Bladeren bron

Simplified the setting of filters in the AbstractPDFStream hierarchy. Instead of unnecessarily re-defining the setupFilterList method, sub-classes just define a getDefaultFilterName method


git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@757712 13f79535-47bb-0310-9956-ffa450edef68
tags/fop-1_0
Vincent Hennebert 15 jaren geleden
bovenliggende
commit
79fb0a5e60

+ 2
- 3
src/java/org/apache/fop/pdf/AbstractPDFFontStream.java Bestand weergeven

@@ -33,9 +33,8 @@ public abstract class AbstractPDFFontStream extends AbstractPDFStream {
}

/** {@inheritDoc} */
protected void setupFilterList() {
addDefaultFilter(PDFFilterList.FONT_FILTER);
super.setupFilterList();
protected String getDefaultFilterName() {
return PDFFilterList.FONT_FILTER;
}

}

+ 11
- 9
src/java/org/apache/fop/pdf/AbstractPDFStream.java Bestand weergeven

@@ -47,21 +47,23 @@ public abstract class AbstractPDFStream extends PDFDictionary {
* from outside.
*/
protected void setupFilterList() {
addDefaultFilter(PDFFilterList.DEFAULT_FILTER);
if (!getFilterList().isInitialized()) {
getFilterList().addDefaultFilters(
getDocumentSafely().getFilterMap(),
getDefaultFilterName());
}
prepareImplicitFilters();
getDocument().applyEncryption(this);
}

/**
* Adds the default filter to the filter list if the filter list hasn't been initialized, yet.
* @param filterName the name of the default filter to use
* Returns the name of a suitable filter for this PDF object.
*
* @return the default filter
* @see PDFFilterList
*/
protected void addDefaultFilter(String filterName) {
if (!getFilterList().isInitialized()) {
getFilterList().addDefaultFilters(
getDocumentSafely().getFilterMap(),
filterName);
}
protected String getDefaultFilterName() {
return PDFFilterList.DEFAULT_FILTER;
}

/**

+ 3
- 6
src/java/org/apache/fop/pdf/PDFImageXObject.java Bestand weergeven

@@ -159,14 +159,11 @@ public class PDFImageXObject extends PDFXObject {
}

/**
* This sets up the default filters for XObjects. It uses the PDFImage
* instance to determine what default filters to apply.
* {@inheritDoc}
* This class uses the PDFImage instance to determine the default filter.
*/
protected void setupFilterList() {
addDefaultFilter(pdfimage.getFilterHint());
super.setupFilterList();
protected String getDefaultFilterName() {
return pdfimage.getFilterHint();
}


}

+ 2
- 3
src/java/org/apache/fop/pdf/PDFMetadata.java Bestand weergeven

@@ -59,9 +59,8 @@ public class PDFMetadata extends PDFStream {
}

/** {@inheritDoc} */
protected void setupFilterList() {
addDefaultFilter(PDFFilterList.METADATA_FILTER);
super.setupFilterList();
protected String getDefaultFilterName() {
return PDFFilterList.METADATA_FILTER;
}

/**

Laden…
Annuleren
Opslaan