public Property get(int subpropId, PropertyList propertyList,
boolean tryInherit, boolean tryDefault)
throws PropertyException {
Property p = super.get(0, propertyList, tryInherit, tryDefault);
FObj fo = propertyList.getFObj();
String fallbackValue = (propId == Constants.PR_PAGE_HEIGHT)
? fo.getFOEventHandler().getUserAgent().getPageHeight()
: fo.getFOEventHandler().getUserAgent().getPageWidth();
if (p.getEnum() == Constants.EN_INDEFINITE) {
int otherId = (propId == Constants.PR_PAGE_HEIGHT)
? Constants.PR_PAGE_WIDTH : Constants.PR_PAGE_HEIGHT;
int writingMode = propertyList.get(Constants.PR_WRITING_MODE).getEnum();
int refOrientation = propertyList.get(Constants.PR_REFERENCE_ORIENTATION)
.getNumeric().getValue();
if (propertyList.getExplicit(otherId) != null
&& propertyList.getExplicit(otherId).getEnum() == Constants.EN_INDEFINITE) {
//both set to "indefinite":
//determine which one of the two defines the dimension
//in block-progression-direction, and set the other to
//"auto"
if ((writingMode != Constants.EN_TB_RL
&& (refOrientation == 0
|| refOrientation == 180
|| refOrientation == -180))
|| (writingMode == Constants.EN_TB_RL
&& (refOrientation == 90
|| refOrientation == 270
|| refOrientation == -270))) {
//set page-width to "auto" = use the fallback from FOUserAgent
if (propId == Constants.PR_PAGE_WIDTH) {
fo.getLogger().warn("Both page-width and page-height set to "
+ "\"indefinite\". Forcing page-width to \"auto\"");
return make(propertyList, fallbackValue, fo);
}
} else {
//set page-height to "auto" = use fallback from FOUserAgent
fo.getLogger().warn("Both page-width and page-height set to "
+ "\"indefinite\". Forcing page-height to \"auto\"");
if (propId == Constants.PR_PAGE_HEIGHT) {
return make(propertyList, fallbackValue, fo);
}
}