git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@757256 13f79535-47bb-0310-9956-ffa450edef68tags/fop-1_0
@@ -26,6 +26,7 @@ import org.xml.sax.Locator; | |||
import org.apache.fop.apps.FOPException; | |||
import org.apache.fop.datatypes.FODimension; | |||
import org.apache.fop.datatypes.Numeric; | |||
import org.apache.fop.datatypes.PercentBaseContext; | |||
import org.apache.fop.fo.FONode; | |||
import org.apache.fop.fo.FObj; | |||
import org.apache.fop.fo.PropertyList; | |||
@@ -130,6 +131,24 @@ public abstract class Region extends FObj { | |||
|| name.equals("xsl-footnote-separator")); | |||
} | |||
/** | |||
* Get the page-width context | |||
* @param lengthBase the lengthBase to use for resolving percentages | |||
* @return context for the width of the page-reference-area | |||
*/ | |||
protected PercentBaseContext getPageWidthContext(int lengthBase) { | |||
return layoutMaster.getPageWidthContext(lengthBase); | |||
} | |||
/** | |||
* Get the page-width context | |||
* @param lengthBase the lengthBase to use for resolving percentages | |||
* @return context for the width of the page-reference-area | |||
*/ | |||
protected PercentBaseContext getPageHeightContext(int lengthBase) { | |||
return layoutMaster.getPageHeightContext(lengthBase); | |||
} | |||
/** {@inheritDoc} */ | |||
public boolean generatesReferenceAreas() { | |||
return true; |
@@ -26,7 +26,7 @@ import java.awt.Rectangle; | |||
import org.apache.fop.fo.FONode; | |||
import org.apache.fop.datatypes.FODimension; | |||
import org.apache.fop.datatypes.LengthBase; | |||
import org.apache.fop.datatypes.SimplePercentBaseContext; | |||
import org.apache.fop.datatypes.PercentBaseContext; | |||
/** | |||
* Class modelling the <a href="http://www.w3.org/TR/xsl/#fo_region-after"> | |||
@@ -48,25 +48,9 @@ public class RegionAfter extends RegionBA { | |||
/* Special rules apply to resolving extent as values are resolved relative | |||
* to the page size and reference orientation. | |||
*/ | |||
SimplePercentBaseContext pageWidthContext; | |||
SimplePercentBaseContext pageHeightContext; | |||
if (spm.getReferenceOrientation() % 180 == 0) { | |||
pageWidthContext = new SimplePercentBaseContext(null, | |||
LengthBase.CUSTOM_BASE, | |||
spm.getPageWidth().getValue()); | |||
pageHeightContext = new SimplePercentBaseContext(null, | |||
LengthBase.CUSTOM_BASE, | |||
spm.getPageHeight().getValue()); | |||
} else { | |||
// invert width and height since top left are rotated by 90 (cl or ccl) | |||
pageWidthContext = new SimplePercentBaseContext(null, | |||
LengthBase.CUSTOM_BASE, | |||
spm.getPageHeight().getValue()); | |||
pageHeightContext = new SimplePercentBaseContext(null, | |||
LengthBase.CUSTOM_BASE, | |||
spm.getPageWidth().getValue()); | |||
} | |||
SimplePercentBaseContext neighbourContext; | |||
PercentBaseContext pageWidthContext = getPageWidthContext(LengthBase.CUSTOM_BASE); | |||
PercentBaseContext pageHeightContext = getPageHeightContext(LengthBase.CUSTOM_BASE); | |||
PercentBaseContext neighbourContext; | |||
Rectangle vpRect; | |||
if (spm.getWritingMode() == EN_LR_TB || spm.getWritingMode() == EN_RL_TB) { | |||
neighbourContext = pageWidthContext; |
@@ -27,7 +27,7 @@ import org.apache.fop.datatypes.FODimension; | |||
import org.apache.fop.datatypes.Length; | |||
import org.apache.fop.datatypes.LengthBase; | |||
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.PropertyList; | |||
import org.apache.fop.fo.properties.CommonMarginBlock; | |||
@@ -106,24 +106,8 @@ public class RegionBody extends Region { | |||
* Also the values are resolved relative to the page size | |||
* and reference orientation. | |||
*/ | |||
SimplePercentBaseContext pageWidthContext; | |||
SimplePercentBaseContext pageHeightContext; | |||
if (spm.getReferenceOrientation() % 180 == 0) { | |||
pageWidthContext = new SimplePercentBaseContext(null, | |||
LengthBase.CONTAINING_BLOCK_WIDTH, | |||
spm.getPageWidth().getValue()); | |||
pageHeightContext = new SimplePercentBaseContext(null, | |||
LengthBase.CONTAINING_BLOCK_WIDTH, | |||
spm.getPageHeight().getValue()); | |||
} else { | |||
// invert width and height since top left are rotated by 90 (cl or ccl) | |||
pageWidthContext = new SimplePercentBaseContext(null, | |||
LengthBase.CONTAINING_BLOCK_WIDTH, | |||
spm.getPageHeight().getValue()); | |||
pageHeightContext = new SimplePercentBaseContext(null, | |||
LengthBase.CONTAINING_BLOCK_WIDTH, | |||
spm.getPageWidth().getValue()); | |||
} | |||
PercentBaseContext pageWidthContext = getPageWidthContext(LengthBase.CONTAINING_BLOCK_WIDTH); | |||
PercentBaseContext pageHeightContext = getPageHeightContext(LengthBase.CONTAINING_BLOCK_WIDTH); | |||
int start; | |||
int end; |
@@ -26,7 +26,7 @@ import java.awt.Rectangle; | |||
import org.apache.fop.fo.FONode; | |||
import org.apache.fop.datatypes.FODimension; | |||
import org.apache.fop.datatypes.LengthBase; | |||
import org.apache.fop.datatypes.SimplePercentBaseContext; | |||
import org.apache.fop.datatypes.PercentBaseContext; | |||
/** | |||
* Class modelling the <a href="http://www.w3.org/TR/xsl/#fo_region-end"> | |||
@@ -48,25 +48,9 @@ public class RegionEnd extends RegionSE { | |||
/* Special rules apply to resolving extent as values are resolved relative | |||
* to the page size and reference orientation. | |||
*/ | |||
SimplePercentBaseContext pageWidthContext; | |||
SimplePercentBaseContext pageHeightContext; | |||
if (spm.getReferenceOrientation() % 180 == 0) { | |||
pageWidthContext = new SimplePercentBaseContext(null, | |||
LengthBase.CUSTOM_BASE, | |||
spm.getPageWidth().getValue()); | |||
pageHeightContext = new SimplePercentBaseContext(null, | |||
LengthBase.CUSTOM_BASE, | |||
spm.getPageHeight().getValue()); | |||
} else { | |||
// invert width and height since top left are rotated by 90 (cl or ccl) | |||
pageWidthContext = new SimplePercentBaseContext(null, | |||
LengthBase.CUSTOM_BASE, | |||
spm.getPageHeight().getValue()); | |||
pageHeightContext = new SimplePercentBaseContext(null, | |||
LengthBase.CUSTOM_BASE, | |||
spm.getPageWidth().getValue()); | |||
} | |||
SimplePercentBaseContext neighbourContext; | |||
PercentBaseContext pageWidthContext = getPageWidthContext(LengthBase.CUSTOM_BASE); | |||
PercentBaseContext pageHeightContext = getPageHeightContext(LengthBase.CUSTOM_BASE); | |||
PercentBaseContext neighbourContext; | |||
Rectangle vpRect; | |||
if (spm.getWritingMode() == EN_LR_TB || spm.getWritingMode() == EN_RL_TB) { | |||
neighbourContext = pageHeightContext; |
@@ -26,7 +26,7 @@ import java.awt.Rectangle; | |||
import org.apache.fop.fo.FONode; | |||
import org.apache.fop.datatypes.FODimension; | |||
import org.apache.fop.datatypes.LengthBase; | |||
import org.apache.fop.datatypes.SimplePercentBaseContext; | |||
import org.apache.fop.datatypes.PercentBaseContext; | |||
/** | |||
* Class modelling the <a href="http://www.w3.org/TR/xsl/#fo_region-start"> | |||
@@ -48,25 +48,9 @@ public class RegionStart extends RegionSE { | |||
/* Special rules apply to resolving extent as values are resolved relative | |||
* to the page size and reference orientation. | |||
*/ | |||
SimplePercentBaseContext pageWidthContext; | |||
SimplePercentBaseContext pageHeightContext; | |||
if (spm.getReferenceOrientation() % 180 == 0) { | |||
pageWidthContext = new SimplePercentBaseContext(null, | |||
LengthBase.CUSTOM_BASE, | |||
spm.getPageWidth().getValue()); | |||
pageHeightContext = new SimplePercentBaseContext(null, | |||
LengthBase.CUSTOM_BASE, | |||
spm.getPageHeight().getValue()); | |||
} else { | |||
// invert width and height since top left are rotated by 90 (cl or ccl) | |||
pageWidthContext = new SimplePercentBaseContext(null, | |||
LengthBase.CUSTOM_BASE, | |||
spm.getPageHeight().getValue()); | |||
pageHeightContext = new SimplePercentBaseContext(null, | |||
LengthBase.CUSTOM_BASE, | |||
spm.getPageWidth().getValue()); | |||
} | |||
SimplePercentBaseContext neighbourContext; | |||
PercentBaseContext pageWidthContext = getPageWidthContext(LengthBase.CUSTOM_BASE); | |||
PercentBaseContext pageHeightContext = getPageHeightContext(LengthBase.CUSTOM_BASE); | |||
PercentBaseContext neighbourContext; | |||
Rectangle vpRect; | |||
if (spm.getWritingMode() == EN_LR_TB || spm.getWritingMode() == EN_RL_TB) { | |||
neighbourContext = pageHeightContext; |
@@ -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; | |||
@@ -194,6 +196,44 @@ public class SimplePageMaster extends FObj { | |||
regions.put(key, region); | |||
} | |||
/** | |||
* 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 |