CVS: jfor/src/org/jfor/jfor/converter TableHeaderBuilder.java,NONE,1.1 AfterBuilder.java,1.2,1.3 TableAttributesConverter.java,1.8,1.9 BeforeBuilder.java,1.2,1.3 AbstractBuilder.java,1.9,1.10 Converter.java,1.14,1.15 TableCellBuilder.java,1.4,1.5 TextAttributesConverter.java,1.9,1.10 ParagraphBuilder.java,1.9,1.10 TableRowBuilder.java,1.4,1.5

Marra Roberto <[email protected]> Tue, 18 Feb 2003 08:11:28 -0800
Newsgroups gmane.text.xml.jfor.cvs
Message-ID <[email protected]>
Update of /cvsroot/jfor/jfor/src/org/jfor/jfor/converter
In directory sc8-pr-cvs1:/tmp/cvs-serv29650/src/org/jfor/jfor/converter

Modified Files:
	AfterBuilder.java TableAttributesConverter.java 
	BeforeBuilder.java AbstractBuilder.java Converter.java 
	TableCellBuilder.java TextAttributesConverter.java 
	ParagraphBuilder.java TableRowBuilder.java 
Added Files:
	TableHeaderBuilder.java 
Log Message:
Contributions Normand Massé
inheritance and other fixes

--- NEW FILE: TableHeaderBuilder.java ---
package org.jfor.jfor.converter;

import java.io.IOException;
import org.xml.sax.Attributes;
import org.jfor.jfor.rtflib.rtfdoc.*;

/*-----------------------------------------------------------------------------
 * jfor - Open-Source XSL-FO to RTF converter - see www.jfor.org
 *
 * ====================================================================
 * jfor Apache-Style Software License.
 * Copyright (c) 2002 by the jfor project. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, 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 jfor project (http://www.jfor.org)."
 * Alternately, this acknowledgment may appear in the software itself,
 * if and wherever such third-party acknowledgments normally appear.
 *
 * 4. The name "jfor" 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 "jfor",
 * nor may "jfor" appear in their name, without prior written
 * permission of [email protected].
 *
 * 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 JFOR PROJECT OR ITS CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, 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.
 * ====================================================================
 * Contributor(s):
 *  @author Andreas Putz [email protected]
-----------------------------------------------------------------------------*/

/**  An IBuilder that handles fo:table-header
 *  @author Normand Masse
 */

class TableHeaderBuilder extends AbstractBuilder
{
    TableHeaderBuilder(BuilderContext ctx)
    {
        super(ctx);
    }

    /** called by Converter at the start of an element */
    public void start(String rawName, Attributes atts)
    throws IOException
    {
        // create an RtfTable in the current table container
        RtfTable tbl = (RtfTable)m_context.getContainer(RtfTable.class,true,this);
        RtfAttributes tblAttribs = TableAttributesConverter.convertRowAttributes (atts, tbl.getRtfAttributes() );
        tbl.setHeaderAttribs( tblAttribs );
        /** - end - */
    }

    /** called by Converter at the end of an element */
    public void end()
    throws IOException {
        RtfTable tbl = (RtfTable)m_context.getContainer(RtfTable.class,true,this);
        tbl.setHeaderAttribs( null );
    }

    /** return a TableBuilder for fo:table elements */
    public IBuilder getBuilder(BuilderContext ctx,String rawName, Attributes atts)
    {
        if(rawName.equals( "fo:table-header" ) ) return new TableHeaderBuilder(ctx);
        else return null;
    }
}

Index: AfterBuilder.java
===================================================================
RCS file: /cvsroot/jfor/jfor/src/org/jfor/jfor/converter/AfterBuilder.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** AfterBuilder.java	13 Aug 2002 14:25:50 -0000	1.2
--- AfterBuilder.java	18 Feb 2003 16:10:45 -0000	1.3
***************
*** 53,57 ****
   * ====================================================================
   * Contributor(s):
!  *  @author Andreas Lambert <[email protected]> 
  -----------------------------------------------------------------------------*/
  
--- 53,57 ----
   * ====================================================================
   * Contributor(s):
!  *  @author Andreas Lambert <[email protected]>
  -----------------------------------------------------------------------------*/
  
***************
*** 59,62 ****
--- 59,66 ----
  // $Id$
  // $Log$
+ // Revision 1.3  2003/02/18 16:10:45  rmarra
+ // Contributions Normand Massé
+ // inheritance and other fixes
+ //
  // Revision 1.2  2002/08/13 14:25:50  bdelacretaz
  // extraneous System.err message removed
***************
*** 89,96 ****
      /** called by Converter at the start of an element */
      public void start(String rawName, Attributes attrs) throws IOException {
!         //we know that the only attribute will be \footer
!         afterAttributes = new RtfAttributes();
!         afterAttributes.set(RtfAfter.FOOTER);
          final IRtfAfterContainer c = (IRtfAfterContainer)m_context.getContainer(IRtfAfterContainer.class,true,this);
          m_after = c.newAfter(afterAttributes);
          m_context.pushContainer(m_after);
--- 93,112 ----
      /** called by Converter at the start of an element */
      public void start(String rawName, Attributes attrs) throws IOException {
!         
          final IRtfAfterContainer c = (IRtfAfterContainer)m_context.getContainer(IRtfAfterContainer.class,true,this);
+ 
+         // Added by Normand Masse
+         // Try to use the parents attributes
+         afterAttributes = ((RtfElement)c).getRtfAttributes();
+         if ( afterAttributes == null ) {
+             afterAttributes = new RtfAttributes();
+         }
+ 
+         afterAttributes.set(RtfAfter.FOOTER);
+ 
+         // Added by Normand Masse
+         // Indicate the XSL attributes used to build the Rtf attributes
+         afterAttributes.setXslAttributes( attrs );        
+         
          m_after = c.newAfter(afterAttributes);
          m_context.pushContainer(m_after);
***************
*** 114,118 ****
            equals=true;
          }
!         
          if(rawName.equals(TAG_STATIC) && equals) {
            return new AfterBuilder(ctx);
--- 130,134 ----
            equals=true;
          }
! 
          if(rawName.equals(TAG_STATIC) && equals) {
            return new AfterBuilder(ctx);

Index: TableAttributesConverter.java
===================================================================
RCS file: /cvsroot/jfor/jfor/src/org/jfor/jfor/converter/TableAttributesConverter.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** TableAttributesConverter.java	12 Aug 2002 09:40:02 -0000	1.8
--- TableAttributesConverter.java	18 Feb 2003 16:10:46 -0000	1.9
***************
*** 64,67 ****
--- 64,71 ----
  // $Id$
  // $Log$
+ // Revision 1.9  2003/02/18 16:10:46  rmarra
+ // Contributions Normand Massé
+ // inheritance and other fixes
+ //
  // Revision 1.8  2002/08/12 09:40:02  bdelacretaz
  // V0.7.1dev-e, contributions from Boris Poudérous for number-columns-spanned
***************
*** 100,104 ****
      }
  
- 
      //////////////////////////////////////////////////
      // @@ Static converter methods
--- 104,107 ----
***************
*** 118,121 ****
--- 121,129 ----
      throws ConverterException {
          RtfAttributes attrib = new RtfAttributes();
+         
+ 		// Added by Normand Masse
+ 		// Default attributes are fetched from Rtf attributes (coming from parent)
+ 		Attributes defAttrs = defaultAttributes == null ? null : defaultAttributes.getXslAttributes();
+ 		attrib.setXslAttributes( defAttrs );        
          String attrValue;
          boolean isBorderPresent=false;
***************
*** 126,132 ****
           * Added by Boris POUDEROUS on 2002/06/25
           */
!         if (AbstractBuilder.attributeIsSet(attrs,"background-color"))
            {
!             attrValue = new String(attrs.getValue("background-color"));
              attrib.set(ITableAttributes.CELL_COLOR_BACKGROUND, FoColorConverter.getInstance().getRtfColorNumber(attrValue, null).intValue());
            }
--- 134,140 ----
           * Added by Boris POUDEROUS on 2002/06/25
           */
!         if ( AbstractBuilder.attributeIsSet(attrs,"background-color", defAttrs))
            {
!             attrValue = new String(AbstractBuilder.getValue( attrs, "background-color", defAttrs ));
              attrib.set(ITableAttributes.CELL_COLOR_BACKGROUND, FoColorConverter.getInstance().getRtfColorNumber(attrValue, null).intValue());
            }
***************
*** 136,167 ****
           * Added by Boris POUDEROUS on 2002/06/27
           */
!         if(AbstractBuilder.attributeIsSet(attrs,"border-color")){
!             attrValue = new String(attrs.getValue("border-color"));
              attrib.set(BorderAttributesConverter.BORDER_COLOR, BorderAttributesConverter.convertAttributetoRtf(attrValue));
              isBorderPresent=true;
          }
!         if(AbstractBuilder.attributeIsSet(attrs,"border-top-color")){
!             attrValue = new String(attrs.getValue("border-top-color"));
              attrib.set(BorderAttributesConverter.BORDER_COLOR, BorderAttributesConverter.convertAttributetoRtf(attrValue));
              isBorderPresent=true;
          }
!         if(AbstractBuilder.attributeIsSet(attrs,"border-bottom-color")){
!             attrValue = new String(attrs.getValue("border-bottom-color"));
              attrib.set(BorderAttributesConverter.BORDER_COLOR, BorderAttributesConverter.convertAttributetoRtf(attrValue));
              isBorderPresent=true;
          }
!         if(AbstractBuilder.attributeIsSet(attrs,"border-left-color")){
!             attrValue = new String(attrs.getValue("border-left-color"));
              attrib.set(BorderAttributesConverter.BORDER_COLOR, BorderAttributesConverter.convertAttributetoRtf(attrValue));
              isBorderPresent=true;
          }
!         if(AbstractBuilder.attributeIsSet(attrs,"border-right-color")){
!             attrValue = new String(attrs.getValue("border-right-color"));
              attrib.set(BorderAttributesConverter.BORDER_COLOR, BorderAttributesConverter.convertAttributetoRtf(attrValue));
              isBorderPresent=true;
          }
  
!         if(AbstractBuilder.attributeIsSet(attrs,"border-style")){
!             attrValue = new String(attrs.getValue("border-style"));
              attrib.set(ITableAttributes.CELL_BORDER_LEFT,"\\"+BorderAttributesConverter.convertAttributetoRtf(attrValue));
              attrib.set(ITableAttributes.CELL_BORDER_RIGHT,"\\"+BorderAttributesConverter.convertAttributetoRtf(attrValue));
--- 144,178 ----
           * Added by Boris POUDEROUS on 2002/06/27
           */
!         if(AbstractBuilder.attributeIsSet(attrs,"border-color", defAttrs)){
!             attrValue = new String(AbstractBuilder.getValue( attrs, "border-color", defAttrs ));
              attrib.set(BorderAttributesConverter.BORDER_COLOR, BorderAttributesConverter.convertAttributetoRtf(attrValue));
              isBorderPresent=true;
          }
!         if(AbstractBuilder.attributeIsSet(attrs,"border-top-color", defAttrs )){
!             attrValue = new String(AbstractBuilder.getValue( attrs, "border-top-color", defAttrs ));
              attrib.set(BorderAttributesConverter.BORDER_COLOR, BorderAttributesConverter.convertAttributetoRtf(attrValue));
              isBorderPresent=true;
          }
!         if(AbstractBuilder.attributeIsSet(attrs,"border-bottom-color", defAttrs )){
!             attrValue = new String(AbstractBuilder.getValue( attrs, "border-bottom-color", defAttrs ));
              attrib.set(BorderAttributesConverter.BORDER_COLOR, BorderAttributesConverter.convertAttributetoRtf(attrValue));
              isBorderPresent=true;
          }
!         if(AbstractBuilder.attributeIsSet(attrs,"border-left-color", defAttrs )){
!             attrValue = new String(AbstractBuilder.getValue( attrs, "border-left-color", defAttrs ));
              attrib.set(BorderAttributesConverter.BORDER_COLOR, BorderAttributesConverter.convertAttributetoRtf(attrValue));
              isBorderPresent=true;
          }
!         if(AbstractBuilder.attributeIsSet(attrs,"border-right-color", defAttrs )){
!             attrValue = new String(AbstractBuilder.getValue( attrs, "border-right-color", defAttrs ));
              attrib.set(BorderAttributesConverter.BORDER_COLOR, BorderAttributesConverter.convertAttributetoRtf(attrValue));
              isBorderPresent=true;
          }
  
!         // Added by Normand Masse
!         // Border styles do not inherit from parent
! 
!         if(AbstractBuilder.attributeIsSet(attrs,"border-style" )){
!             attrValue = new String(AbstractBuilder.getValue( attrs, "border-style"));
              attrib.set(ITableAttributes.CELL_BORDER_LEFT,"\\"+BorderAttributesConverter.convertAttributetoRtf(attrValue));
              attrib.set(ITableAttributes.CELL_BORDER_RIGHT,"\\"+BorderAttributesConverter.convertAttributetoRtf(attrValue));
***************
*** 170,193 ****
              isBorderPresent=true;
          }
!         if(AbstractBuilder.attributeIsSet(attrs,"border-top-style")){
!             attrValue = new String(attrs.getValue("border-top-style"));
              attrib.set(ITableAttributes.CELL_BORDER_TOP,
              "\\"+BorderAttributesConverter.convertAttributetoRtf(attrValue));
              isBorderPresent=true;
          }
!         if(AbstractBuilder.attributeIsSet(attrs,"border-bottom-style")){
!             attrValue = new String(attrs.getValue("border-bottom-style"));
              attrib.set(ITableAttributes.CELL_BORDER_BOTTOM,
              "\\"+BorderAttributesConverter.convertAttributetoRtf(attrValue));
              isBorderPresent=true;
          }
!         if(AbstractBuilder.attributeIsSet(attrs,"border-left-style")){
!             attrValue = new String(attrs.getValue("border-left-style"));
              attrib.set(ITableAttributes.CELL_BORDER_LEFT,
              "\\"+BorderAttributesConverter.convertAttributetoRtf(attrValue));
              isBorderPresent=true;
          }
!         if(AbstractBuilder.attributeIsSet(attrs,"border-right-style")){
!             attrValue = new String(attrs.getValue("border-right-style"));
              attrib.set(ITableAttributes.CELL_BORDER_RIGHT,
              "\\"+BorderAttributesConverter.convertAttributetoRtf(attrValue));
--- 181,204 ----
              isBorderPresent=true;
          }
!         if(AbstractBuilder.attributeIsSet(attrs,"border-top-style" )){
!             attrValue = new String(AbstractBuilder.getValue( attrs, "border-top-style" ));
              attrib.set(ITableAttributes.CELL_BORDER_TOP,
              "\\"+BorderAttributesConverter.convertAttributetoRtf(attrValue));
              isBorderPresent=true;
          }
!         if(AbstractBuilder.attributeIsSet(attrs,"border-bottom-style" )){
!             attrValue = new String(AbstractBuilder.getValue( attrs, "border-bottom-style" ));
              attrib.set(ITableAttributes.CELL_BORDER_BOTTOM,
              "\\"+BorderAttributesConverter.convertAttributetoRtf(attrValue));
              isBorderPresent=true;
          }
!         if(AbstractBuilder.attributeIsSet(attrs,"border-left-style"  )){
!             attrValue = new String(AbstractBuilder.getValue( attrs, "border-left-style" ));
              attrib.set(ITableAttributes.CELL_BORDER_LEFT,
              "\\"+BorderAttributesConverter.convertAttributetoRtf(attrValue));
              isBorderPresent=true;
          }
!         if(AbstractBuilder.attributeIsSet(attrs,"border-right-style" )){
!             attrValue = new String(AbstractBuilder.getValue( attrs, "border-right-style" ));
              attrib.set(ITableAttributes.CELL_BORDER_RIGHT,
              "\\"+BorderAttributesConverter.convertAttributetoRtf(attrValue));
***************
*** 195,200 ****
          }
  
!         if(AbstractBuilder.attributeIsSet(attrs,"border-width")) {
!             attrValue = new String(attrs.getValue("border-width"));
              attrib.set(BorderAttributesConverter.BORDER_WIDTH,
              (int)FoUnitsConverter.getInstance().convertToTwips(attrValue));
--- 206,211 ----
          }
  
!         if(AbstractBuilder.attributeIsSet(attrs,"border-width" )) {
!             attrValue = new String(AbstractBuilder.getValue( attrs, "border-width" ));
              attrib.set(BorderAttributesConverter.BORDER_WIDTH,
              (int)FoUnitsConverter.getInstance().convertToTwips(attrValue));
***************
*** 211,216 ****
           * Added by Boris POUDEROUS on 2002/06/27
           */
!         if(AbstractBuilder.attributeIsSet(attrs,"number-columns-spanned")) {
!             attrValue = new String(attrs.getValue("number-columns-spanned"));
              // Check whether if the number of columns is correct :
              boolean set = true;
--- 222,227 ----
           * Added by Boris POUDEROUS on 2002/06/27
           */
!         if(AbstractBuilder.attributeIsSet(attrs,"number-columns-spanned" )) {
!             attrValue = new String(AbstractBuilder.getValue( attrs, "number-columns-spanned" ));
              // Check whether if the number of columns is correct :
              boolean set = true;
***************
*** 242,246 ****
      static RtfAttributes convertRowAttributes(Attributes attrs, RtfAttributes defaultAttributes)
      throws ConverterException {
!         RtfAttributes attrib = new RtfAttributes();
          String attrValue;
          boolean isBorderPresent=false;
--- 253,262 ----
      static RtfAttributes convertRowAttributes(Attributes attrs, RtfAttributes defaultAttributes)
      throws ConverterException {
!         // Added by Normand Masse
!         // Default attributes are fetched from Rtf attributes (coming from parent)
!         RtfAttributes attrib = defaultAttributes == null ? new RtfAttributes() : (RtfAttributes) defaultAttributes.clone();
!         Attributes defAttrs = defaultAttributes == null ? null : defaultAttributes.getXslAttributes();
!         attrib.setXslAttributes( defAttrs );
! 
          String attrValue;
          boolean isBorderPresent=false;
***************
*** 248,257 ****
  
          //check for keep-together row attribute
!         if(AbstractBuilder.attributeIsSet(attrs,"keep-together.within-page")) {
              attrib.set(ITableAttributes.ROW_KEEP_TOGETHER);
          }
  
  
!         if(AbstractBuilder.attributeIsSet(attrs,"keep-together")) {
              attrib.set(ITableAttributes.ROW_KEEP_TOGETHER);
          }
--- 264,273 ----
  
          //check for keep-together row attribute
!         if(AbstractBuilder.attributeIsSet(attrs,"keep-together.within-page", defAttrs )) {
              attrib.set(ITableAttributes.ROW_KEEP_TOGETHER);
          }
  
  
!         if(AbstractBuilder.attributeIsSet(attrs,"keep-together", defAttrs )) {
              attrib.set(ITableAttributes.ROW_KEEP_TOGETHER);
          }
***************
*** 259,270 ****
  
          //Check for keep-with-next row attribute.
!         if (AbstractBuilder.attributeIsSet(attrs,"keep-with-next")) {
!         	attrib.set(ITableAttributes.ROW_KEEP_WITH_NEXT);
          }
  
  
!   		//Check for keep-with-previous row attribute.
!         if (AbstractBuilder.attributeIsSet(attrs,"keep-with-previous")) {
!         	attrib.set(ITableAttributes.ROW_KEEP_WITH_PREVIOUS);
          }
  
--- 275,286 ----
  
          //Check for keep-with-next row attribute.
!         if (AbstractBuilder.attributeIsSet(attrs,"keep-with-next", defAttrs )) {
!             attrib.set(ITableAttributes.ROW_KEEP_WITH_NEXT);
          }
  
  
!         //Check for keep-with-previous row attribute.
!         if (AbstractBuilder.attributeIsSet(attrs,"keep-with-previous", defAttrs )) {
!             attrib.set(ITableAttributes.ROW_KEEP_WITH_PREVIOUS);
          }
  
***************
*** 279,285 ****
           * of the border place.
           */
!         if(AbstractBuilder.attributeIsSet(attrs,"border-style")){
!             attrValue = new String(attrs.getValue("border-style"));
!             attrib.set(ITableAttributes.CELL_BORDER_LEFT,"\\"+BorderAttributesConverter.convertAttributetoRtf(attrValue));
              attrib.set(ITableAttributes.ROW_BORDER_RIGHT,"\\"+BorderAttributesConverter.convertAttributetoRtf(attrValue));
              attrib.set(ITableAttributes.ROW_BORDER_HORIZONTAL,"\\"+BorderAttributesConverter.convertAttributetoRtf(attrValue));
--- 295,301 ----
           * of the border place.
           */
!         if(AbstractBuilder.attributeIsSet(attrs,"border-style", defAttrs )){
!             attrValue = new String(AbstractBuilder.getValue( attrs, "border-style", defAttrs ));
!             attrib.set(ITableAttributes.ROW_BORDER_LEFT,"\\"+BorderAttributesConverter.convertAttributetoRtf(attrValue));
              attrib.set(ITableAttributes.ROW_BORDER_RIGHT,"\\"+BorderAttributesConverter.convertAttributetoRtf(attrValue));
              attrib.set(ITableAttributes.ROW_BORDER_HORIZONTAL,"\\"+BorderAttributesConverter.convertAttributetoRtf(attrValue));
***************
*** 289,294 ****
              isBorderPresent=true;
          }
!         if(AbstractBuilder.attributeIsSet(attrs,"border-top-style")){
!             attrValue = new String(attrs.getValue("border-top-style"));
              attrib.set(ITableAttributes.ROW_BORDER_TOP,
              "\\"+BorderAttributesConverter.convertAttributetoRtf(attrValue));
--- 305,310 ----
              isBorderPresent=true;
          }
!         if(AbstractBuilder.attributeIsSet(attrs,"border-top-style", defAttrs )){
!             attrValue = new String(AbstractBuilder.getValue( attrs, "border-top-style", defAttrs ));
              attrib.set(ITableAttributes.ROW_BORDER_TOP,
              "\\"+BorderAttributesConverter.convertAttributetoRtf(attrValue));
***************
*** 297,302 ****
              isBorderPresent=true;
          }
!         if(AbstractBuilder.attributeIsSet(attrs,"border-bottom-style")){
!             attrValue = new String(attrs.getValue("border-bottom-style"));
              attrib.set(ITableAttributes.ROW_BORDER_BOTTOM,
              "\\"+BorderAttributesConverter.convertAttributetoRtf(attrValue));
--- 313,318 ----
              isBorderPresent=true;
          }
!         if(AbstractBuilder.attributeIsSet(attrs,"border-bottom-style", defAttrs )){
!             attrValue = new String(AbstractBuilder.getValue( attrs, "border-bottom-style", defAttrs ));
              attrib.set(ITableAttributes.ROW_BORDER_BOTTOM,
              "\\"+BorderAttributesConverter.convertAttributetoRtf(attrValue));
***************
*** 305,310 ****
              isBorderPresent=true;
          }
!         if(AbstractBuilder.attributeIsSet(attrs,"border-left-style")){
!             attrValue = new String(attrs.getValue("border-left-style"));
              attrib.set(ITableAttributes.ROW_BORDER_LEFT,
              "\\"+BorderAttributesConverter.convertAttributetoRtf(attrValue));
--- 321,326 ----
              isBorderPresent=true;
          }
!         if(AbstractBuilder.attributeIsSet(attrs,"border-left-style", defAttrs )){
!             attrValue = new String(AbstractBuilder.getValue( attrs, "border-left-style", defAttrs ));
              attrib.set(ITableAttributes.ROW_BORDER_LEFT,
              "\\"+BorderAttributesConverter.convertAttributetoRtf(attrValue));
***************
*** 313,318 ****
              isBorderPresent=true;
          }
!         if(AbstractBuilder.attributeIsSet(attrs,"border-right-style")){
!             attrValue = new String(attrs.getValue("border-right-style"));
              attrib.set(ITableAttributes.ROW_BORDER_RIGHT,
              "\\"+BorderAttributesConverter.convertAttributetoRtf(attrValue));
--- 329,334 ----
              isBorderPresent=true;
          }
!         if(AbstractBuilder.attributeIsSet(attrs,"border-right-style", defAttrs )){
!             attrValue = new String(AbstractBuilder.getValue( attrs, "border-right-style", defAttrs ));
              attrib.set(ITableAttributes.ROW_BORDER_RIGHT,
              "\\"+BorderAttributesConverter.convertAttributetoRtf(attrValue));
***************
*** 321,326 ****
              isBorderPresent=true;
          }
!         if(AbstractBuilder.attributeIsSet(attrs,"border-horizontal-style")){
!             attrValue = new String(attrs.getValue("border-horizontal-style"));
              attrib.set(ITableAttributes.ROW_BORDER_HORIZONTAL,
              "\\"+BorderAttributesConverter.convertAttributetoRtf(attrValue));
--- 337,342 ----
              isBorderPresent=true;
          }
!         if(AbstractBuilder.attributeIsSet(attrs,"border-horizontal-style", defAttrs )){
!             attrValue = new String(AbstractBuilder.getValue( attrs, "border-horizontal-style", defAttrs ));
              attrib.set(ITableAttributes.ROW_BORDER_HORIZONTAL,
              "\\"+BorderAttributesConverter.convertAttributetoRtf(attrValue));
***************
*** 331,336 ****
              isBorderPresent=true;
          }
!         if(AbstractBuilder.attributeIsSet(attrs,"border-vertical-style")){
!             attrValue = new String(attrs.getValue("border-vertical-style"));
              attrib.set(ITableAttributes.ROW_BORDER_VERTICAL,
              "\\"+BorderAttributesConverter.convertAttributetoRtf(attrValue));
--- 347,352 ----
              isBorderPresent=true;
          }
!         if(AbstractBuilder.attributeIsSet(attrs,"border-vertical-style", defAttrs )){
!             attrValue = new String(AbstractBuilder.getValue( attrs, "border-vertical-style", defAttrs ));
              attrib.set(ITableAttributes.ROW_BORDER_VERTICAL,
              "\\"+BorderAttributesConverter.convertAttributetoRtf(attrValue));
***************
*** 343,348 ****
  
  
!         if(AbstractBuilder.attributeIsSet(attrs,"border-width")) {
!             attrValue = new String(attrs.getValue("border-width"));
              attrib.set(BorderAttributesConverter.BORDER_WIDTH,
              (int)FoUnitsConverter.getInstance().convertToTwips(attrValue));
--- 359,364 ----
  
  
!         if(AbstractBuilder.attributeIsSet(attrs,"border-width", defAttrs )) {
!             attrValue = new String(AbstractBuilder.getValue( attrs, "border-width", defAttrs ));
              attrib.set(BorderAttributesConverter.BORDER_WIDTH,
              (int)FoUnitsConverter.getInstance().convertToTwips(attrValue));
***************
*** 374,379 ****
       */
      private static RtfAttributes convertAttributes(Attributes attrs,
!     RtfAttributes defaultAttributes, boolean cell) throws ConverterException {
          RtfAttributes result = null;
  
          // first copy default attributes if any
--- 390,396 ----
       */
      private static RtfAttributes convertAttributes(Attributes attrs,
!      RtfAttributes defaultAttributes, boolean cell) throws ConverterException {
          RtfAttributes result = null;
+         // Added by Normand Masse
  
          // first copy default attributes if any
***************
*** 386,390 ****
          }
  
!         final String padA = AbstractBuilder.getAttribute(attrs, null, "padding", false);
  
          if (padA != null) {
--- 403,411 ----
          }
  
!         // Added by Normand Masse
!         // Default attributes are fetched from Rtf attributes (coming from parent)
!         Attributes defAttrs = defaultAttributes == null ? null : defaultAttributes.getXslAttributes();
!         final String padA = AbstractBuilder.getAttribute(attrs, null, "padding", false, defAttrs );
! 
  
          if (padA != null) {
***************
*** 403,407 ****
  
              // row-padding-top
!             final String padT = AbstractBuilder.getAttribute(attrs, null, "padding-top", false);
  
              if (padT != null) {
--- 424,428 ----
  
              // row-padding-top
!             final String padT = AbstractBuilder.getAttribute(attrs, null, "padding-top", false, defAttrs );
  
              if (padT != null) {
***************
*** 415,419 ****
  
              // row-padding-left
!             final String padL = AbstractBuilder.getAttribute(attrs, null, "padding-left", false);
  
              if (padL != null) {
--- 436,440 ----
  
              // row-padding-left
!             final String padL = AbstractBuilder.getAttribute(attrs, null, "padding-left", false, defAttrs );
  
              if (padL != null) {
***************
*** 427,431 ****
  
              // row-padding-bottom
!             final String padB = AbstractBuilder.getAttribute(attrs, null, "padding-bottom", false);
  
              if (padB != null) {
--- 448,452 ----
  
              // row-padding-bottom
!             final String padB = AbstractBuilder.getAttribute(attrs, null, "padding-bottom", false, defAttrs );
  
              if (padB != null) {
***************
*** 440,444 ****
  
              // row-padding-right
!             final String padR = AbstractBuilder.getAttribute(attrs, null, "padding-right", false);
  
              if (padR != null) {
--- 461,465 ----
  
              // row-padding-right
!             final String padR = AbstractBuilder.getAttribute(attrs, null, "padding-right", false, defAttrs );
  
              if (padR != null) {
***************
*** 450,453 ****
--- 471,479 ----
                  (int) FoUnitsConverter.getInstance().convertToTwips(padR), cell);
              }
+         }
+         // Added by Normand Masse
+         // Indicate the XSL attributes used to build the Rtf attributes
+         if ( result != null ) {
+             result.setXslAttributes( attrs );
          }
  

Index: BeforeBuilder.java
===================================================================
RCS file: /cvsroot/jfor/jfor/src/org/jfor/jfor/converter/BeforeBuilder.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** BeforeBuilder.java	12 Jul 2002 08:08:31 -0000	1.2
--- BeforeBuilder.java	18 Feb 2003 16:10:46 -0000	1.3
***************
*** 61,64 ****
--- 61,68 ----
  // $Id$
  // $Log$
+ // Revision 1.3  2003/02/18 16:10:46  rmarra
+ // Contributions Normand Massé
+ // inheritance and other fixes
+ //
  // Revision 1.2  2002/07/12 08:08:31  bdelacretaz
  // License changed to jfor Apache-style license
***************
*** 75,115 ****
      private RtfBefore m_before;
      private RtfAttributes beforeAttributes;
!     
      /** if this fo:block is nested into another one, this is the builder that
       *  processes the enclosing block
       */
!     
      BeforeBuilder(BuilderContext ctx) {
          super(ctx);
      }
!     
      /** called by Converter at the start of an element */
      public void start(String rawName, Attributes attrs) throws IOException {
          //we know that the only attribute will be \header
-         beforeAttributes = new RtfAttributes();
-         beforeAttributes.set(RtfBefore.HEADER);
          final IRtfBeforeContainer c = (IRtfBeforeContainer)m_context.getContainer(IRtfBeforeContainer.class,true,this);
          m_before = c.newBefore(beforeAttributes);
          m_context.pushContainer(m_before);
      }
!     
      /** called by Converter at the end of an element */
      public void end() throws IOException {
          m_context.popContainer();
      }
!     
!     
      /** this builder processes fo:block elements */
      public IBuilder getBuilder(BuilderContext ctx,String rawName, Attributes atts) {
!         
!         
          final String attsString = atts.getValue("flow-name");
          boolean equals = false;
!         
          if(attsString != null)
              if(attsString.equals("xsl-region-before")){
                  equals = true;
              }
!         
          if(rawName.equals(TAG_STATIC) && equals) {
              return new BeforeBuilder(ctx);
--- 79,130 ----
      private RtfBefore m_before;
      private RtfAttributes beforeAttributes;
! 
      /** if this fo:block is nested into another one, this is the builder that
       *  processes the enclosing block
       */
! 
      BeforeBuilder(BuilderContext ctx) {
          super(ctx);
      }
! 
      /** called by Converter at the start of an element */
      public void start(String rawName, Attributes attrs) throws IOException {
          //we know that the only attribute will be \header
          final IRtfBeforeContainer c = (IRtfBeforeContainer)m_context.getContainer(IRtfBeforeContainer.class,true,this);
+ 
+         // Added by Normand Masse
+         // Try to use the parents attributes
+         beforeAttributes = ((RtfElement)c).getRtfAttributes();
+         if ( beforeAttributes == null ) {
+             beforeAttributes = new RtfAttributes();
+         }
+ 
+         beforeAttributes.set(RtfBefore.HEADER);
+ 
+         // Added by Normand Masse
+         // Indicate the XSL attributes used to build the Rtf attributes
+         beforeAttributes.setXslAttributes(attrs);
          m_before = c.newBefore(beforeAttributes);
          m_context.pushContainer(m_before);
      }
! 
      /** called by Converter at the end of an element */
      public void end() throws IOException {
          m_context.popContainer();
      }
! 
! 
      /** this builder processes fo:block elements */
      public IBuilder getBuilder(BuilderContext ctx,String rawName, Attributes atts) {
! 
! 
          final String attsString = atts.getValue("flow-name");
          boolean equals = false;
! 
          if(attsString != null)
              if(attsString.equals("xsl-region-before")){
                  equals = true;
              }
! 
          if(rawName.equals(TAG_STATIC) && equals) {
              return new BeforeBuilder(ctx);

Index: AbstractBuilder.java
===================================================================
RCS file: /cvsroot/jfor/jfor/src/org/jfor/jfor/converter/AbstractBuilder.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** AbstractBuilder.java	23 Sep 2002 13:17:01 -0000	1.9
--- AbstractBuilder.java	18 Feb 2003 16:10:47 -0000	1.10
***************
*** 60,63 ****
--- 60,67 ----
  // $Id$
  // $Log$
+ // Revision 1.10  2003/02/18 16:10:47  rmarra
+ // Contributions Normand Massé
+ // inheritance and other fixes
+ //
  // Revision 1.9  2002/09/23 13:17:01  rmarra
  // Jfor-cmd processing added
***************
*** 114,117 ****
--- 118,129 ----
      }
      
+     /** true if the given attribute value is contained in the given Attributes or the default attributes */
+     // Added by Normand Masse
+     static boolean hasAttributeValue(Attributes attrs,String name,String desiredValue, Attributes defattrs) {
+         String actualValue = getValue(attrs, name, defattrs );
+         return desiredValue.equals(actualValue);
+     }
+ 
+     
      /** true if the given attribute value is contained in the given Attributes */
      static boolean hasAttributeValue(Attributes attrs,String name,String desiredValue) {
***************
*** 120,128 ****
      }
      
!     /** true if the given attribute has a value (attribute is present) */
      static boolean attributeIsSet(Attributes attrs, String name){
     		final String actualValue = attrs.getValue(name);
          return (actualValue == null) ? false : true;
     	}
      
      /** return the value of given attribute
--- 132,177 ----
      }
      
!     /** true if the given attribute has a value (attribute is present) in the given Attributes*/
      static boolean attributeIsSet(Attributes attrs, String name){
     		final String actualValue = attrs.getValue(name);
          return (actualValue == null) ? false : true;
     	}
+     
+     /** true if the given attribute has a value (attribute is present) in the given Attributes or the default attributes  */
+     // Added by Normand Masse
+     static boolean attributeIsSet(Attributes attrs, String name, Attributes defattrs ){
+         return getValue( attrs, name, defattrs ) != null;
+     }
+ 
+     /** return the value of the attribute with the specified name from the given Attributes */
+     // Added by Normand Masse
+     static String getValue( Attributes attrs, String name ){
+         return attrs.getValue( name );
+     }
+ 
+     /** return the value of the attribute with the specified name from the given Attributes or the default attributes */
+     // Added by Normand Masse
+     static String getValue( Attributes attrs, String name, Attributes defattrs ){
+         String attrib = attrs.getValue( name );
+         if ( attrib != null ) {
+             return attrib;
+         }
+         return defattrs != null ? defattrs.getValue( name ) : null;
+     }
+ 
+ 
+     /** return the value of given attribute from the Attributes or the default Attributes
+      *  @param required if true and no value, throws ConverterException
+      */
+     // Added by Normand Masse
+     static String getAttribute(Attributes attrs,String tagName,String attrName,boolean required, Attributes defattrs)
+     throws ConverterException {
+         String wValue = getAttribute( attrs, tagName, attrName, required );
+         if ( wValue == null && defattrs != null ) {
+             return getAttribute( defattrs, tagName, attrName, required );
+         }
+         return wValue;
+     }
+ 
      
      /** return the value of given attribute

Index: Converter.java
===================================================================
RCS file: /cvsroot/jfor/jfor/src/org/jfor/jfor/converter/Converter.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** Converter.java	24 Sep 2002 10:12:11 -0000	1.14
--- Converter.java	18 Feb 2003 16:10:48 -0000	1.15
***************
*** 74,77 ****
--- 74,81 ----
  // $Id$
  // $Log$
+ // Revision 1.15  2003/02/18 16:10:48  rmarra
+ // Contributions Normand Massé
+ // inheritance and other fixes
+ //
  // Revision 1.14  2002/09/24 10:12:11  bdelacretaz
  //  V0.7.2dev-e - uses Apache logkit for more precise and configurable logging
***************
*** 245,267 ****
  		// "normal" builders in priority order, first one where getBuilder returns non-null
  		// is used for current element
! 		m_builders.add(new PageBuilder(m_context));
! 		m_builders.add(new PageNumberCitationBuilder(m_context));		
! 		m_builders.add(new SectionBuilder(m_context));
! 		m_builders.add(new BeforeBuilder(m_context));
! 		m_builders.add(new ParagraphBuilder(m_context));
! 		m_builders.add(new TextBuilder(m_context));
! 		m_builders.add(new PageNumberBuilder(m_context));
! 		m_builders.add(new TableBuilder(m_context));
! 		m_builders.add(new TableRowBuilder(m_context));
! 		m_builders.add(new TableCellBuilder(m_context));
! 		m_builders.add(new TableColumnBuilder(m_context));
! 		m_builders.add(new ListBuilder(m_context));
! 		m_builders.add(new ListItemBuilder(m_context));
! 		m_builders.add(new ListItemLabelBuilder(m_context));
! 		m_builders.add(new ExternalGraphicBuilder(m_context));
! 		m_builders.add(new BasicLinkBuilder(m_context));
! 		m_builders.add(new StyleSheetBuilder (m_context));
! 		m_builders.add(new TemplateBuilder (m_context));
! 		m_builders.add(new AfterBuilder (m_context));
  
  		// this must be the last one, applies to all elements not processed before
--- 249,274 ----
  		// "normal" builders in priority order, first one where getBuilder returns non-null
  		// is used for current element
!         m_builders.add(new PageBuilder(m_context));
!         m_builders.add(new PageNumberCitationBuilder(m_context));
!         m_builders.add(new SectionBuilder(m_context));
!         m_builders.add(new BeforeBuilder(m_context));
!         m_builders.add(new ParagraphBuilder(m_context));
!         m_builders.add(new TextBuilder(m_context));
!         m_builders.add(new PageNumberBuilder(m_context));
!         m_builders.add(new TableBuilder(m_context));
!         // Added by Normand Masse
!         // New processing of table header attributes
!         m_builders.add(new TableHeaderBuilder(m_context));
!         m_builders.add(new TableRowBuilder(m_context));
!         m_builders.add(new TableCellBuilder(m_context));
!         m_builders.add(new TableColumnBuilder(m_context));
!         m_builders.add(new ListBuilder(m_context));
!         m_builders.add(new ListItemBuilder(m_context));
!         m_builders.add(new ListItemLabelBuilder(m_context));
!         m_builders.add(new ExternalGraphicBuilder(m_context));
!         m_builders.add(new BasicLinkBuilder(m_context));
!         m_builders.add(new StyleSheetBuilder (m_context));
!         m_builders.add(new TemplateBuilder (m_context));
!         m_builders.add(new AfterBuilder (m_context));
  
  		// this must be the last one, applies to all elements not processed before
***************
*** 271,274 ****
--- 278,282 ----
  		m_start = System.currentTimeMillis();
  	}
+ 	
  
  	/** log duration of conversion */

Index: TableCellBuilder.java
===================================================================
RCS file: /cvsroot/jfor/jfor/src/org/jfor/jfor/converter/TableCellBuilder.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** TableCellBuilder.java	12 Jul 2002 08:08:31 -0000	1.4
--- TableCellBuilder.java	18 Feb 2003 16:10:49 -0000	1.5
***************
*** 62,65 ****
--- 62,69 ----
  // $Id$
  // $Log$
+ // Revision 1.5  2003/02/18 16:10:49  rmarra
+ // Contributions Normand Massé
+ // inheritance and other fixes
+ //
  // Revision 1.4  2002/07/12 08:08:31  bdelacretaz
  // License changed to jfor Apache-style license
***************
*** 85,89 ****
          super(ctx);
      }
!     
      /** called by Converter at the start of an element */
      public void start(String rawName, Attributes atts)
--- 89,93 ----
          super(ctx);
      }
! 
      /** called by Converter at the start of an element */
      public void start(String rawName, Attributes atts)
***************
*** 92,101 ****
          // get width of this column
          final float width = m_context.getTableContext().getColumnWidth();
!         
          // create an RtfTableCell in the current RtfTableRow
          final RtfTableRow row = (RtfTableRow)m_context.getContainer(RtfTableRow.class,true,this);
! 		m_context.pushContainer(row.newTableCell((int)width, TableAttributesConverter.convertCellAttributes (atts, null)));
      }
!     
      /** called by Converter at the end of an element */
      public void end()
--- 96,109 ----
          // get width of this column
          final float width = m_context.getTableContext().getColumnWidth();
! 
          // create an RtfTableCell in the current RtfTableRow
          final RtfTableRow row = (RtfTableRow)m_context.getContainer(RtfTableRow.class,true,this);
!         // Added by Normand Masse
!         // Try to use the parents attributes
!         RtfAttributes rowAttribs = row.getRtfAttributes();
!         RtfAttributes rowCellAttribs = TableAttributesConverter.convertCellAttributes (atts, rowAttribs);
!         m_context.pushContainer(row.newTableCell((int)width, rowCellAttribs));
      }
! 
      /** called by Converter at the end of an element */
      public void end()
***************
*** 105,110 ****
          m_context.getTableContext().selectNextColumn();
      }
!     
!     /** return a TableBuilder for fo:table elements */
      public IBuilder getBuilder(BuilderContext ctx,String rawName, Attributes atts)
      {
--- 113,118 ----
          m_context.getTableContext().selectNextColumn();
      }
! 
!     /** return a TableCellBuilder for fo:table-cell elements */
      public IBuilder getBuilder(BuilderContext ctx,String rawName, Attributes atts)
      {

Index: TextAttributesConverter.java
===================================================================
RCS file: /cvsroot/jfor/jfor/src/org/jfor/jfor/converter/TextAttributesConverter.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** TextAttributesConverter.java	29 Jul 2002 14:21:11 -0000	1.9
--- TextAttributesConverter.java	18 Feb 2003 16:10:49 -0000	1.10
***************
*** 63,66 ****
--- 63,70 ----
  // $Id$
  // $Log$
+ // Revision 1.10  2003/02/18 16:10:49  rmarra
+ // Contributions Normand Massé
+ // inheritance and other fixes
+ //
  // Revision 1.9  2002/07/29 14:21:11  bdelacretaz
  // bug corrected, not all unit values were handled for space-before and space-after
***************
*** 104,132 ****
  
          RtfAttributes result = null;
!         
          // first copy default attributes if any
! 		result = defaultAttributes == null ? null : (RtfAttributes)defaultAttributes.clone();
  
! 		if(attrs == null)
! 			return result;
  
!         
! 		// font-family
! 		final String family = AbstractBuilder.getAttribute(attrs,null,"font-family",false);
! 		if (family != null)
! 		{
! 			if(result==null) result = new RtfAttributes();
! 			result.set (RtfText.ATTR_FONT_FAMILY, RtfFontManager.getInstance().getFontNumber(family));
! 		}
          
          // font-size
!         final String size = AbstractBuilder.getAttribute(attrs,null,"font-size",false);
          if(size != null) {
              if(result==null) result = new RtfAttributes();
              result.set(RtfText.ATTR_FONT_SIZE,FoUnitsConverter.getInstance().convertFontSize(size));
          }
!         
          // color
!         final String color = AbstractBuilder.getAttribute(attrs,null,"color",false);
          if(color != null) {
              if(result==null) result = new RtfAttributes();
--- 108,146 ----
  
          RtfAttributes result = null;
! 
          // first copy default attributes if any
!         result = defaultAttributes == null ? null : (RtfAttributes)defaultAttributes.clone();
!         // Added by Normand Masse
!         // Try to use the parents attributes
!         Attributes defAttrs = defaultAttributes == null ? null : defaultAttributes.getXslAttributes();
  
!         if(attrs == null) {
!             // indicate the XSL attributes used to build the Rtf attributes
!             if ( result != null && defAttrs != null ) {
!                 result.setXslAttributes( defAttrs );
!             }
!             return result;
!         }
  
!         // font-family
!         final String family = AbstractBuilder.getAttribute(attrs,null,"font-family",false,defAttrs );
!         if (family != null)
!         {
!             if(result==null) result = new RtfAttributes();
!             result.set (RtfText.ATTR_FONT_FAMILY, RtfFontManager.getInstance().getFontNumber(family));
!         }
          
          // font-size
!         final String size = AbstractBuilder.getAttribute(attrs,null,"font-size", false, defAttrs );
          if(size != null) {
              if(result==null) result = new RtfAttributes();
              result.set(RtfText.ATTR_FONT_SIZE,FoUnitsConverter.getInstance().convertFontSize(size));
+         } else {
+             if(result==null) result = new RtfAttributes();
+             result.set(RtfText.ATTR_FONT_SIZE,FoUnitsConverter.getInstance().convertFontSize("12pt"));
          }
! 
          // color
!         final String color = AbstractBuilder.getAttribute(attrs,null,"color", false, defAttrs );
          if(color != null) {
              if(result==null) result = new RtfAttributes();
***************
*** 138,315 ****
  
          // bold, italic, underline
!         if(AbstractBuilder.hasAttributeValue(attrs,"font-weight","bold")) {
              if(result==null) result = new RtfAttributes();
              result.set(RtfText.ATTR_BOLD);
          }
!         if(AbstractBuilder.hasAttributeValue(attrs,"font-style","italic")) {
              if(result==null) result = new RtfAttributes();
              result.set(RtfText.ATTR_ITALIC);
          }
!         if(AbstractBuilder.hasAttributeValue(attrs,"text-decoration","underline")) {
              if(result==null) result = new RtfAttributes();
              result.set(RtfText.ATTR_UNDERLINE);
          }
!         
!         
!         
! 		/**
! 		 * Added by Boris POUDEROUS
! 		 */
! 		// background-color
! 		final String backgroundColor = AbstractBuilder.getAttribute(attrs,null,"background-color",false);
! 		if (backgroundColor != null) {
! 		    if (result == null) result = new RtfAttributes();
! 		    final Integer colorNumber = FoColorConverter.getInstance().getRtfColorNumber(backgroundColor,log);
! 		    if (colorNumber != null) {
! 		        result.set(RtfText.ATTR_BACKGROUND_COLOR,colorNumber.intValue());
! 		     }   
! 		}		      
! 		    
! 	    /**
! 	     * Added by Boris POUDEROUS
! 	     */
! 	    // Space before
! 	    final String spaceBefore = AbstractBuilder.getAttribute(attrs,null,"space-before",false);
! 		if (spaceBefore != null) {
! 	        if (result == null) result = new RtfAttributes();
! 	  			result.set(RtfText.SPACE_BEFORE, (int)FoUnitsConverter.getInstance().convertToTwips(spaceBefore));
! 	    }
! 	
! 		/**
! 	     * Added by Boris POUDEROUS
! 	     */
! 	    // Space after
! 	    final String spaceAfter = AbstractBuilder.getAttribute(attrs,null,"space-after",false);
! 		if (spaceAfter != null) {
! 	      if (result == null) result = new RtfAttributes();
! 	  	  result.set(RtfText.SPACE_AFTER, (int)FoUnitsConverter.getInstance().convertToTwips(spaceAfter));
! 	    }
! 	    
!     
!         
! 		if (AbstractBuilder.hasAttributeValue (attrs, "text-align", "center"))
! 		{
! 			if(result==null) result = new RtfAttributes();
! 			result.set (RtfText.ALIGN_CENTER);
! 		}
! 		else if (AbstractBuilder.hasAttributeValue (attrs, "text-align", "end") ||
! 			AbstractBuilder.hasAttributeValue (attrs, "text-align", "right"))
! 		{
! 			if(result==null) result = new RtfAttributes();
! 			result.set (RtfText.ALIGN_RIGHT);
! 		}
! 		else if (AbstractBuilder.hasAttributeValue (attrs, "text-align", "justify"))
! 		{
! 			if(result==null) result = new RtfAttributes();
! 			result.set (RtfText.ALIGN_JUSTIFIED);
! 		}
! 		else if (AbstractBuilder.hasAttributeValue (attrs, "text-align", "distribute"))
! 		{
! 			if(result==null) result = new RtfAttributes();
! 			result.set (RtfText.ALIGN_DISTRIBUTED);
! 		}
! 		//make align left the default
! 		else 
! 		{
! 			if(result==null) result = new RtfAttributes();
! 			result.set (RtfText.ALIGN_LEFT);
! 		}
! 		
! 		//the following lines were added by Chris Scott, Westinghouse
! 		if (AbstractBuilder.hasAttributeValue (attrs, "border-bottom-style", "single"))
! 		{
! 			if(result==null) result = new RtfAttributes();
! 			result.set (RtfText.BDR_BOTTOM_SINGLE);
! 		}
! 		else if (AbstractBuilder.hasAttributeValue (attrs, "border-bottom-style", "double"))
! 		{
! 			if(result==null) result = new RtfAttributes();
! 			result.set (RtfText.BDR_BOTTOM_DOUBLE);
! 		}
! 		else if (AbstractBuilder.hasAttributeValue (attrs, "border-bottom-style", "emboss"))
! 		{
! 			if(result==null) result = new RtfAttributes();
! 			result.set (RtfText.BDR_BOTTOM_EMBOSS);
! 		}
! 		else if (AbstractBuilder.hasAttributeValue (attrs, "border-bottom-style", "dotted"))
! 		{
! 			if(result==null) result = new RtfAttributes();
! 			result.set (RtfText.BDR_BOTTOM_DOTTED);
! 		}
! 		else if (AbstractBuilder.hasAttributeValue (attrs, "border-bottom-style", "dash"))
! 		{
! 			if(result==null) result = new RtfAttributes();
! 			result.set (RtfText.BDR_BOTTOM_DASH);
! 		}
! 		
! 		final String indent = AbstractBuilder.getAttribute(attrs,null,"start-indent",false);
! 		if (indent != null)
! 		{
! 			if(result==null) result = new RtfAttributes();
! 			result.set(RtfText.LEFT_INDENT_BODY,(int)FoUnitsConverter.getInstance().convertToTwips(indent));
! 		}
! 		
! 		final String tabCenter = AbstractBuilder.getAttribute(attrs,null,"tab-center",false);
! 		if (tabCenter != null)
! 		{
! 			if(result==null) result = new RtfAttributes();
! 			result.set(RtfText.TAB_CENTER,(int)FoUnitsConverter.getInstance().convertToTwips(tabCenter));
! 		
! 			if (AbstractBuilder.hasAttributeValue (attrs, "tab-center-leading", "underline"))
! 			{
! 				result.set(RtfText.TAB_LEADER_UNDER);
! 			}
! 			else if (AbstractBuilder.hasAttributeValue (attrs, "tab-center-leading", "dots"))
! 			{
! 				result.set(RtfText.TAB_LEADER_DOTS);
! 			}
! 			else if (AbstractBuilder.hasAttributeValue (attrs, "tab-center-leading", "equals"))
! 			{
! 				result.set(RtfText.TAB_LEADER_EQUALS);
! 			}
! 			else if (AbstractBuilder.hasAttributeValue (attrs, "tab-center-leading", "thick"))
! 			{
! 				result.set(RtfText.TAB_LEADER_THICK);
! 			}
! 			else if (AbstractBuilder.hasAttributeValue (attrs, "tab-center-leading", "hyphen"))
! 			{
! 				result.set(RtfText.TAB_LEADER_HYPHEN);
! 			}
! 		}
! 		
! 		final String tabRight = AbstractBuilder.getAttribute(attrs,null,"tab-right",false);
! 		if (tabRight != null)
! 		{
! 			if(result==null) result = new RtfAttributes();
! 			result.set(RtfText.TAB_RIGHT,(int)FoUnitsConverter.getInstance().convertToTwips(tabRight));
! 		
! 			if (AbstractBuilder.hasAttributeValue (attrs, "tab-right-leading", "underline"))
! 			{
! 				result.set(RtfText.TAB_LEADER_UNDER);
! 			}
! 			else if (AbstractBuilder.hasAttributeValue (attrs, "tab-right-leading", "dots"))
! 			{
! 				result.set(RtfText.TAB_LEADER_DOTS);
! 			}
! 			else if (AbstractBuilder.hasAttributeValue (attrs, "tab-right-leading", "equals"))
! 			{
! 				result.set(RtfText.TAB_LEADER_EQUALS);
! 			}
! 			else if (AbstractBuilder.hasAttributeValue (attrs, "tab-right-leading", "thick"))
! 			{
! 				result.set(RtfText.TAB_LEADER_THICK);
! 			}
! 			else if (AbstractBuilder.hasAttributeValue (attrs, "tab-right-leading", "hyphen"))
! 			{
! 				result.set(RtfText.TAB_LEADER_HYPHEN);
! 			}
! 		}
! 		
! 		if(AbstractBuilder.hasAttributeValue(attrs,"white-space-collapse","false"))
! 		{
! 			result.set("WhiteSpaceFalse");
! 		}
! 		
          return result;
      }
  }
--- 152,335 ----
  
          // bold, italic, underline
!         if(AbstractBuilder.hasAttributeValue(attrs,"font-weight","bold", defAttrs )) {
              if(result==null) result = new RtfAttributes();
              result.set(RtfText.ATTR_BOLD);
          }
!         if(AbstractBuilder.hasAttributeValue(attrs,"font-style","italic", defAttrs )) {
              if(result==null) result = new RtfAttributes();
              result.set(RtfText.ATTR_ITALIC);
          }
!         if(AbstractBuilder.hasAttributeValue(attrs,"text-decoration","underline", defAttrs )) {
              if(result==null) result = new RtfAttributes();
              result.set(RtfText.ATTR_UNDERLINE);
          }
! 
! 
! 
!         /**
!          * Added by Boris POUDEROUS
!          */
!         // background-color
!         final String backgroundColor = AbstractBuilder.getAttribute(attrs,null,"background-color", false, defAttrs );
!         if (backgroundColor != null) {
!             if (result == null) result = new RtfAttributes();
!             final Integer colorNumber = FoColorConverter.getInstance().getRtfColorNumber(backgroundColor,log);
!             if (colorNumber != null) {
!                 result.set(RtfText.ATTR_BACKGROUND_COLOR,colorNumber.intValue());
!              }
!         }
! 
!         /**
!          * Added by Boris POUDEROUS
!          */
!         // Space before
!         final String spaceBefore = AbstractBuilder.getAttribute(attrs,null,"space-before", false, defAttrs );
!         if (spaceBefore != null) {
!             if (result == null) result = new RtfAttributes();
!                 result.set(RtfText.SPACE_BEFORE, (int)FoUnitsConverter.getInstance().convertToTwips(spaceBefore));
!         }
! 
!         /**
!          * Added by Boris POUDEROUS
!          */
!         // Space after
!         final String spaceAfter = AbstractBuilder.getAttribute(attrs,null,"space-after", false, defAttrs );
!         if (spaceAfter != null) {
!           if (result == null) result = new RtfAttributes();
!           result.set(RtfText.SPACE_AFTER, (int)FoUnitsConverter.getInstance().convertToTwips(spaceAfter));
!         }
! 
! 
! 
!         if (AbstractBuilder.hasAttributeValue (attrs, "text-align", "center", defAttrs ))
!         {
!             if(result==null) result = new RtfAttributes();
!             result.set (RtfText.ALIGN_CENTER);
!         }
!         else if (AbstractBuilder.hasAttributeValue (attrs, "text-align", "end", defAttrs ) ||
!             AbstractBuilder.hasAttributeValue (attrs, "text-align", "right", defAttrs ))
!         {
!             if(result==null) result = new RtfAttributes();
!             result.set (RtfText.ALIGN_RIGHT);
!         }
!         else if (AbstractBuilder.hasAttributeValue (attrs, "text-align", "justify", defAttrs ))
!         {
!             if(result==null) result = new RtfAttributes();
!             result.set (RtfText.ALIGN_JUSTIFIED);
!         }
!         else if (AbstractBuilder.hasAttributeValue (attrs, "text-align", "distribute", defAttrs ))
!         {
!             if(result==null) result = new RtfAttributes();
!             result.set (RtfText.ALIGN_DISTRIBUTED);
!         }
!         //make align left the default
!         else
!         {
!             if(result==null) result = new RtfAttributes();
!             result.set (RtfText.ALIGN_LEFT);
!         }
! 
!         //the following lines were added by Chris Scott, Westinghouse
!         if (AbstractBuilder.hasAttributeValue (attrs, "border-bottom-style", "single", defAttrs ))
!         {
!             if(result==null) result = new RtfAttributes();
!             result.set (RtfText.BDR_BOTTOM_SINGLE);
!         }
!         else if (AbstractBuilder.hasAttributeValue (attrs, "border-bottom-style", "double", defAttrs ))
!         {
!             if(result==null) result = new RtfAttributes();
!             result.set (RtfText.BDR_BOTTOM_DOUBLE);
!         }
!         else if (AbstractBuilder.hasAttributeValue (attrs, "border-bottom-style", "emboss", defAttrs ))
!         {
!             if(result==null) result = new RtfAttributes();
!             result.set (RtfText.BDR_BOTTOM_EMBOSS);
!         }
!         else if (AbstractBuilder.hasAttributeValue (attrs, "border-bottom-style", "dotted", defAttrs ))
!         {
!             if(result==null) result = new RtfAttributes();
!             result.set (RtfText.BDR_BOTTOM_DOTTED);
!         }
!         else if (AbstractBuilder.hasAttributeValue (attrs, "border-bottom-style", "dash", defAttrs ))
!         {
!             if(result==null) result = new RtfAttributes();
!             result.set (RtfText.BDR_BOTTOM_DASH);
!         }
! 
!         final String indent = AbstractBuilder.getAttribute(attrs,null,"start-indent", false, defAttrs );
!         if (indent != null)
!         {
!             if(result==null) result = new RtfAttributes();
!             result.set(RtfText.LEFT_INDENT_BODY,(int)FoUnitsConverter.getInstance().convertToTwips(indent));
!         }
! 
!         final String tabCenter = AbstractBuilder.getAttribute(attrs,null,"tab-center", false, defAttrs );
!         if (tabCenter != null)
!         {
!             if(result==null) result = new RtfAttributes();
!             result.set(RtfText.TAB_CENTER,(int)FoUnitsConverter.getInstance().convertToTwips(tabCenter));
! 
!             if (AbstractBuilder.hasAttributeValue (attrs, "tab-center-leading", "underline", defAttrs ))
!             {
!                 result.set(RtfText.TAB_LEADER_UNDER);
!             }
!             else if (AbstractBuilder.hasAttributeValue (attrs, "tab-center-leading", "dots", defAttrs ))
!             {
!                 result.set(RtfText.TAB_LEADER_DOTS);
!             }
!             else if (AbstractBuilder.hasAttributeValue (attrs, "tab-center-leading", "equals", defAttrs ))
!             {
!                 result.set(RtfText.TAB_LEADER_EQUALS);
!             }
!             else if (AbstractBuilder.hasAttributeValue (attrs, "tab-center-leading", "thick", defAttrs ))
!             {
!                 result.set(RtfText.TAB_LEADER_THICK);
!             }
!             else if (AbstractBuilder.hasAttributeValue (attrs, "tab-center-leading", "hyphen", defAttrs ))
!             {
!                 result.set(RtfText.TAB_LEADER_HYPHEN);
!             }
!         }
! 
!         final String tabRight = AbstractBuilder.getAttribute(attrs,null,"tab-right", false, defAttrs );
!         if (tabRight != null)
!         {
!             if(result==null) result = new RtfAttributes();
!             result.set(RtfText.TAB_RIGHT,(int)FoUnitsConverter.getInstance().convertToTwips(tabRight));
! 
!             if (AbstractBuilder.hasAttributeValue (attrs, "tab-right-leading", "underline", defAttrs ))
!             {
!                 result.set(RtfText.TAB_LEADER_UNDER);
!             }
!             else if (AbstractBuilder.hasAttributeValue (attrs, "tab-right-leading", "dots", defAttrs ))
!             {
!                 result.set(RtfText.TAB_LEADER_DOTS);
!             }
!             else if (AbstractBuilder.hasAttributeValue (attrs, "tab-right-leading", "equals", defAttrs ))
!             {
!                 result.set(RtfText.TAB_LEADER_EQUALS);
!             }
!             else if (AbstractBuilder.hasAttributeValue (attrs, "tab-right-leading", "thick", defAttrs ))
!             {
!                 result.set(RtfText.TAB_LEADER_THICK);
!             }
!             else if (AbstractBuilder.hasAttributeValue (attrs, "tab-right-leading", "hyphen", defAttrs ))
!             {
!                 result.set(RtfText.TAB_LEADER_HYPHEN);
!             }
!         }
! 
!         if(AbstractBuilder.hasAttributeValue(attrs,"white-space-collapse","false", defAttrs ))
!         {
!             result.set("WhiteSpaceFalse");
!         }
! 
!         // indicate the XSL attributes used to build the Rtf attributes
!         if ( result != null ) {
!             result.setXslAttributes( attrs );
!         }
! 
          return result;
      }
+ 
  }

Index: ParagraphBuilder.java
===================================================================
RCS file: /cvsroot/jfor/jfor/src/org/jfor/jfor/converter/ParagraphBuilder.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** ParagraphBuilder.java	23 Sep 2002 13:17:01 -0000	1.9
--- ParagraphBuilder.java	18 Feb 2003 16:10:50 -0000	1.10
***************
*** 63,66 ****
--- 63,70 ----
  // $Id$
  // $Log$
+ // Revision 1.10  2003/02/18 16:10:50  rmarra
+ // Contributions Normand Massé
+ // inheritance and other fixes
+ //
  // Revision 1.9  2002/09/23 13:17:01  rmarra
  // Jfor-cmd processing added
***************
*** 143,154 ****
          super(ctx);
  
! 	    // find out if we are nested in another fo:block
! 	    try {
! 	        m_nestedInto = (ParagraphBuilder)m_context.getBuilder(this.getClass(),false);
! 	    } catch(ConverterException cxe) {
! 	        // should not happen as we call getBuilder with required=false
! 	        throw new Error("unexpected ConverterException in ParagraphBuilder constructor");
! 	    }
! 	    
  	    m_paragraphKeeptogetherContext=ParagraphKeeptogetherContext.getInstance();
      }
--- 147,158 ----
          super(ctx);
  
! 		// find out if we are nested in another fo:block
!         try {
!             m_nestedInto = (ParagraphBuilder)m_context.getBuilder(this.getClass(),false);
!         } catch(ConverterException cxe) {
!             // should not happen as we call getBuilder with required=false
!             throw new Error("unexpected ConverterException in ParagraphBuilder constructor");
!         }
! 
  	    m_paragraphKeeptogetherContext=ParagraphKeeptogetherContext.getInstance();
      }
***************
*** 261,283 ****
          final IRtfParagraphContainer c = (IRtfParagraphContainer)m_context.getContainer(IRtfParagraphContainer.class,true,this);
  
! 		RtfAttributes rtfAttrs = new RtfAttributes ();
! 
! 		String jClass = getAttribute (m_attrib, TAG_FO_BLOCK, "jfor-class", false);
! 		if (jClass == null)
! 		{
! 			jClass = RtfStyleSheetTable.getInstance ().getDefaultStyleName ();
! 		}
! 		if (jClass != null)
! 		{
! 			int success = RtfStyleSheetTable.getInstance ().addStyleToAttributes (jClass, rtfAttrs);
! 			if (success == RtfStyleSheetTable.STATUS_DEFAULT)
! 			{
! 				m_context.log.logWarning ("jfor-class '" + jClass + "' is not defined, set to default.");
! 			}
! 		}
  
  
! 		final RtfParagraph para = c.newParagraph(TextAttributesConverter.convertAttributes (m_attrib, rtfAttrs, m_context.log));
  
  
  		//Test if we are inside a keep-together block
--- 265,292 ----
          final IRtfParagraphContainer c = (IRtfParagraphContainer)m_context.getContainer(IRtfParagraphContainer.class,true,this);
  
!         // Added by Normand Masse
!         // Try to use the parents attributes
!         RtfAttributes rtfAttrs = ((RtfElement)c).getRtfAttributes();
!        if ( rtfAttrs == null ) {
!            rtfAttrs = new RtfAttributes();
!        }
  
+         String jClass = getAttribute (m_attrib, TAG_FO_BLOCK, "jfor-class", false, rtfAttrs.getXslAttributes());
+         if (jClass == null)
+         {
+             jClass = RtfStyleSheetTable.getInstance ().getDefaultStyleName ();
+         }
+         if (jClass != null)
+         {
+             int success = RtfStyleSheetTable.getInstance ().addStyleToAttributes (jClass, rtfAttrs);
+             if (success == RtfStyleSheetTable.STATUS_DEFAULT)
+             {
+                 m_context.log.logWarning ("jfor-class '" + jClass + "' is not defined, set to default.");
+             }
+         }
  
!         final RtfParagraph para = c.newParagraph(TextAttributesConverter.convertAttributes (m_attrib, rtfAttrs, m_context.log));
  
+      
  
  		//Test if we are inside a keep-together block
***************
*** 293,297 ****
          // break page if required
          if(!isAfterNestedBlock) {
!             if(hasAttributeValue(m_attrib,"break-before","page")) {
                  para.newPageBreak();
              }
--- 302,306 ----
          // break page if required
          if(!isAfterNestedBlock) {
!             if(hasAttributeValue(m_attrib,"break-before","page",rtfAttrs.getXslAttributes())) {
                  para.newPageBreak();
              }
***************
*** 301,305 ****
          // after nested blocks)
          if(!isAfterNestedBlock) {
!             final String id = getAttribute(m_attrib, TAG_FO_BLOCK, "id", false);
              if (id != null) {
                  para.newBookmark(id);
--- 310,314 ----
          // after nested blocks)
          if(!isAfterNestedBlock) {
!             final String id = getAttribute(m_attrib, TAG_FO_BLOCK, "id", false,rtfAttrs.getXslAttributes());
              if (id != null) {
                  para.newBookmark(id);

Index: TableRowBuilder.java
===================================================================
RCS file: /cvsroot/jfor/jfor/src/org/jfor/jfor/converter/TableRowBuilder.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** TableRowBuilder.java	12 Jul 2002 08:08:31 -0000	1.4
--- TableRowBuilder.java	18 Feb 2003 16:10:51 -0000	1.5
***************
*** 62,65 ****
--- 62,69 ----
  // $Id$
  // $Log$
+ // Revision 1.5  2003/02/18 16:10:51  rmarra
+ // Contributions Normand Massé
+ // inheritance and other fixes
+ //
  // Revision 1.4  2002/07/12 08:08:31  bdelacretaz
  // License changed to jfor Apache-style license
***************
*** 85,89 ****
          super(ctx);
      }
!     
      /** called by Converter at the start of an element */
      public void start(String rawName, Attributes atts)
--- 89,93 ----
          super(ctx);
      }
! 
      /** called by Converter at the start of an element */
      public void start(String rawName, Attributes atts)
***************
*** 92,101 ****
          // create an RtfTableRow in the current RtfTable
          final RtfTable tbl = (RtfTable)m_context.getContainer(RtfTable.class,true,this);
! 		m_context.pushContainer(tbl.newTableRow(TableAttributesConverter.convertRowAttributes (atts, null)));
!         
          // reset column iteration index to correctly access column widths
          m_context.getTableContext().selectFirstColumn();
      }
!     
      /** called by Converter at the end of an element */
      public void end()
--- 96,109 ----
          // create an RtfTableRow in the current RtfTable
          final RtfTable tbl = (RtfTable)m_context.getContainer(RtfTable.class,true,this);
!         // Added by Normand Masse
!         // Try to use the parents attributes
!         RtfAttributes tblAttribs = tbl.getRtfAttributes();
!         RtfAttributes tblRowAttribs = TableAttributesConverter.convertRowAttributes(atts, tblAttribs);
!         m_context.pushContainer(tbl.newTableRow( tblRowAttribs ));
! 
          // reset column iteration index to correctly access column widths
          m_context.getTableContext().selectFirstColumn();
      }
! 
      /** called by Converter at the end of an element */
      public void end()
***************
*** 104,108 ****
          m_context.popContainer();
      }
!     
      /** return a TableBuilder for fo:table elements */
      public IBuilder getBuilder(BuilderContext ctx,String rawName, Attributes atts)
--- 112,116 ----
          m_context.popContainer();
      }
! 
      /** return a TableBuilder for fo:table elements */
      public IBuilder getBuilder(BuilderContext ctx,String rawName, Attributes atts)



-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf