Update of /cvsroot/jfor/jfor/src/org/jfor/jfor/rtflib/rtfdoc
In directory usw-pr-cvs1:/tmp/cvs-serv17517/src/org/jfor/jfor/rtflib/rtfdoc
Modified Files:
RtfAfter.java RtfBefore.java
Added Files:
RtfAfterBeforeBase.java
Log Message:
V0.7.2dev-b, supports tables in headers and footers (thanks to Christoph Zahm
<zahm@xxxxxxx>)
--- NEW FILE: RtfAfterBeforeBase.java ---
package org.jfor.jfor.rtflib.rtfdoc;
import java.io.Writer;
import java.io.*;
import java.util.*;
import java.io.IOException;
import org.jfor.jfor.interfaces.ITableColumnsInfo;
/*-----------------------------------------------------------------------------
* 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 info@xxxxxxxxx
*
* 5. Products derived from this software may not be called "jfor",
* nor may "jfor" appear in their name, without prior written
* permission of info@xxxxxxxxx
*
* 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 Lambert <andreas.lambert@xxxxxxxxxxxxxxx>
* @author Christopher Scott, scottc@xxxxxxxxxxxxxxxx
* @author Christoph Zahm <zahm@xxxxxxx> (support for tables in
headers/footers)
----------------------------------------------------------------------------*/
//------------------------------------------------------------------------------
// $Id: RtfAfterBeforeBase.java,v 1.1 2002/09/03 10:29:36 bdelacretaz Exp $
// $Log: RtfAfterBeforeBase.java,v $
// Revision 1.1 2002/09/03 10:29:36 bdelacretaz
// V0.7.2dev-b, supports tables in headers and footers (thanks to Christoph
Zahm <zahm@xxxxxxx>)
//
// Revision 1.1 2002/07/15 06:44:05 bdelacretaz
// footer code contributed by Andreas Lambert <andreas.lambert@xxxxxxxxxxxxxxx>
//
//------------------------------------------------------------------------------
/** Common code for RtfAfter and RtfBefore */
abstract class RtfAfterBeforeBase
extends RtfContainer
implements IRtfParagraphContainer,
IRtfExternalGraphicContainer,IRtfTableContainer {
protected RtfAttributes m_attrib;
private RtfParagraph m_para;
private RtfExternalGraphic m_externalGraphic;
private RtfTable m_table;
RtfAfterBeforeBase(RtfSection parent, Writer w, RtfAttributes attrs) throws
IOException {
super((RtfContainer)parent,w,attrs);
m_attrib = attrs;
}
public RtfParagraph newParagraph() throws IOException {
closeAll();
m_para = new RtfParagraph(this,m_writer);
return m_para;
}
public RtfParagraph newParagraph(RtfAttributes attrs) throws IOException {
closeAll();
m_para = new RtfParagraph(this,m_writer,attrs);
return m_para;
}
public RtfExternalGraphic newImage() throws IOException {
closeAll();
m_externalGraphic = new RtfExternalGraphic(this,m_writer);
return m_externalGraphic;
}
private void closeCurrentParagraph() throws IOException {
if(m_para!=null) m_para.close();
}
private void closeCurrentExternalGraphic() throws IOException {
if(m_externalGraphic!=null) m_externalGraphic.close();
}
private void closeCurrentTable() throws IOException {
if(m_table != null) m_table.close();
}
protected void writeRtfPrefix() throws IOException {
writeGroupMark(true);
writeMyAttributes();
}
/** must be implemented to write the header or footer attributes */
abstract protected void writeMyAttributes() throws IOException;
protected void writeRtfSuffix() throws IOException {
writeGroupMark(false);
}
public RtfAttributes getAttributes(){
return m_attrib;
}
public void closeAll() throws IOException {
closeCurrentParagraph();
closeCurrentExternalGraphic();
closeCurrentTable();
}
/** close current table if any and start a new one
* @param tc added by Boris Poudérous on july 2002 in order to process
number-columns-spanned attribute
*/
public RtfTable newTable(RtfAttributes attrs, ITableColumnsInfo tc) throws
IOException {
closeAll();
m_table = new RtfTable(this,m_writer,attrs,tc);
return m_table;
}
/** close current table if any and start a new one */
public RtfTable newTable(ITableColumnsInfo tc) throws IOException {
closeAll();
m_table = new RtfTable(this,m_writer,tc);
return m_table;
}
}
Index: RtfAfter.java
===================================================================
RCS file: /cvsroot/jfor/jfor/src/org/jfor/jfor/rtflib/rtfdoc/RtfAfter.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** RtfAfter.java 15 Jul 2002 06:44:05 -0000 1.1
--- RtfAfter.java 3 Sep 2002 10:29:36 -0000 1.2
***************
*** 2,7 ****
import java.io.Writer;
- import java.io.*;
- import java.util.*;
import java.io.IOException;
--- 2,5 ----
***************
*** 53,57 ****
* ====================================================================
* Contributor(s):
! * @author Andreas Lambert <andreas.lambert@xxxxxxxxxxxxxxx>
-----------------------------------------------------------------------------*/
--- 51,55 ----
* ====================================================================
* Contributor(s):
! * @author Andreas Lambert <andreas.lambert@xxxxxxxxxxxxxxx>
-----------------------------------------------------------------------------*/
***************
*** 59,62 ****
--- 57,63 ----
// $Id$
// $Log$
+ // Revision 1.2 2002/09/03 10:29:36 bdelacretaz
+ // V0.7.2dev-b, supports tables in headers and footers (thanks to Christoph
Zahm <zahm@xxxxxxx>)
+ //
// Revision 1.1 2002/07/15 06:44:05 bdelacretaz
// footer code contributed by Andreas Lambert
<andreas.lambert@xxxxxxxxxxxxxxx>
***************
*** 65,128 ****
/** RtfContainer that encloses footers */
! public class RtfAfter extends RtfContainer implements IRtfParagraphContainer,
IRtfExternalGraphicContainer{
! private RtfAttributes m_attrib;
! private RtfParagraph m_para;
! private RtfExternalGraphic m_externalGraphic;
!
! /**RtfBefore attributes*/
! public final static String FOOTER = "footer";
!
! public final static String[] FOOTER_ATTR = new String[]{
! FOOTER
! };
!
! RtfAfter(RtfSection parent, Writer w, RtfAttributes attrs) throws
IOException {
! super((RtfContainer)parent,w,attrs);
! m_attrib = attrs;
! }
!
! public RtfParagraph newParagraph() throws IOException {
! closeAll();
! m_para = new RtfParagraph(this,m_writer);
! return m_para;
! }
!
! public RtfParagraph newParagraph(RtfAttributes attrs) throws
IOException {
! closeAll();
! m_para = new RtfParagraph(this,m_writer,attrs);
! return m_para;
! }
!
! public RtfExternalGraphic newImage() throws IOException {
! closeAll();
! m_externalGraphic = new RtfExternalGraphic(this,m_writer);
! return m_externalGraphic;
! }
!
! private void closeCurrentParagraph() throws IOException {
! if(m_para!=null) m_para.close();
! }
!
! private void closeCurrentExternalGraphic() throws IOException {
! if(m_externalGraphic!=null) m_externalGraphic.close();
! }
!
! protected void writeRtfPrefix() throws IOException {
! writeGroupMark(true);
! writeAttributes(m_attrib,FOOTER_ATTR);
! }
!
! protected void writeRtfSuffix() throws IOException {
! writeGroupMark(false);
! }
!
! public RtfAttributes getAttributes(){
! return m_attrib;
! }
!
! public void closeAll() throws IOException
! {
! closeCurrentParagraph();
! closeCurrentExternalGraphic();
! }
}
--- 66,82 ----
/** RtfContainer that encloses footers */
! public class RtfAfter extends RtfAfterBeforeBase {
! /**RtfBefore attributes*/
! public final static String FOOTER = "footer";
! public final static String[] FOOTER_ATTR = new String[]{
! FOOTER
! };
!
! RtfAfter(RtfSection parent, Writer w, RtfAttributes attrs) throws
IOException {
! super(parent,w,attrs);
! }
!
! protected void writeMyAttributes() throws IOException {
! writeAttributes(m_attrib,FOOTER_ATTR);
! }
}
Index: RtfBefore.java
===================================================================
RCS file: /cvsroot/jfor/jfor/src/org/jfor/jfor/rtflib/rtfdoc/RtfBefore.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** RtfBefore.java 12 Jul 2002 08:08:31 -0000 1.2
--- RtfBefore.java 3 Sep 2002 10:29:36 -0000 1.3
***************
*** 2,7 ****
import java.io.Writer;
- import java.io.*;
- import java.util.*;
import java.io.IOException;
--- 2,5 ----
***************
*** 53,59 ****
* ====================================================================
* Contributor(s):
- * Christopher Scott, scottc@xxxxxxxxxxxxxxxx
- * Portions created by Christopher Scott are Coypright (C) 2001
- * Westinghouse Electric Company. All Rights Reserved.
-----------------------------------------------------------------------------*/
--- 51,54 ----
***************
*** 61,64 ****
--- 56,62 ----
// $Id$
// $Log$
+ // Revision 1.3 2002/09/03 10:29:36 bdelacretaz
+ // V0.7.2dev-b, supports tables in headers and footers (thanks to Christoph
Zahm <zahm@xxxxxxx>)
+ //
// Revision 1.2 2002/07/12 08:08:31 bdelacretaz
// License changed to jfor Apache-style license
***************
*** 69,141 ****
//------------------------------------------------------------------------------
! public class RtfBefore
! extends RtfContainer
! implements IRtfParagraphContainer, IRtfExternalGraphicContainer{
! private RtfAttributes m_attrib;
! private RtfParagraph m_para;
! private RtfExternalGraphic m_externalGraphic;
!
! /**RtfBefore attributes*/
! public final static String HEADER = "header";
!
! public final static String[] HEADER_ATTR = new String[]{
! HEADER
! };
!
! RtfBefore(RtfSection parent, Writer w, RtfAttributes attrs) throws
IOException {
! super((RtfContainer)parent,w,attrs);
! m_attrib = attrs;
! }
!
! public RtfParagraph newParagraph() throws IOException {
! closeAll();
! m_para = new RtfParagraph(this,m_writer);
! return m_para;
! }
!
! public RtfParagraph newParagraph(RtfAttributes attrs) throws
IOException {
! closeAll();
! m_para = new RtfParagraph(this,m_writer,attrs);
! return m_para;
! }
!
! public RtfExternalGraphic newImage() throws IOException {
! closeAll();
! m_externalGraphic = new RtfExternalGraphic(this,m_writer);
! return m_externalGraphic;
! }
!
! private void closeCurrentParagraph() throws IOException {
! if(m_para!=null) m_para.close();
! }
!
! private void closeCurrentExternalGraphic() throws IOException {
! if(m_externalGraphic!=null) m_externalGraphic.close();
! }
!
! protected void writeRtfPrefix() throws IOException {
! writeGroupMark(true);
! writeAttributes(m_attrib,HEADER_ATTR);
! }
!
! protected void writeRtfSuffix() throws IOException {
! writeGroupMark(false);
! }
!
! public RtfAttributes getAttributes(){
! return m_attrib;
! }
!
! /*protected boolean okToWriteRtf()
! {
! return true;
! }*/
!
!
! public void closeAll() throws IOException
! {
! closeCurrentParagraph();
! closeCurrentExternalGraphic();
! }
!
}
--- 67,84 ----
//------------------------------------------------------------------------------
! public class RtfBefore extends RtfAfterBeforeBase {
! /**RtfBefore attributes*/
! public final static String HEADER = "header";
!
! public final static String[] HEADER_ATTR = new String[]{
! HEADER
! };
!
! RtfBefore(RtfSection parent, Writer w, RtfAttributes attrs) throws
IOException {
! super(parent,w,attrs);
! }
!
! protected void writeMyAttributes() throws IOException {
! writeAttributes(m_attrib,HEADER_ATTR);
! }
}
-------------------------------------------------------
This sf.net email is sponsored by: OSDN - Tired of that same old
cell phone? Get a new here for FREE!
https://www.inphonic.com/r.asp?r=sourceforge1&refcode1=vs3390
|