klease      2002/09/26 14:07:48

  Modified:    src/org/apache/fop/layout Tag: fop-0_20_2-maintain Area.java
                        LineArea.java
               src/org/apache/fop/layout/inline Tag: fop-0_20_2-maintain
                        ForeignObjectArea.java
  Log:
  Improve link hotspot positioning
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.24.2.3  +25 -15    xml-fop/src/org/apache/fop/layout/Attic/Area.java
  
  Index: Area.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/layout/Attic/Area.java,v
  retrieving revision 1.24.2.2
  retrieving revision 1.24.2.3
  diff -u -r1.24.2.2 -r1.24.2.3
  --- Area.java 2 Aug 2002 20:28:52 -0000       1.24.2.2
  +++ Area.java 26 Sep 2002 21:07:48 -0000      1.24.2.3
  @@ -38,8 +38,10 @@
       // used to keep track of the current x position within a table.  Required for 
drawing rectangle links.
       protected int tableCellXOffset = 0;
   
  -    // used to keep track of the absolute height on the page.  Required for drawing 
rectangle links.
  -    private int absoluteHeight = 0;
  +    /** Stores position of top of this area relative to page column Ypos.
  +     *  Used to set the position of link hotspot rectangles.
  +     */
  +    private int absoluteYtop = 0;
   
       protected int contentRectangleWidth;
   
  @@ -114,7 +116,6 @@
   
       public void addDisplaySpace(int size) {
           this.addChild(new DisplaySpace(size));
  -        this.absoluteHeight += size;
           this.currentHeight += size;
       }
   
  @@ -253,33 +254,43 @@
           tableCellXOffset = offset;
       }
   
  +    /**
  +     * Return absolute Y position of the current bottom of this area,
  +     * not counting any bottom padding or border. This is used
  +     * to set positions for link hotspots.
  +     * In fact, the position is not really absolute, but is relative
  +     * to the Ypos of the column-level AreaContainer, even when the
  +     * area is in a page header or footer!
  +     */
       public int getAbsoluteHeight() {
  -        return absoluteHeight;
  +        return absoluteYtop + getPaddingTop() + getBorderTopWidth() +
  +         currentHeight;
       }
   
  +    /**
  +     * Set "absolute" Y position of the top of this area. In fact, the
  +     * position is not really absolute, but relative to the Ypos of
  +     * the column-level AreaContainer, even when the area is in a
  +     * page header or footer!
  +     * It is set from the value of getAbsoluteHeight() on the parent
  +     * area, just before adding this area.
  +     */
       public void setAbsoluteHeight(int value) {
  -        absoluteHeight = value;
  -    }
  -
  -    public void increaseAbsoluteHeight(int value) {
  -        absoluteHeight += value;
  +        absoluteYtop = value;
       }
   
       public void increaseHeight(int amount) {
           this.currentHeight += amount;
  -        this.absoluteHeight += amount;
       }
   
       // Remove allocation height of child
       public void removeChild(Area area) {
           this.currentHeight -= area.getHeight();
  -        this.absoluteHeight -= area.getHeight();
           this.children.remove(area);
       }
   
       public void removeChild(DisplaySpace spacer) {
           this.currentHeight -= spacer.getSize();
  -        this.absoluteHeight -= spacer.getSize();
           this.children.remove(spacer);
       }
   
  @@ -329,7 +340,6 @@
           if (currentHeight > getMaxHeight()) {
               currentHeight = getMaxHeight();
           }
  -        absoluteHeight += (currentHeight - prevHeight);
       }
   
       public void setMaxHeight(int height) {
  @@ -361,7 +371,7 @@
   
       public AreaContainer getNearestAncestorAreaContainer() {
           Area area = this.getParent();
  -        while (!(area instanceof AreaContainer)) {
  +        while (area != null && !(area instanceof AreaContainer)) {
               area = area.getParent();
           }
           return (AreaContainer)area;
  
  
  
  1.53.2.10 +9 -3      xml-fop/src/org/apache/fop/layout/Attic/LineArea.java
  
  Index: LineArea.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/layout/Attic/LineArea.java,v
  retrieving revision 1.53.2.9
  retrieving revision 1.53.2.10
  diff -u -r1.53.2.9 -r1.53.2.10
  --- LineArea.java     9 Aug 2002 21:28:56 -0000       1.53.2.9
  +++ LineArea.java     26 Sep 2002 21:07:48 -0000      1.53.2.10
  @@ -551,7 +551,7 @@
               }
   
               addSpacedWord(new String(data, wordStart, wordLength), ls,
  -                          finalWidth + spaceWidth + embeddedLinkStart,
  +                          finalWidth + pendingWidth,
                             spaceWidth, textState, true);
   
               embeddedLinkStart += wordWidth;
  @@ -1051,9 +1051,14 @@
   
       public void setLinkSet(LinkSet ls) {}
   
  -    public void addInlineArea(Area box) {
  +    public void addInlineArea(InlineArea box, LinkSet ls) {
           addPending();
           addChild(box);
  +     if (ls != null) {
  +         Rectangle lr=new Rectangle(finalWidth, 0,box.getContentWidth(),
  +                                    box.getContentHeight());
  +         ls.addRect(lr, this, box);
  +     }
           prev = TEXT;
           finalWidth += box.getContentWidth();
       }
  @@ -1405,4 +1410,5 @@
       }
   
   }
  +
   
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.5.2.2   +5 -1      
xml-fop/src/org/apache/fop/layout/inline/Attic/ForeignObjectArea.java
  
  Index: ForeignObjectArea.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/org/apache/fop/layout/inline/Attic/ForeignObjectArea.java,v
  retrieving revision 1.5.2.1
  retrieving revision 1.5.2.2
  diff -u -r1.5.2.1 -r1.5.2.2
  --- ForeignObjectArea.java    2 Aug 2002 20:28:53 -0000       1.5.2.1
  +++ ForeignObjectArea.java    26 Sep 2002 21:07:48 -0000      1.5.2.2
  @@ -62,6 +62,10 @@
           return getEffectiveHeight();
       }
   
  +    public int getContentHeight() {
  +        return getEffectiveHeight();
  +    }
  +
       public int getXOffset() {
           return this.xOffset;
       }
  
  
  

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

Reply via email to