jeremias2005/01/07 00:21:21
Modified:src/java/org/apache/fop/fo/properties CommonMarginBlock.java
src/java/org/apache/fop/layoutmgr TraitSetter.java
BlockLayoutManager.java
Log:
Bugfix for start-indent calculation for nested blocks. The inherited
start-indent wasn't taken into account as described in 5.3.2 of the spec.
Minor style and javadoc improvements on the way.
Revision ChangesPath
1.5 +34 -2
xml-fop/src/java/org/apache/fop/fo/properties/CommonMarginBlock.java
Index: CommonMarginBlock.java
===
RCS file:
/home/cvs/xml-fop/src/java/org/apache/fop/fo/properties/CommonMarginBlock.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- CommonMarginBlock.java28 Oct 2004 10:00:24 - 1.4
+++ CommonMarginBlock.java7 Jan 2005 08:21:21 - 1.5
@@ -1,5 +1,5 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -70,6 +70,16 @@
public Length endIndent;
/**
+ * The inherited "start-indent" property.
+ */
+public Length inheritedStartIndent;
+
+/**
+ * The inherited "end-indent" property.
+ */
+public Length inheritedEndIndent;
+
+/**
* Create a CommonMarginBlock object.
* @param pList The PropertyList with propery values.
*/
@@ -84,5 +94,27 @@
startIndent = pList.get(Constants.PR_START_INDENT).getLength();
endIndent = pList.get(Constants.PR_END_INDENT).getLength();
+
+if (!pList.getFObj().generatesReferenceAreas()) {
+inheritedStartIndent = pList.getParentPropertyList()
+.get(Constants.PR_START_INDENT).getLength();
+inheritedEndIndent = pList.getParentPropertyList()
+.get(Constants.PR_END_INDENT).getLength();
+}
+}
+
+/** @see java.lang.Object#toString() */
+public String toString() {
+return "CommonMarginBlock:\n"
++ "Margins (top, bottom, left, right): ("
++ marginTop + ", " + marginBottom + ", "
++ marginLeft + ", " + marginRight + ")\n"
++ "Space (before, after): ("
++ spaceBefore + ", " + spaceAfter + ")\n"
++ "Indents (start, end): ("
++ startIndent + ", " + endIndent + ")\n"
++ "Indents inherited (start, end): ("
++ inheritedStartIndent + ", " + inheritedEndIndent + ")\n";
}
+
}
1.11 +33 -22
xml-fop/src/java/org/apache/fop/layoutmgr/TraitSetter.java
Index: TraitSetter.java
===
RCS file:
/home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/TraitSetter.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- TraitSetter.java 20 Oct 2004 11:55:32 - 1.10
+++ TraitSetter.java 7 Jan 2005 08:21:21 - 1.11
@@ -1,5 +1,5 @@
/*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -33,6 +33,8 @@
* Sets border and padding traits on areas.
* @param area area to set the traits on
* @param bpProps border and padding properties
+ * @param bNotFirst True if the area is not the first area
+ * @param bNotLast True if the area is not the last area
*/
public static void setBorderPaddingTraits(Area area,
CommonBorderPaddingBackground bpProps, boolean bNotFirst,
boolean bNotLast) {
@@ -96,45 +98,45 @@
* Add borders to an area.
* Layout managers that create areas with borders can use this to
* add the borders to the area.
- * @param curBlock area to set the traits on
+ * @param area the area to set the traits on.
* @param bordProps border properties
*/
-public static void addBorders(Area curBlock,
CommonBorderPaddingBackground bordProps) {
+public static void addBorders(Area area, CommonBorderPaddingBackground
bordProps) {
BorderProps bps = getBorderProps(bordProps,
CommonBorderPaddingBackground.BEFORE);
if (bps.width != 0) {
-curBlock.addTrait(Trait.BORDER_BEFORE, bps);
+area.addTrait(Trait.BORDER_BEFORE, bps);
}
bps = getBorderProps(bordProps, CommonBorderPaddingBackground.AFTER);
if (bps.width != 0) {
-curBlock.a