You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-commits@xmlgraphics.apache.org by vh...@apache.org on 2012/04/05 18:20:17 UTC
svn commit: r1309921 [15/42] - in
/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript: ./ examples/embedding/
examples/embedding/java/embedding/ examples/embedding/java/embedding/atxml/
examples/embedding/java/embedding/tools/ examples/plan/src/org/apa...
Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/InlineLevel.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/InlineLevel.java?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/InlineLevel.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/InlineLevel.java Thu Apr 5 16:19:19 2012
@@ -25,6 +25,8 @@ import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObjMixed;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.properties.CommonAccessibility;
+import org.apache.fop.fo.properties.CommonAccessibilityHolder;
import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
import org.apache.fop.fo.properties.CommonFont;
import org.apache.fop.fo.properties.CommonMarginInline;
@@ -35,9 +37,10 @@ import org.apache.fop.fo.properties.Spac
* Class modelling the commonalities of several inline-level
* formatting objects.
*/
-public abstract class InlineLevel extends FObjMixed {
+public abstract class InlineLevel extends FObjMixed implements CommonAccessibilityHolder {
- // The value of properties relevant for inline-level FOs.
+ // The value of FO traits (refined properties) that apply to inline level FOs.
+ private CommonAccessibility commonAccessibility;
private CommonBorderPaddingBackground commonBorderPaddingBackground;
private CommonMarginInline commonMarginInline;
private CommonFont commonFont;
@@ -45,7 +48,7 @@ public abstract class InlineLevel extend
private KeepProperty keepWithNext;
private KeepProperty keepWithPrevious;
private SpaceProperty lineHeight;
- // End of property values
+ // End of trait values
/**
* Base constructor
@@ -59,6 +62,7 @@ public abstract class InlineLevel extend
/** {@inheritDoc} */
public void bind(PropertyList pList) throws FOPException {
super.bind(pList);
+ commonAccessibility = CommonAccessibility.getInstance(pList);
commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
commonMarginInline = pList.getMarginInlineProps();
commonFont = pList.getFontProps();
@@ -68,6 +72,11 @@ public abstract class InlineLevel extend
lineHeight = pList.get(PR_LINE_HEIGHT).getSpace();
}
+ /** {@inheritDoc} */
+ public CommonAccessibility getCommonAccessibility() {
+ return commonAccessibility;
+ }
+
/** @return the {@link CommonMarginInline} */
public CommonMarginInline getCommonMarginInline() {
return commonMarginInline;
@@ -83,24 +92,29 @@ public abstract class InlineLevel extend
return commonFont;
}
- /** @return the "color" property */
+ /** @return the "color" trait */
public Color getColor() {
return color;
}
- /** @return the "line-height" property */
+ /** @return the "line-height" trait */
public SpaceProperty getLineHeight() {
return lineHeight;
}
- /** @return the "keep-with-next" property */
+ /** @return the "keep-with-next" trait */
public KeepProperty getKeepWithNext() {
return keepWithNext;
}
- /** @return the "keep-with-previous" property */
+ /** @return the "keep-with-previous" trait */
public KeepProperty getKeepWithPrevious() {
return keepWithPrevious;
}
+ @Override
+ public boolean isDelimitedTextRangeBoundary ( int boundary ) {
+ return false;
+ }
+
}
Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/InstreamForeignObject.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/InstreamForeignObject.java?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/InstreamForeignObject.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/InstreamForeignObject.java Thu Apr 5 16:19:19 2012
@@ -59,6 +59,12 @@ public class InstreamForeignObject exten
super(parent);
}
+ @Override
+ protected void startOfNode() throws FOPException {
+ super.startOfNode();
+ getFOEventHandler().startInstreamForeignObject(this);
+ }
+
/**
* Make sure content model satisfied, if so then tell the
* {@link org.apache.fop.fo.FOEventHandler} that we are at
@@ -69,7 +75,7 @@ public class InstreamForeignObject exten
if (firstChild == null) {
missingChildElementError("one (1) non-XSL namespace child");
}
- getFOEventHandler().foreignObject(this);
+ getFOEventHandler().endInstreamForeignObject(this);
}
/**
Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/Leader.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/Leader.java?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/Leader.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/Leader.java Thu Apr 5 16:19:19 2012
@@ -19,18 +19,24 @@
package org.apache.fop.fo.flow;
+import java.util.Stack;
+
+import org.xml.sax.Locator;
+
import org.apache.fop.apps.FOPException;
+import org.apache.fop.complexscripts.bidi.DelimitedTextRange;
import org.apache.fop.datatypes.Length;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.ValidationException;
import org.apache.fop.fo.properties.LengthRangeProperty;
+import org.apache.fop.util.CharUtilities;
/**
* Class modelling the <a href="http://www.w3.org/TR/xsl/#fo_leader">
* <code>fo:leader</code></a> object.
* The main property of <code>fo:leader</code> is leader-pattern.
* The following patterns are treated: rule, space, dots and use-content.
- * TODO implement validateChildNode()
*/
public class Leader extends InlineLevel {
// The value of properties relevant for fo:leader.
@@ -96,6 +102,28 @@ public class Leader extends InlineLevel
// textShadow = pList.get(PR_TEXT_SHADOW);
}
+ /**
+ * {@inheritDoc}
+ * <br>XSL Content Model: (#PCDATA|%inline;)*
+ * <br><i>Additionally: "The content must not contain an
+ * fo:leader, fo:inline-container, fo:block-container, fo:float,
+ * fo:footnote, or fo:marker either as a direct child or as a
+ * descendant."</i>
+ */
+ protected void validateChildNode(Locator loc, String nsURI, String localName)
+ throws ValidationException {
+ if (FO_URI.equals(nsURI)) {
+ if ( localName.equals("leader")
+ || localName.equals("inline-container")
+ || localName.equals("block-container")
+ || localName.equals("float")
+ || localName.equals("marker")
+ || !isInlineItem(nsURI, localName) ) {
+ invalidChildError(loc, nsURI, localName);
+ }
+ }
+ }
+
/** @return the "rule-style" property */
public int getRuleStyle() {
return ruleStyle;
@@ -158,4 +186,29 @@ public class Leader extends InlineLevel
public int getNameId() {
return FO_LEADER;
}
+
+ @Override
+ protected void startOfNode() throws FOPException {
+ super.startOfNode();
+ getFOEventHandler().startLeader(this);
+ }
+
+ @Override
+ protected void endOfNode() throws FOPException {
+ super.endOfNode();
+ getFOEventHandler().endLeader(this);
+ }
+
+ @Override
+ protected Stack collectDelimitedTextRanges ( Stack ranges, DelimitedTextRange currentRange ) {
+ if ( currentRange != null ) {
+ if ( leaderPattern == EN_USECONTENT ) {
+ ranges = super.collectDelimitedTextRanges ( ranges, currentRange );
+ } else {
+ currentRange.append ( CharUtilities.OBJECT_REPLACEMENT_CHARACTER, this );
+ }
+ }
+ return ranges;
+ }
+
}
Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/ListBlock.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/ListBlock.java?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/ListBlock.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/ListBlock.java Thu Apr 5 16:19:19 2012
@@ -28,6 +28,8 @@ import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.ValidationException;
import org.apache.fop.fo.properties.BreakPropertySet;
+import org.apache.fop.fo.properties.CommonAccessibility;
+import org.apache.fop.fo.properties.CommonAccessibilityHolder;
import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
import org.apache.fop.fo.properties.CommonMarginBlock;
import org.apache.fop.fo.properties.KeepProperty;
@@ -36,8 +38,9 @@ import org.apache.fop.fo.properties.Keep
* Class modelling the <a href=http://www.w3.org/TR/xsl/#fo_list-block">
* <code>fo:list-block</code></a> object.
*/
-public class ListBlock extends FObj implements BreakPropertySet {
+public class ListBlock extends FObj implements BreakPropertySet, CommonAccessibilityHolder {
// The value of properties relevant for fo:list-block.
+ private CommonAccessibility commonAccessibility;
private CommonBorderPaddingBackground commonBorderPaddingBackground;
private CommonMarginBlock commonMarginBlock;
private int breakAfter;
@@ -46,7 +49,6 @@ public class ListBlock extends FObj impl
private KeepProperty keepWithNext;
private KeepProperty keepWithPrevious;
// Unused but valid items, commented out for performance:
- // private CommonAccessibility commonAccessibility;
// private CommonAural commonAural;
// private CommonRelativePosition commonRelativePosition;
// private int intrusionDisplace;
@@ -73,6 +75,7 @@ public class ListBlock extends FObj impl
/** {@inheritDoc} */
public void bind(PropertyList pList) throws FOPException {
super.bind(pList);
+ commonAccessibility = CommonAccessibility.getInstance(pList);
commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
commonMarginBlock = pList.getMarginBlockProps();
breakAfter = pList.get(PR_BREAK_AFTER).getEnum();
@@ -123,6 +126,11 @@ public class ListBlock extends FObj impl
}
}
+ /** {@inheritDoc} */
+ public CommonAccessibility getCommonAccessibility() {
+ return commonAccessibility;
+ }
+
/** @return the {@link CommonMarginBlock} */
public CommonMarginBlock getCommonMarginBlock() {
return commonMarginBlock;
Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/ListItem.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/ListItem.java?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/ListItem.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/ListItem.java Thu Apr 5 16:19:19 2012
@@ -19,14 +19,19 @@
package org.apache.fop.fo.flow;
+import java.util.Stack;
+
import org.xml.sax.Locator;
import org.apache.fop.apps.FOPException;
+import org.apache.fop.complexscripts.bidi.DelimitedTextRange;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.ValidationException;
import org.apache.fop.fo.properties.BreakPropertySet;
+import org.apache.fop.fo.properties.CommonAccessibility;
+import org.apache.fop.fo.properties.CommonAccessibilityHolder;
import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
import org.apache.fop.fo.properties.CommonMarginBlock;
import org.apache.fop.fo.properties.KeepProperty;
@@ -35,8 +40,9 @@ import org.apache.fop.fo.properties.Keep
* Class modelling the <a href=http://www.w3.org/TR/xsl/#fo_list-item">
* <code>fo:list-item</code></a> object.
*/
-public class ListItem extends FObj implements BreakPropertySet {
+public class ListItem extends FObj implements BreakPropertySet, CommonAccessibilityHolder {
// The value of properties relevant for fo:list-item.
+ private CommonAccessibility commonAccessibility;
private CommonBorderPaddingBackground commonBorderPaddingBackground;
private CommonMarginBlock commonMarginBlock;
private int breakAfter;
@@ -45,7 +51,6 @@ public class ListItem extends FObj imple
private KeepProperty keepWithNext;
private KeepProperty keepWithPrevious;
// Unused but valid items, commented out for performance:
- // private CommonAccessibility commonAccessibility;
// private CommonAural commonAural;
// private CommonRelativePosition commonRelativePosition;
// private int intrusionDisplace;
@@ -67,6 +72,7 @@ public class ListItem extends FObj imple
/** {@inheritDoc} */
public void bind(PropertyList pList) throws FOPException {
super.bind(pList);
+ commonAccessibility = CommonAccessibility.getInstance(pList);
commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
commonMarginBlock = pList.getMarginBlockProps();
breakAfter = pList.get(PR_BREAK_AFTER).getEnum();
@@ -134,6 +140,11 @@ public class ListItem extends FObj imple
}
}
+ /** {@inheritDoc} */
+ public CommonAccessibility getCommonAccessibility() {
+ return commonAccessibility;
+ }
+
/** @return the {@link CommonMarginBlock} */
public CommonMarginBlock getCommonMarginBlock() {
return commonMarginBlock;
@@ -193,5 +204,19 @@ public class ListItem extends FObj imple
public int getNameId() {
return FO_LIST_ITEM;
}
+
+ @Override
+ protected Stack collectDelimitedTextRanges ( Stack ranges, DelimitedTextRange currentRange ) {
+ ListItemLabel label = getLabel();
+ if ( label != null ) {
+ ranges = label.collectDelimitedTextRanges ( ranges );
+ }
+ ListItemBody body = getBody();
+ if ( body != null ) {
+ ranges = body.collectDelimitedTextRanges ( ranges );
+ }
+ return ranges;
+ }
+
}
Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/ListItemBody.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/ListItemBody.java?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/ListItemBody.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/ListItemBody.java Thu Apr 5 16:19:19 2012
@@ -38,13 +38,13 @@ public class ListItemBody extends Abstra
/** {@inheritDoc} */
protected void startOfNode() throws FOPException {
super.startOfNode();
- getFOEventHandler().startListBody();
+ getFOEventHandler().startListBody(this);
}
/** {@inheritDoc} */
protected void endOfNode() throws FOPException {
super.endOfNode();
- getFOEventHandler().endListBody();
+ getFOEventHandler().endListBody(this);
}
/** {@inheritDoc} */
Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/ListItemLabel.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/ListItemLabel.java?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/ListItemLabel.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/ListItemLabel.java Thu Apr 5 16:19:19 2012
@@ -40,13 +40,13 @@ public class ListItemLabel extends Abstr
/** {@inheritDoc} */
protected void startOfNode() throws FOPException {
super.startOfNode();
- getFOEventHandler().startListLabel();
+ getFOEventHandler().startListLabel(this);
}
/** {@inheritDoc} */
protected void endOfNode() throws FOPException {
super.endOfNode();
- getFOEventHandler().endListLabel();
+ getFOEventHandler().endListLabel(this);
}
/** {@inheritDoc} */
Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/Marker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/Marker.java?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/Marker.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/Marker.java Thu Apr 5 16:19:19 2012
@@ -357,8 +357,8 @@ public class Marker extends FObjMixed {
/** Convenience inner class */
public static final class MarkerAttribute {
- private static PropertyCache attributeCache
- = new PropertyCache(MarkerAttribute.class);
+ private static final PropertyCache<MarkerAttribute> CACHE
+ = new PropertyCache<MarkerAttribute>();
/** namespace */
protected String namespace;
@@ -398,7 +398,7 @@ public class Marker extends FObjMixed {
private static MarkerAttribute getInstance(
String namespace, String qname,
String name, String value) {
- return attributeCache.fetch(
+ return CACHE.fetch(
new MarkerAttribute(namespace, qname, name, value));
}
Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/PageNumber.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/PageNumber.java?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/PageNumber.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/PageNumber.java Thu Apr 5 16:19:19 2012
@@ -23,6 +23,7 @@ import java.awt.Color;
import org.xml.sax.Locator;
+import org.apache.fop.accessibility.StructureTreeElement;
import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.Length;
import org.apache.fop.fo.Constants;
@@ -30,32 +31,35 @@ import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.ValidationException;
+import org.apache.fop.fo.properties.CommonAccessibility;
+import org.apache.fop.fo.properties.CommonAccessibilityHolder;
import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
import org.apache.fop.fo.properties.CommonFont;
import org.apache.fop.fo.properties.CommonTextDecoration;
import org.apache.fop.fo.properties.SpaceProperty;
-import org.apache.fop.fo.properties.StructurePointerPropertySet;
+import org.apache.fop.fo.properties.StructureTreeElementHolder;
/**
* Class modelling the <a href="http://www.w3.org/TR/xsl/#fo_page-number">
* <code>fo:page-number</code></a> object.
*/
-public class PageNumber extends FObj implements StructurePointerPropertySet {
+public class PageNumber extends FObj
+ implements StructureTreeElementHolder, CommonAccessibilityHolder {
// The value of properties relevant for fo:page-number.
+ private CommonAccessibility commonAccessibility;
private CommonBorderPaddingBackground commonBorderPaddingBackground;
private CommonFont commonFont;
private Length alignmentAdjust;
private int alignmentBaseline;
private Length baselineShift;
private int dominantBaseline;
- private String ptr; // used for accessibility
+ private StructureTreeElement structureTreeElement;
// private ToBeImplementedProperty letterSpacing;
private SpaceProperty lineHeight;
/** Holds the text decoration values. May be null */
private CommonTextDecoration textDecoration;
// private ToBeImplementedProperty textShadow;
// Unused but valid items, commented out for performance:
- // private CommonAccessibility commonAccessibility;
// private CommonAural commonAural;
// private CommonMarginInline commonMarginInline;
// private CommonRelativePosition commonRelativePosition;
@@ -85,6 +89,7 @@ public class PageNumber extends FObj imp
/** {@inheritDoc} */
public void bind(PropertyList pList) throws FOPException {
super.bind(pList);
+ commonAccessibility = CommonAccessibility.getInstance(pList);
commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
commonFont = pList.getFontProps();
alignmentAdjust = pList.get(PR_ALIGNMENT_ADJUST).getLength();
@@ -94,7 +99,6 @@ public class PageNumber extends FObj imp
// letterSpacing = pList.get(PR_LETTER_SPACING);
lineHeight = pList.get(PR_LINE_HEIGHT).getSpace();
textDecoration = pList.getTextDecorationProps();
- ptr = pList.get(PR_X_PTR).getString(); // used for accessibility
// textShadow = pList.get(PR_TEXT_SHADOW);
// implicit properties
@@ -123,6 +127,11 @@ public class PageNumber extends FObj imp
}
}
+ /** {@inheritDoc} */
+ public CommonAccessibility getCommonAccessibility() {
+ return commonAccessibility;
+ }
+
/** @return the Common Font Properties. */
public CommonFont getCommonFont() {
return commonFont;
@@ -168,9 +177,14 @@ public class PageNumber extends FObj imp
return lineHeight;
}
+ @Override
+ public void setStructureTreeElement(StructureTreeElement structureTreeElement) {
+ this.structureTreeElement = structureTreeElement;
+ }
+
/** {@inheritDoc} */
- public String getPtr() {
- return ptr;
+ public StructureTreeElement getStructureTreeElement() {
+ return structureTreeElement;
}
/** {@inheritDoc} */
@@ -185,4 +199,10 @@ public class PageNumber extends FObj imp
public int getNameId() {
return FO_PAGE_NUMBER;
}
+
+ @Override
+ public boolean isDelimitedTextRangeBoundary ( int boundary ) {
+ return false;
+ }
+
}
Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/RetrieveMarker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/RetrieveMarker.java?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/RetrieveMarker.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/RetrieveMarker.java Thu Apr 5 16:19:19 2012
@@ -19,11 +19,12 @@
package org.apache.fop.fo.flow;
+import org.xml.sax.Attributes;
+import org.xml.sax.Locator;
+
import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.PropertyList;
-import org.xml.sax.Locator;
-import org.xml.sax.Attributes;
/**
* Class modelling the <a href="http://www.w3.org/TR/xsl/#fo_retrieve-marker">
@@ -110,4 +111,4 @@ public class RetrieveMarker extends Abst
public int getNameId() {
return FO_RETRIEVE_MARKER;
}
-}
\ No newline at end of file
+}
Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/RetrieveTableMarker.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/RetrieveTableMarker.java?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/RetrieveTableMarker.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/RetrieveTableMarker.java Thu Apr 5 16:19:19 2012
@@ -19,11 +19,12 @@
package org.apache.fop.fo.flow;
+import org.xml.sax.Attributes;
+import org.xml.sax.Locator;
+
+import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.PropertyList;
-import org.apache.fop.apps.FOPException;
-import org.xml.sax.Locator;
-import org.xml.sax.Attributes;
/**
* Class modelling the <a href="http://www.w3.org/TR/xsl/#fo_retrieve-table-marker">
Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/Wrapper.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/Wrapper.java?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/Wrapper.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/Wrapper.java Thu Apr 5 16:19:19 2012
@@ -51,6 +51,18 @@ public class Wrapper extends FObjMixed {
super(parent);
}
+ @Override
+ protected void startOfNode() throws FOPException {
+ super.startOfNode();
+ getFOEventHandler().startWrapper(this);
+ }
+
+ @Override
+ protected void endOfNode() throws FOPException {
+ super.endOfNode();
+ getFOEventHandler().endWrapper(this);
+ }
+
/**
* {@inheritDoc}
* <br>XSL Content Model: marker* (#PCDATA|%inline;|%block;)*
@@ -123,5 +135,11 @@ public class Wrapper extends FObjMixed {
public int getNameId() {
return FO_WRAPPER;
}
+
+ @Override
+ public boolean isDelimitedTextRangeBoundary ( int boundary ) {
+ return false;
+ }
+
}
Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/table/PendingSpan.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/table/PendingSpan.java?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/table/PendingSpan.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/table/PendingSpan.java Thu Apr 5 16:19:19 2012
@@ -55,4 +55,4 @@ class PendingSpan {
}
}
-}
\ No newline at end of file
+}
Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/table/Table.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/table/Table.java?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/table/Table.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/table/Table.java Thu Apr 5 16:19:19 2012
@@ -32,6 +32,8 @@ import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.StaticPropertyList;
import org.apache.fop.fo.ValidationException;
import org.apache.fop.fo.properties.BreakPropertySet;
+import org.apache.fop.fo.properties.CommonAccessibility;
+import org.apache.fop.fo.properties.CommonAccessibilityHolder;
import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
import org.apache.fop.fo.properties.CommonMarginBlock;
import org.apache.fop.fo.properties.KeepProperty;
@@ -43,9 +45,11 @@ import org.apache.fop.fo.properties.Tabl
* Class modelling the <a href="http://www.w3.org/TR/xsl/#fo_table">
* <code>fo:table</code></a> object.
*/
-public class Table extends TableFObj implements ColumnNumberManagerHolder, BreakPropertySet {
+public class Table extends TableFObj implements ColumnNumberManagerHolder, BreakPropertySet,
+ CommonAccessibilityHolder {
- /** properties */
+ // The value of FO traits (refined properties) that apply to fo:table.
+ private CommonAccessibility commonAccessibility;
private CommonBorderPaddingBackground commonBorderPaddingBackground;
private CommonMarginBlock commonMarginBlock;
private LengthRangeProperty blockProgressionDimension;
@@ -60,12 +64,12 @@ public class Table extends TableFObj imp
private int tableLayout;
private int tableOmitFooterAtBreak;
private int tableOmitHeaderAtBreak;
+ private int writingMode;
// Unused but valid items, commented out for performance:
- // private CommonAccessibility commonAccessibility;
// private CommonAural commonAural;
// private CommonRelativePosition commonRelativePosition;
// private int intrusionDisplace;
- // private int writingMode;
+ // End of FO trait values
/** extension properties */
private Length widowContentLimit;
@@ -112,6 +116,7 @@ public class Table extends TableFObj imp
*/
public void bind(PropertyList pList) throws FOPException {
super.bind(pList);
+ commonAccessibility = CommonAccessibility.getInstance(pList);
commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
commonMarginBlock = pList.getMarginBlockProps();
blockProgressionDimension = pList.get(PR_BLOCK_PROGRESSION_DIMENSION).getLengthRange();
@@ -126,6 +131,7 @@ public class Table extends TableFObj imp
tableLayout = pList.get(PR_TABLE_LAYOUT).getEnum();
tableOmitFooterAtBreak = pList.get(PR_TABLE_OMIT_FOOTER_AT_BREAK).getEnum();
tableOmitHeaderAtBreak = pList.get(PR_TABLE_OMIT_HEADER_AT_BREAK).getEnum();
+ writingMode = pList.get(PR_WRITING_MODE).getEnum();
//Bind extension properties
widowContentLimit = pList.get(PR_X_WIDOW_CONTENT_LIMIT).getLength();
@@ -302,6 +308,11 @@ public class Table extends TableFObj imp
}
/** {@inheritDoc} */
+ public CommonAccessibility getCommonAccessibility() {
+ return commonAccessibility;
+ }
+
+ /** {@inheritDoc} */
public Table getTable() {
return this;
}
@@ -327,7 +338,6 @@ public class Table extends TableFObj imp
TableColumn implicitColumn = new TableColumn(this, true);
PropertyList pList = new StaticPropertyList(
implicitColumn, this.propList);
- pList.setWritingMode();
implicitColumn.bind(pList);
implicitColumn.setColumnWidth(new TableColLength(1.0, implicitColumn));
implicitColumn.setColumnNumber(colNumber);
@@ -424,14 +434,14 @@ public class Table extends TableFObj imp
}
/**
- * @return the "inline-progression-dimension" property.
+ * @return the "inline-progression-dimension" FO trait.
*/
public LengthRangeProperty getInlineProgressionDimension() {
return inlineProgressionDimension;
}
/**
- * @return the "block-progression-dimension" property.
+ * @return the "block-progression-dimension" FO trait.
*/
public LengthRangeProperty getBlockProgressionDimension() {
return blockProgressionDimension;
@@ -451,27 +461,27 @@ public class Table extends TableFObj imp
return commonBorderPaddingBackground;
}
- /** @return the "break-after" property. */
+ /** @return the "break-after" FO trait. */
public int getBreakAfter() {
return breakAfter;
}
- /** @return the "break-before" property. */
+ /** @return the "break-before" FO trait. */
public int getBreakBefore() {
return breakBefore;
}
- /** @return the "keep-with-next" property. */
+ /** @return the "keep-with-next" FO trait. */
public KeepProperty getKeepWithNext() {
return keepWithNext;
}
- /** @return the "keep-with-previous" property. */
+ /** @return the "keep-with-previous" FO trait. */
public KeepProperty getKeepWithPrevious() {
return keepWithPrevious;
}
- /** @return the "keep-together" property. */
+ /** @return the "keep-together" FO trait. */
public KeepProperty getKeepTogether() {
return keepTogether;
}
@@ -485,7 +495,7 @@ public class Table extends TableFObj imp
|| !getKeepTogether().getWithinColumn().isAuto();
}
- /** @return the "border-collapse" property. */
+ /** @return the "border-collapse" FO trait. */
public int getBorderCollapse() {
return borderCollapse;
}
@@ -495,17 +505,22 @@ public class Table extends TableFObj imp
return (getBorderCollapse() == EN_SEPARATE);
}
- /** @return the "border-separation" property. */
+ /** @return the "border-separation" FO trait. */
public LengthPairProperty getBorderSeparation() {
return borderSeparation;
}
- /** @return the "fox:widow-content-limit" extension property */
+ /** @return the "writing-mode" FO trait */
+ public int getWritingMode() {
+ return writingMode;
+ }
+
+ /** @return the "fox:widow-content-limit" extension FO trait */
public Length getWidowContentLimit() {
return widowContentLimit;
}
- /** @return the "fox:orphan-content-limit" extension property */
+ /** @return the "fox:orphan-content-limit" extension FO trait */
public Length getOrphanContentLimit() {
return orphanContentLimit;
}
Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/table/TableAndCaption.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/table/TableAndCaption.java?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/table/TableAndCaption.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/table/TableAndCaption.java Thu Apr 5 16:19:19 2012
@@ -25,17 +25,22 @@ import org.xml.sax.Locator;
import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
+import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.ValidationException;
+import org.apache.fop.fo.properties.CommonAccessibility;
+import org.apache.fop.fo.properties.CommonAccessibilityHolder;
/**
* Class modelling the <a href="http://www.w3.org/TR/xsl/#fo_table-and-caption">
* <code>fo:table-and-caption</code></a> property.
* TODO needs implementation
*/
-public class TableAndCaption extends FObj /*implements BreakPropertySet*/ {
+public class TableAndCaption extends FObj implements CommonAccessibilityHolder {
+
+ private CommonAccessibility commonAccessibility;
+
// The value of properties relevant for fo:table-and-caption.
// Unused but valid items, commented out for performance:
- // private CommonAccessibility commonAccessibility;
// private CommonAural commonAural;
// private CommonBorderPaddingBackground commonBorderPaddingBackground;
// private CommonMarginBlock commonMarginBlock;
@@ -50,7 +55,7 @@ public class TableAndCaption extends FOb
// private int textAlign;
// End of property values
- private static boolean notImplementedWarningGiven = false;
+ static boolean notImplementedWarningGiven = false; // CSOK: VisibilityModifier
/** used for FO validation */
private boolean tableCaptionFound = false;
@@ -71,6 +76,12 @@ public class TableAndCaption extends FOb
}
}
+ @Override
+ public void bind(PropertyList pList) throws FOPException {
+ super.bind(pList);
+ commonAccessibility = CommonAccessibility.getInstance(pList);
+ }
+
/**
* Make sure content model satisfied, if so then tell the
* FOEventHandler that we are at the end of the flow.
@@ -128,5 +139,11 @@ public class TableAndCaption extends FOb
public int getNameId() {
return FO_TABLE_AND_CAPTION;
}
+
+ /** {@inheritDoc} */
+ public CommonAccessibility getCommonAccessibility() {
+ return commonAccessibility;
+ }
+
}
Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/table/TableBody.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/table/TableBody.java?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/table/TableBody.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/table/TableBody.java Thu Apr 5 16:19:19 2012
@@ -19,8 +19,8 @@
package org.apache.fop.fo.flow.table;
-import org.apache.fop.fo.FONode;
import org.apache.fop.apps.FOPException;
+import org.apache.fop.fo.FONode;
/**
* Class modelling the <a href="http://www.w3.org/TR/xsl/#fo_table-body">
Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/table/TableCaption.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/table/TableCaption.java?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/table/TableCaption.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/table/TableCaption.java Thu Apr 5 16:19:19 2012
@@ -27,13 +27,18 @@ import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.ValidationException;
+import org.apache.fop.fo.properties.CommonAccessibility;
+import org.apache.fop.fo.properties.CommonAccessibilityHolder;
/**
* Class modelling the <a href="http://www.w3.org/TR/xsl/#fo_table-caption">
* <code>fo:table-caption</code></a> object.
*/
-public class TableCaption extends FObj {
+public class TableCaption extends FObj implements CommonAccessibilityHolder {
+
+ private CommonAccessibility commonAccessibility;
+
// The value of properties relevant for fo:table-caption.
// Unused but valid items, commented out for performance:
// private CommonAural commonAural;
@@ -49,7 +54,7 @@ public class TableCaption extends FObj {
/** used for FO validation */
private boolean blockItemFound = false;
- private static boolean notImplementedWarningGiven = false;
+ static boolean notImplementedWarningGiven = false; // CSOK: VisibilityModifier
/**
* Create a TableCaption instance with the given {@link FONode}
@@ -69,6 +74,7 @@ public class TableCaption extends FObj {
/** {@inheritDoc} */
public void bind(PropertyList pList) throws FOPException {
super.bind(pList);
+ commonAccessibility = CommonAccessibility.getInstance(pList);
}
/** {@inheritDoc} */
@@ -109,5 +115,11 @@ public class TableCaption extends FObj {
public int getNameId() {
return FO_TABLE_CAPTION;
}
+
+ /** {@inheritDoc} */
+ public CommonAccessibility getCommonAccessibility() {
+ return commonAccessibility;
+ }
+
}
Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/table/TableCell.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/table/TableCell.java?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/table/TableCell.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/table/TableCell.java Thu Apr 5 16:19:19 2012
@@ -26,6 +26,8 @@ import org.apache.fop.datatypes.Length;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.ValidationException;
+import org.apache.fop.fo.properties.CommonAccessibility;
+import org.apache.fop.fo.properties.CommonAccessibilityHolder;
import org.apache.fop.fo.properties.CommonBorderPaddingBackground;
import org.apache.fop.fo.properties.LengthRangeProperty;
@@ -33,8 +35,9 @@ import org.apache.fop.fo.properties.Leng
* Class modelling the <a href="http://www.w3.org/TR/xsl/#fo_table-cell">
* <code>fo:table-cell</code></a> object.
*/
-public class TableCell extends TableFObj {
+public class TableCell extends TableFObj implements CommonAccessibilityHolder {
// The value of properties relevant for fo:table-cell.
+ private CommonAccessibility commonAccessibility;
private CommonBorderPaddingBackground commonBorderPaddingBackground;
private LengthRangeProperty blockProgressionDimension;
private int columnNumber;
@@ -46,7 +49,6 @@ public class TableCell extends TableFObj
private int startsRow;
private Length width;
// Unused but valid items, commented out for performance:
- // private CommonAccessibility commonAccessibility;
// private CommonAural commonAural;
// private CommonRelativePosition commonRelativePosition;
// private int relativeAlign;
@@ -74,6 +76,7 @@ public class TableCell extends TableFObj
*/
public void bind(PropertyList pList) throws FOPException {
super.bind(pList);
+ commonAccessibility = CommonAccessibility.getInstance(pList);
commonBorderPaddingBackground = pList.getBorderPaddingBackgroundProps();
blockProgressionDimension = pList.get(PR_BLOCK_PROGRESSION_DIMENSION).getLengthRange();
displayAlign = pList.get(PR_DISPLAY_ALIGN).getEnum();
@@ -145,6 +148,11 @@ public class TableCell extends TableFObj
return true;
}
+ /** {@inheritDoc} */
+ public CommonAccessibility getCommonAccessibility() {
+ return commonAccessibility;
+ }
+
/**
* Get the {@link CommonBorderPaddingBackground} instance
* attached to this TableCell.
Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/table/TableCellContainer.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/table/TableCellContainer.java?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/table/TableCellContainer.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/table/TableCellContainer.java Thu Apr 5 16:19:19 2012
@@ -24,11 +24,17 @@ import java.util.List;
import org.apache.fop.apps.FOPException;
import org.apache.fop.datatypes.Length;
import org.apache.fop.fo.FONode;
+import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.properties.CommonAccessibility;
+import org.apache.fop.fo.properties.CommonAccessibilityHolder;
/**
* A common class for fo:table-body and fo:table-row which both can contain fo:table-cell.
*/
-public abstract class TableCellContainer extends TableFObj implements ColumnNumberManagerHolder {
+public abstract class TableCellContainer extends TableFObj
+ implements ColumnNumberManagerHolder, CommonAccessibilityHolder {
+
+ private CommonAccessibility commonAccessibility;
/** list of pending spans */
protected List pendingSpans;
@@ -44,6 +50,12 @@ public abstract class TableCellContainer
super(parent);
}
+ @Override
+ public void bind(PropertyList pList) throws FOPException {
+ super.bind(pList);
+ commonAccessibility = CommonAccessibility.getInstance(pList);
+ }
+
/**
* Add cell to current row.
* @param cell a table cell to add
@@ -116,4 +128,9 @@ public abstract class TableCellContainer
return columnNumberManager;
}
+ /** {@inheritDoc} */
+ public CommonAccessibility getCommonAccessibility() {
+ return commonAccessibility;
+ }
+
}
Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/table/TableFObj.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/table/TableFObj.java?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/table/TableFObj.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/table/TableFObj.java Thu Apr 5 16:19:19 2012
@@ -36,19 +36,17 @@ import org.apache.fop.fo.properties.Enum
import org.apache.fop.fo.properties.NumberProperty;
import org.apache.fop.fo.properties.Property;
import org.apache.fop.fo.properties.PropertyMaker;
-import org.apache.fop.fo.properties.StructurePointerPropertySet;
import org.apache.fop.layoutmgr.table.CollapsingBorderModel;
/**
* Common base class for table-related FOs
*/
-public abstract class TableFObj extends FObj implements StructurePointerPropertySet {
+public abstract class TableFObj extends FObj {
private Numeric borderAfterPrecedence;
private Numeric borderBeforePrecedence;
private Numeric borderEndPrecedence;
private Numeric borderStartPrecedence;
- private String ptr;
ConditionalBorder borderBefore; // CSOK: VisibilityModifier
ConditionalBorder borderAfter; // CSOK: VisibilityModifier
@@ -74,7 +72,6 @@ public abstract class TableFObj extends
borderBeforePrecedence = pList.get(PR_BORDER_BEFORE_PRECEDENCE).getNumeric();
borderEndPrecedence = pList.get(PR_BORDER_END_PRECEDENCE).getNumeric();
borderStartPrecedence = pList.get(PR_BORDER_START_PRECEDENCE).getNumeric();
- ptr = pList.get(PR_X_PTR).getString();
if (getNameId() != FO_TABLE //Separate check for fo:table in Table.java
&& getNameId() != FO_TABLE_CELL
&& getCommonBorderPaddingBackground().hasPadding(
@@ -241,11 +238,6 @@ public abstract class TableFObj extends
}
}
- /** {@inheritDoc} */
- public String getPtr() {
- return ptr;
- }
-
/**
* Prepares the borders of this element if the collapsing-border model is in use.
* Conflict resolution with parent elements is done where applicable.
Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/table/VariableColRowGroupBuilder.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/table/VariableColRowGroupBuilder.java?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/table/VariableColRowGroupBuilder.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/flow/table/VariableColRowGroupBuilder.java Thu Apr 5 16:19:19 2012
@@ -40,7 +40,7 @@ class VariableColRowGroupBuilder extends
* Each event is recorded and will be played once the table is finished, and the final
* number of columns known.
*/
- private static interface Event {
+ private interface Event {
/**
* Plays this event
*
Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/pagination/AbstractPageSequence.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/pagination/AbstractPageSequence.java?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/pagination/AbstractPageSequence.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/pagination/AbstractPageSequence.java Thu Apr 5 16:19:19 2012
@@ -43,6 +43,9 @@ public abstract class AbstractPageSequen
private char groupingSeparator;
private int groupingSize;
private Numeric referenceOrientation; //XSL 1.1
+ private String language;
+ private String country;
+ private String numberConversionFeatures;
// End of property values
private PageNumberGenerator pageNumberGenerator;
@@ -70,12 +73,16 @@ public abstract class AbstractPageSequen
groupingSeparator = pList.get(PR_GROUPING_SEPARATOR).getCharacter();
groupingSize = pList.get(PR_GROUPING_SIZE).getNumber().intValue();
referenceOrientation = pList.get(PR_REFERENCE_ORIENTATION).getNumeric();
+ language = pList.get(PR_LANGUAGE).getString();
+ country = pList.get(PR_COUNTRY).getString();
+ numberConversionFeatures = pList.get(PR_X_NUMBER_CONVERSION_FEATURES).getString();
}
/** {@inheritDoc} */
protected void startOfNode() throws FOPException {
this.pageNumberGenerator = new PageNumberGenerator(
- format, groupingSeparator, groupingSize, letterValue);
+ format, groupingSeparator, groupingSize, letterValue,
+ numberConversionFeatures, language, country);
}
Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/pagination/ColorProfile.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/pagination/ColorProfile.java?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/pagination/ColorProfile.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/pagination/ColorProfile.java Thu Apr 5 16:19:19 2012
@@ -19,14 +19,14 @@
package org.apache.fop.fo.pagination;
+import org.xml.sax.Locator;
+
import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.ValidationException;
-import org.xml.sax.Locator;
-
/**
* Class modelling the <a href="http://www.w3.org/TR/xsl/#fo_color-profile">
* <code>fo:color-profile</code></a> object.
Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/pagination/ConditionalPageMasterReference.java Thu Apr 5 16:19:19 2012
@@ -27,6 +27,7 @@ import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.ValidationException;
+import org.apache.fop.layoutmgr.BlockLevelEventProducer;
/**
* Class modelling the <a href="http://www.w3.org/TR/xsl/#fo_conditional-page-master-reference">
@@ -41,6 +42,8 @@ import org.apache.fop.fo.ValidationExcep
public class ConditionalPageMasterReference extends FObj {
// The value of properties relevant for fo:conditional-page-master-reference.
private String masterReference;
+ // The simple page master referenced
+ private SimplePageMaster master;
private int pagePosition;
private int oddOrEven;
private int blankOrNotBlank;
@@ -127,8 +130,8 @@ public class ConditionalPageMasterRefere
* Get the value for the <code>master-reference</code> property.
* @return the "master-reference" property
*/
- public String getMasterReference() {
- return masterReference;
+ public SimplePageMaster getMaster() {
+ return master;
}
/**
@@ -151,4 +154,19 @@ public class ConditionalPageMasterRefere
public int getNameId() {
return FO_CONDITIONAL_PAGE_MASTER_REFERENCE;
}
+
+ /**
+ * called by the parent RepeatablePageMasterAlternatives to resolve object references
+ * from simple page master reference names
+ * @param layoutMasterSet the layout-master-set
+ * @throws ValidationException when a named reference cannot be resolved
+ * */
+ public void resolveReferences(LayoutMasterSet layoutMasterSet) throws ValidationException {
+ master = layoutMasterSet.getSimplePageMaster(masterReference);
+ if (master == null) {
+ BlockLevelEventProducer.Provider.get(
+ getUserAgent().getEventBroadcaster())
+ .noMatchingPageMaster(this, parent.getName(), masterReference, getLocator());
+ }
+ }
}
Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/pagination/Declarations.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/pagination/Declarations.java?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/pagination/Declarations.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/pagination/Declarations.java Thu Apr 5 16:19:19 2012
@@ -41,7 +41,7 @@ import org.apache.fop.fo.ValidationExcep
*/
public class Declarations extends FObj {
- private Map colorProfiles = null;
+ private Map<String, ColorProfile> colorProfiles = null;
/**
* @param parent FONode that is the parent of this object
@@ -98,7 +98,7 @@ public class Declarations extends FObj {
private void addColorProfile(ColorProfile cp) {
if (colorProfiles == null) {
- colorProfiles = new java.util.HashMap();
+ colorProfiles = new java.util.HashMap<String, ColorProfile>();
}
if (colorProfiles.get(cp.getColorProfileName()) != null) {
// duplicate names
@@ -132,7 +132,7 @@ public class Declarations extends FObj {
public ColorProfile getColorProfile(String cpName) {
ColorProfile profile = null;
if (this.colorProfiles != null) {
- profile = (ColorProfile)this.colorProfiles.get(cpName);
+ profile = this.colorProfiles.get(cpName);
}
return profile;
}
Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java Thu Apr 5 16:19:19 2012
@@ -20,7 +20,6 @@
package org.apache.fop.fo.pagination;
// Java
-import java.util.Iterator;
import java.util.Map;
import org.xml.sax.Locator;
@@ -44,8 +43,8 @@ import org.apache.fop.fo.ValidationExcep
*/
public class LayoutMasterSet extends FObj {
- private Map simplePageMasters;
- private Map pageSequenceMasters;
+ private Map<String, SimplePageMaster> simplePageMasters;
+ private Map<String, PageSequenceMaster> pageSequenceMasters;
/**
* Create a LayoutMasterSet instance that is a child of the given
@@ -65,8 +64,8 @@ public class LayoutMasterSet extends FOb
/** {@inheritDoc} */
protected void startOfNode() throws FOPException {
getRoot().setLayoutMasterSet(this);
- simplePageMasters = new java.util.HashMap();
- pageSequenceMasters = new java.util.HashMap();
+ simplePageMasters = new java.util.HashMap<String, SimplePageMaster>();
+ pageSequenceMasters = new java.util.HashMap<String, PageSequenceMaster>();
}
/** {@inheritDoc} */
@@ -75,6 +74,7 @@ public class LayoutMasterSet extends FOb
missingChildElementError("(simple-page-master|page-sequence-master)+");
}
checkRegionNames();
+ resolveSubSequenceReferences();
}
/**
@@ -98,18 +98,13 @@ public class LayoutMasterSet extends FOb
*/
private void checkRegionNames() throws ValidationException {
// (user-entered) region-name to default region map.
- Map allRegions = new java.util.HashMap();
- for (Iterator spm = simplePageMasters.values().iterator();
- spm.hasNext();) {
- SimplePageMaster simplePageMaster
- = (SimplePageMaster)spm.next();
- Map spmRegions = simplePageMaster.getRegions();
- for (Iterator e = spmRegions.values().iterator();
- e.hasNext();) {
- Region region = (Region) e.next();
+ Map<String, String> allRegions = new java.util.HashMap<String, String>();
+ for (SimplePageMaster simplePageMaster : simplePageMasters.values()) {
+ Map<String, Region> spmRegions = simplePageMaster.getRegions();
+ for (Region region : spmRegions.values()) {
if (allRegions.containsKey(region.getRegionName())) {
String defaultRegionName
- = (String) allRegions.get(region.getRegionName());
+ = allRegions.get(region.getRegionName());
if (!defaultRegionName.equals(region.getDefaultRegionName())) {
getFOValidationEventProducer().regionNameMappedToMultipleRegionClasses(this,
region.getRegionName(),
@@ -118,7 +113,15 @@ public class LayoutMasterSet extends FOb
}
}
allRegions.put(region.getRegionName(),
- region.getDefaultRegionName());
+ region.getDefaultRegionName());
+ }
+ }
+ }
+
+ private void resolveSubSequenceReferences() throws ValidationException {
+ for (PageSequenceMaster psm : pageSequenceMasters.values()) {
+ for (SubSequenceSpecifier subSequenceSpecifier : psm.getSubSequenceSpecifier()) {
+ subSequenceSpecifier.resolveReferences(this);
}
}
}
@@ -155,7 +158,7 @@ public class LayoutMasterSet extends FOb
* @return the requested simple-page-master
*/
public SimplePageMaster getSimplePageMaster(String masterName) {
- return (SimplePageMaster)this.simplePageMasters.get(masterName);
+ return simplePageMasters.get(masterName);
}
/**
@@ -185,7 +188,7 @@ public class LayoutMasterSet extends FOb
* @return the requested PageSequenceMaster instance
*/
public PageSequenceMaster getPageSequenceMaster(String masterName) {
- return (PageSequenceMaster)this.pageSequenceMasters.get(masterName);
+ return this.pageSequenceMasters.get(masterName);
}
/**
@@ -194,9 +197,8 @@ public class LayoutMasterSet extends FOb
* @return true when the region name specified has a region in this LayoutMasterSet
*/
public boolean regionNameExists(String regionName) {
- for (Iterator e = simplePageMasters.values().iterator();
- e.hasNext();) {
- if (((SimplePageMaster)e.next()).regionNameExists(regionName)) {
+ for (SimplePageMaster spm : simplePageMasters.values()) {
+ if (spm.regionNameExists(regionName)) {
return true;
}
}
Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/pagination/PageNumberGenerator.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/pagination/PageNumberGenerator.java?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/pagination/PageNumberGenerator.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/pagination/PageNumberGenerator.java Thu Apr 5 16:19:19 2012
@@ -19,84 +19,38 @@
package org.apache.fop.fo.pagination;
+import org.apache.fop.complexscripts.util.NumberConverter;
+
+// CSOFF: LineLengthCheck
+
/**
- * This class uses the 'format', 'groupingSeparator', 'groupingSize',
+ * <p>This class uses the 'format', 'groupingSeparator', 'groupingSize',
* and 'letterValue' properties on fo:page-sequence to return a String
- * corresponding to the supplied integer page number.
+ * corresponding to the supplied integer page number.</p>
+ *
+ * <p>In addition, (now) uses 'language' parameter and new 'fox:page-number-features'
+ * parameter to express applicable language and number conversion features.</p>
+ *
+ * <p>This work was authored by Glenn Adams (gadams@apache.org), based on a
+ * rewrite of prior work to use the new <code>NumberConverter</code> utility class.</p>
+ * @see NumberConverter
*/
public class PageNumberGenerator {
- private String format;
- private char groupingSeparator;
- private int groupingSize;
- private int letterValue;
-
- // constants
- private static final int DECIMAL = 1; // '0*1'
- private static final int LOWERALPHA = 2; // 'a'
- private static final int UPPERALPHA = 3; // 'A'
- private static final int LOWERROMAN = 4; // 'i'
- private static final int UPPERROMAN = 5; // 'I'
-
- // flags
- private int formatType = DECIMAL;
- private int minPadding = 0; // for decimal formats
-
- // preloaded strings of zeros
- private String[] zeros = {
- "", "0", "00", "000", "0000", "00000"
- };
+ private NumberConverter converter;
/**
- * Main constructor. For further information on the parameters see the XSLT
- * specs (Number to String Conversion Attributes).
- * @param format format for the page number
- * @param groupingSeparator grouping separator
- * @param groupingSize grouping size
+ * Main constructor. For further information on the parameters see {@link NumberConverter}.
+ * @param format format for the page number (may be null or empty, which is treated as null)
+ * @param groupingSeparator grouping separator (if zero, then no grouping separator applies)
+ * @param groupingSize grouping size (if zero or negative, then no grouping size applies)
* @param letterValue letter value
+ * @param features features (feature sub-parameters)
+ * @param language (may be null or empty, which is treated as null)
+ * @param country (may be null or empty, which is treated as null)
*/
- public PageNumberGenerator(String format, char groupingSeparator,
- int groupingSize, int letterValue) {
- this.format = format;
- this.groupingSeparator = groupingSeparator;
- this.groupingSize = groupingSize;
- this.letterValue = letterValue;
-
- // the only accepted format strings are currently '0*1' 'a', 'A', 'i'
- // and 'I'
- int fmtLen = format.length();
- if (fmtLen == 1) {
- if (format.equals("1")) {
- formatType = DECIMAL;
- minPadding = 0;
- } else if (format.equals("a")) {
- formatType = LOWERALPHA;
- } else if (format.equals("A")) {
- formatType = UPPERALPHA;
- } else if (format.equals("i")) {
- formatType = LOWERROMAN;
- } else if (format.equals("I")) {
- formatType = UPPERROMAN;
- } else {
- // token not handled
- //getLogger().debug("'format' token not recognized; using '1'");
- formatType = DECIMAL;
- minPadding = 0;
- }
- } else {
- // only accepted token is '0+1'at this stage. Because of the
- // wonderful regular expression support in Java, we will resort to a
- // loop
- for (int i = 0; i < fmtLen - 1; i++) {
- if (format.charAt(i) != '0') {
- //getLogger().debug("'format' token not recognized; using '1'");
- formatType = DECIMAL;
- minPadding = 0;
- } else {
- minPadding = fmtLen - 1;
- }
- }
- }
+ public PageNumberGenerator ( String format, int groupingSeparator, int groupingSize, int letterValue, String features, String language, String country ) {
+ this.converter = new NumberConverter ( format, groupingSeparator, groupingSize, letterValue, features, language, country );
}
/**
@@ -104,70 +58,9 @@ public class PageNumberGenerator {
* @param number page number to format
* @return the formatted page number as a String
*/
- public String makeFormattedPageNumber(int number) {
- String pn = null;
- if (formatType == DECIMAL) {
- pn = Integer.toString(number);
- if (minPadding >= pn.length()) {
- int nz = minPadding - pn.length() + 1;
- pn = zeros[nz] + pn;
- }
- } else if ((formatType == LOWERROMAN) || (formatType == UPPERROMAN)) {
- pn = makeRoman(number);
- if (formatType == UPPERROMAN) {
- pn = pn.toUpperCase();
- }
- } else {
- // alphabetic
- pn = makeAlpha(number);
- if (formatType == UPPERALPHA) {
- pn = pn.toUpperCase();
- }
- }
- return pn;
+ public String makeFormattedPageNumber ( int number ) {
+ return converter.convert ( number );
}
- private String makeRoman(int num) {
- int[] arabic = {
- 1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1
- };
- String[] roman = {
- "m", "cm", "d", "cd", "c", "xc", "l", "xl", "x", "ix", "v", "iv",
- "i"
- };
-
- int i = 0;
- StringBuffer romanNumber = new StringBuffer();
-
- while (num > 0) {
- while (num >= arabic[i]) {
- num = num - arabic[i];
- romanNumber.append(roman[i]);
- }
- i = i + 1;
- }
- return romanNumber.toString();
- }
-
- private String makeAlpha(int num) {
- String letters = "abcdefghijklmnopqrstuvwxyz";
- StringBuffer alphaNumber = new StringBuffer();
-
- int base = 26;
- int rem = 0;
-
- num--;
- if (num < base) {
- alphaNumber.append(letters.charAt(num));
- } else {
- while (num >= base) {
- rem = num % base;
- alphaNumber.append(letters.charAt(rem));
- num = num / base;
- }
- alphaNumber.append(letters.charAt(num - 1));
- }
- return alphaNumber.reverse().toString();
- }
}
Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/pagination/PageProductionException.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/pagination/PageProductionException.java?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/pagination/PageProductionException.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/pagination/PageProductionException.java Thu Apr 5 16:19:19 2012
@@ -25,8 +25,8 @@ import org.xml.sax.Locator;
import org.xml.sax.helpers.LocatorImpl;
import org.apache.fop.events.Event;
-import org.apache.fop.events.EventFormatter;
import org.apache.fop.events.EventExceptionManager.ExceptionFactory;
+import org.apache.fop.events.EventFormatter;
/**
* Exception thrown by FOP if there is a problem while producing new pages.
@@ -38,6 +38,15 @@ public class PageProductionException ext
private String localizedMessage;
private Locator locator;
+
+ /**
+ * Creates a new PageProductionException.
+ * @param message the message
+ */
+ public PageProductionException(String message) {
+ super(message);
+ }
+
/**
* Creates a new PageProductionException.
* @param message the message
@@ -48,12 +57,13 @@ public class PageProductionException ext
setLocator(locator);
}
+
/**
* Set a location associated with the exception.
* @param locator the locator holding the location.
*/
public void setLocator(Locator locator) {
- this.locator = new LocatorImpl(locator);
+ this.locator = locator != null ? new LocatorImpl(locator) : null;
}
@@ -98,7 +108,7 @@ public class PageProductionException ext
}
/** {@inheritDoc} */
- public Class getExceptionClass() {
+ public Class<PageProductionException> getExceptionClass() {
return PageProductionException.class;
}
Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/pagination/PageSequence.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/pagination/PageSequence.java?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/pagination/PageSequence.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/pagination/PageSequence.java Thu Apr 5 16:19:19 2012
@@ -19,28 +19,35 @@
package org.apache.fop.fo.pagination;
-// Java
import java.util.Map;
+import java.util.Stack;
import org.xml.sax.Locator;
import org.apache.fop.apps.FOPException;
+import org.apache.fop.complexscripts.bidi.DelimitedTextRange;
+import org.apache.fop.datatypes.Numeric;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.ValidationException;
+import org.apache.fop.traits.Direction;
+import org.apache.fop.traits.WritingMode;
+import org.apache.fop.traits.WritingModeTraits;
+import org.apache.fop.traits.WritingModeTraitsGetter;
/**
* Class modelling the <a href="http://www.w3.org/TR/xsl/#fo_page-sequence">
* <code>fo:page-sequence</code></a> object.
*/
-public class PageSequence extends AbstractPageSequence {
+public class PageSequence extends AbstractPageSequence implements WritingModeTraitsGetter {
- // The value of properties relevant for fo:page-sequence.
+ // The value of FO traits (refined properties) that apply to fo:page-sequence.
private String country;
private String language;
private String masterReference;
- //private int writingMode; //XSL 1.1
- // End of property values
+ private Numeric referenceOrientation;
+ private WritingModeTraits writingModeTraits;
+ // End of trait values
// There doesn't seem to be anything in the spec requiring flows
// to be in the order given, only that they map to the regions
@@ -48,7 +55,7 @@ public class PageSequence extends Abstra
// the set of flows includes StaticContent flows also
/** Map of flows to their flow name (flow-name, Flow) */
- private Map/*<String, Flow>*/ flowMap;
+ private Map<String, FONode> flowMap;
/**
* The currentSimplePageMaster is either the page master for the
@@ -86,8 +93,9 @@ public class PageSequence extends Abstra
country = pList.get(PR_COUNTRY).getString();
language = pList.get(PR_LANGUAGE).getString();
masterReference = pList.get(PR_MASTER_REFERENCE).getString();
- //writingMode = pList.getWritingMode();
-
+ referenceOrientation = pList.get(PR_REFERENCE_ORIENTATION).getNumeric();
+ writingModeTraits = new WritingModeTraits
+ ( WritingMode.valueOf(pList.get(PR_WRITING_MODE).getEnum()) );
if (masterReference == null || masterReference.equals("")) {
missingPropertyError("master-reference");
}
@@ -96,7 +104,7 @@ public class PageSequence extends Abstra
/** {@inheritDoc} */
protected void startOfNode() throws FOPException {
super.startOfNode();
- flowMap = new java.util.HashMap/*<String, Flow>*/();
+ flowMap = new java.util.HashMap<String, FONode>();
this.simplePageMaster
= getRoot().getLayoutMasterSet().getSimplePageMaster(masterReference);
@@ -167,7 +175,7 @@ public class PageSequence extends Abstra
break;
case FO_STATIC_CONTENT:
addFlow((StaticContent)child);
- flowMap.put(((StaticContent)child).getFlowName(), child);
+ flowMap.put(((Flow)child).getFlowName(), (Flow)child);
break;
default:
super.addChildNode(child);
@@ -239,7 +247,7 @@ public class PageSequence extends Abstra
}
/** @return the flow map for this page-sequence */
- public Map getFlowMap() {
+ public Map<String, FONode> getFlowMap() {
return this.flowMap;
}
@@ -270,7 +278,7 @@ public class PageSequence extends Abstra
+ " isBlank=" + isBlank + ")");
}
return pageSequenceMaster.getNextSimplePageMaster(isOddPage,
- isFirstPage, isLastPage, isBlank);
+ isFirstPage, isLastPage, isBlank, getMainFlow().getFlowName());
}
/**
@@ -292,8 +300,8 @@ public class PageSequence extends Abstra
}
/**
- * Get the value of the <code>master-reference</code> property.
- * @return the "master-reference" property
+ * Get the value of the <code>master-reference</code> trait.
+ * @return the "master-reference" trait
*/
public String getMasterReference() {
return masterReference;
@@ -313,22 +321,120 @@ public class PageSequence extends Abstra
}
/**
- * Get the value of the <code>country</code> property.
- * @return the country property value
+ * Get the value of the <code>country</code> trait.
+ * @return the country trait value
*/
public String getCountry() {
return this.country;
}
/**
- * Get the value of the <code>language</code> property.
- * @return the language property value
+ * Get the value of the <code>language</code> trait.
+ * @return the language trait value
*/
public String getLanguage() {
return this.language;
}
/**
+ * Get the value of the <code>reference-orientation</code> trait.
+ * @return the reference orientation trait value
+ */
+ public int getReferenceOrientation() {
+ if ( referenceOrientation != null ) {
+ return referenceOrientation.getValue();
+ } else {
+ return 0;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Direction getInlineProgressionDirection() {
+ if ( writingModeTraits != null ) {
+ return writingModeTraits.getInlineProgressionDirection();
+ } else {
+ return Direction.LR;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Direction getBlockProgressionDirection() {
+ if ( writingModeTraits != null ) {
+ return writingModeTraits.getBlockProgressionDirection();
+ } else {
+ return Direction.TB;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Direction getColumnProgressionDirection() {
+ if ( writingModeTraits != null ) {
+ return writingModeTraits.getColumnProgressionDirection();
+ } else {
+ return Direction.LR;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Direction getRowProgressionDirection() {
+ if ( writingModeTraits != null ) {
+ return writingModeTraits.getRowProgressionDirection();
+ } else {
+ return Direction.TB;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public Direction getShiftDirection() {
+ if ( writingModeTraits != null ) {
+ return writingModeTraits.getShiftDirection();
+ } else {
+ return Direction.TB;
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public WritingMode getWritingMode() {
+ if ( writingModeTraits != null ) {
+ return writingModeTraits.getWritingMode();
+ } else {
+ return WritingMode.LR_TB;
+ }
+ }
+
+
+ @Override
+ protected Stack collectDelimitedTextRanges ( Stack ranges, DelimitedTextRange currentRange ) {
+ // collect ranges from static content flows
+ Map<String, FONode> flows = getFlowMap();
+ if ( flows != null ) {
+ for ( FONode fn : flows.values() ) {
+ if ( fn instanceof StaticContent ) {
+ ranges = ( (StaticContent) fn ).collectDelimitedTextRanges ( ranges );
+ }
+ }
+ }
+ // collect ranges in main flow
+ Flow main = getMainFlow();
+ if ( main != null ) {
+ ranges = main.collectDelimitedTextRanges ( ranges );
+ }
+ return ranges;
+ }
+
+ /**
* Releases a page-sequence's children after the page-sequence has been fully processed.
*/
public void releasePageSequence() {
Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/pagination/PageSequenceMaster.java Thu Apr 5 16:19:19 2012
@@ -20,6 +20,7 @@
package org.apache.fop.fo.pagination;
// Java
+import java.util.Collections;
import java.util.List;
import org.xml.sax.Locator;
@@ -44,9 +45,10 @@ public class PageSequenceMaster extends
// End of property values
private LayoutMasterSet layoutMasterSet;
- private List subSequenceSpecifiers;
+ private List<SubSequenceSpecifier> subSequenceSpecifiers;
private SubSequenceSpecifier currentSubSequence;
private int currentSubSequenceNumber = -1;
+ private BlockLevelEventProducer blockLevelEventProducer;
// The terminology may be confusing. A 'page-sequence-master' consists
// of a sequence of what the XSL spec refers to as
@@ -60,9 +62,11 @@ public class PageSequenceMaster extends
* given {@link FONode}.
*
* @param parent {@link FONode} that is the parent of this object
+ * @param blockLevelEventProducer event producer
*/
- public PageSequenceMaster(FONode parent) {
+ public PageSequenceMaster(FONode parent, BlockLevelEventProducer blockLevelEventProducer) {
super(parent);
+ this.blockLevelEventProducer = blockLevelEventProducer;
}
/** {@inheritDoc} */
@@ -76,7 +80,7 @@ public class PageSequenceMaster extends
/** {@inheritDoc} */
protected void startOfNode() throws FOPException {
- subSequenceSpecifiers = new java.util.ArrayList();
+ subSequenceSpecifiers = new java.util.ArrayList<SubSequenceSpecifier>();
layoutMasterSet = parent.getRoot().getLayoutMasterSet();
layoutMasterSet.addPageSequenceMaster(masterName, this);
}
@@ -121,12 +125,15 @@ public class PageSequenceMaster extends
currentSubSequenceNumber++;
if (currentSubSequenceNumber >= 0
&& currentSubSequenceNumber < subSequenceSpecifiers.size()) {
- return (SubSequenceSpecifier)subSequenceSpecifiers
- .get(currentSubSequenceNumber);
+ return subSequenceSpecifiers.get(currentSubSequenceNumber);
}
return null;
}
+ List<SubSequenceSpecifier> getSubSequenceSpecifier() {
+ return Collections.unmodifiableList(subSequenceSpecifiers);
+ }
+
/**
* Resets the subsequence specifiers subsystem.
*/
@@ -134,8 +141,8 @@ public class PageSequenceMaster extends
currentSubSequenceNumber = -1;
currentSubSequence = null;
if (subSequenceSpecifiers != null) {
- for (int i = 0; i < subSequenceSpecifiers.size(); i++) {
- ((SubSequenceSpecifier)subSequenceSpecifiers.get(i)).reset();
+ for (SubSequenceSpecifier subSequenceSpecifier : subSequenceSpecifiers) {
+ subSequenceSpecifier.reset();
}
}
}
@@ -150,7 +157,7 @@ public class PageSequenceMaster extends
if (!success) {
if (currentSubSequenceNumber > 0) {
currentSubSequenceNumber--;
- currentSubSequence = (SubSequenceSpecifier)subSequenceSpecifiers
+ currentSubSequence = subSequenceSpecifiers
.get(currentSubSequenceNumber);
} else {
currentSubSequence = null;
@@ -178,52 +185,58 @@ public class PageSequenceMaster extends
* @param isFirstPage True if the next page is the first
* @param isLastPage True if the next page is the last
* @param isBlankPage True if the next page is blank
+ * @param mainFlowName the name of the main flow of the page sequence
* @return the requested page master
* @throws PageProductionException if there's a problem determining the next page master
*/
public SimplePageMaster getNextSimplePageMaster(boolean isOddPage,
boolean isFirstPage,
boolean isLastPage,
- boolean isBlankPage)
+ boolean isBlankPage,
+ String mainFlowName)
throws PageProductionException {
if (currentSubSequence == null) {
currentSubSequence = getNextSubSequence();
if (currentSubSequence == null) {
- BlockLevelEventProducer eventProducer = BlockLevelEventProducer.Provider.get(
- getUserAgent().getEventBroadcaster());
- eventProducer.missingSubsequencesInPageSequenceMaster(this,
+ blockLevelEventProducer.missingSubsequencesInPageSequenceMaster(this,
masterName, getLocator());
}
+ if (currentSubSequence.isInfinite() && !currentSubSequence.canProcess(mainFlowName)) {
+ throw new PageProductionException(
+ "The current sub-sequence will not terminate whilst processing then main flow");
+ }
}
- String pageMasterName = currentSubSequence
- .getNextPageMasterName(isOddPage, isFirstPage, isLastPage, isBlankPage);
+
+ SimplePageMaster pageMaster = currentSubSequence
+ .getNextPageMaster(isOddPage, isFirstPage, isLastPage, isBlankPage);
+
boolean canRecover = true;
- while (pageMasterName == null) {
+
+ while (pageMaster == null) {
SubSequenceSpecifier nextSubSequence = getNextSubSequence();
+
if (nextSubSequence == null) {
- BlockLevelEventProducer eventProducer = BlockLevelEventProducer.Provider.get(
- getUserAgent().getEventBroadcaster());
- eventProducer.pageSequenceMasterExhausted(this,
- masterName, canRecover, getLocator());
+ //Sub-sequence exhausted so attempt to reuse it
+ blockLevelEventProducer.pageSequenceMasterExhausted(this,
+ masterName, canRecover & currentSubSequence.isReusable(), getLocator());
currentSubSequence.reset();
+ if (!currentSubSequence.canProcess(mainFlowName)) {
+ throw new PageProductionException(
+ "The last simple-page-master does not reference the main flow");
+ }
canRecover = false;
} else {
currentSubSequence = nextSubSequence;
}
- pageMasterName = currentSubSequence
- .getNextPageMasterName(isOddPage, isFirstPage, isLastPage, isBlankPage);
- }
- SimplePageMaster pageMaster = this.layoutMasterSet
- .getSimplePageMaster(pageMasterName);
- if (pageMaster == null) {
- BlockLevelEventProducer eventProducer = BlockLevelEventProducer.Provider.get(
- getUserAgent().getEventBroadcaster());
- eventProducer.noMatchingPageMaster(this,
- masterName, pageMasterName, getLocator());
+
+ pageMaster = currentSubSequence
+ .getNextPageMaster(isOddPage, isFirstPage, isLastPage, isBlankPage);
}
+
return pageMaster;
}
+
/** {@inheritDoc} */
public String getLocalName() {
return "page-sequence-master";
@@ -236,5 +249,7 @@ public class PageSequenceMaster extends
public int getNameId() {
return FO_PAGE_SEQUENCE_MASTER;
}
+
+
}
Modified: xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/pagination/PageSequenceWrapper.java
URL: http://svn.apache.org/viewvc/xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/pagination/PageSequenceWrapper.java?rev=1309921&r1=1309920&r2=1309921&view=diff
==============================================================================
--- xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/pagination/PageSequenceWrapper.java (original)
+++ xmlgraphics/fop/branches/Temp_TrueTypeInPostScript/src/java/org/apache/fop/fo/pagination/PageSequenceWrapper.java Thu Apr 5 16:19:19 2012
@@ -22,8 +22,8 @@ package org.apache.fop.fo.pagination;
import org.xml.sax.Locator;
import org.apache.fop.apps.FOPException;
-import org.apache.fop.fo.FObj;
import org.apache.fop.fo.FONode;
+import org.apache.fop.fo.FObj;
import org.apache.fop.fo.PropertyList;
import org.apache.fop.fo.ValidationException;
---------------------------------------------------------------------
To unsubscribe, e-mail: fop-commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: fop-commits-help@xmlgraphics.apache.org