StaticContent footnoteSeparator;
if (bFootnotesPresent
&& (footnoteSeparator = pageSeq.getStaticContent("xsl-footnote-separator")) != null) {
+ // the footnote separator can contain page-dependent content such as
+ // page numbers or retrieve markers, so its areas cannot simply be
+ // obtained now and repeated in each page;
+ // we need to know in advance the separator bpd: the actual separator
+ // could be different from page to page, but its bpd would likely be
+ // always the same
+
// create a Block area that will contain the separator areas
separatorArea = new Block();
-
+ separatorArea.setIPD(context.getRefIPD());
// create a StaticContentLM for the footnote separator
footnoteSeparatorLM = (StaticContentLayoutManager)
getLayoutManagerMaker().makeStaticContentLayoutManager(
pslm, footnoteSeparator, separatorArea);
+ footnoteSeparatorLM.doLayout();
- // get the list of elements representing the footnote separator
- footnoteSeparatorList = footnoteSeparatorLM.getNextKnuthElements(context, alignment);
-
- // compute the total length of the elements
- footnoteSeparatorLength = new MinOptMax(0);
- ListIterator separatorIterator = footnoteSeparatorList.listIterator();
- while (separatorIterator.hasNext()) {
- KnuthElement element = (KnuthElement) separatorIterator.next();
- if (element.isBox()) {
- footnoteSeparatorLength.add(new MinOptMax(element.getW()));
- } else if (element.isGlue()) {
- footnoteSeparatorLength.add(new MinOptMax(element.getW()));
- footnoteSeparatorLength.max += element.getY();
- footnoteSeparatorLength.min -= element.getZ();
- }
- }
-
- // add the footnote separator areas to the Block area
- if (footnoteSeparatorList != null) {
- LayoutContext childLC = new LayoutContext(0);
- footnoteSeparatorLM.addAreas(new KnuthPossPosIter(footnoteSeparatorList, 0, footnoteSeparatorList.size()), childLC);
- }
+ footnoteSeparatorLength = new MinOptMax(separatorArea.getBPD());
}
return contentList;
}
}
protected void addAreas(PositionIterator posIter, LayoutContext context) {
+ if (footnoteSeparatorLM != null) {
+ StaticContent footnoteSeparator = pageSeq.getStaticContent("xsl-footnote-separator");
+ // create a Block area that will contain the separator areas
+ separatorArea = new Block();
+ separatorArea.setIPD(curPV.getCurrentSpan().getColumnWidth());
+ // create a StaticContentLM for the footnote separator
+ footnoteSeparatorLM = (StaticContentLayoutManager)
+ getLayoutManagerMaker().makeStaticContentLayoutManager(
+ pslm, footnoteSeparator, separatorArea);
+ footnoteSeparatorLM.doLayout();
+ }
+
getCurrentChildLM().addAreas(posIter, context);
}
if (getStaticContentFO().getFlowName().equals("xsl-footnote-separator")) {
targetBlock.addBlock((Block)childArea);
} else {
- targetRegion.addBlock((Block)childArea);
- }
+ targetRegion.addBlock((Block)childArea);
+ }
}
/**
if (getStaticContentFO().getFlowName().equals("xsl-footnote-separator")) {
return targetBlock;
} else {
- return targetRegion;
- }
+ return targetRegion;
+ }
}
/**
* Does the layout for a side region. Called by PageSequenceLayoutManager.
*/
public void doLayout() {
- StaticContentBreaker breaker = new StaticContentBreaker(
- this, targetRegion.getIPD(), regionFO.getDisplayAlign());
- breaker.doLayout(targetRegion.getBPD());
+ int targetIPD = 0;
+ int targetBPD = 0;
+ int targetAlign = EN_AUTO;
+ StaticContentBreaker breaker;
+
+ if (getStaticContentFO().getFlowName().equals("xsl-footnote-separator")) {
+ targetIPD = targetBlock.getIPD();
+ targetBPD = targetBlock.getBPD();
+ targetAlign = EN_BEFORE;
+ } else {
+ targetIPD = targetRegion.getIPD();
+ targetBPD = targetRegion.getBPD();
+ targetAlign = regionFO.getDisplayAlign();
+ }
+ breaker = new StaticContentBreaker(this, targetIPD, targetAlign);
+ breaker.doLayout(targetBPD);
if (breaker.isOverflow()) {
- if (regionFO.getOverflow() == EN_ERROR_IF_OVERFLOW) {
+ if (!getStaticContentFO().getFlowName().equals("xsl-footnote-separator")
+ && regionFO.getOverflow() == EN_ERROR_IF_OVERFLOW) {
//TODO throw layout exception
}
log.warn("static-content overflows the available area.");