/*
* Copyright 1999-2004 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.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* limitations under the License.
*/
-/* $Id$ */
+/* $Id: BlockLayoutManager.java,v 1.17 2004/05/15 21:51:59 gmazza Exp $ */
package org.apache.fop.layoutmgr;
private CommonMarginBlock marginProps;
/* holds the (one-time use) fo:block space-before
- and -after properties. Large fo:blocks are split
+ and -after properties. Large fo:blocks are split
into multiple Area.Blocks to accomodate the subsequent
- regions (pages) they are placed on. space-before
+ regions (pages) they are placed on. space-before
is applied at the beginning of the first
Block and space-after at the end of the last Block
used in rendering the fo:block.
LayoutManager curLM; // currently active LM
int ipd = context.getRefIPD();
- int iIndents = marginProps.startIndent + marginProps.endIndent;
+ int iIndents = marginProps.startIndent + marginProps.endIndent;
int bIndents = borderProps.getBPPaddingAndBorder(false);
ipd -= iIndents;
// Set context for percentage property values.
fobj.setLayoutDimension(PercentBase.BLOCK_IPD, ipd);
fobj.setLayoutDimension(PercentBase.BLOCK_BPD, -1);
-
+
while ((curLM = getChildLM()) != null) {
// Make break positions and return blocks!
// Set up a LayoutContext
double adjust = layoutContext.getSpaceAdjust();
addBlockSpacing(adjust, foBlockSpaceBefore);
foBlockSpaceBefore = null;
-
+
addID();
addMarkers(true, true);
// Get reference IPD from parentArea
int referenceIPD = parentArea.getIPD();
curBlockArea.setIPD(referenceIPD);
-
+
// Set the width of the block based on the parent block
+ // Need to be careful though, if parent is BC then width may not be set
+ int parentwidth = 0;
if (parentArea instanceof BlockParent) {
- curBlockArea.setWidth(((BlockParent) parentArea).getWidth());
- } else {
- curBlockArea.setWidth(referenceIPD);
+ parentwidth = ((BlockParent) parentArea).getWidth();
+ }
+ if (parentwidth == 0) {
+ parentwidth = referenceIPD;
}
+ curBlockArea.setWidth(parentwidth);
setCurrentArea(curBlockArea); // ??? for generic operations
}
return curBlockArea;