]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Clean up the handling of startIndent
authorVincent Hennebert <vhennebert@apache.org>
Thu, 2 Aug 2007 09:27:42 +0000 (09:27 +0000)
committerVincent Hennebert <vhennebert@apache.org>
Thu, 2 Aug 2007 09:27:42 +0000 (09:27 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@562053 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java

index 17c8dd2d8429835a2ebbe566060d801d0c4a1ab0..8c8cf12ecbf5dcd7d2f958b9b9e1e4c472ae7cd6 100644 (file)
@@ -69,8 +69,6 @@ public class TableCellLayoutManager extends BlockStackingLayoutManager
     private int cellIPD;
     private int rowHeight;
     private int usedBPD;
-    private int startBorderWidth;
-    private int endBorderWidth;
     private int borderAndPaddingBPD;
     private boolean emptyCell = true;
 
@@ -124,18 +122,21 @@ public class TableCellLayoutManager extends BlockStackingLayoutManager
 
     /** {@inheritDoc} */
     protected int getIPIndents() {
-        int iIndents = 0;
         int[] startEndBorderWidths = primaryGridUnit.getStartEndBorderWidths();
-        startBorderWidth += startEndBorderWidths[0];
-        endBorderWidth += startEndBorderWidths[1];
-        iIndents += startBorderWidth;
-        iIndents += endBorderWidth;
-        if (!isSeparateBorderModel()) {
-            iIndents /= 2;
+        startIndent = startEndBorderWidths[0];
+        endIndent = startEndBorderWidths[1];
+        if (isSeparateBorderModel()) {
+            int borderSep = getTable().getBorderSeparation().getLengthPair().getIPD().getLength()
+                    .getValue(this);
+            startIndent += borderSep / 2;
+            endIndent += borderSep / 2;
+        } else {
+            startIndent /= 2;
+            endIndent /= 2;
         }
-        iIndents += getTableCell().getCommonBorderPaddingBackground().getPaddingStart(false, this);
-        iIndents += getTableCell().getCommonBorderPaddingBackground().getPaddingEnd(false, this);
-        return iIndents;
+        startIndent += getTableCell().getCommonBorderPaddingBackground().getPaddingStart(false, this);
+        endIndent += getTableCell().getCommonBorderPaddingBackground().getPaddingEnd(false, this);
+        return startIndent + endIndent;
     }
 
     /**
@@ -147,11 +148,6 @@ public class TableCellLayoutManager extends BlockStackingLayoutManager
         referenceIPD = context.getRefIPD();
         cellIPD = referenceIPD;
         cellIPD -= getIPIndents();
-        if (isSeparateBorderModel()) {
-            int borderSep = getTable().getBorderSeparation().getLengthPair()
-                    .getIPD().getLength().getValue(this);
-            cellIPD -= borderSep;
-        }
 
         LinkedList returnedList = null;
         LinkedList contentList = new LinkedList();
@@ -461,12 +457,6 @@ public class TableCellLayoutManager extends BlockStackingLayoutManager
             curBlockArea.addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
             TraitSetter.setProducerID(curBlockArea, getTableCell().getId());
             curBlockArea.setPositioning(Block.ABSOLUTE);
-            int indent = startBorderWidth;
-            if (!isSeparateBorderModel()) {
-                indent /= 2;
-            }
-            indent += getTableCell()
-                    .getCommonBorderPaddingBackground().getPaddingStart(false, this);
             // set position
             int borderAdjust = 0;
             if (!isSeparateBorderModel()) {
@@ -479,8 +469,7 @@ public class TableCellLayoutManager extends BlockStackingLayoutManager
                 //borderAdjust += primaryGridUnit.getBorders().getBorderBeforeWidth(false);
             }
             TableLayoutManager tableLM = (TableLayoutManager)getParent();
-            curBlockArea.setXOffset(xoffset + inRowIPDOffset
-                    + tableLM.getHalfBorderSeparationIPD() + indent);
+            curBlockArea.setXOffset(xoffset + inRowIPDOffset + startIndent);
             curBlockArea.setYOffset(yoffset - borderAdjust
                     + tableLM.getHalfBorderSeparationBPD());
             curBlockArea.setIPD(cellIPD);