package org.apache.fop.datatypes;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.apache.fop.fo.Constants;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.flow.Character;
import org.apache.fop.fo.flow.ExternalGraphic;
import org.apache.fop.fo.flow.InstreamForeignObject;
+import org.apache.fop.layoutmgr.inline.LeafNodeLayoutManager;
/**
* Models a length which can be used as a factor in a percentage length
/** constant for a alignment adjust percent-based length */
public static final int ALIGNMENT_ADJUST = 12;
+ /**
+ * logging instance
+ */
+ protected static Log log = LogFactory.getLog(LengthBase.class);
+
/**
* The FO for which this property is to be calculated.
*/
* @param baseType a constant defining the type of teh percent base
* @throws PropertyException In case an problem occurs while evaluating values
*/
- public LengthBase(FObj parentFO, PropertyList plist, int baseType) throws PropertyException {
+ public LengthBase(PropertyList plist, int baseType) throws PropertyException {
this.fobj = plist.getFObj();
this.baseType = baseType;
switch (baseType) {
}
baseLen = context.getBaseLength(baseType, fobj);
} else {
- fobj.getLogger().error("getBaseLength called without context");
+ log.error("getBaseLength called without context");
}
return baseLen;
}
return ca[i];
}
default:
- getLogger().warn("Invalid text-tranform value: " + textTransform);
+ log.warn("Invalid text-tranform value: " + textTransform);
return ca[i];
}
}
} else {
return new String(ca).trim();
}
- }
-
+ }
}
\ No newline at end of file
if (node instanceof FObj
|| (node instanceof FOText
&& ((FOText) node).willCreateArea())) {
- getLogger().error(
+ log.error(
"fo:marker must be an initial child: " + mcname);
return;
} else if (node instanceof FOText) {
if (!markers.containsKey(mcname)) {
markers.put(mcname, marker);
} else {
- getLogger().error("fo:marker 'marker-class-name' "
+ log.error("fo:marker 'marker-class-name' "
+ "must be unique for same parent: " + mcname);
}
}
extensionAttachments = new java.util.ArrayList();
}
if (log.isDebugEnabled()) {
- getLogger().debug("ExtensionAttachment of category "
+ log.debug("ExtensionAttachment of category "
+ attachment.getCategory() + " added to "
+ getName() + ": " + attachment);
}
// in theory someone might want to embed some defined
// xml (eg. fo) inside the foreign xml
// they could use a different namespace
- getLogger().debug("Invalid element: " + child.getName() + " inside foreign xml markup");
+ log.debug("Invalid element: " + child.getName() + " inside foreign xml markup");
}
}
}
Length startIndent = pList.get(Constants.PR_START_INDENT).getLength();
- LengthBase base = new LengthBase(pList.getFObj(), pInfo.getPropertyList(),
+ LengthBase base = new LengthBase(pInfo.getPropertyList(),
LengthBase.CONTAINING_REFAREA_WIDTH);
PercentLength refWidth = new PercentLength(1.0, base);
* @param plist PropertyList object
* @param fo FObj
*/
- public PropertyInfo(PropertyMaker maker, PropertyList plist, FObj fo) {
+ public PropertyInfo(PropertyMaker maker, PropertyList plist) {
this.maker = maker;
this.plist = plist;
- this.fo = fo;
+ this.fo = plist.getParentFObj();
}
/**
*/
public PercentBase getPercentBase() throws PropertyException {
PercentBase pcbase = getFunctionPercentBase();
- return (pcbase != null) ? pcbase : maker.getPercentBase(fo, plist);
+ return (pcbase != null) ? pcbase : maker.getPercentBase(plist);
}
/**
}
protected void initialize() {
- if (foObjs == null && batikAvail == true) {
+ if (foObjs == null && batikAvail) {
// this sets the parser that will be used
// by default (SVGBrokenLinkProvider)
// normally the user agent value is used
//svgdoc.setDocumentURI(baseURL.toString());
}
} catch (Exception e) {
- getLogger().error("Could not set base URL for svg", e);
+ log.error("Could not set base URL for svg", e);
}
Element e = ((SVGDocument)doc).getRootElement();
.append(" is missing child elements. ")
.append("Required Content Model: ")
.append(contentModel);
- getLogger().warn(message.toString());
+ log.warn(message.toString());
}
}
}
ImageFactory fact = userAgent.getFactory().getImageFactory();
FopImage fopimage = fact.getImage(url, userAgent);
if (fopimage == null) {
- getLogger().error("Image not available: " + getSrc());
+ log.error("Image not available: " + getSrc());
} else {
// load dimensions
if (!fopimage.load(FopImage.DIMENSIONS)) {
- getLogger().error("Cannot read image dimensions: " + getSrc());
+ log.error("Cannot read image dimensions: " + getSrc());
}
this.intrinsicWidth = fopimage.getIntrinsicWidth();
this.intrinsicHeight = fopimage.getIntrinsicHeight();
super(parent);
if (!notImplementedWarningGiven) {
- getLogger().warn("fo:float is not yet implemented.");
+ log.warn("fo:float is not yet implemented.");
notImplementedWarningGiven = true;
}
}
Point2D csize = new Point2D.Float(-1, -1);
intrinsicDimensions = child.getDimension(csize);
if (intrinsicDimensions == null) {
- getLogger().error("Intrinsic dimensions of "
+ log.error("Intrinsic dimensions of "
+ " instream-foreign-object could not be determined");
}
}
super(parent);
if (!notImplementedWarningGiven) {
- getLogger().warn("fo:multi-case is not yet implemented.");
+ log.warn("fo:multi-case is not yet implemented.");
notImplementedWarningGiven = true;
}
}
super(parent);
if (!notImplementedWarningGiven) {
- getLogger().warn("fo:multi-properties is not yet implemented.");
+ log.warn("fo:multi-properties is not yet implemented.");
notImplementedWarningGiven = true;
}
}
super(parent);
if (!notImplementedWarningGiven) {
- getLogger().warn("fo:multi-property-set is not yet implemented.");
+ log.warn("fo:multi-property-set is not yet implemented.");
notImplementedWarningGiven = true;
}
}
super(parent);
if (!notImplementedWarningGiven) {
- getLogger().warn("fo:multi-switch is not yet implemented.");
+ log.warn("fo:multi-switch is not yet implemented.");
notImplementedWarningGiven = true;
}
}
super(parent);
if (!notImplementedWarningGiven) {
- getLogger().warn("fo:multi-toggle is not yet implemented.");
+ log.warn("fo:multi-toggle is not yet implemented.");
notImplementedWarningGiven = true;
}
}
super(parent);
if (!notImplementedWarningGiven) {
- getLogger().warn("fo:table-and-caption is not yet implemented.");
+ log.warn("fo:table-and-caption is not yet implemented.");
notImplementedWarningGiven = true;
}
}
if (getUserAgent().validateStrictly()) {
missingChildElementError("marker* (table-row+|table-cell+)");
} else {
- getLogger().error("fo:table-body must not be empty. "
+ log.error("fo:table-body must not be empty. "
+ "Expected: marker* (table-row+|table-cell+)");
getParent().removeChild(this);
}
super(parent);
if (!notImplementedWarningGiven) {
- getLogger().warn("fo:table-caption is not yet implemented.");
+ log.warn("fo:table-caption is not yet implemented.");
notImplementedWarningGiven = true;
}
}
if (getUserAgent().validateStrictly()) {
missingChildElementError("marker* (%block;)+");
} else if (childNodes != null && childNodes.size() > 0) {
- getLogger().warn("fo:table-cell content that is not "
+ log.warn("fo:table-cell content that is not "
+ "enclosed by a fo:block will be dropped/ignored.");
}
}
if ((startsRow() || endsRow())
&& getParent().getNameId() == FO_TABLE_ROW ) {
- getLogger().warn("starts-row/ends-row for fo:table-cells "
+ log.warn("starts-row/ends-row for fo:table-cells "
+ "non-applicable for children of an fo:table-row.");
}
getFOEventHandler().endCell(this);
int columnIndex = p.getNumeric().getValue();
if (columnIndex <= 0) {
- fo.getLogger().warn("Specified negative or zero value for "
+ log.warn("Specified negative or zero value for "
+ "column-number on " + fo.getName() + ": "
+ columnIndex + " forced to "
+ parent.getCurrentColumnIndex());
double tmpIndex = p.getNumeric().getNumericValue();
if (tmpIndex - columnIndex > 0.0) {
columnIndex = (int) Math.round(tmpIndex);
- fo.getLogger().warn("Rounding specified column-number of "
+ log.warn("Rounding specified column-number of "
+ tmpIndex + " to " + columnIndex);
return new NumberProperty(columnIndex);
}
if (!"".equals(cp.getColorProfileName())) {
addColorProfile(cp);
} else {
- getLogger().warn("color-profile-name required for color profile");
+ log.warn("color-profile-name required for color profile");
}
} else {
- getLogger().debug("Ignoring element " + node.getName()
+ log.debug("Ignoring element " + node.getName()
+ " inside fo:declarations.");
}
}
}
if (colorProfiles.get(cp.getColorProfileName()) != null) {
// duplicate names
- getLogger().warn("Duplicate fo:color-profile profile name: "
+ log.warn("Duplicate fo:color-profile profile name: "
+ cp.getColorProfileName());
}
colorProfiles.put(cp.getColorProfileName(), cp);
return simplePageMaster;
}
boolean isOddPage = ((page % 2) == 1);
- if (getLogger().isDebugEnabled()) {
- getLogger().debug("getNextSimplePageMaster(page=" + page
+ if (log.isDebugEnabled()) {
+ log.debug("getNextSimplePageMaster(page=" + page
+ " isOdd=" + isOddPage
+ " isFirst=" + isFirstPage
+ " isLast=" + isLastPage
+ masterName
+ "', cannot recover");
}
- getLogger().warn("subsequences exhausted in page-sequence-master '"
+ log.warn("subsequences exhausted in page-sequence-master '"
+ masterName
+ "', using previous subsequence");
currentSubSequence.reset();
} else {
int mr = maximumRepeats.getNumeric().getValue();
if (mr < 0) {
- getLogger().debug("negative maximum-repeats: "
+ log.debug("negative maximum-repeats: "
+ this.maximumRepeats);
mr = 0;
}
} else {
int mr = maximumRepeats.getNumeric().getValue();
if (mr < 0) {
- getLogger().debug("negative maximum-repeats: "
+ log.debug("negative maximum-repeats: "
+ this.maximumRepeats);
mr = 0;
}
* Stores all common border and padding properties.
* See Sec. 7.7 of the XSL-FO Standard.
*/
-public class CommonBorderPaddingBackground implements Cloneable {
+public class CommonBorderPaddingBackground {
/**
* The "background-attachment" property.
*/
/** the "end" edge */
public static final int END = 3;
- public static class BorderInfo implements Cloneable {
+ public static class BorderInfo {
private int mStyle; // Enum for border style
private Color mColor; // Border color
private CondLengthProperty mWidth;
ImageFactory fact = userAgent.getFactory().getImageFactory();
fopimage = fact.getImage(url, userAgent);
if (fopimage == null) {
- fobj.getLogger().error("Background image not available: " + backgroundImage);
+ Property.log.error("Background image not available: " + backgroundImage);
} else {
// load dimensions
if (!fopimage.load(FopImage.DIMENSIONS)) {
- fobj.getLogger().error("Cannot read background image dimensions: "
+ Property.log.error("Cannot read background image dimensions: "
+ backgroundImage);
}
}
FObj fo) throws PropertyException {
Numeric numval = p.getNumeric();
if (numval != null && numval.getDimension() == 0) {
- p = new PercentLength(numval.getNumericValue(), getPercentBase(fo, propertyList));
+ p = new PercentLength(numval.getNumericValue(), getPercentBase(propertyList));
Property spaceProp = super.convertProperty(p, propertyList, fo);
spaceProp.setSpecifiedValue(String.valueOf(numval.getNumericValue()));
return spaceProp;
|| refOrientation == -270))) {
//set page-width to "auto" = use the fallback from FOUserAgent
if (propId == Constants.PR_PAGE_WIDTH) {
- fo.getLogger().warn("Both page-width and page-height set to "
+ Property.log.warn("Both page-width and page-height set to "
+ "\"indefinite\". Forcing page-width to \"auto\"");
return make(propertyList, fallbackValue, fo);
}
} else {
//set page-height to "auto" = use fallback from FOUserAgent
- fo.getLogger().warn("Both page-width and page-height set to "
+ Property.log.warn("Both page-width and page-height set to "
+ "\"indefinite\". Forcing page-height to \"auto\"");
if (propId == Constants.PR_PAGE_HEIGHT) {
return make(propertyList, fallbackValue, fo);
* @return an object implementing the PercentBase interface.
* @throws PropertyException if there is a problem while evaluating the base property
*/
- public PercentBase getPercentBase(FObj fo, PropertyList pl) throws PropertyException {
+ public PercentBase getPercentBase(PropertyList pl) throws PropertyException {
if (percentBase == -1) {
return null;
} else {
- return new LengthBase(fo, pl, percentBase);
+ return new LengthBase(pl, percentBase);
}
}
// Override parsePropertyValue in each subclass of Property.Maker
newProp = PropertyParser.parse(pvalue,
new PropertyInfo(this,
- propertyList, fo));
+ propertyList));
}
if (newProp != null) {
newProp = convertProperty(newProp, propertyList, fo);
// Substituted a value: must parse it
Property p = PropertyParser.parse(pvalue,
new PropertyInfo(this,
- propertyList,
- fo));
+ propertyList));
pret = convertProperty(p, propertyList, fo);
}
}
* @see org.apache.fop.datatypes.PercentBaseContext#getBaseLength(int, FObj)
*/
public int getBaseLength(int lengthBase, FObj fobj) {
- if (fobj == getFObj()) {
+ if (fobj == this.fobj) {
switch (lengthBase) {
case LengthBase.CONTAINING_BLOCK_WIDTH:
return getAncestorBlockAreaIPD();
if (overflow == EN_HIDDEN) {
clip = true;
} else if (overflow == EN_ERROR_IF_OVERFLOW) {
- fobj.getLogger().error("Object overflows the viewport: clipping");
+ log.error("Object overflows the viewport: clipping");
clip = true;
}
}
/**
* logging instance
*/
- private static Log log = LogFactory.getLog(LeafNodeLayoutManager.class);
+ protected static Log log = LogFactory.getLog(LeafNodeLayoutManager.class);
/**
* The inline area that this leafnode will add.
// noop
}
- public int getBaseLength(int lengthBase, FObj fobj) {
+ public int getBaseLength(int lengthBase, FObj fo) {
return 0;
}
}