*/
public void setParentArea(Area parentArea) {
this.parentArea = parentArea;
- // notify the parent area about ipd variations
- if (storedIPDVariation > 0) {
- notifyIPDVariation(storedIPDVariation);
- storedIPDVariation = 0;
- }
}
/**
return getBooleanTrait(Trait.BLINK);
}
- /**
- * 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
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) {
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());
}
}
}
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);
- }
- }
-
}
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());
}
<eval expected="112" xpath="//pageViewport[@nr=111]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/lineArea/text[2]"/>
<eval expected="20016" xpath="//pageViewport[@nr=111]/page/regionViewport/regionBody/mainReference/span/flow/block[1]/lineArea/text[2]/@ipd"/>
<!-- Check the text and width of the inlineparent area -->
- <!-- disabled until this feature is fixed
<eval expected="112" xpath="//pageViewport[@nr=111]/page/regionViewport/regionBody/mainReference/span/flow/block[2]/lineArea/inlineparent"/>
<eval expected="20016" xpath="//pageViewport[@nr=111]/page/regionViewport/regionBody/mainReference/span/flow/block[2]/lineArea/inlineparent/@ipd"/>
- -->
</checks>
</testcase>