Author: spepping
Date: Fri Feb 18 08:32:51 2011
New Revision: 1071918
URL: http://svn.apache.org/viewvc?rev=1071918&view=rev
Log:
merge from trunk r1069735-1071912
Modified:
xmlgraphics/fop/branches/Temp_ComplexScripts/ (props changed)
xmlgraphics/fop/branches/Temp_ComplexScripts/findbugs-exclude.xml
xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/afp/apps/
(props changed)
xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/afp/parser/
(props changed)
xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java
xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/AlignmentContext.java
xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java
xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java
xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java
xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/pdf/PDFColorHandler.java
xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/render/pdf/PDFImageHandlerSVG.java
xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/util/ColorExt.java
(props changed)
Propchange: xmlgraphics/fop/branches/Temp_ComplexScripts/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Feb 18 08:32:51 2011
@@ -2,4 +2,4 @@
/xmlgraphics/fop/branches/Temp_Color:956535-1069429
/xmlgraphics/fop/branches/fop-0_95:684572,688085,688696
/xmlgraphics/fop/branches/fop-1_0:959975-964707
-/xmlgraphics/fop/trunk:981451-1069734
+/xmlgraphics/fop/trunk:981451-1071912
Modified: xmlgraphics/fop/branches/Temp_ComplexScripts/findbugs-exclude.xml
URL:
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/findbugs-exclude.xml?rev=1071918&r1=1071917&r2=1071918&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_ComplexScripts/findbugs-exclude.xml (original)
+++ xmlgraphics/fop/branches/Temp_ComplexScripts/findbugs-exclude.xml Fri Feb
18 08:32:51 2011
@@ -5338,5 +5338,51 @@
<Bug pattern="UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR"/>
</Match>
<!-- /Automatically generated list of exclusions -->
-<!-- .merge-right.r1036883 -->
+ <!-- Automatically generated list of exclusions on 18 February 2011 -->
+ <Match>
+ <Class name="org.apache.fop.afp.goca.GraphicsSetProcessColor"/>
+ <Method name="writeToStream"/>
+ <Bug pattern="OS_OPEN_STREAM"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.pdf.PDFFactory"/>
+ <Method name="makeSeparationColorSpace"/>
+ <Bug pattern="DM_FP_NUMBER_CTOR"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.pdf.PDFFactory"/>
+ <Method name="toColorVector"/>
+ <Bug pattern="DM_FP_NUMBER_CTOR"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.fo.expr.PropertyTokenizer"/>
+ <Field name="recognizeOperator"/>
+ <Bug pattern="URF_UNREAD_FIELD"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.layoutmgr.BlockLayoutManager"/>
+ <Method name="getNextChildElements"/>
+ <Bug pattern="BC_UNCONFIRMED_CAST"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.util.ColorWithFallback"/>
+ <!-- Listing the method 'equals' does not work -->
+ <Bug pattern="EQ_DOESNT_OVERRIDE_EQUALS"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.util.ColorWithFallback"/>
+ <Method name="getAlternativeColors"/>
+ <Bug pattern="PZLA_PREFER_ZERO_LENGTH_ARRAYS"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.fo.expr.NamedColorFunction"/>
+ <Method name="eval"/>
+ <Bug pattern="RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE"/>
+ </Match>
+ <Match>
+ <Class name="org.apache.fop.util.ColorUtil"/>
+ <Method name="parseAsFopRgbNamedColor"/>
+ <Bug pattern="REC_CATCH_EXCEPTION"/>
+ </Match>
+ <!-- /Automatically generated list of exclusions on 18 February 2011 -->
</FindBugsFilter>
Propchange:
xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/afp/apps/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Feb 18 08:32:51 2011
@@ -3,4 +3,4 @@
/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/afp/apps:956535-1069429
/xmlgraphics/fop/branches/fop-0_95/src/java/org/apache/fop/afp/apps:684572,688085,688696
/xmlgraphics/fop/branches/fop-1_0/src/java/org/apache/fop/afp/apps:959975-964707
-/xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/apps:959946-1069734
+/xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/apps:959946-1071912
Propchange:
xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/afp/parser/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Feb 18 08:32:51 2011
@@ -3,4 +3,4 @@
/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/afp/parser:956535-1069429
/xmlgraphics/fop/branches/fop-0_95/src/java/org/apache/fop/afp/parser:684572,688085,688696
/xmlgraphics/fop/branches/fop-1_0/src/java/org/apache/fop/afp/parser:959975-964707
-/xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/parser:959946-1069734
+/xmlgraphics/fop/trunk/src/java/org/apache/fop/afp/parser:959946-1071912
Modified:
xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java
URL:
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java?rev=1071918&r1=1071917&r2=1071918&view=diff
==============================================================================
---
xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java
(original)
+++
xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/AbstractBreaker.java
Fri Feb 18 08:32:51 2011
@@ -429,7 +429,7 @@ public abstract class AbstractBreaker {
effectiveList);
blockListIndex = -1;
} else {
- log.debug("PLM> iOptPageCount= " + optimalPageCount
+ log.debug("PLM> optimalPageCount= " + optimalPageCount
+ " pageBreaks.size()= " +
alg.getPageBreaks().size());
//*** Phase 3: Add areas ***
@@ -455,11 +455,7 @@ public abstract class AbstractBreaker {
return true;
} else {
Position subPosition = position.getPosition();
- if (subPosition == null) {
- return false;
- } else {
- return containsNonRestartableLM(subPosition);
- }
+ return subPosition != null &&
containsNonRestartableLM(subPosition);
}
}
@@ -501,7 +497,7 @@ public abstract class AbstractBreaker {
int endElementIndex = 0;
int lastBreak = -1;
for (int p = startPart; p < startPart + partCount; p++) {
- PageBreakPosition pbp = (PageBreakPosition)
alg.getPageBreaks().get(p);
+ PageBreakPosition pbp = alg.getPageBreaks().get(p);
//Check the last break position for forced breaks
int lastBreakClass;
@@ -761,7 +757,7 @@ public abstract class AbstractBreaker {
/* Retrieve the original position wrapped into this space position */
positionAtBreak = positionAtBreak.getPosition();
LayoutManager restartAtLM = null;
- List<KnuthElement> firstElements = Collections.EMPTY_LIST;
+ List<KnuthElement> firstElements = Collections.emptyList();
if (containsNonRestartableLM(positionAtBreak)) {
if (alg.getIPDdifference() > 0) {
EventBroadcaster eventBroadcaster =
getCurrentChildLM().getFObj()
@@ -875,11 +871,11 @@ public abstract class AbstractBreaker {
*/
private BlockSequence justifyBoxes // CSOK:
MethodLength
(BlockSequence blockList, PageBreakingAlgorithm alg, int availableBPD)
{
- int iOptPageNumber;
+ int optimalPageCount;
alg.setConstantLineWidth(availableBPD);
- iOptPageNumber = alg.findBreakingPoints(blockList, /*availableBPD,*/
+ optimalPageCount = alg.findBreakingPoints(blockList, /*availableBPD,*/
1, true, BreakingAlgorithm.ALL_BREAKS);
- log.debug("PLM> iOptPageNumber= " + iOptPageNumber);
+ log.debug("PLM> optimalPageCount= " + optimalPageCount);
//
ListIterator<KnuthElement> sequenceIterator = blockList.listIterator();
@@ -904,7 +900,7 @@ public abstract class AbstractBreaker {
// inside the
// while loop must be a box
KnuthElement firstElement;
- while ( sequenceIterator.hasNext() ) {
+ while (sequenceIterator.hasNext()) {
firstElement = sequenceIterator.next();
if ( !firstElement.isBox() ) {
log.debug("PLM> ignoring glue or penalty element "
Modified:
xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/AlignmentContext.java
URL:
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/AlignmentContext.java?rev=1071918&r1=1071917&r2=1071918&view=diff
==============================================================================
---
xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/AlignmentContext.java
(original)
+++
xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/inline/AlignmentContext.java
Fri Feb 18 08:32:51 2011
@@ -111,7 +111,7 @@ public class AlignmentContext implements
* @param dominantBaseline the dominant-baseline property
* @param parentAlignmentContext the parent alignment context
*/
- private AlignmentContext(int altitude,
+ private AlignmentContext(int altitude, //
CSOK: ParameterNumber
int depth,
int lineHeight,
int xHeight,
Modified:
xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java
URL:
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java?rev=1071918&r1=1071917&r2=1071918&view=diff
==============================================================================
---
xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java
(original)
+++
xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/list/ListBlockLayoutManager.java
Fri Feb 18 08:32:51 2011
@@ -19,7 +19,6 @@
package org.apache.fop.layoutmgr.list;
-import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
@@ -51,9 +50,7 @@ import org.apache.fop.traits.SpaceVal;
public class ListBlockLayoutManager extends BlockStackingLayoutManager
implements ConditionalElementListener {
- /**
- * logging instance
- */
+ /** logging instance */
private static Log log = LogFactory.getLog(ListBlockLayoutManager.class);
private Block curBlockArea;
@@ -122,13 +119,6 @@ public class ListBlockLayoutManager exte
return returnList;
}
- /** {@inheritDoc} */
- @Override
- public List getChangedKnuthElements(List oldList, int alignment) {
- //log.debug("LBLM.getChangedKnuthElements>");
- return super.getChangedKnuthElements(oldList, alignment);
- }
-
/**
* The table area is a reference area that contains areas for
* columns, bodies, rows and the contents are in cells.
@@ -137,8 +127,7 @@ public class ListBlockLayoutManager exte
* @param layoutContext the layout context for adding areas
*/
@Override
- public void addAreas(PositionIterator parentIter,
- LayoutContext layoutContext) {
+ public void addAreas(PositionIterator parentIter, LayoutContext
layoutContext) {
getParentArea(null);
// if this will create the first block area in a page
@@ -263,6 +252,7 @@ public class ListBlockLayoutManager exte
*
* @param childArea the child area to add
*/
+ @Override
public void addChildArea(Area childArea) {
if (curBlockArea != null) {
curBlockArea.addBlock((Block) childArea);
@@ -270,16 +260,19 @@ public class ListBlockLayoutManager exte
}
/** {@inheritDoc} */
+ @Override
public KeepProperty getKeepTogetherProperty() {
return getListBlockFO().getKeepTogether();
}
/** {@inheritDoc} */
+ @Override
public KeepProperty getKeepWithPreviousProperty() {
return getListBlockFO().getKeepWithPrevious();
}
/** {@inheritDoc} */
+ @Override
public KeepProperty getKeepWithNextProperty() {
return getListBlockFO().getKeepWithNext();
}
Modified:
xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java
URL:
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java?rev=1071918&r1=1071917&r2=1071918&view=diff
==============================================================================
---
xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java
(original)
+++
xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/list/ListItemContentLayoutManager.java
Fri Feb 18 08:32:51 2011
@@ -83,13 +83,6 @@ public class ListItemContentLayoutManage
xoffset = off;
}
- /** {@inheritDoc} */
- @Override
- public List getChangedKnuthElements(List oldList, int alignment) {
- //log.debug(" ListItemContentLayoutManager.getChanged>");
- return super.getChangedKnuthElements(oldList, alignment);
- }
-
/**
* Add the areas for the break points.
* The list item contains block stacking layout managers
@@ -183,6 +176,7 @@ public class ListItemContentLayoutManage
curBlockArea.setPositioning(Block.ABSOLUTE);
// set position
curBlockArea.setXOffset(xoffset);
+ //TODO: Check - itemIPD never set?
curBlockArea.setIPD(itemIPD);
//curBlockArea.setHeight();
@@ -211,19 +205,21 @@ public class ListItemContentLayoutManage
}
/** {@inheritDoc} */
+ @Override
public KeepProperty getKeepTogetherProperty() {
return getPartFO().getKeepTogether();
}
/** {@inheritDoc} */
+ @Override
public Keep getKeepWithNext() {
return Keep.KEEP_AUTO;
}
/** {@inheritDoc} */
+ @Override
public Keep getKeepWithPrevious() {
return Keep.KEEP_AUTO;
}
-
}
Modified:
xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java
URL:
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java?rev=1071918&r1=1071917&r2=1071918&view=diff
==============================================================================
---
xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java
(original)
+++
xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/layoutmgr/list/ListItemLayoutManager.java
Fri Feb 18 08:32:51 2011
@@ -38,6 +38,7 @@ import org.apache.fop.layoutmgr.BreakEle
import org.apache.fop.layoutmgr.ConditionalElementListener;
import org.apache.fop.layoutmgr.ElementListObserver;
import org.apache.fop.layoutmgr.ElementListUtils;
+import org.apache.fop.layoutmgr.FootnoteBodyLayoutManager;
import org.apache.fop.layoutmgr.Keep;
import org.apache.fop.layoutmgr.KnuthBlockBox;
import org.apache.fop.layoutmgr.KnuthBox;
@@ -63,9 +64,7 @@ import org.apache.fop.traits.SpaceVal;
public class ListItemLayoutManager extends BlockStackingLayoutManager
implements ConditionalElementListener {
- /**
- * logging instance
- */
+ /** logging instance */
private static Log log = LogFactory.getLog(ListItemLayoutManager.class);
private ListItemContentLayoutManager label;
@@ -73,8 +72,8 @@ public class ListItemLayoutManager exten
private Block curBlockArea = null;
- private List labelList = null;
- private List bodyList = null;
+ private List<ListElement> labelList = null;
+ private List<ListElement> bodyList = null;
private boolean discardBorderBefore;
private boolean discardBorderAfter;
@@ -86,37 +85,35 @@ public class ListItemLayoutManager exten
private Keep keepWithNextPendingOnLabel;
private Keep keepWithNextPendingOnBody;
- private int listItemHeight;
-
private class ListItemPosition extends Position {
- private int iLabelFirstIndex;
- private int iLabelLastIndex;
- private int iBodyFirstIndex;
- private int iBodyLastIndex;
+ private int labelFirstIndex;
+ private int labelLastIndex;
+ private int bodyFirstIndex;
+ private int bodyLastIndex;
public ListItemPosition(LayoutManager lm, int labelFirst, int
labelLast,
int bodyFirst, int bodyLast) {
super(lm);
- iLabelFirstIndex = labelFirst;
- iLabelLastIndex = labelLast;
- iBodyFirstIndex = bodyFirst;
- iBodyLastIndex = bodyLast;
+ labelFirstIndex = labelFirst;
+ labelLastIndex = labelLast;
+ bodyFirstIndex = bodyFirst;
+ bodyLastIndex = bodyLast;
}
public int getLabelFirstIndex() {
- return iLabelFirstIndex;
+ return labelFirstIndex;
}
public int getLabelLastIndex() {
- return iLabelLastIndex;
+ return labelLastIndex;
}
public int getBodyFirstIndex() {
- return iBodyFirstIndex;
+ return bodyFirstIndex;
}
public int getBodyLastIndex() {
- return iBodyLastIndex;
+ return bodyLastIndex;
}
/** {@inheritDoc} */
@@ -128,8 +125,8 @@ public class ListItemLayoutManager exten
public String toString() {
StringBuffer sb = new StringBuffer("ListItemPosition:");
sb.append(getIndex()).append("(");
-
sb.append("label:").append(iLabelFirstIndex).append("-").append(iLabelLastIndex);
- sb.append("
body:").append(iBodyFirstIndex).append("-").append(iBodyLastIndex);
+
sb.append("label:").append(labelFirstIndex).append("-").append(labelLastIndex);
+ sb.append("
body:").append(bodyFirstIndex).append("-").append(bodyLastIndex);
sb.append(")");
return sb.toString();
}
@@ -172,6 +169,7 @@ public class ListItemLayoutManager exten
}
/** {@inheritDoc} */
+ @Override
public void initialize() {
foSpaceBefore = new SpaceVal(
getListItemFO().getCommonMarginBlock().spaceBefore,
this).getSpace();
@@ -191,32 +189,21 @@ public class ListItemLayoutManager exten
}
/** {@inheritDoc} */
+ @Override
public List getNextKnuthElements(LayoutContext context, int alignment) {
referenceIPD = context.getRefIPD();
LayoutContext childLC;
- List returnList = new LinkedList();
+ List<ListElement> returnList = new LinkedList<ListElement>();
- if (!breakBeforeServed) {
- breakBeforeServed = true;
- if (!context.suppressBreakBefore()) {
- if (addKnuthElementsForBreakBefore(returnList, context)) {
- return returnList;
- }
- }
+ if (!breakBeforeServed(context, returnList)) {
+ return returnList;
}
- addKnuthElementsForSpaceBefore(returnList, alignment);
-
- addKnuthElementsForBorderPaddingBefore(returnList,
!firstVisibleMarkServed);
- firstVisibleMarkServed = true;
-
- //Spaces, border and padding to be repeated at each break
- addPendingMarks(context);
+ addFirstVisibleMarks(returnList, context, alignment);
// label
- childLC = new LayoutContext(0);
- childLC.setRefIPD(context.getRefIPD());
+ childLC = makeChildLayoutContext(context);
label.initialize();
labelList = label.getNextKnuthElements(childLC, alignment);
@@ -229,8 +216,7 @@ public class ListItemLayoutManager exten
this.keepWithNextPendingOnLabel = childLC.getKeepWithNextPending();
// body
- childLC = new LayoutContext(0);
- childLC.setRefIPD(context.getRefIPD());
+ childLC = makeChildLayoutContext(context);
body.initialize();
bodyList = body.getNextKnuthElements(childLC, alignment);
@@ -248,8 +234,8 @@ public class ListItemLayoutManager exten
// "wrap" the Position inside each element
wrapPositionElements(returnedList, returnList, true);
- addKnuthElementsForBorderPaddingAfter(returnList, true);
- addKnuthElementsForSpaceAfter(returnList, alignment);
+ addLastVisibleMarks(returnList, context, alignment);
+
addKnuthElementsForBreakAfter(returnList, context);
context.updateKeepWithNextPending(this.keepWithNextPendingOnLabel);
@@ -262,11 +248,25 @@ public class ListItemLayoutManager exten
return returnList;
}
- private List getCombinedKnuthElementsForListItem(List labelElements,
- List bodyElements, LayoutContext context) {
+ /**
+ * Overridden to unconditionally add elements for space-before.
+ * {@inheritDoc}
+ */
+ @Override
+ protected void addFirstVisibleMarks(List<ListElement> elements,
+ LayoutContext context, int alignment) {
+ addKnuthElementsForSpaceBefore(elements, alignment);
+ addKnuthElementsForBorderPaddingBefore(elements,
!firstVisibleMarkServed);
+ firstVisibleMarkServed = true;
+ //Spaces, border and padding to be repeated at each break
+ addPendingMarks(context);
+ }
+
+ private List getCombinedKnuthElementsForListItem(List<ListElement>
labelElements,
+ List<ListElement> bodyElements, LayoutContext context) {
// Copy elements to array lists to improve element access performance
- List[] elementLists = {new ArrayList(labelElements),
- new ArrayList(bodyElements)};
+ List[] elementLists = {new ArrayList<ListElement>(labelElements),
+ new ArrayList<ListElement>(bodyElements)};
int[] fullHeights =
{ElementListUtils.calcContentLength(elementLists[0]),
ElementListUtils.calcContentLength(elementLists[1])};
int[] partialHeights = {0, 0};
@@ -278,7 +278,7 @@ public class ListItemLayoutManager exten
int addedBoxHeight = 0;
Keep keepWithNextActive = Keep.KEEP_AUTO;
- LinkedList returnList = new LinkedList();
+ LinkedList<ListElement> returnList = new LinkedList<ListElement>();
while ((step = getNextStep(elementLists, start, end, partialHeights))
> 0) {
if (end[0] + 1 == elementLists[0].size()) {
@@ -314,14 +314,14 @@ public class ListItemLayoutManager exten
// collect footnote information
// TODO this should really not be done like this. ListItemLM
should remain as
// footnote-agnostic as possible
- LinkedList footnoteList = null;
+ LinkedList<FootnoteBodyLayoutManager> footnoteList = null;
ListElement el;
for (int i = 0; i < elementLists.length; i++) {
for (int j = start[i]; j <= end[i]; j++) {
el = (ListElement) elementLists[i].get(j);
if (el instanceof KnuthBlockBox && ((KnuthBlockBox)
el).hasAnchors()) {
if (footnoteList == null) {
- footnoteList = new LinkedList();
+ footnoteList = new
LinkedList<FootnoteBodyLayoutManager>();
}
footnoteList.addAll(((KnuthBlockBox)
el).getFootnoteBodyLMs());
}
@@ -424,15 +424,12 @@ public class ListItemLayoutManager exten
fullHeights[1] - partialHeights[1]);
}
- /**
- * {@inheritDoc}
- */
+ /** {@inheritDoc} */
+ @Override
public List getChangedKnuthElements(List oldList, int alignment) {
- //log.debug(" LILM.getChanged> label");
// label
labelList = label.getChangedKnuthElements(labelList, alignment);
- //log.debug(" LILM.getChanged> body");
// body
// "unwrap" the Positions stored in the elements
ListIterator oldListIterator = oldList.listIterator();
@@ -440,11 +437,6 @@ public class ListItemLayoutManager exten
while (oldListIterator.hasNext()) {
oldElement = (KnuthElement)oldListIterator.next();
Position innerPosition = oldElement.getPosition().getPosition();
- //log.debug(" BLM> unwrapping: " + (oldElement.isBox()
- // ? "box " : (oldElement.isGlue() ? "glue " : "penalty"))
- // + " creato da " +
oldElement.getLayoutManager().getClass().getName());
- //log.debug(" BLM> unwrapping: "
- // + oldElement.getPosition().getClass().getName());
if (innerPosition != null) {
// oldElement was created by a descendant of this BlockLM
oldElement.setPosition(innerPosition);
@@ -478,6 +470,7 @@ public class ListItemLayoutManager exten
* @param parentIter the position iterator
* @param layoutContext the layout context for adding areas
*/
+ @Override
public void addAreas(PositionIterator parentIter,
LayoutContext layoutContext) {
getParentArea(null);
@@ -489,10 +482,10 @@ public class ListItemLayoutManager exten
Position lastPos = null;
// "unwrap" the NonLeafPositions stored in parentIter
- LinkedList positionList = new LinkedList();
+ LinkedList<Position> positionList = new LinkedList<Position>();
Position pos;
while (parentIter.hasNext()) {
- pos = (Position) parentIter.next();
+ pos = parentIter.next();
if (pos.getIndex() >= 0) {
if (firstPos == null) {
firstPos = pos;
@@ -577,16 +570,6 @@ public class ListItemLayoutManager exten
}
/**
- * Get the height of the list item after adjusting.
- * Should only be called after adding the list item areas.
- *
- * @return the height of this list item after adjustment
- */
- public int getListItemHeight() {
- return listItemHeight;
- }
-
- /**
* Return an Area which can contain the passed childArea. The childArea
* may not yet have any content, but it has essential traits set.
* In general, if the LayoutManager already has an Area it simply returns
@@ -599,6 +582,7 @@ public class ListItemLayoutManager exten
* @param childArea the child area
* @return the parent are for the child
*/
+ @Override
public Area getParentArea(Area childArea) {
if (curBlockArea == null) {
curBlockArea = new Block();
@@ -607,19 +591,15 @@ public class ListItemLayoutManager exten
/*Area parentArea =*/
parentLayoutManager.getParentArea(curBlockArea);
// set traits
- TraitSetter.setProducerID(curBlockArea, getListItemFO().getId());
- TraitSetter.addBorders(curBlockArea,
- getListItemFO().getCommonBorderPaddingBackground(),
+ ListItem fo = getListItemFO();
+ TraitSetter.setProducerID(curBlockArea, fo.getId());
+ TraitSetter.addBorders(curBlockArea,
fo.getCommonBorderPaddingBackground(),
discardBorderBefore, discardBorderAfter, false, false,
this);
- TraitSetter.addPadding(curBlockArea,
- getListItemFO().getCommonBorderPaddingBackground(),
+ TraitSetter.addPadding(curBlockArea,
fo.getCommonBorderPaddingBackground(),
discardPaddingBefore, discardPaddingAfter, false, false,
this);
- TraitSetter.addMargins(curBlockArea,
- getListItemFO().getCommonBorderPaddingBackground(),
- getListItemFO().getCommonMarginBlock(), this);
- TraitSetter.addBreaks(curBlockArea,
- getListItemFO().getBreakBefore(),
- getListItemFO().getBreakAfter());
+ TraitSetter.addMargins(curBlockArea,
fo.getCommonBorderPaddingBackground(),
+ fo.getCommonMarginBlock(), this);
+ TraitSetter.addBreaks(curBlockArea, fo.getBreakBefore(),
fo.getBreakAfter());
int contentIPD = referenceIPD - getIPIndents();
curBlockArea.setIPD(contentIPD);
@@ -636,6 +616,7 @@ public class ListItemLayoutManager exten
*
* @param childArea the child area
*/
+ @Override
public void addChildArea(Area childArea) {
if (curBlockArea != null) {
curBlockArea.addBlock((Block) childArea);
@@ -643,16 +624,19 @@ public class ListItemLayoutManager exten
}
/** {@inheritDoc} */
+ @Override
public KeepProperty getKeepTogetherProperty() {
return getListItemFO().getKeepTogether();
}
/** {@inheritDoc} */
+ @Override
public KeepProperty getKeepWithPreviousProperty() {
return getListItemFO().getKeepWithPrevious();
}
/** {@inheritDoc} */
+ @Override
public KeepProperty getKeepWithNextProperty() {
return getListItemFO().getKeepWithNext();
}
@@ -703,6 +687,7 @@ public class ListItemLayoutManager exten
}
/** {@inheritDoc} */
+ @Override
public void reset() {
super.reset();
label.reset();
Modified:
xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/pdf/PDFColorHandler.java
URL:
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/pdf/PDFColorHandler.java?rev=1071918&r1=1071917&r2=1071918&view=diff
==============================================================================
---
xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/pdf/PDFColorHandler.java
(original)
+++
xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/pdf/PDFColorHandler.java
Fri Feb 18 08:32:51 2011
@@ -50,6 +50,10 @@ public class PDFColorHandler {
private Map<String, PDFCIELabColorSpace> cieLabColorSpaces;
+ /**
+ * Create a new instance for the given {@link PDFResources}
+ * @param resources the PDF resources
+ */
public PDFColorHandler(PDFResources resources) {
this.resources = resources;
}
Modified:
xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/render/pdf/PDFImageHandlerSVG.java
URL:
http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/render/pdf/PDFImageHandlerSVG.java?rev=1071918&r1=1071917&r2=1071918&view=diff
==============================================================================
---
xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/render/pdf/PDFImageHandlerSVG.java
(original)
+++
xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/render/pdf/PDFImageHandlerSVG.java
Fri Feb 18 08:32:51 2011
@@ -24,6 +24,8 @@ import java.awt.Rectangle;
import java.awt.geom.AffineTransform;
import java.io.IOException;
+import org.w3c.dom.Document;
+
import org.apache.batik.bridge.BridgeContext;
import org.apache.batik.bridge.GVTBuilder;
import org.apache.batik.dom.svg.SVGDOMImplementation;
@@ -35,6 +37,7 @@ import org.apache.commons.logging.LogFac
import org.apache.xmlgraphics.image.loader.Image;
import org.apache.xmlgraphics.image.loader.ImageFlavor;
import org.apache.xmlgraphics.image.loader.impl.ImageXMLDOM;
+import org.apache.xmlgraphics.util.UnitConv;
import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.image.loader.batik.BatikImageFlavors;
@@ -47,7 +50,6 @@ import org.apache.fop.svg.PDFBridgeConte
import org.apache.fop.svg.PDFGraphics2D;
import org.apache.fop.svg.SVGEventProducer;
import org.apache.fop.svg.SVGUserAgent;
-import org.w3c.dom.Document;
/**
* Image Handler implementation which handles SVG images.
@@ -58,7 +60,8 @@ public class PDFImageHandlerSVG implemen
private static Log log = LogFactory.getLog(PDFImageHandlerSVG.class);
/** {@inheritDoc} */
- public void handleImage(RenderingContext context, Image image, Rectangle
pos)
+ public void handleImage(RenderingContext context, // CSOK:
MethodLength
+ Image image, Rectangle pos)
throws IOException {
PDFRenderingContext pdfContext = (PDFRenderingContext)context;
PDFContentGenerator generator = pdfContext.getGenerator();
@@ -109,11 +112,13 @@ public class PDFImageHandlerSVG implemen
//Scaling and translation for the bounding box of the image
AffineTransform scaling = new AffineTransform(
sx, 0, 0, sy, pos.x / 1000f, pos.y / 1000f);
+ double sourceScale = UnitConv.IN2PT / uaResolution;
+ scaling.scale(sourceScale, sourceScale);
//Scale for higher resolution on-the-fly images from Batik
- double s = uaResolution / deviceResolution;
AffineTransform resolutionScaling = new AffineTransform();
- resolutionScaling.scale(s, s);
+ double targetScale = uaResolution / deviceResolution;
+ resolutionScaling.scale(targetScale, targetScale);
resolutionScaling.scale(1.0 / sx, 1.0 / sy);
//Transformation matrix that establishes the local coordinate system
for the SVG graphic
@@ -122,12 +127,26 @@ public class PDFImageHandlerSVG implemen
imageTransform.concatenate(scaling);
imageTransform.concatenate(resolutionScaling);
+ if (log.isTraceEnabled()) {
+ log.trace("nat size: " + w + "/" + h);
+ log.trace("req size: " + pos.width + "/" + pos.height);
+ log.trace("source res: " + uaResolution + ", targetRes: " +
deviceResolution
+ + " --> target scaling: " + targetScale);
+ log.trace(image.getSize());
+ log.trace("sx: " + sx + ", sy: " + sy);
+ log.trace("scaling: " + scaling);
+ log.trace("resolution scaling: " + resolutionScaling);
+ log.trace("image transform: " + resolutionScaling);
+ }
+
/*
* Clip to the svg area.
* Note: To have the svg overlay (under) a text area then use
* an fo:block-container
*/
- generator.comment("SVG setup");
+ if (log.isTraceEnabled()) {
+ generator.comment("SVG setup");
+ }
generator.saveGraphicsState();
if (context.getUserAgent().isAccessibilityEnabled()) {
MarkedContentInfo mci = pdfContext.getMarkedContentInfo();
@@ -137,7 +156,9 @@ public class PDFImageHandlerSVG implemen
generator.setColor(Color.black, true);
if (!scaling.isIdentity()) {
- generator.comment("viewbox");
+ if (log.isTraceEnabled()) {
+ generator.comment("viewbox");
+ }
generator.add(CTMHelper.toPDFString(scaling, false) + " cm\n");
}
@@ -150,8 +171,10 @@ public class PDFImageHandlerSVG implemen
graphics.setGraphicContext(new
org.apache.xmlgraphics.java2d.GraphicContext());
if (!resolutionScaling.isIdentity()) {
- generator.comment("resolution scaling for " + uaResolution
- + " -> " + deviceResolution + "\n");
+ if (log.isTraceEnabled()) {
+ generator.comment("resolution scaling for " + uaResolution
+ + " -> " + deviceResolution);
+ }
generator.add(
CTMHelper.toPDFString(resolutionScaling, false) + " cm\n");
graphics.scale(
@@ -159,7 +182,9 @@ public class PDFImageHandlerSVG implemen
1.0 / resolutionScaling.getScaleY());
}
- generator.comment("SVG start");
+ if (log.isTraceEnabled()) {
+ generator.comment("SVG start");
+ }
//Save state and update coordinate system for the SVG image
generator.getState().save();
@@ -187,7 +212,9 @@ public class PDFImageHandlerSVG implemen
} else {
generator.restoreGraphicsState();
}
- generator.comment("SVG end");
+ if (log.isTraceEnabled()) {
+ generator.comment("SVG end");
+ }
}
/** {@inheritDoc} */
Propchange:
xmlgraphics/fop/branches/Temp_ComplexScripts/src/java/org/apache/fop/util/ColorExt.java
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Feb 18 08:32:51 2011
@@ -3,4 +3,4 @@
/xmlgraphics/fop/branches/Temp_AreaTreeNewDesign/src/java/org/apache/fop/util/ColorExt.java:603620-746655
/xmlgraphics/fop/branches/Temp_Color/src/java/org/apache/fop/util/ColorExt.java:956535-1069429
/xmlgraphics/fop/branches/fop-0_95/src/java/org/apache/fop/util/ColorExt.java:684572,688085,688696
-/xmlgraphics/fop/trunk/src/java/org/apache/fop/util/ColorExt.java:981451-1069734
+/xmlgraphics/fop/trunk/src/java/org/apache/fop/util/ColorExt.java:981451-1071912
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]