]> source.dussan.org Git - xmlgraphics-fop.git/commitdiff
region-start, region-end support
authorarved <arved@unknown>
Sun, 4 Mar 2001 23:10:13 +0000 (23:10 +0000)
committerarved <arved@unknown>
Sun, 4 Mar 2001 23:10:13 +0000 (23:10 +0000)
git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194134 13f79535-47bb-0310-9956-ffa450edef68

src/org/apache/fop/fo/StandardElementMapping.java
src/org/apache/fop/fo/flow/StaticContent.java
src/org/apache/fop/fo/pagination/PageSequence.java
src/org/apache/fop/fo/pagination/Region.java
src/org/apache/fop/fo/pagination/RegionAfter.java
src/org/apache/fop/fo/pagination/RegionBefore.java
src/org/apache/fop/fo/pagination/SimplePageMaster.java
src/org/apache/fop/layout/Page.java
src/org/apache/fop/layout/PageMaster.java
src/org/apache/fop/layout/RegionArea.java

index 891c3d5ff338697db66f52b281f1443820e64aa5..83d7f82566f6dc0a6fd092182aae1b5602541d28 100644 (file)
@@ -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());
index dcbf7bd2553c33362d0ad56bc10d89477786d867..d1a8f009bdf135c8a61e0a611d12f76abf352b1f 100644 (file)
@@ -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;
+           }
            
        }
        
index 060ccc8941874ac66afe0d0982c4265ac35c0ebd..380f238202343756797e0a9d53b99d6d91179a8b 100644 (file)
@@ -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);
+           }
        }
        
     }
index 449982bcad9fcff60e4b3349895c9a0769cb26f8..af1f50e070bb144f47fcf4b5596da2fbcb8e9687 100644 (file)
@@ -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.) 
      */
index 8289075490e9b492996627cf3cba961a7ba1752e..614319ada61759d7034f82a7248474c8ca0ca9d6 100644 (file)
@@ -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);
+       }
 }
index 2fcbf0259cc2e3fcda59cc5c6a9ab69839937c9d..dcc60aaa630877ba4704a2be0c26dbec15d97dd8 100644 (file)
@@ -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);
+       }
 }
index e9a0e0cf34e1d87a6786a4fc5f8a28be90b26a41..b87664a3a4692ccc066f356bc55cc32a3be5674c 100644 (file)
@@ -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);
index c58ebe115f556500f5fdbfc4f0d3858fc8e056fc..1d821850324d3e28a2d8cbca4d0b554bed3022de 100644 (file)
@@ -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;
     }
index 6e60886e2da6a0289ee5a647d724b65a05d049b8..16285950957ef15e44565e683a878a13735c8e38 100644 (file)
@@ -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 {
index b7ab3970f93e3554e8a7486d3f5fd24c2cc0e6be..45b0b48dc9a8cbb251fe615473664d4b7b5a9f40 100644 (file)
@@ -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; }
 }