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-ffa450edef68pull/30/head
genericPadding = new LengthProperty.Maker(0); | genericPadding = new LengthProperty.Maker(0); | ||||
genericPadding.setInherited(false); | genericPadding.setInherited(false); | ||||
genericPadding.setDefault("0pt"); | genericPadding.setDefault("0pt"); | ||||
genericPadding.setPercentBase(LengthBase.BLOCK_WIDTH); | |||||
genericPadding.addShorthand(s_generics[PR_PADDING]); | genericPadding.addShorthand(s_generics[PR_PADDING]); | ||||
// GenericCondBorderWidth | // GenericCondBorderWidth | ||||
m.setInherited(false); | m.setInherited(false); | ||||
m.setDefault("0pt"); | m.setDefault("0pt"); | ||||
m.addShorthand(s_generics[PR_MARGIN]); | m.addShorthand(s_generics[PR_MARGIN]); | ||||
m.setPercentBase(LengthBase.BLOCK_WIDTH); | |||||
addPropertyMaker("margin-top", m); | addPropertyMaker("margin-top", m); | ||||
// margin-bottom | // margin-bottom | ||||
m.setInherited(false); | m.setInherited(false); | ||||
m.setDefault("0pt"); | m.setDefault("0pt"); | ||||
m.addShorthand(s_generics[PR_MARGIN]); | m.addShorthand(s_generics[PR_MARGIN]); | ||||
m.setPercentBase(LengthBase.BLOCK_WIDTH); | |||||
addPropertyMaker("margin-bottom", m); | addPropertyMaker("margin-bottom", m); | ||||
// margin-left | // margin-left | ||||
m.setInherited(false); | m.setInherited(false); | ||||
m.setDefault("0pt"); | m.setDefault("0pt"); | ||||
m.addShorthand(s_generics[PR_MARGIN]); | m.addShorthand(s_generics[PR_MARGIN]); | ||||
m.setPercentBase(LengthBase.BLOCK_WIDTH); | |||||
addPropertyMaker("margin-left", m); | addPropertyMaker("margin-left", m); | ||||
// margin-right | // margin-right | ||||
m.setInherited(false); | m.setInherited(false); | ||||
m.setDefault("0pt"); | m.setDefault("0pt"); | ||||
m.addShorthand(s_generics[PR_MARGIN]); | m.addShorthand(s_generics[PR_MARGIN]); | ||||
m.setPercentBase(LengthBase.BLOCK_WIDTH); | |||||
addPropertyMaker("margin-right", m); | addPropertyMaker("margin-right", m); | ||||
// space-before | // space-before | ||||
// block-progression-dimension | // block-progression-dimension | ||||
m = new LengthRangeProperty.Maker(PR_BLOCK_PROGRESSION_DIMENSION); | m = new LengthRangeProperty.Maker(PR_BLOCK_PROGRESSION_DIMENSION); | ||||
m.setInherited(false); | m.setInherited(false); | ||||
m.setPercentBase(LengthBase.BLOCK_HEIGHT); | |||||
l = new LengthProperty.Maker(CP_MINIMUM); | l = new LengthProperty.Maker(CP_MINIMUM); | ||||
l.setDefault("auto"); | l.setDefault("auto"); | ||||
{PR_MAX_HEIGHT, PR_MAX_HEIGHT, PR_MAX_WIDTH, } | {PR_MAX_HEIGHT, PR_MAX_HEIGHT, PR_MAX_WIDTH, } | ||||
}); | }); | ||||
pdim.setRelative(true); | pdim.setRelative(true); | ||||
m.setCorresponding(pdim); | |||||
addPropertyMaker("block-progression-dimension", m); | addPropertyMaker("block-progression-dimension", m); | ||||
// content-height | // content-height | ||||
// inline-progression-dimension | // inline-progression-dimension | ||||
m = new LengthRangeProperty.Maker(PR_INLINE_PROGRESSION_DIMENSION); | m = new LengthRangeProperty.Maker(PR_INLINE_PROGRESSION_DIMENSION); | ||||
m.setInherited(false); | m.setInherited(false); | ||||
m.setPercentBase(LengthBase.BLOCK_WIDTH); | |||||
l = new LengthProperty.Maker(CP_MINIMUM); | l = new LengthProperty.Maker(CP_MINIMUM); | ||||
l.setDefault("auto"); | l.setDefault("auto"); | ||||
{PR_MIN_WIDTH, PR_MIN_WIDTH, PR_MIN_HEIGHT, }, | {PR_MIN_WIDTH, PR_MIN_WIDTH, PR_MIN_HEIGHT, }, | ||||
{PR_MAX_WIDTH, PR_MAX_WIDTH, PR_MAX_HEIGHT, } | {PR_MAX_WIDTH, PR_MAX_WIDTH, PR_MAX_HEIGHT, } | ||||
}); | }); | ||||
m.setCorresponding(pdim); | |||||
addPropertyMaker("inline-progression-dimension", m); | addPropertyMaker("inline-progression-dimension", m); | ||||
// max-height | // max-height | ||||
l = new LengthProperty.Maker(PR_WIDTH); | l = new LengthProperty.Maker(PR_WIDTH); | ||||
l.setInherited(false); | l.setInherited(false); | ||||
l.setAutoOk(true); | l.setAutoOk(true); | ||||
l.setPercentBase(LengthBase.CONTAINING_BOX); | |||||
l.setPercentBase(LengthBase.BLOCK_WIDTH); | |||||
l.setDefault("auto"); | l.setDefault("auto"); | ||||
addPropertyMaker("width", l); | addPropertyMaker("width", l); | ||||
} | } | ||||
m = new LengthProperty.Maker(PR_TEXT_INDENT); | m = new LengthProperty.Maker(PR_TEXT_INDENT); | ||||
m.setInherited(false); | m.setInherited(false); | ||||
m.setDefault("0pt"); | m.setDefault("0pt"); | ||||
m.setPercentBase(LengthBase.BLOCK_WIDTH); | |||||
addPropertyMaker("text-indent", m); | addPropertyMaker("text-indent", m); | ||||
// white-space-collapse | // white-space-collapse | ||||
m = new LengthProperty.Maker(PR_COLUMN_WIDTH); | m = new LengthProperty.Maker(PR_COLUMN_WIDTH); | ||||
m.setInherited(false); | m.setInherited(false); | ||||
m.setDefault("proportional-column-width(1)", true); | m.setDefault("proportional-column-width(1)", true); | ||||
m.setPercentBase(LengthBase.BLOCK_WIDTH); | |||||
addPropertyMaker("column-width", m); | addPropertyMaker("column-width", m); | ||||
// empty-cells | // empty-cells | ||||
m.setInherited(false); | m.setInherited(false); | ||||
m.setDefault(""); | m.setDefault(""); | ||||
m.setDatatypeParser(new BoxPropShorthandParser()); | m.setDatatypeParser(new BoxPropShorthandParser()); | ||||
m.setPercentBase(LengthBase.BLOCK_WIDTH); | |||||
addPropertyMaker("margin", m); | addPropertyMaker("margin", m); | ||||
// padding | // padding |
*/ | */ | ||||
protected Map markers = null; | protected Map markers = null; | ||||
/** | |||||
* Dynamic layout dimension. Used to resolve relative lengths. | |||||
*/ | |||||
protected Map layoutDimension = null; | |||||
/** | /** | ||||
* Create a new formatting object. | * Create a new formatting object. | ||||
* All formatting object classes extend this class. | * All formatting object classes extend this class. | ||||
return new PropertyManager(propertyList); | 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. | * Add the child to this object. | ||||
* | * |
*/ | */ | ||||
public BlockProps getBlockProps() { | public BlockProps getBlockProps() { | ||||
BlockProps props = new BlockProps(); | 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; | props.lastIndent = 0; | ||||
/*this.propertyList.get("last-line-end-indent").getLength().mvalue(); */ | /*this.propertyList.get("last-line-end-indent").getLength().mvalue(); */ | ||||
props.textAlign = this.propertyList.get(PR_TEXT_ALIGN).getEnum(); | props.textAlign = this.propertyList.get(PR_TEXT_ALIGN).getEnum(); |
package org.apache.fop.fo.flow; | package org.apache.fop.fo.flow; | ||||
// XML | // XML | ||||
import org.xml.sax.Attributes; | |||||
import java.awt.geom.Rectangle2D; | |||||
// FOP | |||||
import org.apache.fop.apps.FOPException; | import org.apache.fop.apps.FOPException; | ||||
import org.apache.fop.datatypes.Length; | |||||
import org.apache.fop.fo.FONode; | import org.apache.fop.fo.FONode; | ||||
import org.apache.fop.fo.FObj; | |||||
import org.apache.fop.fo.FOTreeVisitor; | 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; | 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. | * External graphic formatting object. | ||||
url = ImageFactory.getURL(url); | url = ImageFactory.getURL(url); | ||||
// assume lr-tb for now and just use the .optimum value of the range | // 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(); | getLengthRange().getOptimum().getLength(); | ||||
if (!ipd.isAuto()) { | if (!ipd.isAuto()) { | ||||
viewWidth = ipd.getValue(); | viewWidth = ipd.getValue(); | ||||
viewWidth = ipd.getValue(); | 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()) { | if (!bpd.isAuto()) { | ||||
viewHeight = bpd.getValue(); | viewHeight = bpd.getValue(); | ||||
} else { | } else { | ||||
int cwidth = -1; | int cwidth = -1; | ||||
int cheight = -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.isAuto()) { | ||||
/*if (ch.scaleToFit()) { | /*if (ch.scaleToFit()) { | ||||
if (viewHeight != -1) { | if (viewHeight != -1) { | ||||
} else {*/ | } else {*/ | ||||
cheight = ch.getValue(); | cheight = ch.getValue(); | ||||
} | } | ||||
LengthProperty cw = propertyList.get(PR_CONTENT_WIDTH).getLength(); | |||||
Length cw = propertyList.get(PR_CONTENT_WIDTH).getLength(); | |||||
if (!cw.isAuto()) { | if (!cw.isAuto()) { | ||||
/*if (cw.scaleToFit()) { | /*if (cw.scaleToFit()) { | ||||
if (viewWidth != -1) { | if (viewWidth != -1) { |
import org.apache.fop.fo.properties.CommonBackground; | import org.apache.fop.fo.properties.CommonBackground; | ||||
import org.apache.fop.fo.properties.CommonBorderAndPadding; | 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 | * Class modelling the fo:table-column object. See Sec. 6.7.4 of the XSL-FO | ||||
private ColorType backgroundColor; | private ColorType backgroundColor; | ||||
private Length columnWidthPropVal; | |||||
private int columnWidth; | |||||
private Length columnWidth; | |||||
private int columnOffset; | private int columnOffset; | ||||
private int numColumnsRepeated; | private int numColumnsRepeated; | ||||
private int iColumnNumber; | private int iColumnNumber; | ||||
/** | /** | ||||
* @return Length object containing column width | * @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; | 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 | * @return column number | ||||
*/ | */ | ||||
this.backgroundColor = | this.backgroundColor = | ||||
this.propertyList.get(PR_BACKGROUND_COLOR).getColorType(); | 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 | // initialize id | ||||
setupID(); | setupID(); |
import org.apache.fop.area.CTM; | import org.apache.fop.area.CTM; | ||||
import org.apache.fop.datatypes.FODimension; | import org.apache.fop.datatypes.FODimension; | ||||
import org.apache.fop.datatypes.Length; | import org.apache.fop.datatypes.Length; | ||||
import org.apache.fop.datatypes.PercentBase; | |||||
import org.apache.fop.traits.MinOptMax; | import org.apache.fop.traits.MinOptMax; | ||||
/** | /** | ||||
// stackSize.add(spaceBefore); | // stackSize.add(spaceBefore); | ||||
BreakPoss lastPos = null; | 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) { | while ((curLM = getChildLM()) != null) { | ||||
// Make break positions and return blocks! | // Make break positions and return blocks! | ||||
// Set up a LayoutContext | // Set up a LayoutContext |
import java.util.ArrayList; | import java.util.ArrayList; | ||||
import java.util.List; | import java.util.List; | ||||
import org.apache.fop.datatypes.PercentBase; | |||||
import org.apache.fop.fo.FObj; | import org.apache.fop.fo.FObj; | ||||
import org.apache.fop.fo.TextInfo; | import org.apache.fop.fo.TextInfo; | ||||
import org.apache.fop.fo.PropertyManager; | import org.apache.fop.fo.PropertyManager; | ||||
BreakPoss lastPos = null; | 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) { | while ((curLM = getChildLM()) != null) { | ||||
// Make break positions and return blocks! | // Make break positions and return blocks! | ||||
// Set up a LayoutContext | // Set up a LayoutContext |
*/ | */ | ||||
package org.apache.fop.layoutmgr; | package org.apache.fop.layoutmgr; | ||||
import org.apache.fop.datatypes.Length; | |||||
import org.apache.fop.fo.PropertyManager; | import org.apache.fop.fo.PropertyManager; | ||||
import org.apache.fop.fo.properties.CommonMarginBlock; | import org.apache.fop.fo.properties.CommonMarginBlock; | ||||
import org.apache.fop.fo.properties.CommonHyphenation; | import org.apache.fop.fo.properties.CommonHyphenation; | ||||
private BreakPoss prevBP = null; // Last confirmed break position | private BreakPoss prevBP = null; // Last confirmed break position | ||||
private int bTextAlignment = TextAlign.JUSTIFY; | private int bTextAlignment = TextAlign.JUSTIFY; | ||||
private int iTextIndent = 0; | |||||
private Length textIndent; | |||||
private int iIndents = 0; | private int iIndents = 0; | ||||
private CommonHyphenation hyphProps; | private CommonHyphenation hyphProps; | ||||
iIndents = marginProps.startIndent + marginProps.endIndent; | iIndents = marginProps.startIndent + marginProps.endIndent; | ||||
BlockProps blockProps = propMgr.getBlockProps(); | BlockProps blockProps = propMgr.getBlockProps(); | ||||
bTextAlignment = blockProps.textAlign; | bTextAlignment = blockProps.textAlign; | ||||
iTextIndent = blockProps.firstIndent; | |||||
textIndent = blockProps.firstIndent; | |||||
hyphProps = propMgr.getHyphenationProps(); | hyphProps = propMgr.getHyphenationProps(); | ||||
} | } | ||||
clearPrevIPD(); | clearPrevIPD(); | ||||
int iPrevLineEnd = vecInlineBreaks.size(); | int iPrevLineEnd = vecInlineBreaks.size(); | ||||
// Adjust available line length by text-indent. | |||||
if (iPrevLineEnd == 0 && bTextAlignment == TextAlign.START) { | if (iPrevLineEnd == 0 && bTextAlignment == TextAlign.START) { | ||||
availIPD.subtract(new MinOptMax(iTextIndent)); | |||||
} | |||||
availIPD.subtract(new MinOptMax(textIndent.getValue())); | |||||
} | |||||
prevBP = null; | prevBP = null; | ||||
while ((curLM = getChildLM()) != null) { | while ((curLM = getChildLM()) != null) { | ||||
if (prev == null) { | if (prev == null) { | ||||
vecInlineBreaks.clear(); | vecInlineBreaks.clear(); | ||||
} else if ((iPrev = vecInlineBreaks.indexOf(prev)) != -1) { | } 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); | vecInlineBreaks.remove(i); | ||||
} | } | ||||
} | } | ||||
break; | break; | ||||
case TextAlign.START: | case TextAlign.START: | ||||
if (prevLineEnd == 0) { | if (prevLineEnd == 0) { | ||||
indent = iTextIndent; | |||||
indent = textIndent.getValue(); | |||||
} | } | ||||
break; | |||||
break; | |||||
case TextAlign.CENTER: | case TextAlign.CENTER: | ||||
indent = (targetWith - realWidth) / 2; | indent = (targetWith - realWidth) / 2; | ||||
break; | break; |
import org.apache.fop.area.Footnote; | import org.apache.fop.area.Footnote; | ||||
import org.apache.fop.area.Resolveable; | import org.apache.fop.area.Resolveable; | ||||
import org.apache.fop.datatypes.PercentBase; | |||||
import org.apache.fop.datatypes.FODimension; | import org.apache.fop.datatypes.FODimension; | ||||
import org.apache.fop.fo.FObj; | |||||
import org.apache.fop.fo.Constants; | import org.apache.fop.fo.Constants; | ||||
import org.apache.fop.fo.flow.Marker; | import org.apache.fop.fo.flow.Marker; | ||||
import org.apache.fop.fo.pagination.PageNumberGenerator; | import org.apache.fop.fo.pagination.PageNumberGenerator; | ||||
childLC.setRefIPD(flowIPD); | childLC.setRefIPD(flowIPD); | ||||
if (!curLM.isFinished()) { | if (!curLM.isFinished()) { | ||||
fobj.setLayoutDimension(PercentBase.REFERENCE_AREA_IPD, flowIPD); | |||||
fobj.setLayoutDimension(PercentBase.REFERENCE_AREA_BPD, flowBPD); | |||||
bp = curLM.getNextBreakPoss(childLC); | bp = curLM.getNextBreakPoss(childLC); | ||||
} | } | ||||
if (bp != null) { | if (bp != null) { | ||||
spm.propertyList.get(PR_PAGE_WIDTH).getLength().getValue(); | spm.propertyList.get(PR_PAGE_WIDTH).getLength().getValue(); | ||||
int pageHeight = | int pageHeight = | ||||
spm.propertyList.get(PR_PAGE_HEIGHT).getLength().getValue(); | 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) | // Get absolute margin properties (top, left, bottom, right) | ||||
CommonMarginBlock mProps = spm.getPropertyManager().getMarginProps(); | CommonMarginBlock mProps = spm.getPropertyManager().getMarginProps(); | ||||
for (Iterator regenum = spm.getRegions().values().iterator(); | for (Iterator regenum = spm.getRegions().values().iterator(); | ||||
regenum.hasNext();) { | regenum.hasNext();) { | ||||
Region r = (Region)regenum.next(); | Region r = (Region)regenum.next(); | ||||
r.setLayoutDimension(PercentBase.BLOCK_IPD, pageWidth); | |||||
r.setLayoutDimension(PercentBase.BLOCK_BPD, pageHeight); | |||||
RegionViewport rvp = makeRegionViewport(r, reldims, pageCTM); | RegionViewport rvp = makeRegionViewport(r, reldims, pageCTM); | ||||
if (r.getRegionClassCode() == Region.BODY_CODE) { | if (r.getRegionClassCode() == Region.BODY_CODE) { | ||||
rvp.setRegion(makeRegionBodyReferenceArea(r, rvp.getViewArea())); | rvp.setRegion(makeRegionBodyReferenceArea(r, rvp.getViewArea())); |
*/ | */ | ||||
package org.apache.fop.layoutmgr.table; | package org.apache.fop.layoutmgr.table; | ||||
import org.apache.fop.datatypes.Length; | |||||
import org.apache.fop.fo.FObj; | import org.apache.fop.fo.FObj; | ||||
import org.apache.fop.fo.PropertyManager; | import org.apache.fop.fo.PropertyManager; | ||||
import org.apache.fop.layoutmgr.AbstractLayoutManager; | import org.apache.fop.layoutmgr.AbstractLayoutManager; | ||||
* column properties. | * column properties. | ||||
*/ | */ | ||||
public class Column extends AbstractLayoutManager { | public class Column extends AbstractLayoutManager { | ||||
private int columnWidth; | |||||
private CommonBorderAndPadding borderProps = null; | private CommonBorderAndPadding borderProps = null; | ||||
private CommonBackground backgroundProps; | private CommonBackground backgroundProps; | ||||
*/ | */ | ||||
public void setFObj(FObj fobj) { | public void setFObj(FObj fobj) { | ||||
super.setFObj(fobj); | super.setFObj(fobj); | ||||
columnWidth = ((TableColumn)fobj).getColumnWidth(); | |||||
} | } | ||||
/** | /** | ||||
* | * | ||||
* @return the width of the column | * @return the width of the column | ||||
*/ | */ | ||||
public int getWidth() { | |||||
return columnWidth; | |||||
public Length getWidth() { | |||||
return ((TableColumn)fobj).getColumnWidth(); | |||||
} | } | ||||
/** | /** |
} else { | } else { | ||||
col = (Column)columns.get(cellcount - 1); | col = (Column)columns.get(cellcount - 1); | ||||
} | } | ||||
childLC.setRefIPD(col.getWidth()); | |||||
childLC.setRefIPD(col.getWidth().getValue()); | |||||
while (!curLM.isFinished()) { | while (!curLM.isFinished()) { | ||||
if ((bp = curLM.getNextBreakPoss(childLC)) != null) { | if ((bp = curLM.getNextBreakPoss(childLC)) != null) { | ||||
childLM.setRowHeight(rowHeight); | childLM.setRowHeight(rowHeight); | ||||
childLM.addAreas(breakPosIter, lc); | childLM.addAreas(breakPosIter, lc); | ||||
} | } | ||||
xoffset += col.getWidth(); | |||||
xoffset += col.getWidth().getValue(); | |||||
} | } | ||||
} | } | ||||
*/ | */ | ||||
package org.apache.fop.layoutmgr.table; | 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.PropertyManager; | ||||
import org.apache.fop.fo.properties.TableColLength; | |||||
import org.apache.fop.layoutmgr.BlockStackingLayoutManager; | import org.apache.fop.layoutmgr.BlockStackingLayoutManager; | ||||
import org.apache.fop.layoutmgr.LayoutProcessor; | import org.apache.fop.layoutmgr.LayoutProcessor; | ||||
import org.apache.fop.layoutmgr.LeafPosition; | import org.apache.fop.layoutmgr.LeafPosition; | ||||
import org.apache.fop.fo.properties.CommonBackground; | import org.apache.fop.fo.properties.CommonBackground; | ||||
import java.util.ArrayList; | import java.util.ArrayList; | ||||
import java.util.Iterator; | |||||
import java.util.List; | import java.util.List; | ||||
/** | /** | ||||
// stackSize.add(spaceBefore); | // stackSize.add(spaceBefore); | ||||
BreakPoss lastPos = null; | 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; | MinOptMax headerSize = null; | ||||
if (tableHeader != null) { | if (tableHeader != null) { | ||||
tableHeader.setUserAgent(getUserAgent()); | tableHeader.setUserAgent(getUserAgent()); |
} | } | ||||
try { | try { | ||||
Integer iWidth = new Integer(tc.getColumnWidth() / 1000); | |||||
Integer iWidth = new Integer(tc.getColumnWidth().getValue() / 1000); | |||||
builderContext.getTableContext().setNextColumnWidth(iWidth.toString() + "pt"); | builderContext.getTableContext().setNextColumnWidth(iWidth.toString() + "pt"); | ||||
builderContext.getTableContext().setNextColumnRowSpanning(new Integer(0), null); | builderContext.getTableContext().setNextColumnRowSpanning(new Integer(0), null); | ||||
} catch (Exception e) { | } catch (Exception e) { |
*/ | */ | ||||
package org.apache.fop.traits; | package org.apache.fop.traits; | ||||
import org.apache.fop.datatypes.Length; | |||||
/** | /** | ||||
* Store all block-level layout properties on an FO. | * Store all block-level layout properties on an FO. | ||||
* Public "structure" allows direct member access. | * Public "structure" allows direct member access. | ||||
*/ | */ | ||||
public class BlockProps { | public class BlockProps { | ||||
public int firstIndent; // text-indent | |||||
public Length firstIndent; // text-indent | |||||
public int lastIndent; // last-line-indent | public int lastIndent; // last-line-indent | ||||
public int textAlign; | public int textAlign; | ||||
public int textAlignLast; | public int textAlignLast; |