From: Karen Lease Date: Sun, 4 Mar 2001 21:34:52 +0000 (+0000) Subject: Use PropertyManager for FontState and BorderAndPadding property sets X-Git-Tag: fop-0_18_1~62 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=c4c93d19cb14ed39fe185265fa8000b123e2b3e8;p=xmlgraphics-fop.git Use PropertyManager for FontState and BorderAndPadding property sets git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194126 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/org/apache/fop/fo/flow/Block.java b/src/org/apache/fop/fo/flow/Block.java index e88e1f844..62ff92594 100644 --- a/src/org/apache/fop/fo/flow/Block.java +++ b/src/org/apache/fop/fo/flow/Block.java @@ -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()); diff --git a/src/org/apache/fop/fo/flow/BlockContainer.java b/src/org/apache/fop/fo/flow/BlockContainer.java index 2397f4c97..c8b8ae234 100644 --- a/src/org/apache/fop/fo/flow/BlockContainer.java +++ b/src/org/apache/fop/fo/flow/BlockContainer.java @@ -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 . For more information on the Apache - Software Foundation, please see . - +//-- $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++) { diff --git a/src/org/apache/fop/fo/flow/Character.java b/src/org/apache/fop/fo/flow/Character.java index 0216476d4..d8b4a6377 100644 --- a/src/org/apache/fop/fo/flow/Character.java +++ b/src/org/apache/fop/fo/flow/Character.java @@ -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); diff --git a/src/org/apache/fop/fo/flow/ExternalGraphic.java b/src/org/apache/fop/fo/flow/ExternalGraphic.java index c67f4f189..46c6be514 100644 --- a/src/org/apache/fop/fo/flow/ExternalGraphic.java +++ b/src/org/apache/fop/fo/flow/ExternalGraphic.java @@ -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)) { diff --git a/src/org/apache/fop/fo/flow/FootnoteBody.java b/src/org/apache/fop/fo/flow/FootnoteBody.java index 3ec00bbe0..4b5e95c6c 100644 --- a/src/org/apache/fop/fo/flow/FootnoteBody.java +++ b/src/org/apache/fop/fo/flow/FootnoteBody.java @@ -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); + } } diff --git a/src/org/apache/fop/fo/flow/InlineGraphic.java b/src/org/apache/fop/fo/flow/InlineGraphic.java index 5ed0edfe9..68913fd1f 100644 --- a/src/org/apache/fop/fo/flow/InlineGraphic.java +++ b/src/org/apache/fop/fo/flow/InlineGraphic.java @@ -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, diff --git a/src/org/apache/fop/fo/flow/InstreamForeignObject.java b/src/org/apache/fop/fo/flow/InstreamForeignObject.java index c7c109971..c173ad7b7 100644 --- a/src/org/apache/fop/fo/flow/InstreamForeignObject.java +++ b/src/org/apache/fop/fo/flow/InstreamForeignObject.java @@ -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); diff --git a/src/org/apache/fop/fo/flow/Leader.java b/src/org/apache/fop/fo/flow/Leader.java index 8a6842799..4599509d3 100644 --- a/src/org/apache/fop/fo/flow/Leader.java +++ b/src/org/apache/fop/fo/flow/Leader.java @@ -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, diff --git a/src/org/apache/fop/fo/flow/ListBlock.java b/src/org/apache/fop/fo/flow/ListBlock.java index b5ce9f2ad..e7fbd4ed1 100644 --- a/src/org/apache/fop/fo/flow/ListBlock.java +++ b/src/org/apache/fop/fo/flow/ListBlock.java @@ -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()); diff --git a/src/org/apache/fop/fo/flow/ListItem.java b/src/org/apache/fop/fo/flow/ListItem.java index 4d80641df..8cd89b038 100644 --- a/src/org/apache/fop/fo/flow/ListItem.java +++ b/src/org/apache/fop/fo/flow/ListItem.java @@ -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()); diff --git a/src/org/apache/fop/fo/flow/PageNumber.java b/src/org/apache/fop/fo/flow/PageNumber.java index dc4a3bc82..8138828ff 100644 --- a/src/org/apache/fop/fo/flow/PageNumber.java +++ b/src/org/apache/fop/fo/flow/PageNumber.java @@ -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); diff --git a/src/org/apache/fop/fo/flow/PageNumberCitation.java b/src/org/apache/fop/fo/flow/PageNumberCitation.java index e24a253c0..c3b6d664b 100644 --- a/src/org/apache/fop/fo/flow/PageNumberCitation.java +++ b/src/org/apache/fop/fo/flow/PageNumberCitation.java @@ -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); diff --git a/src/org/apache/fop/fo/flow/Table.java b/src/org/apache/fop/fo/flow/Table.java index 279e7c4c1..3c4afdf77 100644 --- a/src/org/apache/fop/fo/flow/Table.java +++ b/src/org/apache/fop/fo/flow/Table.java @@ -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()); diff --git a/src/org/apache/fop/fo/flow/TableBody.java b/src/org/apache/fop/fo/flow/TableBody.java index 6e4661fce..c9e6b28d0 100644 --- a/src/org/apache/fop/fo/flow/TableBody.java +++ b/src/org/apache/fop/fo/flow/TableBody.java @@ -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()); diff --git a/src/org/apache/fop/fo/flow/TableCell.java b/src/org/apache/fop/fo/flow/TableCell.java index 0849c24d9..311fca76e 100644 --- a/src/org/apache/fop/fo/flow/TableCell.java +++ b/src/org/apache/fop/fo/flow/TableCell.java @@ -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()); diff --git a/src/org/apache/fop/fo/flow/TableColumn.java b/src/org/apache/fop/fo/flow/TableColumn.java index a2430dc73..8f0167103 100644 --- a/src/org/apache/fop/fo/flow/TableColumn.java +++ b/src/org/apache/fop/fo/flow/TableColumn.java @@ -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); diff --git a/src/org/apache/fop/fo/flow/TableRow.java b/src/org/apache/fop/fo/flow/TableRow.java index ab6b6ba73..063eec1d9 100644 --- a/src/org/apache/fop/fo/flow/TableRow.java +++ b/src/org/apache/fop/fo/flow/TableRow.java @@ -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);