klease      02/02/23 08:50:58

  Modified:    src/org/apache/fop/layout MarginProps.java
               src/org/apache/fop/fo/pagination RegionBody.java
                        SimplePageMaster.java
  Log:
  Correct margin handling on body region for writing-mode
  
  Revision  Changes    Path
  1.3       +2 -2      xml-fop/src/org/apache/fop/layout/MarginProps.java
  
  Index: MarginProps.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/layout/MarginProps.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- MarginProps.java  30 Jul 2001 20:29:27 -0000      1.2
  +++ MarginProps.java  23 Feb 2002 16:50:58 -0000      1.3
  @@ -1,5 +1,5 @@
   /*
  - * $Id: MarginProps.java,v 1.2 2001/07/30 20:29:27 tore Exp $
  + * $Id: MarginProps.java,v 1.3 2002/02/23 16:50:58 klease Exp $
    * 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.
  @@ -8,7 +8,7 @@
   package org.apache.fop.layout;
   
   /**
  - * Store all hyphenation related properties on an FO.
  + * Store all block-level margin related properties on an FO.
    * Public "structure" allows direct member access.
    */
   public class MarginProps {
  
  
  
  1.17      +31 -16    xml-fop/src/org/apache/fop/fo/pagination/RegionBody.java
  
  Index: RegionBody.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/pagination/RegionBody.java,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- RegionBody.java   18 Feb 2002 22:49:22 -0000      1.16
  +++ RegionBody.java   23 Feb 2002 16:50:58 -0000      1.17
  @@ -1,5 +1,5 @@
   /*
  - * $Id: RegionBody.java,v 1.16 2002/02/18 22:49:22 klease Exp $
  + * $Id: RegionBody.java,v 1.17 2002/02/23 16:50:58 klease Exp $
    * 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.
  @@ -13,7 +13,9 @@
   // FOP
   
   import org.apache.fop.fo.FONode;
  +import org.apache.fop.fo.FObj;
   import org.apache.fop.fo.PropertyList;
  +import org.apache.fop.fo.Property;
   import org.apache.fop.fo.properties.Overflow;
   import org.apache.fop.datatypes.ColorType;
   import org.apache.fop.datatypes.FODimension;
  @@ -32,22 +34,35 @@
   
       protected Rectangle getViewportRectangle (FODimension reldims)
       {
  -        // Common Margin Properties-Block
  -     // Need these in writing-mode relative coordinates
  -     // Or shall we get absolute and transform to relative using writing mode?
  +     /*
  +      * Use space-before and space-after which will use corresponding
  +      * absolute margin properties if specified. For indents:
  +      * try to get corresponding absolute margin property using the
  +      * writing-mode on the page (not on the region-body!). If that's not
  +      * set but indent is explicitly set, it will return that.
  +      */
           MarginProps mProps = propMgr.getMarginProps();
  -     /**
  -     System.err.println("BodyRegion margin props=" + mProps.startIndent + ","
  -                        + mProps.spaceBefore + "," + mProps.endIndent + ","
  -                        + mProps.spaceAfter);
  -
  -        return new Rectangle( mProps.startIndent, mProps.spaceBefore,
  -                           reldims.ipd - mProps.startIndent - mProps.endIndent,
  -                           reldims.bpd - mProps.spaceBefore - mProps.spaceAfter);
  -     **/
  -     return new Rectangle( mProps.marginLeft, mProps.marginTop,
  -                           reldims.ipd - mProps.marginLeft - mProps.marginRight,
  -                           reldims.bpd - mProps.marginTop - mProps.marginBottom);
  +     int start = getRelMargin(PropertyList.START, "start-indent");
  +     return new Rectangle( start, mProps.spaceBefore,
  +                           reldims.ipd - start -
  +                           getRelMargin(PropertyList.END, "end-indent"),
  +                           reldims.bpd - mProps.spaceBefore -
  +                           mProps.spaceAfter);
  +    }
  +
  +    /**
  +     * Get the relative margin using parent's writing mode, not own
  +     * writing mode.
  +     */
  +    private int getRelMargin(int reldir, String sRelPropName) {
  +     FObj parent = (FObj) getParent();
  +     String sPropName = "margin-" +
  +         parent.properties.wmRelToAbs(reldir);
  +     Property prop = properties.getExplicitBaseProp(sPropName);
  +     if (prop == null) {
  +        prop = properties.getExplicitBaseProp(sRelPropName);
  +     }
  +     return ((prop != null)? prop.getLength().mvalue() : 0);
       }
   
       protected void setRegionTraits(RegionReference r, Rectangle2D absRegVPRect) {
  
  
  
  1.24      +5 -1      xml-fop/src/org/apache/fop/fo/pagination/SimplePageMaster.java
  
  Index: SimplePageMaster.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/pagination/SimplePageMaster.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- SimplePageMaster.java     18 Feb 2002 22:49:22 -0000      1.23
  +++ SimplePageMaster.java     23 Feb 2002 16:50:58 -0000      1.24
  @@ -1,5 +1,5 @@
   /*
  - * $Id: SimplePageMaster.java,v 1.23 2002/02/18 22:49:22 klease Exp $
  + * $Id: SimplePageMaster.java,v 1.24 2002/02/23 16:50:58 klease Exp $
    * 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.
  @@ -123,6 +123,10 @@
        //  _regions = null; // PageSequence access SimplePageMaster....
           children = null;
           properties = null;
  +    }
  +
  +    public boolean generatesReferenceAreas() {
  +        return true;
       }
   
       public PageMaster getPageMaster() {
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to