diff options
author | Andreas L. Delmelle <adelmelle@apache.org> | 2009-03-22 21:08:48 +0000 |
---|---|---|
committer | Andreas L. Delmelle <adelmelle@apache.org> | 2009-03-22 21:08:48 +0000 |
commit | 462737dc5e48cee597e7873829de4247ce481cde (patch) | |
tree | ec63cac64f6a2a906700212d67c7bd78da63e4f4 /src/java/org/apache/fop/fo/pagination/SimplePageMaster.java | |
parent | 3df2eea282cfff325ed544d514524bcccb1c3f2f (diff) | |
download | xmlgraphics-fop-462737dc5e48cee597e7873829de4247ce481cde.tar.gz xmlgraphics-fop-462737dc5e48cee597e7873829de4247ce481cde.zip |
Minor refactoring: extract code-blocks from the Region implementations into protected final method on SimplePageMaster.
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@757256 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/fo/pagination/SimplePageMaster.java')
-rw-r--r-- | src/java/org/apache/fop/fo/pagination/SimplePageMaster.java | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/java/org/apache/fop/fo/pagination/SimplePageMaster.java b/src/java/org/apache/fop/fo/pagination/SimplePageMaster.java index b0ec96406..8c95e1b8a 100644 --- a/src/java/org/apache/fop/fo/pagination/SimplePageMaster.java +++ b/src/java/org/apache/fop/fo/pagination/SimplePageMaster.java @@ -29,6 +29,8 @@ import org.xml.sax.Locator; import org.apache.fop.apps.FOPException; import org.apache.fop.datatypes.Length; import org.apache.fop.datatypes.Numeric; +import org.apache.fop.datatypes.SimplePercentBaseContext; +import org.apache.fop.datatypes.PercentBaseContext; import org.apache.fop.fo.FONode; import org.apache.fop.fo.FObj; import org.apache.fop.fo.PropertyList; @@ -195,6 +197,44 @@ public class SimplePageMaster extends FObj { } /** + * Gets the context for the width of the page-reference-area, + * taking into account the reference-orientation. + * + * @param lengthBase the lengthBase to use to resolve percentages + * @return context for the width of the page-reference-area + */ + protected final PercentBaseContext getPageWidthContext(int lengthBase) { + return (this.referenceOrientation.getValue() % 180 == 0) + ? new SimplePercentBaseContext( + null, + lengthBase, + this.getPageWidth().getValue()) + : new SimplePercentBaseContext( + null, + lengthBase, + this.getPageHeight().getValue()); + } + + /** + * Gets the context for the height of the page-reference-area, + * taking into account the reference-orientation. + * + * @param lengthBase the lengthBase to use to resolve percentages + * @return the context for the height of the page-reference-area + */ + protected final PercentBaseContext getPageHeightContext(int lengthBase) { + return (this.referenceOrientation.getValue() % 180 == 0) + ? new SimplePercentBaseContext( + null, + lengthBase, + this.getPageHeight().getValue()) + : new SimplePercentBaseContext( + null, + lengthBase, + this.getPageWidth().getValue()); + } + + /** * Returns the region for a given region class. * @param regionId Constants ID of the FO representing the region * @return the region, null if it doesn't exist |