* LayoutManager for a block-container FO.
*/
public class BlockContainerLayoutManager extends BlockStackingLayoutManager {
-/*LF*/ // private BlockContainer fobj;
private BlockViewport viewportBlockArea;
private Block referenceArea;
*/
public BlockContainerLayoutManager(BlockContainer node) {
super(node);
-/*LF*/ // fobj = node;
}
/**
* @see org.apache.fop.layoutmgr.AbstractLayoutManager#initProperties()
*/
protected void initProperties() {
- abProps = ((BlockContainer) fobj).getCommonAbsolutePosition();
- foBlockSpaceBefore = new SpaceVal(((BlockContainer) fobj).getCommonMarginBlock().spaceBefore).getSpace();
- foBlockSpaceAfter = new SpaceVal(((BlockContainer) fobj).getCommonMarginBlock().spaceAfter).getSpace();
+ abProps = getBlockContainerFO().getCommonAbsolutePosition();
+ foBlockSpaceBefore = new SpaceVal(getBlockContainerFO().getCommonMarginBlock().spaceBefore).getSpace();
+ foBlockSpaceAfter = new SpaceVal(getBlockContainerFO().getCommonMarginBlock().spaceAfter).getSpace();
- boolean rotated = (((BlockContainer) fobj).getReferenceOrientation() % 180 != 0);
+ boolean rotated = (getBlockContainerFO().getReferenceOrientation() % 180 != 0);
if (rotated) {
- height = ((BlockContainer) fobj).getInlineProgressionDimension().getOptimum().getLength();
- width = ((BlockContainer) fobj).getBlockProgressionDimension().getOptimum().getLength();
+ height = getBlockContainerFO().getInlineProgressionDimension().getOptimum().getLength();
+ width = getBlockContainerFO().getBlockProgressionDimension().getOptimum().getLength();
} else {
- height = ((BlockContainer) fobj).getBlockProgressionDimension().getOptimum().getLength();
- width = ((BlockContainer) fobj).getInlineProgressionDimension().getOptimum().getLength();
+ height = getBlockContainerFO().getBlockProgressionDimension().getOptimum().getLength();
+ width = getBlockContainerFO().getInlineProgressionDimension().getOptimum().getLength();
}
/*LF*/ bpUnit = 0; //layoutProps.blockProgressionUnit;
/*LF*/ if (bpUnit == 0) {
/*LF*/ // use optimum space values
-/*LF*/ adjustedSpaceBefore = ((BlockContainer) fobj).getCommonMarginBlock().spaceBefore.getSpace().getOptimum().getLength().getValue();
-/*LF*/ adjustedSpaceAfter = ((BlockContainer) fobj).getCommonMarginBlock().spaceAfter.getSpace().getOptimum().getLength().getValue();
+/*LF*/ adjustedSpaceBefore = getBlockContainerFO().getCommonMarginBlock().spaceBefore.getSpace().getOptimum().getLength().getValue();
+/*LF*/ adjustedSpaceAfter = getBlockContainerFO().getCommonMarginBlock().spaceAfter.getSpace().getOptimum().getLength().getValue();
/*LF*/ } else {
/*LF*/ // use minimum space values
-/*LF*/ adjustedSpaceBefore = ((BlockContainer) fobj).getCommonMarginBlock().spaceBefore.getSpace().getMinimum().getLength().getValue();
-/*LF*/ adjustedSpaceAfter = ((BlockContainer) fobj).getCommonMarginBlock().spaceAfter.getSpace().getMinimum().getLength().getValue();
+/*LF*/ adjustedSpaceBefore = getBlockContainerFO().getCommonMarginBlock().spaceBefore.getSpace().getMinimum().getLength().getValue();
+/*LF*/ adjustedSpaceAfter = getBlockContainerFO().getCommonMarginBlock().spaceAfter.getSpace().getMinimum().getLength().getValue();
/*LF*/ }
}
/** @return the content IPD */
protected int getRotatedIPD() {
- return ((BlockContainer) fobj).getInlineProgressionDimension().getOptimum().getLength().getValue();
+ return getBlockContainerFO().getInlineProgressionDimension().getOptimum().getLength().getValue();
}
private int getSpaceBefore() {
private int getBPIndents() {
int indents = 0;
- indents += ((BlockContainer) fobj).getCommonMarginBlock().spaceBefore.getOptimum().getLength().getValue();
- indents += ((BlockContainer) fobj).getCommonMarginBlock().spaceAfter.getOptimum().getLength().getValue();
- indents += ((BlockContainer) fobj).getCommonBorderPaddingBackground().getBPPaddingAndBorder(false);
+ indents += getBlockContainerFO().getCommonMarginBlock().spaceBefore.getOptimum().getLength().getValue();
+ indents += getBlockContainerFO().getCommonMarginBlock().spaceAfter.getOptimum().getLength().getValue();
+ indents += getBlockContainerFO().getCommonBorderPaddingBackground().getBPPaddingAndBorder(false);
return indents;
}
private int getIPIndents() {
int iIndents = 0;
- iIndents += ((BlockContainer) fobj).getCommonMarginBlock().startIndent.getValue();
- iIndents += ((BlockContainer) fobj).getCommonMarginBlock().endIndent.getValue();
+ iIndents += getBlockContainerFO().getCommonMarginBlock().startIndent.getValue();
+ iIndents += getBlockContainerFO().getCommonMarginBlock().endIndent.getValue();
return iIndents;
}
}
autoHeight = false;
- boolean rotated = (((BlockContainer) fobj).getReferenceOrientation() % 180 != 0); //vals[0] == 0.0;
+ boolean rotated = (getBlockContainerFO().getReferenceOrientation() % 180 != 0); //vals[0] == 0.0;
referenceIPD = context.getRefIPD();
int maxbpd = context.getStackLimit().opt;
int allocBPD, allocIPD;
vpContentIPD = allocIPD - getIPIndents();
double contentRectOffsetX = 0;
- contentRectOffsetX += ((BlockContainer) fobj).getCommonMarginBlock().startIndent.getValue();
+ contentRectOffsetX += getBlockContainerFO().getCommonMarginBlock().startIndent.getValue();
double contentRectOffsetY = 0;
- //contentRectOffsetY += ((BlockContainer) fobj).getCommonMarginBlock().startIndent.getValue();
+ //contentRectOffsetY += getBlockContainerFO().getCommonMarginBlock().startIndent.getValue();
//contentRectOffsetY += getSpaceBefore();
- contentRectOffsetY += ((BlockContainer) fobj).getCommonBorderPaddingBackground().getBorderBeforeWidth(false);
- contentRectOffsetY += ((BlockContainer) fobj).getCommonBorderPaddingBackground().getPaddingBefore(false);
+ contentRectOffsetY += getBlockContainerFO().getCommonBorderPaddingBackground().getBorderBeforeWidth(false);
+ contentRectOffsetY += getBlockContainerFO().getCommonBorderPaddingBackground().getPaddingBefore(false);
Rectangle2D rect = new Rectangle2D.Double(
contentRectOffsetX, contentRectOffsetY,
vpContentIPD, vpContentBPD);
relDims = new FODimension(0, 0);
- absoluteCTM = CTM.getCTMandRelDims(((BlockContainer) fobj).getReferenceOrientation(),
- ((BlockContainer) fobj).getWritingMode(), rect, relDims);
+ absoluteCTM = CTM.getCTMandRelDims(getBlockContainerFO().getReferenceOrientation(),
+ getBlockContainerFO().getWritingMode(), rect, relDims);
MinOptMax stackLimit = new MinOptMax(relDims.bpd);
if (contentOverflows) {
log.warn("Contents overflow block-container viewport: clipping");
- if (((BlockContainer) fobj).getOverflow() == EN_HIDDEN) {
+ if (getBlockContainerFO().getOverflow() == EN_HIDDEN) {
clip = true;
- } else if (((BlockContainer) fobj).getOverflow() == EN_ERROR_IF_OVERFLOW) {
+ } else if (getBlockContainerFO().getOverflow() == EN_ERROR_IF_OVERFLOW) {
//TODO Throw layout exception
clip = true;
}
vpContentIPD = allocIPD - getIPIndents();
double contentRectOffsetX = offset.getX();
- contentRectOffsetX += ((BlockContainer) fobj).getCommonMarginBlock().startIndent.getValue();
+ contentRectOffsetX += getBlockContainerFO().getCommonMarginBlock().startIndent.getValue();
double contentRectOffsetY = offset.getY();
contentRectOffsetY += getSpaceBefore();
- contentRectOffsetY += ((BlockContainer) fobj).getCommonBorderPaddingBackground().getBorderBeforeWidth(false);
- contentRectOffsetY += ((BlockContainer) fobj).getCommonBorderPaddingBackground().getPaddingBefore(false);
+ contentRectOffsetY += getBlockContainerFO().getCommonBorderPaddingBackground().getBorderBeforeWidth(false);
+ contentRectOffsetY += getBlockContainerFO().getCommonBorderPaddingBackground().getPaddingBefore(false);
Rectangle2D rect = new Rectangle2D.Double(
contentRectOffsetX, contentRectOffsetY,
vpContentIPD, vpContentBPD);
relDims = new FODimension(0, 0);
absoluteCTM = CTM.getCTMandRelDims(
- ((BlockContainer) fobj).getReferenceOrientation(),
- ((BlockContainer) fobj).getWritingMode(),
+ getBlockContainerFO().getReferenceOrientation(),
+ getBlockContainerFO().getWritingMode(),
rect, relDims);
MinOptMax range = new MinOptMax(relDims.ipd);
//TODO Maybe check for page overflow when autoHeight=true
if (!autoHeight & (contentOverflows/*usedBPD > relDims.bpd*/)) {
log.warn("Contents overflow block-container viewport: clipping");
- if (((BlockContainer) fobj).getOverflow() == EN_HIDDEN) {
+ if (getBlockContainerFO().getOverflow() == EN_HIDDEN) {
clip = true;
- } else if (((BlockContainer) fobj).getOverflow() == EN_ERROR_IF_OVERFLOW) {
+ } else if (getBlockContainerFO().getOverflow() == EN_ERROR_IF_OVERFLOW) {
//TODO Throw layout exception
clip = true;
}
}
protected int getCurrentDisplayAlign() {
- return ((BlockContainer) fobj).getDisplayAlign();
+ return getBlockContainerFO().getDisplayAlign();
}
protected boolean hasMoreContent() {
}
autoHeight = false;
- boolean rotated = (((BlockContainer) fobj).getReferenceOrientation() % 180 != 0); //vals[0] == 0.0;
+ boolean rotated = (getBlockContainerFO().getReferenceOrientation() % 180 != 0); //vals[0] == 0.0;
referenceIPD = context.getRefIPD();
int maxbpd = context.getStackLimit().opt;
int allocBPD, allocIPD;
vpContentIPD = allocIPD - getIPIndents();
double contentRectOffsetX = 0;
- contentRectOffsetX += ((BlockContainer) fobj).getCommonMarginBlock().startIndent.getValue();
+ contentRectOffsetX += getBlockContainerFO().getCommonMarginBlock().startIndent.getValue();
double contentRectOffsetY = 0;
- //contentRectOffsetY += ((BlockContainer) fobj).getCommonMarginBlock().startIndent.getValue();
+ //contentRectOffsetY += getBlockContainerFO().getCommonMarginBlock().startIndent.getValue();
//contentRectOffsetY += getSpaceBefore();
- contentRectOffsetY += ((BlockContainer) fobj).getCommonBorderPaddingBackground().getBorderBeforeWidth(false);
- contentRectOffsetY += ((BlockContainer) fobj).getCommonBorderPaddingBackground().getPaddingBefore(false);
+ contentRectOffsetY += getBlockContainerFO().getCommonBorderPaddingBackground().getBorderBeforeWidth(false);
+ contentRectOffsetY += getBlockContainerFO().getCommonBorderPaddingBackground().getPaddingBefore(false);
Rectangle2D rect = new Rectangle2D.Double(
contentRectOffsetX, contentRectOffsetY,
vpContentIPD, vpContentBPD);
relDims = new FODimension(0, 0);
- absoluteCTM = CTM.getCTMandRelDims(((BlockContainer) fobj).getReferenceOrientation(),
- ((BlockContainer) fobj).getWritingMode(), rect, relDims);
+ absoluteCTM = CTM.getCTMandRelDims(getBlockContainerFO().getReferenceOrientation(),
+ getBlockContainerFO().getWritingMode(), rect, relDims);
//double[] vals = absoluteCTM.toArray();
MinOptMax stackLimit;
BreakPoss lastPos = null;
//TODO fix layout dimensions!
- ((BlockContainer) fobj).setLayoutDimension(PercentBase.BLOCK_IPD, allocIPD);
- ((BlockContainer) fobj).setLayoutDimension(PercentBase.BLOCK_BPD, allocBPD);
- ((BlockContainer) fobj).setLayoutDimension(PercentBase.REFERENCE_AREA_IPD, relDims.ipd);
- ((BlockContainer) fobj).setLayoutDimension(PercentBase.REFERENCE_AREA_BPD, relDims.bpd);
+ getBlockContainerFO().setLayoutDimension(PercentBase.BLOCK_IPD, allocIPD);
+ getBlockContainerFO().setLayoutDimension(PercentBase.BLOCK_BPD, allocBPD);
+ getBlockContainerFO().setLayoutDimension(PercentBase.REFERENCE_AREA_IPD, relDims.ipd);
+ getBlockContainerFO().setLayoutDimension(PercentBase.REFERENCE_AREA_BPD, relDims.bpd);
while ((curLM = getChildLM()) != null) {
//Treat bc with fixed BPD as non-breakable
vpContentIPD = allocIPD - getIPIndents();
double contentRectOffsetX = offset.getX();
- contentRectOffsetX += ((BlockContainer) fobj).getCommonMarginBlock().startIndent.getValue();
+ contentRectOffsetX += getBlockContainerFO().getCommonMarginBlock().startIndent.getValue();
double contentRectOffsetY = offset.getY();
contentRectOffsetY += getSpaceBefore();
- contentRectOffsetY += ((BlockContainer) fobj).getCommonBorderPaddingBackground().getBorderBeforeWidth(false);
- contentRectOffsetY += ((BlockContainer) fobj).getCommonBorderPaddingBackground().getPaddingBefore(false);
+ contentRectOffsetY += getBlockContainerFO().getCommonBorderPaddingBackground().getBorderBeforeWidth(false);
+ contentRectOffsetY += getBlockContainerFO().getCommonBorderPaddingBackground().getPaddingBefore(false);
Rectangle2D rect = new Rectangle2D.Double(
contentRectOffsetX, contentRectOffsetY,
vpContentIPD, vpContentBPD);
relDims = new FODimension(0, 0);
absoluteCTM = CTM.getCTMandRelDims(
- ((BlockContainer) fobj).getReferenceOrientation(),
- ((BlockContainer) fobj).getWritingMode(),
+ getBlockContainerFO().getReferenceOrientation(),
+ getBlockContainerFO().getWritingMode(),
rect, relDims);
while ((curLM = getChildLM()) != null) {
//TODO Maybe check for page overflow when autoHeight=true
if (!autoHeight & (usedBPD > relDims.bpd)) {
log.warn("Contents overflow block-container viewport: clipping");
- if (((BlockContainer) fobj).getOverflow() == EN_HIDDEN) {
+ if (getBlockContainerFO().getOverflow() == EN_HIDDEN) {
clip = true;
- } else if (((BlockContainer) fobj).getOverflow() == EN_ERROR_IF_OVERFLOW) {
+ } else if (getBlockContainerFO().getOverflow() == EN_ERROR_IF_OVERFLOW) {
//TODO Throw layout exception
clip = true;
}
addBlockSpacing(0.0, new MinOptMax(layoutContext.getSpaceBefore()));
}
- addID(((BlockContainer) fobj).getId());
+ addID(getBlockContainerFO().getId());
//addMarkers(true, bp1.isFirstArea(), bp1.isLastArea());
addMarkers(true, true, false);
// add space before and / or after the paragraph
// to reach a multiple of bpUnit
if (bSpaceBefore && bSpaceAfter) {
- foBlockSpaceBefore = new SpaceVal(((BlockContainer) fobj).getCommonMarginBlock().spaceBefore).getSpace();
- foBlockSpaceAfter = new SpaceVal(((BlockContainer) fobj).getCommonMarginBlock().spaceAfter).getSpace();
+ foBlockSpaceBefore = new SpaceVal(getBlockContainerFO().getCommonMarginBlock().spaceBefore).getSpace();
+ foBlockSpaceAfter = new SpaceVal(getBlockContainerFO().getCommonMarginBlock().spaceAfter).getSpace();
adjustedSpaceBefore = (neededUnits(splitLength
+ foBlockSpaceBefore.min
+ foBlockSpaceAfter.min)
bcpos.getBreaker().addContainedAreas();
}
- int bIndents = ((BlockContainer) fobj).getCommonBorderPaddingBackground().getBPPaddingAndBorder(false);
+ int bIndents = getBlockContainerFO().getCommonBorderPaddingBackground().getBPPaddingAndBorder(false);
addMarkers(false, false, true);
}*/
BreakPoss bp1 = (BreakPoss)parentIter.peekNext();
- addID(((BlockContainer) fobj).getId());
+ addID(getBlockContainerFO().getId());
addMarkers(true, bp1.isFirstArea(), bp1.isLastArea());
LayoutManager childLM;
/*
if (!isAbsoluteOrFixed()) {
// if adjusted space after
- foBlockSpaceAfter = new SpaceVal(((BlockContainer) fobj).getCommonMarginBlock().spaceAfter).getSpace();
+ foBlockSpaceAfter = new SpaceVal(getBlockContainerFO().getCommonMarginBlock().spaceAfter).getSpace();
addBlockSpacing(adjust, foBlockSpaceAfter);
}*/
viewportBlockArea.setBPD(vpContentBPD);
}
- TraitSetter.addBorders(viewportBlockArea, ((BlockContainer) fobj).getCommonBorderPaddingBackground());
- TraitSetter.addBackground(viewportBlockArea, ((BlockContainer) fobj).getCommonBorderPaddingBackground());
+ TraitSetter.addBorders(viewportBlockArea, getBlockContainerFO().getCommonBorderPaddingBackground());
+ TraitSetter.addBackground(viewportBlockArea, getBlockContainerFO().getCommonBorderPaddingBackground());
TraitSetter.addMargins(viewportBlockArea,
- ((BlockContainer) fobj).getCommonBorderPaddingBackground(),
- ((BlockContainer) fobj).getCommonMarginBlock());
+ getBlockContainerFO().getCommonBorderPaddingBackground(),
+ getBlockContainerFO().getCommonMarginBlock());
viewportBlockArea.setCTM(absoluteCTM);
viewportBlockArea.setClip(clip);
usedBPD = referenceArea.getAllocBPD();
/* done by the breaker now by inserting additional boxes
if (!autoHeight & (usedBPD > 0)) {
- if (((BlockContainer) fobj).getDisplayAlign() == EN_CENTER) {
+ if (getBlockContainerFO().getDisplayAlign() == EN_CENTER) {
viewportBlockArea.setCTM(viewportBlockArea.getCTM().multiply(
new CTM().translate(0, (relDims.bpd - usedBPD) / 2)));
- } else if (((BlockContainer) fobj).getDisplayAlign() == EN_AFTER) {
+ } else if (getBlockContainerFO().getDisplayAlign() == EN_AFTER) {
viewportBlockArea.setCTM(viewportBlockArea.getCTM().multiply(
new CTM().translate(0, (relDims.bpd - usedBPD))));
}
public boolean mustKeepTogether() {
//TODO Keeps will have to be more sophisticated sooner or later
return ((BlockLevelLayoutManager)getParent()).mustKeepTogether()
- || !((BlockContainer) fobj).getKeepTogether().getWithinPage().isAuto()
- || !((BlockContainer) fobj).getKeepTogether().getWithinColumn().isAuto();
+ || !getBlockContainerFO().getKeepTogether().getWithinPage().isAuto()
+ || !getBlockContainerFO().getKeepTogether().getWithinColumn().isAuto();
}
/**
* @see org.apache.fop.layoutmgr.BlockLevelLayoutManager#mustKeepWithPrevious()
*/
public boolean mustKeepWithPrevious() {
- return !((BlockContainer) fobj).getKeepWithPrevious().getWithinPage().isAuto()
- || !((BlockContainer) fobj).getKeepWithPrevious().getWithinColumn().isAuto();
+ return !getBlockContainerFO().getKeepWithPrevious().getWithinPage().isAuto()
+ || !getBlockContainerFO().getKeepWithPrevious().getWithinColumn().isAuto();
}
/**
* @see org.apache.fop.layoutmgr.BlockLevelLayoutManager#mustKeepWithNext()
*/
public boolean mustKeepWithNext() {
- return !((BlockContainer) fobj).getKeepWithNext().getWithinPage().isAuto()
- || !((BlockContainer) fobj).getKeepWithNext().getWithinColumn().isAuto();
+ return !getBlockContainerFO().getKeepWithNext().getWithinPage().isAuto()
+ || !getBlockContainerFO().getKeepWithNext().getWithinColumn().isAuto();
}
-
+
+ /**
+ * convenience method that returns the BlockContainer node
+ */
+ protected BlockContainer getBlockContainerFO() {
+ return (BlockContainer) fobj;
+ }
}
super(inBlock);
proxyLMiter = new ProxyLMiter();
- Font fs = ((org.apache.fop.fo.flow.Block) fobj).getCommonFont().getFontState(
- ((org.apache.fop.fo.flow.Block) fobj).getFOEventHandler().getFontInfo());
+ Font fs = getBlockFO().getCommonFont().getFontState(
+ getBlockFO().getFOEventHandler().getFontInfo());
lead = fs.getAscender();
follow = -fs.getDescender();
middleShift = -fs.getXHeight() / 2;
- lineHeight = ((org.apache.fop.fo.flow.Block) fobj).getLineHeight().getOptimum().getLength().getValue();
+ lineHeight = getBlockFO().getLineHeight().getOptimum().getLength().getValue();
}
/**
* if defined for the block.
*/
protected void initProperties() {
- foBlockSpaceBefore = new SpaceVal(((org.apache.fop.fo.flow.Block) fobj).getCommonMarginBlock().spaceBefore).getSpace();
+ foBlockSpaceBefore = new SpaceVal(getBlockFO().getCommonMarginBlock().spaceBefore).getSpace();
prevFoBlockSpaceAfter = foBlockSpaceAfter;
/*LF*/ bpUnit = 0; //layoutProps.blockProgressionUnit;
/*LF*/ if (bpUnit == 0) {
/*LF*/ // use optimum space values
-/*LF*/ adjustedSpaceBefore = ((org.apache.fop.fo.flow.Block) fobj).getCommonMarginBlock().spaceBefore.getSpace().getOptimum().getLength().getValue();
-/*LF*/ adjustedSpaceAfter = ((org.apache.fop.fo.flow.Block) fobj).getCommonMarginBlock().spaceAfter.getSpace().getOptimum().getLength().getValue();
+/*LF*/ adjustedSpaceBefore = getBlockFO().getCommonMarginBlock().spaceBefore.getSpace().getOptimum().getLength().getValue();
+/*LF*/ adjustedSpaceAfter = getBlockFO().getCommonMarginBlock().spaceAfter.getSpace().getOptimum().getLength().getValue();
/*LF*/ } else {
/*LF*/ // use minimum space values
-/*LF*/ adjustedSpaceBefore = ((org.apache.fop.fo.flow.Block) fobj).getCommonMarginBlock().spaceBefore.getSpace().getMinimum().getLength().getValue();
-/*LF*/ adjustedSpaceAfter = ((org.apache.fop.fo.flow.Block) fobj).getCommonMarginBlock().spaceAfter.getSpace().getMinimum().getLength().getValue();
+/*LF*/ adjustedSpaceBefore = getBlockFO().getCommonMarginBlock().spaceBefore.getSpace().getMinimum().getLength().getValue();
+/*LF*/ adjustedSpaceAfter = getBlockFO().getCommonMarginBlock().spaceAfter.getSpace().getMinimum().getLength().getValue();
/*LF*/ }
}
*/
private LineLayoutManager createLineManager(LayoutManager firstlm) {
LineLayoutManager llm;
- llm = new LineLayoutManager(((org.apache.fop.fo.flow.Block) fobj), lineHeight, lead, follow, middleShift);
+ llm = new LineLayoutManager(getBlockFO(), lineHeight, lead, follow, middleShift);
List inlines = new java.util.ArrayList();
inlines.add(firstlm);
while (proxyLMiter.hasNext()) {
private int getIPIndents() {
int iIndents = 0;
- iIndents += ((org.apache.fop.fo.flow.Block) fobj).getCommonMarginBlock().startIndent.getValue();
- iIndents += ((org.apache.fop.fo.flow.Block) fobj).getCommonMarginBlock().endIndent.getValue();
+ iIndents += getBlockFO().getCommonMarginBlock().startIndent.getValue();
+ iIndents += getBlockFO().getCommonMarginBlock().endIndent.getValue();
return iIndents;
}
BreakPoss lastPos = null;
// Set context for percentage property values.
- ((org.apache.fop.fo.flow.Block) fobj).setLayoutDimension(PercentBase.BLOCK_IPD, contentipd);
- ((org.apache.fop.fo.flow.Block) fobj).setLayoutDimension(PercentBase.BLOCK_BPD, -1);
+ getBlockFO().setLayoutDimension(PercentBase.BLOCK_IPD, contentipd);
+ getBlockFO().setLayoutDimension(PercentBase.BLOCK_BPD, -1);
while ((curLM = getChildLM()) != null) {
// Make break positions and return blocks!
if (getChildLM() == null || over) {
if (getChildLM() == null) {
setFinished(true);
- stackSize.add(new SpaceVal(((org.apache.fop.fo.flow.Block) fobj).getCommonMarginBlock().spaceAfter).getSpace());
+ stackSize.add(new SpaceVal(getBlockFO().getCommonMarginBlock().spaceAfter).getSpace());
}
BreakPoss breakPoss = new BreakPoss(
new LeafPosition(this, childBreaks.size() - 1));
public boolean mustKeepTogether() {
//TODO Keeps will have to be more sophisticated sooner or later
return ((BlockLevelLayoutManager)getParent()).mustKeepTogether()
- || !((org.apache.fop.fo.flow.Block) fobj).getKeepTogether().getWithinPage().isAuto()
- || !((org.apache.fop.fo.flow.Block) fobj).getKeepTogether().getWithinColumn().isAuto();
+ || !getBlockFO().getKeepTogether().getWithinPage().isAuto()
+ || !getBlockFO().getKeepTogether().getWithinColumn().isAuto();
}
/**
* @see org.apache.fop.layoutmgr.BlockLevelLayoutManager#mustKeepWithPrevious()
*/
public boolean mustKeepWithPrevious() {
- return !((org.apache.fop.fo.flow.Block) fobj).getKeepWithPrevious().getWithinPage().isAuto()
- || !((org.apache.fop.fo.flow.Block) fobj).getKeepWithPrevious().getWithinColumn().isAuto();
+ return !getBlockFO().getKeepWithPrevious().getWithinPage().isAuto()
+ || !getBlockFO().getKeepWithPrevious().getWithinColumn().isAuto();
}
/**
* @see org.apache.fop.layoutmgr.BlockLevelLayoutManager#mustKeepWithNext()
*/
public boolean mustKeepWithNext() {
- return !((org.apache.fop.fo.flow.Block) fobj).getKeepWithNext().getWithinPage().isAuto()
- || !((org.apache.fop.fo.flow.Block) fobj).getKeepWithNext().getWithinColumn().isAuto();
+ return !getBlockFO().getKeepWithNext().getWithinPage().isAuto()
+ || !getBlockFO().getKeepWithNext().getWithinColumn().isAuto();
}
//TODO this method is no longer used
foBlockSpaceBefore = null;
if (!isBogus()) {
- addID(((org.apache.fop.fo.flow.Block) fobj).getId());
+ addID(getBlockFO().getId());
addMarkers(true, bp1.isFirstArea(), bp1.isLastArea());
}
flush();
// if adjusted space after
- foBlockSpaceAfter = new SpaceVal(((org.apache.fop.fo.flow.Block) fobj).getCommonMarginBlock().spaceAfter).getSpace();
+ foBlockSpaceAfter = new SpaceVal(getBlockFO().getCommonMarginBlock().spaceAfter).getSpace();
addBlockSpacing(adjust, foBlockSpaceAfter);
curBlockArea = null;
}
addBlockSpacing(0.0, new MinOptMax(layoutContext.getSpaceBefore()));
}
- addID(((org.apache.fop.fo.flow.Block) fobj).getId());
+ addID(getBlockFO().getId());
//addMarkers(true, bp1.isFirstArea(), bp1.isLastArea());
addMarkers(true, true, false);
// add space before and / or after the paragraph
// to reach a multiple of bpUnit
if (bSpaceBefore && bSpaceAfter) {
- foBlockSpaceBefore = new SpaceVal(((org.apache.fop.fo.flow.Block) fobj).getCommonMarginBlock().spaceBefore).getSpace();
- foBlockSpaceAfter = new SpaceVal(((org.apache.fop.fo.flow.Block) fobj).getCommonMarginBlock().spaceAfter).getSpace();
+ foBlockSpaceBefore = new SpaceVal(getBlockFO().getCommonMarginBlock().spaceBefore).getSpace();
+ foBlockSpaceAfter = new SpaceVal(getBlockFO().getCommonMarginBlock().spaceAfter).getSpace();
adjustedSpaceBefore = (neededUnits(splitLength
+ foBlockSpaceBefore.min
+ foBlockSpaceAfter.min)
childLM.addAreas(childPosIter, lc);
}
- int bIndents = ((org.apache.fop.fo.flow.Block) fobj).getCommonBorderPaddingBackground().getBPPaddingAndBorder(false);
+ int bIndents = getBlockFO().getCommonBorderPaddingBackground().getBPPaddingAndBorder(false);
addMarkers(false, false, true);
curBlockArea = new Block();
TraitSetter.addBreaks(curBlockArea,
- ((org.apache.fop.fo.flow.Block) fobj).getBreakBefore(), ((org.apache.fop.fo.flow.Block) fobj).getBreakAfter());
+ getBlockFO().getBreakBefore(), getBlockFO().getBreakAfter());
// Must get dimensions from parent area
//Don't optimize this line away. It can have ugly side-effects.
// set traits
TraitSetter.addBorders(curBlockArea,
- ((org.apache.fop.fo.flow.Block) fobj).getCommonBorderPaddingBackground());
+ getBlockFO().getCommonBorderPaddingBackground());
TraitSetter.addBackground(curBlockArea,
- ((org.apache.fop.fo.flow.Block) fobj).getCommonBorderPaddingBackground());
+ getBlockFO().getCommonBorderPaddingBackground());
TraitSetter.addMargins(curBlockArea,
- ((org.apache.fop.fo.flow.Block) fobj).getCommonBorderPaddingBackground(),
- ((org.apache.fop.fo.flow.Block) fobj).getCommonMarginBlock());
+ getBlockFO().getCommonBorderPaddingBackground(),
+ getBlockFO().getCommonMarginBlock());
// Set up dimensions
// Get reference IPD from parentArea
LayoutManager lm = resetPos.getLM();
}
}
+
+ /**
+ * convenience method that returns the Block node
+ */
+ protected org.apache.fop.fo.flow.Block getBlockFO() {
+ return (org.apache.fop.fo.flow.Block) fobj;
+ }
}