diff options
author | Vincent Hennebert <vhennebert@apache.org> | 2009-03-24 10:46:59 +0000 |
---|---|---|
committer | Vincent Hennebert <vhennebert@apache.org> | 2009-03-24 10:46:59 +0000 |
commit | 79fb0a5e60d927dccdebf8d3b8fe96b649abe6e7 (patch) | |
tree | fc94f6d2e9dc8468ab98ff94c185c0344f9ac626 /src/java | |
parent | c71b4374b1b89486e7103116eaace7c0adf9a84d (diff) | |
download | xmlgraphics-fop-79fb0a5e60d927dccdebf8d3b8fe96b649abe6e7.tar.gz xmlgraphics-fop-79fb0a5e60d927dccdebf8d3b8fe96b649abe6e7.zip |
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
Diffstat (limited to 'src/java')
4 files changed, 18 insertions, 21 deletions
diff --git a/src/java/org/apache/fop/pdf/AbstractPDFFontStream.java b/src/java/org/apache/fop/pdf/AbstractPDFFontStream.java index f3d005bd3..34c9c5dee 100644 --- a/src/java/org/apache/fop/pdf/AbstractPDFFontStream.java +++ b/src/java/org/apache/fop/pdf/AbstractPDFFontStream.java @@ -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; } } diff --git a/src/java/org/apache/fop/pdf/AbstractPDFStream.java b/src/java/org/apache/fop/pdf/AbstractPDFStream.java index fc853b512..4107c7e7a 100644 --- a/src/java/org/apache/fop/pdf/AbstractPDFStream.java +++ b/src/java/org/apache/fop/pdf/AbstractPDFStream.java @@ -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; } /** diff --git a/src/java/org/apache/fop/pdf/PDFImageXObject.java b/src/java/org/apache/fop/pdf/PDFImageXObject.java index a69d9e8de..9ec8f1595 100644 --- a/src/java/org/apache/fop/pdf/PDFImageXObject.java +++ b/src/java/org/apache/fop/pdf/PDFImageXObject.java @@ -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(); } - } diff --git a/src/java/org/apache/fop/pdf/PDFMetadata.java b/src/java/org/apache/fop/pdf/PDFMetadata.java index 5008183ef..92796c0d1 100644 --- a/src/java/org/apache/fop/pdf/PDFMetadata.java +++ b/src/java/org/apache/fop/pdf/PDFMetadata.java @@ -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; } /** |