aboutsummaryrefslogtreecommitdiffstats
path: root/src/java
diff options
context:
space:
mode:
authorAdrian Cumiskey <acumiskey@apache.org>2008-06-17 10:30:54 +0000
committerAdrian Cumiskey <acumiskey@apache.org>2008-06-17 10:30:54 +0000
commit08f0da8adadb9fda358992ad204948570ad41d11 (patch)
tree63839a088e22c7224abbd11ffa8befff0715169f /src/java
parentf25d75a80cbb96a31e6d5b5a4da9d5e95d164cd8 (diff)
downloadxmlgraphics-fop-08f0da8adadb9fda358992ad204948570ad41d11.tar.gz
xmlgraphics-fop-08f0da8adadb9fda358992ad204948570ad41d11.zip
Merged revisions 666596,666967,667367,667831,667862,667864,667893,668177,668576 via svnmerge from
https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk ........ r666596 | vhennebert | 2008-06-11 10:52:04 +0100 (Wed, 11 Jun 2008) | 2 lines Fixed typo ........ r666967 | maxberger | 2008-06-12 07:07:28 +0100 (Thu, 12 Jun 2008) | 1 line Added PMD and Findbugs report, 'reports' target' ........ r667367 | maxberger | 2008-06-13 07:03:30 +0100 (Fri, 13 Jun 2008) | 1 line Disabled retroweaver task definition, because it breaks gump ........ r667831 | maxberger | 2008-06-14 17:21:15 +0100 (Sat, 14 Jun 2008) | 1 line minor spelling fixes ........ r667862 | maxberger | 2008-06-14 19:18:14 +0100 (Sat, 14 Jun 2008) | 1 line minor spelling fixes ........ r667864 | maxberger | 2008-06-14 19:23:28 +0100 (Sat, 14 Jun 2008) | 1 line minor spelling & checkstyle fixes ........ r667893 | maxberger | 2008-06-14 23:20:42 +0100 (Sat, 14 Jun 2008) | 1 line removed double storage of 'fobj' ........ r668177 | lfurini | 2008-06-16 15:52:14 +0100 (Mon, 16 Jun 2008) | 2 lines Fixing the PageBreakingAlgorithm, replacing calls to getLineWidth() with getLineWidth(int) so as to take into account each page's real height. This fixes the positioning of footnotes when the page bpd is not the same for all pages. ........ r668576 | jeremias | 2008-06-17 10:04:05 +0100 (Tue, 17 Jun 2008) | 1 line Wrong line number reported in the case of a line overflow. ........ git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/branches/Temp_AFPGOCAResources@668608 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java')
-rw-r--r--src/java/org/apache/fop/layoutmgr/AbstractBaseLayoutManager.java34
-rw-r--r--src/java/org/apache/fop/layoutmgr/LayoutManager.java4
-rw-r--r--src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java8
-rw-r--r--src/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java35
-rw-r--r--src/java/org/apache/fop/layoutmgr/inline/ExternalGraphicLayoutManager.java16
-rw-r--r--src/java/org/apache/fop/layoutmgr/inline/InstreamForeignObjectLM.java11
-rw-r--r--src/java/org/apache/fop/layoutmgr/inline/LeafNodeLayoutManager.java4
-rw-r--r--src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java3
8 files changed, 46 insertions, 69 deletions
diff --git a/src/java/org/apache/fop/layoutmgr/AbstractBaseLayoutManager.java b/src/java/org/apache/fop/layoutmgr/AbstractBaseLayoutManager.java
index 7fd289c05..27189bf86 100644
--- a/src/java/org/apache/fop/layoutmgr/AbstractBaseLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/AbstractBaseLayoutManager.java
@@ -34,17 +34,17 @@ import org.apache.fop.fo.FObj;
public abstract class AbstractBaseLayoutManager
implements LayoutManager, PercentBaseContext {
- /** Indicator if this LM generates reference areas */
+ /** Indicator if this LM generates reference areas. */
protected boolean generatesReferenceArea = false;
- /** Indicator if this LM generates block areas */
+ /** Indicator if this LM generates block areas. */
protected boolean generatesBlockArea = false;
- /** The formatting object for this LM */
+ /** The formatting object for this LM. */
protected final FObj fobj;
/**
* logging instance
*/
- private static Log log = LogFactory.getLog(AbstractBaseLayoutManager.class);
+ private static final Log LOG = LogFactory.getLog(AbstractBaseLayoutManager.class);
/**
* Abstract base layout manager.
@@ -69,8 +69,8 @@ public abstract class AbstractBaseLayoutManager
// --------- Property Resolution related functions --------- //
/** {@inheritDoc} */
- public int getBaseLength(int lengthBase, FObj fobj) {
- if (fobj == this.fobj) {
+ public int getBaseLength(int lengthBase, FObj fobjx) {
+ if (fobjx == this.fobj) {
switch (lengthBase) {
case LengthBase.CONTAINING_BLOCK_WIDTH:
return getAncestorBlockAreaIPD();
@@ -81,20 +81,20 @@ public abstract class AbstractBaseLayoutManager
case LengthBase.CONTAINING_REFAREA_WIDTH:
return getReferenceAreaIPD();
default:
- log.error("Unknown base type for LengthBase:" + lengthBase);
+ LOG.error("Unknown base type for LengthBase:" + lengthBase);
return 0;
}
} else {
LayoutManager lm = getParent();
- while (lm != null && fobj != lm.getFObj()) {
+ while (lm != null && fobjx != lm.getFObj()) {
lm = lm.getParent();
}
if (lm != null) {
- return lm.getBaseLength(lengthBase, fobj);
+ return lm.getBaseLength(lengthBase, fobjx);
}
}
- log.error("Cannot find LM to handle given FO for LengthBase. ("
- + fobj.getContextInfo() + ")");
+ LOG.error("Cannot find LM to handle given FO for LengthBase. ("
+ + fobjx.getContextInfo() + ")");
return 0;
}
@@ -111,7 +111,7 @@ public abstract class AbstractBaseLayoutManager
}
lm = lm.getParent();
}
- log.error("No parent LM found");
+ LOG.error("No parent LM found");
return 0;
}
@@ -128,7 +128,7 @@ public abstract class AbstractBaseLayoutManager
}
lm = lm.getParent();
}
- log.error("No parent LM found");
+ LOG.error("No parent LM found");
return 0;
}
@@ -141,7 +141,7 @@ public abstract class AbstractBaseLayoutManager
if (lm != null) {
return lm.getContentAreaIPD();
}
- log.error("No parent LM found");
+ LOG.error("No parent LM found");
return 0;
}
@@ -154,7 +154,7 @@ public abstract class AbstractBaseLayoutManager
if (lm != null) {
return lm.getContentAreaBPD();
}
- log.error("No parent LM found");
+ LOG.error("No parent LM found");
return 0;
}
@@ -171,7 +171,7 @@ public abstract class AbstractBaseLayoutManager
}
lm = lm.getParent();
}
- log.error("No parent LM found");
+ LOG.error("No parent LM found");
return 0;
}
@@ -188,7 +188,7 @@ public abstract class AbstractBaseLayoutManager
}
lm = lm.getParent();
}
- log.error("No parent LM found");
+ LOG.error("No parent LM found");
return 0;
}
diff --git a/src/java/org/apache/fop/layoutmgr/LayoutManager.java b/src/java/org/apache/fop/layoutmgr/LayoutManager.java
index 0700ea43a..ad0d9f69c 100644
--- a/src/java/org/apache/fop/layoutmgr/LayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/LayoutManager.java
@@ -134,7 +134,7 @@ public interface LayoutManager extends PercentBaseContext {
* of the node assigned to the LM
*
* @param context the LayoutContext used to store layout information
- * @param alignment the desired text alignement
+ * @param alignment the desired text alignment
* @return the list of KnuthElements
*/
List getNextKnuthElements(LayoutContext context, int alignment);
@@ -145,7 +145,7 @@ public interface LayoutManager extends PercentBaseContext {
*
* In the context of line breaking, this method is called after hyphenation has
* been performed, in order to receive the sequence of elements representing the
- * text together with all possibile hyphenation points.
+ * text together with all possible hyphenation points.
* For example, if the text "representation" originates a single box element
* when getNextKnuthElements() is called, it will be now split in syllables
* (rep-re-sen-ta-tion) each one originating a box and divided by additional
diff --git a/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java b/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java
index a3155e102..9e0b42ecb 100644
--- a/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java
+++ b/src/java/org/apache/fop/layoutmgr/PageBreakingAlgorithm.java
@@ -325,7 +325,7 @@ class PageBreakingAlgorithm extends BreakingAlgorithm {
// this page contains some footnote citations
// add the footnote separator width
actualWidth += footnoteSeparatorLength.opt;
- if (actualWidth + allFootnotes <= getLineWidth()) {
+ if (actualWidth + allFootnotes <= getLineWidth(activeNode.line)) {
// there is enough space to insert all footnotes:
// add the whole allFootnotes length
actualWidth += allFootnotes;
@@ -337,7 +337,7 @@ class PageBreakingAlgorithm extends BreakingAlgorithm {
= checkCanDeferOldFootnotes(pageNode, elementIndex))
|| newFootnotes)
&& (footnoteSplit = getFootnoteSplit(pageNode,
- getLineWidth() - actualWidth, canDeferOldFootnotes)) > 0) {
+ getLineWidth(activeNode.line) - actualWidth, canDeferOldFootnotes)) > 0) {
// it is allowed to break or even defer footnotes if either:
// - there are new footnotes in the last piece of content, and
// there is space to add at least a piece of the first one
@@ -683,7 +683,7 @@ class PageBreakingAlgorithm extends BreakingAlgorithm {
insertedFootnotesLength = lastNode.totalFootnotes;
footnoteListIndex = lastNode.footnoteListIndex;
footnoteElementIndex = lastNode.footnoteElementIndex;
- int availableBPD = getLineWidth();
+ int availableBPD = getLineWidth(lastNode.line);
int split = 0;
KnuthPageNode prevNode = lastNode;
@@ -718,7 +718,7 @@ class PageBreakingAlgorithm extends BreakingAlgorithm {
removeNode(prevNode.line, prevNode);
prevNode = node;
- availableBPD = getLineWidth();
+ availableBPD = getLineWidth(node.line);
}
}
// create the last node
diff --git a/src/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java
index e90927699..76002da2f 100644
--- a/src/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/inline/AbstractGraphicsLayoutManager.java
@@ -39,16 +39,14 @@ import org.apache.fop.layoutmgr.TraitSetter;
*/
public abstract class AbstractGraphicsLayoutManager extends LeafNodeLayoutManager {
- /** The graphics object this LM deals with */
- protected AbstractGraphics fobj;
-
/**
- * Constructor
- * @param node the formatting object that creates this area
+ * Constructor.
+ *
+ * @param node
+ * the formatting object that creates this area
*/
public AbstractGraphicsLayoutManager(AbstractGraphics node) {
super(node);
- fobj = node;
}
/**
@@ -57,6 +55,7 @@ public abstract class AbstractGraphicsLayoutManager extends LeafNodeLayoutManage
* @return the viewport inline area
*/
private Viewport getInlineArea() {
+ final AbstractGraphics fobj = (AbstractGraphics)this.fobj;
Dimension intrinsicSize = new Dimension(
fobj.getIntrinsicWidth(),
fobj.getIntrinsicHeight());
@@ -113,6 +112,7 @@ public abstract class AbstractGraphicsLayoutManager extends LeafNodeLayoutManage
/** {@inheritDoc} */
protected AlignmentContext makeAlignmentContext(LayoutContext context) {
+ final AbstractGraphics fobj = (AbstractGraphics)this.fobj;
return new AlignmentContext(
get(context).getAllocBPD()
, fobj.getAlignmentAdjust()
@@ -128,7 +128,7 @@ public abstract class AbstractGraphicsLayoutManager extends LeafNodeLayoutManage
* the viewport.
* @return the appropriate area
*/
- abstract Area getChildArea();
+ protected abstract Area getChildArea();
// --------- Property Resolution related functions --------- //
@@ -138,31 +138,14 @@ public abstract class AbstractGraphicsLayoutManager extends LeafNodeLayoutManage
public int getBaseLength(int lengthBase, FObj fobj) {
switch (lengthBase) {
case LengthBase.IMAGE_INTRINSIC_WIDTH:
- return getIntrinsicWidth();
+ return ((AbstractGraphics)fobj).getIntrinsicWidth();
case LengthBase.IMAGE_INTRINSIC_HEIGHT:
- return getIntrinsicHeight();
+ return ((AbstractGraphics)fobj).getIntrinsicHeight();
case LengthBase.ALIGNMENT_ADJUST:
return get(null).getBPD();
default: // Delegate to super class
return super.getBaseLength(lengthBase, fobj);
}
}
-
- /**
- * Returns the intrinsic width of the e-g.
- * @return the width of the element
- */
- protected int getIntrinsicWidth() {
- return fobj.getIntrinsicWidth();
- }
-
- /**
- * Returns the intrinsic height of the e-g.
- * @return the height of the element
- */
- protected int getIntrinsicHeight() {
- return fobj.getIntrinsicHeight();
- }
-
}
diff --git a/src/java/org/apache/fop/layoutmgr/inline/ExternalGraphicLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/ExternalGraphicLayoutManager.java
index 5e3c0e2fa..d7bff5a5c 100644
--- a/src/java/org/apache/fop/layoutmgr/inline/ExternalGraphicLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/inline/ExternalGraphicLayoutManager.java
@@ -29,24 +29,20 @@ import org.apache.fop.fo.flow.ExternalGraphic;
*/
public class ExternalGraphicLayoutManager extends AbstractGraphicsLayoutManager {
- private ExternalGraphic fobj;
-
/**
- * Constructor
- * @param node the fo:external-graphic formatting object that creates the area
+ * Constructor.
+ *
+ * @param node
+ * the fo:external-graphic formatting object that creates the
+ * area
*/
public ExternalGraphicLayoutManager(ExternalGraphic node) {
super(node);
- this.fobj = node;
}
/** {@inheritDoc} */
protected Area getChildArea() {
- Image img = new Image(fobj.getSrc());
- if (fobj.hasExtensionAttachments()) {
- img.setExtensionAttachments(fobj.getExtensionAttachments());
- }
- return img;
+ return new Image(((ExternalGraphic) fobj).getSrc());
}
}
diff --git a/src/java/org/apache/fop/layoutmgr/inline/InstreamForeignObjectLM.java b/src/java/org/apache/fop/layoutmgr/inline/InstreamForeignObjectLM.java
index e7da50a9a..5f9365f83 100644
--- a/src/java/org/apache/fop/layoutmgr/inline/InstreamForeignObjectLM.java
+++ b/src/java/org/apache/fop/layoutmgr/inline/InstreamForeignObjectLM.java
@@ -29,20 +29,19 @@ import org.apache.fop.fo.flow.InstreamForeignObject;
*/
public class InstreamForeignObjectLM extends AbstractGraphicsLayoutManager {
- private InstreamForeignObject fobj;
-
/**
- * Constructor
- * @param node the formatting object that creates this area
+ * Constructor.
+ *
+ * @param node
+ * the formatting object that creates this area
*/
public InstreamForeignObjectLM(InstreamForeignObject node) {
super(node);
- fobj = node;
}
/** {@inheritDoc} */
protected Area getChildArea() {
- XMLObj child = (XMLObj) fobj.getChildXMLObj();
+ XMLObj child = ((InstreamForeignObject) fobj).getChildXMLObj();
org.w3c.dom.Document doc = child.getDOMDocument();
String ns = child.getNamespaceURI();
diff --git a/src/java/org/apache/fop/layoutmgr/inline/LeafNodeLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/LeafNodeLayoutManager.java
index 552e74889..19a8cdf2d 100644
--- a/src/java/org/apache/fop/layoutmgr/inline/LeafNodeLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/inline/LeafNodeLayoutManager.java
@@ -91,7 +91,7 @@ public abstract class LeafNodeLayoutManager extends AbstractLayoutManager
/**
- * Create a Leaf node layout mananger.
+ * Create a Leaf node layout manager.
* @param node the FObj to attach to this LM.
*/
public LeafNodeLayoutManager(FObj node) {
@@ -99,7 +99,7 @@ public abstract class LeafNodeLayoutManager extends AbstractLayoutManager
}
/**
- * Create a Leaf node layout mananger.
+ * Create a Leaf node layout manager.
*/
public LeafNodeLayoutManager() {
}
diff --git a/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
index b77f36f0d..87077ee77 100644
--- a/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/inline/LineLayoutManager.java
@@ -387,9 +387,8 @@ public class LineLayoutManager extends InlineStackingLayoutManager
InlineLevelEventProducer eventProducer
= InlineLevelEventProducer.Provider.get(
getFObj().getUserAgent().getEventBroadcaster());
- eventProducer.lineOverflows(this, addedPositions + 1,
+ eventProducer.lineOverflows(this, bestActiveNode.line,
-lack, getFObj().getLocator());
- String textDiff = (lack < -50000 ? "more than 50 points" : (-lack) + "mpt");
}
}