]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Conversion of more properties from Strings to ints.
authorGlen Mazza <gmazza@apache.org>
Sun, 28 Dec 2003 17:10:17 +0000 (17:10 +0000)
committerGlen Mazza <gmazza@apache.org>
Sun, 28 Dec 2003 17:10:17 +0000 (17:10 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@197072 13f79535-47bb-0310-9956-ffa450edef68

23 files changed:
src/java/org/apache/fop/area/Block.java
src/java/org/apache/fop/fo/flow/BasicLink.java
src/java/org/apache/fop/fo/flow/ExternalGraphic.java
src/java/org/apache/fop/fo/flow/InstreamForeignObject.java
src/java/org/apache/fop/fo/flow/Leader.java
src/java/org/apache/fop/fo/flow/ListBlock.java
src/java/org/apache/fop/fo/flow/ListItem.java
src/java/org/apache/fop/fo/flow/PageNumber.java
src/java/org/apache/fop/fo/flow/PageNumberCitation.java
src/java/org/apache/fop/fo/flow/RetrieveMarker.java
src/java/org/apache/fop/fo/flow/Table.java
src/java/org/apache/fop/fo/flow/TableBody.java
src/java/org/apache/fop/fo/flow/TableCell.java
src/java/org/apache/fop/fo/flow/TableColumn.java
src/java/org/apache/fop/fo/pagination/ColorProfile.java
src/java/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java
src/java/org/apache/fop/fo/pagination/PageSequence.java
src/java/org/apache/fop/fo/pagination/Region.java
src/java/org/apache/fop/fo/pagination/RegionBA.java
src/java/org/apache/fop/fo/pagination/RegionBASE.java
src/java/org/apache/fop/fo/pagination/SimplePageMaster.java
src/java/org/apache/fop/fo/pagination/Title.java
src/java/org/apache/fop/layoutmgr/BlockContainerLayoutManager.java

index 2c7273a6130b18230beed5eeb1fcd0fdac9c7d66..850e8894a964b6e9c194166eed60e5b5a2724a43 100644 (file)
@@ -93,10 +93,22 @@ public class Block extends BlockParent {
      * @param block the block area to add
      */
     public void addBlock(Block block) {
+        addBlock(block, true);
+    }
+
+    /**
+     * Add the block to this block area.
+     *
+     * @param block the block area to add
+     * @param autoHeight increase the height of the block.
+     */
+    public void addBlock(Block block, boolean autoHeight) {
         if (children == null) {
             children = new ArrayList();
         }
-        height += block.getHeight();
+        if (autoHeight) {
+            height += block.getHeight();
+        }
         children.add(block);
     }
 
index abff1d3f49e78dd7856cbb70b3a00171f9a296ec..4d237ebcd442954b9769723fcef9e94707083ffe 100644 (file)
@@ -102,10 +102,10 @@ public class BasicLink extends Inline {
         // this.propertyList.get("baseline-shift");
         // this.propertyList.get("destination-place-offset");
         // this.propertyList.get("dominant-baseline");
-        String ext =  propertyList.get("external-destination").getString();
+        String ext =  propertyList.get(PR_EXTERNAL_DESTINATION).getString();
         setupID();
         // this.propertyList.get("indicate-destination");
-        String internal = propertyList.get("internal-destination").getString();
+        String internal = propertyList.get(PR_INTERNAL_DESTINATION).getString();
         if (ext.length() > 0) {
             link = ext;
             external = true;
index dc063251617101ec6dfb4cae9be55058e22e2866..82dec643b740492d39c70b9a6b632b66affa11bc 100644 (file)
@@ -102,27 +102,27 @@ public class ExternalGraphic extends FObj {
      * This gets the sizes for the image and the dimensions and clipping.
      */
     public void setup() {
-        url = this.propertyList.get("src").getString();
+        url = this.propertyList.get(PR_SRC).getString();
         if (url == null) {
             return;
         }
         url = ImageFactory.getURL(url);
 
         // assume lr-tb for now
-        Length ipd = propertyList.get("inline-progression-dimension.optimum").getLength();
+        Length ipd = propertyList.get(PR_INLINE_PROGRESSION_DIMENSION).getLength();
         if (!ipd.isAuto()) {
             viewWidth = ipd.getValue();
         } else {
-            ipd = propertyList.get("width").getLength();
+            ipd = propertyList.get(PR_WIDTH).getLength();
             if (!ipd.isAuto()) {
                 viewWidth = ipd.getValue();
             }
         }
-        Length bpd = propertyList.get("block-progression-dimension.optimum").getLength();
+        Length bpd = propertyList.get(PR_BLOCK_PROGRESSION_DIMENSION | CP_OPTIMUM).getLength();
         if (!bpd.isAuto()) {
             viewHeight = bpd.getValue();
         } else {
-            bpd = propertyList.get("height").getLength();
+            bpd = propertyList.get(PR_HEIGHT).getLength();
             if (!bpd.isAuto()) {
                 viewHeight = bpd.getValue();
             }
@@ -133,7 +133,7 @@ public class ExternalGraphic extends FObj {
 
         int cwidth = -1;
         int cheight = -1;
-        Length ch = propertyList.get("content-height").getLength();
+        Length ch = propertyList.get(PR_CONTENT_HEIGHT).getLength();
         if (!ch.isAuto()) {
             /*if (ch.scaleToFit()) {
                 if (viewHeight != -1) {
@@ -142,7 +142,7 @@ public class ExternalGraphic extends FObj {
             } else {*/
             cheight = ch.getValue();
         }
-        Length cw = propertyList.get("content-width").getLength();
+        Length cw = propertyList.get(PR_CONTENT_WIDTH).getLength();
         if (!cw.isAuto()) {
             /*if (cw.scaleToFit()) {
                 if (viewWidth != -1) {
@@ -152,7 +152,7 @@ public class ExternalGraphic extends FObj {
             cwidth = cw.getValue();
         }
 
-        int scaling = propertyList.get("scaling").getEnum();
+        int scaling = propertyList.get(PR_SCALING).getEnum();
         if ((scaling == Scaling.UNIFORM) || (cwidth == -1) || cheight == -1) {
             ImageFactory fact = ImageFactory.getInstance();
             fopimage = fact.getImage(url, getUserAgent());
@@ -195,7 +195,7 @@ public class ExternalGraphic extends FObj {
         }
 
         if (cwidth > viewWidth || cheight > viewHeight) {
-            int overflow = propertyList.get("overflow").getEnum();
+            int overflow = propertyList.get(PR_OVERFLOW).getEnum();
             if (overflow == Overflow.HIDDEN) {
                 clip = true;
             } else if (overflow == Overflow.ERROR_IF_OVERFLOW) {
@@ -207,7 +207,7 @@ public class ExternalGraphic extends FObj {
 
         int xoffset = 0;
         int yoffset = 0;
-        int da = propertyList.get("display-align").getEnum();
+        int da = propertyList.get(PR_DISPLAY_ALIGN).getEnum();
         switch(da) {
             case DisplayAlign.BEFORE:
             break;
@@ -222,7 +222,7 @@ public class ExternalGraphic extends FObj {
             break;
         }
 
-        int ta = propertyList.get("text-align").getEnum();
+        int ta = propertyList.get(PR_TEXT_ALIGN).getEnum();
         switch(ta) {
             case TextAlign.CENTER:
                 xoffset = (viewWidth - cwidth) / 2;
index 0eaa19d167abe70a50a5d7f6907676d118ebcd1e..1987dec139aa1fa4243a7f9a3f86c13ee9cd8676 100644 (file)
@@ -74,7 +74,7 @@ public class InstreamForeignObject extends FObj {
 
     public int computeXOffset (int ipd, int cwidth) {
         int xoffset = 0;
-        int ta = propertyList.get("text-align").getEnum();
+        int ta = propertyList.get(PR_TEXT_ALIGN).getEnum();
         switch (ta) {
             case TextAlign.CENTER:
                 xoffset = (ipd - cwidth) / 2;
@@ -93,7 +93,7 @@ public class InstreamForeignObject extends FObj {
 
     public int computeYOffset(int bpd, int cheight) {
         int yoffset = 0;
-        int da = propertyList.get("display-align").getEnum();
+        int da = propertyList.get(PR_DISPLAY_ALIGN).getEnum();
         switch (da) {
             case DisplayAlign.BEFORE:
                 break;
index d1691a3e5c9c48e59c738e4cad134f1e8c22fcf3..538cea7b1423b256867469032da0dc52c8a96415 100644 (file)
@@ -130,14 +130,14 @@ public class Leader extends FObjMixed {
         // this.propertyList.get("z-index");
 
         // color properties
-        ColorType c = this.propertyList.get("color").getColorType();
+        ColorType c = this.propertyList.get(PR_COLOR).getColorType();
         float red = c.getRed();
         float green = c.getGreen();
         float blue = c.getBlue();
 
         // fo:leader specific properties
         // determines the pattern of leader; allowed values: space, rule,dots, use-content
-        leaderPattern = this.propertyList.get("leader-pattern").getEnum();
+        leaderPattern = this.propertyList.get(PR_LEADER_PATTERN).getEnum();
         switch(leaderPattern) {
             case LeaderPattern.SPACE:
                 // use Space
@@ -146,8 +146,8 @@ public class Leader extends FObjMixed {
                 // the following properties only apply
                 // for leader-pattern = "rule"
                 ruleThickness =
-                         propertyList.get("rule-thickness").getLength().getValue();
-                ruleStyle = propertyList.get("rule-style").getEnum();
+                         propertyList.get(PR_RULE_THICKNESS).getLength().getValue();
+                ruleStyle = propertyList.get(PR_RULE_STYLE).getEnum();
             break;
             case LeaderPattern.DOTS:
             break;
@@ -159,7 +159,7 @@ public class Leader extends FObjMixed {
 
         // if leaderPatternWidth = 0 = default = use-font-metric
         patternWidth =
-            this.propertyList.get("leader-pattern-width").getLength().getValue();
+            this.propertyList.get(PR_LEADER_PATTERN_WIDTH).getLength().getValue();
 
     }
 
index 4088d38e114f7f142fcece35222fdd6ca1ac1960..73794c4a59a904025f046a3fa00cf412d1d362d1 100644 (file)
@@ -118,21 +118,21 @@ public class ListBlock extends FObj {
             // this.propertyList.get("provisional-distance-between-starts");
             // this.propertyList.get("provisional-label-separation");
 
-            this.align = this.propertyList.get("text-align").getEnum();
-            this.alignLast = this.propertyList.get("text-align-last").getEnum();
+            this.align = this.propertyList.get(PR_TEXT_ALIGN).getEnum();
+            this.alignLast = this.propertyList.get(PR_TEXT_ALIGN_LAST).getEnum();
             this.lineHeight =
-                this.propertyList.get("line-height").getLength().getValue();
+                this.propertyList.get(PR_LINE_HEIGHT).getLength().getValue();
             this.startIndent =
-                this.propertyList.get("start-indent").getLength().getValue();
+                this.propertyList.get(PR_START_INDENT).getLength().getValue();
             this.endIndent =
-                this.propertyList.get("end-indent").getLength().getValue();
+                this.propertyList.get(PR_END_INDENT).getLength().getValue();
             this.spaceBefore =
-                this.propertyList.get("space-before.optimum").getLength().getValue();
+                this.propertyList.get(PR_SPACE_BEFORE | CP_OPTIMUM).getLength().getValue();
             this.spaceAfter =
-                this.propertyList.get("space-after.optimum").getLength().getValue();
+                this.propertyList.get(PR_SPACE_AFTER | CP_OPTIMUM).getLength().getValue();
             this.spaceBetweenListRows = 0;    // not used at present
             this.backgroundColor =
-                this.propertyList.get("background-color").getColorType();
+                this.propertyList.get(PR_BACKGROUND_COLOR).getColorType();
 
     }
 
index efef19ec82942a9431808c20f50d3b6ae7a1707c..4928ccb5358c1441244ce1e12405ed17ecfea7c8 100644 (file)
@@ -117,14 +117,14 @@ public class ListItem extends FObj {
         // this.propertyList.get("keep-with-previous");
         // this.propertyList.get("relative-align");
 
-        this.align = this.propertyList.get("text-align").getEnum();
-        this.alignLast = this.propertyList.get("text-align-last").getEnum();
+        this.align = this.propertyList.get(PR_TEXT_ALIGN).getEnum();
+        this.alignLast = this.propertyList.get(PR_TEXT_ALIGN_LAST).getEnum();
         this.lineHeight =
-            this.propertyList.get("line-height").getLength().getValue();
+            this.propertyList.get(PR_LINE_HEIGHT).getLength().getValue();
         this.spaceBefore =
-            this.propertyList.get("space-before.optimum").getLength().getValue();
+            this.propertyList.get(PR_SPACE_BEFORE | CP_OPTIMUM).getLength().getValue();
         this.spaceAfter =
-            this.propertyList.get("space-after.optimum").getLength().getValue();
+            this.propertyList.get(PR_SPACE_AFTER | CP_OPTIMUM).getLength().getValue();
 
     }
 
index 00efde644f792b864939fd0db89949c3163adb4a..edc9b5ead7e0e307fdae452b207c6ff171c79826 100644 (file)
@@ -125,12 +125,12 @@ public class PageNumber extends FObj {
         // this.propertyList.get("text-transform");
         // this.propertyList.get("word-spacing");
 
-        ColorType c = this.propertyList.get("color").getColorType();
+        ColorType c = this.propertyList.get(PR_COLOR).getColorType();
         this.red = c.getRed();
         this.green = c.getGreen();
         this.blue = c.getBlue();
 
-        this.wrapOption = this.propertyList.get("wrap-option").getEnum();
+        this.wrapOption = this.propertyList.get(PR_WRAP_OPTION).getEnum();
 
     }
 
index 8fb8ba0dea119350aa937289ee2a157baeba6a8c..1ef021d597c9749611ed7f03e12cd0cef135ac72 100644 (file)
@@ -140,13 +140,13 @@ public class PageNumberCitation extends FObj {
         // this.propertyList.get("text-transform");
         // this.propertyList.get("word-spacing");
 
-        ColorType c = this.propertyList.get("color").getColorType();
+        ColorType c = this.propertyList.get(PR_COLOR).getColorType();
         this.red = c.getRed();
         this.green = c.getGreen();
         this.blue = c.getBlue();
 
-        this.wrapOption = this.propertyList.get("wrap-option").getEnum();
-        this.refId = this.propertyList.get("ref-id").getString();
+        this.wrapOption = this.propertyList.get(PR_WRAP_OPTION).getEnum();
+        this.refId = this.propertyList.get(PR_REF_ID).getString();
 
         if (this.refId.equals("")) {
             //throw new FOPException("page-number-citation must contain \"ref-id\"");
index 768c0c88982886152a06f6363bfe93e9182a34d2..41d0eb92c9ca601f321551af78cbb5b834d2ccc9 100644 (file)
@@ -85,11 +85,11 @@ public class RetrieveMarker extends FObjMixed {
     public void handleAttrs(Attributes attlist) throws FOPException {
         super.handleAttrs(attlist);
         this.retrieveClassName =
-            this.propertyList.get("retrieve-class-name").getString();
+            this.propertyList.get(PR_RETRIEVE_CLASS_NAME).getString();
         this.retrievePosition =
-            this.propertyList.get("retrieve-position").getEnum();
+            this.propertyList.get(PR_RETRIEVE_POSITION).getEnum();
         this.retrieveBoundary =
-            this.propertyList.get("retrieve-boundary").getEnum();
+            this.propertyList.get(PR_RETRIEVE_BOUNDARY).getEnum();
     }
 
     public String getRetrieveClassName() {
index 1a9a9530ca14b7aa112804f040a96fe4ad27c9d6..c9da18daccbc37028d86cba265b1c772df807c00 100644 (file)
@@ -169,25 +169,25 @@ public class Table extends FObj {
         // this.propertyList.get("width");
         // this.propertyList.get("writing-mode");
 
-        this.breakBefore = this.propertyList.get("break-before").getEnum();
-        this.breakAfter = this.propertyList.get("break-after").getEnum();
+        this.breakBefore = this.propertyList.get(PR_BREAK_BEFORE).getEnum();
+        this.breakAfter = this.propertyList.get(PR_BREAK_AFTER).getEnum();
         this.spaceBefore = this.propertyList.get(
-                             "space-before.optimum").getLength().getValue();
+                             PR_SPACE_BEFORE | CP_OPTIMUM).getLength().getValue();
         this.spaceAfter = this.propertyList.get(
-                            "space-after.optimum").getLength().getValue();
+                            PR_SPACE_AFTER | CP_OPTIMUM).getLength().getValue();
         this.backgroundColor =
-          this.propertyList.get("background-color").getColorType();
+          this.propertyList.get(PR_BACKGROUND_COLOR).getColorType();
         this.ipd = this.propertyList.get(
-                     "inline-progression-dimension").getLengthRange();
-        this.height = this.propertyList.get("height").getLength().getValue();
+                     PR_INLINE_PROGRESSION_DIMENSION).getLengthRange();
+        this.height = this.propertyList.get(PR_HEIGHT).getLength().getValue();
         this.bAutoLayout = (this.propertyList.get(
-                "table-layout").getEnum() == TableLayout.AUTO);
+                PR_TABLE_LAYOUT).getEnum() == TableLayout.AUTO);
 
         this.omitHeaderAtBreak = this.propertyList.get(
-                "table-omit-header-at-break").getEnum()
+                PR_TABLE_OMIT_HEADER_AT_BREAK).getEnum()
                                             == TableOmitHeaderAtBreak.TRUE;
         this.omitFooterAtBreak = this.propertyList.get(
-                "table-omit-footer-at-break").getEnum()
+                PR_TABLE_OMIT_FOOTER_AT_BREAK).getEnum()
                                             == TableOmitFooterAtBreak.TRUE;
 
     }
index 6ced2d9e0d03508ded936c3b00e927766d73cb96..d997ec0c1eaefccea7be39b763d1839f92451e12 100644 (file)
@@ -101,11 +101,11 @@ public class TableBody extends FObj {
         setupID();
 
         this.spaceBefore = this.propertyList.get(
-                             "space-before.optimum").getLength().getValue();
+                             PR_SPACE_BEFORE | CP_OPTIMUM).getLength().getValue();
         this.spaceAfter = this.propertyList.get(
-                            "space-after.optimum").getLength().getValue();
+                            PR_SPACE_AFTER | CP_OPTIMUM).getLength().getValue();
         this.backgroundColor =
-          this.propertyList.get("background-color").getColorType();
+          this.propertyList.get(PR_BACKGROUND_COLOR).getColorType();
 
     }
 
index 4c7ffc76566add5cec29df407af83e771a3d01f5..461f755c2ad73c27c375e26f2217fc142364892e 100644 (file)
@@ -233,41 +233,41 @@ public class TableCell extends FObj {
         // this.propertyList.get("width");
 
         this.iColNumber =
-            propertyList.get("column-number").getNumber().intValue();
+            propertyList.get(PR_COLUMN_NUMBER).getNumber().intValue();
         if (iColNumber < 0) {
             iColNumber = 0;
         }
         this.numColumnsSpanned =
-            this.propertyList.get("number-columns-spanned").getNumber().intValue();
+            this.propertyList.get(PR_NUMBER_COLUMNS_SPANNED).getNumber().intValue();
         if (numColumnsSpanned < 1) {
             numColumnsSpanned = 1;
         }
         this.numRowsSpanned =
-            this.propertyList.get("number-rows-spanned").getNumber().intValue();
+            this.propertyList.get(PR_NUMBER_ROWS_SPANNED).getNumber().intValue();
         if (numRowsSpanned < 1) {
             numRowsSpanned = 1;
         }
 
         this.backgroundColor =
-            this.propertyList.get("background-color").getColorType();
+            this.propertyList.get(PR_BACKGROUND_COLOR).getColorType();
 
-        bSepBorders = (this.propertyList.get("border-collapse").getEnum()
+        bSepBorders = (this.propertyList.get(PR_BORDER_COLLAPSE).getEnum()
                        == BorderCollapse.SEPARATE);
 
         calcBorders(propMgr.getBorderAndPadding());
 
         // Vertical cell alignment
-        verticalAlign = this.propertyList.get("display-align").getEnum();
+        verticalAlign = this.propertyList.get(PR_DISPLAY_ALIGN).getEnum();
         if (verticalAlign == DisplayAlign.AUTO) {
             // Depends on all cells starting in row
             bRelativeAlign = true;
-            verticalAlign = this.propertyList.get("relative-align").getEnum();
+            verticalAlign = this.propertyList.get(PR_RELATIVE_ALIGN).getEnum();
         } else {
             bRelativeAlign = false;    // Align on a per-cell basis
         }
 
         this.minCellHeight =
-            this.propertyList.get("height").getLength().getValue();
+            this.propertyList.get(PR_HEIGHT).getLength().getValue();
     }
 
     /**
@@ -285,7 +285,7 @@ public class TableCell extends FObj {
              * but it inherits.
              */
             int iSep = propertyList.get(
-                    "border-separation.inline-progression-direction").getLength().getValue();
+                    PR_BORDER_SEPARATION | CP_INLINE_PROGRESSION_DIRECTION).getLength().getValue();
             this.startAdjust = iSep / 2 + bp.getBorderStartWidth(false)
                                + bp.getPaddingStart(false);
 
@@ -295,7 +295,7 @@ public class TableCell extends FObj {
 
             // Offset of content rectangle in the block-progression direction
             borderSeparation = propertyList.get(
-                    "border-separation.block-progression-direction").getLength().getValue();
+                    PR_BORDER_SEPARATION | CP_BLOCK_PROGRESSION_DIRECTION).getLength().getValue();
             this.beforeOffset = borderSeparation / 2
                                 + bp.getBorderBeforeWidth(false)
                                 + bp.getPaddingBefore(false);
index 4670a12b4882a718f30fea12c36358bd61fa24bc..4d6eb7a782275ce10245d56d6a1df6b900451996 100644 (file)
@@ -138,17 +138,17 @@ public class TableColumn extends FObj {
         // this.propertyList.get("number-columns-spanned");
         // this.propertyList.get("visibility");
 
-        iColumnNumber = propertyList.get("column-number").getNumber().intValue();
+        iColumnNumber = propertyList.get(PR_COLUMN_NUMBER).getNumber().intValue();
 
         numColumnsRepeated =
-            propertyList.get("number-columns-repeated").getNumber().intValue();
+            propertyList.get(PR_NUMBER_COLUMNS_REPEATED).getNumber().intValue();
 
         this.backgroundColor =
-            this.propertyList.get("background-color").getColorType();
+            this.propertyList.get(PR_BACKGROUND_COLOR).getColorType();
 
-        Property prop = this.propertyList.get("column-width");
+        Property prop = this.propertyList.get(PR_COLUMN_WIDTH);
         if (prop != null) {
-            columnWidthPropVal = propertyList.get("column-width").getLength();
+            columnWidthPropVal = propertyList.get(PR_COLUMN_WIDTH).getLength();
 
             // This won't include resolved table-units or % values yet.
             columnWidth = columnWidthPropVal.getValue();
index 6f64769336d605b1aa46db8c9b58d107511ba7b4..a34fbfac54c48855af0d5198427e0ced75d08634 100644 (file)
@@ -86,9 +86,9 @@ public class ColorProfile extends FObj {
      * object.
      */
     public void end() {
-        src = this.propertyList.get("src").getString();
-        profileName = this.propertyList.get("color-profile-name").getString();
-        intent = this.propertyList.get("rendering-intent").getEnum();
+        src = this.propertyList.get(PR_SRC).getString();
+        profileName = this.propertyList.get(PR_COLOR_PROFILE_NAME).getString();
+        intent = this.propertyList.get(PR_RENDERING_INTENT).getEnum();
         this.propertyList = null;
     }
 
index db52a0f84ac1a986c819eaadb0b7d97f621099fd..210193d7ef91eb426cb82165a49815ab4ba8bd53 100644 (file)
@@ -98,9 +98,9 @@ public class ConditionalPageMasterReference extends FObj {
 
         validateParent(parent);
 
-        this.pagePosition = this.propertyList.get("page-position").getEnum();
-        this.oddOrEven = this.propertyList.get("odd-or-even").getEnum();
-        this.blankOrNotBlank = this.propertyList.get("blank-or-not-blank").getEnum();
+        this.pagePosition = this.propertyList.get(PR_PAGE_POSITION).getEnum();
+        this.oddOrEven = this.propertyList.get(PR_ODD_OR_EVEN).getEnum();
+        this.blankOrNotBlank = this.propertyList.get(PR_BLANK_OR_NOT_BLANK).getEnum();
     }
 
     /**
@@ -136,7 +136,7 @@ public class ConditionalPageMasterReference extends FObj {
             if (pagePosition == PagePosition.REST) {
                 return false;
             } else if (pagePosition == PagePosition.LAST) {
-                // how the hell do you know at this point?
+                // ?? how can one know at this point?
                 getLogger().debug("LAST PagePosition NYI");
                 return false;
             }
@@ -144,7 +144,7 @@ public class ConditionalPageMasterReference extends FObj {
             if (pagePosition == PagePosition.FIRST) {
                 return false;
             } else if (pagePosition == PagePosition.LAST) {
-                // how the hell do you know at this point?
+                // ?? how can one know at this point?
                 getLogger().debug("LAST PagePosition NYI");
                 // potentially valid, don't return
             }
index 0192382da7f0ac1eaa7a761316523cd344d000f9..6b13cd92da5903bf21ad737414a2770c7ee38e42 100644 (file)
@@ -189,7 +189,7 @@ public class PageSequence extends FObj {
 
         // we are now on the first page of the page sequence
         thisIsFirstPage = true;
-        ipnValue = this.propertyList.get("initial-page-number").getString();
+        ipnValue = this.propertyList.get(PR_INITIAL_PAGE_NUMBER).getString();
 
         if (ipnValue.equals("auto")) {
             pageNumberType = AUTO;
@@ -209,7 +209,7 @@ public class PageSequence extends FObj {
         }
 
 
-        String masterName = this.propertyList.get("master-reference").getString();
+        String masterName = this.propertyList.get(PR_MASTER_REFERENCE).getString();
         this.simplePageMaster =
                 this.layoutMasterSet.getSimplePageMaster(masterName);
         if (this.simplePageMaster == null) {
@@ -224,14 +224,14 @@ public class PageSequence extends FObj {
 
         // get the 'format' properties
         this.pageNumberGenerator =
-            new PageNumberGenerator(this.propertyList.get("format").getString(),
-                                    this.propertyList.get("grouping-separator").getCharacter(),
-                                    this.propertyList.get("grouping-size").getNumber().intValue(),
-                                    this.propertyList.get("letter-value").getEnum());
+            new PageNumberGenerator(this.propertyList.get(PR_FORMAT).getString(),
+                                    this.propertyList.get(PR_GROUPING_SEPARATOR).getCharacter(),
+                                    this.propertyList.get(PR_GROUPING_SIZE).getNumber().intValue(),
+                                    this.propertyList.get(PR_LETTER_VALUE).getEnum());
         this.pageNumberGenerator.enableLogging(getLogger());
 
         this.forcePageCount =
-            this.propertyList.get("force-page-count").getEnum();
+            this.propertyList.get(PR_FORCE_PAGE_COUNT).getEnum();
 
         // this.propertyList.get("country");
         // this.propertyList.get("language");
index d477b220e5c31fb8bfca2861075054427b20237e..6b97bb5b11fb7ae25e72bbc1fc7256e03076dd88 100644 (file)
@@ -133,11 +133,11 @@ public abstract class Region extends FObj {
                     + "of simple-page-master, not "
                     + parent.getName());
         }
-        this.wm = this.propertyList.get("writing-mode").getEnum();
+        this.wm = this.propertyList.get(PR_WRITING_MODE).getEnum();
 
         // this.propertyList.get("clip");
         // this.propertyList.get("display-align");
-        this.overflow = this.propertyList.get("overflow").getEnum();
+        this.overflow = this.propertyList.get(PR_OVERFLOW).getEnum();
     }
 
     public abstract Rectangle getViewportRectangle(FODimension pageRefRect);
index fd795cd9f782ea74f0979e26c45530629976e965..e9d985770951f4f54e036566e4f0e989bf9f5355 100644 (file)
@@ -86,7 +86,7 @@ public abstract class RegionBA extends RegionBASE {
     public void end() {
         super.end();
         bPrecedence =
-            (this.propertyList.get("precedence").getEnum() == Precedence.TRUE);
+            (this.propertyList.get(PR_PRECEDENCE).getEnum() == Precedence.TRUE);
     }
 
     /**
index 425df2b39d70a8d0fc487a4ace3bf1b7edc5de3a..6b1752dede23496e0fdb4b961eabb39c3cba0f5b 100644 (file)
@@ -74,7 +74,7 @@ public abstract class RegionBASE extends Region {
     public void end() {
         // The problem with this is that it might not be known yet....
         // Supposing extent is calculated in terms of percentage
-        this.extent = this.propertyList.get("extent").getLength().getValue();
+        this.extent = this.propertyList.get(PR_EXTENT).getLength().getValue();
     }
 
     /**
index ae16402a4fe5158a5b791074fde8e3abe4703331..02fb87a94da1fa3635bc9e54a45d29992c085ab7 100644 (file)
@@ -92,7 +92,7 @@ public class SimplePageMaster extends FObj {
 
         if (parent.getName().equals("fo:layout-master-set")) {
             LayoutMasterSet layoutMasterSet = (LayoutMasterSet)parent;
-            masterName = this.propertyList.get("master-name").getString();
+            masterName = this.propertyList.get(PR_MASTER_NAME).getString();
             if (masterName == null) {
                 getLogger().warn("simple-page-master does not have "
                         + "a master-name and so is being ignored");
index 2b7bab983212de5c7af9d00387bdf566a0d1fcb8..3fbe8c67b7ae70f9a808353840eaa66a4cc81b2d 100644 (file)
@@ -97,18 +97,18 @@ public class Title extends FObjMixed {
         CommonMarginInline mProps = propMgr.getMarginInlineProps();
 
         Property prop;
-        prop = this.propertyList.get("baseline-shift");
+        prop = this.propertyList.get(PR_BASELINE_SHIFT);
         if (prop instanceof LengthProperty) {
             Length bShift = prop.getLength();
         } else if (prop instanceof EnumProperty) {
             int bShift = prop.getEnum();
         }
-        ColorType col = this.propertyList.get("color").getColorType();
-        Length lHeight = this.propertyList.get("line-height").getLength();
+        ColorType col = this.propertyList.get(PR_COLOR).getColorType();
+        Length lHeight = this.propertyList.get(PR_LINE_HEIGHT).getLength();
         int lShiftAdj = this.propertyList.get(
-                          "line-height-shift-adjustment").getEnum();
-        int vis = this.propertyList.get("visibility").getEnum();
-        Length zIndex = this.propertyList.get("z-index").getLength();
+                          PR_LINE_HEIGHT_SHIFT_ADJUSTMENT).getEnum();
+        int vis = this.propertyList.get(PR_VISIBILITY).getEnum();
+        Length zIndex = this.propertyList.get(PR_Z_INDEX).getLength();
 
     }
 
index 4fb688fee4597a9bfb7e6392646106837609d158..189d28c67086f015b6c1967cbdb3e3d6babf956b 100644 (file)
@@ -63,6 +63,7 @@ import org.apache.fop.fo.properties.Overflow;
 import org.apache.fop.fo.PropertyList;
 import org.apache.fop.area.CTM;
 import org.apache.fop.datatypes.FODimension;
+import org.apache.fop.datatypes.Length;
 import org.apache.fop.traits.MinOptMax;
 
 /**
@@ -81,6 +82,8 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager {
     private boolean clip = false;
     private int overflow;
     private PropertyManager propManager;
+    private Length width;
+    private Length height;
 
     /**
      * Create a new block container layout manager.
@@ -104,6 +107,8 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager {
             absoluteCTM = CTM.getCTMandRelDims(pm.getAbsRefOrient(),
                 pm.getWritingMode(), rect, relDims);
         }
+        height = pm.getPropertyList().get("height").getLength();
+        width = pm.getPropertyList().get("width").getLength();
     }
 
     protected int getRotatedIPD() {
@@ -120,15 +125,21 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager {
             return getAbsoluteBreakPoss(context);
         }
 
-        Rectangle2D rect = new Rectangle2D.Double(0, 0, context.getRefIPD(),
-                                                  context.getStackLimit().opt);
+        int ipd = context.getRefIPD();
+        int bpd = context.getStackLimit().opt;
+        if (!width.isAuto()) {
+            ipd = width.getValue();
+        }
+        if (!height.isAuto()) {
+            bpd = height.getValue();
+        }
+        Rectangle2D rect = new Rectangle2D.Double(0, 0, ipd, bpd);
         relDims = new FODimension(0, 0);
         absoluteCTM = CTM.getCTMandRelDims(propManager.getAbsRefOrient(),
                 propManager.getWritingMode(), rect, relDims);
         double[] vals = absoluteCTM.toArray();
 
         MinOptMax stackLimit;
-        int ipd = context.getRefIPD();
         boolean rotated = vals[0] == 0.0;
         if (rotated) {
             // rotated 90 degrees
@@ -160,6 +171,7 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager {
                                      stackSize));
                 childLC.setRefIPD(ipd);
 
+            boolean over = false;
             while (!curLM.isFinished()) {
                 if ((bp = curLM.getNextBreakPoss(childLC)) != null) {
                     stackSize.add(bp.getStackingSize());
@@ -170,11 +182,17 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager {
                         } else {
                             curLM.resetPosition(null);
                         }
+                        over = true;
                         break;
                     }
                     lastPos = bp;
                     childBreaks.add(bp);
 
+                    if (bp.nextBreakOverflows()) {
+                        over = true;
+                        break;
+                    }                    
+                    
                     childLC.setStackLimit(MinOptMax.subtract(
                                            stackLimit, stackSize));
                 }
@@ -184,6 +202,9 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager {
                 breakPoss = new BreakPoss(new LeafPosition(this,
                                                    childBreaks.size() - 1));
                 breakPoss.setStackingSize(stackSize);
+                if (over) {
+                    breakPoss.setFlag(BreakPoss.NEXT_OVERFLOWS, true);
+                }
                 return breakPoss;
             }
         }
@@ -281,6 +302,11 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager {
     public Area getParentArea(Area childArea) {
         if (curBlockArea == null) {
             viewportBlockArea = new BlockViewport();
+            TraitSetter.addBorders(viewportBlockArea,
+                                   propManager.getBorderAndPadding());
+            TraitSetter.addBackground(viewportBlockArea,
+                                      propManager.getBackgroundProps());
+            
             if (abProps.absolutePosition == AbsolutePosition.ABSOLUTE) {
                 viewportBlockArea.setXOffset(abProps.left);
                 viewportBlockArea.setYOffset(abProps.top);
@@ -304,11 +330,15 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager {
                     viewportBlockArea.setWidth(relDims.bpd);
                     viewportBlockArea.setCTM(absoluteCTM);
                     viewportBlockArea.setClip(clip);
+                } else {
+                    viewportBlockArea.setWidth(relDims.ipd);
+                    if (!height.isAuto()) {
+                        viewportBlockArea.setHeight(relDims.bpd);
+                    }
                 }
             }
 
             curBlockArea = new Block();
-            viewportBlockArea.addBlock(curBlockArea);
 
             if (abProps.absolutePosition == AbsolutePosition.ABSOLUTE) {
                 viewportBlockArea.setPositioning(Block.ABSOLUTE);
@@ -332,7 +362,7 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager {
      */
     public void addChild(Area childArea) {
         if (curBlockArea != null) {
-            curBlockArea.addBlock((Block) childArea);
+            curBlockArea.addBlock((Block) childArea, height.isAuto());
         }
     }
 
@@ -342,5 +372,13 @@ public class BlockContainerLayoutManager extends BlockStackingLayoutManager {
         }
     }
 
+    /*
+     * Force current area to be added to parent area.
+     */
+    protected void flush() {
+        super.flush();
+        viewportBlockArea.addBlock(curBlockArea);
+    }
+    
 }