/* nominal font size and nominal font family incorporated in
fontState */
protected FontState fontState;
+ protected BorderAndPadding bp=null;
protected Vector children = new Vector();
protected ColorType backgroundColor;
private IDReferences idReferences;
- protected int paddingTop;
- protected int paddingLeft;
- protected int paddingBottom;
- protected int paddingRight;
/* author : Seshadri G
** the fo which created it */
public org.apache.fop.fo.FObj foCreator;
- public int borderWidthTop;
- public int borderWidthLeft;
- public int borderWidthRight;
- public int borderWidthBottom;
- public int borderStyleTop;
- public int borderStyleLeft;
- public int borderStyleRight;
- public int borderStyleBottom;
- public ColorType borderColorTop;
- public ColorType borderColorLeft;
- public ColorType borderColorRight;
- public ColorType borderColorBottom;
-
public Area (FontState fontState) {
- this.fontState = fontState;
+ setFontState(fontState);
}
public Area (FontState fontState, int allocationWidth, int maxHeight) {
- this.fontState = fontState;
+ setFontState(fontState);
this.allocationWidth = allocationWidth;
this.contentRectangleWidth = allocationWidth;
this.maxHeight = maxHeight;
}
+ private void setFontState(FontState fontState) {
+ // fontState.setFontInfo(this.page.getFontInfo());
+ this.fontState = fontState;
+ }
public void addChild(Box child) {
this.children.addElement(child);
child.parent = this;
}
public int getAllocationWidth() {
- return this.allocationWidth - paddingLeft - paddingRight -
- borderWidthLeft - borderWidthRight;
+ /* ATTENTION: this may change your output!! (Karen Lease, 4mar2001)
+ return this.allocationWidth - getPaddingLeft() - getPaddingRight()
+ - getBorderLeftWidth() - getBorderRightWidth();
+ */
+ return this.allocationWidth ;
}
public void setAllocationWidth(int w) {
}
public int getContentWidth() {
- return contentRectangleWidth - paddingLeft - paddingRight -
- borderWidthLeft - borderWidthRight;
+ /* ATTENTION: this may change your output!! (Karen Lease, 4mar2001)
+ return contentRectangleWidth - getPaddingLeft() - getPaddingRight()
+ - getBorderLeftWidth() - getBorderRightWidth();
+ */
+ return contentRectangleWidth ;
}
public FontState getFontState() {
}
public int getHeight() {
- return this.currentHeight + paddingTop + paddingBottom +
- borderWidthTop + borderWidthBottom;
+ return this.currentHeight + getPaddingTop() + getPaddingBottom() +
+ getBorderTopWidth() + getBorderBottomWidth();
}
public int getMaxHeight() {
- return this.maxHeight - paddingTop - paddingBottom -
- borderWidthTop - borderWidthBottom;
+ return this.maxHeight - getPaddingTop() - getPaddingBottom() -
+ getBorderTopWidth() - getBorderBottomWidth();
}
public Page getPage() {
return this.backgroundColor;
}
+ // Must handle conditionality here, depending on isLast/isFirst
public int getPaddingTop() {
- return this.paddingTop;
+ return (bp==null? 0 : bp.getPaddingTop(false));
}
public int getPaddingLeft() {
- return this.paddingLeft;
+ return(bp==null? 0 : bp.getPaddingLeft(false));
}
public int getPaddingBottom() {
- return this.paddingBottom;
+ return (bp==null? 0 : bp.getPaddingBottom(false));
}
public int getPaddingRight() {
- return this.paddingRight;
+ return (bp==null? 0 : bp.getPaddingRight(false));
+ }
+
+ // Handle border-width, including conditionality
+ // For now, just pass false everywhere!
+ public int getBorderTopWidth() {
+ return (bp==null? 0 : bp.getBorderTopWidth(false));
+ }
+
+ public int getBorderRightWidth() {
+ return (bp==null? 0 : bp.getBorderRightWidth(false));
+ }
+
+ public int getBorderLeftWidth() {
+ return (bp==null? 0 : bp.getBorderLeftWidth(false));
+ }
+
+ public int getBorderBottomWidth() {
+ return (bp==null? 0 : bp.getBorderBottomWidth(false));
}
public int getTableCellXOffset() {
this.backgroundColor = bgColor;
}
- public void setPadding(int top, int left, int bottom, int right) {
- this.paddingTop = top;
- this.paddingLeft = left;
- this.paddingBottom = bottom;
- this.paddingRight = right;
- }
-
- public void setBorderWidth(int top, int left, int bottom, int right) {
- this.borderWidthTop = top;
- this.borderWidthLeft = left;
- this.borderWidthBottom = bottom;
- this.borderWidthRight = right;
- }
-
- public void setBorderStyle(int top, int left, int bottom, int right) {
- this.borderStyleTop = top;
- this.borderStyleLeft = left;
- this.borderStyleBottom = bottom;
- this.borderStyleRight = right;
- }
-
- public void setBorderColor(ColorType top, ColorType left,
- ColorType bottom, ColorType right) {
- this.borderColorTop = top;
- this.borderColorLeft = left;
- this.borderColorBottom = bottom;
- this.borderColorRight = right;
+ public void setBorderAndPadding(BorderAndPadding bp) {
+ this.bp = bp;
}
public int spaceLeft() {
}
return (AreaContainer)area;
}
+
+ public BorderAndPadding getBorderAndPadding() {
+ return bp;
+ }
}
}
public int getXPosition() {
- return xPosition + this.paddingLeft + this.borderWidthLeft;
+ return xPosition + getPaddingLeft() + getBorderLeftWidth();
}
public void setXPosition(int value) {
}
public int getYPosition() {
- return yPosition + this.paddingTop + this.borderWidthTop;
+ return yPosition + getPaddingTop() + getBorderTopWidth();
}
public int getCurrentYPosition() {
this.addChild(footnoteReferenceArea);
// all padding and border-width must be 0
- setPadding(0, 0, 0, 0);
- setBorderWidth(0, 0, 0, 0);
+ //setBorderAndPadding(new BorderAndPadding());
+ // setPadding(0, 0, 0, 0);
+ // setBorderWidth(0, 0, 0, 0);
}
public void render(Renderer renderer) {
}
public int getXPosition() {
- return xPosition + this.paddingLeft + this.borderWidthLeft;
+ return xPosition + getPaddingLeft() + getBorderLeftWidth();
}
public void setXPosition(int value)
}
public int getYPosition() {
- return yPosition + this.paddingTop + this.borderWidthTop;
+ return yPosition + getPaddingTop() + getBorderTopWidth();
}
public void setYPosition(int value)
--- /dev/null
+/*-- $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.layout;
+
+
+import org.apache.fop.datatypes.ColorType;
+import org.apache.fop.datatypes.CondLength;
+
+public class BorderAndPadding {
+
+ public static final int TOP=0;
+ public static final int RIGHT=1;
+ public static final int BOTTOM=2;
+ public static final int LEFT=3;
+
+ public static class BorderInfo {
+ private int mStyle; // Enum for border style
+ private CondLength mWidth;
+ private ColorType mColor; // Border color
+
+ BorderInfo(int style, CondLength width, ColorType color) {
+ mStyle = style;
+ mWidth = width;
+ mColor = color;
+ }
+ }
+
+ private BorderInfo[] borderInfo = new BorderInfo[4];
+ private CondLength[] padding = new CondLength[4];
+
+ public BorderAndPadding() {
+ }
+
+ public void setBorder(int side, int style, CondLength width, ColorType color ) {
+ borderInfo[side] = new BorderInfo(style, width, color);
+ }
+
+ public void setPadding(int side, CondLength width ) {
+ padding[side] = width;
+ }
+
+ public int getBorderLeftWidth(boolean bDiscard) {
+ return getBorderWidth(LEFT, bDiscard);
+ }
+
+ public int getBorderRightWidth(boolean bDiscard) {
+ return getBorderWidth(RIGHT, bDiscard);
+ }
+
+ public int getBorderTopWidth(boolean bDiscard) {
+ return getBorderWidth(TOP, bDiscard);
+ }
+
+ public int getBorderBottomWidth(boolean bDiscard) {
+ return getBorderWidth(BOTTOM, bDiscard);
+ }
+
+ public int getPaddingLeft(boolean bDiscard) {
+ return getPadding(LEFT, bDiscard);
+ }
+
+ public int getPaddingRight(boolean bDiscard) {
+ return getPadding(RIGHT, bDiscard);
+ }
+
+ public int getPaddingBottom(boolean bDiscard) {
+ return getPadding(BOTTOM, bDiscard);
+ }
+
+ public int getPaddingTop(boolean bDiscard) {
+ return getPadding(TOP, bDiscard);
+ }
+
+
+ private int getBorderWidth(int side, boolean bDiscard) {
+ if ((borderInfo[side] == null) ||
+ (bDiscard && borderInfo[side].mWidth.isDiscard())) {
+ return 0;
+ }
+ else return borderInfo[side].mWidth.mvalue();
+ }
+
+ public ColorType getBorderColor(int side) {
+ if (borderInfo[side] != null) {
+ return borderInfo[side].mColor;
+ }
+ else return null;
+ }
+
+ public int getBorderStyle(int side) {
+ if (borderInfo[side] != null) {
+ return borderInfo[side].mStyle;
+ }
+ else return 0;
+ }
+
+ private int getPadding(int side, boolean bDiscard) {
+ if ((padding[side] == null) ||
+ (bDiscard && padding[side].isDiscard())) {
+ return 0;
+ }
+ else return padding[side].mvalue();
+ }
+}
--- /dev/null
+/*-- $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/>.
+
+ */
+
+package org.apache.fop.layout;
+
+
+/**
+ * Store all hyphenation related properties on an FO.
+ * Public "structure" allows direct member access.
+ */
+public class HyphenationProps {
+ public int hyphenate; // Enum true or false: store as boolean!
+ public char hyphenationChar;
+ public int hyphenationPushCharacterCount;
+ public int hyphenationRemainCharacterCount;
+ public String language; // Language code or enum "NONE"
+ public String country; // Country code or enum "NONE"
+
+ public HyphenationProps() {
+ }
+}