aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org/apache/fop/layoutmgr
diff options
context:
space:
mode:
Diffstat (limited to 'src/java/org/apache/fop/layoutmgr')
-rw-r--r--src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java3
-rw-r--r--src/java/org/apache/fop/layoutmgr/AddLMVisitor.java29
-rw-r--r--src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java8
-rw-r--r--src/java/org/apache/fop/layoutmgr/PageLayoutManager.java11
4 files changed, 26 insertions, 25 deletions
diff --git a/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java b/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java
index cc8f85d07..750b5f87b 100644
--- a/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/AbstractLayoutManager.java
@@ -56,6 +56,7 @@ import org.apache.fop.fo.flow.Marker;
import org.apache.fop.area.Area;
import org.apache.fop.area.Resolveable;
import org.apache.fop.area.PageViewport;
+import org.apache.fop.fo.Constants;
import org.apache.fop.fo.PropertyManager;
import org.apache.avalon.framework.logger.Logger;
@@ -66,7 +67,7 @@ import java.util.Map;
/**
* The base class for all LayoutManagers.
*/
-public abstract class AbstractLayoutManager implements LayoutProcessor {
+public abstract class AbstractLayoutManager implements LayoutProcessor, Constants {
protected FOUserAgent userAgent;
protected LayoutProcessor parentLM = null;
protected FObj fobj;
diff --git a/src/java/org/apache/fop/layoutmgr/AddLMVisitor.java b/src/java/org/apache/fop/layoutmgr/AddLMVisitor.java
index 908537d05..c502d71b7 100644
--- a/src/java/org/apache/fop/layoutmgr/AddLMVisitor.java
+++ b/src/java/org/apache/fop/layoutmgr/AddLMVisitor.java
@@ -73,6 +73,7 @@ import org.apache.fop.area.inline.UnresolvedPageNumber;
import org.apache.fop.area.inline.Viewport;
import org.apache.fop.area.inline.TextArea;
import org.apache.fop.datatypes.Length;
+import org.apache.fop.fo.Constants;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FOText;
import org.apache.fop.fo.FOTreeVisitor;
@@ -352,7 +353,7 @@ public class AddLMVisitor implements FOTreeVisitor {
};
lm.setUserAgent(node.getUserAgent());
lm.setFObj(node);
- lm.setAlignment(node.propertyList.get("leader-alignment").getEnum());
+ lm.setAlignment(node.propertyList.get(Constants.PR_LEADER_ALIGNMENT).getEnum());
currentLMList.add(lm);
}
@@ -460,7 +461,7 @@ public class AddLMVisitor implements FOTreeVisitor {
}
public InlineArea getCharacterInlineArea(Character node) {
- String str = node.propertyList.get("character").getString();
+ String str = node.propertyList.get(Constants.PR_CHARACTER).getString();
if (str.length() == 1) {
org.apache.fop.area.inline.Character ch =
new org.apache.fop.area.inline.Character(
@@ -482,7 +483,7 @@ public class AddLMVisitor implements FOTreeVisitor {
lm.setUserAgent(node.getUserAgent());
lm.setFObj(node);
lm.setCurrentArea(area);
- lm.setAlignment(node.propertyList.get("vertical-align").getEnum());
+ lm.setAlignment(node.propertyList.get(Constants.PR_VERTICAL_ALIGN).getEnum());
lm.setLead(node.getViewHeight());
currentLMList.add(lm);
}
@@ -520,7 +521,7 @@ public class AddLMVisitor implements FOTreeVisitor {
BlockContainerLayoutManager blm = new BlockContainerLayoutManager();
blm.setUserAgent(node.getUserAgent());
blm.setFObj(node);
- blm.setOverflow(node.propertyList.get("overflow").getEnum());
+ blm.setOverflow(node.propertyList.get(Constants.PR_OVERFLOW).getEnum());
currentLMList.add(blm);
}
@@ -538,7 +539,7 @@ public class AddLMVisitor implements FOTreeVisitor {
lm.setUserAgent(node.getUserAgent());
lm.setFObj(node);
lm.setCurrentArea(areaCurrent);
- lm.setAlignment(node.propertyList.get("vertical-align").getEnum());
+ lm.setAlignment(node.propertyList.get(Constants.PR_VERTICAL_ALIGN).getEnum());
lm.setLead(areaCurrent.getHeight());
currentLMList.add(lm);
}
@@ -580,27 +581,27 @@ public class AddLMVisitor implements FOTreeVisitor {
int ipd = -1;
boolean bpdauto = false;
if (hasLH) {
- bpd = node.propertyList.get("line-height").getLength().getValue();
+ bpd = node.propertyList.get(Constants.PR_LINE_HEIGHT).getLength().getValue();
} else {
// this property does not apply when the line-height applies
// isn't the block-progression-dimension always in the same
// direction as the line height?
- len = node.propertyList.get("block-progression-dimension.optimum").getLength();
+ len = node.propertyList.get(Constants.PR_BLOCK_PROGRESSION_DIMENSION | Constants.CP_OPTIMUM).getLength();
if (!len.isAuto()) {
bpd = len.getValue();
} else {
- len = node.propertyList.get("height").getLength();
+ len = node.propertyList.get(Constants.PR_HEIGHT).getLength();
if (!len.isAuto()) {
bpd = len.getValue();
}
}
}
- len = node.propertyList.get("inline-progression-dimension.optimum").getLength();
+ len = node.propertyList.get(Constants.PR_INLINE_PROGRESSION_DIMENSION | Constants.CP_OPTIMUM).getLength();
if (!len.isAuto()) {
ipd = len.getValue();
} else {
- len = node.propertyList.get("width").getLength();
+ len = node.propertyList.get(Constants.PR_WIDTH).getLength();
if (!len.isAuto()) {
ipd = len.getValue();
}
@@ -610,7 +611,7 @@ public class AddLMVisitor implements FOTreeVisitor {
// to the content-height and content-width
int cwidth = -1;
int cheight = -1;
- len = node.propertyList.get("content-width").getLength();
+ len = node.propertyList.get(Constants.PR_CONTENT_WIDTH).getLength();
if (!len.isAuto()) {
/*if(len.scaleToFit()) {
if(ipd != -1) {
@@ -619,7 +620,7 @@ public class AddLMVisitor implements FOTreeVisitor {
} else {*/
cwidth = len.getValue();
}
- len = node.propertyList.get("content-height").getLength();
+ len = node.propertyList.get(Constants.PR_CONTENT_HEIGHT).getLength();
if (!len.isAuto()) {
/*if(len.scaleToFit()) {
if(bpd != -1) {
@@ -642,7 +643,7 @@ public class AddLMVisitor implements FOTreeVisitor {
if (cheight == -1) {
cheight = (int)size.getY() * 1000;
}
- int scaling = node.propertyList.get("scaling").getEnum();
+ int scaling = node.propertyList.get(Constants.PR_SCALING).getEnum();
if (scaling == Scaling.UNIFORM) {
// adjust the larger
double rat1 = cwidth / (size.getX() * 1000f);
@@ -664,7 +665,7 @@ public class AddLMVisitor implements FOTreeVisitor {
boolean clip = false;
if (cwidth > ipd || cheight > bpd) {
- int overflow = node.propertyList.get("overflow").getEnum();
+ int overflow = node.propertyList.get(Constants.PR_OVERFLOW).getEnum();
if (overflow == Overflow.HIDDEN) {
clip = true;
} else if (overflow == Overflow.ERROR_IF_OVERFLOW) {
diff --git a/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java b/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
index 189d28c67..86870754a 100644
--- a/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
@@ -107,14 +107,14 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager {
absoluteCTM = CTM.getCTMandRelDims(pm.getAbsRefOrient(),
pm.getWritingMode(), rect, relDims);
}
- height = pm.getPropertyList().get("height").getLength();
- width = pm.getPropertyList().get("width").getLength();
+ height = pm.getPropertyList().get(PR_HEIGHT).getLength();
+ width = pm.getPropertyList().get(PR_WIDTH).getLength();
}
protected int getRotatedIPD() {
PropertyList props = propManager.getPropertyList();
- int height = props.get("height").getLength().getValue();
- height = props.get("inline-progression-dimension.optimum").getLength().getValue();
+ int height = props.get(PR_HEIGHT).getLength().getValue();
+ height = props.get(PR_INLINE_PROGRESSION_DIMENSION | CP_OPTIMUM).getLength().getValue();
return height;
}
diff --git a/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java b/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java
index bdc72a8ad..37becb59a 100644
--- a/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java
@@ -70,8 +70,8 @@ import org.apache.fop.area.Resolveable;
import org.apache.fop.datatypes.FODimension;
+import org.apache.fop.fo.Constants;
import org.apache.fop.fo.flow.Marker;
-
import org.apache.fop.fo.pagination.PageNumberGenerator;
import org.apache.fop.fo.pagination.PageSequence;
import org.apache.fop.fo.pagination.Region;
@@ -81,7 +81,6 @@ import org.apache.fop.fo.pagination.StaticContent;
import org.apache.fop.fo.properties.CommonBackground;
import org.apache.fop.fo.properties.CommonBorderAndPadding;
import org.apache.fop.fo.properties.CommonMarginBlock;
-import org.apache.fop.fo.Constants;
import org.apache.fop.fo.properties.Overflow;
import java.util.ArrayList;
@@ -770,9 +769,9 @@ public class PageLayoutManager extends AbstractLayoutManager implements Runnable
private PageViewport createPageAreas(SimplePageMaster spm) {
int pageWidth =
- spm.propertyList.get("page-width").getLength().getValue();
+ spm.propertyList.get(PR_PAGE_WIDTH).getLength().getValue();
int pageHeight =
- spm.propertyList.get("page-height").getLength().getValue();
+ spm.propertyList.get(PR_PAGE_HEIGHT).getLength().getValue();
// Get absolute margin properties (top, left, bottom, right)
CommonMarginBlock mProps = spm.getPropertyManager().getMarginProps();
@@ -858,7 +857,7 @@ public class PageLayoutManager extends AbstractLayoutManager implements Runnable
BodyRegion body = new BodyRegion();
setRegionPosition(r, body, absRegVPRect);
int columnCount =
- r.propertyList.get("column-count").getNumber().intValue();
+ r.propertyList.get(PR_COLUMN_COUNT).getNumber().intValue();
if ((columnCount > 1) && (r.overflow == Overflow.SCROLL)) {
// recover by setting 'column-count' to 1. This is allowed but
// not required by the spec.
@@ -869,7 +868,7 @@ public class PageLayoutManager extends AbstractLayoutManager implements Runnable
body.setColumnCount(columnCount);
int columnGap =
- r.propertyList.get("column-gap").getLength().getValue();
+ r.propertyList.get(PR_COLUMN_GAP).getLength().getValue();
body.setColumnGap(columnGap);
return body;
}