]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
Use PropertyManager for FontState and BorderAndPadding property sets
authorKaren Lease <klease@apache.org>
Sun, 4 Mar 2001 21:34:52 +0000 (21:34 +0000)
committerKaren Lease <klease@apache.org>
Sun, 4 Mar 2001 21:34:52 +0000 (21:34 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194126 13f79535-47bb-0310-9956-ffa450edef68

17 files changed:
src/org/apache/fop/fo/flow/Block.java
src/org/apache/fop/fo/flow/BlockContainer.java
src/org/apache/fop/fo/flow/Character.java
src/org/apache/fop/fo/flow/ExternalGraphic.java
src/org/apache/fop/fo/flow/FootnoteBody.java
src/org/apache/fop/fo/flow/InlineGraphic.java
src/org/apache/fop/fo/flow/InstreamForeignObject.java
src/org/apache/fop/fo/flow/Leader.java
src/org/apache/fop/fo/flow/ListBlock.java
src/org/apache/fop/fo/flow/ListItem.java
src/org/apache/fop/fo/flow/PageNumber.java
src/org/apache/fop/fo/flow/PageNumberCitation.java
src/org/apache/fop/fo/flow/Table.java
src/org/apache/fop/fo/flow/TableBody.java
src/org/apache/fop/fo/flow/TableCell.java
src/org/apache/fop/fo/flow/TableColumn.java
src/org/apache/fop/fo/flow/TableRow.java

index e88e1f844f14ceb327fb5003b4a63d69e3c62539..62ff92594f8d7c46054b60f2b6d2e6ae56733279 100644 (file)
@@ -1,7 +1,7 @@
 /*-- $Id$ --
 
  ============================================================================
                                                                       The Apache Software License, Version 1.1
+ The Apache Software License, Version 1.1
  ============================================================================
 
                Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
@@ -72,10 +72,8 @@ public class Block extends FObjMixed {
                                return new Block.Maker();
                }
 
-               FontState fs;
                int align;
                int alignLast;
-               int breakBefore;
                int breakAfter;
                int lineHeight;
                int startIndent;
@@ -85,35 +83,11 @@ public class Block extends FObjMixed {
                int textIndent;
                int keepWithNext;
                ColorType backgroundColor;
-               int paddingTop;
-               int paddingBottom;
-               int paddingLeft;
-               int paddingRight;
                int blockWidows;
                int blockOrphans;
 
                String id;
-
-               ColorType borderTopColor;
-               int borderTopWidth;
-               int borderTopStyle;
-               ColorType borderBottomColor;
-               int borderBottomWidth;
-               int borderBottomStyle;
-               ColorType borderLeftColor;
-               int borderLeftWidth;
-               int borderLeftStyle;
-               ColorType borderRightColor;
-               int borderRightWidth;
-               int borderRightStyle;
-
-               int hyphenate;
-               char hyphenationChar;
-               int hyphenationPushCharacterCount;
-               int hyphenationRemainCharacterCount;
-               String language;
-               String country;
-       int span;
+               int span;
 
                BlockArea blockArea;
 
@@ -135,28 +109,10 @@ public class Block extends FObjMixed {
                                }
 
                                if (this.marker == START) {
-                                               String fontFamily =
-                                                       this.properties.get("font-family").getString();
-                                               String fontStyle =
-                                                       this.properties.get("font-style").getString();
-                                               String fontWeight =
-                                                       this.properties.get("font-weight").getString();
-                                               int fontSize =
-                                                       this.properties.get("font-size").getLength().mvalue();
-
-                                               // font-variant support
-                                               // added by Eric SCHAEFFER
-                                               int fontVariant =
-                                                       this.properties.get("font-variant").getEnum();
-
-                                               this.fs = new FontState(area.getFontInfo(), fontFamily,
-                                                                                                                                               fontStyle, fontWeight, fontSize, fontVariant);
 
                                                this.align = this.properties.get("text-align").getEnum();
                                                this.alignLast =
                                                        this.properties.get("text-align-last").getEnum();
-                                               this.breakBefore =
-                                                       this.properties.get("break-before").getEnum();
                                                this.breakAfter = this.properties.get("break-after").getEnum();
                                                this.lineHeight = this.properties.get(
                                                                                                                                "line-height").getLength().mvalue();
@@ -172,112 +128,29 @@ public class Block extends FObjMixed {
                                                                                                                                "text-indent").getLength().mvalue();
                                                this.keepWithNext =
                                                        this.properties.get("keep-with-next").getEnum();
-                                               this.backgroundColor = this.properties.get(
-                                                                                                                                                "background-color").getColorType();
-                                               this.paddingTop =
-                                                       this.properties.get("padding").getLength().mvalue();
-
-                                               this.paddingLeft = this.paddingTop;
-                                               this.paddingRight = this.paddingTop;
-                                               this.paddingBottom = this.paddingTop;
-                                               if (this.paddingTop == 0) {
-                                                               this.paddingTop = this.properties.get(
-                                                                                                                                               "padding-top").getLength().mvalue();
-                                                               this.paddingLeft = this.properties.get(
-                                                                                                                                                "padding-left").getLength().mvalue();
-                                                               this.paddingBottom = this.properties.get(
-                                                                                                                                                        "padding-bottom").getLength().mvalue();
-                                                               this.paddingRight = this.properties.get(
-                                                                                                                                                       "padding-right").getLength().mvalue();
-                                               }
-                                               this.borderTopColor =
-                                                       this.properties.get("border-color").getColorType();
-                                               this.borderBottomColor = this.borderTopColor;
-                                               this.borderLeftColor = this.borderTopColor;
-                                               this.borderRightColor = this.borderTopColor;
-                                               if (this.borderTopColor == null) {
-                                                               this.borderTopColor = this.properties.get(
-                                                                                                                                                               "border-top-color").getColorType();
-                                                               this.borderBottomColor = this.properties.get(
-                                                                                                                                                                        "border-bottom-color").getColorType();
-                                                               this.borderLeftColor = this.properties.get(
-                                                                                                                                                                "border-left-color").getColorType();
-                                                               this.borderRightColor = this.properties.get(
-                                                                                                                                                                       "border-right-color").getColorType();
-                                               }
-                                               this.borderTopWidth = this.properties.get(
-                                                                                                                                               "border-width").getLength().mvalue();
-                                               this.borderBottomWidth = this.borderTopWidth;
-                                               this.borderLeftWidth = this.borderTopWidth;
-                                               this.borderRightWidth = this.borderTopWidth;
-                                               if (this.borderTopWidth == 0) {
-                                                               this.borderTopWidth = this.properties.get(
-                                                                                                                                                               "border-top-width").getLength().mvalue();
-                                                               this.borderBottomWidth = this.properties.get(
-                                                                                                                                                                        "border-bottom-width").getLength().mvalue();
-                                                               this.borderLeftWidth = this.properties.get(
-                                                                                                                                                                "border-left-width").getLength().mvalue();
-                                                               this.borderRightWidth = this.properties.get(
-                                                                                                                                                                       "border-right-width").getLength().mvalue();
-                                               }
-                                               this.borderTopStyle =
-                                                       this.properties.get("border-style").getEnum();
-                                               this.borderBottomStyle = this.borderTopStyle;
-                                               this.borderLeftStyle = this.borderTopStyle;
-                                               this.borderRightStyle = this.borderTopStyle;
-                                               if (this.borderTopStyle == 0) {
-                                                               this.borderTopStyle =
-                                                                       this.properties.get("border-top-style").getEnum();
-                                                               this.borderBottomStyle = this.properties.get(
-                                                                                                                                                                        "border-bottom-style").getEnum();
-                                                               this.borderLeftStyle = this.properties.get(
-                                                                                                                                                                "border-left-style").getEnum();
-                                                               this.borderRightStyle = this.properties.get(
-                                                                                                                                                                       "border-right-style").getEnum();
-                                               }
+                                               this.backgroundColor = this.properties.get("background-color").getColorType();
+
                                                this.blockWidows =
                                                        this.properties.get("widows").getNumber().intValue();
                                                this.blockOrphans =
                                                        this.properties.get("orphans").getNumber().intValue();
 
-                                               this.hyphenate = this.properties.get("hyphenate").getEnum();
-                                               this.hyphenationChar = this.properties.get("hyphenation-character").getCharacter();
-                                               this.hyphenationPushCharacterCount = this.properties.get(
-                                                                                                                                                                                                        "hyphenation-push-character-count").getNumber().
-                                                                                                                                                                                                intValue();
-                                               this.hyphenationRemainCharacterCount = this.properties.get(
-                                                                                                                                                                                                                "hyphenation-remain-character-count").getNumber().
-                                                                                                                                                                                                        intValue();
-                                               this.language = this.properties.get("language").getString();
-                                               this.country = this.properties.get("country").getString();
+
 
                                                this.id = this.properties.get("id").getString();
 
                                                if (area instanceof BlockArea) {
-                                                               area.end();
+                                                   area.end();
                                                }
 
                                                if(area.getIDReferences() != null)
                                                                area.getIDReferences().createID(id);
 
                                                this.marker = 0;
-
-                                               if (breakBefore == BreakBefore.PAGE) {
-                                                               return new Status(Status.FORCE_PAGE_BREAK);
-                                               }
-
-                                               if (breakBefore == BreakBefore.ODD_PAGE) {
-                                                               return new Status(Status.FORCE_PAGE_BREAK_ODD);
-                                               }
-
-                                               if (breakBefore == BreakBefore.EVEN_PAGE) {
-                                                               return new Status(Status.FORCE_PAGE_BREAK_EVEN);
-                                               }
-
-                                               if (breakBefore == BreakBefore.COLUMN) {
-                                                               return new Status(Status.FORCE_COLUMN_BREAK);
-                                               }
-
+                                               int breakStatus;
+  if ((breakStatus = propMgr.checkBreakBefore()) != Status.OK) {
+    return new Status(breakStatus);
+  }
                                                int numChildren = this.children.size();
                                                for (int i = 0; i < numChildren; i++) {
                                                                FONode fo = (FONode) children.elementAt(i);
@@ -323,23 +196,14 @@ public class Block extends FObjMixed {
                                }
 
                                int spaceLeft = area.spaceLeft();
-                               this.blockArea = new BlockArea(fs, area.getAllocationWidth(),
-                                                                                                                                                        area.spaceLeft(), startIndent, endIndent, textIndent,
-                                                                                                                                                        align, alignLast, lineHeight);
+                               this.blockArea = new BlockArea(propMgr.getFontState(area.getFontInfo()), area.getAllocationWidth(),
+                                                               area.spaceLeft(), startIndent, endIndent, textIndent,
+                                                               align, alignLast, lineHeight);
                                this.blockArea.setParent(area); // BasicLink needs it
                                blockArea.setPage(area.getPage());
                                blockArea.setBackgroundColor(backgroundColor);
-                               blockArea.setPadding(paddingTop, paddingLeft, paddingBottom,
-                                                                                                                paddingRight);
-                               blockArea.setBorderStyle(borderTopStyle, borderLeftStyle,
-                                                                                                                                borderBottomStyle, borderRightStyle);
-                               blockArea.setBorderWidth(borderTopWidth, borderLeftWidth,
-                                                                                                                                borderBottomWidth, borderRightWidth);
-                               blockArea.setBorderColor(borderTopColor, borderLeftColor,
-                                                                                                                                borderBottomColor, borderRightColor);
-                               blockArea.setHyphenation(language, country, hyphenate,
-                                                                                                                                hyphenationChar, hyphenationPushCharacterCount,
-                                                                                                                                hyphenationRemainCharacterCount);
+                               blockArea.setBorderAndPadding(propMgr.getBorderAndPadding());
+                               blockArea.setHyphenation(propMgr.getHyphenationProps());
                                blockArea.start();
 
                                blockArea.setAbsoluteHeight(area.getAbsoluteHeight());
index 2397f4c9768a0b75a239ae8205b674d2a796290f..c8b8ae234d885e26d16ea5a93f82243bbf984abb 100644 (file)
@@ -1,52 +1,8 @@
-/*-- $Id$ --
-
- ============================================================================
-                                                                        The Apache Software License, Version 1.1
- ============================================================================
-
-               Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modifica-
- tion, are permitted provided that the following conditions are met:
-
- 1. Redistributions of  source code must  retain the above copyright  notice,
-               this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright notice,
-               this list of conditions and the following disclaimer in the documentation
-               and/or other materials provided with the distribution.
-
- 3. The end-user documentation included with the redistribution, if any, must
-               include  the following  acknowledgment:  "This product includes  software
-               developed  by the  Apache Software Foundation  (http://www.apache.org/)."
-               Alternately, this  acknowledgment may  appear in the software itself,  if
-               and wherever such third-party acknowledgments normally appear.
-
- 4. The names "FOP" and  "Apache Software Foundation"  must not be used to
-               endorse  or promote  products derived  from this  software without  prior
-               written permission. For written permission, please contact
-               apache@apache.org.
-
- 5. Products  derived from this software may not  be called "Apache", nor may
-               "Apache" appear  in their name,  without prior written permission  of the
-               Apache Software Foundation.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
- APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
- DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
- ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
- (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- This software  consists of voluntary contributions made  by many individuals
- on  behalf of the Apache Software  Foundation and was  originally created by
- James Tauber <jtauber@jtauber.com>. For more  information on the Apache
- Software Foundation, please see <http://www.apache.org/>.
-
+//-- $Id$ --
+/* 
+ * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * For details on use and redistribution please refer to the 
+ * LICENSE file included with these sources."
  */
 
 package org.apache.fop.fo.flow;
@@ -65,12 +21,7 @@ import java.util.Enumeration;
 
 public class BlockContainer extends FObj {
 
-               FontState fs;
                ColorType backgroundColor;
-               int paddingTop;
-               int paddingBottom;
-               int paddingLeft;
-               int paddingRight;
                int position;
 
                int top;
@@ -80,19 +31,6 @@ public class BlockContainer extends FObj {
                int width;
                int height;
 
-               ColorType borderTopColor;
-               int borderTopWidth;
-               int borderTopStyle;
-               ColorType borderBottomColor;
-               int borderBottomWidth;
-               int borderBottomStyle;
-               ColorType borderLeftColor;
-               int borderLeftWidth;
-               int borderLeftStyle;
-               ColorType borderRightColor;
-               int borderRightWidth;
-               int borderRightStyle;
-
        int span;
 
                AreaContainer areaContainer;
@@ -117,137 +55,55 @@ public class BlockContainer extends FObj {
                                this.span = this.properties.get("span").getEnum();
                }
 
-               public Status layout(Area area) throws FOPException {
-       if (this.marker == START) {
-                       this.marker = 0;
-
-                       String fontFamily =
-               this.properties.get("font-family").getString();
-                       String fontStyle =
-               this.properties.get("font-style").getString();
-                       String fontWeight =
-               this.properties.get("font-weight").getString();
-                       int fontSize =
-               this.properties.get("font-size").getLength().mvalue();
-               // font-variant support
-               // added by Eric SCHAEFFER
-               int fontVariant =
-                       this.properties.get("font-variant").getEnum();
-
-               this.fs = new FontState(area.getFontInfo(), fontFamily,
-                                                                                                               fontStyle, fontWeight, fontSize, fontVariant);
-
-                       this.backgroundColor =
-               this.properties.get("background-color").getColorType();
-                       this.paddingTop =
-               this.properties.get("padding").getLength().mvalue();
-                                               this.paddingLeft = this.paddingTop;
-                                               this.paddingRight = this.paddingTop;
-                                               this.paddingBottom = this.paddingTop;
-                                               if (this.paddingTop == 0) {
-                               this.paddingTop =
-                       this.properties.get("padding-top").getLength().mvalue();
-                               this.paddingLeft =
-                       this.properties.get("padding-left").getLength().mvalue();
-                               this.paddingBottom =
-                       this.properties.get("padding-bottom").getLength().mvalue();
-                               this.paddingRight =
-                       this.properties.get("padding-right").getLength().mvalue();
-                                               }
-
-                       this.position =
-               this.properties.get("position").getEnum();
-                       this.top =
-               this.properties.get("top").getLength().mvalue();
-                       this.bottom =
-               this.properties.get("bottom").getLength().mvalue();
-                       this.left =
-               this.properties.get("left").getLength().mvalue();
-                       this.right =
-               this.properties.get("right").getLength().mvalue();
-                       this.width =
-               this.properties.get("width").getLength().mvalue();
-                       this.height =
-               this.properties.get("height").getLength().mvalue();
-
-                       this.borderTopColor =
-               this.properties.get("border-color").getColorType();
-                       this.borderBottomColor = this.borderTopColor;
-                       this.borderLeftColor = this.borderTopColor;
-                       this.borderRightColor = this.borderTopColor;
-                       if (this.borderTopColor == null) {
-               this.borderTopColor =
-                               this.properties.get("border-top-color").getColorType();
-               this.borderBottomColor =
-                               this.properties.get("border-bottom-color").getColorType();
-               this.borderLeftColor =
-                               this.properties.get("border-left-color").getColorType();
-               this.borderRightColor =
-                               this.properties.get("border-right-color").getColorType();
-                       }
-                       this.borderTopWidth =
-               this.properties.get("border-width").getLength().mvalue();
-                       this.borderBottomWidth = this.borderTopWidth;
-                       this.borderLeftWidth = this.borderTopWidth;
-                       this.borderRightWidth = this.borderTopWidth;
-                       if (this.borderTopWidth == 0) {
-               this.borderTopWidth =
-                               this.properties.get("border-top-width").getLength().mvalue();
-               this.borderBottomWidth =
-                               this.properties.get("border-bottom-width").getLength().mvalue();
-               this.borderLeftWidth =
-                               this.properties.get("border-left-width").getLength().mvalue();
-               this.borderRightWidth =
-                               this.properties.get("border-right-width").getLength().mvalue();
-                       }
-                       this.borderTopStyle =
-               this.properties.get("border-style").getEnum();
-                       this.borderBottomStyle = this.borderTopStyle;
-                       this.borderLeftStyle = this.borderTopStyle;
-                       this.borderRightStyle = this.borderTopStyle;
-                       if (this.borderTopStyle == 0) {
-               this.borderTopStyle =
-                               this.properties.get("border-top-style").getEnum();
-               this.borderBottomStyle =
-                               this.properties.get("border-bottom-style").getEnum();
-               this.borderLeftStyle =
-                               this.properties.get("border-left-style").getEnum();
-               this.borderRightStyle =
-                               this.properties.get("border-right-style").getEnum();
-                       }
-
-                                               span = this.properties.get("span").getEnum();
-
-                                               // initialize id
-                                               String id = this.properties.get("id").getString();
-                                               area.getIDReferences().initializeID(id,area);
+  public Status layout(Area area) throws FOPException {
+    if (this.marker == START) {
+      this.marker = 0;
+
+      this.backgroundColor =
+       this.properties.get("background-color").getColorType();
+
+      this.position =
+       this.properties.get("position").getEnum();
+      this.top =
+       this.properties.get("top").getLength().mvalue();
+      this.bottom =
+       this.properties.get("bottom").getLength().mvalue();
+      this.left =
+       this.properties.get("left").getLength().mvalue();
+      this.right =
+       this.properties.get("right").getLength().mvalue();
+      this.width =
+       this.properties.get("width").getLength().mvalue();
+      this.height =
+       this.properties.get("height").getLength().mvalue();
+      span = this.properties.get("span").getEnum();
+
+      // initialize id
+      String id = this.properties.get("id").getString();
+      area.getIDReferences().initializeID(id,area);
+    }
+
+    boolean prevChildMustKeepWithNext = false;
+
+       AreaContainer container = (AreaContainer)area;
+       if ((this.width == 0) && (this.height == 0)) {
+         width = right - left;
+         height = bottom - top;
        }
 
-       boolean prevChildMustKeepWithNext = false;
-
-                               AreaContainer container = (AreaContainer)area;
-                               if ((this.width == 0) && (this.height == 0)) {
-                                       width = right - left;
-                                       height = bottom - top;
-                               }
        this.areaContainer =
-                                       new AreaContainer(fs, container.getXPosition() + left, container.getYPosition() - top, width, height,
-                                                                                                               position);
+         new AreaContainer(propMgr.getFontState(container.getFontInfo()),
+                           container.getXPosition() + left,
+                           container.getYPosition() - top, width, height,
+                           position);
 
        areaContainer.setPage(area.getPage());
        areaContainer.setBackgroundColor(backgroundColor);
-       areaContainer.setPadding(paddingTop, paddingLeft, paddingBottom,
-                                        paddingRight);
-                               areaContainer.setBorderStyle(borderTopStyle, borderLeftStyle,
-                                                borderBottomStyle, borderRightStyle);
-                               areaContainer.setBorderWidth(borderTopWidth, borderLeftWidth,
-                                                borderBottomWidth, borderRightWidth);
-                               areaContainer.setBorderColor(borderTopColor, borderLeftColor,
-                                                borderBottomColor, borderRightColor);
+       areaContainer.setBorderAndPadding(propMgr.getBorderAndPadding());
        areaContainer.start();
-
-                               areaContainer.setAbsoluteHeight(area.getAbsoluteHeight());
-                               areaContainer.setIDReferences(area.getIDReferences());
+       
+       areaContainer.setAbsoluteHeight(area.getAbsoluteHeight());
+       areaContainer.setIDReferences(area.getIDReferences());
 
        int numChildren = this.children.size();
        for (int i = this.marker; i < numChildren; i++) {
index 0216476d43bf60690e0420e1d6841a80e423cd86..d8b4a6377c69b25028e471ce18640cce77b830a2 100644 (file)
@@ -105,20 +105,6 @@ public class Character  extends FObj {
                                blockArea = (BlockArea) area;
                                boolean textDecoration;
 
-                               //retrieving font property information for fo:leader
-                               String fontFamily = this.properties.get("font-family").getString();
-                               String fontStyle = this.properties.get("font-style").getString();
-                               String fontWeight = this.properties.get("font-weight").getString();
-                               int fontSize =
-                                       this.properties.get("font-size").getLength().mvalue();
-                               // font-variant support
-                               // added by Eric SCHAEFFER
-                               int fontVariant =
-                                       this.properties.get("font-variant").getEnum();
-
-                               FontState fontstate = new FontState(area.getFontInfo(), fontFamily,
-                                                                                                                               fontStyle, fontWeight, fontSize, fontVariant);
-
                                //color properties
                                ColorType c = this.properties.get("color").getColorType();
                                float red = c.red();
@@ -148,7 +134,7 @@ public class Character  extends FObj {
         if(la == null) {
             return new Status(Status.AREA_FULL_NONE);
         }
-        la.changeFont(fontstate);
+        la.changeFont(propMgr.getFontState(area.getFontInfo()));
         la.changeColor(red, green, blue);
         la.changeWrapOption(wrapOption);
         la.changeWhiteSpaceCollapse(whiteSpaceCollapse);
@@ -159,7 +145,7 @@ public class Character  extends FObj {
             if(la == null) {
                 return new Status(Status.AREA_FULL_NONE);
             }
-            la.changeFont(fontstate);
+            la.changeFont(propMgr.getFontState(area.getFontInfo()));
             la.changeColor(red, green, blue);
             la.changeWrapOption(wrapOption);
             la.changeWhiteSpaceCollapse(whiteSpaceCollapse);
index c67f4f189e190267011dc01064e0e9aac7bbf701..46c6be514e7f6a2d6f1624c1eb545e7ad6aea33d 100644 (file)
@@ -58,7 +58,6 @@ import java.net.MalformedURLException;
 
 public class ExternalGraphic extends FObj {
 
-       FontState fs;
        int align;
        int startIndent;
        int endIndent;
@@ -81,22 +80,6 @@ public class ExternalGraphic extends FObj {
        public Status layout(Area area) throws FOPException {
 
                if (this.marker == START) {
-                       String fontFamily =
-                                       this.properties.get("font-family").getString();
-                       String fontStyle =
-                                       this.properties.get("font-style").getString();
-                       String fontWeight =
-                                       this.properties.get("font-weight").getString();
-                       int fontSize =
-                                       this.properties.get("font-size").getLength().mvalue();
-                       // font-variant support
-                       // added by Eric SCHAEFFER
-                       int fontVariant =
-                               this.properties.get("font-variant").getEnum();
-
-                       this.fs = new FontState(area.getFontInfo(), fontFamily,
-                                                                                                                       fontStyle, fontWeight, fontSize, fontVariant);
-
                        // FIXME
                        this.align = this.properties.get("text-align").getEnum();
 
@@ -174,7 +157,8 @@ public class ExternalGraphic extends FObj {
                        }
 
                        this.imageArea =
-                                       new ImageArea(fs, img, area.getAllocationWidth(),
+                         new ImageArea(propMgr.getFontState(area.getFontInfo()),
+                                       img, area.getAllocationWidth(),
                                        width, height, startIndent, endIndent, align);
 
                        if ((spaceBefore != 0) && (this.marker == 0)) {
index 3ec00bbe0296aa62269aa2cb68c836959995fdce..4b5e95c6ca75cbdd8c88196c08383792ccc6a731 100644 (file)
@@ -62,7 +62,7 @@ import org.apache.fop.layout.*;
 import java.util.Enumeration;
 
 public class FootnoteBody extends FObj {
-               FontState fs;
+
                int align;
                int alignLast;
                int lineHeight;
@@ -87,49 +87,35 @@ public class FootnoteBody extends FObj {
                this.name = "fo:footnote-body";
        }
 
-               public Status layout(Area area) throws FOPException {
-                               if(this.marker == START) {
-                                               this.marker = 0;
-                               }
-                                               String fontFamily =
-                                                       this.properties.get("font-family").getString();
-                                               String fontStyle =
-                                                       this.properties.get("font-style").getString();
-                                               String fontWeight =
-                                                       this.properties.get("font-weight").getString();
-                                               int fontSize =
-                                                       this.properties.get("font-size").getLength().mvalue();
-                                               // font-variant support
-                                               // added by Eric SCHAEFFER
-                                               int fontVariant =
-                                                       this.properties.get("font-variant").getEnum();
-
-                                               FontState fs = new FontState(area.getFontInfo(), fontFamily,
-                                                                                                                                               fontStyle, fontWeight, fontSize, fontVariant);
-
-                               BlockArea blockArea = new BlockArea(fs, area.getAllocationWidth(),
-                                                                                                                                                        area.spaceLeft(), startIndent, endIndent, textIndent,
-                                                                                                                                                        align, alignLast, lineHeight);
-                               blockArea.setPage(area.getPage());
-                               blockArea.start();
-
-                               blockArea.setAbsoluteHeight(area.getAbsoluteHeight());
-                               blockArea.setIDReferences(area.getIDReferences());
-
-                               blockArea.setTableCellXOffset(area.getTableCellXOffset());
-
-                               int numChildren = this.children.size();
-                               for ( int i = this.marker; i < numChildren; i++ ) {
-                                               FONode fo = (FONode) children.elementAt(i);
-                                               Status status;
-                                               if ( (status = fo.layout(blockArea)).isIncomplete() ) {
-                                                               this.resetMarker();
-                                                               return status;
-                                               }
-                               }
-                               blockArea.end();
-                               area.addChild(blockArea);
-                               area.increaseHeight(blockArea.getHeight());
-                               return new Status(Status.OK);
-               }
+    public Status layout(Area area) throws FOPException {
+      if(this.marker == START) {
+       this.marker = 0;
+      }
+      BlockArea blockArea =
+       new BlockArea(propMgr.getFontState(area.getFontInfo()),
+                     area.getAllocationWidth(),
+                     area.spaceLeft(), startIndent, endIndent, textIndent,
+                     align, alignLast, lineHeight);
+      blockArea.setPage(area.getPage());
+      blockArea.start();
+
+      blockArea.setAbsoluteHeight(area.getAbsoluteHeight());
+      blockArea.setIDReferences(area.getIDReferences());
+      
+      blockArea.setTableCellXOffset(area.getTableCellXOffset());
+
+      int numChildren = this.children.size();
+      for ( int i = this.marker; i < numChildren; i++ ) {
+       FONode fo = (FONode) children.elementAt(i);
+       Status status;
+       if ( (status = fo.layout(blockArea)).isIncomplete() ) {
+         this.resetMarker();
+         return status;
+       }
+      }
+      blockArea.end();
+      area.addChild(blockArea);
+      area.increaseHeight(blockArea.getHeight());
+      return new Status(Status.OK);
+    }
 }
index 5ed0edfe93dca9aab88837699ea6b34372b57e18..68913fd1f464385fc692e42db16b86bfe4a54a21 100644 (file)
@@ -81,7 +81,6 @@ public class InlineGraphic extends FObj {
        return new InlineGraphic.Maker();
                }
 
-               FontState fs;
                int align;
                int startIndent;
                int endIndent;
@@ -102,22 +101,6 @@ public class InlineGraphic extends FObj {
                public Status layout(Area area) throws FOPException {
 
        if (this.marker == START) {
-                       String fontFamily =
-               this.properties.get("font-family").getString();
-                       String fontStyle =
-               this.properties.get("font-style").getString();
-                       String fontWeight =
-               this.properties.get("font-weight").getString();
-                       int fontSize =
-               this.properties.get("font-size").getLength().mvalue();
-               // font-variant support
-               // added by Eric SCHAEFFER
-               int fontVariant =
-                       this.properties.get("font-variant").getEnum();
-
-               this.fs = new FontState(area.getFontInfo(), fontFamily,
-                                                                                                               fontStyle, fontWeight, fontSize, fontVariant);
-
                        // FIXME
                        this.align = this.properties.get("text-align").getEnum();
 
@@ -178,8 +161,8 @@ public class InlineGraphic extends FObj {
                }
 
                this.imageArea = new ImageArea(
-                                                                               fs,
-                                                                               img,
+                                              propMgr.getFontState(area.getFontInfo()),
+                                              img,
                                                                                area.getAllocationWidth(),
                                                                                width,
                                                                                height,
index c7c1099710146bafbb7413ed8f23aca44679e80d..c173ad7b7b25d00d5b5d4134880abe6044876dae 100644 (file)
@@ -92,7 +92,6 @@ public class InstreamForeignObject extends FObj {
        return new InstreamForeignObject.Maker();
        }
 
-       FontState fs;
        int breakBefore;
        int breakAfter;
        int scaling;
@@ -138,18 +137,6 @@ public class InstreamForeignObject extends FObj {
        if (this.marker == START) {
                /* retrieve properties */
                String id = this.properties.get("id").getString();
-               String fontFamily = this.properties.get("font-family").getString();
-               String fontStyle = this.properties.get("font-style").getString();
-               String fontWeight = this.properties.get("font-weight").getString();
-               int fontSize = this.properties.get("font-size").getLength().mvalue();
-               // font-variant support
-               // added by Eric SCHAEFFER
-               int fontVariant =
-                       this.properties.get("font-variant").getEnum();
-
-               this.fs = new FontState(area.getFontInfo(), fontFamily,
-                                                                                                               fontStyle, fontWeight, fontSize, fontVariant);
-
                        int align = this.properties.get("text-align").getEnum();
                        int valign = this.properties.get("vertical-align").getEnum();
                        int overflow = this.properties.get("overflow").getEnum();
@@ -184,7 +171,7 @@ public class InstreamForeignObject extends FObj {
                }
                if(this.areaCurrent == null) {
                this.areaCurrent =
-                               new ForeignObjectArea(fs, area.getAllocationWidth());
+                               new ForeignObjectArea( propMgr.getFontState(area.getFontInfo()), area.getAllocationWidth());
 
                this.areaCurrent.start();
                areaCurrent.setWidth(this.width);
index 8a6842799f5e190330e505f28e37910a9a86262e..4599509d33c3ed29c9b51771f4536e3c5f845668 100644 (file)
@@ -96,20 +96,6 @@ public class Leader extends FObjMixed {
                                                blockArea = (BlockArea) area;
                                }
 
-                               //retrieving font property information for fo:leader
-                               String fontFamily = this.properties.get("font-family").getString();
-                               String fontStyle = this.properties.get("font-style").getString();
-                               String fontWeight = this.properties.get("font-weight").getString();
-                               int fontSize =
-                                       this.properties.get("font-size").getLength().mvalue();
-                               // font-variant support
-                               // added by Eric SCHAEFFER
-                               int fontVariant =
-                                       this.properties.get("font-variant").getEnum();
-
-                               FontState fontstate = new FontState(area.getFontInfo(), fontFamily,
-                                                                                                                               fontStyle, fontWeight, fontSize, fontVariant);
-
                                //color properties
                                ColorType c = this.properties.get("color").getColorType();
                                float red = c.red();
@@ -141,7 +127,7 @@ public class Leader extends FObjMixed {
                                blockArea.getIDReferences().initializeID(id, blockArea);
 
                                //adds leader to blockarea, there the leaderArea is generated
-                               int succeeded = addLeader(blockArea, fontstate, red, green, blue,
+                               int succeeded = addLeader(blockArea, propMgr.getFontState(area.getFontInfo()), red, green, blue,
                                                                                                                                                                                leaderPattern, leaderLengthMinimum,
                                                                                                                                                                                leaderLengthOptimum, leaderLengthMaximum,
                                                                                                                                                                                ruleThickness, ruleStyle, leaderPatternWidth,
index b5ce9f2ad315bc5117128680c5ec0b5a8bfab472..e7fbd4ed1e91205cc163adcd9a52f0e19c22305b 100644 (file)
@@ -77,7 +77,6 @@ public class ListBlock extends FObj {
                                return new ListBlock.Maker();
                }
 
-               FontState fs;
                int align;
                int alignLast;
                int breakBefore;
@@ -97,21 +96,6 @@ public class ListBlock extends FObj {
 
                public Status layout(Area area) throws FOPException {
                                if (this.marker == START) {
-                                               String fontFamily =
-                                                       this.properties.get("font-family").getString();
-                                               String fontStyle =
-                                                       this.properties.get("font-style").getString();
-                                               String fontWeight =
-                                                       this.properties.get("font-weight").getString();
-                                               int fontSize =
-                                                       this.properties.get("font-size").getLength().mvalue();
-                                               // font-variant support
-                                               // added by Eric SCHAEFFER
-                                               int fontVariant =
-                                                       this.properties.get("font-variant").getEnum();
-
-                                               this.fs = new FontState(area.getFontInfo(), fontFamily,
-                                                                                                                                               fontStyle, fontWeight, fontSize, fontVariant);
 
                                                this.align = this.properties.get("text-align").getEnum();
                                                this.alignLast =
@@ -151,7 +135,8 @@ public class ListBlock extends FObj {
                                                area.getIDReferences().initializeID(id, area);
                                }
 
-                               BlockArea blockArea = new BlockArea(fs, area.getAllocationWidth(),
+                               BlockArea blockArea = new BlockArea(propMgr.getFontState(area.getFontInfo()),
+                                                                   area.getAllocationWidth(),
                                                                                                                                                                                area.spaceLeft(), startIndent, endIndent, 0, align,
                                                                                                                                                                                alignLast, lineHeight);
                                blockArea.setPage(area.getPage());
index 4d80641dfd9f3de4e410fcac1d9af0f8553ea92e..8cd89b0384f2fc43da6f420f07e807673184deac 100644 (file)
@@ -75,7 +75,6 @@ public class ListItem extends FObj {
                                return new ListItem.Maker();
     }
 
-    FontState fs;
     int align;
     int alignLast;
     int breakBefore;
@@ -95,21 +94,6 @@ public class ListItem extends FObj {
 
     public Status layout(Area area) throws FOPException {
                                if (this.marker == START) {
-                                               String fontFamily =
-                                                               this.properties.get("font-family").getString();
-                                               String fontStyle =
-                                                               this.properties.get("font-style").getString();
-                                               String fontWeight =
-                                                               this.properties.get("font-weight").getString();
-                                               int fontSize =
-                                                               this.properties.get("font-size").getLength().mvalue();
-                                               // font-variant support
-                                               // added by Eric SCHAEFFER
-                                               int fontVariant =
-                                                               this.properties.get("font-variant").getEnum();
-                                               
-                                               this.fs = new FontState(area.getFontInfo(), fontFamily,
-                                                                                                                                               fontStyle, fontWeight, fontSize, fontVariant);
                                                
                                                this.align = this.properties.get("text-align").getEnum();
                                                this.alignLast =
@@ -138,7 +122,7 @@ public class ListItem extends FObj {
                                }
 
                                this.blockArea =
-                                               new BlockArea(fs, area.getAllocationWidth(),
+                                               new BlockArea(propMgr.getFontState(area.getFontInfo()), area.getAllocationWidth(),
                                                                                                        area.spaceLeft(), 0, 0,
                                                                                                        0, align, alignLast, lineHeight);
                                blockArea.setPage(area.getPage());
index dc4a3bc82114e406f0d5e713defe9e255bfadf69..8138828ff7ed485473c31bdba749fd4dc8c421f4 100644 (file)
@@ -75,7 +75,6 @@ public class PageNumber extends FObj {
                                return new PageNumber.Maker();
                }
 
-               FontState fs;
                float red;
                float green;
                float blue;
@@ -94,21 +93,6 @@ public class PageNumber extends FObj {
                                                return new Status(Status.OK);
                                }
                                if (this.marker == START) {
-                                               String fontFamily =
-                                                       this.properties.get("font-family").getString();
-                                               String fontStyle =
-                                                       this.properties.get("font-style").getString();
-                                               String fontWeight =
-                                                       this.properties.get("font-weight").getString();
-                                               int fontSize =
-                                                       this.properties.get("font-size").getLength().mvalue();
-                                               // font-variant support
-                                               // added by Eric SCHAEFFER
-                                               int fontVariant =
-                                                       this.properties.get("font-variant").getEnum();
-
-                                               this.fs = new FontState(area.getFontInfo(), fontFamily,
-                                                                                                                                               fontStyle, fontWeight, fontSize, fontVariant);
 
                                                ColorType c = this.properties.get("color").getColorType();
                                                this.red = c.red();
@@ -127,7 +111,7 @@ public class PageNumber extends FObj {
                                }
 
                                String p = Integer.toString(area.getPage().getNumber());
-                               this.marker = FOText.addText((BlockArea) area, fs, red, green, blue,
+                               this.marker = FOText.addText((BlockArea) area, propMgr.getFontState(area.getFontInfo()), red, green, blue,
                                                                                        wrapOption, null, whiteSpaceCollapse, p.toCharArray(),
                                                                                        0, p.length(), ts, VerticalAlign.BASELINE);
                                return new Status(Status.OK);
index e24a253c0f74cc5f57d520e4581f31e5fb75c944..c3b6d664b964843f84e96cbc7b7e4c16aa291020 100644 (file)
@@ -128,7 +128,6 @@ public class PageNumberCitation extends FObj {
                                return new PageNumberCitation.Maker();
                }
 
-               FontState fs;
                float red;
                float green;
                float blue;
@@ -156,21 +155,6 @@ public class PageNumberCitation extends FObj {
                                IDReferences idReferences = area.getIDReferences();
                                this.area = area;
                                if (this.marker == START) {
-                                               String fontFamily =
-                                                       this.properties.get("font-family").getString();
-                                               String fontStyle =
-                                                       this.properties.get("font-style").getString();
-                                               String fontWeight =
-                                                       this.properties.get("font-weight").getString();
-                                               int fontSize =
-                                                       this.properties.get("font-size").getLength().mvalue();
-                                               // font-variant support
-                                               // added by Eric SCHAEFFER
-                                               int fontVariant =
-                                                       this.properties.get("font-variant").getEnum();
-
-                                               this.fs = new FontState(area.getFontInfo(), fontFamily,
-                                                                                                                                               fontStyle, fontWeight, fontSize, fontVariant);
 
                                                ColorType c = this.properties.get("color").getColorType();
                                                this.red = c.red();
@@ -203,7 +187,9 @@ public class PageNumberCitation extends FObj {
                                pageNumber = idReferences.getPageNumber(refId);
 
                                if (pageNumber != null) { // if we already know the page number
-                                               this.marker = FOText.addText((BlockArea) area, fs, red, green, blue,
+                                               this.marker = FOText.addText((BlockArea) area,
+                                                                                                       propMgr.getFontState(area.getFontInfo()),
+                                                                                                       red, green, blue,
                                                                                                        wrapOption, null, whiteSpaceCollapse,
                                                                                                        pageNumber.toCharArray(), 0, pageNumber.length(),
                                                                                                        ts, VerticalAlign.BASELINE);
@@ -213,7 +199,7 @@ public class PageNumberCitation extends FObj {
             if(la == null) {
                                                return new Status(Status.AREA_FULL_NONE);
             }
-            la.changeFont(fs);
+            la.changeFont(propMgr.getFontState(area.getFontInfo()));
             la.changeColor(red, green, blue);
             la.changeWrapOption(wrapOption);
             la.changeWhiteSpaceCollapse(whiteSpaceCollapse);
index 279e7c4c1a9cae66057b739bce67b2be443b9179..3c4afdf779160d9c932412173f318ab13f1b03c9 100644 (file)
@@ -75,7 +75,6 @@ public class Table extends FObj {
                                return new Table.Maker();
                }
 
-               FontState fs;
                int breakBefore;
                int breakAfter;
                int spaceBefore;
@@ -83,9 +82,6 @@ public class Table extends FObj {
                ColorType backgroundColor;
                int width;
                int height;
-               ColorType borderColor;
-               int borderWidth;
-               int borderStyle;
                String id;
                TableHeader tableHeader = null;
                TableFooter tableFooter = null;
@@ -109,22 +105,6 @@ public class Table extends FObj {
                                }
 
                                if (this.marker == START) {
-                                               String fontFamily =
-                                                       this.properties.get("font-family").getString();
-                                               String fontStyle =
-                                                       this.properties.get("font-style").getString();
-                                               String fontWeight =
-                                                       this.properties.get("font-weight").getString();
-                                               int fontSize =
-                                                       this.properties.get("font-size").getLength().mvalue();
-                                               // font-variant support
-                                               // added by Eric SCHAEFFER
-                                               int fontVariant =
-                                                       this.properties.get("font-variant").getEnum();
-
-                                               this.fs = new FontState(area.getFontInfo(), fontFamily,
-                                                                                                                                               fontStyle, fontWeight, fontSize, fontVariant);
-
                                                this.breakBefore =
                                                        this.properties.get("break-before").getEnum();
                                                this.breakAfter = this.properties.get("break-after").getEnum();
@@ -138,12 +118,6 @@ public class Table extends FObj {
                                                this.height =
                                                        this.properties.get("height").getLength().mvalue();
 
-                                               this.borderColor =
-                                                       this.properties.get("border-color").getColorType();
-                                               this.borderWidth = this.properties.get(
-                                                                                                                                "border-width").getLength().mvalue();
-                                               this.borderStyle =
-                                                       this.properties.get("border-style").getEnum();
                                                this. id = this.properties.get("id").getString();
 
                                                this.omitHeaderAtBreak = this.properties.get("table-omit-header-at-break").getEnum() == TableOmitHeaderAtBreak.TRUE;
@@ -182,17 +156,12 @@ public class Table extends FObj {
                                }
 
                                this.areaContainer =
-                                       new AreaContainer(fs, 0, 0, area.getAllocationWidth(),
+                                       new AreaContainer(propMgr.getFontState(area.getFontInfo()), 0, 0, area.getAllocationWidth(),
                                                                                                                area.spaceLeft(), Position.STATIC);
                                areaContainer.foCreator=this;   // G Seshadri
                                areaContainer.setPage(area.getPage());
                                areaContainer.setBackgroundColor(backgroundColor);
-                               areaContainer.setBorderStyle(borderStyle, borderStyle,
-                                                                                                                                                borderStyle, borderStyle);
-                               areaContainer.setBorderWidth(borderWidth, borderWidth,
-                                                                                                                                                borderWidth, borderWidth);
-                               areaContainer.setBorderColor(borderColor, borderColor,
-                                                                                                                                                borderColor, borderColor);
+                               areaContainer.setBorderAndPadding(propMgr.getBorderAndPadding());
                                areaContainer.start();
 
                                areaContainer.setAbsoluteHeight(area.getAbsoluteHeight());
index 6e4661fce0e97454206875b1a6c46b4a849b286d..c9e6b28d0b7e2f0f59bacf894eee9ced1487cda1 100644 (file)
@@ -75,13 +75,9 @@ public class TableBody extends FObj {
                                return new TableBody.Maker();
                }
 
-               FontState fs;
                int spaceBefore;
                int spaceAfter;
                ColorType backgroundColor;
-               ColorType borderColor;
-               int borderWidth;
-               int borderStyle;
                String id;
 
                Vector columns;
@@ -115,21 +111,6 @@ public class TableBody extends FObj {
                                }
 
                                if (this.marker == START) {
-                                               String fontFamily =
-                                                       this.properties.get("font-family").getString();
-                                               String fontStyle =
-                                                       this.properties.get("font-style").getString();
-                                               String fontWeight =
-                                                       this.properties.get("font-weight").getString();
-                                               int fontSize =
-                                                       this.properties.get("font-size").getLength().mvalue();
-                                               // font-variant support
-                                               // added by Eric SCHAEFFER
-                                               int fontVariant =
-                                                       this.properties.get("font-variant").getEnum();
-
-                                               this.fs = new FontState(area.getFontInfo(), fontFamily,
-                                                                                                                                               fontStyle, fontWeight, fontSize, fontVariant);
 
                                                this.spaceBefore = this.properties.get(
                                                                                                                                 "space-before.optimum").getLength().mvalue();
@@ -137,12 +118,6 @@ public class TableBody extends FObj {
                                                                                                                                "space-after.optimum").getLength().mvalue();
                                                this.backgroundColor = this.properties.get(
                                                                                                                                                 "background-color").getColorType();
-                                               this.borderColor =
-                                                       this.properties.get("border-color").getColorType();
-                                               this.borderWidth = this.properties.get(
-                                                                                                                                "border-width").getLength().mvalue();
-                                               this.borderStyle =
-                                                       this.properties.get("border-style").getEnum();
                                                this.id = this.properties.get("id").getString();
 
                                                area.getIDReferences().createID(id);
@@ -168,19 +143,15 @@ public class TableBody extends FObj {
                                                area.getIDReferences().configureID(id, area);
                                }
 
-                               this.areaContainer = new AreaContainer(fs, -area.borderWidthLeft,
-                                                                                                                                                                                        -area.borderWidthTop + area.getHeight(),
+                               this.areaContainer = new AreaContainer(propMgr.getFontState(area.getFontInfo()),
+                                                                                                                                                                                        -area.getBorderLeftWidth(),
+                                                                                                                                                                                        -area.getBorderTopWidth() + area.getHeight(),
                                                                                                                                                                                         area.getAllocationWidth(), area.spaceLeft(),
                                                                                                                                                                                         Position.RELATIVE);
                                areaContainer.foCreator=this;   // G Seshadri
                                areaContainer.setPage(area.getPage());
                                areaContainer.setBackgroundColor(backgroundColor);
-                               areaContainer.setBorderStyle(borderStyle, borderStyle,
-                                                                                                                                                borderStyle, borderStyle);
-                               areaContainer.setBorderWidth(borderWidth, borderWidth,
-                                                                                                                                                borderWidth, borderWidth);
-                               areaContainer.setBorderColor(borderColor, borderColor,
-                                                                                                                                                borderColor, borderColor);
+                               areaContainer.setBorderAndPadding(propMgr.getBorderAndPadding());
                                areaContainer.start();
 
                                areaContainer.setAbsoluteHeight(area.getAbsoluteHeight());
index 0849c24d9d5fd0a30f8da7af9f89aaca027c774c..311fca76ecf9c0ed818384ea8198f5a507b73baf 100644 (file)
@@ -74,23 +74,6 @@ public class TableCell extends FObj {
                int spaceAfter;
                ColorType backgroundColor;
 
-               FontState fs;
-               ColorType borderTopColor;
-               int borderTopWidth;
-               int borderTopStyle;
-               ColorType borderBottomColor;
-               int borderBottomWidth;
-               int borderBottomStyle;
-               ColorType borderLeftColor;
-               int borderLeftWidth;
-               int borderLeftStyle;
-               ColorType borderRightColor;
-               int borderRightWidth;
-               int borderRightStyle;
-               int paddingTop;
-               int paddingBottom;
-               int paddingLeft;
-               int paddingRight;
                int position;
                String id;
                int numColumnsSpanned;
@@ -136,82 +119,6 @@ public class TableCell extends FObj {
                this.properties.get("number-columns-spanned").getNumber().intValue();
                        this.numRowsSpanned =
                this.properties.get("number-rows-spanned").getNumber().intValue();
-                       String fontFamily =
-               this.properties.get("font-family").getString();
-                       String fontStyle =
-               this.properties.get("font-style").getString();
-                       String fontWeight =
-               this.properties.get("font-weight").getString();
-                       int fontSize =
-               this.properties.get("font-size").getLength().mvalue();
-               // font-variant support
-               // added by Eric SCHAEFFER
-               int fontVariant =
-                       this.properties.get("font-variant").getEnum();
-
-               this.fs = new FontState(area.getFontInfo(), fontFamily,
-                                                                                                               fontStyle, fontWeight, fontSize, fontVariant);
-
-                       this.borderTopColor =
-               this.properties.get("border-color").getColorType();
-                       this.borderBottomColor = this.borderTopColor;
-                       this.borderLeftColor = this.borderTopColor;
-                       this.borderRightColor = this.borderTopColor;
-                       if (this.borderTopColor == null) {
-               this.borderTopColor =
-                               this.properties.get("border-top-color").getColorType();
-               this.borderBottomColor =
-                               this.properties.get("border-bottom-color").getColorType();
-               this.borderLeftColor =
-                               this.properties.get("border-left-color").getColorType();
-               this.borderRightColor =
-                               this.properties.get("border-right-color").getColorType();
-                       }
-                       this.borderTopWidth =
-               this.properties.get("border-width").getLength().mvalue();
-                       this.borderBottomWidth = this.borderTopWidth;
-                       this.borderLeftWidth = this.borderTopWidth;
-                       this.borderRightWidth = this.borderTopWidth;
-                       if (this.borderTopWidth == 0) {
-               this.borderTopWidth =
-                               this.properties.get("border-top-width").getLength().mvalue();
-               this.borderBottomWidth =
-                               this.properties.get("border-bottom-width").getLength().mvalue();
-               this.borderLeftWidth =
-                               this.properties.get("border-left-width").getLength().mvalue();
-               this.borderRightWidth =
-                               this.properties.get("border-right-width").getLength().mvalue();
-                       }
-                       this.borderTopStyle =
-               this.properties.get("border-style").getEnum();
-                       this.borderBottomStyle = this.borderTopStyle;
-                       this.borderLeftStyle = this.borderTopStyle;
-                       this.borderRightStyle = this.borderTopStyle;
-                       if (this.borderTopStyle == 0) {
-               this.borderTopStyle =
-                               this.properties.get("border-top-style").getEnum();
-               this.borderBottomStyle =
-                               this.properties.get("border-bottom-style").getEnum();
-               this.borderLeftStyle =
-                               this.properties.get("border-left-style").getEnum();
-               this.borderRightStyle =
-                               this.properties.get("border-right-style").getEnum();
-                       }
-                       this.paddingTop =
-               this.properties.get("padding").getLength().mvalue();
-                                               this.paddingLeft = this.paddingTop;
-                                               this.paddingRight = this.paddingTop;
-                                               this.paddingBottom = this.paddingTop;
-                                               if (this.paddingTop == 0) {
-                               this.paddingTop =
-                       this.properties.get("padding-top").getLength().mvalue();
-                               this.paddingLeft =
-                       this.properties.get("padding-left").getLength().mvalue();
-                               this.paddingBottom =
-                       this.properties.get("padding-bottom").getLength().mvalue();
-                               this.paddingRight =
-                       this.properties.get("padding-right").getLength().mvalue();
-                                               }
 
                        this.spaceBefore =
                this.properties.get("space-before.optimum").getLength().mvalue();
@@ -257,20 +164,13 @@ public class TableCell extends FObj {
                                }
 
        this.areaContainer =
-                       new AreaContainer(fs, startOffset - area.borderWidthLeft,
-                                                                                                                       - area.borderWidthTop + ((this.marker ==0) ? spaceBefore : 0),
+                       new AreaContainer(propMgr.getFontState(area.getFontInfo()),
+                                                                                               startOffset - area.getBorderLeftWidth(),
+                                                                                               - area.getBorderTopWidth() + ((this.marker ==0) ? spaceBefore : 0),
                                                                                                        width, area.spaceLeft(), Position.RELATIVE);
        areaContainer.foCreator=this;   // G Seshadri
        areaContainer.setPage(area.getPage());
-       areaContainer.setPadding(paddingTop, paddingLeft, paddingBottom,
-                                        paddingRight);
-       areaContainer.setBackgroundColor(backgroundColor);
-                               areaContainer.setBorderStyle(borderTopStyle, borderLeftStyle,
-                                                borderBottomStyle, borderRightStyle);
-                               areaContainer.setBorderWidth(borderTopWidth, borderLeftWidth,
-                                                borderBottomWidth, borderRightWidth);
-                               areaContainer.setBorderColor(borderTopColor, borderLeftColor,
-                                                borderBottomColor, borderRightColor);
+       areaContainer.setBorderAndPadding(propMgr.getBorderAndPadding());
        areaContainer.start();
 
                                areaContainer.setAbsoluteHeight(area.getAbsoluteHeight());
index a2430dc73ddb207ff88be880be1b3b5fb0eaf4c0..8f0167103e5fdc4c158bd9cf38455dd043da1c20 100644 (file)
@@ -60,24 +60,7 @@ import org.apache.fop.datatypes.*;
 
 public class TableColumn extends FObj {
 
-               FontState fs;
                ColorType backgroundColor;
-               ColorType borderTopColor;
-               int borderTopWidth;
-               int borderTopStyle;
-               ColorType borderBottomColor;
-               int borderBottomWidth;
-               int borderBottomStyle;
-               ColorType borderLeftColor;
-               int borderLeftWidth;
-               int borderLeftStyle;
-               ColorType borderRightColor;
-               int borderRightWidth;
-               int borderRightStyle;
-               int paddingTop;
-               int paddingBottom;
-               int paddingLeft;
-               int paddingRight;
 
                int columnWidth;
                int columnOffset;
@@ -114,84 +97,9 @@ public class TableColumn extends FObj {
        }
 
        if (this.marker == START) {
-                       String fontFamily =
-               this.properties.get("font-family").getString();
-                       String fontStyle =
-               this.properties.get("font-style").getString();
-                       String fontWeight =
-               this.properties.get("font-weight").getString();
-                       int fontSize =
-               this.properties.get("font-size").getLength().mvalue();
-               // font-variant support
-               // added by Eric SCHAEFFER
-               int fontVariant =
-                       this.properties.get("font-variant").getEnum();
-
-               this.fs = new FontState(area.getFontInfo(), fontFamily,
-                                                                                                               fontStyle, fontWeight, fontSize, fontVariant);
-
                        this.backgroundColor =
                this.properties.get("background-color").getColorType();
-                       this.borderTopColor =
-               this.properties.get("border-color").getColorType();
-                       this.borderBottomColor = this.borderTopColor;
-                       this.borderLeftColor = this.borderTopColor;
-                       this.borderRightColor = this.borderTopColor;
-                       if (this.borderTopColor == null) {
-               this.borderTopColor =
-                               this.properties.get("border-top-color").getColorType();
-               this.borderBottomColor =
-                               this.properties.get("border-bottom-color").getColorType();
-               this.borderLeftColor =
-                               this.properties.get("border-left-color").getColorType();
-               this.borderRightColor =
-                               this.properties.get("border-right-color").getColorType();
-                       }
-                       this.borderTopWidth =
-               this.properties.get("border-width").getLength().mvalue();
-                       this.borderBottomWidth = this.borderTopWidth;
-                       this.borderLeftWidth = this.borderTopWidth;
-                       this.borderRightWidth = this.borderTopWidth;
-                       if (this.borderTopWidth == 0) {
-               this.borderTopWidth =
-                               this.properties.get("border-top-width").getLength().mvalue();
-               this.borderBottomWidth =
-                               this.properties.get("border-bottom-width").getLength().mvalue();
-               this.borderLeftWidth =
-                               this.properties.get("border-left-width").getLength().mvalue();
-               this.borderRightWidth =
-                               this.properties.get("border-right-width").getLength().mvalue();
-                       }
-                       this.borderTopStyle =
-               this.properties.get("border-style").getEnum();
-                       this.borderBottomStyle = this.borderTopStyle;
-                       this.borderLeftStyle = this.borderTopStyle;
-                       this.borderRightStyle = this.borderTopStyle;
-                       if (this.borderTopStyle == 0) {
-               this.borderTopStyle =
-                               this.properties.get("border-top-style").getEnum();
-               this.borderBottomStyle =
-                               this.properties.get("border-bottom-style").getEnum();
-               this.borderLeftStyle =
-                               this.properties.get("border-left-style").getEnum();
-               this.borderRightStyle =
-                               this.properties.get("border-right-style").getEnum();
-                       }
-                       this.paddingTop =
-               this.properties.get("padding").getLength().mvalue();
-                                               this.paddingLeft = this.paddingTop;
-                                               this.paddingRight = this.paddingTop;
-                                               this.paddingBottom = this.paddingTop;
-                                               if (this.paddingTop == 0) {
-                               this.paddingTop =
-                       this.properties.get("padding-top").getLength().mvalue();
-                               this.paddingLeft =
-                       this.properties.get("padding-left").getLength().mvalue();
-                               this.paddingBottom =
-                       this.properties.get("padding-bottom").getLength().mvalue();
-                               this.paddingRight =
-                       this.properties.get("padding-right").getLength().mvalue();
-                                               }
+
                                                this.columnWidth =
                                                                this.properties.get("column-width").getLength().mvalue();
 
@@ -201,20 +109,14 @@ public class TableColumn extends FObj {
                                }
 
        this.areaContainer =
-                       new AreaContainer(fs, columnOffset - area.borderWidthLeft, -area.borderWidthTop, columnWidth,
+                       new AreaContainer(propMgr.getFontState(area.getFontInfo()),
+                                                                                               columnOffset - area.getBorderLeftWidth(),
+                                                                                               -area.getBorderTopWidth(), columnWidth,
                                area.getHeight(), Position.RELATIVE);
        areaContainer.foCreator=this;   // G Seshadri
        areaContainer.setPage(area.getPage());
-       areaContainer.setPadding(paddingTop, paddingLeft, paddingBottom,
-                                paddingRight);
-       areaContainer.setBackgroundColor(backgroundColor);
-                               areaContainer.setBorderStyle(borderTopStyle, borderLeftStyle,
-                                                borderBottomStyle, borderRightStyle);
-                               areaContainer.setBorderWidth(borderTopWidth, borderLeftWidth,
-                                                borderBottomWidth, borderRightWidth);
-                               areaContainer.setBorderColor(borderTopColor, borderLeftColor,
-                                                borderBottomColor, borderRightColor);
-                               areaContainer.setHeight(area.getHeight());
+       areaContainer.setBorderAndPadding(propMgr.getBorderAndPadding());
+       areaContainer.setHeight(area.getHeight());
        area.addChild(areaContainer);
 
        return new Status(Status.OK);
index ab6b6ba7339bd4e5ef65fee0803197bc9b5459b1..063eec1d950fc8e6c0beb1cf78d66d8c65deb0a8 100644 (file)
@@ -77,7 +77,6 @@ public class TableRow extends FObj {
 
                boolean setup = false;
 
-               FontState fs;
                int spaceBefore;
                int spaceAfter;
                int breakBefore;
@@ -85,22 +84,6 @@ public class TableRow extends FObj {
                ColorType backgroundColor;
                String id;
 
-               ColorType borderTopColor;
-               int borderTopWidth;
-               int borderTopStyle;
-               ColorType borderBottomColor;
-               int borderBottomWidth;
-               int borderBottomStyle;
-               ColorType borderLeftColor;
-               int borderLeftWidth;
-               int borderLeftStyle;
-               ColorType borderRightColor;
-               int borderRightWidth;
-               int borderRightStyle;
-               int paddingTop;
-               int paddingBottom;
-               int paddingLeft;
-               int paddingRight;
                KeepValue keepWithNext;
                KeepValue keepWithPrevious;
 
@@ -258,18 +241,6 @@ public class TableRow extends FObj {
                }
 
                public void doSetup(Area area) throws FOPException {
-                               String fontFamily = this.properties.get("font-family").getString();
-                               String fontStyle = this.properties.get("font-style").getString();
-                               String fontWeight = this.properties.get("font-weight").getString();
-                               int fontSize =
-                                       this.properties.get("font-size").getLength().mvalue();
-                               // font-variant support
-                               // added by Eric SCHAEFFER
-                               int fontVariant =
-                                       this.properties.get("font-variant").getEnum();
-
-                               this.fs = new FontState(area.getFontInfo(), fontFamily,
-                                                                                                                               fontStyle, fontWeight, fontSize, fontVariant);
 
                                this.spaceBefore = this.properties.get(
                                                                                                                 "space-before.optimum").getLength().mvalue();
@@ -280,67 +251,10 @@ public class TableRow extends FObj {
                                                this.breakAfter = this.properties.get("break-after").getEnum();
                                this.backgroundColor =
                                        this.properties.get("background-color").getColorType();
-                               this.borderTopColor =
-                                       this.properties.get("border-color").getColorType();
-                               this.borderBottomColor = this.borderTopColor;
-                               this.borderLeftColor = this.borderTopColor;
-                               this.borderRightColor = this.borderTopColor;
-                               if (this.borderTopColor == null) {
-                                               this.borderTopColor = this.properties.get(
-                                                                                                                                               "border-top-color").getColorType();
-                                               this.borderBottomColor = this.properties.get(
-                                                                                                                                                        "border-bottom-color").getColorType();
-                                               this.borderLeftColor = this.properties.get(
-                                                                                                                                                "border-left-color").getColorType();
-                                               this.borderRightColor = this.properties.get(
-                                                                                                                                                       "border-right-color").getColorType();
-                               }
-                               this.borderTopWidth =
-                                       this.properties.get("border-width").getLength().mvalue();
-                               this.borderBottomWidth = this.borderTopWidth;
-                               this.borderLeftWidth = this.borderTopWidth;
-                               this.borderRightWidth = this.borderTopWidth;
-                               if (this.borderTopWidth == 0) {
-                                               this.borderTopWidth = this.properties.get(
-                                                                                                                                               "border-top-width").getLength().mvalue();
-                                               this.borderBottomWidth = this.properties.get(
-                                                                                                                                                        "border-bottom-width").getLength().mvalue();
-                                               this.borderLeftWidth = this.properties.get(
-                                                                                                                                                "border-left-width").getLength().mvalue();
-                                               this.borderRightWidth = this.properties.get(
-                                                                                                                                                       "border-right-width").getLength().mvalue();
-                               }
-                               this.borderTopStyle = this.properties.get("border-style").getEnum();
-                               this.borderBottomStyle = this.borderTopStyle;
-                               this.borderLeftStyle = this.borderTopStyle;
-                               this.borderRightStyle = this.borderTopStyle;
-                               if (this.borderTopStyle == 0) {
-                                               this.borderTopStyle =
-                                                       this.properties.get("border-top-style").getEnum();
-                                               this.borderBottomStyle =
-                                                       this.properties.get("border-bottom-style").getEnum();
-                                               this.borderLeftStyle =
-                                                       this.properties.get("border-left-style").getEnum();
-                                               this.borderRightStyle =
-                                                       this.properties.get("border-right-style").getEnum();
-                               }
+
                                this.keepWithNext = getKeepValue("keep-with-next.within-column");
                                this.keepWithPrevious = getKeepValue("keep-with-previous.within-column");
-                               this.paddingTop =
-                                       this.properties.get("padding").getLength().mvalue();
-                               this.paddingLeft = this.paddingTop;
-                               this.paddingRight = this.paddingTop;
-                               this.paddingBottom = this.paddingTop;
-                               if (this.paddingTop == 0) {
-                                               this.paddingTop = this.properties.get(
-                                                                                                                               "padding-top").getLength().mvalue();
-                                               this.paddingLeft = this.properties.get(
-                                                                                                                                "padding-left").getLength().mvalue();
-                                               this.paddingBottom = this.properties.get(
-                                                                                                                                        "padding-bottom").getLength().mvalue();
-                                               this.paddingRight = this.properties.get(
-                                                                                                                                       "padding-right").getLength().mvalue();
-                               }
+
                                this.id = this.properties.get("id").getString();
                                setup = true;
                }
@@ -410,20 +324,15 @@ public class TableRow extends FObj {
                                                area.getIDReferences().configureID(id, area);
                                }
 
-                               this.areaContainer = new AreaContainer(fs, -area.borderWidthLeft,
-                                                                                                                                                                                        -area.borderWidthTop, area.getAllocationWidth(),
+                               this.areaContainer = new AreaContainer(propMgr.getFontState(area.getFontInfo()),
+                                                                                                                                                                                        -area.getBorderLeftWidth(),
+                                                                                                                                                                                        -area.getBorderTopWidth(), area.getAllocationWidth(),
                                                                                                                                                                                         area.spaceLeft(), Position.RELATIVE);
                                areaContainer.foCreator=this;   // G Seshadri
                                areaContainer.setPage(area.getPage());
-                               areaContainer.setPadding(paddingTop, paddingLeft,
-                                                                                                                                paddingBottom, paddingRight);
+
                                areaContainer.setBackgroundColor(backgroundColor);
-                               areaContainer.setBorderStyle(borderTopStyle, borderLeftStyle,
-                                                                                                                                                borderBottomStyle, borderRightStyle);
-                               areaContainer.setBorderWidth(borderTopWidth, borderLeftWidth,
-                                                                                                                                                borderBottomWidth, borderRightWidth);
-                               areaContainer.setBorderColor(borderTopColor, borderLeftColor,
-                                                                                                                                                borderBottomColor, borderRightColor);
+                               areaContainer.setBorderAndPadding(propMgr.getBorderAndPadding());
                                areaContainer.start();
 
                                areaContainer.setAbsoluteHeight(area.getAbsoluteHeight());
@@ -581,9 +490,9 @@ public class TableRow extends FObj {
                                areaContainer.end();
                                area.addDisplaySpace(largestCellHeight +
                                                                                                                 areaContainer.getPaddingTop() +
-                                                                                                                areaContainer.borderWidthTop +
+                                                                                                                areaContainer.getBorderTopWidth() +
                                                                                                                 areaContainer.getPaddingBottom() +
-                                                                                                                areaContainer.borderWidthBottom);
+                                                                                                                areaContainer.getBorderBottomWidth());
 
                                // bug fix from Eric Schaeffer
                                //area.increaseHeight(largestCellHeight);