]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Fully implement the 5.3.2 rules for calculating indent values.
authorFinn Bock <bckfnn@apache.org>
Sun, 10 Oct 2004 21:06:15 +0000 (21:06 +0000)
committerFinn Bock <bckfnn@apache.org>
Sun, 10 Oct 2004 21:06:15 +0000 (21:06 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@198032 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/fo/properties/IndentPropertyMaker.java

index fe029370c8f623f8ad974fcc2ec7719b599e76ef..ed679cb4bcaedc7dc1838124640d21d99aba8c8c 100644 (file)
@@ -69,20 +69,33 @@ public class IndentPropertyMaker extends CorrespondingPropertyMaker {
      * @see CorrespondingPropertyMaker#compute(PropertyList)
      */
     public Property compute(PropertyList propertyList) throws FOPException {
-        // TODO: bckfnn reenable
-        if (propertyList.getExplicitOrShorthand(
-                propertyList.getWritingMode(lr_tb, rl_tb, tb_rl)) == null) {
-            return null;
-        }
+        PropertyList pList = getWMPropertyList(propertyList);
         // Calculate the values as described in 5.3.2.
         try {
+            int marginProp = pList.getWritingMode(lr_tb, rl_tb, tb_rl);
+            Numeric margin;
+//          Calculate the absolute margin.
+            if (propertyList.getExplicitOrShorthand(marginProp) == null) {
+                Property indent = propertyList.getExplicit(baseMaker.propId);
+                if (indent == null) {
+                    margin = new FixedLength(0);
+                } else {
+                    margin = propertyList.getExplicit(baseMaker.propId).getNumeric();
+                    margin = NumericOp.subtraction(margin, propertyList.getInherited(baseMaker.propId).getNumeric());
+                }
+                margin = NumericOp.subtraction(margin, getCorresponding(paddingCorresponding, propertyList).getNumeric());
+                margin = NumericOp.subtraction(margin, getCorresponding(borderWidthCorresponding, propertyList).getNumeric());
+            } else {
+                margin = propertyList.get(marginProp).getNumeric();
+            }
+            
             Numeric v = new FixedLength(0);
             if (!propertyList.getFObj().generatesReferenceAreas()) {
                 // The inherited_value_of([start|end]-indent)
-                v = NumericOp.addition(v, propertyList.getInherited(this.baseMaker.propId).getNumeric());
+                v = NumericOp.addition(v, propertyList.getInherited(baseMaker.propId).getNumeric());
             }
             // The corresponding absolute margin-[right|left}.
-            v = NumericOp.addition(v, propertyList.get(propertyList.getWritingMode(lr_tb, rl_tb, tb_rl)).getNumeric());
+            v = NumericOp.addition(v, margin);
             v = NumericOp.addition(v, getCorresponding(paddingCorresponding, propertyList).getNumeric());
             v = NumericOp.addition(v, getCorresponding(borderWidthCorresponding, propertyList).getNumeric());
             return (Property) v;
@@ -94,7 +107,8 @@ public class IndentPropertyMaker extends CorrespondingPropertyMaker {
     }
     
     private Property getCorresponding(int[] corresponding, PropertyList propertyList) {
-        int wmcorr = propertyList.getWritingMode(corresponding[0], corresponding[1], corresponding[2]);
+        PropertyList pList = getWMPropertyList(propertyList);
+        int wmcorr = pList.getWritingMode(corresponding[0], corresponding[1], corresponding[2]);
         return propertyList.get(wmcorr);
     }
 }