diff options
author | Andreas L. Delmelle <adelmelle@apache.org> | 2005-09-24 23:55:41 +0000 |
---|---|---|
committer | Andreas L. Delmelle <adelmelle@apache.org> | 2005-09-24 23:55:41 +0000 |
commit | e83ae89e75c0b656c1c0e320b1e2132fb18073c9 (patch) | |
tree | 363406af2bd60cc876e4f7aa419ddb13f7d978c2 /src/java/org/apache/fop/fo | |
parent | 78a328cba576a8857eb4a299741b7568736f075d (diff) | |
download | xmlgraphics-fop-e83ae89e75c0b656c1c0e320b1e2132fb18073c9.tar.gz xmlgraphics-fop-e83ae89e75c0b656c1c0e320b1e2132fb18073c9.zip |
Added check for both page-height and page-width set to indefinite; use fallback (auto) for the appropriate one
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@291351 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/java/org/apache/fop/fo')
-rw-r--r-- | src/java/org/apache/fop/fo/properties/PageDimensionMaker.java | 46 |
1 files changed, 37 insertions, 9 deletions
diff --git a/src/java/org/apache/fop/fo/properties/PageDimensionMaker.java b/src/java/org/apache/fop/fo/properties/PageDimensionMaker.java index cf50fc41f..47183e38f 100644 --- a/src/java/org/apache/fop/fo/properties/PageDimensionMaker.java +++ b/src/java/org/apache/fop/fo/properties/PageDimensionMaker.java @@ -51,20 +51,48 @@ public class PageDimensionMaker extends LengthProperty.Maker { 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(); - //TODO: add check for both height and width being specified as indefinite - // and use the fallback value (= set to "auto") + 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) { + return make(propertyList, fallbackValue, fo); + } + } else { + //set page-height to "auto" = use fallback from FOUserAgent + if (propId == Constants.PR_PAGE_HEIGHT) { + return make(propertyList, fallbackValue, fo); + } + } + } + } if (p.isAuto()) { - FObj fo = propertyList.getFObj(); - - String fallbackValue = (propId == Constants.PR_PAGE_HEIGHT) - ? fo.getFOEventHandler().getUserAgent().getPageHeight() - : fo.getFOEventHandler().getUserAgent().getPageWidth(); return make(propertyList, fallbackValue, fo); } return p; - } - + } } |