/*
- * 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.
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.ValidationException;
+import org.apache.fop.fo.expr.PropertyException;
import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
/**
+ " is not permitted.", locator);
}
}
+
+ if (getCommonBorderPaddingBackground().getBPPaddingAndBorder(false) != 0
+ || getCommonBorderPaddingBackground().getIPPaddingAndBorder(false) != 0) {
+ throw new PropertyException("Border and padding for a region "
+ + "must be '0' (See 6.4.13 in XSL 1.0).");
+ }
}
/**
invalidChildError(loc, nsURI, localName);
}
+ /**
+ * @param pageRefRect reference dimension of the page area.
+ * @return the rectangle for the viewport area
+ */
public abstract Rectangle getViewportRectangle(FODimension pageRefRect);
/**
}
/**
- * Return the Common Border, Padding, and Background Properties.
+ * @return the Background Properties (border and padding are not used here).
*/
public CommonBorderPaddingBackground getCommonBorderPaddingBackground() {
return commonBorderPaddingBackground;
}
- /**
- * Return the "region-name" property.
- */
+ /** @return the "region-name" property. */
public String getRegionName() {
return regionName;
}
- /**
- * Return the "writing-mode" property.
- */
+ /** @return the "writing-mode" property. */
public int getWritingMode() {
return writingMode;
}
- /**
- * Return the "overflow" property.
- */
+ /** @return the "overflow" property. */
public int getOverflow() {
return overflow;
}
- /**
- * Return the "reference-orientation" property.
- */
+ /** @return the display-align property. */
+ public int getDisplayAlign() {
+ return displayAlign;
+ }
+
+ /** @return the "reference-orientation" property. */
public int getReferenceOrientation() {
return referenceOrientation.getValue();
}
* @see org.apache.fop.fo.pagination.Region#getViewportRectangle(FODimension)
*/
public Rectangle getViewportRectangle (FODimension reldims) {
- /*
- * Use space-before and space-after which will use corresponding
- * absolute margin properties if specified. For indents:
- * try to get corresponding absolute margin property using the
- * writing-mode on the page (not on the region-body!). If that's not
- * set but indent is explicitly set, it will return that.
- */
- int start = commonMarginBlock.startIndent.getValue();
- int end = commonMarginBlock.endIndent.getValue();
- int before = commonMarginBlock.spaceBefore.getOptimum().getLength().getValue();
- int after = commonMarginBlock.spaceAfter.getOptimum().getLength().getValue();
- return new Rectangle(start, before,
- reldims.ipd - start - end,
- reldims.bpd - before - after);
+ int left = commonMarginBlock.marginLeft.getValue();
+ int right = commonMarginBlock.marginRight.getValue();
+ int top = commonMarginBlock.marginTop.getValue();
+ int bottom = commonMarginBlock.marginBottom.getValue();
+ return new Rectangle(left, top,
+ reldims.ipd - left - right,
+ reldims.bpd - top - bottom);
}
/**
RegionViewport rv = curPage.getPage().getRegionViewport(
FO_REGION_BODY);
curBody = (BodyRegion) rv.getRegion();
- flowBPD = (int) curBody.getBPD()
- - rv.getBorderAndPaddingWidthBefore()
- - rv.getBorderAndPaddingWidthAfter();
+ flowBPD = (int) curBody.getBPD();
return curPage;
}
// transforming it using the page CTM
RegionViewport rv = new RegionViewport(absRegionRect);
rv.addTrait(Trait.IS_VIEWPORT_AREA, Boolean.TRUE);
- if (r.getCommonBorderPaddingBackground().getBPPaddingAndBorder(false) != 0
- || r.getCommonBorderPaddingBackground().getBPPaddingAndBorder(false) != 0) {
- log.error("Border and padding for a region must be '0'.");
- //See 6.4.13 in XSL 1.0
- }
rv.setBPD((int)relRegionRect.getHeight());
rv.setIPD((int)relRegionRect.getWidth());
setRegionViewportTraits(r, rv);
* @param r the region viewport
*/
private void setRegionViewportTraits(Region r, RegionViewport rv) {
- // Common Border, Padding, and Background Properties
- TraitSetter.addBorders(rv, r.getCommonBorderPaddingBackground());
+ // Apply Background Properties, no border and padding on region viewports
TraitSetter.addBackground(rv, r.getCommonBorderPaddingBackground());
}