CVS: jfor/src/org/jfor/jfor/converter ParagraphBuilder.java,1.10,1.11

Peter Herweg <[email protected]> Mon, 25 Aug 2003 14:35:53 -0700
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-serv10348

Modified Files:
	ParagraphBuilder.java 
Log Message:
improved attribut inheritance for nested blocks. (see inherit-attributes-001.fo.xml and 001-fop-compare-blocks.xml)

Index: ParagraphBuilder.java
===================================================================
RCS file: /cvsroot/jfor/jfor/src/org/jfor/jfor/converter/ParagraphBuilder.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** ParagraphBuilder.java	18 Feb 2003 16:10:50 -0000	1.10
--- ParagraphBuilder.java	25 Aug 2003 21:35:51 -0000	1.11
***************
*** 4,7 ****
--- 4,8 ----
  import java.io.IOException;
  import org.xml.sax.Attributes;
+ import org.xml.sax.helpers.AttributesImpl;
  import org.jfor.jfor.rtflib.rtfdoc.*;
  
***************
*** 63,66 ****
--- 64,70 ----
  // $Id$
  // $Log$
+ // Revision 1.11  2003/08/25 21:35:51  pherweg
+ // improved attribut inheritance for nested blocks. (see inherit-attributes-001.fo.xml and 001-fop-compare-blocks.xml)
+ //
  // Revision 1.10  2003/02/18 16:10:50  rmarra
  // Contributions Normand Massé

***************
*** 162,166 ****
      public void start(String rawName, Attributes attrs) throws IOException {
         
!        m_attrib = attrs;
  
  		//The owner open a groupMark
--- 166,170 ----
      public void start(String rawName, Attributes attrs) throws IOException {
         
!        m_attrib = new AttributesImpl(attrs);
  
  		//The owner open a groupMark
***************
*** 261,265 ****
       */
      private RtfParagraph startParagraph(boolean isAfterNestedBlock)
!     throws IOException {
          // create a Paragraph and a TextBuilder to handle text that is directly contained in it
          final IRtfParagraphContainer c = (IRtfParagraphContainer)m_context.getContainer(IRtfParagraphContainer.class,true,this);
--- 265,269 ----
       */
      private RtfParagraph startParagraph(boolean isAfterNestedBlock)
!     throws IOException { 
          // create a Paragraph and a TextBuilder to handle text that is directly contained in it
          final IRtfParagraphContainer c = (IRtfParagraphContainer)m_context.getContainer(IRtfParagraphContainer.class,true,this);
***************
*** 272,275 ****
--- 276,288 ----
         }
  
+         // Added by Peter Herweg
+         // If nested, try to use the attributes of surrounding block	
+         if(m_nestedInto != null){
+             rtfAttrs=TextAttributesConverter.convertAttributes (m_nestedInto.m_attrib, (RtfAttributes)rtfAttrs.clone(), m_context.log);
+         }
+         else if(isAfterNestedBlock){
+             rtfAttrs=TextAttributesConverter.convertAttributes (m_attrib, (RtfAttributes)rtfAttrs.clone(), m_context.log);
+         }
+         
          String jClass = getAttribute (m_attrib, TAG_FO_BLOCK, "jfor-class", false, rtfAttrs.getXslAttributes());
          if (jClass == null)
***************
*** 286,290 ****
          }
  
!         final RtfParagraph para = c.newParagraph(TextAttributesConverter.convertAttributes (m_attrib, rtfAttrs, m_context.log));
  
       
--- 299,305 ----
          }
  
!         final RtfParagraph para = (isAfterNestedBlock && m_nestedInto!=null) 
!         				? c.newParagraph(TextAttributesConverter.convertAttributes (m_nestedInto.m_attrib, rtfAttrs, m_context.log))
! 						: c.newParagraph(TextAttributesConverter.convertAttributes (m_attrib, rtfAttrs, m_context.log));
  
       



-------------------------------------------------------
This SF.net email is sponsored by: VM Ware
With VMware you can run multiple operating systems on a single machine.
WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines
at the same time. Free trial click here:http://www.vmware.com/wl/offer/358/0