You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by ph...@apache.org on 2012/08/16 15:31:44 UTC
svn commit: r1373825 [3/4] - in
/xmlgraphics/fop/branches/Temp_RoundedCorners: ./ lib/
src/documentation/content/ src/documentation/content/xdocs/
src/documentation/content/xdocs/1.1rc1/
src/documentation/content/xdocs/1.1rc1/fotree/ src/documentation/...
Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java Thu Aug 16 13:31:38 2012
@@ -193,7 +193,7 @@ public class BlockContainerLayoutManager
*/
@Override
protected LayoutContext makeChildLayoutContext(LayoutContext context) {
- LayoutContext childLC = new LayoutContext(0);
+ LayoutContext childLC = LayoutContext.newInstance();
childLC.setStackLimitBP(
context.getStackLimitBP().minus(MinOptMax.getInstance(relDims.bpd)));
childLC.setRefIPD(relDims.ipd);
@@ -707,7 +707,7 @@ public class BlockContainerLayoutManager
return curChildLM;
}
- public void addContainedAreas() {
+ public void addContainedAreas(LayoutContext layoutContext) {
if (isEmpty()) {
return;
}
@@ -715,8 +715,10 @@ public class BlockContainerLayoutManager
//overflow should be visible.
this.deferredAlg.removeAllPageBreaks();
this.addAreas(this.deferredAlg,
+ 0,
this.deferredAlg.getPageBreaks().size(),
- this.deferredOriginalList, this.deferredEffectiveList);
+ this.deferredOriginalList, this.deferredEffectiveList,
+ LayoutContext.offspringOf(layoutContext));
}
}
@@ -754,7 +756,7 @@ public class BlockContainerLayoutManager
LayoutManager childLM;
LayoutManager lastLM = null;
- LayoutContext lc = new LayoutContext(0);
+ LayoutContext lc = LayoutContext.offspringOf(layoutContext);
lc.setSpaceAdjust(layoutContext.getSpaceAdjust());
// set space after in the LayoutContext for children
if (layoutContext.getSpaceAfter() > 0) {
@@ -821,7 +823,7 @@ public class BlockContainerLayoutManager
}
} else {
//Add child areas inside the reference area
- bcpos.getBreaker().addContainedAreas();
+ bcpos.getBreaker().addContainedAreas(layoutContext);
}
addMarkersToPage(false, isFirst(firstPos), isLast(lastPos));
@@ -1044,10 +1046,6 @@ public class BlockContainerLayoutManager
return true;
}
- public int getBreakBefore() {
- return BreakOpportunityHelper.getBreakBefore(this);
- }
-
}
Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/BlockLayoutManager.java Thu Aug 16 13:31:38 2012
@@ -272,7 +272,7 @@ public class BlockLayoutManager extends
LayoutManager childLM;
LayoutManager lastLM = null;
- LayoutContext lc = new LayoutContext(0);
+ LayoutContext lc = LayoutContext.offspringOf(layoutContext);
lc.setSpaceAdjust(layoutContext.getSpaceAdjust());
// set space after in the LayoutContext for children
if (layoutContext.getSpaceAfter() > 0) {
@@ -504,8 +504,4 @@ public class BlockLayoutManager extends
return true;
}
- public int getBreakBefore() {
- return BreakOpportunityHelper.getBreakBefore(this);
- }
-
}
Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/BlockStackingLayoutManager.java Thu Aug 16 13:31:38 2012
@@ -383,7 +383,7 @@ public abstract class BlockStackingLayou
* @return a new child layout context
*/
protected LayoutContext makeChildLayoutContext(LayoutContext context) {
- LayoutContext childLC = new LayoutContext(0);
+ LayoutContext childLC = LayoutContext.newInstance();
childLC.copyPendingMarksFrom(context);
childLC.setStackLimitBP(context.getStackLimitBP());
childLC.setRefIPD(referenceIPD);
@@ -1035,7 +1035,7 @@ public abstract class BlockStackingLayou
* @return true if an element has been added due to a break-before.
*/
protected boolean addKnuthElementsForBreakBefore(List returnList, LayoutContext context) {
- int breakBefore = BreakOpportunityHelper.getBreakBefore(this);
+ int breakBefore = getBreakBefore();
if (breakBefore == EN_PAGE
|| breakBefore == EN_COLUMN
|| breakBefore == EN_EVEN_PAGE
@@ -1050,6 +1050,17 @@ public abstract class BlockStackingLayou
}
/**
+ * Returns the highest priority break-before value on this layout manager or its
+ * relevant descendants.
+ *
+ * @return the break-before value (Constants.EN_*)
+ * @see BreakOpportunity#getBreakBefore()
+ */
+ public int getBreakBefore() {
+ return BreakOpportunityHelper.getBreakBefore(this);
+ }
+
+ /**
* Creates Knuth elements for break-after and adds them to the return list.
* @param returnList return list to add the additional elements to
* @param context the layout context
Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/BreakingAlgorithm.java Thu Aug 16 13:31:38 2012
@@ -532,14 +532,15 @@ public abstract class BreakingAlgorithm
// index of the first KnuthBox in the sequence, in case of non-centered
// alignment. For centered alignment, we need to take into account preceding
// penalties+glues used for the filler spaces
- int firstBoxIndex = startIndex;
+ int previousPosition = startIndex;
if (alignment != Constants.EN_CENTER) {
- firstBoxIndex = par.getFirstBoxIndex(startIndex);
+ int firstBoxIndex = par.getFirstBoxIndex(startIndex);
+ previousPosition = (firstBoxIndex >= par.size()) ? startIndex : firstBoxIndex - 1;
}
- firstBoxIndex = (firstBoxIndex < 0) ? 0 : firstBoxIndex;
+ previousPosition = (previousPosition < 0) ? 0 : previousPosition;
// create an active node representing the starting point
- addNode(0, createNode(firstBoxIndex, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, null));
+ addNode(0, createNode(previousPosition, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, null));
KnuthNode lastForced = getNode(0);
if (log.isTraceEnabled()) {
Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/FlowLayoutManager.java Thu Aug 16 13:31:38 2012
@@ -200,7 +200,7 @@ public class FlowLayoutManager extends B
*/
@Override
protected LayoutContext makeChildLayoutContext(LayoutContext context) {
- LayoutContext childLC = new LayoutContext(0);
+ LayoutContext childLC = LayoutContext.newInstance();
childLC.setStackLimitBP(context.getStackLimitBP());
childLC.setRefIPD(context.getRefIPD());
childLC.setWritingMode(getCurrentPage().getSimplePageMaster().getWritingMode());
Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/FootnoteBodyLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/FootnoteBodyLayoutManager.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/FootnoteBodyLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/FootnoteBodyLayoutManager.java Thu Aug 16 13:31:38 2012
@@ -42,7 +42,7 @@ public class FootnoteBodyLayoutManager e
public void addAreas(PositionIterator parentIter, LayoutContext layoutContext) {
LayoutManager childLM;
LayoutManager lastLM = null;
- LayoutContext lc = new LayoutContext(0);
+ LayoutContext lc = LayoutContext.newInstance();
// "unwrap" the NonLeafPositions stored in parentIter
// and put them in a new list;
Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/KnuthSequence.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/KnuthSequence.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/KnuthSequence.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/KnuthSequence.java Thu Aug 16 13:31:38 2012
@@ -20,6 +20,7 @@
package org.apache.fop.layoutmgr;
import java.util.ArrayList;
+import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
@@ -159,46 +160,26 @@ public abstract class KnuthSequence exte
: (ListElement) get(index);
}
- /** @return the position index of the first box in this sequence */
- protected int getFirstBoxIndex() {
- if (isEmpty()) {
- return -1;
- } else {
- return getFirstBoxIndex(0);
- }
- }
-
/**
- * Get the position index of the first box in this sequence,
- * starting at the given index. If there is no box after the
- * passed {@code startIndex}, the starting index itself is returned.
- * @param startIndex the starting index for the lookup
- * @return the absolute position index of the next box element
+ * Returns the position index of the first box in this sequence, starting at the given
+ * index. If {@code startIndex} is outside the bounds of this sequence, it is
+ * returned.
+ *
+ * @param startIndex the index from which to start the lookup
+ * @return the index of the next box element, {@link #size()} if there is no such
+ * element, {@code startIndex} if {@code (startIndex < 0 || startIndex >= size())}
*/
protected int getFirstBoxIndex(int startIndex) {
- if (isEmpty() || startIndex < 0 || startIndex >= size()) {
- return -1;
+ if (startIndex < 0 || startIndex >= size()) {
+ return startIndex;
} else {
- ListElement element = null;
- int posIndex = startIndex;
- int lastIndex = size();
- while ( posIndex < lastIndex ) {
- element = getElement(posIndex);
- if ( !element.isBox() ) {
- posIndex++;
- } else {
- break;
- }
- }
- if ( posIndex != startIndex ) {
- if ( ( element != null ) && element.isBox() ) {
- return posIndex - 1;
- } else {
- return startIndex;
- }
- } else {
- return startIndex;
+ int boxIndex = startIndex;
+ @SuppressWarnings("unchecked")
+ Iterator<ListElement> iter = listIterator(startIndex);
+ while (iter.hasNext() && !iter.next().isBox()) {
+ boxIndex++;
}
+ return boxIndex;
}
}
Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/LayoutContext.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/LayoutContext.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/LayoutContext.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/LayoutContext.java Thu Aug 16 13:31:38 2012
@@ -33,47 +33,27 @@ import org.apache.fop.traits.WritingMode
* This class is used to pass information to the getNextKnuthElements()
* method. It is set up by higher level LM and used by lower level LM.
*/
-public class LayoutContext {
+public final class LayoutContext {
- /** linebreak at line feed only flag */
- public static final int LINEBREAK_AT_LF_ONLY = 0x01;
/** Generated break possibility is first in a new area */
- public static final int NEW_AREA = 0x02;
- /** ipd unknown flag */
- public static final int IPD_UNKNOWN = 0x04;
- /** Signal to a Line LM that a higher level LM may provoke a change
- * in the reference area, thus ref area IPD. The LineLM should return
- * without looking for a line break.
- */
- public static final int CHECK_REF_AREA = 0x08;
+ public static final int NEW_AREA = 0x01;
/**
* If this flag is set, it indicates that any break-before values other than "auto" should
* not cause a mandatory break as this break was already handled by a parent layout manager.
*/
- public static final int SUPPRESS_BREAK_BEFORE = 0x10;
- /** first area flag */
- public static final int FIRST_AREA = 0x20;
- /** try hypenate flag */
- public static final int TRY_HYPHENATE = 0x40;
- /** last area flag */
- public static final int LAST_AREA = 0x80;
- /** resolve leading space flag */
- public static final int RESOLVE_LEADING_SPACE = 0x100;
-
- /**
- * This flag indicates that there's a keep-with-next that hasn't
- * been processed, yet.
- */
- //public static final int KEEP_WITH_NEXT_PENDING = 0x200;
- /**
- * This flag indicates that there's a keep-with-previous that hasn't
- * been processed, yet.
- */
- //public static final int KEEP_WITH_PREVIOUS_PENDING = 0x400;
+ public static final int SUPPRESS_BREAK_BEFORE = 0x02;
+
+ public static final int FIRST_AREA = 0x04;
+
+ public static final int LAST_AREA = 0x08;
+ public static final int RESOLVE_LEADING_SPACE = 0x10;
+
+ private static final int TREAT_AS_ARTIFACT = 0x20;
private int flags; // Contains some set of flags defined above
+
/**
* Total available stacking dimension for a "galley-level" layout
* manager in block-progression-direction. It is passed by the
@@ -145,11 +125,27 @@ public class LayoutContext {
private int disableColumnBalancing;
+ public static LayoutContext newInstance() {
+ return new LayoutContext(0);
+ }
+
+ public static LayoutContext copyOf(LayoutContext copy) {
+ return new LayoutContext(copy);
+ }
+
/**
- * Copy constructor for creating child layout contexts.
- * @param parentLC the parent layout context to copy from
+ * Returns a descendant of the given layout context. The new context is the same as
+ * what would have been created by {@link #newInstance()}, except for inheritable
+ * properties that are passed on by the parent. At the moment, the only inheritable
+ * property is the value returned by {@link #treatAsArtifact()}.
*/
- public LayoutContext(LayoutContext parentLC) {
+ public static LayoutContext offspringOf(LayoutContext parent) {
+ LayoutContext offspring = new LayoutContext(0);
+ offspring.setTreatAsArtifact(parent.treatAsArtifact());
+ return offspring;
+ }
+
+ private LayoutContext(LayoutContext parentLC) {
this.flags = parentLC.flags;
this.refIPD = parentLC.refIPD;
this.writingMode = parentLC.writingMode;
@@ -170,11 +166,7 @@ public class LayoutContext {
this.disableColumnBalancing = parentLC.disableColumnBalancing;
}
- /**
- * Main constructor.
- * @param flags the initial flags
- */
- public LayoutContext(int flags) {
+ private LayoutContext(int flags) {
this.flags = flags;
this.refIPD = 0;
stackLimitBP = MinOptMax.ZERO;
@@ -435,11 +427,6 @@ public class LayoutContext {
return hyphContext;
}
- /** @return true if try hyphenate is set */
- public boolean tryHyphenate() {
- return ((this.flags & TRY_HYPHENATE) != 0);
- }
-
/**
* Sets the currently applicable alignment in BP direction.
* @param alignment one of EN_START, EN_JUSTIFY etc.
@@ -673,7 +660,6 @@ public class LayoutContext {
+ "\nIs First Area: \t" + isFirstArea()
+ "\nStarts New Area: \t" + startsNewArea()
+ "\nIs Last Area: \t" + isLastArea()
- + "\nTry Hyphenate: \t" + tryHyphenate()
+ "\nKeeps: \t[keep-with-next=" + getKeepWithNextPending()
+ "][keep-with-previous=" + getKeepWithPreviousPending() + "] pending"
+ "\nBreaks: \tforced [" + (breakBefore != Constants.EN_AUTO ? "break-before" : "") + "]["
@@ -698,5 +684,13 @@ public class LayoutContext {
public void setDisableColumnBalancing(int disableColumnBalancing) {
this.disableColumnBalancing = disableColumnBalancing;
}
+
+ public boolean treatAsArtifact() {
+ return (flags & TREAT_AS_ARTIFACT) != 0;
+ }
+
+ public void setTreatAsArtifact(boolean treatAsArtifact) {
+ setFlags(TREAT_AS_ARTIFACT, treatAsArtifact);
+ }
}
Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/PageBreaker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/PageBreaker.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/PageBreaker.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/PageBreaker.java Thu Aug 16 13:31:38 2012
@@ -95,8 +95,7 @@ public class PageBreaker extends Abstrac
return new PageBreakingLayoutListener() {
public void notifyOverflow(int part, int amount, FObj obj) {
- Page p = pageProvider.getPage(
- false, part, PageProvider.RELTO_CURRENT_ELEMENT_LIST);
+ Page p = pageProvider.getPageFromColumnIndex(part);
RegionBody body = (RegionBody)p.getSimplePageMaster().getRegion(
Region.FO_REGION_BODY);
BlockLevelEventProducer eventProducer = BlockLevelEventProducer.Provider.get(
@@ -167,7 +166,7 @@ public class PageBreaker extends Abstrac
&& ((KnuthBlockBox) element).hasAnchors()) {
// element represents a line with footnote citations
containsFootnotes = true;
- LayoutContext footnoteContext = new LayoutContext(context);
+ LayoutContext footnoteContext = LayoutContext.copyOf(context);
footnoteContext.setStackLimitBP(context.getStackLimitBP());
footnoteContext.setRefIPD(pslm.getCurrentPV()
.getRegionReference(Constants.FO_REGION_BODY).getIPD());
@@ -330,7 +329,7 @@ public class PageBreaker extends Abstrac
//Get page break from which we restart
PageBreakPosition pbp = (PageBreakPosition)
alg.getPageBreaks().get(restartPoint - 1);
- newStartPos = pbp.getLeafPos() + 1;
+ newStartPos = alg.par.getFirstBoxIndex(pbp.getLeafPos() + 1);
//Handle page break right here to avoid any side-effects
if (newStartPos > 0) {
handleBreakTrait(Constants.EN_PAGE);
@@ -473,7 +472,7 @@ public class PageBreaker extends Abstrac
SpaceResolver.performConditionalsNotification(elementList,
firstIndex, lastIndex, -1);
- LayoutContext childLC = new LayoutContext(0);
+ LayoutContext childLC = LayoutContext.newInstance();
AreaAdditionUtil.addAreas(null,
new KnuthPossPosIter(elementList, firstIndex, lastIndex + 1),
childLC);
@@ -521,7 +520,6 @@ public class PageBreaker extends Abstrac
return;
case Constants.EN_COLUMN:
case Constants.EN_AUTO:
- case Constants.EN_PAGE:
case -1:
PageViewport pv = curPage.getPageViewport();
@@ -545,6 +543,7 @@ public class PageBreaker extends Abstrac
/*curPage = */pslm.makeNewPage(false);
}
return;
+ case Constants.EN_PAGE:
default:
log.debug("handling break-before after page " + pslm.getCurrentPageNum()
+ " breakVal=" + getBreakClassName(breakVal));
@@ -560,7 +559,7 @@ public class PageBreaker extends Abstrac
}
/**
- * Check if a blank page is needed to accomodate
+ * Check if a blank page is needed to accommodate
* desired even or odd page number.
* @param breakVal - value of break-before or break-after trait.
*/
Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/PageProvider.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/PageProvider.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/PageProvider.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/PageProvider.java Thu Aug 16 13:31:38 2012
@@ -151,18 +151,37 @@ public class PageProvider implements Con
return this.lastReportedBPD;
}
- // Wish there were a more elegant way to do this in Java
- private int[] getColIndexAndColCount(int index) {
+ private static class Column {
+
+ final Page page;
+
+ final int pageIndex;
+
+ final int colIndex;
+
+ final int columnCount;
+
+ Column(Page page, int pageIndex, int colIndex, int columnCount) {
+ this.page = page;
+ this.pageIndex = pageIndex;
+ this.colIndex = colIndex;
+ this.columnCount = columnCount;
+ }
+
+ }
+
+ private Column getColumn(int index) {
int columnCount = 0;
int colIndex = startColumnOfCurrentElementList + index;
int pageIndex = -1;
+ Page page;
do {
colIndex -= columnCount;
pageIndex++;
- Page page = getPage(false, pageIndex, RELTO_CURRENT_ELEMENT_LIST);
+ page = getPage(false, pageIndex, RELTO_CURRENT_ELEMENT_LIST);
columnCount = page.getPageViewport().getCurrentSpan().getColumnCount();
} while (colIndex >= columnCount);
- return new int[] {colIndex, columnCount};
+ return new Column(page, pageIndex, colIndex, columnCount);
}
/**
@@ -173,22 +192,13 @@ public class PageProvider implements Con
* than, equal to or greater than the IPD of the following part
*/
public int compareIPDs(int index) {
- int columnCount = 0;
- int colIndex = startColumnOfCurrentElementList + index;
- int pageIndex = -1;
- Page page;
- do {
- colIndex -= columnCount;
- pageIndex++;
- page = getPage(false, pageIndex, RELTO_CURRENT_ELEMENT_LIST);
- columnCount = page.getPageViewport().getCurrentSpan().getColumnCount();
- } while (colIndex >= columnCount);
- if (colIndex + 1 < columnCount) {
+ Column column = getColumn(index);
+ if (column.colIndex + 1 < column.columnCount) {
// Next part is a column on same page => same IPD
return 0;
} else {
- Page nextPage = getPage(false, pageIndex + 1, RELTO_CURRENT_ELEMENT_LIST);
- return page.getPageViewport().getBodyRegion().getIPD()
+ Page nextPage = getPage(false, column.pageIndex + 1, RELTO_CURRENT_ELEMENT_LIST);
+ return column.page.getPageViewport().getBodyRegion().getIPD()
- nextPage.getPageViewport().getBodyRegion().getIPD();
}
}
@@ -199,7 +209,7 @@ public class PageProvider implements Con
* @return {@code true} if the break starts a new page
*/
boolean startPage(int index) {
- return getColIndexAndColCount(index)[0] == 0;
+ return getColumn(index).colIndex == 0;
}
/**
@@ -208,8 +218,8 @@ public class PageProvider implements Con
* @return {@code true} if the break ends a page
*/
boolean endPage(int index) {
- int[] colIndexAndColCount = getColIndexAndColCount(index);
- return colIndexAndColCount[0] == colIndexAndColCount[1] - 1;
+ Column column = getColumn(index);
+ return column.colIndex == column.columnCount - 1;
}
/**
@@ -219,7 +229,7 @@ public class PageProvider implements Con
* @return the number of columns
*/
int getColumnCount(int index) {
- return getColIndexAndColCount(index)[1];
+ return getColumn(index).columnCount;
}
/**
@@ -229,24 +239,12 @@ public class PageProvider implements Con
* @return the requested part index
*/
public int getStartingPartIndexForLastPage(int partCount) {
- int result = 0;
- int idx = 0;
- int pageIndex = 0;
- int colIndex = startColumnOfCurrentElementList;
- Page page = getPage(
- false, pageIndex, RELTO_CURRENT_ELEMENT_LIST);
- while (idx < partCount) {
- if ((colIndex >= page.getPageViewport().getCurrentSpan().getColumnCount())) {
- colIndex = 0;
- pageIndex++;
- page = getPage(
- false, pageIndex, RELTO_CURRENT_ELEMENT_LIST);
- result = idx;
- }
- colIndex++;
- idx++;
- }
- return result;
+ int lastPartIndex = partCount - 1;
+ return lastPartIndex - getColumn(lastPartIndex).colIndex;
+ }
+
+ Page getPageFromColumnIndex(int columnIndex) {
+ return getColumn(columnIndex).page;
}
/**
@@ -291,7 +289,9 @@ public class PageProvider implements Con
log.trace("last page requested: " + index);
}
}
- while (intIndex >= cachedPages.size()) {
+ if (intIndex > cachedPages.size()) {
+ throw new UnsupportedOperationException("Cannot handle holes in page cache");
+ } else if (intIndex == cachedPages.size()) {
if (log.isTraceEnabled()) {
log.trace("Caching " + index);
}
Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/StaticContentLayoutManager.java Thu Aug 16 13:31:38 2012
@@ -232,7 +232,7 @@ public class StaticContentLayoutManager
List returnList = new LinkedList();
while ((curLM = getChildLM()) != null) {
- LayoutContext childLC = new LayoutContext(0);
+ LayoutContext childLC = LayoutContext.newInstance();
childLC.setStackLimitBP(context.getStackLimitBP());
childLC.setRefIPD(context.getRefIPD());
childLC.setWritingMode(context.getWritingMode());
Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java Thu Aug 16 13:31:38 2012
@@ -24,6 +24,7 @@ import java.awt.Rectangle;
import java.util.List;
import org.apache.fop.area.Area;
+import org.apache.fop.area.inline.InlineArea;
import org.apache.fop.area.inline.InlineViewport;
import org.apache.fop.datatypes.LengthBase;
import org.apache.fop.fo.FObj;
@@ -92,7 +93,6 @@ public abstract class AbstractGraphicsLa
transferForeignAttributes(viewportArea);
InlineViewport vp = new InlineViewport(viewportArea, bidiLevel);
- TraitSetter.addStructureTreeElement(vp, fobj.getStructureTreeElement());
TraitSetter.setProducerID(vp, fobj.getId());
vp.setIPD(imageLayout.getViewportSize().width);
vp.setBPD(imageLayout.getViewportSize().height);
@@ -118,6 +118,21 @@ public abstract class AbstractGraphicsLa
return super.getNextKnuthElements(context, alignment);
}
+ @Override
+ protected InlineArea getEffectiveArea(LayoutContext layoutContext) {
+ /*
+ * If an image is in a repeated table heading, then it must be treated as real
+ * content the first time and then as artifact. Therefore we cannot re-use the
+ * area, as we have to account for the likely different values of treatAsArtifact.
+ */
+ InlineArea area = curArea != null ? curArea : getInlineArea();
+ curArea = null;
+ if (!layoutContext.treatAsArtifact()) {
+ TraitSetter.addStructureTreeElement(area, ((AbstractGraphics) fobj).getStructureTreeElement());
+ }
+ return area;
+ }
+
/** {@inheritDoc} */
protected AlignmentContext makeAlignmentContext(LayoutContext context) {
final AbstractGraphics fobj = (AbstractGraphics)this.fobj;
Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/inline/AbstractPageNumberCitationLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/inline/AbstractPageNumberCitationLayoutManager.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/inline/AbstractPageNumberCitationLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/inline/AbstractPageNumberCitationLayoutManager.java Thu Aug 16 13:31:38 2012
@@ -19,17 +19,18 @@
package org.apache.fop.layoutmgr.inline;
-import org.apache.fop.area.Resolvable;
+import org.apache.fop.area.PageViewport;
import org.apache.fop.area.Trait;
import org.apache.fop.area.inline.InlineArea;
import org.apache.fop.area.inline.TextArea;
+import org.apache.fop.area.inline.UnresolvedPageNumber;
import org.apache.fop.fo.flow.AbstractPageNumberCitation;
import org.apache.fop.fonts.Font;
import org.apache.fop.fonts.FontInfo;
import org.apache.fop.fonts.FontTriplet;
import org.apache.fop.layoutmgr.LayoutContext;
-import org.apache.fop.layoutmgr.PositionIterator;
import org.apache.fop.layoutmgr.TraitSetter;
+import org.apache.fop.traits.MinOptMax;
/**
* LayoutManager for the fo:page-number-citation(-last) formatting object
@@ -42,7 +43,9 @@ public abstract class AbstractPageNumber
protected Font font;
/** Indicates whether the page referred to by the citation has been resolved yet */
- protected boolean resolved = false;
+ private boolean resolved;
+
+ private String citationString;
/**
* Constructor
@@ -78,47 +81,79 @@ public abstract class AbstractPageNumber
);
}
- /** {@inheritDoc} */
- public abstract InlineArea get(LayoutContext context);
+ @Override
+ protected MinOptMax getAllocationIPD(int refIPD) {
+ determineCitationString();
+ int ipd = getStringWidth(citationString);
+ return MinOptMax.getInstance(ipd);
+ }
+
+ private void determineCitationString() {
+ assert citationString == null;
+ PageViewport page = getCitedPage();
+ if (page != null) {
+ resolved = true;
+ citationString = page.getPageNumberString();
+ } else {
+ resolved = false;
+ citationString = "MMM"; // Use a place holder
+ }
+ }
- /**
- * {@inheritDoc}
- * , LayoutContext)
- */
- public void addAreas(PositionIterator posIter, LayoutContext context) {
- super.addAreas(posIter, context);
- if (!resolved) {
- getPSLM().addUnresolvedArea(fobj.getRefId(), (Resolvable) curArea);
+ private int getStringWidth(String str) {
+ int width = 0;
+ for (int count = 0; count < str.length(); count++) {
+ width += font.getCharWidth(str.charAt(count));
+ }
+ return width;
+ }
+
+ protected abstract PageViewport getCitedPage();
+
+ @Override
+ protected InlineArea getEffectiveArea(LayoutContext layoutContext) {
+ InlineArea area = getPageNumberCitationArea();
+ if (!layoutContext.treatAsArtifact()) {
+ TraitSetter.addStructureTreeElement(area, fobj.getStructureTreeElement());
+ }
+ return area;
+ }
+
+ private InlineArea getPageNumberCitationArea() {
+ TextArea text;
+ if (resolved) {
+ text = new TextArea();
+ text.addWord(citationString, 0);
+ } else {
+ UnresolvedPageNumber unresolved = new UnresolvedPageNumber(fobj.getRefId(), font,
+ getReferenceType());
+ getPSLM().addUnresolvedArea(fobj.getRefId(), unresolved);
+ text = unresolved;
}
+ setTraits(text);
+ return text;
}
/**
- * Updates the traits for the generated text area.
- * @param text the text area
+ * @return {@link org.apache.fop.area.inline.UnresolvedPageNumber#FIRST} or
+ * {@link org.apache.fop.area.inline.UnresolvedPageNumber#LAST}
*/
- protected void updateTextAreaTraits(TextArea text) {
+ protected abstract boolean getReferenceType();
+
+ private void setTraits(TextArea text) {
TraitSetter.setProducerID(text, fobj.getId());
+ int bidiLevel = getBidiLevel();
+ text.setBidiLevel(bidiLevel);
+ int width = getStringWidth(citationString); // TODO: [GA] !I18N!
+ text.setIPD(width); // TODO: [GA] !I18N!
text.setBPD(font.getAscender() - font.getDescender());
text.setBaselineOffset(font.getAscender());
TraitSetter.addFontTraits(text, font);
text.addTrait(Trait.COLOR, fobj.getColor());
- TraitSetter.addStructureTreeElement(text, fobj.getStructureTreeElement());
TraitSetter.addTextDecoration(text, fobj.getTextDecoration());
}
/**
- * @param str string to be measured
- * @return width (in millipoints ??) of the string
- */
- protected int getStringWidth(String str) {
- int width = 0;
- for (int count = 0; count < str.length(); count++) {
- width += font.getCharWidth(str.charAt(count));
- }
- return width;
- }
-
- /**
* @return bidi level governing abstract page number citation
*/
protected int getBidiLevel() {
Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/inline/CharacterLayoutManager.java Thu Aug 16 13:31:38 2012
@@ -23,6 +23,7 @@ import java.util.LinkedList;
import java.util.List;
import org.apache.fop.area.Trait;
+import org.apache.fop.area.inline.InlineArea;
import org.apache.fop.area.inline.TextArea;
import org.apache.fop.fo.flow.Character;
import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
@@ -69,17 +70,15 @@ public class CharacterLayoutManager exte
hyphIPD = fobj.getCommonHyphenation().getHyphIPD(font);
borderProps = fobj.getCommonBorderPaddingBackground();
setCommonBorderPaddingBackground(borderProps);
- TextArea chArea = getCharacterInlineArea(fobj);
- chArea.setBaselineOffset(font.getAscender());
- setCurrentArea(chArea);
}
- private TextArea getCharacterInlineArea(Character node) {
+ private TextArea createCharacterArea() {
+ Character fobj = (Character) this.fobj;
TextArea text = new TextArea();
- char ch = node.getCharacter();
+ char ch = fobj.getCharacter();
int ipd = font.getCharWidth(ch);
int blockProgressionOffset = 0;
- int level = node.getBidiLevel();
+ int level = fobj.getBidiLevel();
if (CharUtilities.isAnySpace(ch)) {
// add space unless it's zero-width:
if (!CharUtilities.isZeroWidthSpace(ch)) {
@@ -90,32 +89,29 @@ public class CharacterLayoutManager exte
int[] levels = ( level >= 0 ) ? new int[] {level} : null;
text.addWord(String.valueOf(ch), ipd, null, levels, null, blockProgressionOffset);
}
- TraitSetter.setProducerID(text, node.getId());
- TraitSetter.addTextDecoration(text, node.getTextDecoration());
- TraitSetter.addStructureTreeElement(text, node.getStructureTreeElement());
+
+ TraitSetter.setProducerID(text, fobj.getId());
+ TraitSetter.addTextDecoration(text, fobj.getTextDecoration());
+ text.setIPD(font.getCharWidth(fobj.getCharacter()));
+ text.setBPD(font.getAscender() - font.getDescender());
+ text.setBaselineOffset(font.getAscender());
+ TraitSetter.addFontTraits(text, font);
+ text.addTrait(Trait.COLOR, fobj.getColor());
return text;
}
- /** {@inheritDoc} */
@Override
- public List getNextKnuthElements(LayoutContext context, int alignment) {
- MinOptMax ipd;
- curArea = get(context);
- KnuthSequence seq = new InlineKnuthSequence();
-
- if (curArea == null) {
- setFinished(true);
- return null;
+ protected InlineArea getEffectiveArea(LayoutContext layoutContext) {
+ InlineArea area = createCharacterArea();
+ if (!layoutContext.treatAsArtifact()) {
+ TraitSetter.addStructureTreeElement(area, ((Character) fobj).getStructureTreeElement());
}
+ return area;
+ }
- Character fobj = (Character)this.fobj;
-
- ipd = MinOptMax.getInstance(curArea.getIPD());
-
- curArea.setBPD(font.getAscender() - font.getDescender());
-
- TraitSetter.addFontTraits(curArea, font);
- curArea.addTrait(Trait.COLOR, fobj.getColor());
+ /** {@inheritDoc} */
+ public List getNextKnuthElements(LayoutContext context, int alignment) {
+ Character fobj = (Character) this.fobj;
// TODO: may need some special handling for fo:character
alignmentContext = new AlignmentContext(font
@@ -126,9 +122,11 @@ public class CharacterLayoutManager exte
, fobj.getDominantBaseline()
, context.getAlignmentContext());
+ KnuthSequence seq = new InlineKnuthSequence();
addKnuthElementsForBorderPaddingStart(seq);
// create the AreaInfo object to store the computed values
+ MinOptMax ipd = MinOptMax.getInstance(font.getCharWidth(fobj.getCharacter()));
areaInfo = new AreaInfo((short) 0, ipd, false, alignmentContext);
// node is a fo:Character
@@ -162,7 +160,7 @@ public class CharacterLayoutManager exte
/** {@inheritDoc} */
@Override
public String getWordChars(Position pos) {
- return ((TextArea) curArea).getText();
+ return String.valueOf(((Character) fobj).getCharacter());
}
/** {@inheritDoc} */
Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/inline/ContentLayoutManager.java Thu Aug 16 13:31:38 2012
@@ -110,7 +110,8 @@ public class ContentLayoutManager extend
int ipd = 1000000;
- LayoutContext childLC = new LayoutContext(LayoutContext.NEW_AREA);
+ LayoutContext childLC = LayoutContext.newInstance();
+ childLC.setFlags(LayoutContext.NEW_AREA);
childLC.setLeadingSpace(new SpaceSpecifier(false));
childLC.setTrailingSpace(new SpaceSpecifier(false));
childLC.setRefIPD(ipd);
@@ -143,7 +144,7 @@ public class ContentLayoutManager extend
middlefollow = maxtb - lineLead;
}
- LayoutContext lc = new LayoutContext(0);
+ LayoutContext lc = LayoutContext.newInstance();
lc.setFlags(LayoutContext.RESOLVE_LEADING_SPACE, true);
lc.setLeadingSpace(new SpaceSpecifier(false));
@@ -160,7 +161,7 @@ public class ContentLayoutManager extend
int savedIPD = ((InlineArea)holder).getIPD();
// set to zero the ipd adjustment ratio, to avoid spaces in the pattern
// to be modified
- LayoutContext childContext = new LayoutContext(context);
+ LayoutContext childContext = LayoutContext.copyOf(context);
childContext.setIPDAdjust(0.0);
childLM.addAreas(posIter, childContext);
((InlineArea)holder).setIPD(savedIPD);
Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/inline/FootnoteLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/inline/FootnoteLayoutManager.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/inline/FootnoteLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/inline/FootnoteLayoutManager.java Thu Aug 16 13:31:38 2012
@@ -151,7 +151,7 @@ public class FootnoteLayoutManager exten
citationLM.setParent(getParent());
// make the citationLM add its areas
- LayoutContext childContext = new LayoutContext(context);
+ LayoutContext childContext = LayoutContext.copyOf(context);
PositionIterator childPosIter = new PositionIterator(positionList.listIterator());
LayoutManager childLM;
while ((childLM = childPosIter.getNextChildLM()) != null) {
Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/inline/InlineLayoutManager.java Thu Aug 16 13:31:38 2012
@@ -283,7 +283,7 @@ public class InlineLayoutManager extends
, context.getAlignmentContext());
}
- childLC = new LayoutContext(context);
+ childLC = LayoutContext.copyOf(context);
childLC.setAlignmentContext(alignmentContext);
if (context.startsNewArea()) {
@@ -439,7 +439,7 @@ public class InlineLayoutManager extends
addId();
- setChildContext(new LayoutContext(context)); // Store current value
+ setChildContext(LayoutContext.copyOf(context)); // Store current value
// "Unwrap" the NonLeafPositions stored in parentIter and put
// them in a new list. Set lastLM to be the LayoutManager
Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/inline/LeaderLayoutManager.java Thu Aug 16 13:31:38 2012
@@ -191,7 +191,7 @@ public class LeaderLayoutManager extends
clm.addChildLM(lm);
lm.initialize();
- LayoutContext childContext = new LayoutContext(0);
+ LayoutContext childContext = LayoutContext.newInstance();
childContext.setAlignmentContext(context.getAlignmentContext());
contentList = clm.getNextKnuthElements(childContext, 0);
int width = clm.getStackingSize();
Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/inline/LeafNodeLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/inline/LeafNodeLayoutManager.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/inline/LeafNodeLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/inline/LeafNodeLayoutManager.java Thu Aug 16 13:31:38 2012
@@ -188,7 +188,7 @@ public abstract class LeafNodeLayoutMana
public void addAreas(PositionIterator posIter, LayoutContext context) {
addId();
- InlineArea area = getEffectiveArea();
+ InlineArea area = getEffectiveArea(context);
if (area.getAllocIPD() > 0 || area.getAllocBPD() > 0) {
offsetArea(area, context);
widthAdjustArea(area, context);
@@ -211,7 +211,7 @@ public abstract class LeafNodeLayoutMana
* @return the effective area to be added to the area tree. Normally, this is simply "curArea"
* but in the case of page-number(-citation) curArea is cloned, updated and returned.
*/
- protected InlineArea getEffectiveArea() {
+ protected InlineArea getEffectiveArea(LayoutContext layoutContext) {
return curArea;
}
@@ -264,11 +264,6 @@ public abstract class LeafNodeLayoutMana
public List getNextKnuthElements(LayoutContext context, int alignment) {
curArea = get(context);
- if (curArea == null) {
- setFinished(true);
- return null;
- }
-
alignmentContext = makeAlignmentContext(context);
MinOptMax ipd = getAllocationIPD(context.getRefIPD());
Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java Thu Aug 16 13:31:38 2012
@@ -674,7 +674,7 @@ public class LineLayoutManager extends I
* @param context the LayoutContext
*/
private void collectInlineKnuthElements(LayoutContext context) {
- LayoutContext inlineLC = new LayoutContext(context);
+ LayoutContext inlineLC = LayoutContext.copyOf(context);
// convert all the text in a sequence of paragraphs made
// of KnuthBox, KnuthGlue and KnuthPenalty objects
@@ -1522,7 +1522,7 @@ public class LineLayoutManager extends I
PositionIterator inlinePosIter = new KnuthPossPosIter(seq, startElementIndex,
endElementIndex + 1);
- LayoutContext lc = new LayoutContext(0);
+ LayoutContext lc = LayoutContext.offspringOf(context);
lc.setAlignmentContext(alignmentContext);
lc.setSpaceAdjust(lbp.dAdjust);
lc.setIPDAdjust(lbp.ipdAdjust);
@@ -1577,12 +1577,12 @@ public class LineLayoutManager extends I
LineArea lineArea = new LineArea();
setCurrentArea(lineArea);
- LayoutContext lc = new LayoutContext(0);
+ LayoutContext lc = LayoutContext.newInstance();
lc.setAlignmentContext(alignmentContext);
setChildContext(lc);
PositionIterator childPosIter = new PositionIterator(positionList.listIterator());
- LayoutContext blocklc = new LayoutContext(0);
+ LayoutContext blocklc = LayoutContext.offspringOf(context);
blocklc.setLeadingSpace(new SpaceSpecifier(true));
blocklc.setTrailingSpace(new SpaceSpecifier(false));
blocklc.setFlags(LayoutContext.RESOLVE_LEADING_SPACE, true);
Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLastLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLastLayoutManager.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLastLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLastLayoutManager.java Thu Aug 16 13:31:38 2012
@@ -20,65 +20,36 @@
package org.apache.fop.layoutmgr.inline;
import org.apache.fop.area.PageViewport;
-import org.apache.fop.area.Resolvable;
-import org.apache.fop.area.inline.InlineArea;
-import org.apache.fop.area.inline.TextArea;
import org.apache.fop.area.inline.UnresolvedPageNumber;
import org.apache.fop.fo.flow.PageNumberCitationLast;
-import org.apache.fop.layoutmgr.LayoutContext;
-import org.apache.fop.layoutmgr.LayoutManager;
/**
- * LayoutManager for the fo:page-number-citation-last formatting object
+ * LayoutManager for the fo:page-number-citation-last formatting object.
*/
public class PageNumberCitationLastLayoutManager extends AbstractPageNumberCitationLayoutManager {
/**
- * Constructor
+ * Constructor.
*
* @param node the formatting object that creates this area
* TODO better retrieval of font info
*/
public PageNumberCitationLastLayoutManager(PageNumberCitationLast node) {
super(node);
- fobj = node;
}
- /** {@inheritDoc} */
- public InlineArea get(LayoutContext context) {
- curArea = getPageNumberCitationLastInlineArea(parentLayoutManager);
- return curArea;
- }
-
- /**
- * if id can be resolved then simply return a word, otherwise
- * return a resolvable area
- */
- private InlineArea getPageNumberCitationLastInlineArea(LayoutManager parentLM) {
- TextArea text = null;
- int level = getBidiLevel();
- if (!getPSLM().associateLayoutManagerID(fobj.getRefId())) {
- text = new UnresolvedPageNumber(fobj.getRefId(), font, UnresolvedPageNumber.LAST);
- getPSLM().addUnresolvedArea(fobj.getRefId(), (Resolvable)text);
- String str = "MMM"; // reserve three spaces for page number
- int width = getStringWidth(str);
- text.setBidiLevel(level);
- text.setIPD(width);
- resolved = false;
+ @Override
+ protected PageViewport getCitedPage() {
+ if (getPSLM().associateLayoutManagerID(fobj.getRefId())) {
+ return getPSLM().getLastPVWithID(fobj.getRefId());
} else {
- PageViewport page = getPSLM().getLastPVWithID(fobj.getRefId());
- String str = page.getPageNumberString();
- // get page string from parent, build area
- text = new TextArea();
- int width = getStringWidth(str);
- text.setBidiLevel(level);
- text.addWord(str, 0, level);
- text.setIPD(width);
- resolved = true;
+ return null;
}
+ }
- updateTextAreaTraits(text);
-
- return text;
+ @Override
+ protected boolean getReferenceType() {
+ return UnresolvedPageNumber.LAST;
}
+
}
Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLayoutManager.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/inline/PageNumberCitationLayoutManager.java Thu Aug 16 13:31:38 2012
@@ -20,19 +20,16 @@
package org.apache.fop.layoutmgr.inline;
import org.apache.fop.area.PageViewport;
-import org.apache.fop.area.inline.InlineArea;
-import org.apache.fop.area.inline.TextArea;
import org.apache.fop.area.inline.UnresolvedPageNumber;
import org.apache.fop.fo.flow.PageNumberCitation;
-import org.apache.fop.layoutmgr.LayoutContext;
/**
- * LayoutManager for the fo:page-number-citation formatting object
+ * LayoutManager for the fo:page-number-citation formatting object.
*/
public class PageNumberCitationLayoutManager extends AbstractPageNumberCitationLayoutManager {
/**
- * Constructor
+ * Constructor.
*
* @param node the formatting object that creates this area
* TODO better retrieval of font info
@@ -41,42 +38,14 @@ public class PageNumberCitationLayoutMan
super(node);
}
- /** {@inheritDoc} */
- public InlineArea get(LayoutContext context) {
- curArea = getPageNumberCitationInlineArea();
- return curArea;
+ @Override
+ protected PageViewport getCitedPage() {
+ return getPSLM().getFirstPVWithID(fobj.getRefId());
}
- /**
- * if id can be resolved then simply return a word, otherwise
- * return a resolvable area
- *
- * TODO: [GA] May need to run bidi algorithm and script processor
- * on resolved page number.
- */
- private InlineArea getPageNumberCitationInlineArea() {
- PageViewport page = getPSLM().getFirstPVWithID(fobj.getRefId());
- TextArea text = null;
- int level = getBidiLevel();
- if (page != null) {
- String str = page.getPageNumberString();
- // get page string from parent, build area
- text = new TextArea();
- int width = getStringWidth(str); // TODO: [GA] !I18N!
- text.setBidiLevel(level);
- text.addWord(str, 0, level);
- text.setIPD(width); // TODO: [GA] !I18N!
- resolved = true;
- } else {
- text = new UnresolvedPageNumber(fobj.getRefId(), font);
- String str = "MMM"; // reserve three spaces for page number
- int width = getStringWidth(str); // TODO: [GA] !I18N!
- text.setBidiLevel(level);
- text.setIPD(width); // TODO: [GA] !I18N!
- resolved = false;
- }
- updateTextAreaTraits(text);
- return text;
+ @Override
+ protected boolean getReferenceType() {
+ return UnresolvedPageNumber.FIRST;
}
}
Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/inline/PageNumberLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/inline/PageNumberLayoutManager.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/inline/PageNumberLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/inline/PageNumberLayoutManager.java Thu Aug 16 13:31:38 2012
@@ -85,14 +85,13 @@ public class PageNumberLayoutManager ext
text.setBaselineOffset(font.getAscender());
TraitSetter.addFontTraits(text, font);
text.addTrait(Trait.COLOR, fobj.getColor());
- TraitSetter.addStructureTreeElement(text, fobj.getStructureTreeElement());
TraitSetter.addTextDecoration(text, fobj.getTextDecoration());
return text;
}
/** {@inheritDoc} */
- protected InlineArea getEffectiveArea() {
+ protected InlineArea getEffectiveArea(LayoutContext layoutContext) {
TextArea baseArea = (TextArea)curArea;
//TODO Maybe replace that with a clone() call or better, a copy constructor
//TODO or even better: delay area creation until addAreas() stage
@@ -105,6 +104,9 @@ public class PageNumberLayoutManager ext
ta.setBaselineOffset(baseArea.getBaselineOffset());
ta.addTrait(Trait.COLOR, fobj.getColor()); //only to initialize the trait map
ta.getTraits().putAll(baseArea.getTraits());
+ if (!layoutContext.treatAsArtifact()) {
+ TraitSetter.addStructureTreeElement(ta, fobj.getStructureTreeElement());
+ }
updateContent(ta);
return ta;
}
Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/inline/TextLayoutManager.java Thu Aug 16 13:31:38 2012
@@ -469,7 +469,9 @@ public class TextLayoutManager extends L
TraitSetter.addFontTraits(textArea, font);
textArea.addTrait(Trait.COLOR, foText.getColor());
TraitSetter.addTextDecoration(textArea, foText.getTextDecoration());
- TraitSetter.addStructureTreeElement(textArea, foText.getStructureTreeElement());
+ if (!context.treatAsArtifact()) {
+ TraitSetter.addStructureTreeElement(textArea, foText.getStructureTreeElement());
+ }
return textArea;
}
Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/inline/WrapperLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/inline/WrapperLayoutManager.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/inline/WrapperLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/inline/WrapperLayoutManager.java Thu Aug 16 13:31:38 2012
@@ -71,7 +71,7 @@ public class WrapperLayoutManager extend
TraitSetter.setProducerID(helperBlock, fobj.getId());
parentLayoutManager.addChildArea(helperBlock);
} else {
- InlineArea area = getEffectiveArea();
+ InlineArea area = getEffectiveArea(context);
parentLayoutManager.addChildArea(area);
}
}
Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java Thu Aug 16 13:31:38 2012
@@ -141,7 +141,7 @@ public class ListBlockLayoutManager exte
// the list block contains areas stacked from each list item
LayoutManager childLM;
- LayoutContext lc = new LayoutContext(0);
+ LayoutContext lc = LayoutContext.offspringOf(layoutContext);
LayoutManager firstLM = null;
LayoutManager lastLM = null;
Position firstPos = null;
Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java Thu Aug 16 13:31:38 2012
@@ -20,6 +20,7 @@
package org.apache.fop.layoutmgr.list;
import java.util.LinkedList;
+import java.util.List;
import org.apache.fop.area.Area;
import org.apache.fop.area.Block;
@@ -28,9 +29,11 @@ import org.apache.fop.fo.flow.ListItemBo
import org.apache.fop.fo.flow.ListItemLabel;
import org.apache.fop.fo.properties.KeepProperty;
import org.apache.fop.layoutmgr.BlockStackingLayoutManager;
+import org.apache.fop.layoutmgr.BreakOpportunity;
import org.apache.fop.layoutmgr.Keep;
import org.apache.fop.layoutmgr.LayoutContext;
import org.apache.fop.layoutmgr.LayoutManager;
+import org.apache.fop.layoutmgr.ListElement;
import org.apache.fop.layoutmgr.NonLeafPosition;
import org.apache.fop.layoutmgr.Position;
import org.apache.fop.layoutmgr.PositionIterator;
@@ -40,7 +43,7 @@ import org.apache.fop.layoutmgr.TraitSet
/**
* LayoutManager for a list-item-label or list-item-body FO.
*/
-public class ListItemContentLayoutManager extends BlockStackingLayoutManager {
+public class ListItemContentLayoutManager extends BlockStackingLayoutManager implements BreakOpportunity {
private Block curBlockArea;
@@ -98,7 +101,7 @@ public class ListItemContentLayoutManage
addId();
LayoutManager childLM;
- LayoutContext lc = new LayoutContext(0);
+ LayoutContext lc = LayoutContext.offspringOf(layoutContext);
LayoutManager firstLM = null;
LayoutManager lastLM = null;
Position firstPos = null;
@@ -220,5 +223,16 @@ public class ListItemContentLayoutManage
public Keep getKeepWithPrevious() {
return Keep.KEEP_AUTO;
}
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public List<ListElement> getNextKnuthElements(LayoutContext context, int alignment) {
+ List<ListElement> elements = new LinkedList<ListElement>();
+ do {
+ elements.addAll(super.getNextKnuthElements(context, alignment));
+ } while (!isFinished());
+ return elements;
+ }
+
}
Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java Thu Aug 16 13:31:38 2012
@@ -35,6 +35,8 @@ import org.apache.fop.fo.flow.ListItemLa
import org.apache.fop.fo.properties.KeepProperty;
import org.apache.fop.layoutmgr.BlockStackingLayoutManager;
import org.apache.fop.layoutmgr.BreakElement;
+import org.apache.fop.layoutmgr.BreakOpportunity;
+import org.apache.fop.layoutmgr.BreakOpportunityHelper;
import org.apache.fop.layoutmgr.ConditionalElementListener;
import org.apache.fop.layoutmgr.ElementListObserver;
import org.apache.fop.layoutmgr.ElementListUtils;
@@ -56,13 +58,14 @@ import org.apache.fop.layoutmgr.SpaceRes
import org.apache.fop.layoutmgr.TraitSetter;
import org.apache.fop.traits.MinOptMax;
import org.apache.fop.traits.SpaceVal;
+import org.apache.fop.util.BreakUtil;
/**
* LayoutManager for a list-item FO.
* The list item contains a list item label and a list item body.
*/
-public class ListItemLayoutManager extends BlockStackingLayoutManager
- implements ConditionalElementListener {
+public class ListItemLayoutManager extends BlockStackingLayoutManager implements ConditionalElementListener,
+ BreakOpportunity {
/** logging instance */
private static Log log = LogFactory.getLog(ListItemLayoutManager.class);
@@ -204,6 +207,7 @@ public class ListItemLayoutManager exten
// label
childLC = makeChildLayoutContext(context);
+ childLC.setFlags(LayoutContext.SUPPRESS_BREAK_BEFORE);
label.initialize();
labelList = label.getNextKnuthElements(childLC, alignment);
@@ -217,6 +221,7 @@ public class ListItemLayoutManager exten
// body
childLC = makeChildLayoutContext(context);
+ childLC.setFlags(LayoutContext.SUPPRESS_BREAK_BEFORE);
body.initialize();
bodyList = body.getNextKnuthElements(childLC, alignment);
@@ -296,16 +301,23 @@ public class ListItemLayoutManager exten
//Additional penalty height from penalties in the source lists
int additionalPenaltyHeight = 0;
int stepPenalty = 0;
+ int breakClass = EN_AUTO;
KnuthElement endEl = (KnuthElement)elementLists[0].get(end[0]);
if (endEl instanceof KnuthPenalty) {
additionalPenaltyHeight = endEl.getWidth();
- stepPenalty = Math.max(stepPenalty, endEl.getPenalty());
+ stepPenalty = endEl.getPenalty() == -KnuthElement.INFINITE ? -KnuthElement.INFINITE : Math
+ .max(stepPenalty, endEl.getPenalty());
+ breakClass = BreakUtil.compareBreakClasses(breakClass,
+ ((KnuthPenalty) endEl).getBreakClass());
}
endEl = (KnuthElement)elementLists[1].get(end[1]);
if (endEl instanceof KnuthPenalty) {
additionalPenaltyHeight = Math.max(
additionalPenaltyHeight, endEl.getWidth());
- stepPenalty = Math.max(stepPenalty, endEl.getPenalty());
+ stepPenalty = endEl.getPenalty() == -KnuthElement.INFINITE ? -KnuthElement.INFINITE : Math
+ .max(stepPenalty, endEl.getPenalty());
+ breakClass = BreakUtil.compareBreakClasses(breakClass,
+ ((KnuthPenalty) endEl).getBreakClass());
}
int boxHeight = step - addedBoxHeight - penaltyHeight;
@@ -343,9 +355,9 @@ public class ListItemLayoutManager exten
int p = stepPenalty;
if (p > -KnuthElement.INFINITE) {
p = Math.max(p, keep.getPenalty());
+ breakClass = keep.getContext();
}
- returnList.add(new BreakElement(stepPosition, penaltyHeight, p, keep.getContext(),
- context));
+ returnList.add(new BreakElement(stepPosition, penaltyHeight, p, breakClass, context));
}
}
@@ -476,7 +488,7 @@ public class ListItemLayoutManager exten
addId();
- LayoutContext lc = new LayoutContext(0);
+ LayoutContext lc = LayoutContext.offspringOf(layoutContext);
Position firstPos = null;
Position lastPos = null;
@@ -693,6 +705,13 @@ public class ListItemLayoutManager exten
body.reset();
}
+ @Override
+ public int getBreakBefore() {
+ int breakBefore = BreakOpportunityHelper.getBreakBefore(this);
+ breakBefore = BreakUtil.compareBreakClasses(breakBefore, label.getBreakBefore());
+ breakBefore = BreakUtil.compareBreakClasses(breakBefore, body.getBreakBefore());
+ return breakBefore;
+ }
}
Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/table/RowGroupLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/table/RowGroupLayoutManager.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/table/RowGroupLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/table/RowGroupLayoutManager.java Thu Aug 16 13:31:38 2012
@@ -112,7 +112,7 @@ class RowGroupLayoutManager {
spanWidth += ((TableColumn) colIter.next()).getColumnWidth().getValue(
tableLM);
}
- LayoutContext childLC = new LayoutContext(0);
+ LayoutContext childLC = LayoutContext.newInstance();
childLC.setStackLimitBP(context.getStackLimitBP()); //necessary?
childLC.setRefIPD(spanWidth);
Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/table/TableAndCaptionLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/table/TableAndCaptionLayoutManager.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/table/TableAndCaptionLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/table/TableAndCaptionLayoutManager.java Thu Aug 16 13:31:38 2012
@@ -81,7 +81,7 @@ public class TableAndCaptionLayoutManage
int ipd = context.getRefIPD();
BreakPoss bp;
- LayoutContext childLC = new LayoutContext(0);
+ LayoutContext childLC = LayoutContext.newInstance();
// if line layout manager then set stack limit to ipd
// line LM actually generates a LineArea which is a block
childLC.setStackLimit(
@@ -145,7 +145,7 @@ public class TableAndCaptionLayoutManage
/* TODO: Reimplement using Knuth approach
LayoutManager childLM;
int iStartPos = 0;
- LayoutContext lc = new LayoutContext(0);
+ LayoutContext lc = LayoutContext.newInstance();
while (parentIter.hasNext()) {
LeafPosition lfp = (LeafPosition) parentIter.next();
// Add the block areas to Area
Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/table/TableCaptionLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/table/TableCaptionLayoutManager.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/table/TableCaptionLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/table/TableCaptionLayoutManager.java Thu Aug 16 13:31:38 2012
@@ -76,7 +76,7 @@ public class TableCaptionLayoutManager e
int ipd = context.getRefIPD();
BreakPoss bp;
- LayoutContext childLC = new LayoutContext(0);
+ LayoutContext childLC = LayoutContext.newInstance();
// if line layout manager then set stack limit to ipd
// line LM actually generates a LineArea which is a block
childLC.setStackLimit(
@@ -141,7 +141,7 @@ public class TableCaptionLayoutManager e
/* TODO: Reimplement using Knuth approach
LayoutManager childLM;
int iStartPos = 0;
- LayoutContext lc = new LayoutContext(0);
+ LayoutContext lc = LayoutContext.newInstance();
while (parentIter.hasNext()) {
LeafPosition lfp = (LeafPosition) parentIter.next();
// Add the block areas to Area
Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/table/TableCellLayoutManager.java Thu Aug 16 13:31:38 2012
@@ -144,7 +144,7 @@ public class TableCellLayoutManager exte
LayoutManager curLM; // currently active LM
LayoutManager prevLM = null; // previously active LM
while ((curLM = getChildLM()) != null) {
- LayoutContext childLC = new LayoutContext(0);
+ LayoutContext childLC = LayoutContext.newInstance();
// curLM is a ?
childLC.setStackLimitBP(context.getStackLimitBP().minus(stackLimit));
childLC.setRefIPD(cellIPD);
Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/table/TableContentLayoutManager.java Thu Aug 16 13:31:38 2012
@@ -71,6 +71,8 @@ public class TableContentLayoutManager i
private TableStepper stepper;
+ private boolean headerIsBeingRepeated;
+
/**
* Main constructor
* @param parent Parent layout manager
@@ -383,6 +385,7 @@ public class TableContentLayoutManager i
}
}
}
+ boolean treatFooterAsArtifact = layoutContext.treatAsArtifact();
if (lastPos instanceof TableHFPenaltyPosition) {
TableHFPenaltyPosition penaltyPos = (TableHFPenaltyPosition)lastPos;
LOG.debug("Break at penalty!");
@@ -393,6 +396,7 @@ public class TableContentLayoutManager i
}
if (penaltyPos.footerElements != null) {
footerElements = penaltyPos.footerElements;
+ treatFooterAsArtifact = true;
}
}
@@ -403,10 +407,18 @@ public class TableContentLayoutManager i
}
if (headerElements != null) {
+ boolean ancestorTreatAsArtifact = layoutContext.treatAsArtifact();
+ if (headerIsBeingRepeated) {
+ layoutContext.setTreatAsArtifact(true);
+ }
//header positions for the last part are the second-to-last element and need to
//be handled first before all other TableContentPositions
addHeaderFooterAreas(headerElements, tableLM.getTable().getTableHeader(), painter,
false);
+ if (!ancestorTreatAsArtifact) {
+ headerIsBeingRepeated = true;
+ }
+ layoutContext.setTreatAsArtifact(ancestorTreatAsArtifact);
}
if (tablePositions.isEmpty()) {
@@ -419,9 +431,12 @@ public class TableContentLayoutManager i
}
if (footerElements != null) {
+ boolean ancestorTreatAsArtifact = layoutContext.treatAsArtifact();
+ layoutContext.setTreatAsArtifact(treatFooterAsArtifact);
//Positions for footers are simply added at the end
addHeaderFooterAreas(footerElements, tableLM.getTable().getTableFooter(), painter,
true);
+ layoutContext.setTreatAsArtifact(ancestorTreatAsArtifact);
}
this.usedBPD += painter.getAccumulatedBPD();
Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/layoutmgr/table/TableLayoutManager.java Thu Aug 16 13:31:38 2012
@@ -242,7 +242,7 @@ public class TableLayoutManager extends
// Elements for the table-header/footer/body
List contentKnuthElements;
contentLM = new TableContentLayoutManager(this);
- LayoutContext childLC = new LayoutContext(0);
+ LayoutContext childLC = LayoutContext.newInstance();
/*
childLC.setStackLimit(
MinOptMax.subtract(context.getStackLimit(),
@@ -355,7 +355,7 @@ public class TableLayoutManager extends
// BPD of the table, i.e., height of its content; table's borders and paddings not counted
int tableHeight = 0;
//Body childLM;
- LayoutContext lc = new LayoutContext(0);
+ LayoutContext lc = LayoutContext.offspringOf(layoutContext);
lc.setRefIPD(getContentAreaIPD());
Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/pdf/PDFArray.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/pdf/PDFArray.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/pdf/PDFArray.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/pdf/PDFArray.java Thu Aug 16 13:31:38 2012
@@ -100,6 +100,15 @@ public class PDFArray extends PDFObject
}
/**
+ * Creates an array object made of the given elements.
+ *
+ * @param elements the array content
+ */
+ public PDFArray(List<?> elements) {
+ this(null, elements);
+ }
+
+ /**
* Create the array object
* @param parent the array's parent if any
* @param values the actual array wrapped by this object
Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/pdf/PDFDocument.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/pdf/PDFDocument.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/pdf/PDFDocument.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/pdf/PDFDocument.java Thu Aug 16 13:31:38 2012
@@ -37,6 +37,7 @@ import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.fop.pdf.StandardStructureAttributes.Table.Scope;
import org.apache.fop.pdf.xref.CrossReferenceStream;
import org.apache.fop.pdf.xref.CrossReferenceTable;
import org.apache.fop.pdf.xref.TrailerDictionary;
@@ -362,7 +363,7 @@ public class PDFDocument {
* hierarchy
* @return a dictionary of type StructElem
*/
- public PDFStructElem makeStructureElement(PDFName structureType, PDFObject parent) {
+ public PDFStructElem makeStructureElement(StructureType structureType, PDFObject parent) {
PDFStructElem structElem = new PDFStructElem(parent, structureType);
assignObjectNumber(structElem);
structureTreeElements.add(structElem);
@@ -370,6 +371,23 @@ public class PDFDocument {
}
/**
+ * Creates and returns a structure element.
+ *
+ * @param structureType the structure type of the new element (value for the
+ * S entry)
+ * @param parent the parent of the new structure element in the structure
+ * hierarchy
+ * @param scope the scope of the given table header element
+ * @return a dictionary of type StructElem
+ */
+ public PDFStructElem makeStructureElement(StructureType structureType, PDFObject parent,
+ Scope scope) {
+ PDFStructElem structElem = makeStructureElement(structureType, parent);
+ versionController.addTableHeaderScopeAttribute(structElem, scope);
+ return structElem;
+ }
+
+ /**
* Get the {@link PDFInfo} object for this document.
*
* @return the {@link PDFInfo} object
Modified: xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/pdf/PDFProfile.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/pdf/PDFProfile.java?rev=1373825&r1=1373824&r2=1373825&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/pdf/PDFProfile.java (original)
+++ xmlgraphics/fop/branches/Temp_RoundedCorners/src/java/org/apache/fop/pdf/PDFProfile.java Thu Aug 16 13:31:38 2012
@@ -202,7 +202,8 @@ public class PDFProfile {
PDFDictionary markInfo = getDocument().getRoot().getMarkInfo();
if (markInfo == null) {
throw new PDFConformanceException(format(
- "{0} requires the MarkInfo dictionary to be present", getPDFAMode()));
+ "{0} requires that the accessibility option in the configuration file be enabled",
+ getPDFAMode()));
}
if (!Boolean.TRUE.equals(markInfo.get("Marked"))) {
throw new PDFConformanceException(format(err,
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org