aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/org
diff options
context:
space:
mode:
authorSimon Pepping <spepping@apache.org>2006-10-07 14:29:54 +0000
committerSimon Pepping <spepping@apache.org>2006-10-07 14:29:54 +0000
commite7486da571264b21eba4724902db64b94da789c1 (patch)
tree352fa780320208a88e04e10733ea61bf4332cd1e /src/java/org
parent78b3b2bb8f79b35fe41088b69e124b42e2f08da1 (diff)
downloadxmlgraphics-fop-e7486da571264b21eba4724902db64b94da789c1.tar.gz
xmlgraphics-fop-e7486da571264b21eba4724902db64b94da789c1.zip
Fixed layout of forward page number citation references in fo:inline
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@453920 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org')
-rw-r--r--src/java/org/apache/fop/area/inline/InlineArea.java24
-rw-r--r--src/java/org/apache/fop/area/inline/InlineParent.java5
-rw-r--r--src/java/org/apache/fop/area/inline/TextArea.java17
-rw-r--r--src/java/org/apache/fop/area/inline/UnresolvedPageNumber.java2
-rw-r--r--src/java/org/apache/fop/layoutmgr/inline/PageNumberLayoutManager.java2
5 files changed, 13 insertions, 37 deletions
diff --git a/src/java/org/apache/fop/area/inline/InlineArea.java b/src/java/org/apache/fop/area/inline/InlineArea.java
index 892ad6062..5e31adf22 100644
--- a/src/java/org/apache/fop/area/inline/InlineArea.java
+++ b/src/java/org/apache/fop/area/inline/InlineArea.java
@@ -113,11 +113,6 @@ public class InlineArea extends Area {
*/
public void setParentArea(Area parentArea) {
this.parentArea = parentArea;
- // notify the parent area about ipd variations
- if (storedIPDVariation > 0) {
- notifyIPDVariation(storedIPDVariation);
- storedIPDVariation = 0;
- }
}
/**
@@ -162,16 +157,6 @@ public class InlineArea extends Area {
}
/**
- * set the ipd and notify the parent area about the variation;
- * this happens when a page-number or a page-number-citation
- * is resolved to its actual value
- * @param newIPD the new ipd of the area
- */
- public void updateIPD(int newIPD) {
- // default behaviour: do nothing
- }
-
- /**
* recursively apply the variation factor to all descendant areas
* @param variationFactor the variation factor that must be applied to adjustments
* @param lineStretch the total stretch of the line
@@ -184,14 +169,19 @@ public class InlineArea extends Area {
return false;
}
- /**
+ public void handleIPDVariation(int ipdVariation) {
+ increaseIPD(ipdVariation);
+ notifyIPDVariation(ipdVariation);
+ }
+
+ /**
* notify the parent area about the ipd variation of this area
* or of a descendant area
* @param ipdVariation the difference between new and old ipd
*/
protected void notifyIPDVariation(int ipdVariation) {
if (getParentArea() instanceof InlineArea) {
- ((InlineArea) getParentArea()).notifyIPDVariation(ipdVariation);
+ ((InlineArea) getParentArea()).handleIPDVariation(ipdVariation);
} else if (getParentArea() instanceof LineArea) {
((LineArea) getParentArea()).handleIPDVariation(ipdVariation);
} else if (getParentArea() == null) {
diff --git a/src/java/org/apache/fop/area/inline/InlineParent.java b/src/java/org/apache/fop/area/inline/InlineParent.java
index 016154989..4b55d45be 100644
--- a/src/java/org/apache/fop/area/inline/InlineParent.java
+++ b/src/java/org/apache/fop/area/inline/InlineParent.java
@@ -53,9 +53,12 @@ public class InlineParent extends InlineArea {
autoSize = (getIPD() == 0);
}
if (childArea instanceof InlineArea) {
+ InlineArea inlineChildArea = (InlineArea) childArea;
inlines.add(childArea);
+ // set the parent area for the child area
+ inlineChildArea.setParentArea(this);
if (autoSize) {
- increaseIPD(((InlineArea) childArea).getAllocIPD());
+ increaseIPD(inlineChildArea.getAllocIPD());
}
}
}
diff --git a/src/java/org/apache/fop/area/inline/TextArea.java b/src/java/org/apache/fop/area/inline/TextArea.java
index 5e3d3da39..703d6a436 100644
--- a/src/java/org/apache/fop/area/inline/TextArea.java
+++ b/src/java/org/apache/fop/area/inline/TextArea.java
@@ -109,22 +109,5 @@ public class TextArea extends AbstractTextArea {
return text.toString();
}
- /**
- * set the ipd and notify the parent area about the variation;
- * this happens when a page-number or a page-number-citation
- * is resolved to its actual value
- * @param newIPD the new ipd of the area
- */
- public void updateIPD(int newIPD) {
- // remember the old ipd
- int oldIPD = getIPD();
- // set the new ipd
- setIPD(newIPD);
- // check if the line needs to be adjusted because of the ipd variation
- if (newIPD != oldIPD) {
- notifyIPDVariation(newIPD - oldIPD);
- }
- }
-
}
diff --git a/src/java/org/apache/fop/area/inline/UnresolvedPageNumber.java b/src/java/org/apache/fop/area/inline/UnresolvedPageNumber.java
index 2f83afdda..db94ce6a1 100644
--- a/src/java/org/apache/fop/area/inline/UnresolvedPageNumber.java
+++ b/src/java/org/apache/fop/area/inline/UnresolvedPageNumber.java
@@ -107,7 +107,7 @@ public class UnresolvedPageNumber extends TextArea implements Resolvable {
addWord(text, 0);
// update ipd
if (font != null) {
- updateIPD(font.getWordWidth(text));
+ handleIPDVariation(font.getWordWidth(text) - getIPD());
// set the Font object to null, as we don't need it any more
font = null;
} else {
diff --git a/src/java/org/apache/fop/layoutmgr/inline/PageNumberLayoutManager.java b/src/java/org/apache/fop/layoutmgr/inline/PageNumberLayoutManager.java
index ff751bcd8..51783fc1e 100644
--- a/src/java/org/apache/fop/layoutmgr/inline/PageNumberLayoutManager.java
+++ b/src/java/org/apache/fop/layoutmgr/inline/PageNumberLayoutManager.java
@@ -110,7 +110,7 @@ public class PageNumberLayoutManager extends LeafNodeLayoutManager {
area.removeText();
area.addWord(getCurrentPV().getPageNumberString(), 0);
// update the ipd of the area
- area.updateIPD(getStringWidth(area.getText()));
+ area.handleIPDVariation(getStringWidth(area.getText()) - area.getIPD());
// update the width stored in the AreaInfo object
areaInfo.ipdArea = new MinOptMax(area.getIPD());
}