aboutsummaryrefslogtreecommitdiffstats
path: root/src/org/apache
diff options
context:
space:
mode:
authorarved <arved@unknown>2001-03-04 23:10:13 +0000
committerarved <arved@unknown>2001-03-04 23:10:13 +0000
commit961174bd7eaad1595d20152db6b8c4466c896c57 (patch)
treeb2496af9caffb372b9240f9b03dfa915b515d831 /src/org/apache
parent769aeaa5ccdc6ad3fdbd6ddd3259bcf1843a4cc1 (diff)
downloadxmlgraphics-fop-961174bd7eaad1595d20152db6b8c4466c896c57.tar.gz
xmlgraphics-fop-961174bd7eaad1595d20152db6b8c4466c896c57.zip
region-start, region-end support
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194134 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/org/apache')
-rw-r--r--src/org/apache/fop/fo/StandardElementMapping.java54
-rw-r--r--src/org/apache/fop/fo/flow/StaticContent.java59
-rw-r--r--src/org/apache/fop/fo/pagination/PageSequence.java73
-rw-r--r--src/org/apache/fop/fo/pagination/Region.java55
-rw-r--r--src/org/apache/fop/fo/pagination/RegionAfter.java73
-rw-r--r--src/org/apache/fop/fo/pagination/RegionBefore.java69
-rw-r--r--src/org/apache/fop/fo/pagination/SimplePageMaster.java109
-rw-r--r--src/org/apache/fop/layout/Page.java58
-rw-r--r--src/org/apache/fop/layout/PageMaster.java55
-rw-r--r--src/org/apache/fop/layout/RegionArea.java54
10 files changed, 153 insertions, 506 deletions
diff --git a/src/org/apache/fop/fo/StandardElementMapping.java b/src/org/apache/fop/fo/StandardElementMapping.java
index 891c3d5ff..83d7f8256 100644
--- a/src/org/apache/fop/fo/StandardElementMapping.java
+++ b/src/org/apache/fop/fo/StandardElementMapping.java
@@ -1,52 +1,8 @@
/*-- $Id$ --
-
- ============================================================================
- The Apache Software License, Version 1.1
- ============================================================================
-
- Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modifica-
- tion, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- 3. The end-user documentation included with the redistribution, if any, must
- include the following acknowledgment: "This product includes software
- developed by the Apache Software Foundation (http://www.apache.org/)."
- Alternately, this acknowledgment may appear in the software itself, if
- and wherever such third-party acknowledgments normally appear.
-
- 4. The names "FOP" and "Apache Software Foundation" must not be used to
- endorse or promote products derived from this software without prior
- written permission. For written permission, please contact
- apache@apache.org.
-
- 5. Products derived from this software may not be called "Apache", nor may
- "Apache" appear in their name, without prior written permission of the
- Apache Software Foundation.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- This software consists of voluntary contributions made by many individuals
- on behalf of the Apache Software Foundation and was originally created by
- James Tauber <jtauber@jtauber.com>. For more information on the Apache
- Software Foundation, please see <http://www.apache.org/>.
-
+ *
+ * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * For details on use and redistribution please refer to the
+ * LICENSE file included with these sources."
*/
package org.apache.fop.fo;
@@ -68,6 +24,8 @@ public class StandardElementMapping implements ElementMapping {
builder.addMapping(uri, "region-body", RegionBody.maker());
builder.addMapping(uri, "region-before", RegionBefore.maker());
builder.addMapping(uri, "region-after", RegionAfter.maker());
+ builder.addMapping(uri, "region-start", RegionStart.maker());
+ builder.addMapping(uri, "region-end", RegionEnd.maker());
builder.addMapping(uri, "page-sequence", PageSequence.maker());
builder.addMapping(uri, "page-sequence-master",
PageSequenceMaster.maker());
diff --git a/src/org/apache/fop/fo/flow/StaticContent.java b/src/org/apache/fop/fo/flow/StaticContent.java
index dcbf7bd25..d1a8f009b 100644
--- a/src/org/apache/fop/fo/flow/StaticContent.java
+++ b/src/org/apache/fop/fo/flow/StaticContent.java
@@ -1,53 +1,10 @@
/*-- $Id$ --
-
- ============================================================================
- The Apache Software License, Version 1.1
- ============================================================================
-
- Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modifica-
- tion, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- 3. The end-user documentation included with the redistribution, if any, must
- include the following acknowledgment: "This product includes software
- developed by the Apache Software Foundation (http://www.apache.org/)."
- Alternately, this acknowledgment may appear in the software itself, if
- and wherever such third-party acknowledgments normally appear.
-
- 4. The names "FOP" and "Apache Software Foundation" must not be used to
- endorse or promote products derived from this software without prior
- written permission. For written permission, please contact
- apache@apache.org.
-
- 5. Products derived from this software may not be called "Apache", nor may
- "Apache" appear in their name, without prior written permission of the
- Apache Software Foundation.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- This software consists of voluntary contributions made by many individuals
- on behalf of the Apache Software Foundation and was originally created by
- James Tauber <jtauber@jtauber.com>. For more information on the Apache
- Software Foundation, please see <http://www.apache.org/>.
-
+ *
+ * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * For details on use and redistribution please refer to the
+ * LICENSE file included with these sources."
*/
+
package org.apache.fop.fo.flow;
// FOP
@@ -99,6 +56,12 @@ public class StaticContent extends Flow {
else if(getFlowName().equals("xsl-region-after")) {
regionClass = RegionAfter.REGION_CLASS;
}
+ else if(getFlowName().equals("xsl-region-start")) {
+ regionClass = RegionStart.REGION_CLASS;
+ }
+ else if(getFlowName().equals("xsl-region-end")) {
+ regionClass = RegionEnd.REGION_CLASS;
+ }
}
diff --git a/src/org/apache/fop/fo/pagination/PageSequence.java b/src/org/apache/fop/fo/pagination/PageSequence.java
index 060ccc894..380f23820 100644
--- a/src/org/apache/fop/fo/pagination/PageSequence.java
+++ b/src/org/apache/fop/fo/pagination/PageSequence.java
@@ -1,52 +1,8 @@
/*-- $Id$ --
-
- ============================================================================
- The Apache Software License, Version 1.1
- ============================================================================
-
- Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modifica-
- tion, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- 3. The end-user documentation included with the redistribution, if any, must
- include the following acknowledgment: "This product includes software
- developed by the Apache Software Foundation (http://www.apache.org/)."
- Alternately, this acknowledgment may appear in the software itself, if
- and wherever such third-party acknowledgments normally appear.
-
- 4. The names "FOP" and "Apache Software Foundation" must not be used to
- endorse or promote products derived from this software without prior
- written permission. For written permission, please contact
- apache@apache.org.
-
- 5. Products derived from this software may not be called "Apache", nor may
- "Apache" appear in their name, without prior written permission of the
- Apache Software Foundation.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- This software consists of voluntary contributions made by many individuals
- on behalf of the Apache Software Foundation and was originally created by
- James Tauber <jtauber@jtauber.com>. For more information on the Apache
- Software Foundation, please see <http://www.apache.org/>.
-
+ *
+ * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * For details on use and redistribution please refer to the
+ * LICENSE file included with these sources."
*/
package org.apache.fop.fo.pagination;
@@ -388,7 +344,26 @@ public class PageSequence extends FObj
layoutStaticContent(staticFlow, simpleMaster.getRegion(RegionAfter.REGION_CLASS),
afterArea);
}
-
+ }
+
+ if (simpleMaster.getRegion(RegionStart.REGION_CLASS) != null && (currentPage.getStart() != null)) {
+ Flow staticFlow = (Flow)_flowMap.get(simpleMaster.getRegion(RegionStart.REGION_CLASS).getRegionName());
+ if (staticFlow != null) {
+ AreaContainer startArea = currentPage.getStart();
+ startArea.setIDReferences(areaTree.getIDReferences());
+ layoutStaticContent(staticFlow, simpleMaster.getRegion(RegionStart.REGION_CLASS),
+ startArea);
+ }
+ }
+
+ if (simpleMaster.getRegion(RegionEnd.REGION_CLASS) != null && (currentPage.getEnd() != null)) {
+ Flow staticFlow = (Flow)_flowMap.get(simpleMaster.getRegion(RegionEnd.REGION_CLASS).getRegionName());
+ if (staticFlow != null) {
+ AreaContainer endArea = currentPage.getEnd();
+ endArea.setIDReferences(areaTree.getIDReferences());
+ layoutStaticContent(staticFlow, simpleMaster.getRegion(RegionEnd.REGION_CLASS),
+ endArea);
+ }
}
}
diff --git a/src/org/apache/fop/fo/pagination/Region.java b/src/org/apache/fop/fo/pagination/Region.java
index 449982bca..af1f50e07 100644
--- a/src/org/apache/fop/fo/pagination/Region.java
+++ b/src/org/apache/fop/fo/pagination/Region.java
@@ -1,54 +1,11 @@
/*-- $Id$ --
- ============================================================================
- The Apache Software License, Version 1.1
- ============================================================================
-
- Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modifica-
- tion, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- 3. The end-user documentation included with the redistribution, if any, must
- include the following acknowledgment: "This product includes software
- developed by the Apache Software Foundation (http://www.apache.org/)."
- Alternately, this acknowledgment may appear in the software itself, if
- and wherever such third-party acknowledgments normally appear.
-
- 4. The names "Fop" and "Apache Software Foundation" must not be used to
- endorse or promote products derived from this software without prior
- written permission. For written permission, please contact
- apache@apache.org.
-
- 5. Products derived from this software may not be called "Apache", nor may
- "Apache" appear in their name, without prior written permission of the
- Apache Software Foundation.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- This software consists of voluntary contributions made by many individuals
- on behalf of the Apache Software Foundation and was originally created by
- James Tauber <jtauber@jtauber.com>. For more information on the Apache
- Software Foundation, please see <http://www.apache.org/>.
-
+ * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * For details on use and redistribution please refer to the
+ * LICENSE file included with these sources."
*/
-package org.apache.fop.fo.pagination;
+
+ package org.apache.fop.fo.pagination;
// FOP
import org.apache.fop.fo.FObj;
@@ -107,7 +64,7 @@ public abstract class Region extends FObj
int allocationRectangleWidth,
int allocationRectangleHeight);
- /**
+ /**
* Returns the default region name (xsl-region-before, xsl-region-start,
* etc.)
*/
diff --git a/src/org/apache/fop/fo/pagination/RegionAfter.java b/src/org/apache/fop/fo/pagination/RegionAfter.java
index 828907549..614319ada 100644
--- a/src/org/apache/fop/fo/pagination/RegionAfter.java
+++ b/src/org/apache/fop/fo/pagination/RegionAfter.java
@@ -1,58 +1,14 @@
/*-- $Id$ --
-
- ============================================================================
- The Apache Software License, Version 1.1
- ============================================================================
-
- Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modifica-
- tion, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- 3. The end-user documentation included with the redistribution, if any, must
- include the following acknowledgment: "This product includes software
- developed by the Apache Software Foundation (http://www.apache.org/)."
- Alternately, this acknowledgment may appear in the software itself, if
- and wherever such third-party acknowledgments normally appear.
-
- 4. The names "Fop" and "Apache Software Foundation" must not be used to
- endorse or promote products derived from this software without prior
- written permission. For written permission, please contact
- apache@apache.org.
-
- 5. Products derived from this software may not be called "Apache", nor may
- "Apache" appear in their name, without prior written permission of the
- Apache Software Foundation.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- This software consists of voluntary contributions made by many individuals
- on behalf of the Apache Software Foundation and was originally created by
- James Tauber <jtauber@jtauber.com>. For more information on the Apache
- Software Foundation, please see <http://www.apache.org/>.
-
+ *
+ * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * For details on use and redistribution please refer to the
+ * LICENSE file included with these sources."
*/
package org.apache.fop.fo.pagination;
// FOP
-import org.apache.fop.fo.FObj;
-import org.apache.fop.fo.PropertyList;
+import org.apache.fop.fo.*;
+import org.apache.fop.fo.properties.*;
import org.apache.fop.apps.FOPException;
import org.apache.fop.layout.RegionArea;
@@ -70,28 +26,25 @@ public class RegionAfter extends Region {
public static final String REGION_CLASS = "after";
-
+ private int precedence;
+
protected RegionAfter(FObj parent, PropertyList propertyList)
throws FOPException
{
super(parent, propertyList);
+ precedence = this.properties.get("precedence").getEnum();
}
RegionArea makeRegionArea(int allocationRectangleXPosition,
int allocationRectangleYPosition,
int allocationRectangleWidth,
int allocationRectangleHeight) {
- int marginTop = this.properties.get("margin-top").getLength().mvalue();
- int marginBottom = this.properties.get("margin-bottom").getLength().mvalue();
- int marginLeft = this.properties.get("margin-left").getLength().mvalue();
- int marginRight = this.properties.get("margin-right").getLength().mvalue();
int extent = this.properties.get("extent").getLength().mvalue();
- return new RegionArea(allocationRectangleXPosition + marginLeft,
+ return new RegionArea(allocationRectangleXPosition,
allocationRectangleYPosition -
allocationRectangleHeight + extent,
- allocationRectangleWidth - marginLeft -
- marginRight,extent);
+ allocationRectangleWidth,extent);
}
@@ -110,4 +63,8 @@ public class RegionAfter extends Region {
return REGION_CLASS;
}
+ public boolean getPrecedence()
+ {
+ return (precedence == Precedence.TRUE ? true : false);
+ }
}
diff --git a/src/org/apache/fop/fo/pagination/RegionBefore.java b/src/org/apache/fop/fo/pagination/RegionBefore.java
index 2fcbf0259..dcc60aaa6 100644
--- a/src/org/apache/fop/fo/pagination/RegionBefore.java
+++ b/src/org/apache/fop/fo/pagination/RegionBefore.java
@@ -1,52 +1,8 @@
/*-- $Id$ --
-
- ============================================================================
- The Apache Software License, Version 1.1
- ============================================================================
-
- Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modifica-
- tion, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- 3. The end-user documentation included with the redistribution, if any, must
- include the following acknowledgment: "This product includes software
- developed by the Apache Software Foundation (http://www.apache.org/)."
- Alternately, this acknowledgment may appear in the software itself, if
- and wherever such third-party acknowledgments normally appear.
-
- 4. The names "Fop" and "Apache Software Foundation" must not be used to
- endorse or promote products derived from this software without prior
- written permission. For written permission, please contact
- apache@apache.org.
-
- 5. Products derived from this software may not be called "Apache", nor may
- "Apache" appear in their name, without prior written permission of the
- Apache Software Foundation.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- This software consists of voluntary contributions made by many individuals
- on behalf of the Apache Software Foundation and was originally created by
- James Tauber <jtauber@jtauber.com>. For more information on the Apache
- Software Foundation, please see <http://www.apache.org/>.
-
+ *
+ * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * For details on use and redistribution please refer to the
+ * LICENSE file included with these sources."
*/
package org.apache.fop.fo.pagination;
@@ -70,11 +26,13 @@ public class RegionBefore extends Region {
public static final String REGION_CLASS = "before";
+ private int precedence;
protected RegionBefore(FObj parent, PropertyList propertyList)
throws FOPException
{
super(parent, propertyList);
+ precedence = this.properties.get("precedence").getEnum();
}
@@ -82,16 +40,11 @@ public class RegionBefore extends Region {
int allocationRectangleYPosition,
int allocationRectangleWidth,
int allocationRectangleHeight) {
- int marginTop = this.properties.get("margin-top").getLength().mvalue();
- int marginBottom = this.properties.get("margin-bottom").getLength().mvalue();
- int marginLeft = this.properties.get("margin-left").getLength().mvalue();
- int marginRight = this.properties.get("margin-right").getLength().mvalue();
int extent = this.properties.get("extent").getLength().mvalue();
- return new RegionArea(allocationRectangleXPosition + marginLeft,
- allocationRectangleYPosition - marginTop,
- allocationRectangleWidth - marginLeft -
- marginRight, extent);
+ return new RegionArea(allocationRectangleXPosition,
+ allocationRectangleYPosition,
+ allocationRectangleWidth, extent);
}
@@ -110,4 +63,8 @@ public class RegionBefore extends Region {
return REGION_CLASS;
}
+ public boolean getPrecedence()
+ {
+ return (precedence == Precedence.TRUE ? true : false);
+ }
}
diff --git a/src/org/apache/fop/fo/pagination/SimplePageMaster.java b/src/org/apache/fop/fo/pagination/SimplePageMaster.java
index e9a0e0cf3..b87664a3a 100644
--- a/src/org/apache/fop/fo/pagination/SimplePageMaster.java
+++ b/src/org/apache/fop/fo/pagination/SimplePageMaster.java
@@ -1,53 +1,10 @@
-/*-- $Id$ --
-
- ============================================================================
- The Apache Software License, Version 1.1
- ============================================================================
-
- Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modifica-
- tion, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- 3. The end-user documentation included with the redistribution, if any, must
- include the following acknowledgment: "This product includes software
- developed by the Apache Software Foundation (http://www.apache.org/)."
- Alternately, this acknowledgment may appear in the software itself, if
- and wherever such third-party acknowledgments normally appear.
-
- 4. The names "Fop" and "Apache Software Foundation" must not be used to
- endorse or promote products derived from this software without prior
- written permission. For written permission, please contact
- apache@apache.org.
-
- 5. Products derived from this software may not be called "Apache", nor may
- "Apache" appear in their name, without prior written permission of the
- Apache Software Foundation.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- This software consists of voluntary contributions made by many individuals
- on behalf of the Apache Software Foundation and was originally created by
- James Tauber <jtauber@jtauber.com>. For more information on the Apache
- Software Foundation, please see <http://www.apache.org/>.
-
+/*-- $Id$ --
+ *
+ * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * For details on use and redistribution please refer to the
+ * LICENSE file included with these sources."
*/
+
package org.apache.fop.fo.pagination;
// FOP
@@ -55,6 +12,7 @@ import org.apache.fop.fo.*;
import org.apache.fop.messaging.MessageHandler;
import org.apache.fop.fo.properties.*;
import org.apache.fop.layout.PageMaster;
+import org.apache.fop.layout.RegionArea;
import org.apache.fop.layout.BodyRegionArea;
import org.apache.fop.apps.FOPException;
@@ -80,7 +38,13 @@ public class SimplePageMaster extends FObj {
LayoutMasterSet layoutMasterSet;
PageMaster pageMaster;
String masterName;
-
+
+ // before and after data as required by start and end
+ boolean beforePrecedence;
+ int beforeHeight;
+ boolean afterPrecedence;
+ int afterHeight;
+
protected SimplePageMaster(FObj parent, PropertyList propertyList)
throws FOPException {
super(parent, propertyList);
@@ -120,20 +84,56 @@ public class SimplePageMaster extends FObj {
this.pageMaster = new PageMaster(pageWidth, pageHeight);
if (getRegion(RegionBody.REGION_CLASS) != null) {
- this.pageMaster.addBody((BodyRegionArea)getRegion(RegionBody.REGION_CLASS).makeRegionArea(contentRectangleXPosition,contentRectangleYPosition,contentRectangleWidth,contentRectangleHeight));
+ BodyRegionArea body =
+ (BodyRegionArea)getRegion(RegionBody.REGION_CLASS).makeRegionArea(contentRectangleXPosition,
+ contentRectangleYPosition,contentRectangleWidth,contentRectangleHeight);
+ this.pageMaster.addBody(body);
}
else {
MessageHandler.errorln("ERROR: simple-page-master must have a region of class "+RegionBody.REGION_CLASS);
}
if (getRegion(RegionBefore.REGION_CLASS) != null) {
- this.pageMaster.addBefore(getRegion(RegionBefore.REGION_CLASS).makeRegionArea(contentRectangleXPosition,contentRectangleYPosition,contentRectangleWidth,contentRectangleHeight));
+ RegionArea before =
+ getRegion(RegionBefore.REGION_CLASS).makeRegionArea(contentRectangleXPosition,
+ contentRectangleYPosition,contentRectangleWidth,contentRectangleHeight);
+ this.pageMaster.addBefore(before);
+ beforePrecedence = ((RegionBefore)getRegion(RegionBefore.REGION_CLASS)).getPrecedence();
+ beforeHeight = before.getHeight();
+ }
+ else {
+ beforePrecedence = false;
}
if (getRegion(RegionAfter.REGION_CLASS) != null) {
- this.pageMaster.addAfter(getRegion(RegionAfter.REGION_CLASS).makeRegionArea(contentRectangleXPosition,contentRectangleYPosition,contentRectangleWidth,contentRectangleHeight));
+ RegionArea after =
+ getRegion(RegionAfter.REGION_CLASS).makeRegionArea(contentRectangleXPosition,
+ contentRectangleYPosition,contentRectangleWidth,contentRectangleHeight);
+ this.pageMaster.addAfter(after);
+ afterPrecedence = ((RegionAfter)getRegion(RegionAfter.REGION_CLASS)).getPrecedence();
+ afterHeight = after.getHeight();
+ }
+ else {
+ afterPrecedence = false;
}
+ if (getRegion(RegionStart.REGION_CLASS) != null) {
+ RegionArea start =
+ ((RegionStart)getRegion(RegionStart.REGION_CLASS)).makeRegionArea(
+ contentRectangleXPosition,
+ contentRectangleYPosition,contentRectangleWidth,contentRectangleHeight,
+ beforePrecedence, afterPrecedence, beforeHeight, afterHeight);
+ this.pageMaster.addStart(start);
+ }
+
+ if (getRegion(RegionEnd.REGION_CLASS) != null) {
+ RegionArea end =
+ ((RegionEnd)getRegion(RegionEnd.REGION_CLASS)).makeRegionArea(
+ contentRectangleXPosition,
+ contentRectangleYPosition,contentRectangleWidth,contentRectangleHeight,
+ beforePrecedence, afterPrecedence, beforeHeight, afterHeight);
+ this.pageMaster.addEnd(end);
+ }
}
public PageMaster getPageMaster() {
@@ -154,7 +154,8 @@ public class SimplePageMaster extends FObj {
throws FOPException
{
if (_regions.containsKey(region.getRegionClass())) {
- throw new FOPException("Only one region of class "+region.getRegionClass()+" allowed within a simple-page-master.");
+ throw new FOPException("Only one region of class "+region.getRegionClass()
+ +" allowed within a simple-page-master.");
}
else {
_regions.put(region.getRegionClass(), region);
diff --git a/src/org/apache/fop/layout/Page.java b/src/org/apache/fop/layout/Page.java
index c58ebe115..1d8218503 100644
--- a/src/org/apache/fop/layout/Page.java
+++ b/src/org/apache/fop/layout/Page.java
@@ -1,52 +1,8 @@
/*-- $Id$ --
- ============================================================================
- The Apache Software License, Version 1.1
- ============================================================================
-
- Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modifica-
- tion, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- 3. The end-user documentation included with the redistribution, if any, must
- include the following acknowledgment: "This product includes software
- developed by the Apache Software Foundation (http://www.apache.org/)."
- Alternately, this acknowledgment may appear in the software itself, if
- and wherever such third-party acknowledgments normally appear.
-
- 4. The names "FOP" and "Apache Software Foundation" must not be used to
- endorse or promote products derived from this software without prior
- written permission. For written permission, please contact
- apache@apache.org.
-
- 5. Products derived from this software may not be called "Apache", nor may
- "Apache" appear in their name, without prior written permission of the
- Apache Software Foundation.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- This software consists of voluntary contributions made by many individuals
- on behalf of the Apache Software Foundation and was originally created by
- James Tauber <jtauber@jtauber.com>. For more information on the Apache
- Software Foundation, please see <http://www.apache.org/>.
-
+ * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * For details on use and redistribution please refer to the
+ * LICENSE file included with these sources."
*/
package org.apache.fop.layout;
@@ -141,6 +97,14 @@ public class Page {
return this.before;
}
+ public AreaContainer getStart() {
+ return this.start;
+ }
+
+ public AreaContainer getEnd() {
+ return this.end;
+ }
+
public BodyAreaContainer getBody() {
return this.body;
}
diff --git a/src/org/apache/fop/layout/PageMaster.java b/src/org/apache/fop/layout/PageMaster.java
index 6e60886e2..162859509 100644
--- a/src/org/apache/fop/layout/PageMaster.java
+++ b/src/org/apache/fop/layout/PageMaster.java
@@ -1,53 +1,10 @@
-/*-- $Id$ --
-
- ============================================================================
- The Apache Software License, Version 1.1
- ============================================================================
-
- Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modifica-
- tion, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- 3. The end-user documentation included with the redistribution, if any, must
- include the following acknowledgment: "This product includes software
- developed by the Apache Software Foundation (http://www.apache.org/)."
- Alternately, this acknowledgment may appear in the software itself, if
- and wherever such third-party acknowledgments normally appear.
-
- 4. The names "Fop" and "Apache Software Foundation" must not be used to
- endorse or promote products derived from this software without prior
- written permission. For written permission, please contact
- apache@apache.org.
-
- 5. Products derived from this software may not be called "Apache", nor may
- "Apache" appear in their name, without prior written permission of the
- Apache Software Foundation.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- This software consists of voluntary contributions made by many individuals
- on behalf of the Apache Software Foundation and was originally created by
- James Tauber <jtauber@jtauber.com>. For more information on the Apache
- Software Foundation, please see <http://www.apache.org/>.
-
+/*-- $Id$ --
+ *
+ * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * For details on use and redistribution please refer to the
+ * LICENSE file included with these sources."
*/
+
package org.apache.fop.layout;
public class PageMaster {
diff --git a/src/org/apache/fop/layout/RegionArea.java b/src/org/apache/fop/layout/RegionArea.java
index b7ab3970f..45b0b48dc 100644
--- a/src/org/apache/fop/layout/RegionArea.java
+++ b/src/org/apache/fop/layout/RegionArea.java
@@ -1,54 +1,11 @@
/*-- $Id$ --
-
- ============================================================================
- The Apache Software License, Version 1.1
- ============================================================================
-
- Copyright (C) 1999 The Apache Software Foundation. All rights reserved.
-
- Redistribution and use in source and binary forms, with or without modifica-
- tion, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following disclaimer in the documentation
- and/or other materials provided with the distribution.
-
- 3. The end-user documentation included with the redistribution, if any, must
- include the following acknowledgment: "This product includes software
- developed by the Apache Software Foundation (http://www.apache.org/)."
- Alternately, this acknowledgment may appear in the software itself, if
- and wherever such third-party acknowledgments normally appear.
-
- 4. The names "Fop" and "Apache Software Foundation" must not be used to
- endorse or promote products derived from this software without prior
- written permission. For written permission, please contact
- apache@apache.org.
-
- 5. Products derived from this software may not be called "Apache", nor may
- "Apache" appear in their name, without prior written permission of the
- Apache Software Foundation.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLU-
- DING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
- This software consists of voluntary contributions made by many individuals
- on behalf of the Apache Software Foundation and was originally created by
- James Tauber <jtauber@jtauber.com>. For more information on the Apache
- Software Foundation, please see <http://www.apache.org/>.
-
+ *
+ * Copyright (C) 2001 The Apache Software Foundation. All rights reserved.
+ * For details on use and redistribution please refer to the
+ * LICENSE file included with these sources."
*/
package org.apache.fop.layout;
+
import org.apache.fop.fo.properties.*;
import org.apache.fop.datatypes.ColorType;
@@ -80,4 +37,5 @@ public class RegionArea {
this.backgroundColor = bgColor;
}
+ public int getHeight() { return height; }
}