aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLuca Furini <lfurini@apache.org>2005-05-31 16:19:29 +0000
committerLuca Furini <lfurini@apache.org>2005-05-31 16:19:29 +0000
commit2f75a4659d2cfe7f61f5a98521031d81cfb02c56 (patch)
tree766fe35c1daf4e0525c66d68b8d80aaa6989c0a5 /src
parent319ace2424682be5db5ddbf83b78ceb517fb916d (diff)
downloadxmlgraphics-fop-2f75a4659d2cfe7f61f5a98521031d81cfb02c56.tar.gz
xmlgraphics-fop-2f75a4659d2cfe7f61f5a98521031d81cfb02c56.zip
Handling page dependent footnote separator
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@198710 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r--src/java/org/apache/fop/layoutmgr/AbstractBreaker.java2
-rw-r--r--src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java45
-rw-r--r--src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java30
3 files changed, 45 insertions, 32 deletions
diff --git a/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java b/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java
index e5f8f67e3..8cfa6d052 100644
--- a/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java
+++ b/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java
@@ -94,7 +94,7 @@ public abstract class AbstractBreaker {
private List blockLists = null;
- private int alignment;
+ protected int alignment;
private int alignmentLast;
protected MinOptMax footnoteSeparatorLength = new MinOptMax(0);
diff --git a/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java b/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java
index 54dd6e2fc..428e2d061 100644
--- a/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/PageSequenceLayoutManager.java
@@ -192,36 +192,23 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager {
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;
}
@@ -235,6 +222,18 @@ public class PageSequenceLayoutManager extends AbstractLayoutManager {
}
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);
}
diff --git a/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java b/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java
index 16914757e..613f17a75 100644
--- a/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java
@@ -172,8 +172,8 @@ public class StaticContentLayoutManager extends BlockStackingLayoutManager {
if (getStaticContentFO().getFlowName().equals("xsl-footnote-separator")) {
targetBlock.addBlock((Block)childArea);
} else {
- targetRegion.addBlock((Block)childArea);
- }
+ targetRegion.addBlock((Block)childArea);
+ }
}
/**
@@ -183,19 +183,33 @@ public class StaticContentLayoutManager extends BlockStackingLayoutManager {
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.");