]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Bugfix: LineArea used a private field instead of the start-indent trait which caused...
authorJeremias Maerki <jeremias@apache.org>
Tue, 24 Jan 2006 13:45:56 +0000 (13:45 +0000)
committerJeremias Maerki <jeremias@apache.org>
Tue, 24 Jan 2006 13:45:56 +0000 (13:45 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@371912 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/area/LineArea.java
src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java

index e19e71374755b15df328ced2fafea22d13e9dbc1..eb2343565469849cf7d10ea439fb1d3e19477f8e 100644 (file)
@@ -57,14 +57,6 @@ public class LineArea extends Area {
     
     private LineAdjustingInfo adjustingInfo = null;
 
-    //private int stacking = LR;
-    // contains inline areas
-    // has start indent and length, dominant baseline, height
-    private int startIndent;
-
-    // this is the offset for the dominant baseline
-    //private int baseLine;
-
     // this class can contain the dominant char styling info
     // this means that many renderers can optimise a bit
 
@@ -121,17 +113,6 @@ public class LineArea extends Area {
         return inlineAreas;
     }
 
-    /**
-     * Set the start indent of this line area.
-     * The start indent is used for offsetting the start of
-     * the inline areas for alignment or other indents.
-     *
-     * @param si the start indent value
-     */
-    public void setStartIndent(int si) {
-        startIndent = si;
-    }
-
     /**
      * Get the start indent of this line area.
      * The start indent is used for offsetting the start of
@@ -140,7 +121,11 @@ public class LineArea extends Area {
      * @return the start indent value
      */
     public int getStartIndent() {
-        return startIndent;
+        if (hasTrait(Trait.START_INDENT)) {
+            return getTraitAsInteger(Trait.START_INDENT);
+        } else {
+            return 0;
+        }
     }
 
     /**
@@ -179,11 +164,11 @@ public class LineArea extends Area {
                 break;
             case Constants.EN_CENTER:
                 // re-compute indent
-                startIndent -= ipdVariation / 2;
+                addTrait(Trait.START_INDENT, new Integer(getStartIndent() - ipdVariation / 2));
                 break;
             case Constants.EN_END:
                 // re-compute indent
-                startIndent -= ipdVariation;
+                addTrait(Trait.START_INDENT, new Integer(getStartIndent() - ipdVariation));
                 break;
             case Constants.EN_JUSTIFY:
                 // compute variation factor
index e3ea556692584b5e3e84b07795aadd262f984c8f..c5d322a82ca76a4f1af99eec9bc1c843849d48e9 100644 (file)
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-/* $Id: LineLayoutManager.java,v 1.17 2004/04/02 10:38:29 cbowditch Exp $ */
+/* $Id$ */
 
 package org.apache.fop.layoutmgr.inline;
 
@@ -1664,7 +1664,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager
               = new LineArea((lbp.getLeafPos() < seq.size() - 1
                               ? textAlignment : textAlignmentLast),
                               lbp.difference, lbp.availableStretch, lbp.availableShrink);
-            lineArea.setStartIndent(lbp.startIndent);
+            lineArea.addTrait(Trait.START_INDENT, new Integer(lbp.startIndent));
             lineArea.setBPD(lbp.lineHeight);
             lineArea.setIPD(lbp.lineWidth);
             lineArea.addTrait(Trait.SPACE_BEFORE, new Integer(lbp.spaceBefore));
@@ -1745,12 +1745,12 @@ public class LineLayoutManager extends InlineStackingLayoutManager
                 // re-compute indent
                 int updatedIndent = lbp.startIndent
                                     + (context.getStackLimit().opt - lbp.lineWidth) / 2;
-                lineArea.setStartIndent(updatedIndent);
+                lineArea.addTrait(Trait.START_INDENT, new Integer(updatedIndent));
             } else if (false && textAlignment == EN_END) {
                 // re-compute indent
                 int updatedIndent = lbp.startIndent 
                                     + (context.getStackLimit().opt - lbp.lineWidth);
-                lineArea.setStartIndent(updatedIndent);
+                lineArea.addTrait(Trait.START_INDENT, new Integer(updatedIndent));
             }
             
             setCurrentArea(lineArea);