diff options
author | Finn Bock <bckfnn@apache.org> | 2004-02-26 15:47:03 +0000 |
---|---|---|
committer | Finn Bock <bckfnn@apache.org> | 2004-02-26 15:47:03 +0000 |
commit | 02cf7bed6dc6b9b34632c6b2305c47a0809760b1 (patch) | |
tree | 3ea6c3a4a9b996fb2bbd37b83e77b5548f86a827 /src/java/org/apache | |
parent | c3abce87cd7b4c2b37534f7c1516dfb9417faa10 (diff) | |
download | xmlgraphics-fop-02cf7bed6dc6b9b34632c6b2305c47a0809760b1.tar.gz xmlgraphics-fop-02cf7bed6dc6b9b34632c6b2305c47a0809760b1.zip |
Use the new property expressions. Clients must use Length when retrieving
a length and must delay the call to Length.getValue() until the
baselength has been assigned by the LayoutManagers.
PR: 26778 (second half)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197382 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache')
14 files changed, 137 insertions, 58 deletions
diff --git a/src/java/org/apache/fop/fo/FOPropertyMapping.java b/src/java/org/apache/fop/fo/FOPropertyMapping.java index 7703121e8..761c00cc4 100644 --- a/src/java/org/apache/fop/fo/FOPropertyMapping.java +++ b/src/java/org/apache/fop/fo/FOPropertyMapping.java @@ -304,6 +304,7 @@ public class FOPropertyMapping implements Constants { genericPadding = new LengthProperty.Maker(0); genericPadding.setInherited(false); genericPadding.setDefault("0pt"); + genericPadding.setPercentBase(LengthBase.BLOCK_WIDTH); genericPadding.addShorthand(s_generics[PR_PADDING]); // GenericCondBorderWidth @@ -1189,6 +1190,7 @@ public class FOPropertyMapping implements Constants { m.setInherited(false); m.setDefault("0pt"); m.addShorthand(s_generics[PR_MARGIN]); + m.setPercentBase(LengthBase.BLOCK_WIDTH); addPropertyMaker("margin-top", m); // margin-bottom @@ -1196,6 +1198,7 @@ public class FOPropertyMapping implements Constants { m.setInherited(false); m.setDefault("0pt"); m.addShorthand(s_generics[PR_MARGIN]); + m.setPercentBase(LengthBase.BLOCK_WIDTH); addPropertyMaker("margin-bottom", m); // margin-left @@ -1203,6 +1206,7 @@ public class FOPropertyMapping implements Constants { m.setInherited(false); m.setDefault("0pt"); m.addShorthand(s_generics[PR_MARGIN]); + m.setPercentBase(LengthBase.BLOCK_WIDTH); addPropertyMaker("margin-left", m); // margin-right @@ -1210,6 +1214,7 @@ public class FOPropertyMapping implements Constants { m.setInherited(false); m.setDefault("0pt"); m.addShorthand(s_generics[PR_MARGIN]); + m.setPercentBase(LengthBase.BLOCK_WIDTH); addPropertyMaker("margin-right", m); // space-before @@ -1343,6 +1348,7 @@ public class FOPropertyMapping implements Constants { // block-progression-dimension m = new LengthRangeProperty.Maker(PR_BLOCK_PROGRESSION_DIMENSION); m.setInherited(false); + m.setPercentBase(LengthBase.BLOCK_HEIGHT); l = new LengthProperty.Maker(CP_MINIMUM); l.setDefault("auto"); @@ -1372,6 +1378,7 @@ public class FOPropertyMapping implements Constants { {PR_MAX_HEIGHT, PR_MAX_HEIGHT, PR_MAX_WIDTH, } }); pdim.setRelative(true); + m.setCorresponding(pdim); addPropertyMaker("block-progression-dimension", m); // content-height @@ -1398,6 +1405,7 @@ public class FOPropertyMapping implements Constants { // inline-progression-dimension m = new LengthRangeProperty.Maker(PR_INLINE_PROGRESSION_DIMENSION); m.setInherited(false); + m.setPercentBase(LengthBase.BLOCK_WIDTH); l = new LengthProperty.Maker(CP_MINIMUM); l.setDefault("auto"); @@ -1427,6 +1435,7 @@ public class FOPropertyMapping implements Constants { {PR_MIN_WIDTH, PR_MIN_WIDTH, PR_MIN_HEIGHT, }, {PR_MAX_WIDTH, PR_MAX_WIDTH, PR_MAX_HEIGHT, } }); + m.setCorresponding(pdim); addPropertyMaker("inline-progression-dimension", m); // max-height @@ -1471,7 +1480,7 @@ public class FOPropertyMapping implements Constants { l = new LengthProperty.Maker(PR_WIDTH); l.setInherited(false); l.setAutoOk(true); - l.setPercentBase(LengthBase.CONTAINING_BOX); + l.setPercentBase(LengthBase.BLOCK_WIDTH); l.setDefault("auto"); addPropertyMaker("width", l); } @@ -1580,6 +1589,7 @@ public class FOPropertyMapping implements Constants { m = new LengthProperty.Maker(PR_TEXT_INDENT); m.setInherited(false); m.setDefault("0pt"); + m.setPercentBase(LengthBase.BLOCK_WIDTH); addPropertyMaker("text-indent", m); // white-space-collapse @@ -2222,6 +2232,7 @@ public class FOPropertyMapping implements Constants { m = new LengthProperty.Maker(PR_COLUMN_WIDTH); m.setInherited(false); m.setDefault("proportional-column-width(1)", true); + m.setPercentBase(LengthBase.BLOCK_WIDTH); addPropertyMaker("column-width", m); // empty-cells @@ -2476,6 +2487,7 @@ public class FOPropertyMapping implements Constants { m.setInherited(false); m.setDefault(""); m.setDatatypeParser(new BoxPropShorthandParser()); + m.setPercentBase(LengthBase.BLOCK_WIDTH); addPropertyMaker("margin", m); // padding diff --git a/src/java/org/apache/fop/fo/FObj.java b/src/java/org/apache/fop/fo/FObj.java index 6d61dce3b..df057eab1 100644 --- a/src/java/org/apache/fop/fo/FObj.java +++ b/src/java/org/apache/fop/fo/FObj.java @@ -97,6 +97,11 @@ public class FObj extends FONode implements Constants { protected Map markers = null; /** + * Dynamic layout dimension. Used to resolve relative lengths. + */ + protected Map layoutDimension = null; + + /** * Create a new formatting object. * All formatting object classes extend this class. * @@ -237,6 +242,50 @@ public class FObj extends FONode implements Constants { return new PropertyManager(propertyList); } + /* This section is the implemenation of the property context. */ + + /** + * Assign the size of a layout dimension to the key. + * @param key the Layout dimension, from PercentBase. + * @param dimension The layout length. + */ + public void setLayoutDimension(Integer key, int dimension) { + if (layoutDimension == null){ + layoutDimension = new HashMap(); + } + layoutDimension.put(key, new Integer(dimension)); + } + + /** + * Assign the size of a layout dimension to the key. + * @param key the Layout dimension, from PercentBase. + * @param dimension The layout length. + */ + public void setLayoutDimension(Integer key, float dimension) { + if (layoutDimension == null){ + layoutDimension = new HashMap(); + } + layoutDimension.put(key, new Float(dimension)); + } + + /** + * Return the size associated with the key. + * @param key The layout dimension key. + * @return the length. + */ + public Number getLayoutDimension(Integer key) { + if (layoutDimension != null) { + Number result = (Number) layoutDimension.get(key); + if (result != null) { + return result; + } + } + if (parent != null) { + return ((FObj) parent).getLayoutDimension(key); + } + return new Integer(0); + } + /** * Add the child to this object. * diff --git a/src/java/org/apache/fop/fo/PropertyManager.java b/src/java/org/apache/fop/fo/PropertyManager.java index 4c25add9e..50a9e6c17 100644 --- a/src/java/org/apache/fop/fo/PropertyManager.java +++ b/src/java/org/apache/fop/fo/PropertyManager.java @@ -465,7 +465,7 @@ public class PropertyManager implements Constants { */ public BlockProps getBlockProps() { BlockProps props = new BlockProps(); - props.firstIndent = this.propertyList.get(PR_TEXT_INDENT).getLength().getValue(); + props.firstIndent = this.propertyList.get(PR_TEXT_INDENT).getLength(); props.lastIndent = 0; /*this.propertyList.get("last-line-end-indent").getLength().mvalue(); */ props.textAlign = this.propertyList.get(PR_TEXT_ALIGN).getEnum(); diff --git a/src/java/org/apache/fop/fo/flow/ExternalGraphic.java b/src/java/org/apache/fop/fo/flow/ExternalGraphic.java index 3e51896be..903e3d360 100644 --- a/src/java/org/apache/fop/fo/flow/ExternalGraphic.java +++ b/src/java/org/apache/fop/fo/flow/ExternalGraphic.java @@ -51,18 +51,16 @@ package org.apache.fop.fo.flow; // XML -import org.xml.sax.Attributes; +import java.awt.geom.Rectangle2D; -// FOP import org.apache.fop.apps.FOPException; +import org.apache.fop.datatypes.Length; import org.apache.fop.fo.FONode; -import org.apache.fop.fo.FObj; import org.apache.fop.fo.FOTreeVisitor; -import org.apache.fop.fo.properties.LengthProperty; -import org.apache.fop.image.ImageFactory; +import org.apache.fop.fo.FObj; import org.apache.fop.image.FopImage; -// Java -import java.awt.geom.Rectangle2D; +import org.apache.fop.image.ImageFactory; +import org.xml.sax.Attributes; /** * External graphic formatting object. @@ -104,7 +102,7 @@ public class ExternalGraphic extends FObj { url = ImageFactory.getURL(url); // assume lr-tb for now and just use the .optimum value of the range - LengthProperty ipd = propertyList.get(PR_INLINE_PROGRESSION_DIMENSION). + Length ipd = propertyList.get(PR_INLINE_PROGRESSION_DIMENSION). getLengthRange().getOptimum().getLength(); if (!ipd.isAuto()) { viewWidth = ipd.getValue(); @@ -114,7 +112,7 @@ public class ExternalGraphic extends FObj { viewWidth = ipd.getValue(); } } - LengthProperty bpd = propertyList.get(PR_BLOCK_PROGRESSION_DIMENSION | CP_OPTIMUM).getLength(); + Length bpd = propertyList.get(PR_BLOCK_PROGRESSION_DIMENSION | CP_OPTIMUM).getLength(); if (!bpd.isAuto()) { viewHeight = bpd.getValue(); } else { @@ -129,7 +127,7 @@ public class ExternalGraphic extends FObj { int cwidth = -1; int cheight = -1; - LengthProperty ch = propertyList.get(PR_CONTENT_HEIGHT).getLength(); + Length ch = propertyList.get(PR_CONTENT_HEIGHT).getLength(); if (!ch.isAuto()) { /*if (ch.scaleToFit()) { if (viewHeight != -1) { @@ -138,7 +136,7 @@ public class ExternalGraphic extends FObj { } else {*/ cheight = ch.getValue(); } - LengthProperty cw = propertyList.get(PR_CONTENT_WIDTH).getLength(); + Length cw = propertyList.get(PR_CONTENT_WIDTH).getLength(); if (!cw.isAuto()) { /*if (cw.scaleToFit()) { if (viewWidth != -1) { diff --git a/src/java/org/apache/fop/fo/flow/TableColumn.java b/src/java/org/apache/fop/fo/flow/TableColumn.java index 76a960771..39a19c61d 100644 --- a/src/java/org/apache/fop/fo/flow/TableColumn.java +++ b/src/java/org/apache/fop/fo/flow/TableColumn.java @@ -63,7 +63,6 @@ import org.apache.fop.fo.FOTreeVisitor; import org.apache.fop.fo.properties.CommonBackground; import org.apache.fop.fo.properties.CommonBorderAndPadding; -import org.apache.fop.fo.properties.Property; /** * Class modelling the fo:table-column object. See Sec. 6.7.4 of the XSL-FO @@ -73,8 +72,7 @@ public class TableColumn extends FObj { private ColorType backgroundColor; - private Length columnWidthPropVal; - private int columnWidth; + private Length columnWidth; private int columnOffset; private int numColumnsRepeated; private int iColumnNumber; @@ -91,27 +89,11 @@ public class TableColumn extends FObj { /** * @return Length object containing column width */ - public Length getColumnWidthAsLength() { - return columnWidthPropVal; - } - - /** - * @return the column width (in millipoints ??) - */ - public int getColumnWidth() { + public Length getColumnWidth() { return columnWidth; } /** - * Set the column width value, overriding the value from the column-width - * Property. - * @param columnWidth the column width value in base units (millipoints ??) - */ - public void setColumnWidth(int columnWidth) { - this.columnWidth = columnWidth; - } - - /** * @return column number */ public int getColumnNumber() { @@ -146,15 +128,7 @@ public class TableColumn extends FObj { this.backgroundColor = this.propertyList.get(PR_BACKGROUND_COLOR).getColorType(); - Property prop = this.propertyList.get(PR_COLUMN_WIDTH); - if (prop != null) { - columnWidthPropVal = propertyList.get(PR_COLUMN_WIDTH).getLength(); - - // This won't include resolved table-units or % values yet. - columnWidth = columnWidthPropVal.getValue(); - } else { - columnWidth = 300000; - } + columnWidth = this.propertyList.get(PR_COLUMN_WIDTH).getLength(); // initialize id setupID(); diff --git a/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java b/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java index 6a9742492..ce8ae6551 100644 --- a/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java @@ -64,6 +64,7 @@ import org.apache.fop.fo.PropertyList; import org.apache.fop.area.CTM; import org.apache.fop.datatypes.FODimension; import org.apache.fop.datatypes.Length; +import org.apache.fop.datatypes.PercentBase; import org.apache.fop.traits.MinOptMax; /** @@ -177,6 +178,11 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager { // stackSize.add(spaceBefore); BreakPoss lastPos = null; + fobj.setLayoutDimension(PercentBase.BLOCK_IPD, ipd); + fobj.setLayoutDimension(PercentBase.BLOCK_BPD, bpd - bIndents); + fobj.setLayoutDimension(PercentBase.REFERENCE_AREA_IPD, ipd); + fobj.setLayoutDimension(PercentBase.REFERENCE_AREA_BPD, bpd - bIndents); + while ((curLM = getChildLM()) != null) { // Make break positions and return blocks! // Set up a LayoutContext diff --git a/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java b/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java index 396cba7db..53fe44c9e 100644 --- a/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java @@ -54,6 +54,7 @@ import java.util.ListIterator; import java.util.ArrayList; import java.util.List; +import org.apache.fop.datatypes.PercentBase; import org.apache.fop.fo.FObj; import org.apache.fop.fo.TextInfo; import org.apache.fop.fo.PropertyManager; @@ -212,6 +213,10 @@ public class BlockLayoutManager extends BlockStackingLayoutManager { BreakPoss lastPos = null; + // 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 diff --git a/src/java/org/apache/fop/layoutmgr/LineLayoutManager.java b/src/java/org/apache/fop/layoutmgr/LineLayoutManager.java index b86627052..c90512662 100644 --- a/src/java/org/apache/fop/layoutmgr/LineLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/LineLayoutManager.java @@ -50,6 +50,7 @@ */ package org.apache.fop.layoutmgr; +import org.apache.fop.datatypes.Length; import org.apache.fop.fo.PropertyManager; import org.apache.fop.fo.properties.CommonMarginBlock; import org.apache.fop.fo.properties.CommonHyphenation; @@ -109,7 +110,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager { private BreakPoss prevBP = null; // Last confirmed break position private int bTextAlignment = TextAlign.JUSTIFY; - private int iTextIndent = 0; + private Length textIndent; private int iIndents = 0; private CommonHyphenation hyphProps; @@ -146,7 +147,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager { iIndents = marginProps.startIndent + marginProps.endIndent; BlockProps blockProps = propMgr.getBlockProps(); bTextAlignment = blockProps.textAlign; - iTextIndent = blockProps.firstIndent; + textIndent = blockProps.firstIndent; hyphProps = propMgr.getHyphenationProps(); } @@ -178,10 +179,9 @@ public class LineLayoutManager extends InlineStackingLayoutManager { clearPrevIPD(); int iPrevLineEnd = vecInlineBreaks.size(); - // Adjust available line length by text-indent. if (iPrevLineEnd == 0 && bTextAlignment == TextAlign.START) { - availIPD.subtract(new MinOptMax(iTextIndent)); - } + availIPD.subtract(new MinOptMax(textIndent.getValue())); + } prevBP = null; while ((curLM = getChildLM()) != null) { @@ -453,7 +453,7 @@ public class LineLayoutManager extends InlineStackingLayoutManager { if (prev == null) { vecInlineBreaks.clear(); } else if ((iPrev = vecInlineBreaks.indexOf(prev)) != -1) { - for (int i = vecInlineBreaks.size(); iPrev < i; --i) { + for (int i = vecInlineBreaks.size()-1; iPrev < i; --i) { vecInlineBreaks.remove(i); } } @@ -623,9 +623,9 @@ public class LineLayoutManager extends InlineStackingLayoutManager { break; case TextAlign.START: if (prevLineEnd == 0) { - indent = iTextIndent; + indent = textIndent.getValue(); } - break; + break; case TextAlign.CENTER: indent = (targetWith - realWidth) / 2; break; diff --git a/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java b/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java index ae6fd33cd..55c1c32c3 100644 --- a/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java @@ -68,8 +68,10 @@ import org.apache.fop.area.BeforeFloat; import org.apache.fop.area.Footnote; import org.apache.fop.area.Resolveable; +import org.apache.fop.datatypes.PercentBase; import org.apache.fop.datatypes.FODimension; +import org.apache.fop.fo.FObj; import org.apache.fop.fo.Constants; import org.apache.fop.fo.flow.Marker; import org.apache.fop.fo.pagination.PageNumberGenerator; @@ -254,6 +256,8 @@ public class PageLayoutManager extends AbstractLayoutManager implements Runnable childLC.setRefIPD(flowIPD); if (!curLM.isFinished()) { + fobj.setLayoutDimension(PercentBase.REFERENCE_AREA_IPD, flowIPD); + fobj.setLayoutDimension(PercentBase.REFERENCE_AREA_BPD, flowBPD); bp = curLM.getNextBreakPoss(childLC); } if (bp != null) { @@ -769,6 +773,10 @@ public class PageLayoutManager extends AbstractLayoutManager implements Runnable spm.propertyList.get(PR_PAGE_WIDTH).getLength().getValue(); int pageHeight = spm.propertyList.get(PR_PAGE_HEIGHT).getLength().getValue(); + // Set the page dimension as the toplevel containing block for margin. + ((FObj) fobj.getParent()).setLayoutDimension(PercentBase.BLOCK_IPD, pageWidth); + ((FObj) fobj.getParent()).setLayoutDimension(PercentBase.BLOCK_BPD, pageHeight); + // Get absolute margin properties (top, left, bottom, right) CommonMarginBlock mProps = spm.getPropertyManager().getMarginProps(); @@ -797,6 +805,8 @@ public class PageLayoutManager extends AbstractLayoutManager implements Runnable for (Iterator regenum = spm.getRegions().values().iterator(); regenum.hasNext();) { Region r = (Region)regenum.next(); + r.setLayoutDimension(PercentBase.BLOCK_IPD, pageWidth); + r.setLayoutDimension(PercentBase.BLOCK_BPD, pageHeight); RegionViewport rvp = makeRegionViewport(r, reldims, pageCTM); if (r.getRegionClassCode() == Region.BODY_CODE) { rvp.setRegion(makeRegionBodyReferenceArea(r, rvp.getViewArea())); diff --git a/src/java/org/apache/fop/layoutmgr/table/Column.java b/src/java/org/apache/fop/layoutmgr/table/Column.java index 2cf42e796..4e5e57609 100644 --- a/src/java/org/apache/fop/layoutmgr/table/Column.java +++ b/src/java/org/apache/fop/layoutmgr/table/Column.java @@ -50,6 +50,7 @@ */ package org.apache.fop.layoutmgr.table; +import org.apache.fop.datatypes.Length; import org.apache.fop.fo.FObj; import org.apache.fop.fo.PropertyManager; import org.apache.fop.layoutmgr.AbstractLayoutManager; @@ -70,7 +71,6 @@ import org.apache.fop.fo.properties.CommonBackground; * column properties. */ public class Column extends AbstractLayoutManager { - private int columnWidth; private CommonBorderAndPadding borderProps = null; private CommonBackground backgroundProps; @@ -85,7 +85,6 @@ public class Column extends AbstractLayoutManager { */ public void setFObj(FObj fobj) { super.setFObj(fobj); - columnWidth = ((TableColumn)fobj).getColumnWidth(); } /** @@ -136,8 +135,8 @@ public class Column extends AbstractLayoutManager { * * @return the width of the column */ - public int getWidth() { - return columnWidth; + public Length getWidth() { + return ((TableColumn)fobj).getColumnWidth(); } /** diff --git a/src/java/org/apache/fop/layoutmgr/table/Row.java b/src/java/org/apache/fop/layoutmgr/table/Row.java index 2715a38f0..1e1a94db1 100644 --- a/src/java/org/apache/fop/layoutmgr/table/Row.java +++ b/src/java/org/apache/fop/layoutmgr/table/Row.java @@ -191,7 +191,7 @@ public class Row extends BlockStackingLayoutManager { } else { col = (Column)columns.get(cellcount - 1); } - childLC.setRefIPD(col.getWidth()); + childLC.setRefIPD(col.getWidth().getValue()); while (!curLM.isFinished()) { if ((bp = curLM.getNextBreakPoss(childLC)) != null) { @@ -343,7 +343,7 @@ public class Row extends BlockStackingLayoutManager { childLM.setRowHeight(rowHeight); childLM.addAreas(breakPosIter, lc); } - xoffset += col.getWidth(); + xoffset += col.getWidth().getValue(); } } diff --git a/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java b/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java index 6f1a558f3..ce12c3523 100644 --- a/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java +++ b/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java @@ -50,7 +50,10 @@ */ package org.apache.fop.layoutmgr.table; +import org.apache.fop.datatypes.Length; +import org.apache.fop.datatypes.PercentBase; import org.apache.fop.fo.PropertyManager; +import org.apache.fop.fo.properties.TableColLength; import org.apache.fop.layoutmgr.BlockStackingLayoutManager; import org.apache.fop.layoutmgr.LayoutProcessor; import org.apache.fop.layoutmgr.LeafPosition; @@ -67,6 +70,7 @@ import org.apache.fop.fo.properties.CommonBorderAndPadding; import org.apache.fop.fo.properties.CommonBackground; import java.util.ArrayList; +import java.util.Iterator; import java.util.List; /** @@ -159,6 +163,26 @@ public class TableLayoutManager extends BlockStackingLayoutManager { // stackSize.add(spaceBefore); BreakPoss lastPos = null; + fobj.setLayoutDimension(PercentBase.BLOCK_IPD, context.getRefIPD()); + fobj.setLayoutDimension(PercentBase.BLOCK_BPD, context.getStackLimit().opt); + fobj.setLayoutDimension(PercentBase.REFERENCE_AREA_IPD, context.getRefIPD()); + fobj.setLayoutDimension(PercentBase.REFERENCE_AREA_BPD, context.getStackLimit().opt); + + int sumCols = 0; + float factors = 0; + if (columns != null) { + for (Iterator i = columns.iterator(); i.hasNext(); ) { + Column column = (Column) i.next(); + Length width = column.getWidth(); + sumCols += width.getValue(); + if (width instanceof TableColLength) { + factors += ((TableColLength) width).getTableUnits(); + } + } + } + if (sumCols < context.getRefIPD()) { + fobj.setLayoutDimension(PercentBase.TABLE_UNITS, (context.getRefIPD() - sumCols) / factors); + } MinOptMax headerSize = null; if (tableHeader != null) { tableHeader.setUserAgent(getUserAgent()); diff --git a/src/java/org/apache/fop/render/rtf/RTFHandler.java b/src/java/org/apache/fop/render/rtf/RTFHandler.java index 68894c3c0..3e8d09470 100644 --- a/src/java/org/apache/fop/render/rtf/RTFHandler.java +++ b/src/java/org/apache/fop/render/rtf/RTFHandler.java @@ -479,7 +479,7 @@ public class RTFHandler extends FOInputHandler { } try { - Integer iWidth = new Integer(tc.getColumnWidth() / 1000); + Integer iWidth = new Integer(tc.getColumnWidth().getValue() / 1000); builderContext.getTableContext().setNextColumnWidth(iWidth.toString() + "pt"); builderContext.getTableContext().setNextColumnRowSpanning(new Integer(0), null); } catch (Exception e) { diff --git a/src/java/org/apache/fop/traits/BlockProps.java b/src/java/org/apache/fop/traits/BlockProps.java index 5099d2f78..d99346a47 100644 --- a/src/java/org/apache/fop/traits/BlockProps.java +++ b/src/java/org/apache/fop/traits/BlockProps.java @@ -50,13 +50,15 @@ */ package org.apache.fop.traits; +import org.apache.fop.datatypes.Length; + /** * Store all block-level layout properties on an FO. * Public "structure" allows direct member access. */ public class BlockProps { - public int firstIndent; // text-indent + public Length firstIndent; // text-indent public int lastIndent; // last-line-indent public int textAlign; public int textAlignLast; |