aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/fo/pagination
diff options
context:
space:
mode:
Diffstat (limited to 'src/java/org/apache/fop/fo/pagination')
-rw-r--r--src/java/org/apache/fop/fo/pagination/ColorProfile.java6
-rw-r--r--src/java/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java6
-rw-r--r--src/java/org/apache/fop/fo/pagination/PageSequence.java7
-rw-r--r--src/java/org/apache/fop/fo/pagination/Region.java45
-rw-r--r--src/java/org/apache/fop/fo/pagination/RegionAfter.java30
-rw-r--r--src/java/org/apache/fop/fo/pagination/RegionBA.java21
-rw-r--r--src/java/org/apache/fop/fo/pagination/RegionBefore.java30
-rw-r--r--src/java/org/apache/fop/fo/pagination/RegionEnd.java21
-rw-r--r--src/java/org/apache/fop/fo/pagination/RegionSE.java13
-rw-r--r--src/java/org/apache/fop/fo/pagination/RegionStart.java18
10 files changed, 115 insertions, 82 deletions
diff --git a/src/java/org/apache/fop/fo/pagination/ColorProfile.java b/src/java/org/apache/fop/fo/pagination/ColorProfile.java
index eedfabc32..6a483bf49 100644
--- a/src/java/org/apache/fop/fo/pagination/ColorProfile.java
+++ b/src/java/org/apache/fop/fo/pagination/ColorProfile.java
@@ -66,9 +66,9 @@ public class ColorProfile extends FObj {
* object.
*/
protected void endOfNode() throws SAXParseException {
- src = this.propertyList.get(PR_SRC).getString();
- profileName = this.propertyList.get(PR_COLOR_PROFILE_NAME).getString();
- intent = this.propertyList.get(PR_RENDERING_INTENT).getEnum();
+ src = getPropString(PR_SRC);
+ profileName = getPropString(PR_COLOR_PROFILE_NAME);
+ intent = getPropEnum(PR_RENDERING_INTENT);
this.propertyList = null;
}
diff --git a/src/java/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java b/src/java/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java
index 322d3df25..18018eb58 100644
--- a/src/java/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java
+++ b/src/java/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java
@@ -72,9 +72,9 @@ public class ConditionalPageMasterReference extends FObj {
validateParent(parent);
- this.pagePosition = this.propertyList.get(PR_PAGE_POSITION).getEnum();
- this.oddOrEven = this.propertyList.get(PR_ODD_OR_EVEN).getEnum();
- this.blankOrNotBlank = this.propertyList.get(PR_BLANK_OR_NOT_BLANK).getEnum();
+ this.pagePosition = getPropEnum(PR_PAGE_POSITION);
+ this.oddOrEven = getPropEnum(PR_ODD_OR_EVEN);
+ this.blankOrNotBlank = getPropEnum(PR_BLANK_OR_NOT_BLANK);
}
/**
diff --git a/src/java/org/apache/fop/fo/pagination/PageSequence.java b/src/java/org/apache/fop/fo/pagination/PageSequence.java
index 04738468a..57eff5ccd 100644
--- a/src/java/org/apache/fop/fo/pagination/PageSequence.java
+++ b/src/java/org/apache/fop/fo/pagination/PageSequence.java
@@ -276,13 +276,12 @@ public class PageSequence extends FObj {
// get the 'format' properties
this.pageNumberGenerator =
- new PageNumberGenerator(this.propertyList.get(PR_FORMAT).getString(),
+ new PageNumberGenerator(getPropString(PR_FORMAT),
this.propertyList.get(PR_GROUPING_SEPARATOR).getCharacter(),
this.propertyList.get(PR_GROUPING_SIZE).getNumber().intValue(),
- this.propertyList.get(PR_LETTER_VALUE).getEnum());
+ getPropEnum(PR_LETTER_VALUE));
- this.forcePageCount =
- this.propertyList.get(PR_FORCE_PAGE_COUNT).getEnum();
+ this.forcePageCount = getPropEnum(PR_FORCE_PAGE_COUNT);
// this.propertyList.get("country");
// this.propertyList.get("language");
diff --git a/src/java/org/apache/fop/fo/pagination/Region.java b/src/java/org/apache/fop/fo/pagination/Region.java
index 974c71cf8..95a0ec5e2 100644
--- a/src/java/org/apache/fop/fo/pagination/Region.java
+++ b/src/java/org/apache/fop/fo/pagination/Region.java
@@ -43,13 +43,12 @@ public abstract class Region extends FObj {
/** Holds the writing mode */
protected int wm;
- protected int extent = 0;
-
/**
* @see org.apache.fop.fo.FONode#FONode(FONode)
*/
protected Region(FONode parent) {
super(parent);
+ layoutMaster = (SimplePageMaster) parent;
}
/**
@@ -61,31 +60,21 @@ public abstract class Region extends FObj {
// regions may have name, or default
if (null == this.propertyList.get(PR_REGION_NAME)) {
setRegionName(getDefaultRegionName());
- } else if (this.propertyList.get(PR_REGION_NAME).getString().equals("")) {
+ } else if (getPropString(PR_REGION_NAME).equals("")) {
setRegionName(getDefaultRegionName());
} else {
- setRegionName(this.propertyList.get(PR_REGION_NAME).getString());
+ setRegionName(getPropString(PR_REGION_NAME));
// check that name is OK. Not very pretty.
if (isReserved(getRegionName())
&& !getRegionName().equals(getDefaultRegionName())) {
throw new SAXParseException("region-name '" + regionName
+ "' for " + this.getName()
- + " not permitted.", locator);
+ + " is not permitted.", locator);
}
}
- if (parent instanceof SimplePageMaster) {
- layoutMaster = (SimplePageMaster)parent;
- } else {
- throw new SAXParseException(this.getName() + " must be child "
- + "of simple-page-master, not "
- + parent.getName(), locator);
- }
- this.wm = this.propertyList.get(PR_WRITING_MODE).getEnum();
-
- // this.propertyList.get("clip");
- // this.propertyList.get("display-align");
- this.overflow = this.propertyList.get(PR_OVERFLOW).getEnum();
+ this.wm = getPropEnum(PR_WRITING_MODE);
+ this.overflow = getPropEnum(PR_OVERFLOW);
}
/**
@@ -123,14 +112,6 @@ public abstract class Region extends FObj {
}
/**
- * Returns the page master associated with this region.
- * @return a simple-page-master
- */
- protected SimplePageMaster getPageMaster() {
- return this.layoutMaster;
- }
-
- /**
* Checks to see if a given region name is one of the reserved names
*
* @param name a region name to check
@@ -159,18 +140,6 @@ public abstract class Region extends FObj {
*/
protected Region getSiblingRegion(int regionId) {
// Ask parent for region
- return layoutMaster.getRegion(regionId);
- }
-
- /**
- * Indicates if this region gets precedence.
- * @return True if it gets precedence
- */
- public boolean getPrecedence() {
- return false;
- }
-
- public int getExtent() {
- return extent;
+ return layoutMaster.getRegion(regionId);
}
}
diff --git a/src/java/org/apache/fop/fo/pagination/RegionAfter.java b/src/java/org/apache/fop/fo/pagination/RegionAfter.java
index 55dadce6e..199c2c0dc 100644
--- a/src/java/org/apache/fop/fo/pagination/RegionAfter.java
+++ b/src/java/org/apache/fop/fo/pagination/RegionAfter.java
@@ -21,6 +21,10 @@ package org.apache.fop.fo.pagination;
// Java
import java.awt.Rectangle;
+// XML
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXParseException;
+
// FOP
import org.apache.fop.fo.FONode;
import org.apache.fop.datatypes.FODimension;
@@ -30,6 +34,9 @@ import org.apache.fop.datatypes.FODimension;
*/
public class RegionAfter extends RegionBA {
+ private int extent = 0;
+ private boolean precedence = false;
+
/**
* @see org.apache.fop.fo.FONode#FONode(FONode)
*/
@@ -38,17 +45,34 @@ public class RegionAfter extends RegionBA {
}
/**
+ * @see org.apache.fop.fo.FObj#addProperties
+ */
+ protected void addProperties(Attributes attlist) throws SAXParseException {
+ super.addProperties(attlist);
+ extent = getPropLength(PR_EXTENT);
+ precedence = (getPropEnum(PR_PRECEDENCE) == Precedence.TRUE);
+ }
+
+ /**
+ * Indicates if this region gets precedence.
+ * @return True if it gets precedence
+ */
+ public boolean getPrecedence() {
+ return precedence;
+ }
+
+ /**
* @see org.apache.fop.fo.pagination.Region#getViewportRectangle(FODimension)
*/
public Rectangle getViewportRectangle (FODimension reldims) {
// Depends on extent, precedence ans writing mode
Rectangle vpRect;
if (this.wm == WritingMode.LR_TB || this.wm == WritingMode.RL_TB) {
- vpRect = new Rectangle(0, reldims.bpd - getExtent(), reldims.ipd, getExtent());
+ vpRect = new Rectangle(0, reldims.bpd - extent, reldims.ipd, extent);
} else {
- vpRect = new Rectangle(0, reldims.bpd - getExtent(), getExtent(), reldims.ipd);
+ vpRect = new Rectangle(0, reldims.bpd - extent, extent, reldims.ipd);
}
- if (getPrecedence() == false) {
+ if (precedence == false) {
adjustIPD(vpRect, this.wm);
}
return vpRect;
diff --git a/src/java/org/apache/fop/fo/pagination/RegionBA.java b/src/java/org/apache/fop/fo/pagination/RegionBA.java
index 0e670d59c..57273828f 100644
--- a/src/java/org/apache/fop/fo/pagination/RegionBA.java
+++ b/src/java/org/apache/fop/fo/pagination/RegionBA.java
@@ -33,8 +33,6 @@ import org.apache.fop.fo.FONode;
*/
public abstract class RegionBA extends Region {
- private boolean bPrecedence;
-
/**
* @see org.apache.fop.fo.FONode#FONode(FONode)
*/
@@ -42,20 +40,11 @@ public abstract class RegionBA extends Region {
super(parent);
}
- protected void addProperties(Attributes attlist) throws SAXParseException {
- super.addProperties(attlist);
-
- bPrecedence =
- (this.propertyList.get(PR_PRECEDENCE).getEnum() == Precedence.TRUE);
-
- this.extent = getPropLength(PR_EXTENT);
- }
-
/**
- * @see org.apache.fop.fo.pagination.Region#getPrecedence()
+ * @see org.apache.fop.fo.FObj#addProperties
*/
- public boolean getPrecedence() {
- return bPrecedence;
+ protected void addProperties(Attributes attlist) throws SAXParseException {
+ super.addProperties(attlist);
}
/**
@@ -71,12 +60,12 @@ public abstract class RegionBA extends Region {
int offset = 0;
Region start = getSiblingRegion(FO_REGION_START);
if (start != null) {
- offset = start.getExtent();
+ offset = start.getPropLength(PR_EXTENT);
vpRefRect.translate(offset, 0);
}
Region end = getSiblingRegion(FO_REGION_END);
if (end != null) {
- offset += end.getExtent();
+ offset += end.getPropLength(PR_EXTENT);
}
if (offset > 0) {
if (wm == WritingMode.LR_TB || wm == WritingMode.RL_TB) {
diff --git a/src/java/org/apache/fop/fo/pagination/RegionBefore.java b/src/java/org/apache/fop/fo/pagination/RegionBefore.java
index 222e0fbac..1315c2c04 100644
--- a/src/java/org/apache/fop/fo/pagination/RegionBefore.java
+++ b/src/java/org/apache/fop/fo/pagination/RegionBefore.java
@@ -21,6 +21,10 @@ package org.apache.fop.fo.pagination;
// Java
import java.awt.Rectangle;
+// XML
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXParseException;
+
// FOP
import org.apache.fop.datatypes.FODimension;
import org.apache.fop.fo.FONode;
@@ -30,6 +34,9 @@ import org.apache.fop.fo.FONode;
*/
public class RegionBefore extends RegionBA {
+ private int extent = 0;
+ private boolean precedence = false;
+
/**
* @see org.apache.fop.fo.FONode#FONode(FONode)
*/
@@ -38,6 +45,23 @@ public class RegionBefore extends RegionBA {
}
/**
+ * @see org.apache.fop.fo.FObj#addProperties
+ */
+ protected void addProperties(Attributes attlist) throws SAXParseException {
+ super.addProperties(attlist);
+ extent = getPropLength(PR_EXTENT);
+ precedence = (getPropEnum(PR_PRECEDENCE) == Precedence.TRUE);
+ }
+
+ /**
+ * Indicates if this region gets precedence.
+ * @return True if it gets precedence
+ */
+ public boolean getPrecedence() {
+ return precedence;
+ }
+
+ /**
* @see org.apache.fop.fo.pagination.Region#getDefaultRegionName()
*/
protected String getDefaultRegionName() {
@@ -56,11 +80,11 @@ public class RegionBefore extends RegionBA {
// ipd depends on precedence, bpd=extent
Rectangle vpRect;
if (this.wm == WritingMode.LR_TB || this.wm == WritingMode.RL_TB) {
- vpRect = new Rectangle(0, 0, reldims.ipd, getExtent());
+ vpRect = new Rectangle(0, 0, reldims.ipd, extent);
} else {
- vpRect = new Rectangle(0, 0, getExtent(), reldims.ipd);
+ vpRect = new Rectangle(0, 0, extent, reldims.ipd);
}
- if (getPrecedence() == false) {
+ if (precedence == false) {
adjustIPD(vpRect, this.wm);
}
return vpRect;
diff --git a/src/java/org/apache/fop/fo/pagination/RegionEnd.java b/src/java/org/apache/fop/fo/pagination/RegionEnd.java
index 25eb93843..3636dfc7a 100644
--- a/src/java/org/apache/fop/fo/pagination/RegionEnd.java
+++ b/src/java/org/apache/fop/fo/pagination/RegionEnd.java
@@ -21,6 +21,10 @@ package org.apache.fop.fo.pagination;
// Java
import java.awt.Rectangle;
+// XML
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXParseException;
+
// FOP
import org.apache.fop.fo.FONode;
import org.apache.fop.datatypes.FODimension;
@@ -30,6 +34,7 @@ import org.apache.fop.datatypes.FODimension;
*/
public class RegionEnd extends RegionSE {
+ private int extent = 0;
/**
* @see org.apache.fop.fo.FONode#FONode(FONode)
@@ -39,17 +44,25 @@ public class RegionEnd extends RegionSE {
}
/**
+ * @see org.apache.fop.fo.FObj#addProperties
+ */
+ protected void addProperties(Attributes attlist) throws SAXParseException {
+ super.addProperties(attlist);
+ extent = getPropLength(PR_EXTENT);
+ }
+
+ /**
* @see org.apache.fop.fo.pagination.Region#getViewportRectangle(FODimension)
*/
public Rectangle getViewportRectangle (FODimension reldims) {
// Depends on extent, precedence and writing mode
Rectangle vpRect;
if (this.wm == WritingMode.LR_TB || this.wm == WritingMode.RL_TB) {
- vpRect = new Rectangle(reldims.ipd - getExtent(), 0,
- getExtent(), reldims.bpd);
+ vpRect = new Rectangle(reldims.ipd - extent, 0,
+ extent, reldims.bpd);
} else {
- vpRect = new Rectangle(reldims.ipd - getExtent(), 0,
- reldims.bpd, getExtent());
+ vpRect = new Rectangle(reldims.ipd - extent, 0,
+ reldims.bpd, extent);
}
adjustIPD(vpRect, this.wm);
return vpRect;
diff --git a/src/java/org/apache/fop/fo/pagination/RegionSE.java b/src/java/org/apache/fop/fo/pagination/RegionSE.java
index 98b8b71f1..21fa704ac 100644
--- a/src/java/org/apache/fop/fo/pagination/RegionSE.java
+++ b/src/java/org/apache/fop/fo/pagination/RegionSE.java
@@ -40,10 +40,11 @@ public abstract class RegionSE extends Region {
super(parent);
}
+ /**
+ * @see org.apache.fop.fo.FObj#addProperties
+ */
protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
-
- this.extent = getPropLength(PR_EXTENT);
}
/**
@@ -58,14 +59,14 @@ public abstract class RegionSE extends Region {
*/
protected void adjustIPD(Rectangle vpRefRect, int wm) {
int offset = 0;
- Region before = getSiblingRegion(FO_REGION_BEFORE);
+ RegionBefore before = (RegionBefore) getSiblingRegion(FO_REGION_BEFORE);
if (before != null && before.getPrecedence()) {
- offset = before.getExtent();
+ offset = before.getPropLength(PR_EXTENT);
vpRefRect.translate(0, offset);
}
- Region after = getSiblingRegion(FO_REGION_AFTER);
+ RegionAfter after = (RegionAfter) getSiblingRegion(FO_REGION_AFTER);
if (after != null && after.getPrecedence()) {
- offset += after.getExtent();
+ offset += after.getPropLength(PR_EXTENT);
}
if (offset > 0) {
if (wm == WritingMode.LR_TB || wm == WritingMode.RL_TB) {
diff --git a/src/java/org/apache/fop/fo/pagination/RegionStart.java b/src/java/org/apache/fop/fo/pagination/RegionStart.java
index 66523e657..f00414934 100644
--- a/src/java/org/apache/fop/fo/pagination/RegionStart.java
+++ b/src/java/org/apache/fop/fo/pagination/RegionStart.java
@@ -21,6 +21,10 @@ package org.apache.fop.fo.pagination;
// Java
import java.awt.Rectangle;
+// XML
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXParseException;
+
// FOP
import org.apache.fop.fo.FONode;
import org.apache.fop.datatypes.FODimension;
@@ -30,6 +34,8 @@ import org.apache.fop.datatypes.FODimension;
*/
public class RegionStart extends RegionSE {
+ private int extent = 0;
+
/**
* @see org.apache.fop.fo.FONode#FONode(FONode)
*/
@@ -38,6 +44,14 @@ public class RegionStart extends RegionSE {
}
/**
+ * @see org.apache.fop.fo.FObj#addProperties
+ */
+ protected void addProperties(Attributes attlist) throws SAXParseException {
+ super.addProperties(attlist);
+ extent = getPropLength(PR_EXTENT);
+ }
+
+ /**
* @see org.apache.fop.fo.pagination.Region#getViewportRectangle(FODimension)
*/
public Rectangle getViewportRectangle (FODimension reldims) {
@@ -46,9 +60,9 @@ public class RegionStart extends RegionSE {
// writing-mode relative coordinates
Rectangle vpRect;
if (this.wm == WritingMode.LR_TB || this.wm == WritingMode.RL_TB) {
- vpRect = new Rectangle(0, 0, getExtent(), reldims.bpd);
+ vpRect = new Rectangle(0, 0, extent, reldims.bpd);
} else {
- vpRect = new Rectangle(0, 0, reldims.bpd, getExtent());
+ vpRect = new Rectangle(0, 0, reldims.bpd, extent);
}
adjustIPD(vpRect, this.wm);
return vpRect;