gmazza 2004/09/04 21:00:53
Modified: src/java/org/apache/fop/area AreaTreeHandler.java
src/java/org/apache/fop/fo FOInputHandler.java FONode.java
FOTreeBuilder.java FObj.java FObjMixed.java
XMLObj.java
src/java/org/apache/fop/fo/flow Block.java Table.java
src/java/org/apache/fop/fo/pagination Flow.java
LayoutMasterSet.java PageSequence.java
RegionBA.java RegionEnd.java
RepeatablePageMasterReference.java
src/java/org/apache/fop/layoutmgr PageLayoutManager.java
src/java/org/apache/fop/render/mif MIFHandler.java
src/java/org/apache/fop/render/rtf RTFHandler.java
Log:
1.) AddChildNode(), characters() modified to throw SAXParseException to
allow AddChildNode() to do validation of its own.
2.) Better child validation added to PageSequence.java.
3.) Various other code cleanups.
Revision Changes Path
1.6 +3 -5 xml-fop/src/java/org/apache/fop/area/AreaTreeHandler.java
Index: AreaTreeHandler.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/area/AreaTreeHandler.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- AreaTreeHandler.java 26 Aug 2004 20:58:30 -0000 1.5
+++ AreaTreeHandler.java 5 Sep 2004 04:00:51 -0000 1.6
@@ -351,8 +351,7 @@
* @param pageSequence the page sequence ending
* @throws FOPException if there is an error formatting the pages
*/
- public void endPageSequence(PageSequence pageSequence)
- throws FOPException {
+ public void endPageSequence(PageSequence pageSequence) {
//areaTree.setFontInfo(fontInfo);
if (collectStatistics) {
@@ -377,8 +376,7 @@
* @param areaTree the area tree to format this page sequence into
* @throws FOPException if there is an error formatting the contents
*/
- private void formatPageSequence(PageSequence pageSeq)
- throws FOPException {
+ private void formatPageSequence(PageSequence pageSeq) {
Title title = null;
if (pageSeq.getTitleFO() != null) {
title = getTitleArea(pageSeq.getTitleFO());
1.24 +2 -4 xml-fop/src/java/org/apache/fop/fo/FOInputHandler.java
Index: FOInputHandler.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/FOInputHandler.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- FOInputHandler.java 13 Jul 2004 00:16:22 -0000 1.23
+++ FOInputHandler.java 5 Sep 2004 04:00:51 -0000 1.24
@@ -144,11 +144,9 @@
}
/**
- *
* @param pageSeq PageSequence that is ending.
- * @throws FOPException For errors encountered.
*/
- public void endPageSequence(PageSequence pageSeq) throws FOPException {
+ public void endPageSequence(PageSequence pageSeq) {
}
/**
1.42 +3 -3 xml-fop/src/java/org/apache/fop/fo/FONode.java
Index: FONode.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/FONode.java,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -r1.41 -r1.42
--- FONode.java 4 Sep 2004 20:55:20 -0000 1.41
+++ FONode.java 5 Sep 2004 04:00:51 -0000 1.42
@@ -66,7 +66,7 @@
* Set the location information for this element
* @param locator the org.xml.sax.Locator object
*/
- public void setLocation(Locator locator) {
+ public void setLocator(Locator locator) {
if (locator != null) {
this.locator = locator;
}
@@ -130,7 +130,7 @@
* @param locator location in fo source file.
*/
protected void addCharacters(char data[], int start, int length,
- Locator locator) {
+ Locator locator) throws SAXParseException {
// ignore
}
@@ -151,7 +151,7 @@
/**
* @param child child node to be added to the childNodes of this node
*/
- protected void addChildNode(FONode child) {
+ protected void addChildNode(FONode child) throws SAXParseException {
}
/**
1.46 +5 -4 xml-fop/src/java/org/apache/fop/fo/FOTreeBuilder.java
Index: FOTreeBuilder.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/FOTreeBuilder.java,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -r1.45 -r1.46
--- FOTreeBuilder.java 1 Aug 2004 04:20:48 -0000 1.45
+++ FOTreeBuilder.java 5 Sep 2004 04:00:51 -0000 1.46
@@ -204,10 +204,11 @@
* SAX Handler for characters
* @see org.xml.sax.ContentHandler#characters(char[], int, int)
*/
- public void characters(char[] data, int start, int length) {
- if (currentFObj != null) {
- currentFObj.addCharacters(data, start, start + length, locator);
- }
+ public void characters(char[] data, int start, int length)
+ throws SAXParseException {
+ if (currentFObj != null) {
+ currentFObj.addCharacters(data, start, start + length, locator);
+ }
}
/**
1.74 +2 -2 xml-fop/src/java/org/apache/fop/fo/FObj.java
Index: FObj.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/FObj.java,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -r1.73 -r1.74
--- FObj.java 4 Sep 2004 20:55:20 -0000 1.73
+++ FObj.java 5 Sep 2004 04:00:52 -0000 1.74
@@ -102,7 +102,7 @@
*/
public void processNode(String elementName, Locator locator,
Attributes attlist) throws SAXParseException {
- setLocation(locator);
+ setLocator(locator);
addProperties(attlist);
}
@@ -225,7 +225,7 @@
/**
* @see org.apache.fop.fo.FONode#addChildNode(FONode)
*/
- protected void addChildNode(FONode child) {
+ protected void addChildNode(FONode child) throws SAXParseException {
if (PropertySets.canHaveMarkers(getNameId()) &&
child.getNameId() == FO_MARKER) {
addMarker((Marker) child);
1.36 +3 -2 xml-fop/src/java/org/apache/fop/fo/FObjMixed.java
Index: FObjMixed.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/FObjMixed.java,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -r1.35 -r1.36
--- FObjMixed.java 26 Aug 2004 20:58:30 -0000 1.35
+++ FObjMixed.java 5 Sep 2004 04:00:52 -0000 1.36
@@ -20,6 +20,7 @@
import java.util.List;
import org.xml.sax.Locator;
+import org.xml.sax.SAXParseException;
import org.apache.fop.layoutmgr.LMiter;
import org.apache.fop.layoutmgr.InlineStackingLayoutManager;
@@ -46,7 +47,7 @@
* @param locator location in fo source file.
*/
protected void addCharacters(char data[], int start, int length,
- Locator locator) {
+ Locator locator) throws SAXParseException {
if (textInfo == null) {
// Really only need one of these, but need to get fontInfo
// stored in propMgr for later use.
@@ -55,7 +56,7 @@
}
FOText ft = new FOText(data, start, length, textInfo, this);
- ft.setLocation(locator);
+ ft.setLocator(locator);
getFOInputHandler().characters(ft.ca, ft.startIndex, ft.endIndex);
addChildNode(ft);
1.17 +1 -1 xml-fop/src/java/org/apache/fop/fo/XMLObj.java
Index: XMLObj.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/XMLObj.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- XMLObj.java 27 Aug 2004 05:36:43 -0000 1.16
+++ XMLObj.java 5 Sep 2004 04:00:52 -0000 1.17
@@ -70,7 +70,7 @@
*/
public void processNode(String elementName, Locator locator,
Attributes attlist) throws SAXParseException {
- setLocation(locator);
+ setLocator(locator);
name = elementName;
attr = attlist;
}
1.38 +1 -1 xml-fop/src/java/org/apache/fop/fo/flow/Block.java
Index: Block.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/Block.java,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- Block.java 30 Aug 2004 12:00:52 -0000 1.37
+++ Block.java 5 Sep 2004 04:00:52 -0000 1.38
@@ -166,7 +166,7 @@
/**
* @see org.apache.fop.fo.FONode#addChildNode(FONode)
*/
- public void addChildNode(FONode child) {
+ public void addChildNode(FONode child) throws SAXParseException {
// Handle whitespace based on values of properties
// Handle a sequence of inline-producing child nodes in
// one pass
1.34 +1 -1 xml-fop/src/java/org/apache/fop/fo/flow/Table.java
Index: Table.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/flow/Table.java,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -r1.33 -r1.34
--- Table.java 30 Aug 2004 12:00:52 -0000 1.33
+++ Table.java 5 Sep 2004 04:00:52 -0000 1.34
@@ -109,7 +109,7 @@
/**
* @see org.apache.fop.fo.FONode#addChildNode(FONode)
*/
- protected void addChildNode(FONode child) {
+ protected void addChildNode(FONode child) throws SAXParseException {
if (child.getName().equals("fo:table-column")) {
if (columns == null) {
columns = new ArrayList();
1.30 +5 -18 xml-fop/src/java/org/apache/fop/fo/pagination/Flow.java
Index: Flow.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/pagination/Flow.java,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- Flow.java 4 Sep 2004 19:53:07 -0000 1.29
+++ Flow.java 5 Sep 2004 04:00:52 -0000 1.30
@@ -34,26 +34,16 @@
/**
* Class modelling the fo:flow object.
+ * @todo check need for markerSnapshot, contentWidth
*/
public class Flow extends FObj {
/**
- * PageSequence container
- */
- private PageSequence pageSequence;
-
- /**
* ArrayList to store snapshot
*/
private ArrayList markerSnapshot;
/**
- * flow-name attribute: indicates the region the content of this
- * flow should go to.
- */
- protected String flowName;
-
- /**
* Content-width of current column area during layout
*/
private int contentWidth;
@@ -74,16 +64,13 @@
protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
- this.pageSequence = (PageSequence) parent;
-
- flowName = getPropString(PR_FLOW_NAME);
+ // check flow_name property
+ String flowName = getPropString(PR_FLOW_NAME);
if (flowName == null || flowName.equals("")) {
missingPropertyError("flow-name");
}
-
- // Now done in addChild of page-sequence
- //pageSequence.addFlow(this);
+
getFOInputHandler().startFlow(this);
}
1.23 +36 -35
xml-fop/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java
Index: LayoutMasterSet.java
===================================================================
RCS file:
/home/cvs/xml-fop/src/java/org/apache/fop/fo/pagination/LayoutMasterSet.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- LayoutMasterSet.java 25 Aug 2004 05:03:06 -0000 1.22
+++ LayoutMasterSet.java 5 Sep 2004 04:00:52 -0000 1.23
@@ -93,6 +93,42 @@
if (childNodes == null) {
missingChildElementError("(simple-page-master|page-sequence-master)+");
}
+ checkRegionNames();
+ }
+
+ /**
+ * Section 7.25.7: check to see that if a region-name is a
+ * duplicate, that it maps to the same fo region-class.
+ * @throws SAXParseException if there's a name duplication
+ */
+ private void checkRegionNames() throws SAXParseException {
+ // (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();
+ if (allRegions.containsKey(region.getRegionName())) {
+ String defaultRegionName =
+ (String) allRegions.get(region.getRegionName());
+ if (!defaultRegionName.equals(region.getDefaultRegionName())) {
+ throw new SAXParseException("Region-name ("
+ + region.getRegionName()
+ + ") is being mapped to multiple "
+ + "region-classes ("
+ + defaultRegionName + " and "
+ + region.getDefaultRegionName()
+ + ")", locator);
+ }
+ }
+ allRegions.put(region.getRegionName(),
+ region.getDefaultRegionName());
+ }
+ }
}
/**
@@ -164,41 +200,6 @@
*/
public PageSequenceMaster getPageSequenceMaster(String masterName) {
return (PageSequenceMaster)this.pageSequenceMasters.get(masterName);
- }
-
- /**
- * Section 7.25.7: check to see that if a region-name is a
- * duplicate, that it maps to the same fo region-class.
- * @throws SAXParseException if there's a name duplication
- */
- public void checkRegionNames() throws SAXParseException {
- // (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();
- if (allRegions.containsKey(region.getRegionName())) {
- String defaultRegionName =
- (String) allRegions.get(region.getRegionName());
- if (!defaultRegionName.equals(region.getDefaultRegionName())) {
- throw new SAXParseException("Region-name ("
- + region.getRegionName()
- + ") is being mapped to multiple "
- + "region-classes ("
- + defaultRegionName + " and "
- + region.getDefaultRegionName()
- + ")", locator);
- }
- }
- allRegions.put(region.getRegionName(),
- region.getDefaultRegionName());
- }
- }
}
/**
1.43 +107 -144 xml-fop/src/java/org/apache/fop/fo/pagination/PageSequence.java
Index: PageSequence.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/pagination/PageSequence.java,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -r1.42 -r1.43
--- PageSequence.java 4 Sep 2004 19:53:07 -0000 1.42
+++ PageSequence.java 5 Sep 2004 04:00:52 -0000 1.43
@@ -27,7 +27,6 @@
import org.xml.sax.SAXParseException;
// FOP
-import org.apache.fop.apps.FOPException;
import org.apache.fop.fo.FONode;
import org.apache.fop.fo.FObj;
@@ -38,16 +37,13 @@
*/
public class PageSequence extends FObj {
//
- // intial-page-number types
+ // initial-page-number types
//
public static final int EXPLICIT = 0;
public static final int AUTO = 1;
public static final int AUTO_EVEN = 2;
public static final int AUTO_ODD = 3;
- //
- // associations
- //
/**
* The parent root object
*/
@@ -68,11 +64,7 @@
*/
public HashMap flowMap;
- // according to communication from Paul Grosso (XSL-List,
- // 001228, Number 406), confusion in spec section 6.4.5 about
- // multiplicity of fo:flow in XSL 1.0 is cleared up - one (1)
- // fo:flow per fo:page-sequence only.
-// private boolean isFlowSet = false;
+// private boolean isFlowSet = false;
// for structure handler
private boolean sequenceStarted = false;
@@ -113,14 +105,14 @@
public PageSequenceMaster pageSequenceMaster;
/**
- * The main content flow for this page-sequence.
+ * The fo:title object for this page-sequence.
*/
- private Flow mainFlow = null;
+ private Title titleFO;
/**
- * The fo:title object for this page-sequence.
+ * The fo:flow object for this page-sequence.
*/
- private Title titleFO;
+ private Flow mainFlow = null;
/**
* Create a page sequence FO node.
@@ -132,112 +124,12 @@
}
/**
- * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String)
- XSL Content Model: (title?,static-content*,flow)
- */
- protected void validateChildNode(Locator loc, String nsURI, String localName)
- throws SAXParseException {
- if (nsURI == FO_URI) {
- if (localName.equals("title")) {
- if (titleFO != null) {
- tooManyNodesError(loc, "fo:title");
- } else if (flowMap.size() > 0) {
- nodesOutOfOrderError(loc, "fo:title", "fo:static-content");
- } else if (mainFlow != null) {
- nodesOutOfOrderError(loc, "fo:title", "fo:flow");
- }
- } else if (localName.equals("static-content")) {
- if (mainFlow != null) {
- nodesOutOfOrderError(loc, "fo:static-content", "fo:flow");
- }
- } else if (localName.equals("flow")) {
- if (mainFlow != null) {
- tooManyNodesError(loc, "fo:flow");
- }
- } else {
- invalidChildError(loc, nsURI, localName);
- }
- } else {
- invalidChildError(loc, nsURI, localName);
- }
- }
-
- /**
- * Signal end of this xml element.
- * This passes the end page sequence to the structure handler
- * so it can act upon that.
- */
- protected void endOfNode() throws SAXParseException {
- if (mainFlow == null) {
- missingChildElementError("(title?,static-content*,flow)");
- }
- try {
- getFOInputHandler().endPageSequence(this);
- } catch (FOPException fopex) {
- getLogger().error("Error in PageSequence.endOfNode(): "
- + fopex.getMessage(), fopex);
- }
- }
-
- /**
- * @see org.apache.fop.fo.FONode#addChildNode(FONode)
- */
- public void addChildNode(FONode child) {
- try {
- String childName = child.getName();
- if (childName.equals("fo:title")) {
- this.titleFO = (Title)child;
- } else if (childName.equals("fo:flow")) {
- this.mainFlow = (Flow)child;
- String flowName = this.mainFlow.getPropString(PR_FLOW_NAME);
- if (flowMap.containsKey(flowName)) {
- throw new FOPException("flow-name "
- + flowName
- + " is not unique within an fo:page-sequence");
- }
- if (!this.layoutMasterSet.regionNameExists(flowName)) {
- getLogger().error("region-name '"
- + flowName
- + "' doesn't exist in the layout-master-set.");
- }
- // Don't add main flow to the flow map
-// addFlow(mainFlow);
- startStructuredPageSequence();
- super.addChildNode(child); // For getChildren
- } else if (childName.equals("fo:static-content")) {
- String flowName =
((StaticContent)child).getPropString(PR_FLOW_NAME);
- if (flowMap.containsKey(flowName)) {
- throw new FOPException("flow-name " + flowName
- + " is not unique within an fo:page-sequence");
- }
- if (!this.layoutMasterSet.regionNameExists(flowName)) {
- throw new FOPException("region-name '" + flowName
- + "' doesn't exist in the layout-master-set.");
- }
- flowMap.put(flowName, child);
-// addFlow((Flow)child);
- startStructuredPageSequence();
- }
- } catch (FOPException fopex) {
- getLogger().error("Error in PageSequence.addChildNode(): "
- + fopex.getMessage(), fopex);
- }
- }
-
-
- /**
* @see org.apache.fop.fo.FObj#addProperties
*/
protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
-
this.root = (Root) parent;
-// this.root.addPageSequence(this);
layoutMasterSet = root.getLayoutMasterSet();
-
- // best time to run some checks on LayoutMasterSet
- layoutMasterSet.checkRegionNames();
-
flowMap = new HashMap();
// we are now on the first page of the page sequence
@@ -257,7 +149,7 @@
this.explicitFirstNumber = (pageStart > 0) ? pageStart : 1;
} catch (NumberFormatException nfe) {
throw new SAXParseException("\"" + ipnValue
- + "\" is not a valid value for
initial-page-number", locator);
+ + "\" is not a valid value for initial-page-number", locator);
}
}
@@ -269,17 +161,17 @@
this.layoutMasterSet.getPageSequenceMaster(masterName);
if (this.pageSequenceMaster == null) {
throw new SAXParseException("master-reference '" + masterName
- + "' for fo:page-sequence matches no"
- + " simple-page-master or
page-sequence-master", locator);
+ + "' for fo:page-sequence matches no"
+ + " simple-page-master or page-sequence-master", locator);
}
}
// get the 'format' properties
this.pageNumberGenerator =
new PageNumberGenerator(getPropString(PR_FORMAT),
-
this.propertyList.get(PR_GROUPING_SEPARATOR).getCharacter(),
-
this.propertyList.get(PR_GROUPING_SIZE).getNumber().intValue(),
- getPropEnum(PR_LETTER_VALUE));
+ this.propertyList.get(PR_GROUPING_SEPARATOR).getCharacter(),
+ this.propertyList.get(PR_GROUPING_SIZE).getNumber().intValue(),
+ getPropEnum(PR_LETTER_VALUE));
this.forcePageCount = getPropEnum(PR_FORCE_PAGE_COUNT);
@@ -291,26 +183,95 @@
startStructuredPageSequence();
}
+ /**
+ * @see org.apache.fop.fo.FONode#validateChildNode(Locator, String, String)
+ XSL Content Model: (title?,static-content*,flow)
+ */
+ protected void validateChildNode(Locator loc, String nsURI, String localName)
+ throws SAXParseException {
+ if (nsURI == FO_URI) {
+ if (localName.equals("title")) {
+ if (titleFO != null) {
+ tooManyNodesError(loc, "fo:title");
+ } else if (flowMap.size() > 0) {
+ nodesOutOfOrderError(loc, "fo:title", "fo:static-content");
+ } else if (mainFlow != null) {
+ nodesOutOfOrderError(loc, "fo:title", "fo:flow");
+ }
+ } else if (localName.equals("static-content")) {
+ if (mainFlow != null) {
+ nodesOutOfOrderError(loc, "fo:static-content", "fo:flow");
+ }
+ } else if (localName.equals("flow")) {
+ if (mainFlow != null) {
+ tooManyNodesError(loc, "fo:flow");
+ }
+ } else {
+ invalidChildError(loc, nsURI, localName);
+ }
+ } else {
+ invalidChildError(loc, nsURI, localName);
+ }
+ }
+
+ /**
+ * @see org.apache.fop.fo.FONode#addChildNode(FONode)
+ * @todo see if addChildNode() should also be called for fo's other than
+ * fo:flow.
+ */
+ public void addChildNode(FONode child) throws SAXParseException {
+ int childId = child.getNameId();
+
+ if (childId == FO_TITLE) {
+ this.titleFO = (Title) child;
+ } else if (childId == FO_FLOW) {
+ this.mainFlow = (Flow) child;
+ addFlow(mainFlow);
+ startStructuredPageSequence();
+ super.addChildNode(child); // For getChildren
+ } else if (childId == FO_STATIC_CONTENT) {
+ addFlow((StaticContent) child);
+ startStructuredPageSequence();
+ }
+ }
+
+ /**
+ * Signal end of this xml element.
+ * This passes the end page sequence to the structure handler
+ * so it can act upon that.
+ */
+ protected void endOfNode() throws SAXParseException {
+ if (mainFlow == null) {
+ missingChildElementError("(title?,static-content*,flow)");
+ }
+
+ getFOInputHandler().endPageSequence(this);
+ }
/**
* Add a flow or static content, mapped by its flow-name.
* The flow-name is used to associate the flow with a region on a page,
- * based on the names given to the regions in the page-master used to
- * generate that page.
+ * based on the region-names given to the regions in the page-master
+ * used to generate that page.
*/
-// private void addFlow(Flow flow) throws FOPException {
-// if (flowMap.containsKey(flow.getFlowName())) {
-// throw new FOPException("flow-names must be unique within an
fo:page-sequence");
-// }
-// if (!this.layoutMasterSet.regionNameExists(flow.getFlowName())) {
-// getLogger().error("region-name '"
-// + flow.getFlowName()
-// + "' doesn't exist in the
layout-master-set.");
-// }
-// flowMap.put(flow.getFlowName(), flow);
-// //setIsFlowSet(true);
-// }
+ private void addFlow(Flow flow) throws SAXParseException {
+ String flowName = flow.getPropString(PR_FLOW_NAME);
+
+ if (hasFlowName(flowName)) {
+ throw new SAXParseException ("duplicate flow-name \""
+ + flowName
+ + "\" found within fo:page-sequence", flow.locator);
+ }
+ if (!layoutMasterSet.regionNameExists(flowName)
+ && !flowName.equals("xsl-before-float-separator")
+ && !flowName.equals("xsl-footnote-separator")) {
+ throw new SAXParseException ("flow-name \""
+ + flowName
+ + "\" could not be mapped to a region-name in the"
+ + " layout-master-set", flow.locator);
+ }
+ }
/**
* Start the page-sequence logic in the Structured Handler
@@ -322,7 +283,6 @@
}
}
-
/**
* Initialize the current page number for the start of the page sequence.
*/
@@ -667,15 +627,7 @@
* @return the static content FO node
*/
public StaticContent getStaticContent(String name) {
- return (StaticContent)flowMap.get(name);
- }
-
- /**
- * Accessor method for layoutMasterSet
- * @return layoutMasterSet for this object
- */
- public LayoutMasterSet getLayoutMasterSet() {
- return layoutMasterSet;
+ return (StaticContent) flowMap.get(name);
}
/**
@@ -693,6 +645,17 @@
*/
public Flow getMainFlow() {
return mainFlow;
+ }
+
+ /**
+ * Determine if this PageSequence already has a flow with the given flow-name
+ * Used for validation of incoming fo:flow or fo:static-content objects
+ * @param flowName The flow-name to search for
+ * @return true if flow-name already defined within this page sequence,
+ * false otherwise
+ */
+ public boolean hasFlowName(String flowName) {
+ return flowMap.containsKey(flowName);
}
/**
1.20 +1 -1 xml-fop/src/java/org/apache/fop/fo/pagination/RegionBA.java
Index: RegionBA.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/pagination/RegionBA.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- RegionBA.java 30 Aug 2004 12:00:53 -0000 1.19
+++ RegionBA.java 5 Sep 2004 04:00:52 -0000 1.20
@@ -61,7 +61,7 @@
Region start = getSiblingRegion(FO_REGION_START);
if (start != null) {
offset = start.getPropLength(PR_EXTENT);
- vpRefRect.translate(offset, 0);
+ vpRefRect.translate(offset, 0); // move (x, y) units
}
Region end = getSiblingRegion(FO_REGION_END);
if (end != null) {
1.17 +2 -0 xml-fop/src/java/org/apache/fop/fo/pagination/RegionEnd.java
Index: RegionEnd.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/fo/pagination/RegionEnd.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- RegionEnd.java 30 Aug 2004 12:00:53 -0000 1.16
+++ RegionEnd.java 5 Sep 2004 04:00:52 -0000 1.17
@@ -58,9 +58,11 @@
// Depends on extent, precedence and writing mode
Rectangle vpRect;
if (this.wm == WritingMode.LR_TB || this.wm == WritingMode.RL_TB) {
+ // Rectangle: x , y (of top left point), width, height
vpRect = new Rectangle(reldims.ipd - extent, 0,
extent, reldims.bpd);
} else {
+ // Rectangle: x , y (of top left point), width, height
vpRect = new Rectangle(reldims.ipd - extent, 0,
reldims.bpd, extent);
}
1.18 +0 -1
xml-fop/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java
Index: RepeatablePageMasterReference.java
===================================================================
RCS file:
/home/cvs/xml-fop/src/java/org/apache/fop/fo/pagination/RepeatablePageMasterReference.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- RepeatablePageMasterReference.java 27 Aug 2004 05:36:43 -0000 1.17
+++ RepeatablePageMasterReference.java 5 Sep 2004 04:00:52 -0000 1.18
@@ -50,7 +50,6 @@
/**
* @see org.apache.fop.fo.FObj#addProperties
- * @todo need to
*/
protected void addProperties(Attributes attlist) throws SAXParseException {
super.addProperties(attlist);
1.47 +0 -11 xml-fop/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java
Index: PageLayoutManager.java
===================================================================
RCS file:
/home/cvs/xml-fop/src/java/org/apache/fop/layoutmgr/PageLayoutManager.java,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -r1.46 -r1.47
--- PageLayoutManager.java 4 Sep 2004 19:53:07 -0000 1.46
+++ PageLayoutManager.java 5 Sep 2004 04:00:52 -0000 1.47
@@ -768,9 +768,6 @@
spm.getPropertyManager().getWritingMode(), pageRefRect, reldims);
// Create a RegionViewport/ reference area pair for each page region
-
- boolean bHasBody = false;
-
for (Iterator regenum = spm.getRegions().values().iterator();
regenum.hasNext();) {
Region r = (Region)regenum.next();
@@ -783,17 +780,9 @@
rvp.setRegion(makeRegionReferenceArea(r, rvp.getViewArea()));
}
page.setRegionViewport(r.getNameId(), rvp);
- if (r.getNameId() == FO_REGION_BODY) {
- bHasBody = true;
- }
- }
-
- if (!bHasBody) {
- spm.getLogger().error("simple-page-master has no region-body");
}
return new PageViewport(page, new Rectangle(0, 0, pageWidth, pageHeight));
-
}
/**
1.12 +4 -5 xml-fop/src/java/org/apache/fop/render/mif/MIFHandler.java
Index: MIFHandler.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/render/mif/MIFHandler.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- MIFHandler.java 21 Aug 2004 19:48:00 -0000 1.11
+++ MIFHandler.java 5 Sep 2004 04:00:52 -0000 1.12
@@ -116,9 +116,9 @@
// get the layout master set
// setup the pages for this sequence
String name = pageSeq.getPropString(Constants.PR_MASTER_REFERENCE);
- SimplePageMaster spm =
pageSeq.getLayoutMasterSet().getSimplePageMaster(name);
+ SimplePageMaster spm =
pageSeq.getRoot().getLayoutMasterSet().getSimplePageMaster(name);
if (spm == null) {
- PageSequenceMaster psm =
pageSeq.getLayoutMasterSet().getPageSequenceMaster(name);
+ PageSequenceMaster psm =
pageSeq.getRoot().getLayoutMasterSet().getPageSequenceMaster(name);
} else {
// create simple master with regions
MIFElement prop = new MIFElement("PageType");
@@ -159,8 +159,7 @@
/**
* @see org.apache.fop.fo.FOInputHandler#endPageSequence(PageSequence)
*/
- public void endPageSequence(PageSequence pageSeq) throws FOPException {
-
+ public void endPageSequence(PageSequence pageSeq) {
}
/**
1.31 +3 -3 xml-fop/src/java/org/apache/fop/render/rtf/RTFHandler.java
Index: RTFHandler.java
===================================================================
RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/render/rtf/RTFHandler.java,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -r1.30 -r1.31
--- RTFHandler.java 4 Sep 2004 19:53:07 -0000 1.30
+++ RTFHandler.java 5 Sep 2004 04:00:52 -0000 1.31
@@ -178,7 +178,7 @@
String reference = prop.getString();
SimplePageMaster pagemaster
- = pageSeq.getLayoutMasterSet().getSimplePageMaster(reference);
+ =
pageSeq.getRoot().getLayoutMasterSet().getSimplePageMaster(reference);
//only simple-page-master supported, so pagemaster may be null
if (pagemaster != null) {
@@ -202,7 +202,7 @@
/**
* @see org.apache.fop.fo.FOInputHandler#endPageSequence(PageSequence)
*/
- public void endPageSequence(PageSequence pageSeq) throws FOPException {
+ public void endPageSequence(PageSequence pageSeq) {
if (bDefer) {
return;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]