klease      01/07/20 14:00:08

  Modified:    src/org/apache/fop/fo/flow Table.java TableColumn.java
                        TableCell.java
  Log:
  Fix some bugs in table and cell border drawing and cell width calculations
  
  Revision  Changes    Path
  1.31      +46 -50    xml-fop/src/org/apache/fop/fo/flow/Table.java
  
  Index: Table.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/flow/Table.java,v
  retrieving revision 1.30
  retrieving revision 1.31
  diff -u -r1.30 -r1.31
  --- Table.java        2001/05/10 00:52:58     1.30
  +++ Table.java        2001/07/20 21:00:08     1.31
  @@ -1,52 +1,7 @@
  -/*-- $Id: Table.java,v 1.30 2001/05/10 00:52:58 arved Exp $ --
  -
  - ============================================================================
  -                                                                      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
  -             [EMAIL PROTECTED]
  -
  - 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 <[EMAIL PROTECTED]>. For more  information on the Apache
  - Software Foundation, please see <http://www.apache.org/>.
  -
  +/*-- $Id: Table.java,v 1.31 2001/07/20 21:00:08 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.
    */
   
   package org.apache.fop.fo.flow;
  @@ -353,7 +308,7 @@
                                for (int i = 0; i < numChildren; i++) {
                                                FONode fo = (FONode) 
children.elementAt(i);
                                                if (fo instanceof TableColumn) {
  -                                                             ((TableColumn) 
fo).setHeight(areaContainer.getHeight());
  +                                                             ((TableColumn) 
fo).setHeight(areaContainer.getContentHeight());
                                                }
                                }
                }
  @@ -372,4 +327,45 @@
                                                return 0; // not laid out yet
                }
   
  +//           /**
  +//            * Return the last TableRow in the header or null if no header or
  +//            * no header in non-first areas.
  +//            * @param bForInitialArea If true, return the header row for the
  +//            * initial table area, else for a continuation area, taking into
  +//            * account the omit-header-at-break property.
  +//            */
  +//           TableRow getLastHeaderRow(boolean bForInitialArea) {
  +//                           // Check omit...
  +//                           if ((tableHeader != null)  &&
  +//                                           (bForInitialArea || omitHeaderAtBreak 
== false)) {
  +//                                           return 
tableHeader.children.lastElement();
  +//                           }
  +//                           return null;
  +//           }
  +
  +//           /**
  +//            * Return the first TableRow in the footer or null if no footer or
  +//            * no footer in non-last areas.
  +//            * @param bForFinalArea If true, return the footer row for the
  +//            * final table area, else for a non-final area, taking into
  +//            * account the omit-footer-at-break property.
  +//            */
  +//           TableRow getLastFooterRow(boolean bForFinalArea) {
  +//                           if ((tableFooter != null) &&
  +//                                           (bForFinalArea || omitFooterAtBreak == 
false)) {
  +//                                           return 
tableFooter.children.firstElement();
  +//                           }
  +//                           return null;
  +//           }
  +
  +
  +//           /**
  +//            * Return border information for the side (start/end) of the column
  +//            * whose number is iColNumber (first column = 1).
  +//            * ATTENTION: for now we assume columns are in order in the array!
  +//            */
  +//           BorderInfo getColumnBorder(BorderInfo.Side side, int iColNumber) {
  +//                           TableColumn col = 
(TableColumn)columns.elementAt(iColNumber);
  +//                           return col.getBorderInfo(side);
  +//           }
   }
  
  
  
  1.16      +6 -4      xml-fop/src/org/apache/fop/fo/flow/TableColumn.java
  
  Index: TableColumn.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/flow/TableColumn.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- TableColumn.java  2001/05/10 00:53:22     1.15
  +++ TableColumn.java  2001/07/20 21:00:08     1.16
  @@ -1,4 +1,4 @@
  -/*-- $Id: TableColumn.java,v 1.15 2001/05/10 00:53:22 arved Exp $ --
  +/*-- $Id: TableColumn.java,v 1.16 2001/07/20 21:00:08 klease Exp $ --
   
    ============================================================================
                                                                         The Apache 
Software License, Version 1.1
  @@ -127,11 +127,13 @@
                                }
                        }
   
  +                     // KL: don't take table borders into account!
        this.areaContainer =
                        new AreaContainer(propMgr.getFontState(area.getFontInfo()),
  -                                                                                    
         columnOffset - area.getBorderLeftWidth(),
  -                                                                                    
         -area.getBorderTopWidth(), columnWidth,
  -                             area.getHeight(), Position.RELATIVE);
  +                                                                                    
         columnOffset /*- area.getBorderLeftWidth()*/,
  +                                                                                    
         /*-area.getBorderTopWidth()*/ 0, columnWidth,
  +                                                                                    
         area.getContentHeight(), Position.RELATIVE);
  +     //      area.getHeight(), Position.RELATIVE);
        areaContainer.foCreator=this;   // G Seshadri
        areaContainer.setPage(area.getPage());
        areaContainer.setBorderAndPadding(propMgr.getBorderAndPadding());
  
  
  
  1.35      +28 -13    xml-fop/src/org/apache/fop/fo/flow/TableCell.java
  
  Index: TableCell.java
  ===================================================================
  RCS file: /home/cvs/xml-fop/src/org/apache/fop/fo/flow/TableCell.java,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -r1.34 -r1.35
  --- TableCell.java    2001/07/18 21:24:36     1.34
  +++ TableCell.java    2001/07/20 21:00:08     1.35
  @@ -1,4 +1,4 @@
  -/*-- $Id: TableCell.java,v 1.34 2001/07/18 21:24:36 klease Exp $ --
  +/*-- $Id: TableCell.java,v 1.35 2001/07/20 21:00:08 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.
  @@ -40,14 +40,26 @@
                 */
                protected int startOffset;
   
  -             /** Dimension of content rectangle in inline-progression-direction */
  +             /** Dimension of allocation rectangle in inline-progression-direction,
  +              *  determined by the width of the column(s) occupied by the cell
  +              */
                protected int width;
   
                /** Offset of content rectangle, in block-progression-direction,
                 * relative to the row.
  +              */
  +             protected int beforeOffset=0;
  +
  +             /** Offset of content rectangle, in inline-progression-direction,
  +              * relative to the column start edge.
                 */
  -             protected int beforeOffset;
  +             protected int startAdjust=0;
   
  +             /** Adjust to theoretical column width to obtain content width
  +              * relative to the column start edge.
  +              */
  +             protected int widthAdjust=0;
  +
                /* For collapsed border style */
                protected int borderHeight = 0;
                /**
  @@ -120,6 +132,9 @@
   
                        bSepBorders = 
(this.properties.get("border-collapse").getEnum() ==
                                                                                       
                 BorderCollapse.SEPARATE);
  +
  +                     calcBorders(propMgr.getBorderAndPadding());
  +
                        // Vertical cell alignment
                        verticalAlign = this.properties.get("display-align").getEnum();
                        if (verticalAlign == DisplayAlign.AUTO) {
  @@ -145,7 +160,7 @@
   //                                           }
   
                                                // Calculate cell borders
  -                                             
calcBorders(propMgr.getBorderAndPadding());
  +                                             // 
calcBorders(propMgr.getBorderAndPadding());
   
                                                area.getIDReferences().createID(id);
   
  @@ -169,8 +184,9 @@
                                // and padding are outside of this rectangle.
                                this.cellArea =
                                                new 
AreaContainer(propMgr.getFontState(area.getFontInfo()),
  -                                                                                    
                                 startOffset, beforeOffset,
  -                                                                                    
                                 width, spaceLeft,
  +                                                                                    
                                 startOffset+startAdjust,
  +                                                                                    
                                 beforeOffset,
  +                                                                                    
                                 width-widthAdjust, spaceLeft,
                                                                                       
                                 Position.RELATIVE);
   
                                cellArea.foCreator=this;        // G Seshadri
  @@ -306,15 +322,14 @@
                                                 * but it inherits.
                                                 */
                                                int iSep = 
properties.get("border-separation.inline-progression-direction").getLength().mvalue();
  -                                             int contentOffset = iSep/2 + 
bp.getBorderLeftWidth(false) +
  +                                             this.startAdjust = iSep/2 + 
bp.getBorderLeftWidth(false) +
                                                                
bp.getPaddingLeft(false);
                                                /*
                                                int contentOffset = iSep + 
bp.getBorderStartWidth(false) +
                                                                
bp.getPaddingStart(false);
                                                */
  -                                             this.startOffset += contentOffset;
  -                                             this.width -= (contentOffset + iSep - 
iSep/2 +
  -                                                             
bp.getBorderRightWidth(false) + bp.getPaddingRight(false));
  +                                             this.widthAdjust = startAdjust + iSep 
- iSep/2 +
  +                                                             
bp.getBorderRightWidth(false) + bp.getPaddingRight(false);
                                                // bp.getBorderEndWidth(false) + 
bp.getPaddingEnd(false);
                                                // Offset of content rectangle in the 
block-progression direction
                                                m_borderSeparation =
  @@ -376,10 +391,10 @@
                                                int borderBefore = 
bp.getBorderTopWidth(false);
                                                int borderAfter  = 
bp.getBorderBottomWidth(false);
   
  -                                             int contentOffset = borderStart/2 + 
bp.getPaddingLeft(false);
  +                                             this.startAdjust = borderStart/2 + 
bp.getPaddingLeft(false);
   
  -                                             this.startOffset += contentOffset;
  -                                             this.width -= (contentOffset + 
borderEnd/2 + bp.getPaddingRight(false));
  +                                             this.widthAdjust = startAdjust + 
borderEnd/2 +
  +                                                             
bp.getPaddingRight(false);
                                                this.beforeOffset = borderBefore/2 + 
bp.getPaddingTop(false);
                                                // Half border height to fix 
overestimate of area size!
                                                this.borderHeight = (borderBefore + 
borderAfter)/2;
  
  
  

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

Reply via email to