CVS: jfor/src/org/jfor/jfor/rtflib/rtfdoc RtfJforCmd.java,NONE,1.1 IRtfJforCmdContainer.java,NONE,1.1 RtfSection.java,1.5,1.6 RtfParagraphKeepWithNext.java,1.1,1.2

Marra Roberto <[email protected]> Wed, 26 Jun 2002 10:41:32 -0700
Newsgroups gmane.text.xml.jfor.cvs
Message-ID <[email protected]>
Update of /cvsroot/jfor/jfor/src/org/jfor/jfor/rtflib/rtfdoc
In directory usw-pr-cvs1:/tmp/cvs-serv25551

Modified Files:
	RtfSection.java RtfParagraphKeepWithNext.java 
Added Files:
	RtfJforCmd.java IRtfJforCmdContainer.java 
Log Message:
V0.6.4 jfor-cmd implemented

--- NEW FILE: RtfJforCmd.java ---
package org.jfor.jfor.rtflib.rtfdoc;



import java.io.Writer;
import java.io.*;
import java.util.*;
import java.io.IOException;

/*-----------------------------------------------------------------------------
 * jfor - Open-Source XSL-FO to RTF converter - see www.jfor.org
 *
 * The contents of this file are subject to the Mozilla Public
 * License Version 1.1 (the "License"); you may not use this file
 * except in compliance with the License. You may obtain a copy of
 * the License at http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS
 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
 * implied. See the License for the specific language governing
 * rights and limitations under the License.
 *
 * The Original Code is the contents of this java source file, as distributed
 * on www.sourceforge.net/projects/jfor and/or www.jfor.org.
 *
 * The Initial Developer of the Original Code is Bertrand Delacrétaz, 
 * codeconsult, Cugy/Lausanne, Switzerland [email protected].
 * Portions created by Bertrand Delacrétaz are Copyright (C) 2001 codeconsult, 
 * Bertrand Delacrétaz. All Rights Reserved.
 *
 * Contributor(s):
 * Christopher Scott, [email protected]
 * Portions created by Christopher Scott, are Coypright (C) 2001 
 * Westinghouse Electric Company. All Rights Reserved.
-----------------------------------------------------------------------------*/

/*
 *	RtfJforCmd process "jfor-cmd"
 *
 */
public class RtfJforCmd extends RtfContainer {
	
	private final String PARA_KEEP_ON ="para-keep:on";
	private final String PARA_KEEP_OFF ="para-keep:off";
	
	private final RtfAttributes m_attrib;
	private RtfParagraphKeepWithNext m_paraKeep=null;
	
	 
	RtfJforCmd(RtfContainer parent, Writer w, RtfAttributes attrs) throws IOException {
		super((RtfContainer)parent,w);
		m_attrib = attrs;
		m_paraKeep = new RtfParagraphKeepWithNext(this,w);
	}

	
	protected void writeRtfContent() throws IOException {		
			
		//Execute all jfor-cmd commands
		//TODO create one class for each jfor command ?
		
		for(Iterator it = m_attrib.nameIterator(); it.hasNext(); ) {
			final String cmd = (String)it.next();
			
			if (cmd.equals(PARA_KEEP_ON)) {
				m_paraKeep.startNewParagraph();		
			}else if (cmd.equals(PARA_KEEP_OFF)) {
			  	m_paraKeep.closeParagraph();
		    }else  {
		   		this.getRtfFile ().getLog ().logInfo ("JFOR-CMD ignored, command not recognised:"+cmd);	
		    }
	    
	 	}
	
		super.writeRtfContent();
	}
	
	




}

--- NEW FILE: IRtfJforCmdContainer.java ---
package org.jfor.jfor.rtflib.rtfdoc;

import java.io.IOException;

/*-----------------------------------------------------------------------------
 * jfor - Open-Source XSL-FO to RTF converter - see www.jfor.org
 *
 * The contents of this file are subject to the Mozilla Public
 * License Version 1.1 (the "License"); you may not use this file
 * except in compliance with the License. You may obtain a copy of
 * the License at http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS
 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
 * implied. See the License for the specific language governing
 * rights and limitations under the License.
 *
 * The Original Code is the contents of this java source file, as distributed
 * on www.sourceforge.net/projects/jfor and/or www.jfor.org.
 *
 * The Initial Developer of the Original Code is Bertrand Delacrétaz, 
 * codeconsult, Cugy/Lausanne, Switzerland [email protected].
 * Portions created by Bertrand Delacrétaz are Copyright (C) 2001 codeconsult, 
 * Bertrand Delacrétaz. All Rights Reserved.
 *
 * Contributor(s):
-----------------------------------------------------------------------------*/



public interface IRtfJforCmdContainer {
	public RtfJforCmd newJforCmd(RtfAttributes attr) throws IOException;
}
Index: RtfSection.java
===================================================================
RCS file: /cvsroot/jfor/jfor/src/org/jfor/jfor/rtflib/rtfdoc/RtfSection.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** RtfSection.java	25 Jun 2002 13:27:24 -0000	1.5
--- RtfSection.java	26 Jun 2002 17:41:29 -0000	1.6
***************
*** 38,41 ****
--- 38,44 ----
  // $Id$
  // $Log$
+ // Revision 1.6  2002/06/26 17:41:29  rmarra
+ // V0.6.4 jfor-cmd implemented
+ //
  // Revision 1.5  2002/06/25 13:27:24  rmarra
  // Keep paragraph with the next paragraph implemented.
***************
*** 66,70 ****
  public class RtfSection
  extends RtfContainer
! implements IRtfParagraphContainer,IRtfTableContainer,IRtfListContainer,IRtfExternalGraphicContainer,IRtfBeforeContainer
  {
  	private RtfParagraph m_paragraph;
--- 69,73 ----
  public class RtfSection
  extends RtfContainer
! implements IRtfParagraphContainer,IRtfTableContainer,IRtfListContainer,IRtfExternalGraphicContainer,IRtfBeforeContainer, IRtfJforCmdContainer
  {
  	private RtfParagraph m_paragraph;
***************
*** 73,77 ****
  	private RtfExternalGraphic m_externalGraphic;
  	private RtfBefore m_before;
! 
  
  	/** Create an RTF container as a child of given container */
--- 76,80 ----
  	private RtfExternalGraphic m_externalGraphic;
  	private RtfBefore m_before;
! 	private RtfJforCmd m_jforCmd;
  
  	/** Create an RTF container as a child of given container */
***************
*** 125,128 ****
--- 128,136 ----
  		m_before = new RtfBefore(this,m_writer,attrs);
  		return m_before;		
+ 	}
+ 	
+ 	public RtfJforCmd newJforCmd(RtfAttributes attrs) throws IOException {
+ 		m_jforCmd  = new RtfJforCmd(this,m_writer,attrs);
+ 		return m_jforCmd;
  	}
  		

Index: RtfParagraphKeepWithNext.java
===================================================================
RCS file: /cvsroot/jfor/jfor/src/org/jfor/jfor/rtflib/rtfdoc/RtfParagraphKeepWithNext.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** RtfParagraphKeepWithNext.java	25 Jun 2002 13:23:36 -0000	1.1
--- RtfParagraphKeepWithNext.java	26 Jun 2002 17:41:29 -0000	1.2
***************
*** 69,76 ****
  	
    	protected void writeRtfContent() throws IOException {
- 	
  		//Create a new paragraph with the attribute "Keep paragraph with the next paragraph".
      	if (m_status == STATUS_NEW_PARA) {	
! 			   	//System.out.println ("RtfParagraphKeepWithNext keep-with-next");
  				keepWithNextActived=true;
  		    	writeControlWord("pard");
--- 69,75 ----
  	
    	protected void writeRtfContent() throws IOException {
  		//Create a new paragraph with the attribute "Keep paragraph with the next paragraph".
      	if (m_status == STATUS_NEW_PARA) {	
! 			   	//System.out.println ("RtfParagraphKeepWithNext begin");
  				keepWithNextActived=true;
  		    	writeControlWord("pard");
***************
*** 84,88 ****
  	    //Set the end of group mark that was started	   
  	   	if (m_status == STATUS_CLOSE_PARA) {	
! 	    		//System.out.println ("RtfParagraphKeepWithNext keep-with-previous");
  				keepWithNextActived=false;
  		        writeGroupMark(false);
--- 83,87 ----
  	    //Set the end of group mark that was started	   
  	   	if (m_status == STATUS_CLOSE_PARA) {	
! 	    		//System.out.println ("RtfParagraphKeepWithNext end");
  				keepWithNextActived=false;
  		        writeGroupMark(false);



-------------------------------------------------------
This sf.net email is sponsored by: Jabber Inc.
Don't miss the IM event of the season | Special offer for OSDN members! 
JabberConf 2002, Aug. 20-22, Keystone, CO http://www.jabberconf.com/osdn