CVS: jfor/src/org/jfor/jfor/converter AbstractBuilder.java,1.5,1.6 ParagraphBuilder.java,1.5,1.6 JforCmdAttributesConverter.java,1.1,NONE JForCmdProcessor.java,1.1,NONE

Marra Roberto <[email protected]> Mon, 01 Jul 2002 06:27:02 -0700
Newsgroups gmane.text.xml.jfor.cvs
Message-ID <[email protected]>
Update of /cvsroot/jfor/jfor/src/org/jfor/jfor/converter
In directory usw-pr-cvs1:/tmp/cvs-serv30531

Modified Files:
	AbstractBuilder.java ParagraphBuilder.java 
Removed Files:
	JforCmdAttributesConverter.java JForCmdProcessor.java 
Log Message:
V0.6.5 jfor-cmd removed, ParagraphKeepTogether implemented using standard FO "keep-together" element attribute.

Index: AbstractBuilder.java
===================================================================
RCS file: /cvsroot/jfor/jfor/src/org/jfor/jfor/converter/AbstractBuilder.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** AbstractBuilder.java	26 Jun 2002 17:40:26 -0000	1.5
--- AbstractBuilder.java	1 Jul 2002 13:27:00 -0000	1.6
***************
*** 35,38 ****
--- 35,41 ----
  // $Id$
  // $Log$
+ // Revision 1.6  2002/07/01 13:27:00  rmarra
+ // V0.6.5 jfor-cmd removed, ParagraphKeepTogether implemented using standard FO "keep-together" element attribute.
+ //
  // Revision 1.5  2002/06/26 17:40:26  rmarra
  // V0.6.4 jfor-cmd implemented
***************
*** 115,125 ****
      /** called by Converter before calling start()   */
      public void preStart(String rawName, Attributes atts) throws IOException {
!     	m_jforCmdProcessor = new JForCmdProcessor(this);
!     	m_jforCmdProcessor.preStart(rawName,atts);
      }
      
      /** called by Converter after calling end()   */
      public void postEnd() throws IOException {
!     	m_jforCmdProcessor.postEnd();
      }
  }
--- 118,127 ----
      /** called by Converter before calling start()   */
      public void preStart(String rawName, Attributes atts) throws IOException {
! 
      }
      
      /** called by Converter after calling end()   */
      public void postEnd() throws IOException {
! 
      }
  }

Index: ParagraphBuilder.java
===================================================================
RCS file: /cvsroot/jfor/jfor/src/org/jfor/jfor/converter/ParagraphBuilder.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** ParagraphBuilder.java	4 Sep 2001 07:02:17 -0000	1.5
--- ParagraphBuilder.java	1 Jul 2002 13:27:00 -0000	1.6
***************
*** 38,41 ****
--- 38,44 ----
  // $Id$
  // $Log$
+ // Revision 1.6  2002/07/01 13:27:00  rmarra
+ // V0.6.5 jfor-cmd removed, ParagraphKeepTogether implemented using standard FO "keep-together" element attribute.
+ //
  // Revision 1.5  2001/09/04 07:02:17  bdelacretaz
  // V0.4.6 - decoding of named and hexadecimal colors implemented
***************
*** 84,90 ****
--- 87,98 ----
  extends AbstractBuilder {
      public static final String TAG_FO_BLOCK = "fo:block";
+     public static final String ATTRIBUTE_FO_KEEP_TOGETHER = "keep-together";
+     
      private TextBuilder m_textBuilder;
      private Attributes m_attrib;
      private RtfParagraph m_para;
+     private static boolean m_paraKeepOpen=false;
+ 	
+ 
      
      /** if this fo:block is nested into another one, this is the builder that
***************
*** 95,113 ****
      ParagraphBuilder(BuilderContext ctx) {
          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");
!         }
      }
      
      /** called by Converter at the start of an element */
      public void start(String rawName, Attributes attrs) throws IOException {
          m_attrib = attrs;
!         m_para = startParagraph(false);
!         m_context.pushContainer(m_para);
      }
      
--- 103,133 ----
      ParagraphBuilder(BuilderContext ctx) {
          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");
! 	    }
! 	   
      }
      
+     
+     
      /** called by Converter at the start of an element */
      public void start(String rawName, Attributes attrs) throws IOException {
          m_attrib = attrs;
!         
!         if (attrs.getValue(ATTRIBUTE_FO_KEEP_TOGETHER)!=null) {
!         	RtfParagraphKeepTogether paraKeep = startParagraphKeepTogether();
!         	paraKeep.setStatus(RtfParagraphKeepTogether.STATUS_OPEN_PARAGRAPH);
!         	m_context.pushContainer(paraKeep);
!         	m_paraKeepOpen=true;
!     	}
!         	
!     	m_para = startParagraph(false);
! 	    m_context.pushContainer(m_para);
! 
      }
      
***************
*** 115,132 ****
      public void end() throws IOException {
          m_context.popContainer();
!         if(m_nestedInto!=null) {
!             m_nestedInto.nestedParagraphEnds();
          }
      }
      
      /** called by the parser for Text nodes */
      public void characters(String str) throws IOException {
!         m_textBuilder.characters(str);
      }
      
      /** this builder processes fo:block elements */
      public IBuilder getBuilder(BuilderContext ctx,String rawName, Attributes atts) {
!         if(rawName.equals(TAG_FO_BLOCK)) return new ParagraphBuilder(ctx);
!         else return null;
      }
      
--- 135,165 ----
      public void end() throws IOException {
          m_context.popContainer();
!         
!         //close the keep-together paragraph if needed
!         if (m_paraKeepOpen) {
!         	RtfParagraphKeepTogether paraKeep = startParagraphKeepTogether();
!         	paraKeep.setStatus(RtfParagraphKeepTogether.STATUS_CLOSE_PARAGRAPH);
!         	m_context.pushContainer(paraKeep);
!         	m_paraKeepOpen=false;
          }
+         
+ 	    if(m_nestedInto!=null) {
+ 	        m_nestedInto.nestedParagraphEnds();
+ 	    }
+ 	  
      }
      
      /** called by the parser for Text nodes */
      public void characters(String str) throws IOException {
!         if(m_textBuilder!=null) m_textBuilder.characters(str);
      }
      
      /** this builder processes fo:block elements */
      public IBuilder getBuilder(BuilderContext ctx,String rawName, Attributes atts) {
!         if(rawName.equals(TAG_FO_BLOCK)) {
!    			return new ParagraphBuilder(ctx);
!         } else {
!         	return null;
!         }
      }
      
***************
*** 134,137 ****
--- 167,171 ----
      private void nestedParagraphEnds()
      throws IOException {
+     	
          // start a new paragraph so that the rest of our content goes
          // after the enclosed content in the RTF document
***************
*** 143,146 ****
--- 177,190 ----
      }
      
+     
+     
+     /** Create a new RtfParagraphKeepTogether */
+     private RtfParagraphKeepTogether startParagraphKeepTogether() throws IOException {
+     	final IRtfParagraphKeepTogetherContainer c = (IRtfParagraphKeepTogetherContainer)m_context.getContainer(IRtfParagraphKeepTogetherContainer.class,true,this);
+     	return c.newParagraphKeepTogether();
+     }
+      
+     
+     
      /** Add an RtfParagraph to the current paragraph container.
       *  Can be called several times for the same ParagraphBuilder, for example when fo:blocks
***************
*** 183,187 ****
--- 227,233 ----
  		}
  
+ 		
  		final RtfParagraph para = c.newParagraph(TextAttributesConverter.convertAttributes (m_attrib, rtfAttrs, m_context.log));
+                
          
          // break page if required

--- JforCmdAttributesConverter.java DELETED ---

--- JForCmdProcessor.java DELETED ---



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