]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Set the SPACE_START and SPACE_END traits and adjust the height to take
authorFinn Bock <bckfnn@apache.org>
Thu, 29 Jan 2004 19:43:05 +0000 (19:43 +0000)
committerFinn Bock <bckfnn@apache.org>
Thu, 29 Jan 2004 19:43:05 +0000 (19:43 +0000)
border and padding into account.

PR: 25802.

git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197294 13f79535-47bb-0310-9956-ffa450edef68

src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java

index d63f67c6c924288e0093ac5c7be89aaa935fd9d0..1588c713960173c18e71cc886e405fc737e01c8d 100644 (file)
@@ -58,6 +58,8 @@ import org.apache.fop.area.BlockViewport;
 import org.apache.fop.area.Block;
 import org.apache.fop.fo.PropertyManager;
 import org.apache.fop.fo.properties.CommonAbsolutePosition;
+import org.apache.fop.fo.properties.CommonBorderAndPadding;
+import org.apache.fop.fo.properties.CommonMarginBlock;
 import org.apache.fop.fo.PropertyList;
 import org.apache.fop.area.CTM;
 import org.apache.fop.datatypes.FODimension;
@@ -75,6 +77,8 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager {
     private List childBreaks = new java.util.ArrayList();
 
     private CommonAbsolutePosition abProps;
+    private CommonBorderAndPadding borderProps;
+    private CommonMarginBlock marginProps;
     private FODimension relDims;
     private CTM absoluteCTM;
     private boolean clip = false;
@@ -105,6 +109,8 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager {
             absoluteCTM = CTM.getCTMandRelDims(pm.getAbsRefOrient(),
                 pm.getWritingMode(), rect, relDims);
         }
+        marginProps = pm.getMarginProps();
+        borderProps = pm.getBorderAndPadding();
         height = pm.getPropertyList().get(PR_HEIGHT).getLength();
         width = pm.getPropertyList().get(PR_WIDTH).getLength();
     }
@@ -123,13 +129,16 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager {
             return getAbsoluteBreakPoss(context);
         }
 
+        int bIndents = borderProps.getBPPaddingAndBorder(false);
+        int iIndents = marginProps.startIndent + marginProps.endIndent; 
+
         int ipd = context.getRefIPD();
         int bpd = context.getStackLimit().opt;
         if (!width.isAuto()) {
-            ipd = width.getValue();
+            ipd = width.getValue() + iIndents;
         }
         if (!height.isAuto()) {
-            bpd = height.getValue();
+            bpd = height.getValue() + bIndents;
         }
         Rectangle2D rect = new Rectangle2D.Double(0, 0, ipd, bpd);
         relDims = new FODimension(0, 0);
@@ -137,6 +146,8 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager {
                 propManager.getWritingMode(), rect, relDims);
         double[] vals = absoluteCTM.toArray();
 
+        ipd -= iIndents;
+
         MinOptMax stackLimit;
         boolean rotated = vals[0] == 0.0;
         if (rotated) {
index 2579c0a27bbc643a67c782f66bd2a0ae51298ca9..396cba7dbc307f070195f4946a5547179b68921a 100644 (file)
@@ -63,6 +63,7 @@ import org.apache.fop.area.LineArea;
 import org.apache.fop.traits.LayoutProps;
 import org.apache.fop.fo.properties.CommonBorderAndPadding;
 import org.apache.fop.fo.properties.CommonBackground;
+import org.apache.fop.fo.properties.CommonMarginBlock;
 import org.apache.fop.traits.MinOptMax;
 
 /**
@@ -75,6 +76,7 @@ public class BlockLayoutManager extends BlockStackingLayoutManager {
     private LayoutProps layoutProps;
     private CommonBorderAndPadding borderProps;
     private CommonBackground backgroundProps;
+    private CommonMarginBlock marginProps;
 
     /* holds the (one-time use) fo:block space-before
        and -after properties.  Large fo:blocks are split 
@@ -182,6 +184,7 @@ public class BlockLayoutManager extends BlockStackingLayoutManager {
         layoutProps = pm.getLayoutProps();
         borderProps = pm.getBorderAndPadding();
         backgroundProps = pm.getBackgroundProps();
+        marginProps = pm.getMarginProps();
         foBlockSpaceBefore = layoutProps.spaceBefore.getSpace();
         prevFoBlockSpaceAfter = foBlockSpaceAfter;
     }
@@ -190,8 +193,8 @@ public class BlockLayoutManager extends BlockStackingLayoutManager {
         LayoutProcessor curLM; // currently active LM
 
         int ipd = context.getRefIPD();
-        int iIndents = borderProps.getPaddingStart(false) 
-            + borderProps.getPaddingEnd(false);
+        int iIndents = marginProps.startIndent + marginProps.endIndent; 
+        int bIndents = borderProps.getBPPaddingAndBorder(false);
         ipd -= iIndents;
 
         MinOptMax stackSize = new MinOptMax();
@@ -206,7 +209,7 @@ public class BlockLayoutManager extends BlockStackingLayoutManager {
             // resetting foBlockSpaceBefore = null in addAreas()
             stackSize.add(foBlockSpaceBefore);
         }
-        
+
         BreakPoss lastPos = null;
 
         while ((curLM = getChildLM()) != null) {
@@ -313,6 +316,8 @@ public class BlockLayoutManager extends BlockStackingLayoutManager {
             }
         }
 
+        int bIndents = borderProps.getBPPaddingAndBorder(false);
+        curBlockArea.setHeight(curBlockArea.getHeight() + bIndents);
 
         addMarkers(false, true);
 
@@ -342,6 +347,7 @@ public class BlockLayoutManager extends BlockStackingLayoutManager {
             // set traits
             TraitSetter.addBorders(curBlockArea, borderProps);
             TraitSetter.addBackground(curBlockArea, backgroundProps);
+            TraitSetter.addMargins(curBlockArea, borderProps, marginProps);
 
             // Set up dimensions
             // Must get dimensions from parent area