CVS: jfor/src/org/jfor/jfor/rtflib/rtfdoc RtfSection.java,1.4,1.5

Marra Roberto <[email protected]> Tue, 25 Jun 2002 06:27:26 -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-serv26333

Modified Files:
	RtfSection.java 
Log Message:
Keep paragraph with the next paragraph implemented.

Index: RtfSection.java
===================================================================
RCS file: /cvsroot/jfor/jfor/src/org/jfor/jfor/rtflib/rtfdoc/RtfSection.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** RtfSection.java	28 Dec 2001 17:08:50 -0000	1.4
--- RtfSection.java	25 Jun 2002 13:27:24 -0000	1.5
***************
*** 38,41 ****
--- 38,44 ----
  // $Id$
  // $Log$
+ // Revision 1.5  2002/06/25 13:27:24  rmarra
+ // Keep paragraph with the next paragraph implemented.
+ //
  // Revision 1.4  2001/12/28 17:08:50  bdelacretaz
  // V0.5.2 - first integration of Chris Scott's changes
***************
*** 71,74 ****
--- 74,78 ----
  	private RtfBefore m_before;
  
+ 
  	/** Create an RTF container as a child of given container */
  	RtfSection(RtfDocumentArea parent, Writer w) throws IOException {
***************
*** 105,109 ****
  	public RtfTable newTable(RtfAttributes attrs) throws IOException
  	{
! 		closeAll();
  		m_table = new RtfTable(this,m_writer, attrs);
  		return m_table;
--- 109,113 ----
  	public RtfTable newTable(RtfAttributes attrs) throws IOException
  	{
! 		closeAll();	
  		m_table = new RtfTable(this,m_writer, attrs);
  		return m_table;
***************
*** 120,124 ****
  		closeAll();
  		m_before = new RtfBefore(this,m_writer,attrs);
! 		return m_before;
  	}
  		
--- 124,128 ----
  		closeAll();
  		m_before = new RtfBefore(this,m_writer,attrs);
! 		return m_before;		
  	}
  		
***************
*** 131,137 ****
--- 135,151 ----
  	/** can be overridden to write RTF suffix code, what comes after our children */
  	protected void writeRtfSuffix() throws IOException {
+ 		checkKeepWithParagraphClosed();
  		writeControlWord("sect");
  	}
  
+ 	/** Check for RtfParagraphKeepWithNext not closed */
+ 	private void checkKeepWithParagraphClosed() throws IOException {
+ 		if (!RtfParagraphKeepWithNext.isParagraphClosed()) {
+ 			this.getRtfFile ().getLog ().logInfo ("Warning: Paragraph keep-with-next not correctly closed!");
+ 			RtfParagraphKeepWithNext para = new RtfParagraphKeepWithNext(this,m_writer);
+ 			para.writeRtfEndParagraph();
+ 		}	
+ 	}
+ 
  	private void closeCurrentTable() throws IOException {
  		if(m_table != null) m_table.close();
***************
*** 155,161 ****
  	
  
! 
  	private void closeAll()
  	throws IOException {
  		closeCurrentTable();
  		closeCurrentParagraph();
--- 169,177 ----
  	
  
! 	
! 	
  	private void closeAll()
  	throws IOException {
+ 
  		closeCurrentTable();
  		closeCurrentParagraph();



-------------------------------------------------------
Sponsored by:
ThinkGeek at http://www.ThinkGeek.com/