import java.util.Iterator;
import org.apache.fop.datatypes.FODimension;
-import org.apache.fop.datatypes.PercentBase;
+import org.apache.fop.datatypes.LengthBase;
+import org.apache.fop.datatypes.PercentBaseContext;
+import org.apache.fop.datatypes.SimplePercentBaseContext;
import org.apache.fop.fo.Constants;
import org.apache.fop.fo.pagination.Region;
import org.apache.fop.fo.pagination.RegionBody;
* page-reference-area
*/
public Page(SimplePageMaster spm) {
- int pageWidth = spm.getPageWidth().getValue();
- int pageHeight = spm.getPageHeight().getValue();
+ // Width and Height of the page view port
+ FODimension pageViewPortDims = new FODimension(spm.getPageWidth().getValue()
+ , spm.getPageHeight().getValue());
// Get absolute margin properties (top, left, bottom, right)
CommonMarginBlock mProps = spm.getCommonMarginBlock();
-
+
/*
* Create the page reference area rectangle (0,0 is at top left
* of the "page media" and y increases
* when moving towards the bottom of the page.
* The media rectangle itself is (0,0,pageWidth,pageHeight).
*/
+ /* Special rules apply to resolving margins in the page context.
+ * Contrary to normal margins in this case top and bottom margin
+ * are resolved relative to the height. In the property subsystem
+ * all margin properties are configured to using BLOCK_WIDTH.
+ * That's why we 'cheat' here and setup a context for the height but
+ * use the LengthBase.BLOCK_WIDTH.
+ */
+ SimplePercentBaseContext pageWidthContext
+ = new SimplePercentBaseContext(null, LengthBase.CONTAINING_BLOCK_WIDTH, pageViewPortDims.ipd);
+ SimplePercentBaseContext pageHeightContext
+ = new SimplePercentBaseContext(null, LengthBase.CONTAINING_BLOCK_WIDTH, pageViewPortDims.bpd);
+
Rectangle pageRefRect =
- new Rectangle(mProps.marginLeft.getValue(), mProps.marginTop.getValue(),
- pageWidth - mProps.marginLeft.getValue() - mProps.marginRight.getValue(),
- pageHeight - mProps.marginTop.getValue() - mProps.marginBottom.getValue());
+ new Rectangle(mProps.marginLeft.getValue(pageWidthContext), mProps.marginTop.getValue(pageHeightContext),
+ pageViewPortDims.ipd - mProps.marginLeft.getValue(pageWidthContext) - mProps.marginRight.getValue(pageWidthContext),
+ pageViewPortDims.bpd - mProps.marginTop.getValue(pageHeightContext) - mProps.marginBottom.getValue(pageHeightContext));
// Set up the CTM on the page reference area based on writing-mode
// and reference-orientation
for (Iterator regenum = spm.getRegions().values().iterator();
regenum.hasNext();) {
Region r = (Region)regenum.next();
- RegionViewport rvp = makeRegionViewport(r, reldims, pageCTM);
- r.setLayoutDimension(PercentBase.BLOCK_IPD, rvp.getIPD());
- r.setLayoutDimension(PercentBase.BLOCK_BPD, rvp.getBPD());
+ RegionViewport rvp = makeRegionViewport(r, reldims, pageCTM, pageViewPortDims);
if (r.getNameId() == Constants.FO_REGION_BODY) {
rr = new BodyRegion((RegionBody) r, rvp);
} else {
* @param pageCTM page coordinate transformation matrix
* @return the new region viewport
*/
- private RegionViewport makeRegionViewport(Region r, FODimension reldims, CTM pageCTM) {
- Rectangle2D relRegionRect = r.getViewportRectangle(reldims);
+ private RegionViewport makeRegionViewport(Region r, FODimension reldims, CTM pageCTM,
+ FODimension pageViewPortDims) {
+ Rectangle2D relRegionRect = r.getViewportRectangle(reldims, pageViewPortDims);
Rectangle2D absRegionRect = pageCTM.transform(relRegionRect);
// Get the region viewport rectangle in absolute coords by
// transforming it using the page CTM
RegionViewport rv = new RegionViewport(absRegionRect);
rv.setBPD((int)relRegionRect.getHeight());
rv.setIPD((int)relRegionRect.getWidth());
- TraitSetter.addBackground(rv, r.getCommonBorderPaddingBackground());
+ TraitSetter.addBackground(rv, r.getCommonBorderPaddingBackground(), null);
rv.setClip(r.getOverflow() == Constants.EN_HIDDEN
|| r.getOverflow() == Constants.EN_ERROR_IF_OVERFLOW);
return rv;
public HashMap getUnresolvedReferences() {
return unresolved;
}
+
}
* @return the length in millipoints
*/
public int getValue();
+
+ /**
+ * Returns the length in 1/1000ths of a point (millipoints)
+ * @param context The context for the length calculation (for percentage based lengths)
+ * @return the length in millipoints
+ */
+ public int getValue(PercentBaseContext context);
+
}
/** constant for an inh font-size percent-based length */
public static final int INH_FONTSIZE = 2;
/** constant for a containing box percent-based length */
- public static final int CONTAINING_BOX = 3;
+ public static final int PARENT_AREA_WIDTH = 3;
/** constant for a containing refarea percent-based length */
- public static final int CONTAINING_REFAREA = 4;
+ public static final int CONTAINING_REFAREA_WIDTH = 4;
/** constant for a containing block percent-based length */
- public static final int BLOCK_WIDTH = 5;
+ public static final int CONTAINING_BLOCK_WIDTH = 5;
/** constant for a containing block percent-based length */
- public static final int BLOCK_HEIGHT = 6;
+ public static final int CONTAINING_BLOCK_HEIGHT = 6;
/** constant for a image intrinsic percent-based length */
public static final int IMAGE_INTRINSIC_WIDTH = 7;
/** constant for a image intrinsic percent-based length */
public static final int IMAGE_INTRINSIC_HEIGHT = 8;
+ /** constant for a image background position horizontal percent-based length */
+ public static final int IMAGE_BACKGROUND_POSITION_HORIZONTAL = 9;
+ /** constant for a image background position vertical percent-based length */
+ public static final int IMAGE_BACKGROUND_POSITION_VERTICAL = 10;
/** array of valid percent-based length types */
public static final int[] PERCENT_BASED_LENGTH_TYPES
- = {CUSTOM_BASE, FONTSIZE, INH_FONTSIZE, CONTAINING_BOX,
- CONTAINING_REFAREA,
- IMAGE_INTRINSIC_WIDTH, IMAGE_INTRINSIC_HEIGHT};
+ = {CUSTOM_BASE, FONTSIZE, INH_FONTSIZE, PARENT_AREA_WIDTH,
+ CONTAINING_REFAREA_WIDTH,
+ IMAGE_INTRINSIC_WIDTH, IMAGE_INTRINSIC_HEIGHT,
+ IMAGE_BACKGROUND_POSITION_HORIZONTAL, IMAGE_BACKGROUND_POSITION_VERTICAL
+ };
/**
- * FO parent of the FO for which this property is to be calculated.
+ * The FO for which this property is to be calculated.
*/
- protected /* final */ FObj parentFO;
-
- /**
- * PropertyList for the FO where this property is calculated.
- */
- private /* final */ PropertyList propertyList;
+ protected /* final */ FObj fobj;
/**
* One of the defined types of LengthBase
*/
private /* final */ int iBaseType;
+ private Length fontSize;
+
/**
* Constructor
* @param parentFO parent FO for this
* @param plist property list for this
* @param iBaseType a member of {@link #PERCENT_BASED_LENGTH_TYPES}
*/
- public LengthBase(FObj parentFO, PropertyList plist, int iBaseType) {
- this.parentFO = parentFO;
- this.propertyList = plist;
+ public LengthBase(FObj parentFO, PropertyList plist, int iBaseType) throws PropertyException {
+ this.fobj = plist.getFObj();
this.iBaseType = iBaseType;
- }
-
- /**
- * Accessor for parentFO object from subclasses which define
- * custom kinds of LengthBase calculations.
- * @return this object's parent FO
- */
- protected FObj getParentFO() {
- return parentFO;
- }
-
- /**
- * Accessor for propertyList object from subclasses which define
- * custom kinds of LengthBase calculations.
- * @return this object's PropertyList
- */
- protected PropertyList getPropertyList() {
- return propertyList;
+ switch (iBaseType) {
+ case FONTSIZE:
+ this.fontSize = plist.get(Constants.PR_FONT_SIZE).getLength();
+ break;
+ case INH_FONTSIZE:
+ this.fontSize = plist.getInherited(Constants.PR_FONT_SIZE).getLength();
+ break;
+ }
}
/**
}
/** @see org.apache.fop.datatypes.PercentBase#getBaseLength() */
- public int getBaseLength() throws PropertyException {
- //TODO Don't use propertyList here
- //See http://nagoya.apache.org/eyebrowse/ReadMsg?listName=fop-dev@xml.apache.org&msgNo=10342
- switch (iBaseType) {
- case FONTSIZE:
- return propertyList.get(Constants.PR_FONT_SIZE).getLength().getValue();
- case INH_FONTSIZE:
- return propertyList.getInherited(Constants.PR_FONT_SIZE).getLength().getValue();
- case BLOCK_WIDTH:
- return parentFO.getLayoutDimension(PercentBase.BLOCK_IPD).intValue();
- case BLOCK_HEIGHT:
- return parentFO.getLayoutDimension(PercentBase.BLOCK_BPD).intValue();
- case CONTAINING_REFAREA: // example: start-indent, end-indent
- FObj fo;
- fo = parentFO;
- while (fo != null && !fo.generatesReferenceAreas()) {
- fo = fo.findNearestAncestorFObj();
- }
- if (fo != null && fo instanceof FObj) {
- return fo.getLayoutDimension(PercentBase.BLOCK_IPD).intValue();
- } else {
- return 0;
+ public int getBaseLength(PercentBaseContext context) throws PropertyException {
+ int baseLength = 0;
+ if (context != null) {
+ if (iBaseType == FONTSIZE || iBaseType == INH_FONTSIZE) {
+ return fontSize.getValue(context);
}
- case IMAGE_INTRINSIC_WIDTH:
- return propertyList.getFObj()
- .getLayoutDimension(PercentBase.IMAGE_INTRINSIC_WIDTH).intValue();
- case IMAGE_INTRINSIC_HEIGHT:
- return propertyList.getFObj()
- .getLayoutDimension(PercentBase.IMAGE_INTRINSIC_HEIGHT).intValue();
- case CUSTOM_BASE:
- //log.debug("!!! LengthBase.getBaseLength() called on CUSTOM_BASE type !!!");
- return 0;
- default:
- parentFO.getLogger().error("Unknown base type for LengthBase.");
- return 0;
+ baseLength = context.getBaseLength(iBaseType, fobj);
+ } else {
+ fobj.getLogger().error("getBaseLength called without context");
}
+ return baseLength;
}
}
*/
double getNumericValue() throws PropertyException;
+ /**
+ * Return the value of this Numeric
+ * @param context The context for the length calculation (for percentage based lengths)
+ * @return the computed value.
+ * @throws PropertyException
+ */
+ double getNumericValue(PercentBaseContext context) throws PropertyException;
+
/**
* Return the dimension of this numeric. Plain numbers has a dimension of
* 0 and length has a dimension of 1. Other dimension can occur as a result
*/
public int getValue();
+ /**
+ * Returns the value of this numeric as an int.
+ * @param conext The context for the length calculation (for percentage based lengths)
+ * @return the value as an integer.
+ */
+ public int getValue(PercentBaseContext context);
+
/**
* Return the resolved value. This method will becalled during evaluation
* of the expression tree and relative numerics can then return a
/** table units */
LayoutDimension TABLE_UNITS = new LayoutDimension("table-units");
- /** Block IPD */
- LayoutDimension BLOCK_IPD = new LayoutDimension("block-ipd");
- /** Block BPD */
- LayoutDimension BLOCK_BPD = new LayoutDimension("block-bpd");
- /** Reference Area IPD */
- LayoutDimension REFERENCE_AREA_IPD = new LayoutDimension("reference-area-ipd");
- /** Reference Area BPD */
- LayoutDimension REFERENCE_AREA_BPD = new LayoutDimension("reference-area-bpd");
- /** Intrinsic width of an image or foreign-object */
- LayoutDimension IMAGE_INTRINSIC_WIDTH = new LayoutDimension("image-intrinsic-width");
- /** Intrinsic height of an image or foreign-object */
- LayoutDimension IMAGE_INTRINSIC_HEIGHT = new LayoutDimension("image-intrinsic-heigth");
/**
* Determines whether a numeric property is created or one with a percentage
double getBaseValue();
/**
+ * @param context The context for percentage evaluation
* @return the integer size in millipoints of the object (this will be used
* as the base to which a percentage will be applied to compute the length
* of the referencing item)
* @throws PropertyException if a problem occurs during evaluation of this
* value.
*/
- int getBaseLength() throws PropertyException;
+ int getBaseLength(PercentBaseContext context) throws PropertyException;
/** Enum class for dimension types. */
public class LayoutDimension {
--- /dev/null
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id $ */
+
+package org.apache.fop.datatypes;
+
+import org.apache.fop.fo.FObj;
+
+/**
+ * This interface is used by the layout managers to provide relevant information
+ * back to the property percentage resolution logic, that is
+ * the percentages based property getValue() functions expect an object implementing
+ * this interface as an argument.
+ */
+public interface PercentBaseContext {
+
+ /**
+ * Returns the base length for the given length base.
+ * Length base should be one of the constants defined in {@link LengthBase}.
+ * @param lengthBase Indicates which type of the base length value is to be returned
+ * @param fobj The FO object against which the percentage should be evaluated
+ * @return The base length value of the given kind
+ */
+ public int getBaseLength(int lengthBase, FObj fobj);
+
+}
--- /dev/null
+/*
+ * SimplePercentBaseContext.java
+ *
+ * Created on 29 August 2005, 17:02
+ *
+ * To change this template, choose Tools | Options and locate the template under
+ * the Source Creation and Management node. Right-click the template and choose
+ * Open. You can then make changes to the template in the Source Editor.
+ */
+
+package org.apache.fop.datatypes;
+
+import org.apache.fop.fo.FObj;
+
+/**
+ * Class to implement a simple lookup context for a single percent base value.
+ */
+public class SimplePercentBaseContext implements PercentBaseContext {
+
+ private PercentBaseContext parentContext;
+ private int lengthBase;
+ private int lengthBaseValue;
+
+ /**
+ * @param parentContext the context to be used for all percentages other than lengthBase
+ * @param lengthBase the particular percentage length base for which this context provides a value
+ * @param lengthBaseValue the value to be returned for requests to the given lengthBase
+ */
+ public SimplePercentBaseContext(PercentBaseContext parentContext,
+ int lengthBase,
+ int lengthBaseValue) {
+ this.parentContext = parentContext;
+ this.lengthBase = lengthBase;
+ this.lengthBaseValue = lengthBaseValue;
+ }
+
+ /**
+ * Returns the value for the given lengthBase.
+ * @see org.apache.fop.datatypes.PercentBaseContext#getBaseLength(int, fobj)
+ */
+ public int getBaseLength(int lengthBase, FObj fobj) {
+ // if its for us return our value otherwise delegate to parent context
+ if (lengthBase == this.lengthBase) {
+ return lengthBaseValue;
+ } else if (parentContext != null) {
+ return parentContext.getBaseLength(lengthBase, fobj);
+ }
+ return -1;
+ }
+
+}
/* $Id$ */
-
package org.apache.fop.fo;
+/**
+ * Definition of constants used throughout FOP.
+ * There are sets of constants describing:
+ * <ul>
+ * <li>Input and output formats</li>
+ * <li>Formatting objects</li>
+ * <li>Formatting properties</li>
+ * <li>Enumerated values used in formatting properties</li>
+ * </ul>
+ */
public interface Constants {
/* These constants are used by apps.CommandLineOptions and
/** render constants for bounds checking */
int RENDER_MIN_CONST = 1;
+ /** render constants for bounds checking */
int RENDER_MAX_CONST = 12;
/** input / output not set */
int NOT_SET = 0;
int RENDER_PNG = 12;
// element constants
- int FO_UNKNOWN_NODE = 0; // FObj base class
+ /** FObj base class */
+ int FO_UNKNOWN_NODE = 0;
+ /** FO element constant */
int FO_BASIC_LINK = 1;
+ /** FO element constant */
int FO_BIDI_OVERRIDE = 2;
+ /** FO element constant */
int FO_BLOCK = 3;
+ /** FO element constant */
int FO_BLOCK_CONTAINER = 4;
+ /** FO element constant */
int FO_CHARACTER = 5;
+ /** FO element constant */
int FO_COLOR_PROFILE = 6;
+ /** FO element constant */
int FO_CONDITIONAL_PAGE_MASTER_REFERENCE = 7;
+ /** FO element constant */
int FO_DECLARATIONS = 8;
+ /** FO element constant */
int FO_EXTERNAL_GRAPHIC = 9;
+ /** FO element constant */
int FO_FLOAT = 10;
+ /** FO element constant */
int FO_FLOW = 11;
+ /** FO element constant */
int FO_FOOTNOTE = 12;
+ /** FO element constant */
int FO_FOOTNOTE_BODY = 13;
+ /** FO element constant */
int FO_INITIAL_PROPERTY_SET = 14;
+ /** FO element constant */
int FO_INLINE = 15;
+ /** FO element constant */
int FO_INLINE_CONTAINER = 16;
+ /** FO element constant */
int FO_INSTREAM_FOREIGN_OBJECT = 17;
+ /** FO element constant */
int FO_LAYOUT_MASTER_SET = 18;
+ /** FO element constant */
int FO_LEADER = 19;
+ /** FO element constant */
int FO_LIST_BLOCK = 20;
+ /** FO element constant */
int FO_LIST_ITEM = 21;
+ /** FO element constant */
int FO_LIST_ITEM_BODY = 22;
+ /** FO element constant */
int FO_LIST_ITEM_LABEL = 23;
+ /** FO element constant */
int FO_MARKER = 24;
+ /** FO element constant */
int FO_MULTI_CASE = 25;
+ /** FO element constant */
int FO_MULTI_PROPERTIES = 26;
+ /** FO element constant */
int FO_MULTI_PROPERTY_SET = 27;
+ /** FO element constant */
int FO_MULTI_SWITCH = 28;
+ /** FO element constant */
int FO_MULTI_TOGGLE = 29;
+ /** FO element constant */
int FO_PAGE_NUMBER = 30;
+ /** FO element constant */
int FO_PAGE_NUMBER_CITATION = 31;
+ /** FO element constant */
int FO_PAGE_SEQUENCE = 32;
+ /** FO element constant */
int FO_PAGE_SEQUENCE_MASTER = 33;
+ /** FO element constant */
int FO_REGION_AFTER = 34;
+ /** FO element constant */
int FO_REGION_BEFORE = 35;
+ /** FO element constant */
int FO_REGION_BODY = 36;
+ /** FO element constant */
int FO_REGION_END = 37;
+ /** FO element constant */
int FO_REGION_START = 38;
+ /** FO element constant */
int FO_REPEATABLE_PAGE_MASTER_ALTERNATIVES = 39;
+ /** FO element constant */
int FO_REPEATABLE_PAGE_MASTER_REFERENCE = 40;
+ /** FO element constant */
int FO_RETRIEVE_MARKER = 41;
+ /** FO element constant */
int FO_ROOT = 42;
+ /** FO element constant */
int FO_SIMPLE_PAGE_MASTER = 43;
+ /** FO element constant */
int FO_SINGLE_PAGE_MASTER_REFERENCE = 44;
+ /** FO element constant */
int FO_STATIC_CONTENT = 45;
+ /** FO element constant */
int FO_TABLE = 46;
+ /** FO element constant */
int FO_TABLE_AND_CAPTION = 47;
+ /** FO element constant */
int FO_TABLE_BODY = 48;
+ /** FO element constant */
int FO_TABLE_CAPTION = 49;
+ /** FO element constant */
int FO_TABLE_CELL = 50;
+ /** FO element constant */
int FO_TABLE_COLUMN = 51;
+ /** FO element constant */
int FO_TABLE_FOOTER = 52;
+ /** FO element constant */
int FO_TABLE_HEADER = 53;
+ /** FO element constant */
int FO_TABLE_ROW = 54;
+ /** FO element constant */
int FO_TITLE = 55;
+ /** FO element constant */
int FO_WRAPPER = 56;
- int FO_BOOKMARK_TREE = 57; // XSL 1.1
- int FO_BOOKMARK = 58; // XSL 1.1
- int FO_BOOKMARK_TITLE = 59; // XSL 1.1
- int FO_PAGE_SEQUENCE_WRAPPER = 60; // XSL 1.1
+ /** FO element constant - XSL 1.1 */
+ int FO_BOOKMARK_TREE = 57;
+ /** FO element constant - XSL 1.1 */
+ int FO_BOOKMARK = 58;
+ /** FO element constant - XSL 1.1 */
+ int FO_BOOKMARK_TITLE = 59;
+ /** FO element constant - XSL 1.1 */
+ int FO_PAGE_SEQUENCE_WRAPPER = 60;
+ /** Number of FO element constants defined */
int FRM_OBJ_COUNT = 60;
// Masks
+ /**
+ * For compound properties the property constant value is shifted by this amount.
+ * The low order bits hold the constant for the component property.
+ */
int COMPOUND_SHIFT = 9;
- int PROPERTY_MASK = (1 << COMPOUND_SHIFT)-1;
+ /**
+ * Mask that when applied to a compound property returns the constant of
+ * the component property.
+ */
+ int PROPERTY_MASK = (1 << COMPOUND_SHIFT) - 1;
+ /**
+ * Mask that when applied to a compound property returns the constant of
+ * the compound property.
+ */
int COMPOUND_MASK = ~PROPERTY_MASK;
+ /** Number of compund properties defined */
int COMPOUND_COUNT = 11;
// property constants
+ /** Property constant */
int PR_ABSOLUTE_POSITION = 1;
+ /** Property constant */
int PR_ACTIVE_STATE = 2;
+ /** Property constant */
int PR_ALIGNMENT_ADJUST = 3;
+ /** Property constant */
int PR_ALIGNMENT_BASELINE = 4;
+ /** Property constant */
int PR_AUTO_RESTORE = 5;
+ /** Property constant */
int PR_AZIMUTH = 6;
+ /** Property constant */
int PR_BACKGROUND = 7;
+ /** Property constant */
int PR_BACKGROUND_ATTACHMENT = 8;
+ /** Property constant */
int PR_BACKGROUND_COLOR = 9;
+ /** Property constant */
int PR_BACKGROUND_IMAGE = 10;
+ /** Property constant */
int PR_BACKGROUND_POSITION = 11;
+ /** Property constant */
int PR_BACKGROUND_POSITION_HORIZONTAL = 12;
+ /** Property constant */
int PR_BACKGROUND_POSITION_VERTICAL = 13;
+ /** Property constant */
int PR_BACKGROUND_REPEAT = 14;
+ /** Property constant */
int PR_BASELINE_SHIFT = 15;
+ /** Property constant */
int PR_BLANK_OR_NOT_BLANK = 16;
+ /** Property constant */
int PR_BLOCK_PROGRESSION_DIMENSION = 17;
+ /** Property constant */
int PR_BORDER = 18;
+ /** Property constant */
int PR_BORDER_AFTER_COLOR = 19;
+ /** Property constant */
int PR_BORDER_AFTER_PRECEDENCE = 20;
+ /** Property constant */
int PR_BORDER_AFTER_STYLE = 21;
+ /** Property constant */
int PR_BORDER_AFTER_WIDTH = 22;
+ /** Property constant */
int PR_BORDER_BEFORE_COLOR = 23;
+ /** Property constant */
int PR_BORDER_BEFORE_PRECEDENCE = 24;
+ /** Property constant */
int PR_BORDER_BEFORE_STYLE = 25;
+ /** Property constant */
int PR_BORDER_BEFORE_WIDTH = 26;
+ /** Property constant */
int PR_BORDER_BOTTOM = 27;
+ /** Property constant */
int PR_BORDER_BOTTOM_COLOR = 28;
+ /** Property constant */
int PR_BORDER_BOTTOM_STYLE = 29;
+ /** Property constant */
int PR_BORDER_BOTTOM_WIDTH = 30;
+ /** Property constant */
int PR_BORDER_COLLAPSE = 31;
+ /** Property constant */
int PR_BORDER_COLOR = 32;
+ /** Property constant */
int PR_BORDER_END_COLOR = 33;
+ /** Property constant */
int PR_BORDER_END_PRECEDENCE = 34;
+ /** Property constant */
int PR_BORDER_END_STYLE = 35;
+ /** Property constant */
int PR_BORDER_END_WIDTH = 36;
+ /** Property constant */
int PR_BORDER_LEFT = 37;
+ /** Property constant */
int PR_BORDER_LEFT_COLOR = 38;
+ /** Property constant */
int PR_BORDER_LEFT_STYLE = 39;
+ /** Property constant */
int PR_BORDER_LEFT_WIDTH = 40;
+ /** Property constant */
int PR_BORDER_RIGHT = 41;
+ /** Property constant */
int PR_BORDER_RIGHT_COLOR = 42;
+ /** Property constant */
int PR_BORDER_RIGHT_STYLE = 43;
+ /** Property constant */
int PR_BORDER_RIGHT_WIDTH = 44;
+ /** Property constant */
int PR_BORDER_SEPARATION = 45;
+ /** Property constant */
int PR_BORDER_SPACING = 46;
+ /** Property constant */
int PR_BORDER_START_COLOR = 47;
+ /** Property constant */
int PR_BORDER_START_PRECEDENCE = 48;
+ /** Property constant */
int PR_BORDER_START_STYLE = 49;
+ /** Property constant */
int PR_BORDER_START_WIDTH = 50;
+ /** Property constant */
int PR_BORDER_STYLE = 51;
+ /** Property constant */
int PR_BORDER_TOP = 52;
+ /** Property constant */
int PR_BORDER_TOP_COLOR = 53;
+ /** Property constant */
int PR_BORDER_TOP_STYLE = 54;
+ /** Property constant */
int PR_BORDER_TOP_WIDTH = 55;
+ /** Property constant */
int PR_BORDER_WIDTH = 56;
+ /** Property constant */
int PR_BOTTOM = 57;
+ /** Property constant */
int PR_BREAK_AFTER = 58;
+ /** Property constant */
int PR_BREAK_BEFORE = 59;
+ /** Property constant */
int PR_CAPTION_SIDE = 60;
+ /** Property constant */
int PR_CASE_NAME = 61;
+ /** Property constant */
int PR_CASE_TITLE = 62;
+ /** Property constant */
int PR_CHARACTER = 63;
+ /** Property constant */
int PR_CLEAR = 64;
+ /** Property constant */
int PR_CLIP = 65;
+ /** Property constant */
int PR_COLOR = 66;
+ /** Property constant */
int PR_COLOR_PROFILE_NAME = 67;
+ /** Property constant */
int PR_COLUMN_COUNT = 68;
+ /** Property constant */
int PR_COLUMN_GAP = 69;
+ /** Property constant */
int PR_COLUMN_NUMBER = 70;
+ /** Property constant */
int PR_COLUMN_WIDTH = 71;
+ /** Property constant */
int PR_CONTENT_HEIGHT = 72;
+ /** Property constant */
int PR_CONTENT_TYPE = 73;
+ /** Property constant */
int PR_CONTENT_WIDTH = 74;
+ /** Property constant */
int PR_COUNTRY = 75;
+ /** Property constant */
int PR_CUE = 76;
+ /** Property constant */
int PR_CUE_AFTER = 77;
+ /** Property constant */
int PR_CUE_BEFORE = 78;
+ /** Property constant */
int PR_DESTINATION_PLACEMENT_OFFSET = 79;
+ /** Property constant */
int PR_DIRECTION = 80;
+ /** Property constant */
int PR_DISPLAY_ALIGN = 81;
+ /** Property constant */
int PR_DOMINANT_BASELINE = 82;
+ /** Property constant */
int PR_ELEVATION = 83;
+ /** Property constant */
int PR_EMPTY_CELLS = 84;
+ /** Property constant */
int PR_END_INDENT = 85;
+ /** Property constant */
int PR_ENDS_ROW = 86;
+ /** Property constant */
int PR_EXTENT = 87;
+ /** Property constant */
int PR_EXTERNAL_DESTINATION = 88;
+ /** Property constant */
int PR_FLOAT = 89;
+ /** Property constant */
int PR_FLOW_NAME = 90;
+ /** Property constant */
int PR_FONT = 91;
+ /** Property constant */
int PR_FONT_FAMILY = 92;
+ /** Property constant */
int PR_FONT_SELECTION_STRATEGY = 93;
+ /** Property constant */
int PR_FONT_SIZE = 94;
+ /** Property constant */
int PR_FONT_SIZE_ADJUST = 95;
+ /** Property constant */
int PR_FONT_STRETCH = 96;
+ /** Property constant */
int PR_FONT_STYLE = 97;
+ /** Property constant */
int PR_FONT_VARIANT = 98;
+ /** Property constant */
int PR_FONT_WEIGHT = 99;
+ /** Property constant */
int PR_FORCE_PAGE_COUNT = 100;
+ /** Property constant */
int PR_FORMAT = 101;
+ /** Property constant */
int PR_GLYPH_ORIENTATION_HORIZONTAL = 102;
+ /** Property constant */
int PR_GLYPH_ORIENTATION_VERTICAL = 103;
+ /** Property constant */
int PR_GROUPING_SEPARATOR = 104;
+ /** Property constant */
int PR_GROUPING_SIZE = 105;
+ /** Property constant */
int PR_HEIGHT = 106;
+ /** Property constant */
int PR_HYPHENATE = 107;
+ /** Property constant */
int PR_HYPHENATION_CHARACTER = 108;
+ /** Property constant */
int PR_HYPHENATION_KEEP = 109;
+ /** Property constant */
int PR_HYPHENATION_LADDER_COUNT = 110;
+ /** Property constant */
int PR_HYPHENATION_PUSH_CHARACTER_COUNT = 111;
+ /** Property constant */
int PR_HYPHENATION_REMAIN_CHARACTER_COUNT = 112;
+ /** Property constant */
int PR_ID = 113;
+ /** Property constant */
int PR_INDICATE_DESTINATION = 114;
+ /** Property constant */
int PR_INITIAL_PAGE_NUMBER = 115;
+ /** Property constant */
int PR_INLINE_PROGRESSION_DIMENSION = 116;
+ /** Property constant */
int PR_INTERNAL_DESTINATION = 117;
+ /** Property constant */
int PR_KEEP_TOGETHER = 118;
+ /** Property constant */
int PR_KEEP_WITH_NEXT = 119;
+ /** Property constant */
int PR_KEEP_WITH_PREVIOUS = 120;
+ /** Property constant */
int PR_LANGUAGE = 121;
+ /** Property constant */
int PR_LAST_LINE_END_INDENT = 122;
+ /** Property constant */
int PR_LEADER_ALIGNMENT = 123;
+ /** Property constant */
int PR_LEADER_LENGTH = 124;
+ /** Property constant */
int PR_LEADER_PATTERN = 125;
+ /** Property constant */
int PR_LEADER_PATTERN_WIDTH = 126;
+ /** Property constant */
int PR_LEFT = 127;
+ /** Property constant */
int PR_LETTER_SPACING = 128;
+ /** Property constant */
int PR_LETTER_VALUE = 129;
+ /** Property constant */
int PR_LINEFEED_TREATMENT = 130;
+ /** Property constant */
int PR_LINE_HEIGHT = 131;
+ /** Property constant */
int PR_LINE_HEIGHT_SHIFT_ADJUSTMENT = 132;
+ /** Property constant */
int PR_LINE_STACKING_STRATEGY = 133;
+ /** Property constant */
int PR_MARGIN = 134;
+ /** Property constant */
int PR_MARGIN_BOTTOM = 135;
+ /** Property constant */
int PR_MARGIN_LEFT = 136;
+ /** Property constant */
int PR_MARGIN_RIGHT = 137;
+ /** Property constant */
int PR_MARGIN_TOP = 138;
+ /** Property constant */
int PR_MARKER_CLASS_NAME = 139;
+ /** Property constant */
int PR_MASTER_NAME = 140;
+ /** Property constant */
int PR_MASTER_REFERENCE = 141;
+ /** Property constant */
int PR_MAX_HEIGHT = 142;
+ /** Property constant */
int PR_MAXIMUM_REPEATS = 143;
+ /** Property constant */
int PR_MAX_WIDTH = 144;
+ /** Property constant */
int PR_MEDIA_USAGE = 145;
+ /** Property constant */
int PR_MIN_HEIGHT = 146;
+ /** Property constant */
int PR_MIN_WIDTH = 147;
+ /** Property constant */
int PR_NUMBER_COLUMNS_REPEATED = 148;
+ /** Property constant */
int PR_NUMBER_COLUMNS_SPANNED = 149;
+ /** Property constant */
int PR_NUMBER_ROWS_SPANNED = 150;
+ /** Property constant */
int PR_ODD_OR_EVEN = 151;
+ /** Property constant */
int PR_ORPHANS = 152;
+ /** Property constant */
int PR_OVERFLOW = 153;
+ /** Property constant */
int PR_PADDING = 154;
+ /** Property constant */
int PR_PADDING_AFTER = 155;
+ /** Property constant */
int PR_PADDING_BEFORE = 156;
+ /** Property constant */
int PR_PADDING_BOTTOM = 157;
+ /** Property constant */
int PR_PADDING_END = 158;
+ /** Property constant */
int PR_PADDING_LEFT = 159;
+ /** Property constant */
int PR_PADDING_RIGHT = 160;
+ /** Property constant */
int PR_PADDING_START = 161;
+ /** Property constant */
int PR_PADDING_TOP = 162;
+ /** Property constant */
int PR_PAGE_BREAK_AFTER = 163;
+ /** Property constant */
int PR_PAGE_BREAK_BEFORE = 164;
+ /** Property constant */
int PR_PAGE_BREAK_INSIDE = 165;
+ /** Property constant */
int PR_PAGE_HEIGHT = 166;
+ /** Property constant */
int PR_PAGE_POSITION = 167;
+ /** Property constant */
int PR_PAGE_WIDTH = 168;
+ /** Property constant */
int PR_PAUSE = 169;
+ /** Property constant */
int PR_PAUSE_AFTER = 170;
+ /** Property constant */
int PR_PAUSE_BEFORE = 171;
+ /** Property constant */
int PR_PITCH = 172;
+ /** Property constant */
int PR_PITCH_RANGE = 173;
+ /** Property constant */
int PR_PLAY_DURING = 174;
+ /** Property constant */
int PR_POSITION = 175;
+ /** Property constant */
int PR_PRECEDENCE = 176;
+ /** Property constant */
int PR_PROVISIONAL_DISTANCE_BETWEEN_STARTS = 177;
+ /** Property constant */
int PR_PROVISIONAL_LABEL_SEPARATION = 178;
+ /** Property constant */
int PR_REFERENCE_ORIENTATION = 179;
+ /** Property constant */
int PR_REF_ID = 180;
+ /** Property constant */
int PR_REGION_NAME = 181;
+ /** Property constant */
int PR_RELATIVE_ALIGN = 182;
+ /** Property constant */
int PR_RELATIVE_POSITION = 183;
+ /** Property constant */
int PR_RENDERING_INTENT = 184;
+ /** Property constant */
int PR_RETRIEVE_BOUNDARY = 185;
+ /** Property constant */
int PR_RETRIEVE_CLASS_NAME = 186;
+ /** Property constant */
int PR_RETRIEVE_POSITION = 187;
+ /** Property constant */
int PR_RICHNESS = 188;
+ /** Property constant */
int PR_RIGHT = 189;
+ /** Property constant */
int PR_ROLE = 190;
+ /** Property constant */
int PR_RULE_STYLE = 191;
+ /** Property constant */
int PR_RULE_THICKNESS = 192;
+ /** Property constant */
int PR_SCALING = 193;
+ /** Property constant */
int PR_SCALING_METHOD = 194;
+ /** Property constant */
int PR_SCORE_SPACES = 195;
+ /** Property constant */
int PR_SCRIPT = 196;
+ /** Property constant */
int PR_SHOW_DESTINATION = 197;
+ /** Property constant */
int PR_SIZE = 198;
+ /** Property constant */
int PR_SOURCE_DOCUMENT = 199;
+ /** Property constant */
int PR_SPACE_AFTER = 200;
+ /** Property constant */
int PR_SPACE_BEFORE = 201;
+ /** Property constant */
int PR_SPACE_END = 202;
+ /** Property constant */
int PR_SPACE_START = 203;
+ /** Property constant */
int PR_SPAN = 204;
+ /** Property constant */
int PR_SPEAK = 205;
+ /** Property constant */
int PR_SPEAK_HEADER = 206;
+ /** Property constant */
int PR_SPEAK_NUMERAL = 207;
+ /** Property constant */
int PR_SPEAK_PUNCTUATION = 208;
+ /** Property constant */
int PR_SPEECH_RATE = 209;
+ /** Property constant */
int PR_SRC = 210;
+ /** Property constant */
int PR_START_INDENT = 211;
+ /** Property constant */
int PR_STARTING_STATE = 212;
+ /** Property constant */
int PR_STARTS_ROW = 213;
+ /** Property constant */
int PR_STRESS = 214;
+ /** Property constant */
int PR_SUPPRESS_AT_LINE_BREAK = 215;
+ /** Property constant */
int PR_SWITCH_TO = 216;
+ /** Property constant */
int PR_TABLE_LAYOUT = 217;
+ /** Property constant */
int PR_TABLE_OMIT_FOOTER_AT_BREAK = 218;
+ /** Property constant */
int PR_TABLE_OMIT_HEADER_AT_BREAK = 219;
+ /** Property constant */
int PR_TARGET_PRESENTATION_CONTEXT = 220;
+ /** Property constant */
int PR_TARGET_PROCESSING_CONTEXT = 221;
+ /** Property constant */
int PR_TARGET_STYLESHEET = 222;
+ /** Property constant */
int PR_TEXT_ALIGN = 223;
+ /** Property constant */
int PR_TEXT_ALIGN_LAST = 224;
+ /** Property constant */
int PR_TEXT_ALTITUDE = 225;
+ /** Property constant */
int PR_TEXT_DECORATION = 226;
+ /** Property constant */
int PR_TEXT_DEPTH = 227;
+ /** Property constant */
int PR_TEXT_INDENT = 228;
+ /** Property constant */
int PR_TEXT_SHADOW = 229;
+ /** Property constant */
int PR_TEXT_TRANSFORM = 230;
+ /** Property constant */
int PR_TOP = 231;
+ /** Property constant */
int PR_TREAT_AS_WORD_SPACE = 232;
+ /** Property constant */
int PR_UNICODE_BIDI = 233;
+ /** Property constant */
int PR_VERTICAL_ALIGN = 234;
+ /** Property constant */
int PR_VISIBILITY = 235;
+ /** Property constant */
int PR_VOICE_FAMILY = 236;
+ /** Property constant */
int PR_VOLUME = 237;
+ /** Property constant */
int PR_WHITE_SPACE_COLLAPSE = 238;
+ /** Property constant */
int PR_WHITE_SPACE_TREATMENT = 239;
+ /** Property constant */
int PR_WIDOWS = 240;
+ /** Property constant */
int PR_WIDTH = 241;
+ /** Property constant */
int PR_WORD_SPACING = 242;
+ /** Property constant */
int PR_WRAP_OPTION = 243;
+ /** Property constant */
int PR_WRITING_MODE = 244;
+ /** Property constant */
int PR_XML_LANG = 245;
+ /** Property constant */
int PR_Z_INDEX = 246;
+ /** Property constant */
int PR_INTRUSION_DISPLACE = 247;
- int PR_INDEX_CLASS = 248; // XSL 1.1
- int PR_INDEX_KEY = 249; // XSL 1.1
- int PR_X_BLOCK_PROGRESSION_UNIT = 250; //Custom extension
+ /** Property constant - XSL 1.1 */
+ int PR_INDEX_CLASS = 248;
+ /** Property constant - XSL 1.1 */
+ int PR_INDEX_KEY = 249;
+ /** Property constant - Custom extension */
+ int PR_X_BLOCK_PROGRESSION_UNIT = 250;
+ /** Number of property constants defined */
int PROPERTY_COUNT = 250;
// compound property constants
+ /** Property constant for compund property */
int CP_BLOCK_PROGRESSION_DIRECTION = 1 << COMPOUND_SHIFT;
+ /** Property constant for compund property */
int CP_CONDITIONALITY = 2 << COMPOUND_SHIFT;
+ /** Property constant for compund property */
int CP_INLINE_PROGRESSION_DIRECTION = 3 << COMPOUND_SHIFT;
+ /** Property constant for compund property */
int CP_LENGTH = 4 << COMPOUND_SHIFT;
+ /** Property constant for compund property */
int CP_MAXIMUM = 5 << COMPOUND_SHIFT;
+ /** Property constant for compund property */
int CP_MINIMUM = 6 << COMPOUND_SHIFT;
+ /** Property constant for compund property */
int CP_OPTIMUM = 7 << COMPOUND_SHIFT;
+ /** Property constant for compund property */
int CP_PRECEDENCE = 8 << COMPOUND_SHIFT;
+ /** Property constant for compund property */
int CP_WITHIN_COLUMN = 9 << COMPOUND_SHIFT;
+ /** Property constant for compund property */
int CP_WITHIN_LINE = 10 << COMPOUND_SHIFT;
+ /** Property constant for compund property */
int CP_WITHIN_PAGE = 11 << COMPOUND_SHIFT;
// Enumeration constants
+ /** Enumeration constant */
int EN_ABSOLUTE = 1;
+ /** Enumeration constant */
int EN_ABSOLUTE_COLORMETRIC = 2;
+ /** Enumeration constant */
int EN_AFTER = 3;
+ /** Enumeration constant */
int EN_AFTER_EDGE = 4;
+ /** Enumeration constant */
int EN_ALL = 5;
+ /** Enumeration constant */
int EN_ALPHABETIC = 6;
+ /** Enumeration constant */
int EN_ALWAYS = 7;
+ /** Enumeration constant */
int EN_ANY = 8;
+ /** Enumeration constant */
int EN_AUTO = 9;
+ /** Enumeration constant */
int EN_AUTO_EVEN = 10;
+ /** Enumeration constant */
int EN_AUTO_ODD = 11;
+ /** Enumeration constant */
int EN_BASELINE = 12;
+ /** Enumeration constant */
int EN_BEFORE = 13;
+ /** Enumeration constant */
int EN_BEFORE_EDGE = 14;
+ /** Enumeration constant */
int EN_BIDI_OVERRIDE = 15;
+ /** Enumeration constant */
int EN_BLANK = 16;
+ /** Enumeration constant */
int EN_BLINK = 17;
+ /** Enumeration constant */
int EN_BLOCK = 18;
+ /** Enumeration constant */
int EN_BOTH = 19;
+ /** Enumeration constant */
int EN_BOTTOM = 20;
+ /** Enumeration constant */
int EN_BOUNDED_IN_ONE_DIMENSION = 21;
+ /** Enumeration constant */
int EN_CAPITALIZE = 22;
+ /** Enumeration constant */
int EN_CENTER = 23;
+ /** Enumeration constant */
int EN_CENTRAL = 24;
+ /** Enumeration constant */
int EN_CHARACTER_BY_CHARACTER = 25;
+ /** Enumeration constant */
int EN_COLLAPSE = 26;
+ /** Enumeration constant */
int EN_COLLAPSE_WITH_PRECEDENCE = 27;
+ /** Enumeration constant */
int EN_COLUMN = 28;
+ /** Enumeration constant */
int EN_CONDENSED = 29;
+ /** Enumeration constant */
int EN_CONSIDER_SHIFTS = 30;
+ /** Enumeration constant */
int EN_DASHED = 31;
+ /** Enumeration constant */
int EN_DISCARD = 32;
+ /** Enumeration constant */
int EN_DISREGARD_SHIFTS = 33;
+ /** Enumeration constant */
int EN_DOCUMENT = 34;
+ /** Enumeration constant */
int EN_DOTS = 35;
+ /** Enumeration constant */
int EN_DOTTED = 36;
+ /** Enumeration constant */
int EN_DOUBLE = 37;
+ /** Enumeration constant */
int EN_EMBED = 38;
+ /** Enumeration constant */
int EN_END = 39;
+ /** Enumeration constant */
int EN_END_ON_EVEN = 40;
+ /** Enumeration constant */
int EN_END_ON_ODD = 41;
+ /** Enumeration constant */
int EN_ERROR_IF_OVERFLOW = 42;
+ /** Enumeration constant */
int EN_EVEN = 43;
+ /** Enumeration constant */
int EN_EVEN_PAGE = 44;
+ /** Enumeration constant */
int EN_EXPANDED = 45;
+ /** Enumeration constant */
int EN_EXTRA_CONDENSED = 46;
+ /** Enumeration constant */
int EN_EXTRA_EXPANDED = 47;
+ /** Enumeration constant */
int EN_FALSE = 48;
+ /** Enumeration constant */
int EN_FIC = 49;
+ /** Enumeration constant */
int EN_FIRST = 50;
+ /** Enumeration constant */
int EN_FIXED = 51;
+ /** Enumeration constant */
int EN_FONT_HEIGHT = 52;
+ /** Enumeration constant */
int EN_FORCE = 53;
+ /** Enumeration constant */
int EN_FSWP = 54;
+ /** Enumeration constant */
int EN_GROOVE = 55;
+ /** Enumeration constant */
int EN_HANGING = 56;
+ /** Enumeration constant */
int EN_HIDDEN = 57;
+ /** Enumeration constant */
int EN_HIDE = 58;
+ /** Enumeration constant */
int EN_IDEOGRAPHIC = 59;
+ /** Enumeration constant */
int EN_IGNORE = 60;
+ /** Enumeration constant */
int EN_IGNORE_IF_AFTER_LINEFEED = 61;
+ /** Enumeration constant */
int EN_IGNORE_IF_BEFORE_LINEFEED = 62;
+ /** Enumeration constant */
int EN_IGNORE_IF_SURROUNDING_LINEFEED = 63;
+ /** Enumeration constant */
int EN_INDEFINITE = 64;
+ /** Enumeration constant */
int EN_INDENT = 65;
+ /** Enumeration constant */
int EN_INHERIT = 66;
+ /** Enumeration constant */
int EN_INSET = 67;
+ /** Enumeration constant */
int EN_INSIDE = 68;
+ /** Enumeration constant */
int EN_INTEGER_PIXELS = 69;
+ /** Enumeration constant */
int EN_JUSTIFY = 70;
+ /** Enumeration constant */
int EN_LARGER = 71;
+ /** Enumeration constant */
int EN_LAST = 72;
+ /** Enumeration constant */
int EN_LEFT = 73;
+ /** Enumeration constant */
int EN_LEWP = 74;
+ /** Enumeration constant */
int EN_LINE = 75;
+ /** Enumeration constant */
int EN_LINE_HEIGHT = 76;
+ /** Enumeration constant */
int EN_LINE_THROUGH = 77;
+ /** Enumeration constant */
int EN_LOWERCASE = 78;
+ /** Enumeration constant */
int EN_LR_TB = 79;
+ /** Enumeration constant */
int EN_LTR = 80;
+ /** Enumeration constant */
int EN_LSWP = 81;
+ /** Enumeration constant */
int EN_MATHEMATICAL = 82;
+ /** Enumeration constant */
int EN_MAX_HEIGHT = 83;
+ /** Enumeration constant */
int EN_MIDDLE = 84;
+ /** Enumeration constant */
int EN_NARROWER = 85;
+ /** Enumeration constant */
int EN_NO_BLINK = 86;
+ /** Enumeration constant */
int EN_NO_CHANGE = 87;
+ /** Enumeration constant */
int EN_NO_FORCE = 88;
+ /** Enumeration constant */
int EN_NO_LIMIT = 89;
+ /** Enumeration constant */
int EN_NO_LINE_THROUGH = 90;
+ /** Enumeration constant */
int EN_NO_OVERLINE = 91;
+ /** Enumeration constant */
int EN_NO_UNDERLINE = 92;
+ /** Enumeration constant */
int EN_NO_WRAP = 93;
+ /** Enumeration constant */
int EN_NON_UNIFORM = 94;
+ /** Enumeration constant */
int EN_NONE = 95;
+ /** Enumeration constant */
int EN_NOREPEAT = 96;
+ /** Enumeration constant */
int EN_NORMAL = 97;
+ /** Enumeration constant */
int EN_NOT_BLANK = 98;
+ /** Enumeration constant */
int EN_ODD = 99;
+ /** Enumeration constant */
int EN_ODD_PAGE = 100;
+ /** Enumeration constant */
int EN_OUTSET = 101;
+ /** Enumeration constant */
int EN_OUTSIDE = 102;
+ /** Enumeration constant */
int EN_OVERLINE = 103;
+ /** Enumeration constant */
int EN_PAGE = 104;
+ /** Enumeration constant */
int EN_PAGE_SEQUENCE = 105;
+ /** Enumeration constant */
int EN_PAGINATE = 106;
+ /** Enumeration constant */
int EN_PERCEPTUAL = 107;
+ /** Enumeration constant */
int EN_PRESERVE = 108;
+ /** Enumeration constant */
int EN_REFERENCE_AREA = 109;
+ /** Enumeration constant */
int EN_RELATIVE = 110;
+ /** Enumeration constant */
int EN_RELATIVE_COLOMETRIC = 111;
+ /** Enumeration constant */
int EN_REPEAT = 112;
+ /** Enumeration constant */
int EN_REPEATX = 113;
+ /** Enumeration constant */
int EN_REPEATY = 114;
+ /** Enumeration constant */
int EN_RESAMPLE_ANY_METHOD = 115;
+ /** Enumeration constant */
int EN_RESET_SIZE = 116;
+ /** Enumeration constant */
int EN_REST = 117;
+ /** Enumeration constant */
int EN_RETAIN = 118;
+ /** Enumeration constant */
int EN_RIDGE = 119;
+ /** Enumeration constant */
int EN_RIGHT = 120;
+ /** Enumeration constant */
int EN_RL_TB = 121;
+ /** Enumeration constant */
int EN_RTL = 122;
+ /** Enumeration constant */
int EN_RULE = 123;
+ /** Enumeration constant */
int EN_SATURATION = 124;
+ /** Enumeration constant */
int EN_SCALE_TO_FIT = 125;
+ /** Enumeration constant */
int EN_SCROLL = 126;
+ /** Enumeration constant */
int EN_SEMI_CONDENSED = 127;
+ /** Enumeration constant */
int EN_SEMI_EXPANDED = 128;
+ /** Enumeration constant */
int EN_SEPARATE = 129;
+ /** Enumeration constant */
int EN_SHOW = 130;
+ /** Enumeration constant */
int EN_SMALL_CAPS = 131;
+ /** Enumeration constant */
int EN_SMALLER = 132;
+ /** Enumeration constant */
int EN_SOLID = 133;
+ /** Enumeration constant */
int EN_SPACE = 134;
+ /** Enumeration constant */
int EN_START = 135;
+ /** Enumeration constant */
int EN_STATIC = 136;
+ /** Enumeration constant */
int EN_SUB = 137;
+ /** Enumeration constant */
int EN_SUPER = 138;
+ /** Enumeration constant */
int EN_SUPPRESS = 139;
+ /** Enumeration constant */
int EN_TB_RL = 140;
+ /** Enumeration constant */
int EN_TEXT_AFTER_EDGE = 141;
+ /** Enumeration constant */
int EN_TEXT_BEFORE_EDGE = 142;
+ /** Enumeration constant */
int EN_TEXT_BOTTOM = 143;
+ /** Enumeration constant */
int EN_TEXT_TOP = 144;
+ /** Enumeration constant */
int EN_TOP = 145;
+ /** Enumeration constant */
int EN_TRADITIONAL = 146;
+ /** Enumeration constant */
int EN_TREAT_AS_SPACE = 147;
+ /** Enumeration constant */
int EN_TREAT_AS_ZERO_WIDTH_SPACE = 148;
+ /** Enumeration constant */
int EN_TRUE = 149;
+ /** Enumeration constant */
int EN_ULTRA_CONDENSED = 150;
+ /** Enumeration constant */
int EN_ULTRA_EXPANDED = 151;
+ /** Enumeration constant */
int EN_UNBOUNDED = 152;
+ /** Enumeration constant */
int EN_UNDERLINE = 153;
+ /** Enumeration constant */
int EN_UNIFORM = 154;
+ /** Enumeration constant */
int EN_UPPERCASE = 155;
+ /** Enumeration constant */
int EN_USE_FONT_METRICS = 156;
+ /** Enumeration constant */
int EN_USE_SCRIPT = 157;
+ /** Enumeration constant */
int EN_USECONTENT = 158;
+ /** Enumeration constant */
int EN_VISIBLE = 159;
+ /** Enumeration constant */
int EN_WIDER = 160;
+ /** Enumeration constant */
int EN_WRAP = 161;
- int EN_X_FILL = 162; //non-standard for display-align
- int EN_X_DISTRIBUTE = 163; //non-standard for display-align
+ /** Enumeration constant - non-standard for display-align */
+ int EN_X_FILL = 162;
+ /** Enumeration constant - non-standard for display-align */
+ int EN_X_DISTRIBUTE = 163;
+ /** Number of enumeration constants defined */
int ENUM_COUNT = 163;
}
genericCondPadding.useGeneric(genericCondLength);
genericCondPadding.setInherited(false);
genericCondPadding.getSubpropMaker(CP_LENGTH).setDefault("0pt");
+ genericCondPadding.setPercentBase(LengthBase.CONTAINING_BLOCK_WIDTH);
// GenericPadding
genericPadding = new LengthProperty.Maker(0);
genericPadding.setInherited(false);
genericPadding.setDefault("0pt");
- genericPadding.setPercentBase(LengthBase.BLOCK_WIDTH);
+ genericPadding.setPercentBase(LengthBase.CONTAINING_BLOCK_WIDTH);
genericPadding.addShorthand(s_generics[PR_PADDING]);
// GenericCondBorderWidth
m.addKeyword("left", "0%");
m.addKeyword("center", "50%");
m.addKeyword("right", "100%");
- m.setPercentBase(LengthBase.CONTAINING_BOX);
+ m.setPercentBase(LengthBase.IMAGE_BACKGROUND_POSITION_HORIZONTAL);
addPropertyMaker("background-position-horizontal", m);
// background-position-vertical
m.addKeyword("top", "0%");
m.addKeyword("center", "50%");
m.addKeyword("bottom", "100%");
- m.setPercentBase(LengthBase.CONTAINING_BOX);
+ m.setPercentBase(LengthBase.IMAGE_BACKGROUND_POSITION_VERTICAL);
addPropertyMaker("background-position-vertical", m);
// border-before-color
m.setInherited(false);
m.setDefault("0pt");
m.addShorthand(s_generics[PR_MARGIN]);
- m.setPercentBase(LengthBase.BLOCK_WIDTH);
+ m.setPercentBase(LengthBase.CONTAINING_BLOCK_WIDTH);
addPropertyMaker("margin-top", m);
// margin-bottom
m.setInherited(false);
m.setDefault("0pt");
m.addShorthand(s_generics[PR_MARGIN]);
- m.setPercentBase(LengthBase.BLOCK_WIDTH);
+ m.setPercentBase(LengthBase.CONTAINING_BLOCK_WIDTH);
addPropertyMaker("margin-bottom", m);
// margin-left
m.setInherited(false);
m.setDefault("0pt");
m.addShorthand(s_generics[PR_MARGIN]);
- m.setPercentBase(LengthBase.BLOCK_WIDTH);
+ m.setPercentBase(LengthBase.CONTAINING_BLOCK_WIDTH);
addPropertyMaker("margin-left", m);
// margin-right
m.setInherited(false);
m.setDefault("0pt");
m.addShorthand(s_generics[PR_MARGIN]);
- m.setPercentBase(LengthBase.BLOCK_WIDTH);
+ m.setPercentBase(LengthBase.CONTAINING_BLOCK_WIDTH);
addPropertyMaker("margin-right", m);
// space-before
// block-progression-dimension
m = new LengthRangeProperty.Maker(PR_BLOCK_PROGRESSION_DIMENSION);
m.setInherited(false);
- m.setPercentBase(LengthBase.BLOCK_HEIGHT);
+ m.setPercentBase(LengthBase.CONTAINING_BLOCK_HEIGHT);
l = new LengthProperty.Maker(CP_MINIMUM);
l.setDefault("auto");
l.addEnum("auto", getEnumProperty(EN_AUTO, "AUTO"));
- l.setPercentBase(LengthBase.CONTAINING_BOX);
+ l.setPercentBase(LengthBase.CONTAINING_BLOCK_HEIGHT);
l.setByShorthand(true);
m.addSubpropMaker(l);
l = new LengthProperty.Maker(CP_OPTIMUM);
l.setDefault("auto");
l.addEnum("auto", getEnumProperty(EN_AUTO, "AUTO"));
- l.setPercentBase(LengthBase.CONTAINING_BOX);
+ l.setPercentBase(LengthBase.CONTAINING_BLOCK_HEIGHT);
l.setByShorthand(true);
m.addSubpropMaker(l);
l = new LengthProperty.Maker(CP_MAXIMUM);
l.addEnum("auto", getEnumProperty(EN_AUTO, "AUTO"));
l.setDefault("auto");
- l.setPercentBase(LengthBase.CONTAINING_BOX);
+ l.setPercentBase(LengthBase.CONTAINING_BLOCK_HEIGHT);
l.setByShorthand(true);
m.addSubpropMaker(l);
l = new LengthProperty.Maker(PR_HEIGHT);
l.setInherited(false);
l.addEnum("auto", getEnumProperty(EN_AUTO, "AUTO"));
- l.setPercentBase(LengthBase.BLOCK_HEIGHT);
+ l.setPercentBase(LengthBase.CONTAINING_BLOCK_HEIGHT);
l.setDefault("auto");
addPropertyMaker("height", l);
// inline-progression-dimension
m = new LengthRangeProperty.Maker(PR_INLINE_PROGRESSION_DIMENSION);
m.setInherited(false);
- m.setPercentBase(LengthBase.BLOCK_WIDTH);
+ m.setPercentBase(LengthBase.CONTAINING_BLOCK_WIDTH);
l = new LengthProperty.Maker(CP_MINIMUM);
l.setDefault("auto");
l.addEnum("auto", getEnumProperty(EN_AUTO, "AUTO"));
- l.setPercentBase(LengthBase.CONTAINING_BOX);
+ l.setPercentBase(LengthBase.CONTAINING_BLOCK_WIDTH);
l.setByShorthand(true);
m.addSubpropMaker(l);
l = new LengthProperty.Maker(CP_OPTIMUM);
l.setDefault("auto");
l.addEnum("auto", getEnumProperty(EN_AUTO, "AUTO"));
- l.setPercentBase(LengthBase.CONTAINING_BOX);
+ l.setPercentBase(LengthBase.CONTAINING_BLOCK_WIDTH);
l.setByShorthand(true);
m.addSubpropMaker(l);
l = new LengthProperty.Maker(CP_MAXIMUM);
l.addEnum("auto", getEnumProperty(EN_AUTO, "AUTO"));
l.setDefault("auto");
- l.setPercentBase(LengthBase.CONTAINING_BOX);
+ l.setPercentBase(LengthBase.CONTAINING_BLOCK_WIDTH);
l.setByShorthand(true);
m.addSubpropMaker(l);
l = new LengthProperty.Maker(PR_WIDTH);
l.setInherited(false);
l.addEnum("auto", getEnumProperty(EN_AUTO, "AUTO"));
- l.setPercentBase(LengthBase.BLOCK_WIDTH);
+ l.setPercentBase(LengthBase.CONTAINING_BLOCK_WIDTH);
l.setDefault("auto");
addPropertyMaker("width", l);
m = new LengthProperty.Maker(PR_TEXT_INDENT);
m.setInherited(true);
m.setDefault("0pt");
- m.setPercentBase(LengthBase.BLOCK_WIDTH);
+ m.setPercentBase(LengthBase.CONTAINING_BLOCK_WIDTH);
addPropertyMaker("text-indent", m);
// white-space-collapse
m.setInherited(true);
m.setDefault("use-font-metrics", true);
m.addKeyword("use-font-metrics", "0pt");
- m.setPercentBase(LengthBase.CONTAINING_BOX);
+ m.setPercentBase(LengthBase.PARENT_AREA_WIDTH);
addPropertyMaker("leader-pattern-width", m);
// leader-length
m = new LengthRangeProperty.Maker(PR_LEADER_LENGTH);
m.setInherited(true);
- m.setPercentBase(LengthBase.CONTAINING_BOX);
+ m.setPercentBase(LengthBase.PARENT_AREA_WIDTH);
sub = new LengthProperty.Maker(CP_MINIMUM);
sub.setDefault("0pt");
- sub.setPercentBase(LengthBase.BLOCK_WIDTH);
+ sub.setPercentBase(LengthBase.CONTAINING_BLOCK_WIDTH);
sub.setByShorthand(true);
m.addSubpropMaker(sub);
sub = new LengthProperty.Maker(CP_OPTIMUM);
sub.setDefault("12.0pt");
- sub.setPercentBase(LengthBase.BLOCK_WIDTH);
+ sub.setPercentBase(LengthBase.CONTAINING_BLOCK_WIDTH);
sub.setByShorthand(true);
m.addSubpropMaker(sub);
sub = new LengthProperty.Maker(CP_MAXIMUM);
sub.setDefault("100%", true);
- sub.setPercentBase(LengthBase.BLOCK_WIDTH);
+ sub.setPercentBase(LengthBase.CONTAINING_BLOCK_WIDTH);
sub.setByShorthand(true);
m.addSubpropMaker(sub);
addPropertyMaker("leader-length", m);
m = new LengthProperty.Maker(PR_EXTENT);
m.setInherited(true);
m.setDefault("0pt");
+ m.setPercentBase(LengthBase.CUSTOM_BASE);
addPropertyMaker("extent", m);
// flow-name
m = new LengthProperty.Maker(PR_COLUMN_WIDTH);
m.setInherited(false);
m.setDefault("proportional-column-width(1)", true);
- m.setPercentBase(LengthBase.BLOCK_WIDTH);
+ m.setPercentBase(LengthBase.CONTAINING_BLOCK_WIDTH);
addPropertyMaker("column-width", m);
// empty-cells
m.setInherited(false);
m.setDefault("");
m.setDatatypeParser(new BoxPropShorthandParser());
- m.setPercentBase(LengthBase.BLOCK_WIDTH);
+ m.setPercentBase(LengthBase.CONTAINING_BLOCK_WIDTH);
addPropertyMaker("margin", m);
// padding
m = new ListProperty.Maker(PR_PADDING);
m.setInherited(false);
m.setDatatypeParser(new BoxPropShorthandParser());
+ m.setPercentBase(LengthBase.CONTAINING_BLOCK_WIDTH);
addPropertyMaker("padding", m);
// page-break-after
private void checkBoundaries(CommonBorderPaddingBackground bpb) {
bStartBoundary = (bpb.getBorderStartWidth(false) > 0
- || bpb.getPaddingStart(false) > 0);
+ || bpb.getPaddingStart(false, null) > 0); // TODO do we need context here?
bEndBoundary = (bpb.getBorderEndWidth(false) > 0
- || bpb.getPaddingEnd(false) > 0);
+ || bpb.getPaddingEnd(false, null) > 0); // TODO do we need context here?
}
/**
Length startIndent = pList.get(Constants.PR_START_INDENT).getLength();
LengthBase base = new LengthBase(pList.getFObj(), pInfo.getPropertyList(),
- LengthBase.CONTAINING_REFAREA);
+ LengthBase.CONTAINING_REFAREA_WIDTH);
PercentLength refWidth = new PercentLength(1.0, base);
Numeric labelEnd = distance;
package org.apache.fop.fo.expr;
+import org.apache.fop.datatypes.PercentBaseContext;
import org.apache.fop.datatypes.Numeric;
/**
*/
public static Numeric addition(Numeric op1, Numeric op2) throws PropertyException {
if (op1.isAbsolute() && op2.isAbsolute()) {
- return addition2(op1, op2);
+ return addition2(op1, op2, null);
} else {
return new RelativeNumericProperty(RelativeNumericProperty.ADDITION, op1, op2);
}
}
- public static Numeric addition2(Numeric op1, Numeric op2) throws PropertyException {
+ public static Numeric addition2(Numeric op1, Numeric op2, PercentBaseContext context) throws PropertyException {
if (op1.getDimension() != op2.getDimension()) {
throw new PropertyException("Can't subtract Numerics of different dimensions");
}
- return numeric(op1.getNumericValue() + op2.getNumericValue(), op1.getDimension());
+ return numeric(op1.getNumericValue(context) + op2.getNumericValue(context), op1.getDimension());
}
/**
*/
public static Numeric subtraction(Numeric op1, Numeric op2) throws PropertyException {
if (op1.isAbsolute() && op2.isAbsolute()) {
- return subtraction2(op1, op2);
+ return subtraction2(op1, op2, null);
} else {
return new RelativeNumericProperty(RelativeNumericProperty.SUBTRACTION, op1, op2);
}
}
- public static Numeric subtraction2(Numeric op1, Numeric op2) throws PropertyException {
+ public static Numeric subtraction2(Numeric op1, Numeric op2, PercentBaseContext context) throws PropertyException {
if (op1.getDimension() != op2.getDimension()) {
throw new PropertyException("Can't subtract Numerics of different dimensions");
}
- return numeric(op1.getNumericValue() - op2.getNumericValue(), op1.getDimension());
+ return numeric(op1.getNumericValue(context) - op2.getNumericValue(context), op1.getDimension());
}
/**
*/
public static Numeric multiply(Numeric op1, Numeric op2) throws PropertyException {
if (op1.isAbsolute() && op2.isAbsolute()) {
- return multiply2(op1, op2);
+ return multiply2(op1, op2, null);
} else {
return new RelativeNumericProperty(RelativeNumericProperty.MULTIPLY, op1, op2);
}
}
- public static Numeric multiply2(Numeric op1, Numeric op2) throws PropertyException {
- return numeric(op1.getNumericValue() * op2.getNumericValue(),
+ public static Numeric multiply2(Numeric op1, Numeric op2, PercentBaseContext context) throws PropertyException {
+ return numeric(op1.getNumericValue(context) * op2.getNumericValue(context),
op1.getDimension() + op2.getDimension());
}
*/
public static Numeric divide(Numeric op1, Numeric op2) throws PropertyException {
if (op1.isAbsolute() && op2.isAbsolute()) {
- return divide2(op1, op2);
+ return divide2(op1, op2, null);
} else {
return new RelativeNumericProperty(RelativeNumericProperty.DIVIDE, op1, op2);
}
}
- public static Numeric divide2(Numeric op1, Numeric op2) throws PropertyException {
- return numeric(op1.getNumericValue() / op2.getNumericValue(),
+ public static Numeric divide2(Numeric op1, Numeric op2, PercentBaseContext context) throws PropertyException {
+ return numeric(op1.getNumericValue(context) / op2.getNumericValue(context),
op1.getDimension() - op2.getDimension());
}
*/
public static Numeric modulo(Numeric op1, Numeric op2) throws PropertyException {
if (op1.isAbsolute() && op2.isAbsolute()) {
- return modulo2(op1, op2);
+ return modulo2(op1, op2, null);
} else {
return new RelativeNumericProperty(RelativeNumericProperty.MODULO, op1, op2);
}
}
- public static Numeric modulo2(Numeric op1, Numeric op2) throws PropertyException {
- return numeric(op1.getNumericValue() % op2.getNumericValue(), op1.getDimension());
+ public static Numeric modulo2(Numeric op1, Numeric op2, PercentBaseContext context) throws PropertyException {
+ return numeric(op1.getNumericValue(context) % op2.getNumericValue(context), op1.getDimension());
}
/**
*/
public static Numeric abs(Numeric op) throws PropertyException {
if (op.isAbsolute()) {
- return abs2(op);
+ return abs2(op, null);
} else {
return new RelativeNumericProperty(RelativeNumericProperty.ABS, op);
}
}
- public static Numeric abs2(Numeric op) throws PropertyException {
- return numeric(Math.abs(op.getNumericValue()), op.getDimension());
+ public static Numeric abs2(Numeric op, PercentBaseContext context) throws PropertyException {
+ return numeric(Math.abs(op.getNumericValue(context)), op.getDimension());
}
/**
*/
public static Numeric negate(Numeric op) throws PropertyException {
if (op.isAbsolute()) {
- return negate2(op);
+ return negate2(op, null);
} else {
return new RelativeNumericProperty(RelativeNumericProperty.NEGATE, op);
}
}
- public static Numeric negate2(Numeric op) throws PropertyException {
- return numeric(- op.getNumericValue(), op.getDimension());
+ public static Numeric negate2(Numeric op, PercentBaseContext context) throws PropertyException {
+ return numeric(- op.getNumericValue(context), op.getDimension());
}
/**
*/
public static Numeric max(Numeric op1, Numeric op2) throws PropertyException {
if (op1.isAbsolute() && op2.isAbsolute()) {
- return max2(op1, op2);
+ return max2(op1, op2, null);
} else {
return new RelativeNumericProperty(RelativeNumericProperty.MAX, op1, op2);
}
}
- public static Numeric max2(Numeric op1, Numeric op2) throws PropertyException {
+ public static Numeric max2(Numeric op1, Numeric op2, PercentBaseContext context) throws PropertyException {
if (op1.getDimension() != op2.getDimension()) {
throw new PropertyException("Arguments to max() must have same dimensions");
}
- return op1.getNumericValue() > op2.getNumericValue() ? op1 : op2;
+ return op1.getNumericValue(context) > op2.getNumericValue(context) ? op1 : op2;
}
/**
*/
public static Numeric min(Numeric op1, Numeric op2) throws PropertyException {
if (op1.isAbsolute() && op2.isAbsolute()) {
- return min2(op1, op2);
+ return min2(op1, op2, null);
} else {
return new RelativeNumericProperty(RelativeNumericProperty.MIN, op1, op2);
}
}
- public static Numeric min2(Numeric op1, Numeric op2) throws PropertyException {
+ public static Numeric min2(Numeric op1, Numeric op2, PercentBaseContext context) throws PropertyException {
if (op1.getDimension() != op2.getDimension()) {
throw new PropertyException("Arguments to min() must have same dimensions");
}
- return op1.getNumericValue() <= op2.getNumericValue() ? op1 : op2;
+ return op1.getNumericValue(context) <= op2.getNumericValue(context) ? op1 : op2;
}
/**
package org.apache.fop.fo.expr;
import org.apache.fop.datatypes.Length;
+import org.apache.fop.datatypes.PercentBaseContext;
import org.apache.fop.datatypes.Numeric;
import org.apache.fop.fo.properties.ColorTypeProperty;
import org.apache.fop.fo.properties.Property;
return value;
}
+ /**
+ * Return the value.
+ * @param Evaluation context
+ * @see Numeric#getNumericValue(Object)
+ */
+ public double getNumericValue(PercentBaseContext context) {
+ return value;
+ }
+
/**
* Return true of the numeric is absolute.
* @see Numeric#isAbsolute()
return (int) value;
}
+ /**
+ * Return the value of this numeric as a length in millipoints.
+ * @param Evaluation context
+ */
+ public int getValue(PercentBaseContext context) {
+ return (int) value;
+ }
+
/**
* Cast this as a length. That is only possible when the dimension is
* one.
import java.util.Stack;
+import org.apache.fop.datatypes.Length;
+import org.apache.fop.datatypes.PercentBase;
import org.apache.fop.fo.Constants;
-import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.FObj;
+import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.properties.PropertyMaker;
-import org.apache.fop.datatypes.PercentBase;
/**
* Propagates to the Maker.
* @return The PercentBase object or null if percentLengthOK()=false.
*/
- public PercentBase getPercentBase() {
+ public PercentBase getPercentBase() throws PropertyException {
PercentBase pcbase = getFunctionPercentBase();
return (pcbase != null) ? pcbase : maker.getPercentBase(fo, plist);
}
/**
* @return the current font-size value as base units (milli-points).
*/
- public int currentFontSize() throws PropertyException {
- return plist.get(Constants.PR_FONT_SIZE).getLength().getValue();
+ public Length currentFontSize() throws PropertyException {
+ return plist.get(Constants.PR_FONT_SIZE).getLength();
}
/**
String unitPart = currentTokenValue.substring(numLen);
Double numPart = new Double(currentTokenValue.substring(0,
numLen));
- LengthProperty length = null;
if (unitPart.equals(RELUNIT)) {
- length = new FixedLength(numPart.doubleValue(),
+ prop = (Property) NumericOp.multiply(new NumberProperty(numPart.doubleValue()),
propInfo.currentFontSize());
} else {
- length = new FixedLength(numPart.doubleValue(), unitPart);
- }
- if (length == null) {
- throw new PropertyException("unrecognized unit name: "
- + currentTokenValue);
- } else {
- prop = length;
+ prop = new FixedLength(numPart.doubleValue(), unitPart);
}
break;
package org.apache.fop.fo.expr;
+import org.apache.fop.datatypes.PercentBaseContext;
+import org.apache.fop.datatypes.PercentBase;
import org.apache.fop.fo.properties.ColorTypeProperty;
import org.apache.fop.fo.properties.Property;
-import org.apache.fop.datatypes.PercentBase;
class RGBColorFunction extends FunctionBase {
public int nbArgs() {
return 255f;
}
- public int getBaseLength() {
+ public int getBaseLength(PercentBaseContext context) {
return 0;
}
package org.apache.fop.fo.expr;
+import org.apache.fop.datatypes.Length;
+import org.apache.fop.datatypes.PercentBaseContext;
import org.apache.fop.datatypes.Numeric;
import org.apache.fop.datatypes.Length;
import org.apache.fop.fo.properties.Property;
/**
* Return a resolved (calculated) Numeric with the value of the expression.
+ * @param context Evaluation context
* @throws PropertyException when an exception occur during evaluation.
*/
- private Numeric getResolved() throws PropertyException {
+ private Numeric getResolved(PercentBaseContext context) throws PropertyException {
Numeric n;
switch (operation) {
case ADDITION:
- return NumericOp.addition2(op1, op2);
+ return NumericOp.addition2(op1, op2, context);
case SUBTRACTION:
- return NumericOp.subtraction2(op1, op2);
+ return NumericOp.subtraction2(op1, op2, context);
case MULTIPLY:
- return NumericOp.multiply2(op1, op2);
+ return NumericOp.multiply2(op1, op2, context);
case DIVIDE:
- return NumericOp.divide2(op1, op2);
+ return NumericOp.divide2(op1, op2, context);
case MODULO:
- return NumericOp.modulo2(op1, op2);
+ return NumericOp.modulo2(op1, op2, context);
case NEGATE:
- return NumericOp.negate2(op1);
+ return NumericOp.negate2(op1, context);
case ABS:
- return NumericOp.abs2(op1);
+ return NumericOp.abs2(op1, context);
case MAX:
- return NumericOp.max2(op1, op2);
+ return NumericOp.max2(op1, op2, context);
case MIN:
- return NumericOp.min2(op1, op2);
+ return NumericOp.min2(op1, op2, context);
default:
throw new PropertyException("Unknown expr operation " + operation);
}
* @see Numeric#getNumericValue()
*/
public double getNumericValue() throws PropertyException {
- return getResolved().getNumericValue();
+ return getResolved(null).getNumericValue(null);
+ }
+
+ /**
+ * Return the value.
+ * @param Evaluation context
+ * @see Numeric#getNumericValue(Object)
+ */
+ public double getNumericValue(PercentBaseContext context) throws PropertyException {
+ return getResolved(context).getNumericValue(context);
}
/**
return 0;
}
+ /**
+ * Return the value of this numeric as a length in millipoints.
+ * @param Evaluation context
+ */
+ public int getValue(PercentBaseContext context) {
+ try {
+ return (int) getNumericValue(context);
+ } catch (PropertyException exc) {
+ log.error(exc);
+ }
+ return 0;
+ }
+
/**
* Return a string represention of the expression. Only used for debugging.
*/
return FO_EXTERNAL_GRAPHIC;
}
- /**
- * @see org.apache.fop.fo.FObj#getLayoutDimension(org.apache.fop.datatypes.PercentBase.LayoutDimension)
- */
- public Number getLayoutDimension(PercentBase.LayoutDimension key) {
- if (key == PercentBase.IMAGE_INTRINSIC_WIDTH) {
- return new Integer(getIntrinsicWidth());
- } else if (key == PercentBase.IMAGE_INTRINSIC_HEIGHT) {
- return new Integer(getIntrinsicHeight());
- } else {
- return super.getLayoutDimension(key);
- }
- }
-
/**
* @see org.apache.fop.fo.IntrinsicSizeAccess#getIntrinsicWidth()
*/
return FO_INSTREAM_FOREIGN_OBJECT;
}
- /** @see org.apache.fop.fo.FObj */
- public Number getLayoutDimension(PercentBase.LayoutDimension key) {
- if (key == PercentBase.IMAGE_INTRINSIC_WIDTH) {
- return new Integer(getIntrinsicWidth());
- } else if (key == PercentBase.IMAGE_INTRINSIC_HEIGHT) {
- return new Integer(getIntrinsicHeight());
- } else {
- return super.getLayoutDimension(key);
- }
- }
-
/**
* Preloads the image so the intrinsic size is available.
*/
PropertyList colPList = new StaticPropertyList(defaultColumn, pList);
colPList.setWritingMode();
defaultColumn.bind(colPList);
-
+
+ /* TODO hasPadding requires context for evaluation - need to move this to layout
if (borderCollapse != EN_SEPARATE && commonBorderPaddingBackground.hasPadding()) {
//See "17.6.2 The collapsing border model" in CSS2
getLogger().error("Table may not have padding when using the collapsing border model.");
}
+ */
if (borderCollapse != EN_SEPARATE) {
getLogger().warn("The collapsing border model on an fo:table "
+ "is currently not supported by FOP");
* Calculate cell border and padding, including offset of content
* rectangle from the theoretical grid position.
*/
- private void calcBorders(CommonBorderPaddingBackground bp) {
- if (this.borderCollapse == EN_SEPARATE) {
- /*
- * Easy case.
- * Cell border is the property specified directly on cell.
- * Offset content rect by half the border-separation value,
- * in addition to the border and padding values. Note:
- * border-separate should only be specified on the table object,
- * but it inherits.
- */
- int iSep = borderSeparation.getIPD().getLength().getValue();
- this.startAdjust = iSep / 2 + bp.getBorderStartWidth(false)
- + bp.getPaddingStart(false);
-
- this.widthAdjust = startAdjust + iSep - iSep / 2
- + bp.getBorderEndWidth(false)
- + bp.getPaddingEnd(false);
-
- // Offset of content rectangle in the block-progression direction
- int bSep = borderSeparation.getBPD().getLength().getValue();
- this.beforeOffset = bSep / 2
- + bp.getBorderBeforeWidth(false)
- + bp.getPaddingBefore(false);
-
- } else {
- // System.err.println("Collapse borders");
- /*
- * Hard case.
- * Cell border is combination of other cell borders, or table
- * border for edge cells. Also seems to border values specified
- * on row and column FO in the table (if I read CR correclty.)
- */
-
- // Set up before and after borders, taking into account row
- // and table border properties.
- // ??? What about table-body, header,footer
-
- /*
- * We can't calculate before and after because we aren't sure
- * whether this row will be the first or last in its area, due
- * to redoing break decisions (at least in the "new" architecture.)
- * So in the general case, we will calculate two possible values:
- * the first/last one and the "middle" one.
- * Example: border-before
- * 1. If the cell is in the first row in the first table body, it
- * will combine with the last row of the header, or with the
- * top (before) table border if there is no header.
- * 2. Otherwise there are two cases:
- * a. the row is first in its (non-first) Area.
- * The border can combine with either:
- * i. the last row of table-header and its cells, or
- * ii. the table before border (no table-header or it is
- * omitted on non-first Areas).
- * b. the row isn't first in its Area.
- * The border combines with the border of the previous
- * row and the cells which end in that row.
- */
-
- /*
- * if-first
- * Calculate the effective border of the cell before-border,
- * it's parent row before-border, the last header row after-border,
- * the after border of the cell(s) which end in the last header
- * row.
- */
- /*
- * if-not-first
- * Calculate the effective border of the cell before-border,
- * it's parent row before-border, the previous row after-border,
- * the after border of the cell(s) which end in the previous
- * row.
- */
-
-
- /* ivan demakov */
- int borderStart = bp.getBorderStartWidth(false);
- int borderEnd = bp.getBorderEndWidth(false);
- int borderBefore = bp.getBorderBeforeWidth(false);
- int borderAfter = bp.getBorderAfterWidth(false);
-
- this.startAdjust = borderStart / 2 + bp.getPaddingStart(false);
-
- this.widthAdjust = startAdjust + borderEnd / 2
- + bp.getPaddingEnd(false);
- this.beforeOffset = borderBefore / 2 + bp.getPaddingBefore(false);
- // Half border height to fix overestimate of area size!
- this.borderHeight = (borderBefore + borderAfter) / 2;
- }
- }
+// TODO This whole method is not used it refers to padding which requires layout
+// context to evaluate
+// private void calcBorders(CommonBorderPaddingBackground bp) {
+// if (this.borderCollapse == EN_SEPARATE) {
+// /*
+// * Easy case.
+// * Cell border is the property specified directly on cell.
+// * Offset content rect by half the border-separation value,
+// * in addition to the border and padding values. Note:
+// * border-separate should only be specified on the table object,
+// * but it inherits.
+// */
+// int iSep = borderSeparation.getIPD().getLength().getValue();
+// this.startAdjust = iSep / 2 + bp.getBorderStartWidth(false)
+// + bp.getPaddingStart(false);
+//
+// this.widthAdjust = startAdjust + iSep - iSep / 2
+// + bp.getBorderEndWidth(false)
+// + bp.getPaddingEnd(false);
+//
+// // Offset of content rectangle in the block-progression direction
+// int bSep = borderSeparation.getBPD().getLength().getValue();
+// this.beforeOffset = bSep / 2
+// + bp.getBorderBeforeWidth(false)
+// + bp.getPaddingBefore(false);
+//
+// } else {
+// // System.err.println("Collapse borders");
+// /*
+// * Hard case.
+// * Cell border is combination of other cell borders, or table
+// * border for edge cells. Also seems to border values specified
+// * on row and column FO in the table (if I read CR correclty.)
+// */
+//
+// // Set up before and after borders, taking into account row
+// // and table border properties.
+// // ??? What about table-body, header,footer
+//
+// /*
+// * We can't calculate before and after because we aren't sure
+// * whether this row will be the first or last in its area, due
+// * to redoing break decisions (at least in the "new" architecture.)
+// * So in the general case, we will calculate two possible values:
+// * the first/last one and the "middle" one.
+// * Example: border-before
+// * 1. If the cell is in the first row in the first table body, it
+// * will combine with the last row of the header, or with the
+// * top (before) table border if there is no header.
+// * 2. Otherwise there are two cases:
+// * a. the row is first in its (non-first) Area.
+// * The border can combine with either:
+// * i. the last row of table-header and its cells, or
+// * ii. the table before border (no table-header or it is
+// * omitted on non-first Areas).
+// * b. the row isn't first in its Area.
+// * The border combines with the border of the previous
+// * row and the cells which end in that row.
+// */
+//
+// /*
+// * if-first
+// * Calculate the effective border of the cell before-border,
+// * it's parent row before-border, the last header row after-border,
+// * the after border of the cell(s) which end in the last header
+// * row.
+// */
+// /*
+// * if-not-first
+// * Calculate the effective border of the cell before-border,
+// * it's parent row before-border, the previous row after-border,
+// * the after border of the cell(s) which end in the previous
+// * row.
+// */
+//
+//
+// /* ivan demakov */
+// int borderStart = bp.getBorderStartWidth(false);
+// int borderEnd = bp.getBorderEndWidth(false);
+// int borderBefore = bp.getBorderBeforeWidth(false);
+// int borderAfter = bp.getBorderAfterWidth(false);
+//
+// this.startAdjust = borderStart / 2 + bp.getPaddingStart(false);
+//
+// this.widthAdjust = startAdjust + borderEnd / 2
+// + bp.getPaddingEnd(false);
+// this.beforeOffset = borderBefore / 2 + bp.getPaddingBefore(false);
+// // Half border height to fix overestimate of area size!
+// this.borderHeight = (borderBefore + borderAfter) / 2;
+// }
+// }
/**
* @return the Common Border, Padding, and Background Properties.
}
}
- if (getCommonBorderPaddingBackground().getBPPaddingAndBorder(false) != 0
- || getCommonBorderPaddingBackground().getIPPaddingAndBorder(false) != 0) {
+ if (getCommonBorderPaddingBackground().getBPPaddingAndBorder(false, null) != 0 //TODO do we need context here?
+ || getCommonBorderPaddingBackground().getIPPaddingAndBorder(false, null) != 0) { //TODO do we need context here?
throw new PropertyException("Border and padding for a region "
+ "must be '0' (See 6.4.13 in XSL 1.0).");
}
/**
* @param pageRefRect reference dimension of the page area.
+ * @param pageViewRectRect page view port dimensions.
* @return the rectangle for the viewport area
*/
- public abstract Rectangle getViewportRectangle(FODimension pageRefRect);
+ public abstract Rectangle getViewportRectangle(FODimension pageRefRect
+ , FODimension pageViewPortRect);
/**
* Returns the default region name (xsl-region-before, xsl-region-start,
// FOP
import org.apache.fop.fo.FONode;
import org.apache.fop.datatypes.FODimension;
+import org.apache.fop.datatypes.LengthBase;
+import org.apache.fop.datatypes.SimplePercentBaseContext;
/**
* The fo:region-after element.
/**
* @see org.apache.fop.fo.pagination.Region#getViewportRectangle(FODimension)
*/
- public Rectangle getViewportRectangle (FODimension reldims) {
+ public Rectangle getViewportRectangle (FODimension reldims, FODimension pageViewPortRect) {
// Depends on extent, precedence ans writing mode
+ /* Special rules apply to resolving extent.
+ * In the property subsystem the extent property is configured to
+ * using BLOCK_WIDTH as its percent base.
+ * However, depending on the writing mode extent import resolved either
+ * against the page width or the page height.
+ */
Rectangle vpRect;
+ SimplePercentBaseContext pageWidthContext
+ = new SimplePercentBaseContext(null, LengthBase.CUSTOM_BASE, pageViewPortRect.ipd);
+ SimplePercentBaseContext pageHeightContext
+ = new SimplePercentBaseContext(null, LengthBase.CUSTOM_BASE, pageViewPortRect.bpd);
+ SimplePercentBaseContext neighbourContext;
if (getWritingMode() == EN_LR_TB || getWritingMode() == EN_RL_TB) {
- vpRect = new Rectangle(0, reldims.bpd - getExtent().getValue(), reldims.ipd, getExtent().getValue());
+ neighbourContext = pageWidthContext;
+ vpRect = new Rectangle(0, reldims.bpd - getExtent().getValue(pageHeightContext), reldims.ipd, getExtent().getValue(pageHeightContext));
} else {
- vpRect = new Rectangle(0, reldims.bpd - getExtent().getValue(), getExtent().getValue(), reldims.ipd);
+ neighbourContext = pageHeightContext;
+ vpRect = new Rectangle(0, reldims.bpd - getExtent().getValue(pageWidthContext), getExtent().getValue(pageWidthContext), reldims.ipd);
}
if (getPrecedence() == EN_FALSE) {
- adjustIPD(vpRect, getWritingMode());
+ adjustIPD(vpRect, getWritingMode(), neighbourContext);
}
return vpRect;
}
import java.awt.Rectangle;
import org.apache.fop.apps.FOPException;
+import org.apache.fop.datatypes.PercentBaseContext;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.PropertyList;
* and end regions if they are present.
* @param vpRefRect viewport reference rectangle
* @param wm writing mode
+ * @param siblingContext the context to use to resolve extent on siblings
*/
- protected void adjustIPD(Rectangle vpRefRect, int wm) {
+ protected void adjustIPD(Rectangle vpRefRect, int wm, PercentBaseContext siblingContext) {
int offset = 0;
RegionStart start = (RegionStart) getSiblingRegion(FO_REGION_START);
if (start != null) {
- offset = start.getExtent().getValue();
+ offset = start.getExtent().getValue(siblingContext);
vpRefRect.translate(offset, 0); // move (x, y) units
}
RegionEnd end = (RegionEnd) getSiblingRegion(FO_REGION_END);
if (end != null) {
- offset += end.getExtent().getValue();
+ offset += end.getExtent().getValue(siblingContext);
}
if (offset > 0) {
if (wm == EN_LR_TB || wm == EN_RL_TB) {
// FOP
import org.apache.fop.datatypes.FODimension;
+import org.apache.fop.datatypes.LengthBase;
+import org.apache.fop.datatypes.SimplePercentBaseContext;
import org.apache.fop.fo.FONode;
/**
/**
* @see org.apache.fop.fo.pagination.Region#getViewportRectangle(FODimension)
*/
- public Rectangle getViewportRectangle (FODimension reldims) {
+ public Rectangle getViewportRectangle (FODimension reldims, FODimension pageViewPortRect) {
// Depends on extent, precedence and writing mode
// This should return rectangle in writing-mode coordinates relative
// to the page-reference area rectangle
// This means the origin is (start, before) and the dimensions are (ipd,bpd)
// Before is always 0, start depends on extent
// ipd depends on precedence, bpd=extent
+ /* Special rules apply to resolving extent.
+ * In the property subsystem the extent property is configured to
+ * using BLOCK_WIDTH as its percent base.
+ * However, depending on the writing mode extent import resolved either
+ * against the page width or the page height.
+ */
Rectangle vpRect;
+ SimplePercentBaseContext pageWidthContext
+ = new SimplePercentBaseContext(null, LengthBase.CUSTOM_BASE, pageViewPortRect.ipd);
+ SimplePercentBaseContext pageHeightContext
+ = new SimplePercentBaseContext(null, LengthBase.CUSTOM_BASE, pageViewPortRect.bpd);
+ SimplePercentBaseContext neighbourContext;
if (getWritingMode() == EN_LR_TB || getWritingMode() == EN_RL_TB) {
- vpRect = new Rectangle(0, 0, reldims.ipd, getExtent().getValue());
+ neighbourContext = pageWidthContext;
+ vpRect = new Rectangle(0, 0, reldims.ipd, getExtent().getValue(pageHeightContext));
} else {
- vpRect = new Rectangle(0, 0, getExtent().getValue(), reldims.ipd);
+ neighbourContext = pageHeightContext;
+ vpRect = new Rectangle(0, 0, getExtent().getValue(pageWidthContext), reldims.ipd);
}
if (getPrecedence() == EN_FALSE) {
- adjustIPD(vpRect, getWritingMode());
+ adjustIPD(vpRect, getWritingMode(), neighbourContext);
}
return vpRect;
}
import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.FODimension;
import org.apache.fop.datatypes.Length;
+import org.apache.fop.datatypes.LengthBase;
import org.apache.fop.datatypes.Numeric;
+import org.apache.fop.datatypes.SimplePercentBaseContext;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.properties.CommonMarginBlock;
/**
* @see org.apache.fop.fo.pagination.Region#getViewportRectangle(FODimension)
*/
- public Rectangle getViewportRectangle (FODimension reldims) {
- int left = commonMarginBlock.marginLeft.getValue();
- int right = commonMarginBlock.marginRight.getValue();
- int top = commonMarginBlock.marginTop.getValue();
- int bottom = commonMarginBlock.marginBottom.getValue();
+ public Rectangle getViewportRectangle (FODimension reldims, FODimension pageViewPortRect) {
+ /* Special rules apply to resolving margins in the page context.
+ * Contrary to normal margins in this case top and bottom margin
+ * are resolved relative to the height. In the property subsystem
+ * all margin properties are configured to using BLOCK_WIDTH.
+ * That's why we 'cheat' here and setup a context for the height but
+ * use the LengthBase.BLOCK_WIDTH.
+ * Also the values are resolved relative to the page size.
+ */
+ SimplePercentBaseContext pageWidthContext
+ = new SimplePercentBaseContext(null, LengthBase.CONTAINING_BLOCK_WIDTH, pageViewPortRect.ipd);
+ SimplePercentBaseContext pageHeightContext
+ = new SimplePercentBaseContext(null, LengthBase.CONTAINING_BLOCK_WIDTH, pageViewPortRect.bpd);
+
+ int left = commonMarginBlock.marginLeft.getValue(pageWidthContext);
+ int right = commonMarginBlock.marginRight.getValue(pageWidthContext);
+ int top = commonMarginBlock.marginTop.getValue(pageHeightContext);
+ int bottom = commonMarginBlock.marginBottom.getValue(pageHeightContext);
return new Rectangle(left, top,
reldims.ipd - left - right,
reldims.bpd - top - bottom);
// FOP
import org.apache.fop.fo.FONode;
import org.apache.fop.datatypes.FODimension;
+import org.apache.fop.datatypes.LengthBase;
+import org.apache.fop.datatypes.SimplePercentBaseContext;
/**
* The fo:region-end element.
/**
* @see org.apache.fop.fo.pagination.Region#getViewportRectangle(FODimension)
*/
- public Rectangle getViewportRectangle (FODimension reldims) {
+ public Rectangle getViewportRectangle (FODimension reldims, FODimension pageViewPortRect) {
// Depends on extent, precedence and writing mode
+ /* Special rules apply to resolving extent.
+ * In the property subsystem the extent property is configured to
+ * using BLOCK_WIDTH as its percent base.
+ * However, depending on the writing mode extent import resolved either
+ * against the page width or the page height.
+ */
Rectangle vpRect;
+ SimplePercentBaseContext pageWidthContext
+ = new SimplePercentBaseContext(null, LengthBase.CUSTOM_BASE, pageViewPortRect.ipd);
+ SimplePercentBaseContext pageHeightContext
+ = new SimplePercentBaseContext(null, LengthBase.CUSTOM_BASE, pageViewPortRect.bpd);
+ SimplePercentBaseContext neighbourContext;
if (getWritingMode() == EN_LR_TB || getWritingMode() == EN_RL_TB) {
- // Rectangle: x , y (of top left point), width, height
- vpRect = new Rectangle(reldims.ipd - getExtent().getValue(), 0,
- getExtent().getValue(), reldims.bpd);
+ neighbourContext = pageHeightContext;
+ vpRect = new Rectangle(reldims.ipd - getExtent().getValue(pageWidthContext), 0,
+ getExtent().getValue(pageWidthContext), reldims.bpd);
} else {
// Rectangle: x , y (of top left point), width, height
- vpRect = new Rectangle(reldims.ipd - getExtent().getValue(), 0,
- reldims.bpd, getExtent().getValue());
+ neighbourContext = pageWidthContext;
+ vpRect = new Rectangle(reldims.ipd - getExtent().getValue(pageHeightContext), 0,
+ reldims.bpd, getExtent().getValue(pageHeightContext));
}
- adjustIPD(vpRect, getWritingMode());
+ adjustIPD(vpRect, getWritingMode(), neighbourContext);
return vpRect;
}
import java.awt.Rectangle;
import org.apache.fop.apps.FOPException;
+import org.apache.fop.datatypes.PercentBaseContext;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.PropertyList;
* diminish by extend of start and end if present.
* @param vpRefRect viewport reference rectangle
* @param wm writing mode
+ * @param siblingContext the context to use to resolve extent on siblings
*/
- protected void adjustIPD(Rectangle vpRefRect, int wm) {
+ protected void adjustIPD(Rectangle vpRefRect, int wm, PercentBaseContext siblingContext) {
int offset = 0;
RegionBefore before = (RegionBefore) getSiblingRegion(FO_REGION_BEFORE);
if (before != null && before.getPrecedence() == EN_TRUE) {
- offset = before.getExtent().getValue();
+ offset = before.getExtent().getValue(siblingContext);
vpRefRect.translate(0, offset);
}
RegionAfter after = (RegionAfter) getSiblingRegion(FO_REGION_AFTER);
if (after != null && after.getPrecedence() == EN_TRUE) {
- offset += after.getExtent().getValue();
+ offset += after.getExtent().getValue(siblingContext);
}
if (offset > 0) {
if (wm == EN_LR_TB || wm == EN_RL_TB) {
// FOP
import org.apache.fop.fo.FONode;
import org.apache.fop.datatypes.FODimension;
+import org.apache.fop.datatypes.LengthBase;
+import org.apache.fop.datatypes.SimplePercentBaseContext;
/**
* The fo:region-start element.
/**
* @see org.apache.fop.fo.pagination.Region#getViewportRectangle(FODimension)
*/
- public Rectangle getViewportRectangle (FODimension reldims) {
+ public Rectangle getViewportRectangle (FODimension reldims, FODimension pageViewPortRect) {
// Depends on extent, precedence and writing mode
// This is the rectangle relative to the page-reference area in
// writing-mode relative coordinates
+ /* Special rules apply to resolving extent.
+ * In the property subsystem the extent property is configured to
+ * using BLOCK_WIDTH as its percent base.
+ * However, depending on the writing mode extent import resolved either
+ * against the page width or the page height.
+ */
Rectangle vpRect;
+ SimplePercentBaseContext pageWidthContext
+ = new SimplePercentBaseContext(null, LengthBase.CUSTOM_BASE, pageViewPortRect.ipd);
+ SimplePercentBaseContext pageHeightContext
+ = new SimplePercentBaseContext(null, LengthBase.CUSTOM_BASE, pageViewPortRect.bpd);
+ SimplePercentBaseContext neighbourContext;
if (getWritingMode() == EN_LR_TB || getWritingMode() == EN_RL_TB) {
- vpRect = new Rectangle(0, 0, getExtent().getValue(), reldims.bpd);
+ neighbourContext = pageHeightContext;
+ vpRect = new Rectangle(0, 0, getExtent().getValue(pageWidthContext), reldims.bpd);
} else {
- vpRect = new Rectangle(0, 0, reldims.bpd, getExtent().getValue());
+ neighbourContext = pageWidthContext;
+ vpRect = new Rectangle(0, 0, reldims.bpd, getExtent().getValue(pageHeightContext));
}
- adjustIPD(vpRect, getWritingMode());
+ adjustIPD(vpRect, getWritingMode(), neighbourContext);
return vpRect;
}
import org.apache.fop.datatypes.ColorType;
import org.apache.fop.datatypes.Length;
+import org.apache.fop.datatypes.PercentBaseContext;
import org.apache.fop.fo.Constants;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
return this.borderInfo[side];
}
+ /**
+ * Set padding.
+ * @param source the padding info to copy from
+ */
+ public void setPadding(CommonBorderPaddingBackground source) {
+ this.padding = source.padding;
+ }
+
/**
* @return the background image as a preloaded FopImage, null if there is
* no background image.
return getBorderWidth(AFTER, bDiscard);
}
- public int getPaddingStart(boolean bDiscard) {
- return getPadding(START, bDiscard);
+ public int getPaddingStart(boolean bDiscard, PercentBaseContext context) {
+ return getPadding(START, bDiscard, context);
}
- public int getPaddingEnd(boolean bDiscard) {
- return getPadding(END, bDiscard);
+ public int getPaddingEnd(boolean bDiscard, PercentBaseContext context) {
+ return getPadding(END, bDiscard, context);
}
- public int getPaddingBefore(boolean bDiscard) {
- return getPadding(BEFORE, bDiscard);
+ public int getPaddingBefore(boolean bDiscard, PercentBaseContext context) {
+ return getPadding(BEFORE, bDiscard, context);
}
- public int getPaddingAfter(boolean bDiscard) {
- return getPadding(AFTER, bDiscard);
+ public int getPaddingAfter(boolean bDiscard, PercentBaseContext context) {
+ return getPadding(AFTER, bDiscard, context);
}
public int getBorderWidth(int side, boolean bDiscard) {
}
}
- public int getPadding(int side, boolean bDiscard) {
+ public int getPadding(int side, boolean bDiscard, PercentBaseContext context) {
if ((padding[side] == null) || (bDiscard && padding[side].isDiscard())) {
return 0;
} else {
- return padding[side].getLengthValue();
+ return padding[side].getLengthValue(context);
}
}
* Return all the border and padding width in the inline progression
* dimension.
* @param bDiscard the discard flag.
+ * @param context for percentage evaluation.
* @return all the padding and border width.
*/
- public int getIPPaddingAndBorder(boolean bDiscard) {
- return getPaddingStart(bDiscard)
- + getPaddingEnd(bDiscard)
+ public int getIPPaddingAndBorder(boolean bDiscard, PercentBaseContext context) {
+ return getPaddingStart(bDiscard, context)
+ + getPaddingEnd(bDiscard, context)
+ getBorderStartWidth(bDiscard)
+ getBorderEndWidth(bDiscard);
}
* Return all the border and padding height in the block progression
* dimension.
* @param bDiscard the discard flag.
+ * @param context for percentage evaluation
* @return all the padding and border height.
*/
- public int getBPPaddingAndBorder(boolean bDiscard) {
- return getPaddingBefore(bDiscard) + getPaddingAfter(bDiscard) +
+ public int getBPPaddingAndBorder(boolean bDiscard, PercentBaseContext context) {
+ return getPaddingBefore(bDiscard, context) + getPaddingAfter(bDiscard, context) +
getBorderBeforeWidth(bDiscard) + getBorderAfterWidth(bDiscard);
}
getBorderStartWidth(false) + ", " + getBorderEndWidth(false) + ")\n" +
"Border Colors: (" + getBorderColor(BEFORE) + ", " + getBorderColor(AFTER) + ", " +
getBorderColor(START) + ", " + getBorderColor(END) + ")\n" +
- "Padding: (" + getPaddingBefore(false) + ", " + getPaddingAfter(false) + ", " +
- getPaddingStart(false) + ", " + getPaddingEnd(false) + ")\n";
+ "Padding: (" + getPaddingBefore(false, null) + ", " + getPaddingAfter(false, null) + ", " +
+ getPaddingStart(false, null) + ", " + getPaddingEnd(false, null) + ")\n";
}
/**
+ getBorderStartWidth(false) + getBorderEndWidth(false)) > 0);
}
- /** @return true if padding is non-zero. */
- public boolean hasPadding() {
- return ((getPaddingBefore(false) + getPaddingAfter(false)
- + getPaddingStart(false) + getPaddingEnd(false)) > 0);
+ /**
+ * @param context for percentage based evaluation.
+ * @return true if padding is non-zero.
+ */
+ public boolean hasPadding(PercentBaseContext context) {
+ return ((getPaddingBefore(false, context) + getPaddingAfter(false, context)
+ + getPaddingStart(false, context) + getPaddingEnd(false, context)) > 0);
}
}
// FOP
import org.apache.fop.datatypes.Length;
import org.apache.fop.datatypes.Numeric;
+import org.apache.fop.datatypes.PercentBaseContext;
import org.apache.fop.fo.Constants;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.expr.PropertyException;
* @param fontInfo
* @return a Font object.
*/
- public Font getFontState(FontInfo fontInfo) {
+ public Font getFontState(FontInfo fontInfo, PercentBaseContext context) {
if (fontState == null) {
/**@todo this is ugly. need to improve. */
String fname = fontInfo.fontLookup(fontFamily, fontStyle,
font_weight);
FontMetrics metrics = fontInfo.getMetricsFor(fname);
- fontState = new Font(fname, metrics, fontSize.getValue());
+ fontState = new Font(fname, metrics, fontSize.getValue(context));
}
return fontState;
}
import org.apache.fop.fo.Constants;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.expr.PropertyException;
+import org.apache.fop.fo.expr.RelativeNumericProperty;
/**
* Store all common margin properties for blocks.
import org.apache.fop.datatypes.CompoundDatatype;
import org.apache.fop.datatypes.Length;
+import org.apache.fop.datatypes.PercentBaseContext;
import org.apache.fop.fo.Constants;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
return this.length.getLength().getValue();
}
+ /**
+ * Returns the computed length value.
+ * @return the length in millipoints
+ */
+ public int getLengthValue(PercentBaseContext context) {
+ return this.length.getLength().getValue(context);
+ }
+
public String toString() {
return "CondLength[" + (isDiscard() ? "discard, " : "") +
length.getObject().toString() + "]";
package org.apache.fop.fo.properties;
+import org.apache.fop.datatypes.PercentBaseContext;
+
/**
* A length quantity in XSL which is specified as an enum, such as "auto"
*/
public boolean isAbsolute() {
return false;
}
+
/**
* Returns the length in 1/1000ths of a point (millipoints)
* @return the length in millipoints
return 0;
}
+ /**
+ * Returns the length in 1/1000ths of a point (millipoints)
+ * @param Evaluation context
+ * @return the length in millipoints
+ */
+ public int getValue(PercentBaseContext context) {
+ log.error("getValue() called on " + enumProperty + " length");
+ return 0;
+ }
+
/**
* Returns the value as numeric.
* @return the length in millipoints
return 0;
}
+ /**
+ * Returns the value as numeric.
+ * @param context Evaluation context
+ * @return the length in millipoints
+ */
+ public double getNumericValue(PercentBaseContext context) {
+ log.error("getNumericValue() called on " + enumProperty + " number");
+ return 0;
+ }
+
/**
* @see org.apache.fop.fo.properties.Property#getString()
*/
package org.apache.fop.fo.properties;
+import org.apache.fop.datatypes.PercentBaseContext;
+
/**
* An absolute length quantity in XSL
*/
return millipoints;
}
+ /**
+ * Returns the length in 1/1000ths of a point (millipoints)
+ * @param Evaluation context
+ * @return the length in millipoints
+ */
+ public int getValue(PercentBaseContext context) {
+ return millipoints;
+ }
+
/**
* Returns the value as numeric.
* @return the length in millipoints
+ * @see Numeric#getNumericValue()
*/
public double getNumericValue() {
return millipoints;
}
+ /**
+ * Return the value of this Numeric.
+ * @param context Evaluation context
+ * @return the length in millipoints
+ * @see Numeric#getNumericValue(Object)
+ */
+ public double getNumericValue(PercentBaseContext context) {
+ return millipoints;
+ }
+
/**
* Return true since FixedLength are always absolute.
* @see org.apache.fop.datatypes.Numeric#isAbsolute()
/* $Id: $ */
package org.apache.fop.fo.properties;
+import org.apache.fop.datatypes.Length;
+import org.apache.fop.datatypes.LengthBase;
+import org.apache.fop.datatypes.SimplePercentBaseContext;
import org.apache.fop.fo.Constants;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.expr.PropertyException;
+import org.apache.fop.fo.expr.RelativeNumericProperty;
/**
* This subclass of LengthProperty.Maker handles the special treatment of
package org.apache.fop.fo.properties;
import org.apache.fop.datatypes.CompoundDatatype;
+import org.apache.fop.datatypes.PercentBaseContext;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.expr.PropertyException;
*/
public Property getComponent(int cmpId) {
if (cmpId == CP_MINIMUM) {
- return getMinimum();
+ return getMinimum(null);
} else if (cmpId == CP_OPTIMUM) {
- return getOptimum();
+ return getOptimum(null);
} else if (cmpId == CP_MAXIMUM) {
- return getMaximum();
+ return getMaximum(null);
} else {
return null; // SHOULDN'T HAPPEN
}
}
// Minimum is prioritaire, if explicit
- private void checkConsistency() {
+ private void checkConsistency(PercentBaseContext context) {
if (consistent) {
return;
}
+ if (context == null) {
+ return;
+ }
// Make sure max >= min
// Must also control if have any allowed enum values!
if (!minimum.isAuto() && !maximum.isAuto()
- && minimum.getLength().getValue() > maximum.getLength().getValue()) {
+ && minimum.getLength().getValue(context) > maximum.getLength().getValue(context)) {
if ((bfSet & MINSET) != 0) {
// if minimum is explicit, force max to min
if ((bfSet & MAXSET) != 0) {
}
// Now make sure opt <= max and opt >= min
if (!optimum.isAuto() && !maximum.isAuto()
- && optimum.getLength().getValue() > maximum.getLength().getValue()) {
+ && optimum.getLength().getValue(context) > maximum.getLength().getValue(context)) {
if ((bfSet & OPTSET) != 0) {
if ((bfSet & MAXSET) != 0) {
// Warning: opt > max, resetting opt to max
optimum = maximum;
}
} else if (!optimum.isAuto() && !minimum.isAuto() &&
- optimum.getLength().getValue() < minimum.getLength().getValue()) {
+ optimum.getLength().getValue(context) < minimum.getLength().getValue(context)) {
if ((bfSet & MINSET) != 0) {
// if minimum is explicit, force opt to min
if ((bfSet & OPTSET) != 0) {
}
/**
+ * @param context Percentage evaluation context
* @return minimum length
*/
- public Property getMinimum() {
- checkConsistency();
+ public Property getMinimum(PercentBaseContext context) {
+ checkConsistency(context);
return this.minimum;
}
/**
+ * @param context Percentage evaluation context
* @return maximum length
*/
- public Property getMaximum() {
- checkConsistency();
+ public Property getMaximum(PercentBaseContext context) {
+ checkConsistency(context);
return this.maximum;
}
/**
+ * @param context Percentage evaluation context
* @return optimum length
*/
- public Property getOptimum() {
- checkConsistency();
+ public Property getOptimum(PercentBaseContext context) {
+ checkConsistency(context);
return this.optimum;
}
public String toString() {
return "LengthRange[" +
- "min:" + getMinimum().getObject() +
- ", max:" + getMaximum().getObject() +
- ", opt:" + getOptimum().getObject() + "]";
+ "min:" + getMinimum(null).getObject() +
+ ", max:" + getMaximum(null).getObject() +
+ ", opt:" + getOptimum(null).getObject() + "]";
}
/**
/* $Id$ */
package org.apache.fop.fo.properties;
-
+import org.apache.fop.datatypes.LengthBase;
import org.apache.fop.datatypes.Numeric;
+import org.apache.fop.datatypes.SimplePercentBaseContext;
+import org.apache.fop.fo.Constants;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.expr.PropertyException;
+import org.apache.fop.fo.expr.RelativeNumericProperty;
/**
* A maker which calculates the line-height property.
return null;
}
+ /**
+ * @see SpaceProperty#convertProperty(Property, PropertyList, FObj)
+ */
public Property convertProperty(Property p,
PropertyList propertyList,
FObj fo) throws PropertyException {
- Numeric numval = p.getNumeric();
+ Numeric numval = p.getNumeric();
if (numval != null && numval.getDimension() == 0) {
p = new PercentLength(numval.getNumericValue(), getPercentBase(fo,propertyList));
Property spaceProp = super.convertProperty(p, propertyList, fo);
package org.apache.fop.fo.properties;
+import org.apache.fop.datatypes.PercentBaseContext;
import org.apache.fop.datatypes.Numeric;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
return number.doubleValue();
}
+ /**
+ * Return the value of this Numeric.
+ * @param context Evaluation context
+ * @return The value as a double.
+ * @see Numeric#getNumericValue(Object)
+ */
+ public double getNumericValue(PercentBaseContext context) {
+ return getNumericValue();
+ }
+
public int getValue() {
return number.intValue();
}
+ /**
+ * Return the value
+ * @param context Evaluation context
+ * @return The value as an int.
+ * @see Numeric#getValue(Object)
+ */
+ public int getValue(PercentBaseContext context) {
+ return getValue();
+ }
+
/**
* Return true because all numbers are absolute.
* @return true.
package org.apache.fop.fo.properties;
+import org.apache.fop.datatypes.PercentBaseContext;
import org.apache.fop.datatypes.PercentBase;
import org.apache.fop.fo.expr.PropertyException;
* {@link #factor} should be applied to compute the actual length
*/
private PercentBase lbase = null;
+
+ private double resolvedValue;
/**
* Main constructor. Construct an object based on a factor (the percent,
* @see org.apache.fop.datatypes.Numeric#getNumericValue()
*/
public double getNumericValue() {
+ return getNumericValue(null);
+ }
+
+ /**
+ * Return the value of this Numeric.
+ * @param context Evaluation context
+ * @return the length in millipoints
+ * @see Numeric#getNumericValue(Object)
+ */
+ public double getNumericValue(PercentBaseContext context) {
try {
- return factor * lbase.getBaseLength();
+ resolvedValue = factor * lbase.getBaseLength(context);
+ return resolvedValue;
} catch (PropertyException exc) {
log.error(exc);
return 0;
return (int) getNumericValue();
}
+ /**
+ * Return the value of this numeric as a length in millipoints.
+ * @param Evaluation context
+ */
+ public int getValue(PercentBaseContext context) {
+ return (int) getNumericValue(context);
+ }
+
/**
* @return the String equivalent of this
*/
* what this is used for, or remove it from the signature.)
* @return an object implementing the PercentBase interface.
*/
- public PercentBase getPercentBase(FObj fo, PropertyList pl) {
+ public PercentBase getPercentBase(FObj fo, PropertyList pl) throws PropertyException {
if (percentBase == -1)
return null;
return new LengthBase(fo, pl, percentBase);
public String toString() {
return "Space[" +
- "min:" + getMinimum().getObject() +
- ", max:" + getMaximum().getObject() +
- ", opt:" + getOptimum().getObject() +
+ "min:" + getMinimum(null).getObject() +
+ ", max:" + getMaximum(null).getObject() +
+ ", opt:" + getOptimum(null).getObject() +
", precedence:" + precedence.getObject() +
", conditionality:" + conditionality.getObject() + "]";
}
package org.apache.fop.fo.properties;
+import org.apache.fop.datatypes.PercentBaseContext;
import org.apache.fop.datatypes.PercentBase;
import org.apache.fop.fo.FObj;
return tcolUnits * column.getLayoutDimension(PercentBase.TABLE_UNITS).floatValue();
}
+ /**
+ * Return the value of this Numeric.
+ * @param context Evaluation context
+ * @return the value
+ * @see Numeric#getNumericValue(Object)
+ */
+ public double getNumericValue(PercentBaseContext context) {
+ return getNumericValue();
+ }
+
/**
* Return the value as a length.
* @see org.apache.fop.datatypes.Length#getValue()
return (int) (tcolUnits * column.getLayoutDimension(PercentBase.TABLE_UNITS).floatValue());
}
+ /**
+ * Returns the length in 1/1000ths of a point (millipoints)
+ * @param Evaluation context
+ * @return the length in millipoints
+ */
+ public int getValue(PercentBaseContext context) {
+ return getValue();
+ }
+
/**
* Convert this to a String
* @return the string representation of this
--- /dev/null
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.layoutmgr;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.fop.datatypes.LengthBase;
+import org.apache.fop.datatypes.PercentBaseContext;
+import org.apache.fop.fo.FObj;
+
+/**
+ * The base class for nearly all LayoutManagers.
+ * Provides the functionality for merging the {@link LayoutManager}
+ * and the {@link org.apache.fop.datatypes.PercentBaseContext} interfaces
+ * into a common base calls for all higher LayoutManagers.
+ */
+public abstract class AbstractBaseLayoutManager
+ implements LayoutManager, PercentBaseContext {
+
+ protected boolean generatesReferenceArea = false;
+ protected boolean generatesBlockArea = false;
+
+ protected FObj fobj = null;
+
+ /**
+ * logging instance
+ */
+ protected static Log log = LogFactory.getLog(LayoutManager.class);
+
+ /**
+ * Abstract base layout manager.
+ */
+ public AbstractBaseLayoutManager() {
+ }
+
+ /**
+ * Abstract base layout manager.
+ *
+ * @param fo the formatting object for this layout manager
+ */
+ public AbstractBaseLayoutManager(FObj fo) {
+ fobj = fo;
+ setGeneratesReferenceArea(fo.generatesReferenceAreas());
+ if (getGeneratesReferenceArea()) {
+ setGeneratesBlockArea(true);
+ }
+ }
+
+ // --------- Property Resolution related functions --------- //
+
+ /**
+ * @see org.apache.fop.datatypes.PercentBaseContext#getBaseLength(int, FObj)
+ */
+ public int getBaseLength(int lengthBase, FObj fobj) {
+ if (fobj == getFObj()) {
+ switch (lengthBase) {
+ case LengthBase.CONTAINING_BLOCK_WIDTH:
+ return getAncestorBlockAreaIPD();
+ case LengthBase.CONTAINING_BLOCK_HEIGHT:
+ return getAncestorBlockAreaBPD();
+ case LengthBase.PARENT_AREA_WIDTH:
+ return getParentAreaIPD();
+ case LengthBase.CONTAINING_REFAREA_WIDTH:
+ return getReferenceAreaIPD();
+ default:
+ log.error("Unknown base type for LengthBase:" + lengthBase);
+ new Exception().printStackTrace();
+ return 0;
+ }
+ } else {
+ LayoutManager lm = getParent();
+ while (lm != null && fobj != lm.getFObj()) {
+ lm = lm.getParent();
+ }
+ if (lm != null) {
+ return lm.getBaseLength(lengthBase, fobj);
+ }
+ }
+ log.error("Cannot find LM to handle given FO for LengthBase.");
+ return 0;
+ }
+
+ /**
+ * Find the first ancestor area that is a block area
+ * and returns its IPD.
+ * @return the ipd of the ancestor block area
+ */
+ protected int getAncestorBlockAreaIPD() {
+ LayoutManager lm = getParent();
+ while (lm != null) {
+ if (lm.getGeneratesBlockArea() && !lm.getGeneratesLineArea()) {
+ return lm.getContentAreaIPD();
+ }
+ lm = lm.getParent();
+ }
+ if (lm == null) {
+ log.error("No parent LM found");
+ }
+ return 0;
+ }
+
+ /**
+ * Find the first ancestor area that is a block area
+ * and returns its BPD.
+ * @return the bpd of the ancestor block area
+ */
+ protected int getAncestorBlockAreaBPD() {
+ LayoutManager lm = getParent();
+ while (lm != null) {
+ if (lm.getGeneratesBlockArea() && !lm.getGeneratesLineArea()) {
+ return lm.getContentAreaBPD();
+ }
+ lm = lm.getParent();
+ }
+ if (lm == null) {
+ log.error("No parent LM found");
+ }
+ return 0;
+ }
+
+ /**
+ * Find the parent area and returns its IPD.
+ * @return the ipd of the parent area
+ */
+ protected int getParentAreaIPD() {
+ LayoutManager lm = getParent();
+ if (lm != null) {
+ return lm.getContentAreaIPD();
+ }
+ log.error("No parent LM found");
+ return 0;
+ }
+
+ /**
+ * Find the parent area and returns its BPD.
+ * @return the bpd of the parent area
+ */
+ protected int getParentAreaBPD() {
+ LayoutManager lm = getParent();
+ if (lm != null) {
+ return lm.getContentAreaBPD();
+ }
+ log.error("No parent LM found");
+ return 0;
+ }
+
+ /**
+ * Find the first ancestor area that is a reference area
+ * and returns its IPD.
+ * @return the ipd of the ancestor reference area
+ */
+ public int getReferenceAreaIPD() {
+ LayoutManager lm = getParent();
+ while (lm != null) {
+ if (lm.getGeneratesReferenceArea()) {
+ return lm.getContentAreaIPD();
+ }
+ lm = lm.getParent();
+ }
+ if (lm == null) {
+ log.error("No parent LM found");
+ }
+ return 0;
+ }
+
+ /**
+ * Find the first ancestor area that is a reference area
+ * and returns its BPD.
+ * @return the bpd of the ancestor reference area
+ */
+ protected int getReferenceAreaBPD() {
+ LayoutManager lm = getParent();
+ while (lm != null) {
+ if (lm.getGeneratesReferenceArea()) {
+ return lm.getContentAreaBPD();
+ }
+ lm = lm.getParent();
+ }
+ if (lm == null) {
+ log.error("No parent LM found");
+ }
+ return 0;
+ }
+
+ /**
+ * Returns the IPD of the content area
+ * @return the IPD of the content area
+ * @see LayoutManager#getContentAreaIPD
+ */
+ public int getContentAreaIPD() {
+ log.error("getContentAreaIPD called when it should have been overwritten");
+ return 0;
+ }
+
+ /**
+ * Returns the BPD of the content area
+ * @return the BPD of the content area
+ * @see LayoutManager#getContentAreaBPD
+ */
+ public int getContentAreaBPD() {
+ log.error("getContentAreaBPD called when it should have been overwritten");
+ return 0;
+ }
+
+ /**
+ * @see LayoutManager#getGeneratesReferenceArea
+ */
+ public boolean getGeneratesReferenceArea() {
+ return generatesReferenceArea;
+ }
+
+ /**
+ * Lets implementing LM set the flag indicating if they
+ * generate reference areas.
+ * @param generatesReferenceArea if true the areas generates by this LM are
+ * reference areas.
+ */
+ protected void setGeneratesReferenceArea(boolean generatesReferenceArea) {
+ this.generatesReferenceArea = generatesReferenceArea;
+ }
+
+ /**
+ * @see LayoutManager#getGeneratesBlockArea
+ */
+ public boolean getGeneratesBlockArea() {
+ return generatesBlockArea;
+ }
+
+ /**
+ * Lets implementing LM set the flag indicating if they
+ * generate block areas.
+ * @param generatesBlockArea if true the areas generates by this LM are block areas.
+ */
+ protected void setGeneratesBlockArea(boolean generatesBlockArea) {
+ this.generatesBlockArea = generatesBlockArea;
+ }
+
+ /**
+ * @see org.apache.fop.layoutmgr.LayoutManager#getGeneratesLineArea
+ */
+ public boolean getGeneratesLineArea() {
+ return false;
+ }
+
+ public FObj getFObj() {
+ return fobj;
+ }
+
+}
import org.apache.fop.fo.FONode;
import org.apache.fop.area.Area;
import org.apache.fop.area.PageViewport;
+import org.apache.fop.datatypes.LengthBase;
+import org.apache.fop.datatypes.PercentBaseContext;
import org.apache.fop.fo.Constants;
import org.apache.fop.fo.flow.RetrieveMarker;
/**
* The base class for most LayoutManagers.
*/
-public abstract class AbstractLayoutManager implements LayoutManager, Constants {
+public abstract class AbstractLayoutManager extends AbstractBaseLayoutManager
+ implements Constants {
protected LayoutManager parentLM = null;
protected List childLMs = null;
protected ListIterator fobjIter = null;
/** child LM and child LM iterator during getNextBreakPoss phase */
protected LayoutManager curChildLM = null;
protected ListIterator childLMiter = null;
-
- /**
- * logging instance
- */
- protected static Log log = LogFactory.getLog(LayoutManager.class);
-
+
/**
* Abstract layout manager.
*/
* @param fo the formatting object for this layout manager
*/
public AbstractLayoutManager(FObj fo) {
+ super(fo);
if (fo == null) {
throw new IllegalStateException("Null formatting object found.");
}
return this.parentLM;
}
+ public void initialize() {
+ // Empty
+ }
+
/**
* Return currently active child LayoutManager or null if
* all children have finished layout.
}
while (childLMiter.hasNext()) {
curChildLM = (LayoutManager) childLMiter.next();
+ curChildLM.initialize();
return curChildLM;
}
return null;
public void addAreas(PositionIterator posIter, LayoutContext context) {
}
+ /**
+ * @see org.apache.fop.layoutmgr.LayoutManager#getNextKnuthElements(LayoutContext, int)
+ */
public LinkedList getNextKnuthElements(LayoutContext context,
int alignment) {
log.warn("null implementation of getNextKnuthElements() called!");
addChildLM(lm);
}
}
+
}
*/
public BlockContainerLayoutManager(BlockContainer node) {
super(node);
- initialize();
}
- private void initialize() {
+ public void initialize() {
abProps = getBlockContainerFO().getCommonAbsolutePosition();
foBlockSpaceBefore = new SpaceVal(getBlockContainerFO().getCommonMarginBlock()
- .spaceBefore).getSpace();
+ .spaceBefore, this).getSpace();
foBlockSpaceAfter = new SpaceVal(getBlockContainerFO().getCommonMarginBlock()
- .spaceAfter).getSpace();
+ .spaceAfter, this).getSpace();
boolean rotated = (getBlockContainerFO().getReferenceOrientation() % 180 != 0);
if (rotated) {
- height = getBlockContainerFO().getInlineProgressionDimension().getOptimum().getLength();
- width = getBlockContainerFO().getBlockProgressionDimension().getOptimum().getLength();
+ height = getBlockContainerFO().getInlineProgressionDimension()
+ .getOptimum(this).getLength();
+ width = getBlockContainerFO().getBlockProgressionDimension()
+ .getOptimum(this).getLength();
} else {
- height = getBlockContainerFO().getBlockProgressionDimension().getOptimum().getLength();
- width = getBlockContainerFO().getInlineProgressionDimension().getOptimum().getLength();
+ height = getBlockContainerFO().getBlockProgressionDimension()
+ .getOptimum(this).getLength();
+ width = getBlockContainerFO().getInlineProgressionDimension()
+ .getOptimum(this).getLength();
}
bpUnit = 0; //layoutProps.blockProgressionUnit;
if (bpUnit == 0) {
// use optimum space values
adjustedSpaceBefore = getBlockContainerFO().getCommonMarginBlock()
- .spaceBefore.getSpace().getOptimum().getLength().getValue();
+ .spaceBefore.getSpace().getOptimum(this).getLength().getValue(this);
adjustedSpaceAfter = getBlockContainerFO().getCommonMarginBlock()
- .spaceAfter.getSpace().getOptimum().getLength().getValue();
+ .spaceAfter.getSpace().getOptimum(this).getLength().getValue(this);
} else {
// use minimum space values
adjustedSpaceBefore = getBlockContainerFO().getCommonMarginBlock()
- .spaceBefore.getSpace().getMinimum().getLength().getValue();
+ .spaceBefore.getSpace().getMinimum(this).getLength().getValue(this);
adjustedSpaceAfter = getBlockContainerFO().getCommonMarginBlock()
- .spaceAfter.getSpace().getMinimum().getLength().getValue();
+ .spaceAfter.getSpace().getMinimum(this).getLength().getValue(this);
}
}
/** @return the content IPD */
protected int getRotatedIPD() {
return getBlockContainerFO().getInlineProgressionDimension()
- .getOptimum().getLength().getValue();
+ .getOptimum(this).getLength().getValue(this);
}
private int getSpaceBefore() {
private int getBPIndents() {
int indents = 0;
indents += getBlockContainerFO().getCommonMarginBlock()
- .spaceBefore.getOptimum().getLength().getValue();
+ .spaceBefore.getOptimum(this).getLength().getValue(this);
indents += getBlockContainerFO().getCommonMarginBlock()
- .spaceAfter.getOptimum().getLength().getValue();
+ .spaceAfter.getOptimum(this).getLength().getValue(this);
indents += getBlockContainerFO().getCommonBorderPaddingBackground()
- .getBPPaddingAndBorder(false);
+ .getBPPaddingAndBorder(false, this);
return indents;
}
private int getIPIndents() {
int iIndents = 0;
- iIndents += getBlockContainerFO().getCommonMarginBlock().startIndent.getValue();
- iIndents += getBlockContainerFO().getCommonMarginBlock().endIndent.getValue();
+ iIndents += getBlockContainerFO().getCommonMarginBlock().startIndent.getValue(this);
+ iIndents += getBlockContainerFO().getCommonMarginBlock().endIndent.getValue(this);
return iIndents;
}
int maxbpd = context.getStackLimit().opt;
int allocBPD, allocIPD;
if (height.getEnum() != EN_AUTO) {
- allocBPD = height.getValue(); //this is the content-height
+ allocBPD = height.getValue(this); //this is the content-height
allocBPD += getBPIndents();
} else {
allocBPD = maxbpd;
autoHeight = true;
}
if (width.getEnum() != EN_AUTO) {
- allocIPD = width.getValue(); //this is the content-width
+ allocIPD = width.getValue(this); //this is the content-width
allocIPD += getIPIndents();
} else {
allocIPD = referenceIPD;
vpContentBPD = allocBPD - getBPIndents();
vpContentIPD = allocIPD - getIPIndents();
-
+ setContentAreaIPD(vpContentIPD);
double contentRectOffsetX = 0;
- contentRectOffsetX += getBlockContainerFO().getCommonMarginBlock().startIndent.getValue();
+ contentRectOffsetX += getBlockContainerFO()
+ .getCommonMarginBlock().startIndent.getValue(this);
double contentRectOffsetY = 0;
contentRectOffsetY += getBlockContainerFO()
.getCommonBorderPaddingBackground().getBorderBeforeWidth(false);
contentRectOffsetY += getBlockContainerFO()
- .getCommonBorderPaddingBackground().getPaddingBefore(false);
+ .getCommonBorderPaddingBackground().getPaddingBefore(false, this);
Rectangle2D rect = new Rectangle2D.Double(
contentRectOffsetX, contentRectOffsetY,
Point offset = getAbsOffset();
int allocBPD, allocIPD;
if (height.getEnum() != EN_AUTO) {
- allocBPD = height.getValue(); //this is the content-height
+ allocBPD = height.getValue(this); //this is the content-height
allocBPD += getBPIndents();
} else {
allocBPD = 0;
allocBPD = availHeight;
allocBPD -= offset.y;
if (abProps.bottom.getEnum() != EN_AUTO) {
- allocBPD -= abProps.bottom.getValue();
+ allocBPD -= abProps.bottom.getValue(this);
if (allocBPD < 0) {
log.error("The current combination of top and bottom properties results"
+ " in a negative extent for the block-container. 'bottom' may be"
- + " at most " + (allocBPD + abProps.bottom.getValue()) + " mpt,"
- + " but was actually " + abProps.bottom.getValue() + " mpt."
+ + " at most " + (allocBPD + abProps.bottom.getValue(this)) + " mpt,"
+ + " but was actually " + abProps.bottom.getValue(this) + " mpt."
+ " The nominal available height is " + availHeight + " mpt.");
allocBPD = 0;
}
}
}
if (width.getEnum() != EN_AUTO) {
- allocIPD = width.getValue(); //this is the content-width
+ allocIPD = width.getValue(this); //this is the content-width
allocIPD += getIPIndents();
} else {
int availWidth;
}
allocIPD = availWidth;
if (abProps.left.getEnum() != EN_AUTO) {
- allocIPD -= abProps.left.getValue();
+ allocIPD -= abProps.left.getValue(this);
}
if (abProps.right.getEnum() != EN_AUTO) {
- allocIPD -= abProps.right.getValue();
+ allocIPD -= abProps.right.getValue(this);
if (allocIPD < 0) {
log.error("The current combination of left and right properties results"
+ " in a negative extent for the block-container. 'right' may be"
- + " at most " + (allocIPD + abProps.right.getValue()) + " mpt,"
- + " but was actually " + abProps.right.getValue() + " mpt."
+ + " at most " + (allocIPD + abProps.right.getValue(this)) + " mpt,"
+ + " but was actually " + abProps.right.getValue(this) + " mpt."
+ " The nominal available width is " + availWidth + " mpt.");
allocIPD = 0;
}
log.error("The current combination of left and right properties results"
+ " in a negative extent for the block-container. 'left' may be"
+ " at most " + allocIPD + " mpt,"
- + " but was actually " + abProps.left.getValue() + " mpt."
+ + " but was actually " + abProps.left.getValue(this) + " mpt."
+ " The nominal available width is " + availWidth + " mpt.");
allocIPD = 0;
}
vpContentIPD = allocIPD - getIPIndents();
double contentRectOffsetX = offset.getX();
- contentRectOffsetX += getBlockContainerFO().getCommonMarginBlock().startIndent.getValue();
+ contentRectOffsetX += getBlockContainerFO()
+ .getCommonMarginBlock().startIndent.getValue(this);
double contentRectOffsetY = offset.getY();
contentRectOffsetY += getSpaceBefore();
contentRectOffsetY += getBlockContainerFO()
.getCommonBorderPaddingBackground().getBorderBeforeWidth(false);
contentRectOffsetY += getBlockContainerFO()
- .getCommonBorderPaddingBackground().getPaddingBefore(false);
+ .getCommonBorderPaddingBackground().getPaddingBefore(false, this);
Rectangle2D rect = new Rectangle2D.Double(
contentRectOffsetX, contentRectOffsetY,
int x = 0;
int y = 0;
if (abProps.left.getEnum() != EN_AUTO) {
- x = abProps.left.getValue();
+ x = abProps.left.getValue(this);
}
if (abProps.top.getEnum() != EN_AUTO) {
- y = abProps.top.getValue();
+ y = abProps.top.getValue(this);
}
return new Point(x, y);
}
// to reach a multiple of bpUnit
if (bSpaceBefore && bSpaceAfter) {
foBlockSpaceBefore = new SpaceVal(getBlockContainerFO()
- .getCommonMarginBlock().spaceBefore).getSpace();
+ .getCommonMarginBlock().spaceBefore, this).getSpace();
foBlockSpaceAfter = new SpaceVal(getBlockContainerFO()
- .getCommonMarginBlock().spaceAfter).getSpace();
+ .getCommonMarginBlock().spaceAfter, this).getSpace();
adjustedSpaceBefore = (neededUnits(splitLength
+ foBlockSpaceBefore.min
+ foBlockSpaceAfter.min)
TraitSetter.setProducerID(viewportBlockArea, getBlockContainerFO().getId());
TraitSetter.addBorders(viewportBlockArea,
- getBlockContainerFO().getCommonBorderPaddingBackground());
- TraitSetter.addBackground(viewportBlockArea,
- getBlockContainerFO().getCommonBorderPaddingBackground());
+ getBlockContainerFO().getCommonBorderPaddingBackground(), this);
+ // TraitSetter.addBackground(viewportBlockArea,
+ // getBlockContainerFO().getCommonBorderPaddingBackground(),
+ // this);
TraitSetter.addMargins(viewportBlockArea,
getBlockContainerFO().getCommonBorderPaddingBackground(),
- getBlockContainerFO().getCommonMarginBlock());
+ getBlockContainerFO().getCommonMarginBlock(),
+ this);
viewportBlockArea.setCTM(absoluteCTM);
viewportBlockArea.setClip(clip);
protected void flush() {
viewportBlockArea.addBlock(referenceArea, autoHeight);
+ TraitSetter.addBackground(viewportBlockArea,
+ getBlockContainerFO().getCommonBorderPaddingBackground(),
+ this);
+
// Fake a 0 height for absolute positioned blocks.
int saveBPD = viewportBlockArea.getBPD();
if (viewportBlockArea.getPositioning() == Block.ABSOLUTE) {
protected BlockContainer getBlockContainerFO() {
return (BlockContainer) fobj;
}
+
+ // --------- Property Resolution related functions --------- //
+
+ /**
+ * @see org.apache.fop.layoutmgr.LayoutManager#getGeneratesReferenceArea
+ */
+ public boolean getGeneratesReferenceArea() {
+ return true;
+ }
+
+ /**
+ * @see org.apache.fop.layoutmgr.LayoutManager#getGeneratesBlockArea
+ */
+ public boolean getGeneratesBlockArea() {
+ return true;
+ }
+
}
package org.apache.fop.layoutmgr;
import java.util.LinkedList;
-import java.util.ListIterator;
import java.util.List;
+import java.util.ListIterator;
-import org.apache.fop.fonts.Font;
-import org.apache.fop.layoutmgr.inline.InlineLevelLayoutManager;
-import org.apache.fop.layoutmgr.inline.LineLayoutManager;
import org.apache.fop.area.Area;
import org.apache.fop.area.Block;
import org.apache.fop.area.LineArea;
-import org.apache.fop.traits.SpaceVal;
+import org.apache.fop.datatypes.Length;
+import org.apache.fop.fonts.Font;
+import org.apache.fop.layoutmgr.inline.InlineLevelLayoutManager;
+import org.apache.fop.layoutmgr.inline.LineLayoutManager;
import org.apache.fop.traits.MinOptMax;
+import org.apache.fop.traits.SpaceVal;
/**
* LayoutManager for a block FO.
protected ListIterator proxyLMiter;
private int lead = 12000;
- private int lineHeight = 14000;
+ private Length lineHeight;
private int follow = 2000;
private int middleShift = 0;
public BlockLayoutManager(org.apache.fop.fo.flow.Block inBlock) {
super(inBlock);
proxyLMiter = new ProxyLMiter();
+ }
+ public void initialize() {
Font fs = getBlockFO().getCommonFont().getFontState(
- getBlockFO().getFOEventHandler().getFontInfo());
+ getBlockFO().getFOEventHandler().getFontInfo(), this);
lead = fs.getAscender();
follow = -fs.getDescender();
middleShift = -fs.getXHeight() / 2;
- lineHeight = getBlockFO().getLineHeight().getOptimum().getLength().getValue();
- initialize();
- }
-
- private void initialize() {
- foSpaceBefore = new SpaceVal(getBlockFO().getCommonMarginBlock().spaceBefore).getSpace();
- foSpaceAfter = new SpaceVal(getBlockFO().getCommonMarginBlock().spaceAfter).getSpace();
+ lineHeight = getBlockFO().getLineHeight().getOptimum(this).getLength();
+ foSpaceBefore = new SpaceVal(getBlockFO().getCommonMarginBlock().spaceBefore, this)
+ .getSpace();
+ foSpaceAfter = new SpaceVal(getBlockFO().getCommonMarginBlock().spaceAfter, this)
+ .getSpace();
bpUnit = 0; // non-standard extension
if (bpUnit == 0) {
// use optimum space values
- adjustedSpaceBefore = getBlockFO().getCommonMarginBlock().spaceBefore.getSpace().getOptimum().getLength().getValue();
- adjustedSpaceAfter = getBlockFO().getCommonMarginBlock().spaceAfter.getSpace().getOptimum().getLength().getValue();
+ adjustedSpaceBefore = getBlockFO().getCommonMarginBlock().spaceBefore.getSpace()
+ .getOptimum(this).getLength().getValue(this);
+ adjustedSpaceAfter = getBlockFO().getCommonMarginBlock().spaceAfter.getSpace()
+ .getOptimum(this).getLength().getValue(this);
} else {
// use minimum space values
- adjustedSpaceBefore = getBlockFO().getCommonMarginBlock().spaceBefore.getSpace().getMinimum().getLength().getValue();
- adjustedSpaceAfter = getBlockFO().getCommonMarginBlock().spaceAfter.getSpace().getMinimum().getLength().getValue();
+ adjustedSpaceBefore = getBlockFO().getCommonMarginBlock().spaceBefore.getSpace()
+ .getMinimum(this).getLength().getValue(this);
+ adjustedSpaceAfter = getBlockFO().getCommonMarginBlock().spaceAfter.getSpace()
+ .getMinimum(this).getLength().getValue(this);
}
}
*/
protected class ProxyLMiter extends LMiter {
+ /*
+ * Constructs a proxy iterator for Block LM.
+ */
public ProxyLMiter() {
super(BlockLayoutManager.this);
listLMs = new java.util.ArrayList(10);
}
+ /**
+ * @return true if there are more child lms
+ */
public boolean hasNext() {
return (curPos < listLMs.size()) ? true : createNextChildLMs(curPos);
}
+ /**
+ * @return true if new child lms were added
+ */
protected boolean createNextChildLMs(int pos) {
List newLMs = createChildLMs(pos + 1 - listLMs.size());
if (newLMs != null) {
private int getIPIndents() {
int iIndents = 0;
- iIndents += getBlockFO().getCommonMarginBlock().startIndent.getValue();
- iIndents += getBlockFO().getCommonMarginBlock().endIndent.getValue();
+ iIndents += getBlockFO().getCommonMarginBlock().startIndent.getValue(this);
+ iIndents += getBlockFO().getCommonMarginBlock().endIndent.getValue(this);
return iIndents;
}
|| !getBlockFO().getKeepWithNext().getWithinColumn().isAuto();
}
+ /**
+ * @see org.apache.fop.layoutmgr.LayoutManager#addAreas(org.apache.fop.layoutmgr.PositionIterator, org.apache.fop.layoutmgr.LayoutContext)
+ */
public void addAreas(PositionIterator parentIter,
LayoutContext layoutContext) {
//System.out.println(" BLM.addAreas>");
// add space before and / or after the paragraph
// to reach a multiple of bpUnit
if (bSpaceBefore && bSpaceAfter) {
- foSpaceBefore = new SpaceVal(getBlockFO().getCommonMarginBlock().spaceBefore).getSpace();
- foSpaceAfter = new SpaceVal(getBlockFO().getCommonMarginBlock().spaceAfter).getSpace();
+ foSpaceBefore = new SpaceVal(getBlockFO()
+ .getCommonMarginBlock().spaceBefore, this).getSpace();
+ foSpaceAfter = new SpaceVal(getBlockFO()
+ .getCommonMarginBlock().spaceAfter, this).getSpace();
adjustedSpaceBefore = (neededUnits(splitLength
+ foSpaceBefore.min
+ foSpaceAfter.min)
childLM.addAreas(childPosIter, lc);
}
- //int bIndents = getBlockFO().getCommonBorderPaddingBackground().getBPPaddingAndBorder(false);
+ //int bIndents = getBlockFO().getCommonBorderPaddingBackground()
+ // .getBPPaddingAndBorder(false);
if (markers != null) {
getCurrentPV().addMarkers(markers, false, isFirst(firstPos), isLast(lastPos));
* its own area. This includes setting the content IPD and the maximum
* BPD.
* @param childArea area to get the parent area for
+ * @return the parent area
*/
public Area getParentArea(Area childArea) {
if (curBlockArea == null) {
curBlockArea = new Block();
+ int contentIPD = referenceIPD - getIPIndents();
+
+ curBlockArea.setIPD(contentIPD/*parentwidth*/);
+
TraitSetter.addBreaks(curBlockArea,
getBlockFO().getBreakBefore(), getBlockFO().getBreakAfter());
// set traits
TraitSetter.setProducerID(curBlockArea, getBlockFO().getId());
TraitSetter.addBorders(curBlockArea,
- getBlockFO().getCommonBorderPaddingBackground());
+ getBlockFO().getCommonBorderPaddingBackground(), this);
TraitSetter.addMargins(curBlockArea,
getBlockFO().getCommonBorderPaddingBackground(),
- getBlockFO().getCommonMarginBlock());
+ getBlockFO().getCommonMarginBlock(),
+ this);
// Set up dimensions
// Get reference IPD from parentArea
parentwidth -= getIPIndents();
*/
- int contentIPD = referenceIPD - getIPIndents();
-
- curBlockArea.setIPD(contentIPD/*parentwidth*/);
- TraitSetter.addBackground(curBlockArea,
- getBlockFO().getCommonBorderPaddingBackground());
setCurrentArea(curBlockArea); // ??? for generic operations
}
return curBlockArea;
}
}
+ /**
+ * Force current area to be added to parent area.
+ * @see org.apache.fop.layoutmgr.BlockStackingLayoutManager#flush()
+ */
+ protected void flush() {
+ if (curBlockArea != null) {
+ TraitSetter.addBackground(curBlockArea,
+ getBlockFO().getCommonBorderPaddingBackground(),
+ this);
+ super.flush();
+ }
+ }
+
/**
* @see org.apache.fop.layoutmgr.LayoutManager#resetPosition(org.apache.fop.layoutmgr.Position)
*/
/**
* convenience method that returns the Block node
+ * @return the block node
*/
protected org.apache.fop.fo.flow.Block getBlockFO() {
return (org.apache.fop.fo.flow.Block) fobj;
}
+
+ // --------- Property Resolution related functions --------- //
+
+ /**
+ * Returns the IPD of the content area
+ * @return the IPD of the content area
+ */
+ public int getContentAreaIPD() {
+ if (curBlockArea != null) {
+ return curBlockArea.getIPD();
+ }
+ return super.getContentAreaIPD();
+ }
+
+
+ /**
+ * Returns the BPD of the content area
+ * @return the BPD of the content area
+ */
+ public int getContentAreaBPD() {
+ if (curBlockArea != null) {
+ return curBlockArea.getBPD();
+ }
+ return -1;
+ }
+
+ /**
+ * @see org.apache.fop.layoutmgr.LayoutManager#getGeneratesBlockArea
+ */
+ public boolean getGeneratesBlockArea() {
+ return true;
+ }
+
}
protected boolean bSpaceBeforeServed = false;
/** Reference IPD available */
protected int referenceIPD = 0;
-
- /* holds the (one-time use) fo:block space-before
- and -after properties. Large fo:blocks are split
- into multiple Area.Blocks to accomodate the subsequent
- regions (pages) they are placed on. space-before
- is applied at the beginning of the first
- Block and space-after at the end of the last Block
- used in rendering the fo:block.
- */
+ /**
+ * Holds the (one-time use) fo:block space-before
+ * and -after properties. Large fo:blocks are split
+ * into multiple Area. Blocks to accomodate the subsequent
+ * regions (pages) they are placed on. space-before
+ * is applied at the beginning of the first
+ * Block and space-after at the end of the last Block
+ * used in rendering the fo:block.
+ */
protected MinOptMax foSpaceBefore = null;
+ /** see foSpaceBefore */
protected MinOptMax foSpaceAfter = null;
private int lastGeneratedPosition = -1;
private int smallestPosNumberChecked = Integer.MAX_VALUE;
private Position auxiliaryPosition;
+
+ private int contentAreaIPD = 0;
+ /**
+ * @param the fo this LM deals with
+ */
public BlockStackingLayoutManager(FObj node) {
super(node);
+ setGeneratesBlockArea(true);
fobj = node;
}
- /** return current area being filled
+ /**
+ * @return current area being filled
*/
protected BlockParent getCurrentArea() {
return this.parentArea;
/**
* Set the current area being filled.
+ * @param parentArea the current area to be filled
*/
protected void setCurrentArea(BlockParent parentArea) {
this.parentArea = parentArea;
return (int) Math.ceil((float)len / bpUnit);
}
+ /**
+ * @see LayoutManager#getNextKnuthElements(LayoutContext, int)
+ */
public LinkedList getNextKnuthElements(LayoutContext context, int alignment) {
/* LF *///System.err.println("BLM.getNextKnuthElements> keep-together = "
// + layoutProps.keepTogether.getType());
BlockLevelLayoutManager prevLM = null; // previously active LM
referenceIPD = context.getRefIPD();
+
int iIndents = 0;
int bIndents = 0;
if (fobj instanceof org.apache.fop.fo.flow.Block) {
org.apache.fop.fo.flow.Block block = (org.apache.fop.fo.flow.Block)fobj;
- iIndents = block.getCommonMarginBlock().startIndent.getValue()
- + block.getCommonMarginBlock().endIndent.getValue();
- bIndents = block.getCommonBorderPaddingBackground().getBPPaddingAndBorder(false);
+ iIndents = block.getCommonMarginBlock().startIndent.getValue(this)
+ + block.getCommonMarginBlock().endIndent.getValue(this);
+ bIndents = block.getCommonBorderPaddingBackground().getBPPaddingAndBorder(false, this);
}
int ipd = referenceIPD - iIndents;
MinOptMax stackSize = new MinOptMax();
// Set context for percentage property values.
- fobj.setLayoutDimension(PercentBase.BLOCK_IPD, ipd);
- fobj.setLayoutDimension(PercentBase.BLOCK_BPD, -1);
+ setContentAreaIPD(ipd);
LinkedList returnedList = null;
LinkedList contentList = new LinkedList();
return returnList;
}
+ /**
+ * @see org.apache.fop.layoutmgr.BlockLevelLayoutManager#negotiateBPDAdjustment(int, org.apache.fop.layoutmgr.KnuthElement)
+ */
public int negotiateBPDAdjustment(int adj, KnuthElement lastElement) {
/*LF*/ //System.out.println(" BLM.negotiateBPDAdjustment> " + adj);
/*LF*/ //System.out.println(" lastElement e' " + (lastElement.isPenalty()
}
}
+ /**
+ * @see BlockLevelLayoutManager#discardSpace(KnuthGlue)
+ */
public void discardSpace(KnuthGlue spaceGlue) {
//System.out.println(" BLM.discardSpace> " + spaceGlue.getPosition().getClass().getName());
Position innerPosition = ((NonLeafPosition) spaceGlue.getPosition()).getPosition();
}
}
+ /**
+ * @see LayoutManager#getChangedKnuthElements(List, int)
+ */
public LinkedList getChangedKnuthElements(List oldList, int alignment) {
/*LF*/ //System.out.println("");
/*LF*/ //System.out.println(" BLM.getChangedKnuthElements> inizio: oldList.size() = "
/**
* Creates Knuth elements for before border padding and adds them to the return list.
* @param returnList return list to add the additional elements to
- * @param returnPosition applicable return position
*/
protected void addKnuthElementsForBorderPaddingBefore(LinkedList returnList/*,
Position returnPosition*/) {
if (borderAndPadding != null) {
//TODO Handle conditionality
int bpBefore = borderAndPadding.getBorderBeforeWidth(false)
- + borderAndPadding.getPaddingBefore(false);
+ + borderAndPadding.getPaddingBefore(false, this);
if (bpBefore > 0) {
returnList.add(new KnuthBox(bpBefore, getAuxiliaryPosition(), true));
}
/**
* Creates Knuth elements for after border padding and adds them to the return list.
* @param returnList return list to add the additional elements to
- * @param returnPosition applicable return position
*/
protected void addKnuthElementsForBorderPaddingAfter(LinkedList returnList/*,
Position returnPosition*/) {
if (borderAndPadding != null) {
//TODO Handle conditionality
int bpAfter = borderAndPadding.getBorderAfterWidth(false)
- + borderAndPadding.getPaddingAfter(false);
+ + borderAndPadding.getPaddingAfter(false, this);
if (bpAfter > 0) {
returnList.add(new KnuthBox(bpAfter, getAuxiliaryPosition(), true));
}
/**
* Creates Knuth elements for break-before and adds them to the return list.
* @param returnList return list to add the additional elements to
- * @param returnPosition applicable return position
* @return true if an element has been added due to a break-before.
*/
protected boolean addKnuthElementsForBreakBefore(LinkedList returnList/*,
/**
* Creates Knuth elements for break-after and adds them to the return list.
* @param returnList return list to add the additional elements to
- * @param returnPosition applicable return position
* @return true if an element has been added due to a break-after.
*/
protected boolean addKnuthElementsForBreakAfter(LinkedList returnList/*,
/**
* Creates Knuth elements for space-before and adds them to the return list.
* @param returnList return list to add the additional elements to
- * @param returnPosition applicable return position
* @param alignment vertical alignment
*/
protected void addKnuthElementsForSpaceBefore(LinkedList returnList/*,
// append elements representing space-before
if (bpUnit > 0
|| spaceBefore != null
- && !(spaceBefore.getMinimum().getLength().getValue() == 0
- && spaceBefore.getMaximum().getLength().getValue() == 0)) {
+ && !(spaceBefore.getMinimum(this).getLength().getValue(this) == 0
+ && spaceBefore.getMaximum(this).getLength().getValue(this) == 0)) {
if (spaceBefore != null && !spaceBefore.getSpace().isDiscard()) {
// add elements to prevent the glue to be discarded
returnList.add(new KnuthBox(0, getAuxiliaryPosition(), false));
getAuxiliaryPosition(), true));
} else /*if (alignment == EN_JUSTIFY)*/ {
returnList.add(new KnuthGlue(
- spaceBefore.getOptimum().getLength().getValue(),
- spaceBefore.getMaximum().getLength().getValue()
- - spaceBefore.getOptimum().getLength().getValue(),
- spaceBefore.getOptimum().getLength().getValue()
- - spaceBefore.getMinimum().getLength().getValue(),
+ spaceBefore.getOptimum(this).getLength().getValue(this),
+ spaceBefore.getMaximum(this).getLength().getValue(this)
+ - spaceBefore.getOptimum(this).getLength().getValue(this),
+ spaceBefore.getOptimum(this).getLength().getValue(this)
+ - spaceBefore.getMinimum(this).getLength().getValue(this),
BlockLevelLayoutManager.SPACE_BEFORE_ADJUSTMENT,
getAuxiliaryPosition(), true));
} /*else {
returnList.add(new KnuthGlue(
- spaceBefore.getOptimum().getLength().getValue(),
+ spaceBefore.getOptimum().getLength().getValue(this),
0, 0, BlockLevelLayoutManager.SPACE_BEFORE_ADJUSTMENT,
returnPosition, true));
}*/
/**
* Creates Knuth elements for space-after and adds them to the return list.
* @param returnList return list to add the additional elements to
- * @param returnPosition applicable return position
* @param alignment vertical alignment
*/
protected void addKnuthElementsForSpaceAfter(LinkedList returnList/*, Position returnPosition*/,
// append elements representing space-after
if (bpUnit > 0
|| spaceAfter != null
- && !(spaceAfter.getMinimum().getLength().getValue() == 0
- && spaceAfter.getMaximum().getLength().getValue() == 0)) {
+ && !(spaceAfter.getMinimum(this).getLength().getValue(this) == 0
+ && spaceAfter.getMaximum(this).getLength().getValue(this) == 0)) {
if (spaceAfter != null && !spaceAfter.getSpace().isDiscard()) {
returnList.add(new KnuthPenalty(0, KnuthElement.INFINITE,
false, getAuxiliaryPosition(), false));
getAuxiliaryPosition(), true));
} else /*if (alignment == EN_JUSTIFY)*/ {
returnList.add(new KnuthGlue(
- spaceAfter.getOptimum().getLength().getValue(),
- spaceAfter.getMaximum().getLength().getValue()
- - spaceAfter.getOptimum().getLength().getValue(),
- spaceAfter.getOptimum().getLength().getValue()
- - spaceAfter.getMinimum().getLength().getValue(),
+ spaceAfter.getOptimum(this).getLength().getValue(this),
+ spaceAfter.getMaximum(this).getLength().getValue(this)
+ - spaceAfter.getOptimum(this).getLength().getValue(this),
+ spaceAfter.getOptimum(this).getLength().getValue(this)
+ - spaceAfter.getMinimum(this).getLength().getValue(this),
BlockLevelLayoutManager.SPACE_AFTER_ADJUSTMENT, getAuxiliaryPosition(),
(!spaceAfter.getSpace().isDiscard()) ? false : true));
} /*else {
returnList.add(new KnuthGlue(
- spaceAfter.getOptimum().getLength().getValue(), 0, 0,
+ spaceAfter.getOptimum().getLength().getValue(this), 0, 0,
BlockLevelLayoutManager.SPACE_AFTER_ADJUSTMENT, returnPosition,
(!spaceAfter.getSpace().isDiscard()) ? false : true));
}*/
}
}
+ /**
+ * Returns the IPD of the content area
+ * @return the IPD of the content area
+ */
+ public int getContentAreaIPD() {
+ return contentAreaIPD;
+ }
+
+ protected void setContentAreaIPD(int contentAreaIPD) {
+ this.contentAreaIPD = contentAreaIPD;
+ }
+
+ /**
+ * Returns the BPD of the content area
+ * @return the BPD of the content area
+ */
+ public int getContentAreaBPD() {
+ return -1;
+ }
+
}
// set layout dimensions
int flowIPD = getCurrentPV().getCurrentSpan().getColumnWidth();
int flowBPD = (int) getCurrentPV().getBodyRegion().getBPD();
- fobj.setLayoutDimension(PercentBase.REFERENCE_AREA_IPD, flowIPD);
- fobj.setLayoutDimension(PercentBase.REFERENCE_AREA_BPD, flowBPD);
- fobj.setLayoutDimension(PercentBase.BLOCK_IPD, context.getRefIPD());
- fobj.setLayoutDimension(PercentBase.BLOCK_BPD, context.getStackLimit().opt);
// currently active LM
BlockLevelLayoutManager curLM;
reset(null);
}
}
+ /**
+ * Returns the IPD of the content area
+ * @return the IPD of the content area
+ */
+ public int getContentAreaIPD() {
+ return getCurrentPV().getCurrentSpan().getColumnWidth();
+ }
+
+ /**
+ * Returns the BPD of the content area
+ * @return the BPD of the content area
+ */
+ public int getContentAreaBPD() {
+ return (int) getCurrentPV().getBodyRegion().getBPD();
+ }
+
}
import java.util.List;
import org.apache.fop.area.Area;
+import org.apache.fop.datatypes.PercentBaseContext;
+import org.apache.fop.fo.FObj;
/**
* The interface for all LayoutManagers.
*/
-public interface LayoutManager {
+public interface LayoutManager extends PercentBaseContext {
/**
* Set the parent layout manager.
*/
LayoutManager getParent();
+ /**
+ * initialize the layout manager. Allows each layout manager
+ * to calculate often used values.
+ */
+ public void initialize();
+
/**
* Get the active PageSequenceLayoutManager instance for this
* layout process.
* of the node assigned to the LM, after changes have been applied
*
* @param oldList the elements to replace
- * @param flaggedPenalty the penalty value for hyphenated lines
* @param alignment the desired text alignment
* @return the updated list of KnuthElements
*/
LinkedList getChangedKnuthElements(List oldList, /*int flaggedPenalty,*/
int alignment);
+
+ /**
+ * Returns the IPD of the content area
+ * @return the IPD of the content area
+ */
+ int getContentAreaIPD();
+ /**
+ * Returns the BPD of the content area
+ * @return the BPD of the content area
+ */
+ int getContentAreaBPD();
+
+ /**
+ * Returns an indication if the layout manager generates a reference area.
+ * @return True if the layout manager generates a reference area
+ */
+ boolean getGeneratesReferenceArea();
+
+ /**
+ * Returns an indication if the layout manager generates a block area.
+ * @return True if the layout manager generates a block area
+ */
+ boolean getGeneratesBlockArea();
+
+ /**
+ * Returns an indication if the layout manager generates a line area.
+ * @return True if the layout manager generates a line area
+ */
+ boolean getGeneratesLineArea();
+
+ /**
+ * Returns the fo this layout manager is associated with.
+ * @return The fo for this layout manager or null.
+ */
+ FObj getFObj();
+
}
package org.apache.fop.layoutmgr;
+import org.apache.fop.datatypes.PercentBaseContext;
import org.apache.fop.fo.Constants;
import org.apache.fop.fo.properties.LengthRangeProperty;
import org.apache.fop.traits.MinOptMax;
* Restricts a MinOptMax using the values from a LengthRangeProperty.
* @param mom MinOptMax to restrict
* @param lr restricting source
+ * @param context Percentage evaluation context
*/
- public static void restrict(MinOptMax mom, LengthRangeProperty lr) {
+ public static void restrict(MinOptMax mom, LengthRangeProperty lr,
+ PercentBaseContext context) {
if (lr.getEnum() != Constants.EN_AUTO) {
- if (lr.getMinimum().getEnum() != Constants.EN_AUTO) {
- int min = lr.getMinimum().getLength().getValue();
+ if (lr.getMinimum(context).getEnum() != Constants.EN_AUTO) {
+ int min = lr.getMinimum(context).getLength().getValue(context);
if (min > mom.min) {
mom.min = min;
fixAfterMinChanged(mom);
}
}
- if (lr.getMaximum().getEnum() != Constants.EN_AUTO) {
- int max = lr.getMaximum().getLength().getValue();
+ if (lr.getMaximum(context).getEnum() != Constants.EN_AUTO) {
+ int max = lr.getMaximum(context).getLength().getValue(context);
if (max < mom.max) {
mom.max = max;
if (mom.max < mom.opt) {
}
}
}
- if (lr.getOptimum().getEnum() != Constants.EN_AUTO) {
- int opt = lr.getOptimum().getLength().getValue();
+ if (lr.getOptimum(context).getEnum() != Constants.EN_AUTO) {
+ int opt = lr.getOptimum(context).getLength().getValue(context);
if (opt > mom.min) {
mom.opt = opt;
if (mom.opt > mom.max) {
}
}
+ /**
+ * Extend the minimum length to the given length.
+ * @param mom the min/opt/max trait
+ * @param len the new minimum length
+ * @param optToLen if set adjusts the optimum length to be the smaller of the
+ * minimum length and the given length
+ */
public static void extendMinimum(MinOptMax mom, int len, boolean optToLen) {
if (mom.min < len) {
mom.min = len;
/**
* Converts a LengthRangeProperty to a MinOptMax.
* @param prop LengthRangeProperty
+ * @param context Percentage evaluation context
* @return the requested MinOptMax instance
*/
- public static MinOptMax toMinOptMax(LengthRangeProperty prop) {
+ public static MinOptMax toMinOptMax(LengthRangeProperty prop, PercentBaseContext context) {
MinOptMax mom = new MinOptMax(
- (prop.getMinimum().isAuto()
- ? 0 : prop.getMinimum().getLength().getValue()),
- (prop.getOptimum().isAuto()
- ? 0 : prop.getOptimum().getLength().getValue()),
- (prop.getMinimum().isAuto()
+ (prop.getMinimum(context).isAuto()
+ ? 0 : prop.getMinimum(context).getLength().getValue(context)),
+ (prop.getOptimum(context).isAuto()
+ ? 0 : prop.getOptimum(context).getLength().getValue(context)),
+ (prop.getMinimum(context).isAuto()
? Integer.MAX_VALUE
- : prop.getMaximum().getLength().getValue()));
+ : prop.getMaximum(context).getLength().getValue(context)));
return mom;
}
FootnoteBodyLayoutManager fblm
= (FootnoteBodyLayoutManager) footnoteBodyIterator.next();
fblm.setParent(childFLM);
+ fblm.initialize();
((KnuthBlockBox) element).addElementList(
fblm.getNextKnuthElements(footnoteContext, alignment));
}
private Block targetBlock;
private SideRegion regionFO;
+ private int contentAreaIPD = 0;
+ private int contentAreaBPD = -1;
+
/**
* Creates a new StaticContentLayoutManager.
* @param pslm PageSequenceLayoutManager this layout manager belongs to
super(node);
setParent(pslm);
regionFO = reg;
- targetRegion = getCurrentPV().getRegionReference(regionFO.getNameId());
+ targetRegion = getCurrentPV().getRegionReference(regionFO.getNameId());
}
+ /**
+ * Creates a new StaticContentLayoutManager.
+ * @param pslm PageSequenceLayoutManager this layout manager belongs to
+ * @param node static-content FO
+ * @param block the block to layout into
+ */
public StaticContentLayoutManager(PageSequenceLayoutManager pslm,
StaticContent node, Block block) {
super(node);
*/
public LinkedList getNextKnuthElements(LayoutContext context, int alignment) {
// set layout dimensions
- fobj.setLayoutDimension(PercentBase.BLOCK_IPD, context.getRefIPD());
- fobj.setLayoutDimension(PercentBase.BLOCK_BPD, context.getStackLimit().opt);
+ setContentAreaIPD(context.getRefIPD());
+ setContentAreaBPD(context.getStackLimit().opt);
//TODO Copied from elsewhere. May be worthwhile to factor out the common parts.
// currently active LM
}
/**
- * convenience method that returns the Static Content node
+ * Convenience method that returns the Static Content node.
+ * @return the static content node
*/
protected StaticContent getStaticContentFO() {
return (StaticContent) fobj;
protected LayoutManager getCurrentChildLM() {
return null; //TODO NYI
}
- }
+ }
+
+ /**
+ * Returns the IPD of the content area
+ * @return the IPD of the content area
+ */
+ public int getContentAreaIPD() {
+ return contentAreaIPD;
+ }
+
+ private void setContentAreaIPD(int contentAreaIPD) {
+ this.contentAreaIPD = contentAreaIPD;
+ }
+
+ /**
+ * Returns the BPD of the content area
+ * @return the BPD of the content area
+ */
+ public int getContentAreaBPD() {
+ return contentAreaBPD;
+ }
+
+ private void setContentAreaBPD(int contentAreaBPD) {
+ this.contentAreaBPD = contentAreaBPD;
+ }
+
}
import org.apache.fop.traits.BorderProps;
import org.apache.fop.area.Area;
import org.apache.fop.area.Trait;
+import org.apache.fop.datatypes.LengthBase;
+import org.apache.fop.datatypes.PercentBaseContext;
+import org.apache.fop.datatypes.SimplePercentBaseContext;
import org.apache.fop.fo.Constants;
import org.apache.fop.fo.properties.CommonMarginBlock;
import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
* @param bpProps border and padding properties
* @param bNotFirst True if the area is not the first area
* @param bNotLast True if the area is not the last area
+ * @param context Property evaluation context
*/
public static void setBorderPaddingTraits(Area area,
- CommonBorderPaddingBackground bpProps, boolean bNotFirst, boolean bNotLast) {
+ CommonBorderPaddingBackground bpProps, boolean bNotFirst, boolean bNotLast,
+ PercentBaseContext context) {
int iBP;
- iBP = bpProps.getPadding(CommonBorderPaddingBackground.START, bNotFirst);
+ iBP = bpProps.getPadding(CommonBorderPaddingBackground.START, bNotFirst, context);
if (iBP > 0) {
area.addTrait(Trait.PADDING_START, new Integer(iBP));
}
- iBP = bpProps.getPadding(CommonBorderPaddingBackground.END, bNotLast);
+ iBP = bpProps.getPadding(CommonBorderPaddingBackground.END, bNotLast, context);
if (iBP > 0) {
area.addTrait(Trait.PADDING_END, new Integer(iBP));
}
- iBP = bpProps.getPadding(CommonBorderPaddingBackground.BEFORE, false);
+ iBP = bpProps.getPadding(CommonBorderPaddingBackground.BEFORE, false, context);
if (iBP > 0) {
area.addTrait(Trait.PADDING_BEFORE, new Integer(iBP));
}
- iBP = bpProps.getPadding(CommonBorderPaddingBackground.AFTER, false);
+ iBP = bpProps.getPadding(CommonBorderPaddingBackground.AFTER, false, context);
if (iBP > 0) {
area.addTrait(Trait.PADDING_AFTER, new Integer(iBP));
}
* add the borders to the area.
* @param area the area to set the traits on.
* @param bordProps border properties
+ * @param context Property evaluation context
*/
- public static void addBorders(Area area, CommonBorderPaddingBackground bordProps) {
+ public static void addBorders(Area area, CommonBorderPaddingBackground bordProps,
+ PercentBaseContext context) {
BorderProps bps = getBorderProps(bordProps, CommonBorderPaddingBackground.BEFORE);
if (bps != null) {
area.addTrait(Trait.BORDER_BEFORE, bps);
area.addTrait(Trait.BORDER_END, bps);
}
- addPadding(area, bordProps);
+ addPadding(area, bordProps, context);
}
/**
* @param bordProps border properties
* @param outer 4 boolean values indicating if the side represents the
* table's outer border. Order: before, after, start, end
+ * @param context Property evaluation context
*/
public static void addCollapsingBorders(Area area,
CommonBorderPaddingBackground bordProps,
- boolean[] outer) {
+ boolean[] outer,
+ PercentBaseContext context) {
BorderProps bps = getCollapsingBorderProps(bordProps,
CommonBorderPaddingBackground.BEFORE, outer[0]);
if (bps != null) {
area.addTrait(Trait.BORDER_END, bps);
}
- addPadding(area, bordProps);
+ addPadding(area, bordProps, context);
}
- private static void addPadding(Area area, CommonBorderPaddingBackground bordProps) {
- int padding = bordProps.getPadding(CommonBorderPaddingBackground.START, false);
+ private static void addPadding(Area area, CommonBorderPaddingBackground bordProps,
+ PercentBaseContext context) {
+ int padding = bordProps.getPadding(CommonBorderPaddingBackground.START, false, context);
if (padding != 0) {
area.addTrait(Trait.PADDING_START, new java.lang.Integer(padding));
}
- padding = bordProps.getPadding(CommonBorderPaddingBackground.END, false);
+ padding = bordProps.getPadding(CommonBorderPaddingBackground.END, false, context);
if (padding != 0) {
area.addTrait(Trait.PADDING_END, new java.lang.Integer(padding));
}
- padding = bordProps.getPadding(CommonBorderPaddingBackground.BEFORE, false);
+ padding = bordProps.getPadding(CommonBorderPaddingBackground.BEFORE, false, context);
if (padding != 0) {
area.addTrait(Trait.PADDING_BEFORE, new java.lang.Integer(padding));
}
- padding = bordProps.getPadding(CommonBorderPaddingBackground.AFTER, false);
+ padding = bordProps.getPadding(CommonBorderPaddingBackground.AFTER, false, context);
if (padding != 0) {
area.addTrait(Trait.PADDING_AFTER, new java.lang.Integer(padding));
}
* Note: The area's IPD and BPD must be set before calling this method.
* @param area the area to set the traits on
* @param backProps the background properties
+ * @param context Property evaluation context
*/
- public static void addBackground(Area area, CommonBorderPaddingBackground backProps) {
+ public static void addBackground(Area area,
+ CommonBorderPaddingBackground backProps,
+ PercentBaseContext context) {
if (!backProps.hasBackground()) {
return;
}
if (backProps.backgroundPositionHorizontal != null) {
if (back.getRepeat() == Constants.EN_NOREPEAT
|| back.getRepeat() == Constants.EN_REPEATY) {
- if (backProps.backgroundPositionHorizontal instanceof PercentLength) {
- if (area.getIPD() > 0) {
- int width = area.getIPD();
- width += backProps.getPaddingStart(false);
- width += backProps.getPaddingEnd(false);
- back.setHoriz((int)((width - back.getFopImage().getIntrinsicWidth())
- * ((PercentLength)backProps.backgroundPositionHorizontal).value()));
- } else {
- //TODO Area IPD has to be set for this to work
- log.warn("Horizontal background image positioning ignored"
- + " because the IPD was not set on the area."
- + " (Yes, it's a bug in FOP)");
- }
+ if (area.getIPD() > 0) {
+ int width = area.getIPD();
+ width += backProps.getPaddingStart(false, context);
+ width += backProps.getPaddingEnd(false, context);
+ back.setHoriz(backProps.backgroundPositionHorizontal.getValue(
+ new SimplePercentBaseContext(context,
+ LengthBase.IMAGE_BACKGROUND_POSITION_HORIZONTAL,
+ (width - back.getFopImage().getIntrinsicWidth())
+ )
+ ));
} else {
- back.setHoriz(backProps.backgroundPositionHorizontal.getValue());
+ //TODO Area IPD has to be set for this to work
+ log.warn("Horizontal background image positioning ignored"
+ + " because the IPD was not set on the area."
+ + " (Yes, it's a bug in FOP)");
}
}
}
if (backProps.backgroundPositionVertical != null) {
if (back.getRepeat() == Constants.EN_NOREPEAT
|| back.getRepeat() == Constants.EN_REPEATX) {
- if (backProps.backgroundPositionVertical instanceof PercentLength) {
- if (area.getBPD() > 0) {
- int height = area.getBPD();
- height += backProps.getPaddingBefore(false);
- height += backProps.getPaddingAfter(false);
- back.setVertical(
- (int)((height - back.getFopImage().getIntrinsicHeight())
- * ((PercentLength)backProps.backgroundPositionVertical).value()));
- } else {
- //TODO Area BPD has to be set for this to work
- log.warn("Vertical background image positioning ignored"
- + " because the BPD was not set on the area."
- + " (Yes, it's a bug in FOP)");
- }
+ if (area.getBPD() > 0) {
+ int height = area.getBPD();
+ height += backProps.getPaddingBefore(false, context);
+ height += backProps.getPaddingAfter(false, context);
+ back.setVertical(backProps.backgroundPositionVertical.getValue(
+ new SimplePercentBaseContext(context,
+ LengthBase.IMAGE_BACKGROUND_POSITION_VERTICAL,
+ (height - back.getFopImage().getIntrinsicHeight())
+ )
+ ));
} else {
- back.setVertical(backProps.backgroundPositionVertical.getValue());
+ //TODO Area BPD has to be set for this to work
+ log.warn("Vertical background image positioning ignored"
+ + " because the BPD was not set on the area."
+ + " (Yes, it's a bug in FOP)");
}
}
}
* @param area the area to set the traits on.
* @param bpProps the border, padding and background properties
* @param marginProps the margin properties.
+ * @param context the context for evaluation of percentages
*/
public static void addMargins(Area area,
CommonBorderPaddingBackground bpProps,
- CommonMarginBlock marginProps) {
- int startIndent = marginProps.startIndent.getValue();
+ CommonMarginBlock marginProps,
+ PercentBaseContext context) {
+ int startIndent = marginProps.startIndent.getValue(context);
if (startIndent != 0) {
area.addTrait(Trait.START_INDENT, new Integer(startIndent));
}
- int spaceStart = marginProps.startIndent.getValue()
+ int spaceStart = marginProps.startIndent.getValue(context)
- bpProps.getBorderStartWidth(false)
- - bpProps.getPaddingStart(false);
+ - bpProps.getPaddingStart(false, context);
if (spaceStart != 0) {
area.addTrait(Trait.SPACE_START, new Integer(spaceStart));
}
- int endIndent = marginProps.endIndent.getValue();
+ int endIndent = marginProps.endIndent.getValue(context);
if (endIndent != 0) {
area.addTrait(Trait.END_INDENT, new Integer(endIndent));
}
- int spaceEnd = marginProps.endIndent.getValue()
+ int spaceEnd = marginProps.endIndent.getValue(context)
- bpProps.getBorderEndWidth(false)
- - bpProps.getPaddingEnd(false);
+ - bpProps.getPaddingEnd(false, context);
if (spaceEnd != 0) {
area.addTrait(Trait.SPACE_END, new Integer(spaceEnd));
}
/*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
public BidiLayoutManager(BidiOverride node, InlineLayoutManager cLM) {
super(node);
+ setParent(cLM);
children = new ArrayList();
/*
for (int count = cLM.size() - 1; count >= 0; count--) {
public CharacterLayoutManager(Character node) {
super(node);
fobj = node;
- InlineArea inline = getCharacterInlineArea(node);
+ }
+
+ public void initialize() {
+ InlineArea inline = getCharacterInlineArea(fobj);
setCurrentArea(inline);
+
setAlignment(fobj.getVerticalAlign());
- fs = fobj.getCommonFont().getFontState(fobj.getFOEventHandler().getFontInfo());
+ fs = fobj.getCommonFont().getFontState(fobj.getFOEventHandler().getFontInfo(), this);
SpaceVal ls = SpaceVal.makeLetterSpacing(fobj.getLetterSpacing());
letterSpaceIPD = ls.getSpace();
import org.apache.fop.apps.FOUserAgent;
import org.apache.fop.fo.Constants;
import org.apache.fop.fo.pagination.Title;
+import org.apache.fop.layoutmgr.AbstractBaseLayoutManager;
import org.apache.fop.layoutmgr.KnuthElement;
import org.apache.fop.layoutmgr.KnuthPossPosIter;
import org.apache.fop.layoutmgr.LayoutContext;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.fop.area.Block;
/**
* Content Layout Manager.
* For use with objects that contain inline areas such as
* leader use-content and title.
*/
-public class ContentLayoutManager implements InlineLevelLayoutManager {
+public class ContentLayoutManager extends AbstractBaseLayoutManager
+ implements InlineLevelLayoutManager {
private FOUserAgent userAgent;
private Area holder;
private int stackSize;
private LayoutManager parentLM;
private InlineLevelLayoutManager childLM = null;
- /**
- * logging instance
- */
- protected static Log log = LogFactory.getLog(LayoutManager.class);
-
/**
* Constructs a new ContentLayoutManager
*
fillArea(lm);
}
+ public void initialize() {
+ // Empty
+ }
+
public void fillArea(LayoutManager curLM) {
int ipd = 1000000;
public PageSequenceLayoutManager getPSLM() {
return parentLM.getPSLM();
}
+
+ // --------- Property Resolution related functions --------- //
+
+ /**
+ * Returns the IPD of the content area
+ * @return the IPD of the content area
+ */
+ public int getContentAreaIPD() {
+ return holder.getIPD();
+ }
+
+ /**
+ * Returns the BPD of the content area
+ * @return the BPD of the content area
+ */
+ public int getContentAreaBPD() {
+ return holder.getBPD();
+ }
+
+ /**
+ * @see org.apache.fop.layoutmgr.LayoutManager#getGeneratesReferenceArea
+ */
+ public boolean getGeneratesReferenceArea() {
+ return false;
+ }
+
+ /**
+ * @see org.apache.fop.layoutmgr.LayoutManager#getGeneratesBlockArea
+ */
+ public boolean getGeneratesBlockArea() {
+ return getGeneratesLineArea() || holder instanceof Block;
+ }
+
+ /**
+ * @see org.apache.fop.layoutmgr.LayoutManager#getGeneratesLineArea
+ */
+ public boolean getGeneratesLineArea() {
+ return holder instanceof LineArea;
+ }
+
}
// Java
import java.awt.geom.Rectangle2D;
+import java.util.LinkedList;
// FOP
import org.apache.fop.area.inline.Image;
import org.apache.fop.area.inline.InlineArea;
import org.apache.fop.area.inline.Viewport;
import org.apache.fop.datatypes.Length;
+import org.apache.fop.datatypes.LengthBase;
+import org.apache.fop.fo.FObj;
import org.apache.fop.fo.flow.ExternalGraphic;
import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
+import org.apache.fop.layoutmgr.LayoutContext;
import org.apache.fop.layoutmgr.TraitSetter;
/**
public ExternalGraphicLayoutManager(ExternalGraphic node) {
super(node);
fobj = node;
- setup();
- InlineArea area = getExternalGraphicInlineArea();
- setCurrentArea(area);
- setAlignment(fobj.getVerticalAlign());
- setLead(viewHeight);
}
/**
*/
private void setup() {
// assume lr-tb for now and just use the .optimum value of the range
- Length ipd = fobj.getInlineProgressionDimension().getOptimum().getLength();
+ Length ipd = fobj.getInlineProgressionDimension().getOptimum(this).getLength();
if (ipd.getEnum() != EN_AUTO) {
- viewWidth = ipd.getValue();
+ viewWidth = ipd.getValue(this);
} else {
ipd = fobj.getWidth();
if (ipd.getEnum() != EN_AUTO) {
- viewWidth = ipd.getValue();
+ viewWidth = ipd.getValue(this);
}
}
- Length bpd = fobj.getBlockProgressionDimension().getOptimum().getLength();
+ Length bpd = fobj.getBlockProgressionDimension().getOptimum(this).getLength();
if (bpd.getEnum() != EN_AUTO) {
- viewHeight = bpd.getValue();
+ viewHeight = bpd.getValue(this);
} else {
bpd = fobj.getHeight();
if (bpd.getEnum() != EN_AUTO) {
- viewHeight = bpd.getValue();
+ viewHeight = bpd.getValue(this);
}
}
cheight = viewHeight;
}
} else {
- cheight = ch.getValue();
+ cheight = ch.getValue(this);
}
}
Length cw = fobj.getContentWidth();
cwidth = viewWidth;
}
} else {
- cwidth = cw.getValue();
+ cwidth = cw.getValue(this);
}
}
CommonBorderPaddingBackground borderProps = fobj.getCommonBorderPaddingBackground();
//Determine extra BPD from borders etc.
- int beforeBPD = borderProps.getPadding(CommonBorderPaddingBackground.BEFORE, false);
+ int beforeBPD = borderProps.getPadding(CommonBorderPaddingBackground.BEFORE, false, this);
beforeBPD += borderProps.getBorderWidth(CommonBorderPaddingBackground.BEFORE,
false);
- int afterBPD = borderProps.getPadding(CommonBorderPaddingBackground.AFTER, false);
+ int afterBPD = borderProps.getPadding(CommonBorderPaddingBackground.AFTER, false, this);
afterBPD += borderProps.getBorderWidth(CommonBorderPaddingBackground.AFTER, false);
yoffset += beforeBPD;
//Determine extra IPD from borders etc.
int startIPD = borderProps.getPadding(CommonBorderPaddingBackground.START,
- false/*bNotFirst*/);
+ false/*bNotFirst*/, this);
startIPD += borderProps.getBorderWidth(CommonBorderPaddingBackground.START,
false/*bNotFirst*/);
- int endIPD = borderProps.getPadding(CommonBorderPaddingBackground.END, false/*bNotLast*/);
+ int endIPD = borderProps.getPadding(CommonBorderPaddingBackground.END, false/*bNotLast*/, this);
endIPD += borderProps.getBorderWidth(CommonBorderPaddingBackground.END, false/*bNotLast*/);
xoffset += startIPD;
placement = new Rectangle2D.Float(xoffset, yoffset, cwidth, cheight);
}
+ /**
+ * @see org.apache.fop.layoutmgr.LayoutManager#getNextKnuthElements(LayoutContext, int)
+ */
+ public LinkedList getNextKnuthElements(LayoutContext context,
+ int alignment) {
+ setup();
+ InlineArea area = getExternalGraphicInlineArea();
+ setCurrentArea(area);
+ setAlignment(fobj.getVerticalAlign());
+ setLead(viewHeight);
+ return super.getNextKnuthElements(context, alignment);
+ }
+
/**
* Get the inline area for this external grpahic.
* This creates the image area and puts it inside a viewport.
vp.setOffset(0);
// Common Border, Padding, and Background Properties
- TraitSetter.addBorders(vp, fobj.getCommonBorderPaddingBackground());
- TraitSetter.addBackground(vp, fobj.getCommonBorderPaddingBackground());
+ TraitSetter.addBorders(vp, fobj.getCommonBorderPaddingBackground(), this);
+ TraitSetter.addBackground(vp, fobj.getCommonBorderPaddingBackground(), this);
return vp;
}
protected void addId() {
getPSLM().addIDToPage(fobj.getId());
}
+
+ // --------- Property Resolution related functions --------- //
+
+ /**
+ * @see org.apache.fop.datatypes.PercentBaseContext#getBaseLength(int, FObj)
+ */
+ public int getBaseLength(int lengthBase, FObj fobj) {
+ switch (lengthBase) {
+ case LengthBase.IMAGE_INTRINSIC_WIDTH:
+ return getIntrinsicWidth();
+ case LengthBase.IMAGE_INTRINSIC_HEIGHT:
+ return getIntrinsicHeight();
+ default: // Delegate to super class
+ return super.getBaseLength(lengthBase, fobj);
+ }
+ }
+
+ /**
+ * Returns the intrinsic width of the e-g.
+ * @return the width of the element
+ */
+ protected int getIntrinsicWidth() {
+ return fobj.getIntrinsicWidth();
+ }
+
+ /**
+ * Returns the intrinsic height of the e-g.
+ * @return the height of the element
+ */
+ protected int getIntrinsicHeight() {
+ return fobj.getIntrinsicHeight();
+ }
+
}
public FootnoteLayoutManager(Footnote node) {
super(node);
footnote = node;
-
+ }
+
+ public void initialize() {
// create an InlineStackingLM handling the fo:inline child of fo:footnote
citationLM = new InlineLayoutManager(footnote.getFootnoteCitation());
// set the citationLM parent to be this LM's parent
citationLM.setParent(getParent());
+ citationLM.initialize();
bodyLM.setParent(this);
+ bodyLM.initialize();
// get Knuth elements representing the footnote citation
LinkedList returnedList = new LinkedList();
public InlineLayoutManager(InlineLevel node) {
super(node);
fobj = node;
- initialize();
}
private Inline getInlineFO() {
return (Inline)fobj;
}
- private void initialize() {
+ public void initialize() {
inlineProps = fobj.getCommonMarginInline();
borderProps = fobj.getCommonBorderPaddingBackground();
- int iPad = borderProps.getPadding(CommonBorderPaddingBackground.BEFORE, false);
+ int iPad = borderProps.getPadding(CommonBorderPaddingBackground.BEFORE, false, this);
iPad += borderProps.getBorderWidth(CommonBorderPaddingBackground.BEFORE,
false);
- iPad += borderProps.getPadding(CommonBorderPaddingBackground.AFTER, false);
+ iPad += borderProps.getPadding(CommonBorderPaddingBackground.AFTER, false, this);
iPad += borderProps.getBorderWidth(CommonBorderPaddingBackground.AFTER, false);
extraBPD = new MinOptMax(iPad);
}
protected MinOptMax getExtraIPD(boolean bNotFirst, boolean bNotLast) {
int iBP = borderProps.getPadding(CommonBorderPaddingBackground.START,
- bNotFirst);
+ bNotFirst, this);
iBP += borderProps.getBorderWidth(CommonBorderPaddingBackground.START,
bNotFirst);
- iBP += borderProps.getPadding(CommonBorderPaddingBackground.END, bNotLast);
+ iBP += borderProps.getPadding(CommonBorderPaddingBackground.END, bNotLast, this);
iBP += borderProps.getBorderWidth(CommonBorderPaddingBackground.END, bNotLast);
return new MinOptMax(iBP);
}
protected boolean hasLeadingFence(boolean bNotFirst) {
int iBP = borderProps.getPadding(CommonBorderPaddingBackground.START,
- bNotFirst);
+ bNotFirst, this);
iBP += borderProps.getBorderWidth(CommonBorderPaddingBackground.START,
bNotFirst);
return (iBP > 0);
}
protected boolean hasTrailingFence(boolean bNotLast) {
- int iBP = borderProps.getPadding(CommonBorderPaddingBackground.END, bNotLast);
+ int iBP = borderProps.getPadding(CommonBorderPaddingBackground.END, bNotLast, this);
iBP += borderProps.getBorderWidth(CommonBorderPaddingBackground.END, bNotLast);
return (iBP > 0);
}
// Add border and padding to current area and set flags (FIRST, LAST ...)
TraitSetter.setBorderPaddingTraits(getCurrentArea(),
- borderProps, bNotFirst, bNotLast);
+ borderProps, bNotFirst, bNotLast, this);
if (borderProps != null) {
- TraitSetter.addBorders(getCurrentArea(), borderProps);
- TraitSetter.addBackground(getCurrentArea(), borderProps);
+ TraitSetter.addBorders(getCurrentArea(), borderProps, this);
+ TraitSetter.addBackground(getCurrentArea(), borderProps, this);
}
}
// not be the first area created by this inline
childLC = new LayoutContext(lc);
if (getSpaceStart() != null) {
- lc.getLeadingSpace().addSpace(new SpaceVal(getSpaceStart()));
+ lc.getLeadingSpace().addSpace(new SpaceVal(getSpaceStart(), this));
}
// Check for "fence"
*
* @param parentIter Iterator over Position information returned
* by this LayoutManager.
- * @param dSpaceAdjust Factor controlling how much extra space to add
- * in order to justify the line.
+ * @param context layout context.
*/
public void addAreas(PositionIterator parentIter,
LayoutContext context) {
}
if (getSpaceStart() != null) {
- context.getLeadingSpace().addSpace(new SpaceVal(getSpaceStart()));
+ context.getLeadingSpace().addSpace(new SpaceVal(getSpaceStart(), this));
}
// "unwrap" the NonLeafPositions stored in parentIter
}
// Add own trailing space to parent context (or set on area?)
if (context.getTrailingSpace() != null && getSpaceEnd() != null) {
- context.getTrailingSpace().addSpace(new SpaceVal(getSpaceEnd()));
+ context.getTrailingSpace().addSpace(new SpaceVal(getSpaceEnd(), this));
}
- setTraits(bAreaCreated, !bIsLast);
parentLM.addChildArea(getCurrentArea());
+ setTraits(bAreaCreated, !bIsLast);
+
context.setFlags(LayoutContext.LAST_AREA, bIsLast);
bAreaCreated = true;
}
// Java
import java.awt.geom.Rectangle2D;
+import java.util.LinkedList;
// FOP
import org.apache.fop.datatypes.Length;
+import org.apache.fop.datatypes.LengthBase;
import org.apache.fop.fo.XMLObj;
import org.apache.fop.fo.flow.InstreamForeignObject;
import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
import org.apache.fop.layoutmgr.TraitSetter;
import org.apache.fop.area.inline.ForeignObject;
import org.apache.fop.area.inline.Viewport;
+import org.apache.fop.fo.FObj;
+import org.apache.fop.layoutmgr.LayoutContext;
/**
* LayoutManager for the fo:instream-foreign-object formatting object
/**
* Constructor
* @param node the formatting object that creates this area
+ * @param parent the parent layout manager
*/
public InstreamForeignObjectLM(InstreamForeignObject node) {
super(node);
fobj = node;
- Viewport areaCurrent = getInlineArea();
- setCurrentArea(areaCurrent);
- setAlignment(node.getVerticalAlign());
- setLead(areaCurrent.getBPD());
}
/**
int ipd = -1;
boolean bpdauto = false;
if (hasLH) {
- bpd = fobj.getLineHeight().getValue();
+ bpd = fobj.getLineHeight().getValue(this);
} else {
// this property does not apply when the line-height applies
// isn't the block-progression-dimension always in the same
// direction as the line height?
- len = fobj.getBlockProgressionDimension().getOptimum().getLength();
+ len = fobj.getBlockProgressionDimension().getOptimum(this).getLength();
if (len.getEnum() != EN_AUTO) {
- bpd = len.getValue();
+ bpd = len.getValue(this);
} else {
len = fobj.getHeight();
if (len.getEnum() != EN_AUTO) {
- bpd = len.getValue();
+ bpd = len.getValue(this);
}
}
}
- len = fobj.getInlineProgressionDimension().getOptimum().getLength();
+ len = fobj.getInlineProgressionDimension().getOptimum(this).getLength();
if (len.getEnum() != EN_AUTO) {
- ipd = len.getValue();
+ ipd = len.getValue(this);
} else {
len = fobj.getWidth();
if (len.getEnum() != EN_AUTO) {
- ipd = len.getValue();
+ ipd = len.getValue(this);
}
}
cwidth = ipd;
}
} else {
- cwidth = len.getValue();
+ cwidth = len.getValue(this);
}
}
len = fobj.getContentHeight();
cwidth = bpd;
}
} else {
- cheight = len.getValue();
+ cheight = len.getValue(this);
}
}
CommonBorderPaddingBackground borderProps = fobj.getCommonBorderPaddingBackground();
//Determine extra BPD from borders etc.
- int beforeBPD = borderProps.getPadding(CommonBorderPaddingBackground.BEFORE, false);
+ int beforeBPD = borderProps.getPadding(CommonBorderPaddingBackground.BEFORE, false, this);
beforeBPD += borderProps.getBorderWidth(CommonBorderPaddingBackground.BEFORE,
false);
- int afterBPD = borderProps.getPadding(CommonBorderPaddingBackground.AFTER, false);
+ int afterBPD = borderProps.getPadding(CommonBorderPaddingBackground.AFTER, false, this);
afterBPD += borderProps.getBorderWidth(CommonBorderPaddingBackground.AFTER, false);
yoffset += beforeBPD;
//Determine extra IPD from borders etc.
int startIPD = borderProps.getPadding(CommonBorderPaddingBackground.START,
- false/*bNotFirst*/);
+ false/*bNotFirst*/, this);
startIPD += borderProps.getBorderWidth(CommonBorderPaddingBackground.START,
false/*bNotFirst*/);
- int endIPD = borderProps.getPadding(CommonBorderPaddingBackground.END, false/*bNotLast*/);
+ int endIPD = borderProps.getPadding(CommonBorderPaddingBackground.END, false/*bNotLast*/, this);
endIPD += borderProps.getBorderWidth(CommonBorderPaddingBackground.END, false/*bNotLast*/);
xoffset += startIPD;
vp.setOffset(0);
// Common Border, Padding, and Background Properties
- TraitSetter.addBorders(vp, fobj.getCommonBorderPaddingBackground());
- TraitSetter.addBackground(vp, fobj.getCommonBorderPaddingBackground());
+ TraitSetter.addBorders(vp, fobj.getCommonBorderPaddingBackground(), this);
+ TraitSetter.addBackground(vp, fobj.getCommonBorderPaddingBackground(), this);
return vp;
}
+ /**
+ * @see org.apache.fop.layoutmgr.LayoutManager#getNextKnuthElements(LayoutContext, int)
+ */
+ public LinkedList getNextKnuthElements(LayoutContext context,
+ int alignment) {
+ Viewport areaCurrent = getInlineArea();
+ setCurrentArea(areaCurrent);
+ setAlignment(fobj.getVerticalAlign());
+ setLead(areaCurrent.getBPD());
+ return super.getNextKnuthElements(context, alignment);
+ }
+
/**
* @see org.apache.fop.layoutmgr.inline.LeafNodeLayoutManager#addId()
*/
protected void addId() {
getPSLM().addIDToPage(fobj.getId());
}
+
+ // --------- Property Resolution related functions --------- //
+
+ /**
+ * @see org.apache.fop.datatypes.PercentBaseContext#getBaseLength(int, FObj)
+ */
+ public int getBaseLength(int lengthBase, FObj fobj) {
+ switch (lengthBase) {
+ case LengthBase.IMAGE_INTRINSIC_WIDTH:
+ return getIntrinsicWidth();
+ case LengthBase.IMAGE_INTRINSIC_HEIGHT:
+ return getIntrinsicHeight();
+ default: // Delegate to super class
+ return super.getBaseLength(lengthBase, fobj);
+ }
+ }
+
+ /**
+ * Returns the intrinsic width of the e-g.
+ * @return the width of the element
+ */
+ protected int getIntrinsicWidth() {
+ return fobj.getIntrinsicWidth();
+ }
+
+ /**
+ * Returns the intrinsic height of the e-g.
+ * @return the height of the element
+ */
+ protected int getIntrinsicHeight() {
+ return fobj.getIntrinsicHeight();
+ }
+
}
import org.apache.fop.area.inline.InlineArea;
import org.apache.fop.area.inline.Space;
import org.apache.fop.area.inline.TextArea;
-import org.apache.fop.datatypes.PercentBase;
import org.apache.fop.fo.flow.Leader;
import org.apache.fop.fonts.Font;
import org.apache.fop.layoutmgr.KnuthElement;
import java.util.List;
import java.util.LinkedList;
+import org.apache.fop.fo.FObj;
+import org.apache.fop.layoutmgr.inline.LeafNodeLayoutManager.AreaInfo;
/**
* LayoutManager for the fo:leader formatting object
private LinkedList contentList = null;
private ContentLayoutManager clm = null;
+
+ private int contentAreaIPD = 0;
/**
* Constructor
public LeaderLayoutManager(Leader node) {
super(node);
fobj = node;
- font = fobj.getCommonFont().getFontState(fobj.getFOEventHandler().getFontInfo());
+ }
+
+ public void initialize() {
+ font = fobj.getCommonFont().getFontState(fobj.getFOEventHandler().getFontInfo(), this);
// the property leader-alignment does not affect vertical positioning
// (see section 7.21.1 in the XSL Recommendation)
// setAlignment(node.getLeaderAlignment());
private MinOptMax getLeaderAllocIPD(int ipd) {
// length of the leader
- fobj.setLayoutDimension(PercentBase.BLOCK_IPD, ipd);
- int opt = fobj.getLeaderLength().getOptimum().getLength().getValue();
- int min = fobj.getLeaderLength().getMinimum().getLength().getValue();
- int max = fobj.getLeaderLength().getMaximum().getLength().getValue();
+ setContentAreaIPD(ipd);
+ int opt = fobj.getLeaderLength().getOptimum(this).getLength().getValue(this);
+ int min = fobj.getLeaderLength().getMinimum(this).getLength().getValue(this);
+ int max = fobj.getLeaderLength().getMaximum(this).getLength().getValue(this);
return new MinOptMax(min, opt, max);
}
org.apache.fop.area.inline.Leader leader =
new org.apache.fop.area.inline.Leader();
leader.setRuleStyle(fobj.getRuleStyle());
- leader.setRuleThickness(fobj.getRuleThickness().getValue());
+ leader.setRuleThickness(fobj.getRuleThickness().getValue(this));
+ leader.setBPD(fobj.getRuleThickness().getValue(this));
leaderArea = leader;
} else if (fobj.getLeaderPattern() == EN_SPACE) {
leaderArea = new Space();
+ leaderArea.setBPD(font.getAscender());
} else if (fobj.getLeaderPattern() == EN_DOTS) {
TextArea t = new TextArea();
char dot = '.'; // userAgent.getLeaderDotCharacter();
t.addTrait(Trait.FONT_SIZE, new Integer(font.getFontSize()));
int width = font.getCharWidth(dot);
Space spacer = null;
- if (fobj.getLeaderPatternWidth().getValue() > width) {
+ if (fobj.getLeaderPatternWidth().getValue(this) > width) {
spacer = new Space();
- spacer.setIPD(fobj.getLeaderPatternWidth().getValue() - width);
- width = fobj.getLeaderPatternWidth().getValue();
+ spacer.setIPD(fobj.getLeaderPatternWidth().getValue(this) - width);
+ width = fobj.getLeaderPatternWidth().getValue(this);
}
FilledArea fa = new FilledArea();
fa.setUnitWidth(width);
contentList = clm.getNextKnuthElements(new LayoutContext(0), 0);
int width = clm.getStackingSize();
Space spacer = null;
- if (fobj.getLeaderPatternWidth().getValue() > width) {
+ if (fobj.getLeaderPatternWidth().getValue(this) > width) {
spacer = new Space();
- spacer.setIPD(fobj.getLeaderPatternWidth().getValue() - width);
- width = fobj.getLeaderPatternWidth().getValue();
+ spacer.setIPD(fobj.getLeaderPatternWidth().getValue(this) - width);
+ width = fobj.getLeaderPatternWidth().getValue(this);
}
fa.setUnitWidth(width);
if (spacer != null) {
protected void addId() {
getPSLM().addIDToPage(fobj.getId());
}
+
+ /**
+ * @see org.apache.fop.datatypes.PercentBaseContext#getBaseLength(int, FObj)
+ */
+ public int getBaseLength(int lengthBase, FObj fobj) {
+ return getParent().getBaseLength(lengthBase, getParent().getFObj());
+ }
+
+ /**
+ * Returns the IPD of the content area
+ * @return the IPD of the content area
+ */
+ public int getContentAreaIPD() {
+ return contentAreaIPD;
+ }
+
+ private void setContentAreaIPD(int contentAreaIPD) {
+ this.contentAreaIPD = contentAreaIPD;
+ }
+
}
private Block fobj;
- private void initialize() {
+ public void initialize() {
bTextAlignment = fobj.getTextAlign();
bTextAlignmentLast = fobj.getTextAlignLast();
textIndent = fobj.getTextIndent();
private CommonHyphenation hyphProps;
//private LayoutProps layoutProps;
- private int lineHeight;
+ private Length lineHeight;
private int lead;
private int follow;
// offset of the middle baseline with respect to the main baseline
// add the element representing text indentation
// at the beginning of the first paragraph
if (knuthParagraphs.size() == 0
- && fobj.getTextIndent().getValue() != 0) {
- this.add(new KnuthInlineBox(fobj.getTextIndent().getValue(), 0, 0, 0,
+ && fobj.getTextIndent().getValue(layoutManager) != 0) {
+ this.add(new KnuthInlineBox(fobj.getTextIndent().getValue(layoutManager), 0, 0, 0,
null, false));
ignoreAtStart ++;
}
* @param l the default lead, from top to baseline
* @param f the default follow, from baseline to bottom
*/
- public LineLayoutManager(Block block, int lh, int l, int f, int ms) {
+ public LineLayoutManager(Block block, Length lh, int l, int f, int ms) {
super(block);
fobj = block;
// the child FObj are owned by the parent BlockLM
lead = l;
follow = f;
middleShift = ms;
- initialize(); // Normally done when started by parent!
}
/** @see org.apache.fop.layoutmgr.LayoutManager */
int iPrevLineEnd = vecInlineBreaks.size();
if (iPrevLineEnd == 0 && bTextAlignment == EN_START) {
- availIPD.subtract(new MinOptMax(textIndent.getValue()));
+ availIPD.subtract(new MinOptMax(textIndent.getValue(this)));
}
//PHASE 1: Create Knuth elements
if (lastPar == null) {
lastPar = new Paragraph(this,
bTextAlignment, bTextAlignmentLast,
- textIndent.getValue());
+ textIndent.getValue(this));
lastPar.startParagraph(availIPD.opt);
if (log.isTraceEnabled()) {
trace.append(" [");
? difference / 2
: (textAlign == EN_END) ? difference : 0;
indent += (line == 1 && knuthParagraphs.indexOf(par) == 0)
- ? textIndent.getValue() : 0;
+ ? textIndent.getValue(this) : 0;
double ratio = (textAlign == EN_JUSTIFY)
? knuthPara.getAdjustRatio(i) : 0;
int iBPcount = 0;
LineBreakingAlgorithm alg = new LineBreakingAlgorithm(alignment,
bTextAlignment, bTextAlignmentLast,
- textIndent.getValue(), currPar.lineFiller.opt,
- lineHeight, lead, follow, middleShift,
+ textIndent.getValue(this), currPar.lineFiller.opt,
+ lineHeight.getValue(this), lead, follow, middleShift,
(knuthParagraphs.indexOf(currPar) == 0),
this);
return false;
}
+ /**
+ * @see org.apache.fop.layoutmgr.BlockLevelLayoutManager#negotiateBPDAdjustment(int, org.apache.fop.layoutmgr.KnuthElement)
+ */
public int negotiateBPDAdjustment(int adj, KnuthElement lastElement) {
LeafPosition pos = (LeafPosition)lastElement.getPosition();
int totalAdj = adj;
}
}
+ // --------- Property Resolution related functions --------- //
+
+ /**
+ * @see org.apache.fop.layoutmgr.LayoutManager#getGeneratesBlockArea
+ */
+ public boolean getGeneratesBlockArea() {
+ return true;
+ }
+
+ /**
+ * @see org.apache.fop.layoutmgr.LayoutManager#getGeneratesLineArea
+ */
+ public boolean getGeneratesLineArea() {
+ return true;
+ }
+
}
public PageNumberCitationLayoutManager(PageNumberCitation node) {
super(node);
fobj = node;
- font = fobj.getCommonFont().getFontState(fobj.getFOEventHandler().getFontInfo());
+ }
+
+ public void initialize() {
+ font = fobj.getCommonFont().getFontState(fobj.getFOEventHandler().getFontInfo(), this);
}
public InlineArea get(LayoutContext context) {
public PageNumberLayoutManager(PageNumber node) {
super(node);
fobj = node;
- font = fobj.getCommonFont().getFontState(fobj.getFOEventHandler().getFontInfo());
+ }
+
+ public void initialize() {
+ font = fobj.getCommonFont().getFontState(fobj.getFOEventHandler().getFontInfo(), this);
}
public InlineArea get(LayoutContext context) {
private int total = 0;
private int middle = 0;
private int verticalAlignment = EN_BASELINE;
-
/**
* Create a Text layout manager.
*
node.endIndex - node.startIndex);
vecAreaInfo = new java.util.ArrayList();
-
- fs = foText.getCommonFont().getFontState(foText.getFOEventHandler().getFontInfo());
+ }
+
+ public void initialize() {
+ fs = foText.getCommonFont().getFontState(foText.getFOEventHandler().getFontInfo(), this);
// With CID fonts, space isn't neccesary currentFontState.width(32)
spaceCharIPD = fs.getCharWidth(' ');
-/*\r
- * Copyright 2005 The Apache Software Foundation.\r
- * \r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- * \r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-/* $Id$ */\r
-\r
-package org.apache.fop.layoutmgr.inline;\r
-\r
-import org.apache.fop.area.inline.InlineArea;\r
-import org.apache.fop.fo.flow.Wrapper;\r
-import org.apache.fop.layoutmgr.LayoutContext;\r
-\r
-/**\r
- * This is the layout manager for the fo:wrapper formatting object.\r
- */\r
-public class WrapperLayoutManager extends LeafNodeLayoutManager {\r
- \r
- private Wrapper fobj;\r
-\r
- /**\r
- * Creates a new LM for fo:wrapper.\r
- * @param node the fo:wrapper\r
- */\r
- public WrapperLayoutManager(Wrapper node) {\r
- super(node);\r
- fobj = node;\r
- }\r
-\r
- /** @see org.apache.fop.layoutmgr.inline.LeafNodeLayoutManager */\r
- public InlineArea get(LayoutContext context) {\r
- //Create a zero-width, zero-height dummy area so this node can \r
- //participate in the ID handling. Otherwise, addId() wouldn't \r
- //be called.\r
- InlineArea area = new InlineArea();\r
- return area;\r
- }\r
- \r
- /** @see org.apache.fop.layoutmgr.inline.LeafNodeLayoutManager#addId() */\r
- protected void addId() {\r
- getPSLM().addIDToPage(fobj.getId());\r
- }\r
- \r
-}\r
+/*
+ * Copyright 2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* $Id$ */
+
+package org.apache.fop.layoutmgr.inline;
+
+import org.apache.fop.area.inline.InlineArea;
+import org.apache.fop.fo.flow.Wrapper;
+import org.apache.fop.layoutmgr.LayoutContext;
+import org.apache.fop.layoutmgr.LayoutManager;
+
+/**
+ * This is the layout manager for the fo:wrapper formatting object.
+ */
+public class WrapperLayoutManager extends LeafNodeLayoutManager {
+
+ private Wrapper fobj;
+
+ /**
+ * Creates a new LM for fo:wrapper.
+ * @param node the fo:wrapper
+ */
+ public WrapperLayoutManager(Wrapper node) {
+ super(node);
+ fobj = node;
+ }
+
+ /** @see org.apache.fop.layoutmgr.inline.LeafNodeLayoutManager */
+ public InlineArea get(LayoutContext context) {
+ //Create a zero-width, zero-height dummy area so this node can
+ //participate in the ID handling. Otherwise, addId() wouldn't
+ //be called.
+ InlineArea area = new InlineArea();
+ return area;
+ }
+
+ /** @see org.apache.fop.layoutmgr.inline.LeafNodeLayoutManager#addId() */
+ protected void addId() {
+ getPSLM().addIDToPage(fobj.getId());
+ }
+
+}
* the list block area..
*/
public class ListBlockLayoutManager extends BlockStackingLayoutManager {
+
private Block curBlockArea;
//TODO space-before|after: handle space-resolution rules
/**
* Create a new list block layout manager.
* @param node list-block to create the layout manager for
+ * @param parent the parent layout manager
*/
public ListBlockLayoutManager(ListBlock node) {
super(node);
- initialize();
}
/**
return (ListBlock)fobj;
}
- private void initialize() {
- foSpaceBefore = new SpaceVal(getListBlockFO().getCommonMarginBlock().spaceBefore).getSpace();
- foSpaceAfter = new SpaceVal(getListBlockFO().getCommonMarginBlock().spaceAfter).getSpace();
+ public void initialize() {
+ foSpaceBefore = new SpaceVal(getListBlockFO().getCommonMarginBlock().spaceBefore, this).getSpace();
+ foSpaceAfter = new SpaceVal(getListBlockFO().getCommonMarginBlock().spaceAfter, this).getSpace();
}
private int getIPIndents() {
int iIndents = 0;
- iIndents += getListBlockFO().getCommonMarginBlock().startIndent.getValue();
- iIndents += getListBlockFO().getCommonMarginBlock().endIndent.getValue();
+ iIndents += getListBlockFO().getCommonMarginBlock().startIndent.getValue(this);
+ iIndents += getListBlockFO().getCommonMarginBlock().endIndent.getValue(this);
return iIndents;
}
getCurrentPV().addMarkers(markers, false, isFirst(firstPos), isLast(lastPos));
}
+ // We are done with this area add the background
+ TraitSetter.addBackground(curBlockArea,
+ getListBlockFO().getCommonBorderPaddingBackground(),
+ this);
+
flush();
// if adjusted space after
// set traits
TraitSetter.setProducerID(curBlockArea, getListBlockFO().getId());
TraitSetter.addBorders(curBlockArea,
- getListBlockFO().getCommonBorderPaddingBackground());
+ getListBlockFO().getCommonBorderPaddingBackground(), this);
TraitSetter.addMargins(curBlockArea,
getListBlockFO().getCommonBorderPaddingBackground(),
- getListBlockFO().getCommonMarginBlock());
+ getListBlockFO().getCommonMarginBlock(),
+ this);
TraitSetter.addBreaks(curBlockArea,
getListBlockFO().getBreakBefore(),
getListBlockFO().getBreakAfter());
int contentIPD = referenceIPD - getIPIndents();
curBlockArea.setIPD(contentIPD);
- TraitSetter.addBackground(curBlockArea,
- getListBlockFO().getCommonBorderPaddingBackground());
setCurrentArea(curBlockArea);
}
private LinkedList bodyList = null;
private int listItemHeight;
-
+
//TODO space-before|after: handle space-resolution rules
private boolean keepWithNextPendingOnLabel;
super(node);
setLabel(node.getLabel());
setBody(node.getBody());
- initialize();
}
/**
body.setParent(this);
}
- private void initialize() {
- foSpaceBefore = new SpaceVal(getListItemFO().getCommonMarginBlock().spaceBefore).getSpace();
- foSpaceAfter = new SpaceVal(getListItemFO().getCommonMarginBlock().spaceAfter).getSpace();
+ public void initialize() {
+ foSpaceBefore = new SpaceVal(getListItemFO().getCommonMarginBlock().spaceBefore, this).getSpace();
+ foSpaceAfter = new SpaceVal(getListItemFO().getCommonMarginBlock().spaceAfter, this).getSpace();
}
private int getIPIndents() {
int iIndents = 0;
- iIndents += getListItemFO().getCommonMarginBlock().startIndent.getValue();
- iIndents += getListItemFO().getCommonMarginBlock().endIndent.getValue();
+ iIndents += getListItemFO().getCommonMarginBlock().startIndent.getValue(this);
+ iIndents += getListItemFO().getCommonMarginBlock().endIndent.getValue(this);
return iIndents;
}
// label
childLC = new LayoutContext(0);
childLC.setRefIPD(context.getRefIPD());
+ label.initialize();
labelList = label.getNextKnuthElements(childLC, alignment);
if (childLC.isKeepWithPreviousPending()) {
context.setFlags(LayoutContext.KEEP_WITH_PREVIOUS_PENDING);
// body
childLC = new LayoutContext(0);
childLC.setRefIPD(context.getRefIPD());
+ body.initialize();
bodyList = body.getNextKnuthElements(childLC, alignment);
if (childLC.isKeepWithPreviousPending()) {
context.setFlags(LayoutContext.KEEP_WITH_PREVIOUS_PENDING);
getCurrentPV().addMarkers(markers, false, isFirst(firstPos), isLast(lastPos));
}
+ // We are done with this area add the background
+ TraitSetter.addBackground(curBlockArea,
+ getListItemFO().getCommonBorderPaddingBackground(),
+ this);
+
flush();
// if adjusted space after
// set traits
TraitSetter.setProducerID(curBlockArea, getListItemFO().getId());
TraitSetter.addBorders(curBlockArea,
- getListItemFO().getCommonBorderPaddingBackground());
- TraitSetter.addBackground(curBlockArea,
- getListItemFO().getCommonBorderPaddingBackground());
+ getListItemFO().getCommonBorderPaddingBackground(), this);
TraitSetter.addMargins(curBlockArea,
getListItemFO().getCommonBorderPaddingBackground(),
- getListItemFO().getCommonMarginBlock());
+ getListItemFO().getCommonMarginBlock(), this);
TraitSetter.addBreaks(curBlockArea,
getListItemFO().getBreakBefore(),
getListItemFO().getBreakAfter());
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.apache.fop.datatypes.PercentBaseContext;
import org.apache.fop.fo.flow.Table;
import org.apache.fop.fo.flow.TableColumn;
/**
* @param col column index (1 is first column)
+ * @param context the context for percentage based calculations
* @return the X offset of the requested column
*/
- public int getXOffset(int col) {
+ public int getXOffset(int col, PercentBaseContext context) {
int xoffset = 0;
for (int i = 1; i < col; i++) {
- xoffset += getColumn(i).getColumnWidth().getValue();
+ xoffset += getColumn(i).getColumnWidth().getValue(context);
}
return xoffset;
}
this.effBorders.setBorderInfo(
borderModel.determineWinner(this, other,
side, resFlags), side);
+ if (cell != null) {
+ this.effBorders.setPadding(this.cell.getCommonBorderPaddingBackground());
+ }
}
/**
import org.apache.fop.fo.flow.TableCell;
import org.apache.fop.fo.flow.TableColumn;
+import org.apache.fop.layoutmgr.LayoutManager;
/**
* This class represents a primary grid unit of a spanned cell.
/** @return true if cell/row has an explicit BPD/height */
public boolean hasBPD() {
- if (!getCell().getBlockProgressionDimension().getOptimum().isAuto()) {
+ if (!getCell().getBlockProgressionDimension().getOptimum(null).isAuto()) {
return true;
}
if (getRow() != null
- && !getRow().getBlockProgressionDimension().getOptimum().isAuto()) {
+ && !getRow().getBlockProgressionDimension().getOptimum(null).isAuto()) {
return true;
}
return false;
import org.apache.fop.area.Area;
import org.apache.fop.area.Block;
import org.apache.fop.area.Trait;
+import org.apache.fop.layoutmgr.LayoutManager;
import org.apache.fop.traits.MinOptMax;
/**
super(node);
fobj = node;
this.gridUnit = pgu;
- initialize();
}
/** @return the table-cell FO */
- public TableCell getFObj() {
+ public TableCell getTableCell() {
return this.fobj;
}
return fobj.isSeparateBorderModel();
}
- private void initialize() {
+ public void initialize() {
borderAndPaddingBPD = 0;
borderAndPaddingBPD += fobj.getCommonBorderPaddingBackground().getBorderBeforeWidth(false);
borderAndPaddingBPD += fobj.getCommonBorderPaddingBackground().getBorderAfterWidth(false);
if (!isSeparateBorderModel()) {
borderAndPaddingBPD /= 2;
}
- borderAndPaddingBPD += fobj.getCommonBorderPaddingBackground().getPaddingBefore(false);
- borderAndPaddingBPD += fobj.getCommonBorderPaddingBackground().getPaddingAfter(false);
+ borderAndPaddingBPD += fobj.getCommonBorderPaddingBackground().getPaddingBefore(false, this);
+ borderAndPaddingBPD += fobj.getCommonBorderPaddingBackground().getPaddingAfter(false, this);
}
/**
if (!isSeparateBorderModel()) {
iIndents /= 2;
}
- iIndents += fobj.getCommonBorderPaddingBackground().getPaddingStart(false);
- iIndents += fobj.getCommonBorderPaddingBackground().getPaddingEnd(false);
+ iIndents += fobj.getCommonBorderPaddingBackground().getPaddingStart(false, this);
+ iIndents += fobj.getCommonBorderPaddingBackground().getPaddingEnd(false, this);
return iIndents;
}
cellIPD -= getIPIndents();
if (isSeparateBorderModel()) {
int borderSep = fobj.getBorderSeparation().getLengthPair()
- .getIPD().getLength().getValue();
+ .getIPD().getLength().getValue(this);
cellIPD -= borderSep;
}
}
CommonBorderPaddingBackground cbpb
= gu.getCell().getCommonBorderPaddingBackground();
- bpd -= cbpb.getPaddingBefore(false);
- bpd -= cbpb.getPaddingAfter(false);
+ bpd -= cbpb.getPaddingBefore(false, this);
+ bpd -= cbpb.getPaddingAfter(false, this);
return bpd;
}
getPSLM().addIDToPage(fobj.getId());
- if (!isSeparateBorderModel()) {
+ if (isSeparateBorderModel()) {
+ if (!emptyCell || fobj.showEmptyCells()) {
+ TraitSetter.addBorders(curBlockArea, fobj.getCommonBorderPaddingBackground(), this);
+ }
+ } else {
boolean[] outer = new boolean[] {
gridUnit.getFlag(GridUnit.FIRST_IN_TABLE),
gridUnit.getFlag(GridUnit.LAST_IN_TABLE),
if (!gridUnit.hasSpanning()) {
//Can set the borders directly if there's no span
TraitSetter.addCollapsingBorders(curBlockArea,
- gridUnit.getBorders(), outer);
+ gridUnit.getBorders(), outer, this);
} else {
int dy = yoffset;
for (int y = 0; y < gridUnit.getRows().size(); y++) {
}
block.setBPD(bpd);
lastRowHeight = rowHeight;
- int ipd = gu.getColumn().getColumnWidth().getValue();
+ int ipd = gu.getColumn().getColumnWidth().getValue(this);
int borderStartWidth = gu.getBorders().getBorderStartWidth(false) / 2;
ipd -= borderStartWidth;
ipd -= gu.getBorders().getBorderEndWidth(false) / 2;
+= gu.getBorders().getBorderBeforeWidth(false) / 2;
}
block.setYOffset(dy - halfCollapsingBorderHeight);
- TraitSetter.addCollapsingBorders(block, gu.getBorders(), outer);
+ TraitSetter.addCollapsingBorders(block, gu.getBorders(), outer, this);
parentLM.addChildArea(block);
- dx += gu.getColumn().getColumnWidth().getValue();
+ dx += gu.getColumn().getColumnWidth().getValue(this);
}
dy += lastRowHeight;
}
curBlockArea.setBPD(contentBPD);
+ // Add background after we know the BPD
if (isSeparateBorderModel()) {
if (!emptyCell || fobj.showEmptyCells()) {
- TraitSetter.addBorders(curBlockArea, fobj.getCommonBorderPaddingBackground());
- TraitSetter.addBackground(curBlockArea, fobj.getCommonBorderPaddingBackground());
+ TraitSetter.addBackground(curBlockArea,
+ fobj.getCommonBorderPaddingBackground(),
+ this);
}
} else {
- TraitSetter.addBackground(curBlockArea, fobj.getCommonBorderPaddingBackground());
+ TraitSetter.addBackground(curBlockArea,
+ fobj.getCommonBorderPaddingBackground(),
+ this);
}
flush();
if (!isSeparateBorderModel()) {
indent /= 2;
}
- indent += fobj.getCommonBorderPaddingBackground().getPaddingStart(false);
+ indent += fobj.getCommonBorderPaddingBackground().getPaddingStart(false, this);
// set position
int halfBorderSep = 0;
if (isSeparateBorderModel()) {
halfBorderSep = fobj.getBorderSeparation().getLengthPair()
- .getIPD().getLength().getValue() / 2;
+ .getIPD().getLength().getValue(this) / 2;
}
int borderAdjust = 0;
if (!isSeparateBorderModel()) {
|| !fobj.getKeepWithNext().getWithinColumn().isAuto();
*/
}
+
+ // --------- Property Resolution related functions --------- //
+
+ /**
+ * Returns the IPD of the content area
+ * @return the IPD of the content area
+ */
+ public int getContentAreaIPD() {
+ return cellIPD;
+ }
+
+ /**
+ * Returns the BPD of the content area
+ * @return the BPD of the content area
+ */
+ public int getContentAreaBPD() {
+ if (curBlockArea != null) {
+ return curBlockArea.getBPD();
+ } else {
+ log.error("getContentAreaBPD called on unknown BPD");
+ return -1;
+ }
+ }
+
+ /**
+ * @see org.apache.fop.layoutmgr.LayoutManager#getGeneratesReferenceArea
+ */
+ public boolean getGeneratesReferenceArea() {
+ return true;
+ }
+
+ /**
+ * @see org.apache.fop.layoutmgr.LayoutManager#getGeneratesBlockArea
+ */
+ public boolean getGeneratesBlockArea() {
+ return true;
+ }
}
import org.apache.commons.logging.LogFactory;
import org.apache.fop.area.Block;
import org.apache.fop.area.Trait;
+import org.apache.fop.datatypes.PercentBaseContext;
import org.apache.fop.fo.Constants;
+import org.apache.fop.fo.FObj;
import org.apache.fop.fo.flow.Table;
import org.apache.fop.fo.flow.TableBody;
import org.apache.fop.fo.flow.TableRow;
/**
* Layout manager for table contents, particularly managing the creation of combined element lists.
*/
-public class TableContentLayoutManager {
+public class TableContentLayoutManager implements PercentBaseContext {
/** Logger **/
private static Log log = LogFactory.getLog(TableContentLayoutManager.class);
PrimaryGridUnit primary = gu.getPrimary();
if (gu.isPrimary()) {
- primary.getCellLM().setParent(tableLM);
+ primary.getCellLM().setParent(getTableLM());
//Determine the table-row if any
if (tableRow == null && primary.getRow() != null) {
//Check for bpd on row, see CSS21, 17.5.3 Table height algorithms
LengthRangeProperty bpd = tableRow.getBlockProgressionDimension();
- if (!bpd.getMinimum().isAuto()) {
+ if (!bpd.getMinimum(getTableLM()).isAuto()) {
minContentHeight = Math.max(minContentHeight,
- bpd.getMinimum().getLength().getValue());
+ bpd.getMinimum(getTableLM()).getLength().getValue(getTableLM()));
}
- MinOptMaxUtil.restrict(explicitRowHeights[rgi], bpd);
+ MinOptMaxUtil.restrict(explicitRowHeights[rgi], bpd, getTableLM());
}
+ primary.getCell().getNumberColumnsSpanned();
i++) {
spanWidth += getTableLM().getColumns().getColumn(i + 1)
- .getColumnWidth().getValue();
+ .getColumnWidth().getValue(getTableLM());
}
LayoutContext childLC = new LayoutContext(0);
childLC.setStackLimit(context.getStackLimit()); //necessary?
if (gu.isLastGridUnitRowSpan()) {
int effCellContentHeight = minContentHeight;
LengthRangeProperty bpd = primary.getCell().getBlockProgressionDimension();
- if (!bpd.getMinimum().isAuto()) {
+ if (!bpd.getMinimum(getTableLM()).isAuto()) {
effCellContentHeight = Math.max(effCellContentHeight,
- bpd.getMinimum().getLength().getValue());
+ bpd.getMinimum(getTableLM()).getLength().getValue(getTableLM()));
}
- if (!bpd.getOptimum().isAuto()) {
+ if (!bpd.getOptimum(getTableLM()).isAuto()) {
effCellContentHeight = Math.max(effCellContentHeight,
- bpd.getOptimum().getLength().getValue());
+ bpd.getOptimum(getTableLM()).getLength().getValue(getTableLM()));
}
if (gu.getRowSpanIndex() == 0) {
//TODO ATM only non-row-spanned cells are taken for this
- MinOptMaxUtil.restrict(explicitRowHeights[rgi], bpd);
+ MinOptMaxUtil.restrict(explicitRowHeights[rgi], bpd, tableLM);
}
effCellContentHeight = Math.max(effCellContentHeight,
primary.getContentLength());
effCellContentHeight);
CommonBorderPaddingBackground cbpb
= primary.getCell().getCommonBorderPaddingBackground();
- padding += cbpb.getPaddingBefore(false);
- padding += cbpb.getPaddingAfter(false);
+ padding += cbpb.getPaddingBefore(false, primary.getCellLM());
+ padding += cbpb.getPaddingAfter(false, primary.getCellLM());
int effRowHeight = effCellContentHeight + padding + borderWidths;
for (int previous = 0; previous < gu.getRowSpanIndex(); previous++) {
effRowHeight -= rowHeights[rgi - previous - 1].opt;
*/
protected int getXOffsetOfGridUnit(GridUnit gu) {
int col = gu.getStartCol();
- return startXOffset + getTableLM().getColumns().getXOffset(col + 1);
+ return startXOffset + getTableLM().getColumns().getXOffset(col + 1, getTableLM());
}
/**
gridUnits[i].getElements(), start[i], end[i]);
partLength[i] = len;
log.debug("len of part: " + len);
+
if (start[i] == 0) {
LengthRangeProperty bpd = gridUnits[i].getCell()
.getBlockProgressionDimension();
- if (!bpd.getMinimum().isAuto()) {
- if (bpd.getMinimum().getLength().getValue() > 0) {
- len = Math.max(len, bpd.getMinimum().getLength().getValue());
+ if (!bpd.getMinimum(getTableLM()).isAuto()) {
+ if (bpd.getMinimum(getTableLM()).getLength().getValue(getTableLM()) > 0) {
+ len = Math.max(len, bpd.getMinimum(getTableLM()).getLength().getValue(getTableLM()));
}
}
- if (!bpd.getOptimum().isAuto()) {
- if (bpd.getOptimum().getLength().getValue() > 0) {
- len = Math.max(len, bpd.getOptimum().getLength().getValue());
+ if (!bpd.getOptimum(getTableLM()).isAuto()) {
+ if (bpd.getOptimum(getTableLM()).getLength().getValue(getTableLM()) > 0) {
+ len = Math.max(len, bpd.getOptimum(getTableLM()).getLength().getValue(getTableLM()));
}
}
if (gridUnits[i].getRow() != null) {
bpd = gridUnits[i].getRow().getBlockProgressionDimension();
- if (!bpd.getMinimum().isAuto()) {
- if (bpd.getMinimum().getLength().getValue() > 0) {
- len = Math.max(len, bpd.getMinimum().getLength().getValue());
+ if (!bpd.getMinimum(getTableLM()).isAuto()) {
+ if (bpd.getMinimum(getTableLM()).getLength().getValue(getTableLM()) > 0) {
+ len = Math.max(len, bpd.getMinimum(getTableLM()).getLength().getValue(getTableLM()));
}
}
}
}
+ // Add the padding if any
+ len += gridUnits[i].getBorders()
+ .getPaddingBefore(false, gridUnits[i].getCellLM());
+ len += gridUnits[i].getBorders()
+ .getPaddingAfter(false, gridUnits[i].getCellLM());
+
//Now add the borders to the contentLength
if (isSeparateBorderModel()) {
len += gridUnits[i].getBorders().getBorderBeforeWidth(false);
len += gridUnits[i].getBorders().getBorderAfterWidth(false);
}
- len += gridUnits[i].getBorders().getPaddingBefore(false);
- len += gridUnits[i].getBorders().getPaddingAfter(false);
int startRow = Math.max(gridUnits[i].getStartRow(), firstRow[bt]);
Integer storedOffset = (Integer)rowOffsets[bt].get(new Integer(startRow));
int effYOffset;
Block block = new Block();
block.addTrait(Trait.IS_REFERENCE_AREA, Boolean.TRUE);
block.setPositioning(Block.ABSOLUTE);
- TraitSetter.addBackground(block, row.getCommonBorderPaddingBackground());
return block;
}
}
rowBackground.setXOffset(this.startXOffset);
rowBackground.setYOffset(yoffset);
getTableLM().addChildArea(rowBackground);
+ TraitSetter.addBackground(rowBackground, row.getCommonBorderPaddingBackground(), getTableLM());
}
}
}
}
+ // --------- Property Resolution related functions --------- //
+
+ /**
+ * @see org.apache.fop.datatypes.PercentBaseContext#getBaseLength(int, fobj)
+ */
+ public int getBaseLength(int lengthBase, FObj fobj) {
+ return tableLM.getBaseLength(lengthBase, fobj);
+ }
+
}
import java.util.Iterator;
import java.util.LinkedList;
+import org.apache.fop.datatypes.LengthBase;
+import org.apache.fop.fo.FObj;
/**
* LayoutManager for a table FO.
private Block curBlockArea;
private int referenceIPD;
+ private int referenceBPD;
private boolean autoLayout = true;
//TODO space-before|after: handle space-resolution rules
private MinOptMax spaceBefore;
private MinOptMax spaceAfter;
-
/**
* Create a new table layout manager.
* @param node the table FO
super(node);
fobj = node;
this.columns = new ColumnSetup(node);
- initialize();
}
/** @return the table FO */
return this.columns;
}
- private void initialize() {
- spaceBefore = new SpaceVal(fobj.getCommonMarginBlock().spaceBefore).getSpace();
- spaceAfter = new SpaceVal(fobj.getCommonMarginBlock().spaceAfter).getSpace();
+ public void initialize() {
+ spaceBefore = new SpaceVal(fobj.getCommonMarginBlock().spaceBefore, this).getSpace();
+ spaceAfter = new SpaceVal(fobj.getCommonMarginBlock().spaceAfter, this).getSpace();
if (!fobj.isAutoLayout()
- && fobj.getInlineProgressionDimension().getOptimum().getEnum() != EN_AUTO) {
+ && fobj.getInlineProgressionDimension().getOptimum(this).getEnum() != EN_AUTO) {
autoLayout = false;
}
}
private int getIPIndents() {
int iIndents = 0;
- iIndents += fobj.getCommonMarginBlock().startIndent.getValue();
- iIndents += fobj.getCommonMarginBlock().endIndent.getValue();
+ iIndents += fobj.getCommonMarginBlock().startIndent.getValue(this);
+ iIndents += fobj.getCommonMarginBlock().endIndent.getValue(this);
return iIndents;
}
}
}
+ referenceBPD = context.getStackLimit().opt;
referenceIPD = context.getRefIPD();
- if (fobj.getInlineProgressionDimension().getOptimum().getEnum() != EN_AUTO) {
- referenceIPD = fobj.getInlineProgressionDimension().getOptimum().getLength().getValue();
+
+ if (fobj.getInlineProgressionDimension().getOptimum(this).getEnum() != EN_AUTO) {
+ referenceIPD = fobj.getInlineProgressionDimension().getOptimum(this).getLength().getValue(this);
} else if( !fobj.isAutoLayout() ) {
log.info("table-layout=\"fixed\" and width=\"auto\", but auto-layout not supported " +
"=> assuming width=\"100%\"");
stackSize.add(spaceBefore);
}
- fobj.setLayoutDimension(PercentBase.BLOCK_IPD, referenceIPD);
- fobj.setLayoutDimension(PercentBase.BLOCK_BPD, context.getStackLimit().opt);
- fobj.setLayoutDimension(PercentBase.REFERENCE_AREA_IPD, referenceIPD);
- fobj.setLayoutDimension(PercentBase.REFERENCE_AREA_BPD, context.getStackLimit().opt);
-
// either works out table of column widths or if proportional-column-width function
// is used works out total factor, so that value of single unit can be computed.
int sumCols = 0;
for (Iterator i = columns.iterator(); i.hasNext(); ) {
TableColumn column = (TableColumn) i.next();
Length width = column.getColumnWidth();
- sumCols += width.getValue();
+ sumCols += width.getValue(this);
if (width instanceof TableColLength) {
factors += ((TableColLength) width).getTableUnits();
}
addBlockSpacing(adjust, spaceBefore);
spaceBefore = null;
- int startXOffset = fobj.getCommonMarginBlock().startIndent.getValue();
+ int startXOffset = fobj.getCommonMarginBlock().startIndent.getValue(this);
// add column, body then row areas
curBlockArea.setBPD(tableHeight);
if (fobj.isSeparateBorderModel()) {
- TraitSetter.addBorders(curBlockArea, fobj.getCommonBorderPaddingBackground());
+ TraitSetter.addBorders(curBlockArea, fobj.getCommonBorderPaddingBackground(), this);
}
- TraitSetter.addBackground(curBlockArea, fobj.getCommonBorderPaddingBackground());
+ TraitSetter.addBackground(curBlockArea,
+ fobj.getCommonBorderPaddingBackground(),
+ this);
TraitSetter.addMargins(curBlockArea,
fobj.getCommonBorderPaddingBackground(),
- fobj.getCommonMarginBlock());
+ fobj.getCommonMarginBlock(),
+ this);
TraitSetter.addBreaks(curBlockArea,
fobj.getBreakBefore(), fobj.getBreakAfter());
|| !fobj.getKeepWithNext().getWithinColumn().isAuto();
}
+ // --------- Property Resolution related functions --------- //
+
+ /**
+ * @see org.apache.fop.datatypes.PercentBaseContext#getBaseLength(int, FObj)
+ */
+ public int getBaseLength(int lengthBase, FObj fobj) {
+ // Special handler for TableColumn width specifications
+ if (fobj instanceof TableColumn && fobj.getParent() == getFObj()) {
+ switch (lengthBase) {
+ case LengthBase.CONTAINING_BLOCK_WIDTH:
+ return getContentAreaIPD();
+ default:
+ log.error("Unknown base type for LengthBase.");
+ return 0;
+ }
+ } else {
+ return super.getBaseLength(lengthBase, fobj);
+ }
+ }
+
+ /**
+ * Returns the IPD of the content area
+ * @return the IPD of the content area
+ */
+ public int getContentAreaIPD() {
+ return referenceIPD;
+ }
+
+ /**
+ * Returns the BPD of the content area
+ * @return the BPD of the content area
+ */
+ public int getContentAreaBPD() {
+ return referenceBPD;
+ }
+
}
} else {
borderBefore[column] = pgu.getBorders().getBorderBeforeWidth(false) / 2;
}
- paddingBefore[column] = pgu.getBorders().getPaddingBefore(false);
- paddingAfter[column] = pgu.getBorders().getPaddingAfter(false);
+ paddingBefore[column] = pgu.getBorders().getPaddingBefore(false, pgu.getCellLM());
+ paddingAfter[column] = pgu.getBorders().getPaddingAfter(false, pgu.getCellLM());
start[column] = 0;
end[column] = -1;
widths[column] = 0;
= getTableLM().getTable().getCommonBorderPaddingBackground();
effPenaltyLen += borders.getBorderBeforeWidth(false);
effPenaltyLen += borders.getBorderAfterWidth(false);
- effPenaltyLen += borders.getPaddingBefore(false);
- effPenaltyLen += borders.getPaddingAfter(false);
+ effPenaltyLen += borders.getPaddingBefore(false, getTableLM());
+ effPenaltyLen += borders.getPaddingAfter(false, getTableLM());
}
TableContentPosition tcpos = new TableContentPosition(getTableLM(),
gridUnitParts, getActiveRow());
//TODO Make this configurable
if (reproduceMSWordBug) {
//MS Word has a bug where padding left and top are exchanged
- padding = border.getPaddingStart(false);
+ padding = border.getPaddingStart(false, null); // TODO do we need a real context here?
if (padding != 0) {
attrib.setTwips(ITableAttributes.ATTR_CELL_PADDING_TOP, padding);
attrib.set(ITableAttributes.ATTR_CELL_U_PADDING_TOP, 3 /*=twips*/);
}
- padding = border.getPaddingBefore(false);
+ padding = border.getPaddingBefore(false, null); // TODO do we need a real context here?
if (padding != 0) {
attrib.setTwips(ITableAttributes.ATTR_CELL_PADDING_LEFT, padding);
attrib.set(ITableAttributes.ATTR_CELL_U_PADDING_LEFT, 3 /*=twips*/);
}
} else {
- padding = border.getPaddingStart(false);
+ padding = border.getPaddingStart(false, null); // TODO do we need a real context here?
if (padding != 0) {
attrib.setTwips(ITableAttributes.ATTR_CELL_PADDING_LEFT, padding);
attrib.set(ITableAttributes.ATTR_CELL_U_PADDING_LEFT, 3 /*=twips*/);
}
- padding = border.getPaddingBefore(false);
+ padding = border.getPaddingBefore(false, null); // TODO do we need a real context here?
if (padding != 0) {
attrib.setTwips(ITableAttributes.ATTR_CELL_PADDING_TOP, padding);
attrib.set(ITableAttributes.ATTR_CELL_U_PADDING_TOP, 3 /*=twips*/);
}
}
- padding = border.getPaddingEnd(false);
+ padding = border.getPaddingEnd(false, null); // TODO do we need a real context here?
if (padding != 0) {
attrib.setTwips(ITableAttributes.ATTR_CELL_PADDING_RIGHT, padding);
attrib.set(ITableAttributes.ATTR_CELL_U_PADDING_RIGHT, 3 /*=twips*/);
}
- padding = border.getPaddingAfter(false);
+ padding = border.getPaddingAfter(false, null); // TODO do we need a real context here?
if (padding != 0) {
attrib.setTwips(ITableAttributes.ATTR_CELL_PADDING_BOTTOM, padding);
attrib.set(ITableAttributes.ATTR_CELL_U_PADDING_BOTTOM, 3 /*=twips*/);
private static void attrBlockMargin(CommonMarginBlock cmb, FOPRtfAttributes rtfAttr) {
rtfAttr.setTwips(RtfText.SPACE_BEFORE,
- cmb.spaceBefore.getOptimum().getLength());
+ cmb.spaceBefore.getOptimum(null).getLength());
rtfAttr.setTwips(RtfText.SPACE_AFTER,
- cmb.spaceAfter.getOptimum().getLength());
+ cmb.spaceAfter.getOptimum(null).getLength());
rtfAttr.setTwips(RtfText.LEFT_INDENT_BODY, cmb.marginLeft);
rtfAttr.setTwips(RtfText.RIGHT_INDENT_BODY, cmb.marginRight);
}
/*
- * Copyright 1999-2004 The Apache Software Foundation.
+ * Copyright 1999-2005 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
package org.apache.fop.traits;
+import org.apache.fop.datatypes.PercentBaseContext;
import org.apache.fop.fo.Constants;
import org.apache.fop.fo.properties.Property;
import org.apache.fop.fo.properties.SpaceProperty;
/**
* Constructor for SpaceVal objects based on Space objects.
* @param spaceprop Space object to use
+ * @param context Percentage evaluation context
*/
- public SpaceVal(SpaceProperty spaceprop) {
- space = new MinOptMax(spaceprop.getMinimum().getLength().getValue(),
- spaceprop.getOptimum().getLength().getValue(),
- spaceprop.getMaximum().getLength().getValue());
+ public SpaceVal(SpaceProperty spaceprop, PercentBaseContext context) {
+ space = new MinOptMax(spaceprop.getMinimum(context).getLength().getValue(context),
+ spaceprop.getOptimum(context).getLength().getValue(context),
+ spaceprop.getMaximum(context).getLength().getValue(context));
bConditional =
(spaceprop.getConditionality().getEnum() == Constants.EN_DISCARD);
Property precProp = spaceprop.getPrecedence();
this.iPrecedence = iPrecedence;
}
- static public SpaceVal makeWordSpacing(Property wordSpacing, SpaceVal letterSpacing, Font fs) {
+ static public SpaceVal makeWordSpacing(Property wordSpacing,
+ SpaceVal letterSpacing,
+ Font fs) {
if (wordSpacing.getEnum() == Constants.EN_NORMAL) {
// give word spaces the possibility to shrink by a third,
// and stretch by a half;
(space, MinOptMax.multiply(letterSpacing.getSpace(), 2)),
true, true, 0);
} else {
- return new SpaceVal(wordSpacing.getSpace());
+ return new SpaceVal(wordSpacing.getSpace(), null);
}
}
// letter spaces are set to zero (or use different values?)
return new SpaceVal(new MinOptMax(0), true, true, 0);
} else {
- return new SpaceVal(letterSpacing.getSpace());
+ return new SpaceVal(letterSpacing.getSpace(), null);
}
}
final LayoutEngineTester tester, final File f) {
suite.addTest(new LayoutEngineTestCase(f.getName()) {
public void runTest() throws Exception {
+ org.apache.commons.logging.LogFactory.getLog(this.getClass()).info("Starting " + f.getName());
prepare(tester, f);
testMain();
}
-background-image-list1.xml
-background-image-list2.xml
+background-image6.xml
background-image-table2.xml
-background-image-table3.xml
-background-image-table4.xml
background-image-table5.xml
-background-image3.xml
-background-image5.xml
-background-image6.xml
-background-image7.xml
block-container4a.xml
-external-graphic1.xml
-external-graphic2.xml
+font-stretch.xml
external-graphic4.xml
inline-block2.xml
inline-container1.xml
keep-with-previous3.xml
keep-with-previous4.xml
keep-with-previous5.xml
-leader-dots.xml
-leader-rule.xml
-leader-space.xml
+leader-alignment.xml
+leader-use-content.xml
letter-spacing3.xml
list4a.xml
+margin-region3.xml
multi-column3.xml
multi-column4.xml
normal-breaking4.xml
<testcase>
<info>
<p>
- This test checks background image on lists (list-item).
+ This test checks background image on lists (list-block).
</p>
</info>
<variables>
<img>../../resources/images/bgimg300dpi.jpg</img>
</variables>
<fo>
- <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:svg="http://www.w3.org/2000/svg">
+ <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master master-name="normal" page-width="5in" page-height="5in">
<fo:region-body/>
</fo:layout-master-set>
<fo:page-sequence master-reference="normal" white-space-collapse="true">
<fo:flow flow-name="xsl-region-body">
- <fo:list-block provisional-distance-between-starts="1in" provisional-label-separation="0.1in" background-repeat="no-repeat" background-position-horizontal="center" background-position-vertical="center" background-image="##img">
+ <fo:list-block provisional-distance-between-starts="1in" provisional-label-separation="0.1in" background-color="yellow" background-repeat="no-repeat" background-position-horizontal="center" background-position-vertical="center" background-image="##img">
<fo:list-item>
<fo:list-item-label end-indent="label-end()">
<fo:block>label 1</fo:block>
<fo:list-item-label end-indent="label-end()">
<fo:block>label 3</fo:block>
</fo:list-item-label>
- <fo:list-item-body start-indent="body-start()" background-repeat="no-repeat" background-position-horizontal="center" background-position-vertical="center" background-image="##img">
+ <fo:list-item-body start-indent="body-start()">
<fo:block>
body 3: The whole list should have a centered background.
The whole list should have a centered background.
</fo:list-item-body>
</fo:list-item>
</fo:list-block>
- <fo:block></fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
</fo>
<checks>
+ <eval expected="360000" xpath="//flow/block/@ipd"/>
+ <eval expected="172800" xpath="//flow/block/@bpd"/>
+ <eval expected="color=#ffff00,url=../../resources/images/bgimg300dpi.jpg,repeat=no-repeat,horiz=156960,vertical=63360" xpath="//flow/block/@background"/>
</checks>
</testcase>
<img>../../resources/images/bgimg300dpi.jpg</img>
</variables>
<fo>
- <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:svg="http://www.w3.org/2000/svg">
+ <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
<fo:layout-master-set>
<fo:simple-page-master master-name="normal" page-width="5in" page-height="5in">
<fo:region-body/>
<fo:page-sequence master-reference="normal" white-space-collapse="true">
<fo:flow flow-name="xsl-region-body">
<fo:list-block provisional-distance-between-starts="1in" provisional-label-separation="0.1in">
- <fo:list-item background-repeat="no-repeat" background-position-horizontal="center" background-position-vertical="center" background-image="##img">
+ <fo:list-item background-repeat="no-repeat" background-color="yellow" background-position-horizontal="center" background-position-vertical="center" background-image="##img">
<fo:list-item-label end-indent="label-end()">
<fo:block>label 1</fo:block>
</fo:list-item-label>
<fo:list-item-label end-indent="label-end()">
<fo:block>label 3</fo:block>
</fo:list-item-label>
- <fo:list-item-body start-indent="body-start()" background-repeat="no-repeat" background-position-horizontal="center" background-position-vertical="center" background-image="##img">
+ <fo:list-item-body start-indent="body-start()">
<fo:block>
- body 3: The whole list should have a centered background.
- The whole list should have a centered background.
- The whole list should have a centered background.
+ body 3: We should have no background on this list item.
+ We should have no background on this list item.
+ We should have no background on this list item.
</fo:block>
</fo:list-item-body>
</fo:list-item>
</fo:list-block>
- <fo:block></fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
</fo>
<checks>
+ <eval expected="360000" xpath="//flow/block/block/@ipd"/>
+ <eval expected="72000" xpath="//flow/block/block/@bpd"/>
+ <eval expected="color=#ffff00,url=../../resources/images/bgimg300dpi.jpg,repeat=no-repeat,horiz=156960,vertical=12960" xpath="//flow/block/block/@background"/>
</checks>
</testcase>
<testcase>
<info>
<p>
- This test checks background image on a table.
+ This test checks background image on a fo:table.
</p>
</info>
<variables>
</fo:layout-master-set>
<fo:page-sequence master-reference="normal" white-space-collapse="true">
<fo:flow flow-name="xsl-region-body">
- <fo:table background-repeat="no-repeat" background-position-horizontal="center" background-position-vertical="center" background-image="##img">
+ <fo:table background-color="yellow" background-repeat="no-repeat" background-position-horizontal="center" background-position-vertical="center" background-image="##img">
<fo:table-column column-number="1" />
<fo:table-column column-number="2" />
<fo:table-column column-number="3" />
</fo:table-row>
</fo:table-body>
</fo:table>
- <fo:block>Table with centered background</fo:block>
+ <fo:block>Table with centered background image</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
</fo>
<checks>
- <eval expected="color=null,url=../../resources/images/bgimg300dpi.jpg,repeat=no-repeat,horiz=156960,vertical=12960" xpath="//flow/block[1]/@background"/>
+ <eval expected="color=#ffff00,url=../../resources/images/bgimg300dpi.jpg,repeat=no-repeat,horiz=156960,vertical=12960" xpath="//flow/block[1]/@background"/>
</checks>
</testcase>
<testcase>
<info>
<p>
- This test checks background image on a table.
+ This test checks background image on a fo:table-body.
</p>
</info>
<variables>
</fo:table-cell>
</fo:table-row>
</fo:table-header>
- <fo:table-body background-repeat="no-repeat" background-position-horizontal="center" background-position-vertical="center" background-image="##img">
+ <fo:table-body background-color="yellow" background-repeat="no-repeat" background-position-horizontal="center" background-position-vertical="center" background-image="##img">
<fo:table-row>
<fo:table-cell>
<fo:block>Row 1 Col 1</fo:block>
</fo:table-row>
</fo:table-body>
</fo:table>
- <fo:block>Table with centered body background</fo:block>
+ <fo:block>Table with centered background image on body</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
</fo>
<checks>
+ <!-- backgrounds on table-body are not supported at the time this test
+ was written. Therefore no checks! -->
</checks>
</testcase>
<testcase>
<info>
<p>
- This test checks background image on a table.
+ This test checks background image on a fo:table-row.
</p>
</info>
<variables>
</fo:table-row>
</fo:table-header>
<fo:table-body>
- <fo:table-row background-repeat="no-repeat" background-position-horizontal="center" background-position-vertical="center" background-image="##img">
+ <fo:table-row height="1in" background-color="yellow" background-repeat="no-repeat" background-position-horizontal="center" background-position-vertical="center" background-image="##img">
<fo:table-cell>
<fo:block>Row 1 Col 1</fo:block>
</fo:table-cell>
<fo:block>Row 2 Col 3</fo:block>
</fo:table-cell>
</fo:table-row>
- <fo:table-row>
- <fo:table-cell>
- <fo:block>Row 3 Col 1</fo:block>
- </fo:table-cell>
- <fo:table-cell>
- <fo:block>Row 3 Col 2</fo:block>
- </fo:table-cell>
- <fo:table-cell>
- <fo:block>Row 3 Col 3</fo:block>
- </fo:table-cell>
- </fo:table-row>
- <fo:table-row>
- <fo:table-cell>
- <fo:block>Row 4 Col 1</fo:block>
- </fo:table-cell>
- <fo:table-cell>
- <fo:block>Row 4 Col 2</fo:block>
- </fo:table-cell>
- <fo:table-cell>
- <fo:block>Row 4 Col 3</fo:block>
- </fo:table-cell>
- </fo:table-row>
</fo:table-body>
</fo:table>
- <fo:block>Table with centered row 1 background</fo:block>
+ <fo:block>Table with centered background image on row 1</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
</fo>
<checks>
+ <eval expected="360000" xpath="//flow/block/block[4]/@ipd"/>
+ <eval expected="72000" xpath="//flow/block/block[4]/@bpd"/>
+ <eval expected="color=#ffff00,url=../../resources/images/bgimg300dpi.jpg,repeat=no-repeat,horiz=156960,vertical=12960" xpath="//flow/block/block[4]/@background"/>
</checks>
</testcase>
<testcase>
<info>
<p>
- This test checks background image on a table.
+ This test checks background image on a fo:table-cell.
</p>
</info>
<variables>
<fo:table-column column-number="1" />
<fo:table-column column-number="2" />
<fo:table-column column-number="3" />
- <fo:table-header>
- <fo:table-row>
- <fo:table-cell>
- <fo:block>Header Col 1</fo:block>
- </fo:table-cell>
- <fo:table-cell>
- <fo:block>Header Col 2</fo:block>
- </fo:table-cell>
- <fo:table-cell>
- <fo:block>Header Col 3</fo:block>
- </fo:table-cell>
- </fo:table-row>
- </fo:table-header>
<fo:table-body>
<fo:table-row>
- <fo:table-cell background-repeat="no-repeat" background-position-horizontal="center" background-position-vertical="center" background-image="##img">
+ <fo:table-cell>
<fo:block>Row 1 Col 1</fo:block>
</fo:table-cell>
<fo:table-cell>
</fo:table-cell>
</fo:table-row>
<fo:table-row>
- <fo:table-cell>
+ <fo:table-cell background-color="yellow" background-repeat="no-repeat" background-position-horizontal="center" background-position-vertical="center" background-image="##img">
+ <fo:block>Row 2 Col 1</fo:block>
+ <fo:block>Row 2 Col 1</fo:block>
+ <fo:block>Row 2 Col 1</fo:block>
+ <fo:block>Row 2 Col 1</fo:block>
<fo:block>Row 2 Col 1</fo:block>
</fo:table-cell>
- <fo:table-cell>
+ <fo:table-cell padding="5pt" display-align="center" background-color="blue" background-repeat="no-repeat" background-position-horizontal="center" background-position-vertical="center" background-image="##img">
<fo:block>Row 2 Col 2</fo:block>
</fo:table-cell>
- <fo:table-cell>
+ <fo:table-cell display-align="center" background-color="yellow" background-repeat="no-repeat" background-position-horizontal="center" background-position-vertical="center" background-image="##img">
<fo:block>Row 2 Col 3</fo:block>
</fo:table-cell>
</fo:table-row>
- <fo:table-row>
- <fo:table-cell>
- <fo:block>Row 3 Col 1</fo:block>
- </fo:table-cell>
- <fo:table-cell>
- <fo:block>Row 3 Col 2</fo:block>
- </fo:table-cell>
- <fo:table-cell>
- <fo:block>Row 3 Col 3</fo:block>
- </fo:table-cell>
- </fo:table-row>
- <fo:table-row>
- <fo:table-cell>
- <fo:block>Row 4 Col 1</fo:block>
- </fo:table-cell>
- <fo:table-cell>
- <fo:block>Row 4 Col 2</fo:block>
- </fo:table-cell>
- <fo:table-cell>
- <fo:block>Row 4 Col 3</fo:block>
- </fo:table-cell>
- </fo:table-row>
</fo:table-body>
</fo:table>
- <fo:block>Table with centered row 1 col 1 background</fo:block>
+ <fo:block>Table with centered background images on row 2 col 1, and 3</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
</fo>
<checks>
+ <!-- first cell in row 2 -->
+ <eval expected="120000" xpath="//flow/block/block[4]/@ipd"/>
+ <eval expected="72000" xpath="//flow/block/block[4]/@bpd"/>
+ <eval expected="72000" xpath="//flow/block/block[4]/@bpda"/>
+ <eval expected="color=#ffff00,url=../../resources/images/bgimg300dpi.jpg,repeat=no-repeat,horiz=36960,vertical=12960" xpath="//flow/block/block[4]/@background"/>
+ <!-- second cell in row 2 -->
+ <eval expected="110000" xpath="//flow/block/block[5]/@ipd"/>
+ <eval expected="62000" xpath="//flow/block/block[5]/@bpd"/>
+ <eval expected="72000" xpath="//flow/block/block[5]/@bpda"/>
+ <eval expected="color=#0000ff,url=../../resources/images/bgimg300dpi.jpg,repeat=no-repeat,horiz=36960,vertical=12960" xpath="//flow/block/block[5]/@background"/>
+ <!-- second cell in row 2 -->
+ <eval expected="120000" xpath="//flow/block/block[6]/@ipd"/>
+ <eval expected="72000" xpath="//flow/block/block[6]/@bpd"/>
+ <eval expected="72000" xpath="//flow/block/block[6]/@bpda"/>
+ <eval expected="color=#ffff00,url=../../resources/images/bgimg300dpi.jpg,repeat=no-repeat,horiz=36960,vertical=12960" xpath="//flow/block/block[6]/@background"/>
</checks>
</testcase>
<testcase>
<info>
<p>
- This test checks background image on a table.
+ This test checks background image on a fo:table-header and footer.
</p>
</info>
<variables>
<fo:table-column column-number="1" />
<fo:table-column column-number="2" />
<fo:table-column column-number="3" />
- <fo:table-header background-repeat="no-repeat" background-position-horizontal="center" background-position-vertical="center" background-image="##img">
+ <fo:table-header background-color="yellow" background-repeat="no-repeat" background-position-horizontal="center" background-position-vertical="center" background-image="##img">
<fo:table-row>
<fo:table-cell>
<fo:block>Header Col 1</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-header>
- <fo:table-body>
+ <fo:table-footer background-color="yellow" background-repeat="no-repeat" background-position-horizontal="center" background-position-vertical="center" background-image="##img">
<fo:table-row>
<fo:table-cell>
- <fo:block>Row 1 Col 1</fo:block>
- </fo:table-cell>
- <fo:table-cell>
- <fo:block>Row 1 Col 2</fo:block>
- </fo:table-cell>
- <fo:table-cell>
- <fo:block>Row 1 Col 3</fo:block>
- </fo:table-cell>
- </fo:table-row>
- <fo:table-row>
- <fo:table-cell>
- <fo:block>Row 2 Col 1</fo:block>
+ <fo:block>Footer Col 1</fo:block>
</fo:table-cell>
<fo:table-cell>
- <fo:block>Row 2 Col 2</fo:block>
+ <fo:block>Footer Col 2</fo:block>
</fo:table-cell>
<fo:table-cell>
- <fo:block>Row 2 Col 3</fo:block>
+ <fo:block>Footer Col 3</fo:block>
</fo:table-cell>
</fo:table-row>
- <fo:table-row>
+ </fo:table-footer>
+ <fo:table-body background-color="blue">
+ <fo:table-row height="4in" background-color="blue">
<fo:table-cell>
- <fo:block>Row 3 Col 1</fo:block>
+ <fo:block>Row 1 Col 1</fo:block>
</fo:table-cell>
<fo:table-cell>
- <fo:block>Row 3 Col 2</fo:block>
+ <fo:block>Row 1 Col 2</fo:block>
</fo:table-cell>
<fo:table-cell>
- <fo:block>Row 3 Col 3</fo:block>
+ <fo:block>Row 1 Col 3</fo:block>
</fo:table-cell>
</fo:table-row>
- <fo:table-row>
+ <fo:table-row height="4in" background-color="blue">
<fo:table-cell>
- <fo:block>Row 4 Col 1</fo:block>
+ <fo:block>Row 2 Col 1</fo:block>
</fo:table-cell>
<fo:table-cell>
- <fo:block>Row 4 Col 2</fo:block>
+ <fo:block>Row 2 Col 2</fo:block>
</fo:table-cell>
<fo:table-cell>
- <fo:block>Row 4 Col 3</fo:block>
+ <fo:block>Row 2 Col 3</fo:block>
</fo:table-cell>
</fo:table-row>
</fo:table-body>
</fo:table>
- <fo:block>Table with centered header background</fo:block>
+ <fo:block>Table with centered background image in header and footer</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
</fo>
<checks>
+ <!-- backgrounds on table-header/footer are not supported at the time this test
+ was written. Therefore no checks! -->
</checks>
</testcase>
<testcase>
<info>
<p>
- This test checks background images.
+ This test checks background images in block-containers.
</p>
</info>
<variables>
</fo:layout-master-set>
<fo:page-sequence master-reference="normal" white-space-collapse="true">
<fo:flow flow-name="xsl-region-body">
- <fo:block-container height="100%" width="100%" background-color="yellow">
- <fo:block background-repeat="no-repeat" background-position-horizontal="center" background-position-vertical="center" background-image="##img">
- normal block<fo:block/>
- normal block
- </fo:block>
+ <fo:block-container height="50%" width="50%" background-repeat="no-repeat" background-position-horizontal="center" background-position-vertical="center" background-image="##img">
+ <fo:block background-repeat="no-repeat" background-position-horizontal="center" background-position-vertical="center" background-image="##img">
+ normal block<fo:block/>
+ normal block
+ </fo:block>
</fo:block-container>
</fo:flow>
</fo:page-sequence>
</fo:root>
</fo>
<checks>
- <eval expected="color=#ffff00" xpath="//flow/block[1]/@background"/>
- <eval expected="color=null,url=../../resources/images/bgimg300dpi.jpg,repeat=no-repeat,horiz=136960,vertical=-8640" xpath="//flow/block[1]/block[1]/block[1]/@background"/>
+ <eval expected="color=null,url=../../resources/images/bgimg300dpi.jpg,repeat=no-repeat,horiz=136960,vertical=136960" xpath="//regionViewport/@background"/>
+ <eval expected="color=null,url=../../resources/images/bgimg300dpi.jpg,repeat=no-repeat,horiz=56960,vertical=56960" xpath="//flow/block[1]/@background"/>
+ <eval expected="color=null,url=../../resources/images/bgimg300dpi.jpg,repeat=no-repeat,horiz=56960,vertical=-8640" xpath="//flow/block[1]/block[1]/block[1]/@background"/>
</checks>
</testcase>
<testcase>
<info>
<p>
- This test checks background image on a fo:basic-link.
+ This test checks background image on a fo:inline.
</p>
</info>
<variables>
<fo:page-sequence master-reference="normal" white-space-collapse="true">
<fo:flow flow-name="xsl-region-body">
<fo:block>
- Why is <fo:inline font-size="96pt" background-repeat="no-repeat" background-position-horizontal="center" background-position-vertical="center" background-image="##img" background-color="lightgray">FOP</fo:inline> so cool?
+ Why is <fo:inline font-size="96pt" background-color="yellow" background-repeat="no-repeat" background-position-horizontal="center" background-position-vertical="center" background-image="##img">FOP</fo:inline> so cool?
</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
</fo>
<checks>
+ <eval expected="197376" xpath="//flow/block/lineArea/inlineparent/@ipd"/>
+ <eval expected="92100" xpath="//flow/block/lineArea/inlineparent/@bpd"/>
+ <eval expected="color=#ffff00,url=../../resources/images/bgimg300dpi.jpg,repeat=no-repeat,horiz=75648,vertical=23010" xpath="//flow/block/lineArea/inlineparent/@background"/>
</checks>
</testcase>
<fo:page-sequence master-reference="normal" white-space-collapse="true">
<fo:flow flow-name="xsl-region-body">
<fo:block>
- Why is <fo:basic-link external-destination="http://xmlgraphics.apache.org/fop" font-size="96pt" background-repeat="no-repeat" background-position-horizontal="center" background-position-vertical="center" background-image="##img">FOP</fo:basic-link> so cool?
+ Why is <fo:basic-link external-destination="http://xmlgraphics.apache.org/fop" font-size="96pt" background-color="yellow" background-repeat="no-repeat" background-position-horizontal="center" background-position-vertical="center" background-image="##img">FOP</fo:basic-link> so cool?
</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
</fo>
<checks>
+ <eval expected="197376" xpath="//flow/block/lineArea/inlineparent/@ipd"/>
+ <eval expected="92100" xpath="//flow/block/lineArea/inlineparent/@bpd"/>
+ <eval expected="color=#ffff00,url=../../resources/images/bgimg300dpi.jpg,repeat=no-repeat,horiz=75648,vertical=23010" xpath="//flow/block/lineArea/inlineparent/@background"/>
</checks>
</testcase>
</fo>
<checks>
<eval expected="360000" xpath="/areaTree/pageSequence/pageViewport/page[1]/regionViewport/regionBody/mainReference/span/flow/block[2]/@ipd"/>
- <eval expected="50214" xpath="/areaTree/pageSequence/pageViewport/page[1]/regionViewport/regionBody/mainReference/span/flow/block[2]/@bpd"/>
+ <eval expected="51864" xpath="/areaTree/pageSequence/pageViewport/page[1]/regionViewport/regionBody/mainReference/span/flow/block[2]/@bpd"/>
<eval expected="46080" xpath="/areaTree/pageSequence/pageViewport/page[1]/regionViewport/regionBody/mainReference/span/flow/block[2]/lineArea/viewport/@ipd"/>
<eval expected="46080" xpath="/areaTree/pageSequence/pageViewport/page[1]/regionViewport/regionBody/mainReference/span/flow/block[2]/lineArea/viewport/@ipda"/>
<eval expected="46080" xpath="/areaTree/pageSequence/pageViewport/page[1]/regionViewport/regionBody/mainReference/span/flow/block[2]/lineArea/viewport/@bpd"/>
<checks>
<!-- first image -->
<eval expected="360000" xpath="/areaTree/pageSequence/pageViewport/page[1]/regionViewport/regionBody/mainReference/span/flow/block[2]/@ipd"/>
- <eval expected="44134" xpath="/areaTree/pageSequence/pageViewport/page[1]/regionViewport/regionBody/mainReference/span/flow/block[2]/@bpd"/>
+ <eval expected="45784" xpath="/areaTree/pageSequence/pageViewport/page[1]/regionViewport/regionBody/mainReference/span/flow/block[2]/@bpd"/>
<eval expected="46080" xpath="/areaTree/pageSequence/pageViewport/page[1]/regionViewport/regionBody/mainReference/span/flow/block[2]/lineArea/viewport/@ipd"/>
<eval expected="46080" xpath="/areaTree/pageSequence/pageViewport/page[1]/regionViewport/regionBody/mainReference/span/flow/block[2]/lineArea/viewport/@ipda"/>
<eval expected="40000" xpath="/areaTree/pageSequence/pageViewport/page[1]/regionViewport/regionBody/mainReference/span/flow/block[2]/lineArea/viewport/@bpd"/>
<eval expected="40000" xpath="/areaTree/pageSequence/pageViewport/page[1]/regionViewport/regionBody/mainReference/span/flow/block[2]/lineArea/viewport/@bpda"/>
- <!-- first image -->
+ <!-- second image -->
<eval expected="360000" xpath="/areaTree/pageSequence/pageViewport/page[1]/regionViewport/regionBody/mainReference/span/flow/block[4]/@ipd"/>
- <eval expected="50214" xpath="/areaTree/pageSequence/pageViewport/page[1]/regionViewport/regionBody/mainReference/span/flow/block[4]/@bpd"/>
+ <eval expected="51864" xpath="/areaTree/pageSequence/pageViewport/page[1]/regionViewport/regionBody/mainReference/span/flow/block[4]/@bpd"/>
<eval expected="40000" xpath="/areaTree/pageSequence/pageViewport/page[1]/regionViewport/regionBody/mainReference/span/flow/block[4]/lineArea/viewport/@ipd"/>
<eval expected="40000" xpath="/areaTree/pageSequence/pageViewport/page[1]/regionViewport/regionBody/mainReference/span/flow/block[4]/lineArea/viewport/@ipda"/>
<eval expected="46080" xpath="/areaTree/pageSequence/pageViewport/page[1]/regionViewport/regionBody/mainReference/span/flow/block[4]/lineArea/viewport/@bpd"/>
-<?xml version="1.0" encoding="UTF-8"?>\r
-<!--\r
- Copyright 2005 The Apache Software Foundation\r
-\r
- Licensed under the Apache License, Version 2.0 (the "License");\r
- you may not use this file except in compliance with the License.\r
- You may obtain a copy of the License at\r
-\r
- http://www.apache.org/licenses/LICENSE-2.0\r
-\r
- Unless required by applicable law or agreed to in writing, software\r
- distributed under the License is distributed on an "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- See the License for the specific language governing permissions and\r
- limitations under the License.\r
--->\r
-<!-- $Id$ -->\r
-<testcase>\r
- <info>\r
- <p>\r
- This test checks external-graphics. An oversized image is to be squeezed into page using min/opt/max values.\r
- </p>\r
- </info>\r
- <fo>\r
- <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:svg="http://www.w3.org/2000/svg">\r
- <fo:layout-master-set>\r
- <fo:simple-page-master master-name="normal" page-width="21cm" page-height="29.7cm" margin="2cm">\r
- <fo:region-body background-color="yellow"/>\r
- </fo:simple-page-master>\r
- </fo:layout-master-set>\r
- <fo:page-sequence master-reference="normal" white-space-collapse="true">\r
- <fo:flow flow-name="xsl-region-body">\r
- <fo:block font-size="8pt">This first block is only to force an infinite loop if the image is not scaled down.</fo:block>\r
- <!-- TODO If you remove the above block, the image is placed on the page although it's too big. No warnings. -->\r
- <fo:block>\r
- <fo:external-graphic src="../../resources/images/big-image.png" \r
- inline-progression-dimension.maximum="100%" block-progression-dimension.maximum="100%"\r
- content-width="scale-to-fit" content-height="scale-to-fit" overflow="hidden"/>\r
- </fo:block>\r
- <fo:block>EOF</fo:block>\r
- </fo:flow>\r
- </fo:page-sequence>\r
- </fo:root>\r
- </fo>\r
- <checks>\r
- <eval expected="0 0 595275 841889" xpath="//pageViewport/@bounds"/>\r
- <eval expected="481891" xpath="//regionBody/@ipda"/>\r
- <eval expected="728505" xpath="//regionBody/@bpda"/>\r
- <eval expected="481891" xpath="//flow/block[2]/lineArea/viewport/@ipda"/>\r
- <eval expected="728505" xpath="//flow/block[2]/lineArea/viewport/@bpda + //flow/block[1]/@bpda"/>\r
- </checks>\r
-</testcase>\r
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2005 The Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!-- $Id$ -->
+<testcase>
+ <info>
+ <p>
+ This test checks external-graphics with relative content-height
+ </p>
+ </info>
+ <fo>
+ <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:svg="http://www.w3.org/2000/svg">
+ <fo:layout-master-set>
+ <fo:simple-page-master master-name="normal" page-width="5in" page-height="5in">
+ <fo:region-body/>
+ </fo:simple-page-master>
+ </fo:layout-master-set>
+ <fo:page-sequence master-reference="normal" white-space-collapse="true">
+ <fo:flow flow-name="xsl-region-body">
+ <fo:block>plain external-graphic</fo:block>
+ <fo:block>
+ <fo:external-graphic src="../../resources/images/bgimg300dpi.jpg" content-height="200%" content-width="200%" />EOG
+ </fo:block>
+ <fo:block>EOF</fo:block>
+ </fo:flow>
+ </fo:page-sequence>
+ </fo:root>
+ </fo>
+ <checks>
+ <eval expected="360000" xpath="//flow/block[2]/@ipd"/>
+ <eval expected="92160" xpath="//flow/block[2]/lineArea/viewport/@ipd"/>
+ <eval expected="92160" xpath="//flow/block[2]/lineArea/viewport/@ipda"/>
+ <eval expected="92160" xpath="//flow/block[2]/lineArea/viewport/@bpd"/>
+ <eval expected="92160" xpath="//flow/block[2]/lineArea/viewport/@bpda"/>
+ </checks>
+</testcase>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2005 The Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!-- $Id$ -->
+<testcase>
+ <info>
+ <p>
+ This test checks font stretches.
+ </p>
+ </info>
+ <fo>
+ <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:svg="http://www.w3.org/2000/svg">
+ <fo:layout-master-set>
+ <fo:simple-page-master master-name="normal" page-width="210mm" page-height="297mm">
+ <fo:region-body/>
+ </fo:simple-page-master>
+ </fo:layout-master-set>
+ <fo:page-sequence master-reference="normal" white-space-collapse="true">
+ <fo:flow flow-name="xsl-region-body">
+ <fo:block font-family="serif">font-family="serif" font-stretch not given</fo:block>
+ <fo:block font-family="serif" font-stretch="ultra-condensed">font-family="serif" font-stretch="ultra-condensed"
+ <fo:block font-family="serif" font-stretch="narrower">font-family="serif" font-stretch="narrower"</fo:block>
+ </fo:block>
+ <fo:block font-family="serif" font-stretch="extra-condensed">font-family="serif" font-stretch="extra-condensed"</fo:block>
+ <fo:block font-family="serif" font-stretch="condensed">font-family="serif" font-stretch="condensed"</fo:block>
+ <fo:block font-family="serif" font-stretch="semi-condensed">font-family="serif" font-stretch="semi-condensed"</fo:block>
+ <fo:block font-family="serif" font-stretch="normal">font-family="serif" font-stretch="normal"</fo:block>
+ <fo:block font-family="serif" font-stretch="semi-expanded">font-family="serif" font-stretch="semi-expanded"</fo:block>
+ <fo:block font-family="serif" font-stretch="expanded">font-family="serif" font-stretch="expanded"</fo:block>
+ <fo:block font-family="serif" font-stretch="extra-expanded">font-family="serif" font-stretch="extra-expanded"</fo:block>
+ <fo:block font-family="serif" font-stretch="ultra-expanded">font-family="serif" font-stretch="ultra-expanded"
+ <fo:block font-family="serif" font-stretch="wider">font-family="serif" font-stretch="wider"</fo:block>
+ </fo:block>
+ <fo:block font-family="serif" font-stretch="narrower">font-family="serif" font-stretch="narrower"</fo:block>
+ <fo:block font-family="serif" font-stretch="wider">font-family="serif" font-stretch="wider"</fo:block>
+ </fo:flow>
+ </fo:page-sequence>
+ </fo:root>
+ </fo>
+ <checks>
+ </checks>
+</testcase>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2005 The Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!-- $Id$ -->
+<testcase>
+ <info>
+ <p>
+ This test checks leaders
+ </p>
+ </info>
+ <fo>
+ <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:svg="http://www.w3.org/2000/svg">
+ <fo:layout-master-set>
+ <fo:simple-page-master master-name="normal" page-width="5in" page-height="6in">
+ <fo:region-body/>
+ </fo:simple-page-master>
+ </fo:layout-master-set>
+ <fo:page-sequence master-reference="normal" white-space-collapse="true">
+ <fo:flow flow-name="xsl-region-body">
+ <fo:block margin="0pt" padding-left="10mm">
+ margin="0pt" padding-left="10mm"
+ </fo:block>
+ <fo:block padding-left="10mm">
+ padding-left="10mm"
+ </fo:block>
+ <fo:block>
+ <fo:leader leader-length.minimum="12pt"
+ leader-length.optimum="80pt"
+ leader-length.maximum="100%" leader-pattern="dots" leader-alignment="page"/>
+ leader-alignment="page"
+ </fo:block>
+ <fo:block margin="0pt" padding-left="10mm">
+ <fo:leader leader-length.minimum="12pt"
+ leader-length.optimum="80pt"
+ leader-length.maximum="100%" leader-pattern="dots" leader-alignment="page"/>
+ leader-alignment="page"
+ </fo:block>
+ <fo:block margin="0pt" padding-left="5mm">
+ <fo:leader leader-length.minimum="12pt"
+ leader-length.optimum="80pt"
+ leader-length.maximum="100%" leader-pattern="dots" leader-alignment="reference-area"/>
+ leader-alignment="reference-area"
+ <fo:leader leader-length.minimum="12pt"
+ leader-length.optimum="80pt"
+ leader-length.maximum="100%" leader-pattern="dots" leader-alignment="reference-area"/>
+ leader-alignment="reference-area" Leader-pattern is aligned as if it began on the current reference-area's content-rectangle start-edge.
+ </fo:block>
+ </fo:flow>
+ </fo:page-sequence>
+ </fo:root>
+ </fo>
+ <checks>
+ </checks>
+</testcase>
<fo:leader leader-pattern="dots" leader-length="20mm" leader-pattern-width="5mm"/>
leader-length="20mm" leader-pattern-width="5mm"
</fo:block>
+ <fo:block>
+ <fo:leader leader-pattern="dots" leader-length="20%" leader-pattern-width="5mm"/>
+ leader-length="20%" leader-pattern-width="5mm"
+ </fo:block>
<fo:block>
<fo:leader leader-pattern="dots" leader-pattern-width="1pt"/>
leader-pattern-width="1pt"
</fo:block>
<fo:block>
- <fo:leader leader-pattern="dots" leader-pattern-width="5%"/>
- leader-pattern-width="5%"
+ <fo:leader leader-pattern="dots" leader-length="20%" leader-pattern-width="5%"/>
+ leader-length="20%" leader-pattern-width="5%"
</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
</fo>
<checks>
+ <eval expected="14400" xpath="//flow/block[1]/lineArea/@bpd"/>
+ <eval expected="360000" xpath="//flow/block[1]/lineArea/@ipd"/>
+ <eval expected="12000" xpath="//flow/block[1]/lineArea/inlineparent/@ipd"/>
+ <eval expected="3" xpath="count(//flow/block[1]/lineArea/inlineparent/text)"/>
+ <eval expected="14400" xpath="//flow/block[2]/lineArea/@bpd"/>
+ <eval expected="360000" xpath="//flow/block[2]/lineArea/@ipd"/>
+ <eval expected="12000" xpath="//flow/block[2]/lineArea/inlineparent/@ipd"/>
+ <eval expected="3" xpath="count(//flow/block[2]/lineArea/inlineparent/text)"/>
+ <eval expected="14400" xpath="//flow/block[3]/lineArea/@bpd"/>
+ <eval expected="360000" xpath="//flow/block[3]/lineArea/@ipd"/>
+ <eval expected="56692" xpath="//flow/block[3]/lineArea/inlineparent/@ipd"/>
+ <eval expected="4" xpath="count(//flow/block[3]/lineArea/inlineparent/text)"/>
+ <eval expected="4" xpath="count(//flow/block[3]/lineArea/inlineparent/space)"/>
+ <eval expected="14400" xpath="//flow/block[4]/lineArea/@bpd"/>
+ <eval expected="360000" xpath="//flow/block[4]/lineArea/@ipd"/>
+ <eval expected="72000" xpath="//flow/block[4]/lineArea/inlineparent/@ipd"/>
+ <eval expected="5" xpath="count(//flow/block[4]/lineArea/inlineparent/text)"/>
+ <eval expected="5" xpath="count(//flow/block[4]/lineArea/inlineparent/space)"/>
+ <eval expected="14400" xpath="//flow/block[5]/lineArea/@bpd"/>
+ <eval expected="360000" xpath="//flow/block[5]/lineArea/@ipd"/>
+ <eval expected="12000" xpath="//flow/block[5]/lineArea/inlineparent/@ipd"/>
+ <eval expected="3" xpath="count(//flow/block[5]/lineArea/inlineparent/text)"/>
+ <eval expected="14400" xpath="//flow/block[6]/lineArea/@bpd"/>
+ <eval expected="360000" xpath="//flow/block[6]/lineArea/@ipd"/>
+ <eval expected="72000" xpath="//flow/block[6]/lineArea/inlineparent/@ipd"/>
+ <eval expected="4" xpath="count(//flow/block[6]/lineArea/inlineparent/text)"/>
+ <eval expected="4" xpath="count(//flow/block[6]/lineArea/inlineparent/space)"/>
</checks>
</testcase>
</fo:root>
</fo>
<checks>
+ <eval expected="14400" xpath="//flow/block[1]/lineArea/@bpd"/>
+ <eval expected="360000" xpath="//flow/block[1]/lineArea/@ipd"/>
+ <eval expected="12000" xpath="//flow/block[1]/lineArea/leader/@ipd"/>
+ <eval expected="solid" xpath="//flow/block[1]/lineArea/leader/@ruleStyle"/>
+ <eval expected="1000" xpath="//flow/block[1]/lineArea/leader/@ruleThickness"/>
+ <eval expected="14400" xpath="//flow/block[2]/lineArea/@bpd"/>
+ <eval expected="360000" xpath="//flow/block[2]/lineArea/@ipd"/>
+ <eval expected="12000" xpath="//flow/block[2]/lineArea/leader/@ipd"/>
+ <eval expected="--NYI--" xpath="//flow/block[2]/lineArea/leader/@ruleStyle"/>
+ <eval expected="1000" xpath="//flow/block[2]/lineArea/leader/@ruleThickness"/>
+ <eval expected="14400" xpath="//flow/block[3]/lineArea/@bpd"/>
+ <eval expected="360000" xpath="//flow/block[3]/lineArea/@ipd"/>
+ <eval expected="12000" xpath="//flow/block[3]/lineArea/leader/@ipd"/>
+ <eval expected="dotted" xpath="//flow/block[3]/lineArea/leader/@ruleStyle"/>
+ <eval expected="1000" xpath="//flow/block[3]/lineArea/leader/@ruleThickness"/>
+ <eval expected="14400" xpath="//flow/block[4]/lineArea/@bpd"/>
+ <eval expected="360000" xpath="//flow/block[4]/lineArea/@ipd"/>
+ <eval expected="12000" xpath="//flow/block[4]/lineArea/leader/@ipd"/>
+ <eval expected="dashed" xpath="//flow/block[4]/lineArea/leader/@ruleStyle"/>
+ <eval expected="1000" xpath="//flow/block[4]/lineArea/leader/@ruleThickness"/>
+ <eval expected="14400" xpath="//flow/block[5]/lineArea/@bpd"/>
+ <eval expected="360000" xpath="//flow/block[5]/lineArea/@ipd"/>
+ <eval expected="12000" xpath="//flow/block[5]/lineArea/leader/@ipd"/>
+ <eval expected="solid" xpath="//flow/block[5]/lineArea/leader/@ruleStyle"/>
+ <eval expected="1000" xpath="//flow/block[5]/lineArea/leader/@ruleThickness"/>
+ <eval expected="14400" xpath="//flow/block[6]/lineArea/@bpd"/>
+ <eval expected="360000" xpath="//flow/block[6]/lineArea/@ipd"/>
+ <eval expected="12000" xpath="//flow/block[6]/lineArea/leader/@ipd"/>
+ <eval expected="double" xpath="//flow/block[6]/lineArea/leader/@ruleStyle"/>
+ <eval expected="1000" xpath="//flow/block[6]/lineArea/leader/@ruleThickness"/>
+ <eval expected="14400" xpath="//flow/block[7]/lineArea/@bpd"/>
+ <eval expected="360000" xpath="//flow/block[7]/lineArea/@ipd"/>
+ <eval expected="12000" xpath="//flow/block[7]/lineArea/leader/@ipd"/>
+ <eval expected="groove" xpath="//flow/block[7]/lineArea/leader/@ruleStyle"/>
+ <eval expected="1000" xpath="//flow/block[7]/lineArea/leader/@ruleThickness"/>
+ <eval expected="14400" xpath="//flow/block[8]/lineArea/@bpd"/>
+ <eval expected="360000" xpath="//flow/block[8]/lineArea/@ipd"/>
+ <eval expected="12000" xpath="//flow/block[8]/lineArea/leader/@ipd"/>
+ <eval expected="ridge" xpath="//flow/block[8]/lineArea/leader/@ruleStyle"/>
+ <eval expected="1000" xpath="//flow/block[8]/lineArea/leader/@ruleThickness"/>
+ <eval expected="14400" xpath="//flow/block[9]/lineArea/@bpd"/>
+ <eval expected="360000" xpath="//flow/block[9]/lineArea/@ipd"/>
+ <eval expected="12000" xpath="//flow/block[9]/lineArea/leader/@ipd"/>
+ <eval expected="dotted" xpath="//flow/block[9]/lineArea/leader/@ruleStyle"/>
+ <eval expected="3000" xpath="//flow/block[9]/lineArea/leader/@ruleThickness"/>
+ <eval expected="14400" xpath="//flow/block[10]/lineArea/@bpd"/>
+ <eval expected="360000" xpath="//flow/block[10]/lineArea/@ipd"/>
+ <eval expected="12000" xpath="//flow/block[10]/lineArea/leader/@ipd"/>
+ <eval expected="dashed" xpath="//flow/block[10]/lineArea/leader/@ruleStyle"/>
+ <eval expected="3000" xpath="//flow/block[10]/lineArea/leader/@ruleThickness"/>
+ <eval expected="14400" xpath="//flow/block[11]/lineArea/@bpd"/>
+ <eval expected="360000" xpath="//flow/block[11]/lineArea/@ipd"/>
+ <eval expected="12000" xpath="//flow/block[11]/lineArea/leader/@ipd"/>
+ <eval expected="solid" xpath="//flow/block[11]/lineArea/leader/@ruleStyle"/>
+ <eval expected="3000" xpath="//flow/block[11]/lineArea/leader/@ruleThickness"/>
+ <eval expected="14400" xpath="//flow/block[12]/lineArea/@bpd"/>
+ <eval expected="360000" xpath="//flow/block[12]/lineArea/@ipd"/>
+ <eval expected="12000" xpath="//flow/block[12]/lineArea/leader/@ipd"/>
+ <eval expected="double" xpath="//flow/block[12]/lineArea/leader/@ruleStyle"/>
+ <eval expected="3000" xpath="//flow/block[12]/lineArea/leader/@ruleThickness"/>
+ <eval expected="14400" xpath="//flow/block[13]/lineArea/@bpd"/>
+ <eval expected="360000" xpath="//flow/block[13]/lineArea/@ipd"/>
+ <eval expected="12000" xpath="//flow/block[13]/lineArea/leader/@ipd"/>
+ <eval expected="groove" xpath="//flow/block[13]/lineArea/leader/@ruleStyle"/>
+ <eval expected="3000" xpath="//flow/block[13]/lineArea/leader/@ruleThickness"/>
+ <eval expected="14400" xpath="//flow/block[14]/lineArea/@bpd"/>
+ <eval expected="360000" xpath="//flow/block[14]/lineArea/@ipd"/>
+ <eval expected="12000" xpath="//flow/block[14]/lineArea/leader/@ipd"/>
+ <eval expected="ridge" xpath="//flow/block[14]/lineArea/leader/@ruleStyle"/>
+ <eval expected="3000" xpath="//flow/block[14]/lineArea/leader/@ruleThickness"/>
+ <!-- No checks for the "alignment-baseline=..." section as this property is currently
+ not supported -->
</checks>
</testcase>
Default space pattern
</fo:block>
<fo:block>
- <fo:leader leader-pattern="space" leader-pattern-width="use-font-metrics"/>
- leader-pattern-width="use-font-metrics"
+ <fo:leader leader-pattern="space" leader-length="0.5in"/>
+ leader-length="0.5in"
</fo:block>
<fo:block>
- <fo:leader leader-pattern="space" leader-length="20mm" leader-pattern-width="5mm"/>
- leader-length="20mm" leader-pattern-width="5mm"
- </fo:block>
- <fo:block>
- <fo:leader leader-pattern="space" leader-pattern-width="1pt"/>
- leader-pattern-width="1pt"
- </fo:block>
- <fo:block>
- <fo:leader leader-pattern="space" leader-pattern-width="5%"/>
- leader-pattern-width="5%"
+ <fo:leader leader-pattern="space" leader-length="5%"/>
+ leader-length="5%"
</fo:block>
</fo:flow>
</fo:page-sequence>
</fo:root>
</fo>
<checks>
+ <eval expected="14400" xpath="//flow/block[1]/lineArea/@bpd"/>
+ <eval expected="360000" xpath="//flow/block[1]/lineArea/@ipd"/>
+ <eval expected="12000" xpath="//flow/block[1]/lineArea/space/@ipd"/>
+ <eval expected="14400" xpath="//flow/block[2]/lineArea/@bpd"/>
+ <eval expected="360000" xpath="//flow/block[2]/lineArea/@ipd"/>
+ <eval expected="36000" xpath="//flow/block[2]/lineArea/space/@ipd"/>
+ <eval expected="14400" xpath="//flow/block[3]/lineArea/@bpd"/>
+ <eval expected="360000" xpath="//flow/block[3]/lineArea/@ipd"/>
+ <eval expected="18000" xpath="//flow/block[3]/lineArea/space/@ipd"/>
</checks>
</testcase>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2005 The Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!-- $Id$ -->
+<testcase>
+ <info>
+ <p>
+ This test checks leaders with leader-pattern="use-content"
+ </p>
+ </info>
+ <fo>
+ <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:svg="http://www.w3.org/2000/svg">
+ <fo:layout-master-set>
+ <fo:simple-page-master master-name="normal" page-width="5in" page-height="5in">
+ <fo:region-body/>
+ </fo:simple-page-master>
+ </fo:layout-master-set>
+ <fo:page-sequence master-reference="normal" white-space-collapse="true">
+ <fo:flow flow-name="xsl-region-body">
+ <fo:block>
+ <fo:leader leader-pattern="use-content"/>
+ Default dots pattern
+ </fo:block>
+ <fo:block>
+ <fo:leader leader-pattern="use-content" leader-pattern-width="use-font-metrics"/>
+ leader-pattern-width="use-font-metrics"
+ </fo:block>
+ <fo:block>
+ <fo:leader leader-pattern="use-content" leader-length="20mm" leader-pattern-width="5mm"/>
+ leader-length="20mm" leader-pattern-width="5mm"
+ </fo:block>
+ <fo:block>
+ <fo:leader leader-pattern="use-content" leader-pattern-width="1pt"/>
+ leader-pattern-width="1pt"
+ </fo:block>
+ <fo:block>
+ <fo:leader leader-pattern="use-content" leader-pattern-width="5%"/>
+ leader-pattern-width="5%"
+ </fo:block>
+ </fo:flow>
+ </fo:page-sequence>
+ </fo:root>
+ </fo>
+ <checks>
+ </checks>
+</testcase>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2005 The Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!-- $Id$ -->
+<testcase>
+ <info>
+ <p>
+ This test checks line height and its special inheritance behaviour
+ </p>
+ </info>
+ <fo>
+ <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:svg="http://www.w3.org/2000/svg">
+ <fo:layout-master-set>
+ <fo:simple-page-master master-name="normal" page-width="5in" page-height="5in">
+ <fo:region-body/>
+ </fo:simple-page-master>
+ </fo:layout-master-set>
+ <fo:page-sequence master-reference="normal" white-space-collapse="true">
+ <fo:flow flow-name="xsl-region-body">
+ <fo:block line-height="normal" background-color="yellow">line-height="normal"
+ <fo:block font-size="larger" margin-left="10pt" background-color="blue">font-size="larger" - line height grows</fo:block>
+ <fo:block font-size="smaller" margin-left="10pt" background-color="red">font-size="smaller" - line height shrinks</fo:block>
+ </fo:block>
+ <fo:block line-height="150%" background-color="yellow">line-height="150%"
+ <fo:block font-size="larger" margin-left="10pt" background-color="blue">font-size="larger" - line height same as above</fo:block>
+ <fo:block font-size="smaller" margin-left="10pt" background-color="red">font-size="smaller" - line height same as above</fo:block>
+ </fo:block>
+ <fo:block line-height="20pt" background-color="yellow">line-height="20pt"
+ <fo:block font-size="larger" margin-left="10pt" background-color="blue">font-size="larger" - line height same as above</fo:block>
+ <fo:block font-size="smaller" margin-left="10pt" background-color="red">font-size="smaller" - line height same as above</fo:block>
+ </fo:block>
+ <fo:block line-height="1.5" background-color="yellow">line-height="1.5"
+ <fo:block font-size="larger" margin-left="10pt" background-color="blue">font-size="larger" - line height grows</fo:block>
+ <fo:block font-size="smaller" margin-left="10pt" background-color="red">font-size="smaller" - line height shrinks</fo:block>
+ </fo:block>
+ <fo:block line-height="150% - 5pt" background-color="yellow">line-height="150% - 5pt"
+ <fo:block font-size="larger" margin-left="10pt" background-color="blue">font-size="larger" - line height same as above</fo:block>
+ <fo:block font-size="smaller" margin-left="10pt" background-color="red">font-size="smaller" - line height same as above</fo:block>
+ </fo:block>
+ </fo:flow>
+ </fo:page-sequence>
+ </fo:root>
+ </fo>
+ <checks>
+ <eval expected="14400" xpath="//flow/block[1]/lineArea/@bpd"/>
+ <eval expected="17280" xpath="//flow/block[1]/block[1]/lineArea/@bpd"/>
+ <eval expected="12000" xpath="//flow/block[1]/block[2]/lineArea/@bpd"/>
+ <eval expected="18000" xpath="//flow/block[2]/lineArea/@bpd"/>
+ <eval expected="18000" xpath="//flow/block[2]/block[1]/lineArea/@bpd"/>
+ <eval expected="18000" xpath="//flow/block[2]/block[2]/lineArea/@bpd"/>
+ <eval expected="20000" xpath="//flow/block[3]/lineArea/@bpd"/>
+ <eval expected="20000" xpath="//flow/block[3]/block[1]/lineArea/@bpd"/>
+ <eval expected="20000" xpath="//flow/block[3]/block[2]/lineArea/@bpd"/>
+ <eval expected="18000" xpath="//flow/block[4]/lineArea/@bpd"/>
+ <eval expected="21600" xpath="//flow/block[4]/block[1]/lineArea/@bpd"/>
+ <eval expected="15000" xpath="//flow/block[4]/block[2]/lineArea/@bpd"/>
+ <eval expected="13000" xpath="//flow/block[5]/lineArea/@bpd"/>
+ <eval expected="13000" xpath="//flow/block[5]/block[1]/lineArea/@bpd"/>
+ <eval expected="13000" xpath="//flow/block[5]/block[2]/lineArea/@bpd"/>
+ </checks>
+</testcase>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2005 The Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!-- $Id$ -->
+<testcase>
+ <info>
+ <p>
+ This test checks margin percentages on fo:block.
+ </p>
+ </info>
+ <fo>
+ <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:svg="http://www.w3.org/2000/svg">
+ <fo:layout-master-set>
+ <fo:simple-page-master master-name="normal" page-width="5in" page-height="5in">
+ <fo:region-body/>
+ </fo:simple-page-master>
+ </fo:layout-master-set>
+ <fo:page-sequence master-reference="normal" white-space-collapse="true">
+ <fo:flow flow-name="xsl-region-body">
+ <fo:block margin="5%" background-color="yellow">
+ <fo:block margin="5%" background-color="blue">
+ margin="5%" - should have the slightly smaller margin than the enclosing block
+ </fo:block>
+ </fo:block>
+ <fo:block>Yellow block has margin="5%" - 18pt margin based on 5in page width</fo:block>
+ </fo:flow>
+ </fo:page-sequence>
+ </fo:root>
+ </fo>
+ <checks>
+ <eval expected="0" xpath="//flow/block[1]/@ipd"/>
+ <eval expected="18000" xpath="//flow/block[1]/@bpd"/>
+ <eval expected="324000" xpath="//flow/block[2]/@ipd"/>
+ <eval expected="18000" xpath="//flow/block[2]/@start-indent"/>
+ <eval expected="18000" xpath="//flow/block[2]/@end-indent"/>
+ <eval expected="18000" xpath="//flow/block[2]/@space-start"/>
+ <eval expected="18000" xpath="//flow/block[2]/@space-end"/>
+ <eval expected="0" xpath="//flow/block[2]/block[1]/@ipd"/>
+ <eval expected="16200" xpath="//flow/block[2]/block[1]/@bpd"/>
+ <eval expected="291600" xpath="//flow/block[2]/block[2]/@ipd"/>
+ <eval expected="34200" xpath="//flow/block[2]/block[2]/@start-indent"/>
+ <eval expected="34200" xpath="//flow/block[2]/block[2]/@end-indent"/>
+ <eval expected="34200" xpath="//flow/block[2]/block[2]/@space-start"/>
+ <eval expected="34200" xpath="//flow/block[2]/block[2]/@space-end"/>
+ <eval expected="0" xpath="//flow/block[2]/block[3]/@ipd"/>
+ <eval expected="16200" xpath="//flow/block[2]/block[3]/@bpd"/>
+ <eval expected="0" xpath="//flow/block[3]/@ipd"/>
+ <eval expected="18000" xpath="//flow/block[3]/@bpd"/>
+ </checks>
+</testcase>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2005 The Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!-- $Id$ -->
+<testcase>
+ <info>
+ <p>
+ This test checks margin percentages on fo:block with explict inheritance.
+ </p>
+ </info>
+ <fo>
+ <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:svg="http://www.w3.org/2000/svg">
+ <fo:layout-master-set>
+ <fo:simple-page-master master-name="normal" page-width="5in" page-height="5in">
+ <fo:region-body/>
+ </fo:simple-page-master>
+ </fo:layout-master-set>
+ <fo:page-sequence master-reference="normal" white-space-collapse="true">
+ <fo:flow flow-name="xsl-region-body">
+ <fo:block margin="5%" background-color="yellow">
+ <fo:block margin="inherit" background-color="blue">
+ margin="inherit" - should have the same margin as the enclosing block
+ </fo:block>
+ </fo:block>
+ <fo:block>Yellow block has margin="5%" - 18pt margin based on 5in page width</fo:block>
+ </fo:flow>
+ </fo:page-sequence>
+ </fo:root>
+ </fo>
+ <checks>
+ <eval expected="0" xpath="//flow/block[1]/@ipd"/>
+ <eval expected="18000" xpath="//flow/block[1]/@bpd"/>
+ <eval expected="324000" xpath="//flow/block[2]/@ipd"/>
+ <eval expected="18000" xpath="//flow/block[2]/@start-indent"/>
+ <eval expected="18000" xpath="//flow/block[2]/@end-indent"/>
+ <eval expected="18000" xpath="//flow/block[2]/@space-start"/>
+ <eval expected="18000" xpath="//flow/block[2]/@space-end"/>
+ <eval expected="0" xpath="//flow/block[2]/block[1]/@ipd"/>
+ <eval expected="18000" xpath="//flow/block[2]/block[1]/@bpd"/>
+ <eval expected="288000" xpath="//flow/block[2]/block[2]/@ipd"/>
+ <eval expected="36000" xpath="//flow/block[2]/block[2]/@start-indent"/>
+ <eval expected="36000" xpath="//flow/block[2]/block[2]/@end-indent"/>
+ <eval expected="36000" xpath="//flow/block[2]/block[2]/@space-start"/>
+ <eval expected="36000" xpath="//flow/block[2]/block[2]/@space-end"/>
+ <eval expected="0" xpath="//flow/block[2]/block[3]/@ipd"/>
+ <eval expected="18000" xpath="//flow/block[2]/block[3]/@bpd"/>
+ <eval expected="0" xpath="//flow/block[3]/@ipd"/>
+ <eval expected="18000" xpath="//flow/block[3]/@bpd"/>
+ </checks>
+</testcase>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2005 The Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!-- $Id$ -->
+<testcase>
+ <info>
+ <p>
+ This test checks relative margin on region (region-body).
+ </p>
+ </info>
+ <variables>
+ <img>../../resources/images/bgimg300dpi.jpg</img>
+ </variables>
+ <fo>
+ <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:svg="http://www.w3.org/2000/svg">
+ <fo:layout-master-set>
+ <fo:simple-page-master master-name="normal" page-width="3in" page-height="5in" margin="5%">
+ <fo:region-body margin="5%" background-color="yellow" />
+ <fo:region-before extent="5%" background-color="blue" precedence="true" />
+ <fo:region-after extent="5%" background-color="green" precedence="true" />
+ <fo:region-start extent="5%" background-color="red" />
+ <fo:region-end extent="5%" background-color="orange" />
+ </fo:simple-page-master>
+ </fo:layout-master-set>
+ <fo:page-sequence master-reference="normal" white-space-collapse="true">
+ <fo:static-content flow-name="xsl-region-before">
+ <fo:block>
+ r e g i o n b e f o r e
+ </fo:block>
+ </fo:static-content>
+ <fo:static-content flow-name="xsl-region-after">
+ <fo:block>
+ r e g i o n a f t e r
+ </fo:block>
+ </fo:static-content>
+ <fo:static-content flow-name="xsl-region-start">
+ <fo:block>
+ r e g i o n s t a r t
+ </fo:block>
+ </fo:static-content>
+ <fo:static-content flow-name="xsl-region-end">
+ <fo:block>
+ r e g i o n e n d
+ </fo:block>
+ </fo:static-content>
+ <fo:flow flow-name="xsl-region-body">
+ <fo:block>
+ Demonstrates relative 5% margins on all regions and the page master.
+ The page size is 5in x 3in. This gives top and bottom margins of 0.25in and
+ left and right margins 0.15in.
+ </fo:block>
+ </fo:flow>
+ </fo:page-sequence>
+ </fo:root>
+ </fo>
+ <checks>
+ <!-- region before -->
+ <eval expected="color=#0000ff" xpath="//page/regionViewport[1]/@background"/>
+ <eval expected="194400" xpath="//page/regionViewport[1]/@ipd"/>
+ <eval expected="18000" xpath="//page/regionViewport[1]/@bpd"/>
+ <eval expected="10800 18000 194400 18000" xpath="//page/regionViewport[1]/@rect"/>
+ <eval expected="194400" xpath="//page/regionViewport[1]/regionBefore/@ipd"/>
+ <eval expected="18000" xpath="//page/regionViewport[1]/regionBefore/@bpd"/>
+ <!-- region start -->
+ <eval expected="color=#ff0000" xpath="//page/regionViewport[2]/@background"/>
+ <eval expected="10800" xpath="//page/regionViewport[2]/@ipd"/>
+ <eval expected="288000" xpath="//page/regionViewport[2]/@bpd"/>
+ <eval expected="10800 36000 10800 288000" xpath="//page/regionViewport[2]/@rect"/>
+ <eval expected="10800" xpath="//page/regionViewport[2]/regionStart/@ipd"/>
+ <eval expected="288000" xpath="//page/regionViewport[2]/regionStart/@bpd"/>
+ <!-- region end -->
+ <eval expected="color=#ffa500" xpath="//page/regionViewport[3]/@background"/>
+ <eval expected="10800" xpath="//page/regionViewport[3]/@ipd"/>
+ <eval expected="288000" xpath="//page/regionViewport[3]/@bpd"/>
+ <eval expected="194400 36000 10800 288000" xpath="//page/regionViewport[3]/@rect"/>
+ <eval expected="10800" xpath="//page/regionViewport[3]/regionEnd/@ipd"/>
+ <eval expected="288000" xpath="//page/regionViewport[3]/regionEnd/@bpd"/>
+ <!-- region after -->
+ <eval expected="color=#008000" xpath="//page/regionViewport[4]/@background"/>
+ <eval expected="194400" xpath="//page/regionViewport[4]/@ipd"/>
+ <eval expected="18000" xpath="//page/regionViewport[4]/@bpd"/>
+ <eval expected="10800 324000 194400 18000" xpath="//page/regionViewport[4]/@rect"/>
+ <eval expected="194400" xpath="//page/regionViewport[4]/regionAfter/@ipd"/>
+ <eval expected="18000" xpath="//page/regionViewport[4]/regionAfter/@bpd"/>
+ <!-- region body -->
+ <eval expected="color=#ffff00" xpath="//page/regionViewport[5]/@background"/>
+ <eval expected="172800" xpath="//page/regionViewport[5]/@ipd"/>
+ <eval expected="288000" xpath="//page/regionViewport[5]/@bpd"/>
+ <eval expected="21600 36000 172800 288000" xpath="//page/regionViewport[5]/@rect"/>
+ <eval expected="172800" xpath="//page/regionViewport[5]/regionBody/@ipd"/>
+ <eval expected="288000" xpath="//page/regionViewport[5]/regionBody/@bpd"/>
+ </checks>
+</testcase>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2005 The Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!-- $Id$ -->
+<testcase>
+ <info>
+ <p>
+ This test checks relative margin on region (region-body).
+ </p>
+ </info>
+ <variables>
+ <img>../../resources/images/bgimg300dpi.jpg</img>
+ </variables>
+ <fo>
+ <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:svg="http://www.w3.org/2000/svg">
+ <fo:layout-master-set>
+ <fo:simple-page-master master-name="normal" page-width="3in" page-height="5in" margin="5%" reference-orientation="90">
+ <fo:region-body margin="5%" background-color="yellow" />
+ <fo:region-before extent="5%" background-color="blue" precedence="true" />
+ <fo:region-after extent="5%" background-color="green" precedence="true" />
+ <fo:region-start extent="5%" background-color="red" />
+ <fo:region-end extent="5%" background-color="orange" />
+ </fo:simple-page-master>
+ </fo:layout-master-set>
+ <fo:page-sequence master-reference="normal" white-space-collapse="true">
+ <fo:static-content flow-name="xsl-region-before">
+ <fo:block>
+ r e g i o n b e f o r e
+ </fo:block>
+ </fo:static-content>
+ <fo:static-content flow-name="xsl-region-after">
+ <fo:block>
+ r e g i o n a f t e r
+ </fo:block>
+ </fo:static-content>
+ <fo:static-content flow-name="xsl-region-start">
+ <fo:block>
+ r e g i o n s t a r t
+ </fo:block>
+ </fo:static-content>
+ <fo:static-content flow-name="xsl-region-end">
+ <fo:block>
+ r e g i o n e n d
+ </fo:block>
+ </fo:static-content>
+ <fo:flow flow-name="xsl-region-body">
+ <fo:block>
+ Demonstrates relative 5% margins on all regions and the page master with a
+ landscape reference orientation.
+ The page size is 5in x 3in. This gives top and bottom margins of 0.25in and
+ left and right margins 0.15in.
+ </fo:block>
+ </fo:flow>
+ </fo:page-sequence>
+ </fo:root>
+ </fo>
+ <checks>
+ <!-- region before -->
+ <eval expected="color=#0000ff" xpath="//page/regionViewport[1]/@background"/>
+ <eval expected="324000" xpath="//page/regionViewport[1]/@ipd"/>
+ <eval expected="18000" xpath="//page/regionViewport[1]/@bpd"/>
+ <eval expected="10800 18000 18000 324000" xpath="//page/regionViewport[1]/@rect"/>
+ <eval expected="324000" xpath="//page/regionViewport[1]/regionBefore/@ipd"/>
+ <eval expected="18000" xpath="//page/regionViewport[1]/regionBefore/@bpd"/>
+ <!-- region start -->
+ <eval expected="color=#ff0000" xpath="//page/regionViewport[2]/@background"/>
+ <eval expected="10800" xpath="//page/regionViewport[2]/@ipd"/>
+ <eval expected="158400" xpath="//page/regionViewport[2]/@bpd"/>
+ <eval expected="28800 331200 158400 10800" xpath="//page/regionViewport[2]/@rect"/>
+ <eval expected="10800" xpath="//page/regionViewport[2]/regionStart/@ipd"/>
+ <eval expected="158400" xpath="//page/regionViewport[2]/regionStart/@bpd"/>
+ <!-- region end -->
+ <eval expected="color=#ffa500" xpath="//page/regionViewport[3]/@background"/>
+ <eval expected="10800" xpath="//page/regionViewport[3]/@ipd"/>
+ <eval expected="158400" xpath="//page/regionViewport[3]/@bpd"/>
+ <eval expected="28800 18000 158400 10800" xpath="//page/regionViewport[3]/@rect"/>
+ <eval expected="10800" xpath="//page/regionViewport[3]/regionEnd/@ipd"/>
+ <eval expected="158400" xpath="//page/regionViewport[3]/regionEnd/@bpd"/>
+ <!-- region after -->
+ <eval expected="color=#008000" xpath="//page/regionViewport[4]/@background"/>
+ <eval expected="324000" xpath="//page/regionViewport[4]/@ipd"/>
+ <eval expected="18000" xpath="//page/regionViewport[4]/@bpd"/>
+ <eval expected="187200 18000 18000 324000" xpath="//page/regionViewport[4]/@rect"/>
+ <eval expected="324000" xpath="//page/regionViewport[4]/regionAfter/@ipd"/>
+ <eval expected="18000" xpath="//page/regionViewport[4]/regionAfter/@bpd"/>
+ <!-- region body -->
+ <eval expected="color=#ffff00" xpath="//page/regionViewport[5]/@background"/>
+ <eval expected="302400" xpath="//page/regionViewport[5]/@ipd"/>
+ <eval expected="158400" xpath="//page/regionViewport[5]/@bpd"/>
+ <eval expected="28800 28800 158400 302400" xpath="//page/regionViewport[5]/@rect"/>
+ <eval expected="302400" xpath="//page/regionViewport[5]/regionBody/@ipd"/>
+ <eval expected="158400" xpath="//page/regionViewport[5]/regionBody/@bpd"/>
+ </checks>
+</testcase>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2005 The Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!-- $Id$ -->
+<testcase>
+ <info>
+ <p>
+ This test checks relative margin on regions (region-body).
+ </p>
+ </info>
+ <variables>
+ <img>../../resources/images/bgimg300dpi.jpg</img>
+ </variables>
+ <fo>
+ <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:svg="http://www.w3.org/2000/svg">
+ <fo:layout-master-set>
+ <fo:simple-page-master master-name="normal" page-width="3in" page-height="5in" margin="5%" writing-mode="rl">
+ <fo:region-body margin-top="5%" margin-bottom="5%" margin-left="5%" margin-right="10%" background-color="yellow" />
+ <fo:region-before extent="5%" background-color="blue" precedence="true" />
+ <fo:region-after extent="5%" background-color="green" precedence="true" />
+ <fo:region-start extent="10%" background-color="red" />
+ <fo:region-end extent="5%" background-color="orange" />
+ </fo:simple-page-master>
+ </fo:layout-master-set>
+ <fo:page-sequence master-reference="normal" white-space-collapse="true">
+ <fo:static-content flow-name="xsl-region-before">
+ <fo:block>
+ r e g i o n b e f o r e
+ </fo:block>
+ </fo:static-content>
+ <fo:static-content flow-name="xsl-region-after">
+ <fo:block>
+ r e g i o n a f t e r
+ </fo:block>
+ </fo:static-content>
+ <fo:static-content flow-name="xsl-region-start">
+ <fo:block>
+ r e g i o n s t a r t
+ </fo:block>
+ </fo:static-content>
+ <fo:static-content flow-name="xsl-region-end">
+ <fo:block>
+ r e g i o n e n d
+ </fo:block>
+ </fo:static-content>
+ <fo:flow flow-name="xsl-region-body">
+ <fo:block>
+ Demonstrates relative 5% margins on all regions and the page master.
+ The page size is 5in x 3in. This gives top and bottom margins of 0.25in and
+ left and right margins 0.15in.
+ </fo:block>
+ </fo:flow>
+ </fo:page-sequence>
+ </fo:root>
+ </fo>
+ <checks>
+ <!-- The values in these checks are currently not correct. However, there is also a bug
+ in the rl writing mode causing a swap of left and right margin. Both should be fixed at
+ the same time. -->
+ <!-- region before -->
+ <eval expected="color=#0000ff" xpath="//page/regionViewport[1]/@background"/>
+ <eval expected="194400" xpath="//page/regionViewport[1]/@ipd"/>
+ <eval expected="18000" xpath="//page/regionViewport[1]/@bpd"/>
+ <eval expected="10800 18000 194400 18000" xpath="//page/regionViewport[1]/@rect"/>
+ <eval expected="194400" xpath="//page/regionViewport[1]/regionBefore/@ipd"/>
+ <eval expected="18000" xpath="//page/regionViewport[1]/regionBefore/@bpd"/>
+ <!-- region start -->
+ <eval expected="color=#ff0000" xpath="//page/regionViewport[2]/@background"/>
+ <eval expected="10800" xpath="//page/regionViewport[2]/@ipd"/>
+ <eval expected="288000" xpath="//page/regionViewport[2]/@bpd"/>
+ <eval expected="10800 36000 10800 288000" xpath="//page/regionViewport[2]/@rect"/>
+ <eval expected="10800" xpath="//page/regionViewport[2]/regionStart/@ipd"/>
+ <eval expected="288000" xpath="//page/regionViewport[2]/regionStart/@bpd"/>
+ <!-- region end -->
+ <eval expected="color=#ffa500" xpath="//page/regionViewport[3]/@background"/>
+ <eval expected="10800" xpath="//page/regionViewport[3]/@ipd"/>
+ <eval expected="288000" xpath="//page/regionViewport[3]/@bpd"/>
+ <eval expected="194400 36000 10800 288000" xpath="//page/regionViewport[3]/@rect"/>
+ <eval expected="10800" xpath="//page/regionViewport[3]/regionEnd/@ipd"/>
+ <eval expected="288000" xpath="//page/regionViewport[3]/regionEnd/@bpd"/>
+ <!-- region after -->
+ <eval expected="color=#008000" xpath="//page/regionViewport[4]/@background"/>
+ <eval expected="194400" xpath="//page/regionViewport[4]/@ipd"/>
+ <eval expected="18000" xpath="//page/regionViewport[4]/@bpd"/>
+ <eval expected="10800 324000 194400 18000" xpath="//page/regionViewport[4]/@rect"/>
+ <eval expected="194400" xpath="//page/regionViewport[4]/regionAfter/@ipd"/>
+ <eval expected="18000" xpath="//page/regionViewport[4]/regionAfter/@bpd"/>
+ <!-- region body -->
+ <eval expected="color=#ffff00" xpath="//page/regionViewport[5]/@background"/>
+ <eval expected="172800" xpath="//page/regionViewport[5]/@ipd"/>
+ <eval expected="288000" xpath="//page/regionViewport[5]/@bpd"/>
+ <eval expected="21600 36000 172800 288000" xpath="//page/regionViewport[5]/@rect"/>
+ <eval expected="172800" xpath="//page/regionViewport[5]/regionBody/@ipd"/>
+ <eval expected="288000" xpath="//page/regionViewport[5]/regionBody/@bpd"/>
+ </checks>
+</testcase>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2005 The Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!-- $Id$ -->
+<testcase>
+ <info>
+ <p>
+ This test checks relative padding on block containers.
+ </p>
+ </info>
+ <fo>
+ <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
+ <fo:layout-master-set>
+ <fo:simple-page-master master-name="normal" page-width="5in" page-height="5in">
+ <fo:region-body/>
+ </fo:simple-page-master>
+ </fo:layout-master-set>
+ <fo:page-sequence master-reference="normal" white-space-collapse="true">
+ <fo:flow flow-name="xsl-region-body">
+ <fo:block-container width="2in" height="1in" background-color="yellow" padding="5%">
+ <fo:block>margin not specified padding="5%" on this 2x1in yellow container</fo:block>
+ </fo:block-container>
+ <fo:block-container width="2in" height="1in" margin="0pt" background-color="blue" padding="5%">
+ <fo:block>margin="0pt" padding="5%" on this 2x1in blue container</fo:block>
+ </fo:block-container>
+ </fo:flow>
+ </fo:page-sequence>
+ </fo:root>
+ </fo>
+ <checks>
+ <eval expected="18000 18000 18000 18000" xpath="//flow/block[1]/@bap"/>
+ <eval expected="-18000" xpath="//flow/block[1]/@space-start"/>
+ <eval expected="-18000" xpath="//flow/block[1]/@space-end"/>
+ <eval expected="color=#ffff00" xpath="//flow/block[1]/@background"/>
+ <eval expected="18000 18000 18000 18000" xpath="//flow/block[2]/@bap"/>
+ <eval expected="18000" xpath="//flow/block[2]/@start-indent"/>
+ <eval expected="18000" xpath="//flow/block[2]/@end-indent"/>
+ <eval expected="color=#0000ff" xpath="//flow/block[2]/@background"/>
+ </checks>
+</testcase>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2005 The Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!-- $Id$ -->
+<testcase>
+ <info>
+ <p>
+ This test checks relative padding on blocks.
+ </p>
+ </info>
+ <fo>
+ <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
+ <fo:layout-master-set>
+ <fo:simple-page-master master-name="normal" page-width="5in" page-height="5in">
+ <fo:region-body/>
+ </fo:simple-page-master>
+ </fo:layout-master-set>
+ <fo:page-sequence master-reference="normal" white-space-collapse="true">
+ <fo:flow flow-name="xsl-region-body">
+ <fo:block background-color="yellow" padding="5%">
+ margin not specified padding="5%"
+ </fo:block>
+ <fo:block margin="0pt" background-color="yellow" padding="5%">
+ margin="0pt" padding="5%"
+ </fo:block>
+ </fo:flow>
+ </fo:page-sequence>
+ </fo:root>
+ </fo>
+ <checks>
+ <eval expected="18000 18000 18000 18000" xpath="//flow/block[1]/@bap"/>
+ <eval expected="-18000" xpath="//flow/block[1]/@space-start"/>
+ <eval expected="-18000" xpath="//flow/block[1]/@space-end"/>
+ <eval expected="color=#ffff00" xpath="//flow/block[1]/@background"/>
+ <eval expected="18000 18000 18000 18000" xpath="//flow/block[2]/@bap"/>
+ <eval expected="18000" xpath="//flow/block[2]/@start-indent"/>
+ <eval expected="18000" xpath="//flow/block[2]/@end-indent"/>
+ <eval expected="color=#ffff00" xpath="//flow/block[2]/@background"/>
+ </checks>
+</testcase>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2005 The Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!-- $Id$ -->
+<testcase>
+ <info>
+ <p>
+ This test checks relative padding on lists (list-block).
+ </p>
+ </info>
+ <fo>
+ <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
+ <fo:layout-master-set>
+ <fo:simple-page-master master-name="normal" page-width="5in" page-height="5in">
+ <fo:region-body/>
+ </fo:simple-page-master>
+ </fo:layout-master-set>
+ <fo:page-sequence master-reference="normal" white-space-collapse="true">
+ <fo:flow flow-name="xsl-region-body">
+ <fo:list-block provisional-distance-between-starts="1in" provisional-label-separation="0.1in" margin="0pt" padding="5%" background-color="yellow">
+ <fo:list-item background-color="white">
+ <fo:list-item-label end-indent="label-end()">
+ <fo:block>label 1</fo:block>
+ </fo:list-item-label>
+ <fo:list-item-body start-indent="body-start()">
+ <fo:block>
+ body 1: The whole list should have a 5% padding shown in yellow.
+ </fo:block>
+ </fo:list-item-body>
+ </fo:list-item>
+ <fo:list-item background-color="white">
+ <fo:list-item-label end-indent="label-end()">
+ <fo:block>label 2</fo:block>
+ </fo:list-item-label>
+ <fo:list-item-body start-indent="body-start()">
+ <fo:block>
+ body 2: The whole list should have a 5% padding shown in yellow.
+ </fo:block>
+ </fo:list-item-body>
+ </fo:list-item>
+ <fo:list-item background-color="white">
+ <fo:list-item-label end-indent="label-end()">
+ <fo:block>label 3</fo:block>
+ </fo:list-item-label>
+ <fo:list-item-body start-indent="body-start()">
+ <fo:block>
+ body 3: The whole list should have a 5% padding shown in yellow.
+ </fo:block>
+ </fo:list-item-body>
+ </fo:list-item>
+ </fo:list-block>
+ </fo:flow>
+ </fo:page-sequence>
+ </fo:root>
+ </fo>
+ <checks>
+ <eval expected="18000 18000 18000 18000" xpath="//flow/block/@bap"/>
+ <eval expected="18000" xpath="//flow/block/@start-indent"/>
+ <eval expected="18000" xpath="//flow/block/@end-indent"/>
+ <eval expected="color=#ffff00" xpath="//flow/block/@background"/>
+ </checks>
+</testcase>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2005 The Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!-- $Id$ -->
+<testcase>
+ <info>
+ <p>
+ This test checks relative padding widths on lists (list-item).
+ </p>
+ </info>
+ <variables>
+ <img>../../resources/images/bgimg300dpi.jpg</img>
+ </variables>
+ <fo>
+ <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
+ <fo:layout-master-set>
+ <fo:simple-page-master master-name="normal" page-width="5in" page-height="5in">
+ <fo:region-body/>
+ </fo:simple-page-master>
+ </fo:layout-master-set>
+ <fo:page-sequence master-reference="normal" white-space-collapse="true">
+ <fo:flow flow-name="xsl-region-body">
+ <fo:list-block provisional-distance-between-starts="1in" provisional-label-separation="0.1in">
+ <fo:list-item margin="0pt" padding="5%" background-color="yellow">
+ <fo:list-item-label end-indent="label-end()">
+ <fo:block>label 1</fo:block>
+ </fo:list-item-label>
+ <fo:list-item-body start-indent="body-start()">
+ <fo:block>
+ body 1: We should have 5% padding around this whole yellow list item.
+ </fo:block>
+ </fo:list-item-body>
+ </fo:list-item>
+ <fo:list-item>
+ <fo:list-item-label end-indent="label-end()">
+ <fo:block>label 2</fo:block>
+ </fo:list-item-label>
+ <fo:list-item-body start-indent="body-start()">
+ <fo:block>
+ body 2: We should have no padding around this whole list item.
+ </fo:block>
+ </fo:list-item-body>
+ </fo:list-item>
+ <fo:list-item>
+ <fo:list-item-label end-indent="label-end()">
+ <fo:block>label 3</fo:block>
+ </fo:list-item-label>
+ <fo:list-item-body start-indent="body-start()">
+ <fo:block>
+ body 3: We should have no padding around this whole list item.
+ </fo:block>
+ </fo:list-item-body>
+ </fo:list-item>
+ </fo:list-block>
+ </fo:flow>
+ </fo:page-sequence>
+ </fo:root>
+ </fo>
+ <checks>
+ <eval expected="18000 18000 18000 18000" xpath="//flow/block/block/@bap"/>
+ <eval expected="18000" xpath="//flow/block/block/@start-indent"/>
+ <eval expected="18000" xpath="//flow/block/block/@end-indent"/>
+ <eval expected="color=#ffff00" xpath="//flow/block/block/@background"/>
+ </checks>
+</testcase>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2005 The Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!-- $Id$ -->
+<testcase>
+ <info>
+ <p>
+ This test checks relative padding on a fo:table.
+ </p>
+ </info>
+ <fo>
+ <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
+ <fo:layout-master-set>
+ <fo:simple-page-master master-name="normal" page-width="5in" page-height="5in">
+ <fo:region-body/>
+ </fo:simple-page-master>
+ </fo:layout-master-set>
+ <fo:page-sequence master-reference="normal" white-space-collapse="true">
+ <fo:flow flow-name="xsl-region-body">
+ <fo:table margin="0pt" padding="5%" background-color="yellow" border-collapse="separate">
+ <fo:table-column column-number="1" />
+ <fo:table-column column-number="2" />
+ <fo:table-column column-number="3" />
+ <fo:table-header>
+ <fo:table-row>
+ <fo:table-cell>
+ <fo:block>Header Col 1</fo:block>
+ </fo:table-cell>
+ <fo:table-cell>
+ <fo:block>Header Col 2</fo:block>
+ </fo:table-cell>
+ <fo:table-cell>
+ <fo:block>Header Col 3</fo:block>
+ </fo:table-cell>
+ </fo:table-row>
+ </fo:table-header>
+ <fo:table-body>
+ <fo:table-row>
+ <fo:table-cell>
+ <fo:block>Row 1 Col 1</fo:block>
+ </fo:table-cell>
+ <fo:table-cell>
+ <fo:block>Row 1 Col 2</fo:block>
+ </fo:table-cell>
+ <fo:table-cell>
+ <fo:block>Row 1 Col 3</fo:block>
+ </fo:table-cell>
+ </fo:table-row>
+ </fo:table-body>
+ </fo:table>
+ <fo:block>Table on yellow background with 5% padding</fo:block>
+ </fo:flow>
+ </fo:page-sequence>
+ </fo:root>
+ </fo>
+ <checks>
+ <eval expected="18000" xpath="//flow/block/@start-indent"/>
+ <eval expected="18000" xpath="//flow/block/@end-indent"/>
+ <eval expected="color=#ffff00" xpath="//flow/block/@background"/>
+ </checks>
+</testcase>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2005 The Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!-- $Id$ -->
+<testcase>
+ <info>
+ <p>
+ This test checks relative padding on a fo:table-cell.
+ </p>
+ </info>
+ <fo>
+ <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format">
+ <fo:layout-master-set>
+ <fo:simple-page-master master-name="normal" page-width="5in" page-height="5in">
+ <fo:region-body/>
+ </fo:simple-page-master>
+ </fo:layout-master-set>
+ <fo:page-sequence master-reference="normal" white-space-collapse="true">
+ <fo:flow flow-name="xsl-region-body">
+ <fo:table>
+ <fo:table-column column-number="1" />
+ <fo:table-column column-number="2" />
+ <fo:table-column column-number="3" />
+ <fo:table-body>
+ <fo:table-row>
+ <fo:table-cell>
+ <fo:block>Row 1 Col 1</fo:block>
+ </fo:table-cell>
+ <fo:table-cell margin="0pt" padding="2%" background-color="yellow">
+ <fo:block>Row 1 Col 2</fo:block>
+ </fo:table-cell>
+ <fo:table-cell>
+ <fo:block>Row 1 Col 3</fo:block>
+ </fo:table-cell>
+ </fo:table-row>
+ </fo:table-body>
+ </fo:table>
+ <fo:block>Table a yellow cell having 2% padding.</fo:block>
+ </fo:flow>
+ </fo:page-sequence>
+ </fo:root>
+ </fo>
+ <checks>
+ <eval expected="7200 7200 7200 7200" xpath="//flow/block/block[2]/@bap"/>
+ <eval expected="color=#ffff00" xpath="//flow/block/block[2]/@background"/>
+ <eval expected="7200" xpath="//flow/block/block[2]/block/@start-indent"/>
+ <eval expected="7200" xpath="//flow/block/block[2]/block/@end-indent"/>
+ <eval expected="7200" xpath="//flow/block/block[2]/block/@space-start"/>
+ <eval expected="7200" xpath="//flow/block/block[2]/block/@space-end"/>
+ </checks>
+</testcase>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Copyright 2005 The Apache Software Foundation
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!-- $Id$ -->
+<testcase>
+ <info>
+ <p>
+ This test checks basic tables with percentages in cells.
+ </p>
+ </info>
+ <fo>
+ <fo:root xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:svg="http://www.w3.org/2000/svg">
+ <fo:layout-master-set>
+ <fo:simple-page-master master-name="normal" page-width="5in" page-height="5in">
+ <fo:region-body/>
+ </fo:simple-page-master>
+ </fo:layout-master-set>
+ <fo:page-sequence master-reference="normal" white-space-collapse="true">
+ <fo:flow flow-name="xsl-region-body">
+ <fo:table table-layout="fixed" width="100%">
+ <fo:table-column column-width="2in"/>
+ <fo:table-column column-width="3in"/>
+ <fo:table-body>
+ <fo:table-row>
+ <fo:table-cell>
+ <fo:block margin="10%">cell1</fo:block>
+ </fo:table-cell>
+ <fo:table-cell background-color="yellow">
+ <fo:block margin-left="5%" margin-right="5%">cell2</fo:block>
+ </fo:table-cell>
+ </fo:table-row>
+ </fo:table-body>
+ </fo:table>
+ </fo:flow>
+ </fo:page-sequence>
+ </fo:root>
+ </fo>
+ <checks>
+ <!-- table dimensions -->
+ <eval expected="360000" xpath="//flow/block[1]/@ipd"/>
+ <eval expected="43200" xpath="//flow/block[1]/@bpd"/>
+
+ <!-- cell 1 -->
+ <true xpath="//flow/block[1]/block[1]/@is-reference-area"/>
+ <eval expected="144000" xpath="//flow/block[1]/block[1]/@ipd"/>
+ <eval expected="43200" xpath="//flow/block[1]/block[1]/@bpd"/>
+ <eval expected="115200" xpath="//flow/block[1]/block[1]/block[2]/@ipd"/>
+ <eval expected="14400" xpath="//flow/block[1]/block[1]/block[2]/@bpd"/>
+ <eval expected="14400" xpath="//flow/block[1]/block[1]/block[2]/@start-indent"/>
+ <eval expected="14400" xpath="//flow/block[1]/block[1]/block[2]/@space-start"/>
+ <eval expected="14400" xpath="//flow/block[1]/block[1]/block[2]/@end-indent"/>
+ <eval expected="14400" xpath="//flow/block[1]/block[1]/block[2]/@space-end"/>
+
+ <!-- cell 2 -->
+ <true xpath="//flow/block[1]/block[2]/@is-reference-area"/>
+ <eval expected="144000" xpath="//flow/block[1]/block[2]/@left-offset"/>
+ <eval expected="216000" xpath="//flow/block[1]/block[2]/@ipd"/>
+ <eval expected="43200" xpath="//flow/block[1]/block[2]/@bpd"/>
+ <eval expected="194400" xpath="//flow/block[1]/block[2]/block[1]/@ipd"/>
+ <eval expected="14400" xpath="//flow/block[1]/block[2]/block[1]/@bpd"/>
+ <eval expected="10800" xpath="//flow/block[1]/block[2]/block[1]/@start-indent"/>
+ <eval expected="10800" xpath="//flow/block[1]/block[2]/block[1]/@space-start"/>
+ <eval expected="10800" xpath="//flow/block[1]/block[2]/block[1]/@end-indent"/>
+ <eval expected="10800" xpath="//flow/block[1]/block[2]/block[1]/@space-end"/>
+ </checks>
+</testcase>