<exclude name="org/apache/fop/pdf/PDFEncryptionJCE.java" unless="jce.present"/>
</patternset>
- <!-- jfor RTF library has been moved here but needs tweaking before it compiles -->
- <!-- remove this once the RTF library compiles -->
- <patternset id="exclude-rtflib">
- <exclude name="org/apache/fop/rtf/rtflib/**/*.java"/>
- </patternset>
-
<patternset id="base-sources">
<include name="**/*.java"/>
<exclude name="**/*${ignore_this}"/>
<patternset refid="exclude-jce-dependencies"/>
<patternset refid="exclude-jai"/>
<patternset refid="exclude-jimi"/>
-
- <!-- remove this once the RTF library compiles -->
- <patternset refid="exclude-rtflib"/>
-
<classpath refid="libs-build-classpath"/>
<patternset refid="base-sources"/>
</javac>
import org.apache.fop.fo.flow.TableRow;
// JFOR
-import org.jfor.jfor.rtflib.rtfdoc.RtfAttributes;
-import org.jfor.jfor.rtflib.rtfdoc.RtfFile;
-import org.jfor.jfor.rtflib.rtfdoc.RtfSection;
-import org.jfor.jfor.rtflib.rtfdoc.RtfText;
-import org.jfor.jfor.rtflib.rtfdoc.RtfParagraph;
-import org.jfor.jfor.rtflib.rtfdoc.RtfDocumentArea;
+import org.apache.fop.rtf.rtflib.rtfdoc.RtfAttributes;
+import org.apache.fop.rtf.rtflib.rtfdoc.RtfFile;
+import org.apache.fop.rtf.rtflib.rtfdoc.RtfSection;
+import org.apache.fop.rtf.rtflib.rtfdoc.RtfText;
+import org.apache.fop.rtf.rtflib.rtfdoc.RtfParagraph;
+import org.apache.fop.rtf.rtflib.rtfdoc.RtfDocumentArea;
/**
* RTF Handler: generates RTF output using the structure events from
*/
public void writeRtfContent () throws IOException
{
- this.getRtfFile ().getLog ().logInfo ("Write bookmark '" + bookmark + "'.");
+// this.getRtfFile ().getLog ().logInfo ("Write bookmark '" + bookmark + "'.");
// No content to write
}
// warn of this problem
final RtfFile rf = getRtfFile();
- if(rf.getLog() != null) {
- rf.getLog().logWarning(msg);
- }
+// if(rf.getLog() != null) {
+// rf.getLog().logWarning(msg);
+// }
// TODO this should be activated to help detect XSL-FO constructs
// that we do not handle properly.
import java.io.*;
import java.util.*;
-import org.apache.fop.rtf.rtflib.jfor.main.JForVersionInfo;
+//import org.apache.fop.rtf.rtflib.jfor.main.JForVersionInfo;
import org.xml.sax.Attributes;
/** Base class for all elements of an RTF file.
// make the exception message stand out so that the problem is visible
writeControlWord("fs48");
- RtfStringConverter.getInstance().writeRtfString(m_writer,JForVersionInfo.getShortVersionInfo() + ": ");
+// RtfStringConverter.getInstance().writeRtfString(m_writer,JForVersionInfo.getShortVersionInfo() + ": ");
RtfStringConverter.getInstance().writeRtfString(m_writer,ie.getClass().getName());
writeControlWord("fs20");
import org.apache.fop.rtf.rtflib.tools.ImageConstants;
import org.apache.fop.rtf.rtflib.tools.ImageUtil;
-import org.apache.fop.rtf.rtflib.tools.jpeg.Encoder;
-import org.apache.fop.rtf.rtflib.tools.jpeg.JPEGException;
+//import org.apache.fop.rtf.rtflib.tools.jpeg.Encoder;
+//import org.apache.fop.rtf.rtflib.tools.jpeg.JPEGException;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
return;
}
- getRtfFile ().getLog ().logInfo ("Writing image '" + url + "'.");
+// getRtfFile ().getLog ().logInfo ("Writing image '" + url + "'.");
byte[] data = null;
if (to == ImageConstants.I_JPG) {
ByteArrayOutputStream out = null;
- try {
+// try {
//convert to jpeg
- out = new ByteArrayOutputStream();
- Encoder jpgEncoder = new Encoder(graphicCompressionRate, out);
- jpgEncoder.encodeJPEG(data);
- data = out.toByteArray();
- type = to;
- }
- catch (JPEGException e) {
- e.setMessage("Image from tag <fo:external-graphic> could not be created (src = '" + url + "'");
- }
- finally {
+// out = new ByteArrayOutputStream();
+// Encoder jpgEncoder = new Encoder(graphicCompressionRate, out);
+// jpgEncoder.encodeJPEG(data);
+// data = out.toByteArray();
+// type = to;
+// }
+// catch (JPEGException e) {
+// e.setMessage("Image from tag <fo:external-graphic> could not be created (src = '" + url + "'");
+// }
+// finally {
out.close();
- }
+// }
}
else {
type = ImageConstants.I_NOT_SUPPORTED;
package org.apache.fop.rtf.rtflib.rtfdoc;
import org.apache.fop.rtf.rtflib.exceptions.RtfStructureException;
-import org.apache.fop.rtf.rtflib.jfor.converter.ConverterLogChannel;
+//import org.apache.fop.rtf.rtflib.jfor.converter.ConverterLogChannel;
import java.io.*;
/** Models the top-level structure of an RTF file.
private RtfPageArea m_pageArea;
private RtfListTable m_listTable;
private RtfDocumentArea m_docArea;
- private ConverterLogChannel m_log;
+// private ConverterLogChannel m_log;
private RtfContainer m_listTableContainer;
private int listNum=0;
}
/** optional log channel */
- public void setLogChannel(ConverterLogChannel log)
- {
- m_log = log;
- }
+// public void setLogChannel(ConverterLogChannel log)
+// {
+// m_log = log;
+// }
/**
* Gets the log channel.
* If logchannel not set, it will return a empty log channel.
* @return our log channel, it is never null */
- ConverterLogChannel getLog()
- {
- if (m_log == null)
- m_log = new ConverterLogChannel (null);
- return m_log;
- }
+// ConverterLogChannel getLog()
+// {
+// if (m_log == null)
+// m_log = new ConverterLogChannel (null);
+// return m_log;
+// }
/** If called, must be called before startDocumentArea */
public RtfHeader startHeader()
m_listTableContainer = new RtfContainer(this,m_writer);
return m_header;
}
-
+
/** Creates the list table.*/
public RtfListTable startListTable(RtfAttributes attr)
throws IOException{
m_listTableContainer.addChild(m_listTable);
return m_listTable;
}
-
+
/** Closes the RtfHeader if not done yet, and starts the docment area.
Like startDocumentArea, is only called once. This is not optimal,
must be able to have multiple page definition, and corresponding
addChild(m_pageArea);
return m_pageArea;
}
-
+
/** Call startPageArea if needed and return the page area object. */
public RtfPageArea getPageArea()
throws IOException,RtfStructureException {
if(m_pageArea== null) return startPageArea();
return m_pageArea;
}
-
+
/** Closes the RtfHeader if not done yet, and starts the document area.
* Must be called once only.
*/
addChild(m_docArea);
return m_docArea;
}
-
-
-
+
+
+
/** Call startDocumentArea if needed and return the document area object. */
public RtfDocumentArea getDocumentArea()
throws IOException,RtfStructureException {
import java.util.*;
import java.io.Writer;
import java.io.IOException;
-import org.apache.fop.rtf.rtflib.jfor.main.JForVersionInfo;
+//import org.apache.fop.rtf.rtflib.jfor.main.JForVersionInfo;
/** RTF file header, contains style, font and other document-level information.
* @author Bertrand Delacretaz bdelacretaz@codeconsult.ch
class RtfHeader extends RtfContainer {
private final String m_charset = "ansi";
private final Map m_userProperties = new HashMap();
-
+
/** Create an RTF header */
RtfHeader(RtfFile f,Writer w) throws IOException {
super(f,w);
new RtfFontTable(this,w);
- m_userProperties.put("jforVersion",JForVersionInfo.getLongVersionInfo());
+// m_userProperties.put("jforVersion",JForVersionInfo.getLongVersionInfo());
}
-
+
/** Overridden to write our own data before our children's data */
protected void writeRtfContent() throws IOException {
writeControlWord(m_charset);
RtfStyleSheetTable.getInstance().writeStyleSheet(this);
}
-
+
/** write user properties if any */
private void writeUserProperties() throws IOException {
if(m_userProperties.size() > 0) {
writeGroupMark(false);
}
}
-
+
/** write directly to our Writer
* TODO should check that this done at the right point, or even better, store
* what is written here to render it in writeRtfContent. <-- it is for the color table
void write(String toWrite) throws IOException {
m_writer.write(toWrite);
}
-
+
/** write to our Writer using an RtfStringConverter */
void writeRtfString(String toWrite) throws IOException {
RtfStringConverter.getInstance().writeRtfString(m_writer,toWrite);
*
*/
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 ParagraphKeeptogetherContext m_paragraphKeeptogetherContext;
-
-
+
+
RtfJforCmd(RtfContainer parent, Writer w, RtfAttributes attrs) throws IOException {
super((RtfContainer)parent,w);
m_attrib = attrs;
m_paragraphKeeptogetherContext=ParagraphKeeptogetherContext.getInstance();
}
-
-
+
+
public boolean isEmpty() {
- return true;
+ return true;
}
-
-
+
+
public void process() {
-
+
//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_paragraphKeeptogetherContext.KeepTogetherOpen();
+ m_paragraphKeeptogetherContext.KeepTogetherOpen();
}else if (cmd.equals(PARA_KEEP_OFF)) {
m_paragraphKeeptogetherContext.KeepTogetherClose();
}else {
- this.getRtfFile ().getLog ().logInfo ("JFOR-CMD ignored, command not recognised:"+cmd);
+// this.getRtfFile ().getLog ().logInfo ("JFOR-CMD ignored, command not recognised:"+cmd);
}
-
+
}
-
+
}
-
-
-
+
+
+
}
\ No newline at end of file
import java.util.*;
import java.io.Writer;
import java.io.IOException;
-import org.apache.fop.rtf.rtflib.jfor.main.JForVersionInfo;
+//import org.apache.fop.rtf.rtflib.jfor.main.JForVersionInfo;
/**RtfListTable: used to make the list table in the header section of the RtfFile.
* This is the method that Word uses to make lists in RTF and the way most RTF readers,
* @author Christopher Scott, scottc@westinghouse.com
*/
public class RtfListTable extends RtfContainer{
-
+
//number of list in document
private Integer listNum;
//id of list
public static final String LIST_NAME = "listname ;";
public static final String LIST_ID = "listid";
public static final String LIST_FONT_TYPE ="f";
-
+
public static final String LIST_OVR_TABLE = "listoverridetable";
public static final String LIST_OVR = "listoverride";
public static final String LIST_OVR_COUNT = "listoverridecount";
public static final String LIST_NUMBER = "ls";
-
+
public static final String [] LIST_TABLE_ATTR = {
LIST_TABLE, LIST, LIST_TEMPLATE_ID,
LIST_NUMBER_TYPE, LIST_JUSTIFICATION, LIST_FOLLOWING_CHAR,
LIST_OVR_TABLE, LIST_OVR, LIST_OVR_COUNT,
LIST_NUMBER, LIST_LEVEL
};
-
+
/**RtfListTable Constructor: sets the number of the list, and allocates
* for the RtfAttributes */
public RtfListTable(RtfContainer parent, Writer w, Integer num, RtfAttributes attrs)
listTemplateId = new Integer(listIdGenerator.nextInt());
m_attrib.set(LIST_NUMBER_TYPE,0);
}
-
+
public void setParentList(RtfList parent) {
parentList = parent;
}
-
+
public Integer getListNumber() {
return listNum;
}
-
+
/** Set whether the list is a bulleted list not, and set attributes
* accordingly */
private void setListType() {
m_attrib.set(LIST_FONT_TYPE,0);
}
}
-
+
public void writeRtfContent() throws IOException {
setListType();
writeGroupMark(true);
writeStarControlWordNS(LIST_TABLE);
writeGroupMark(true);
-
+
writeControlWordNS(LIST);
writeOneAttributeNS(LIST_TEMPLATE_ID,listTemplateId.toString());
writeOneAttributeNS(LIST,m_attrib.getValue(LIST));
writeGroupMark(false);
writeGroupMark(false);
}
-
+
//since this has no text content we have to overwrite isEmpty to print
//the table
public boolean isEmpty() {
return false;
}
-
-
+
+
}
\ No newline at end of file
if(rightPadStr != null) gaph = (gaph + rightPadStr.intValue()) / 2;
} catch(Exception e) {
final String msg = "RtfTableRow.writePaddingAttributes: " + e.toString();
- getRtfFile().getLog().logWarning(msg);
+// getRtfFile().getLog().logWarning(msg);
}
if(gaph >= 0) {
m_attrib.set(ATTR_RTF_15_TRGAPH,gaph);
import java.io.File;
import java.io.IOException;
-import org.apache.fop.rtf.rtflib.jfor.main.JForVersionInfo;
+//import org.apache.fop.rtf.rtflib.jfor.main.JForVersionInfo;
/** Create test RTF documents from classes found in this package.
* @author Bertrand Delacretaz bdelacretaz@codeconsult.ch
System.exit(1);
}
- System.err.println("CreateTestDocuments - using " + JForVersionInfo.getLongVersionInfo());
+// System.err.println("CreateTestDocuments - using " + JForVersionInfo.getLongVersionInfo());
System.err.println("Generates documents to test the jfor RTF library.");
final File outDir = new File(args[0]);
new CreateTestDocuments(outDir);
import java.util.Date;
import java.io.*;
import org.apache.fop.rtf.rtflib.rtfdoc.*;
-import org.apache.fop.rtf.rtflib.jfor.main.JForVersionInfo;
+//import org.apache.fop.rtf.rtflib.jfor.main.JForVersionInfo;
/** Base class for generating RTF documents used to test the jfor rtflib package.
* @author Bertrand Delacretaz bdelacretaz@codeconsult.ch
abstract class TestDocument {
private File m_output;
-
+
final void setOutputDir(File outDir)
throws IOException
{
m_output = new File(outDir,getRtfFilename());
}
-
+
final String getRtfFilename()
{
// use class name for output filename
final int pos = name.lastIndexOf('.');
return name.substring(pos + 1) + ".rtf";
}
-
+
final void generateOutput()
throws IOException
{
generateDocument(rda,sect);
f.flush();
}
-
+
protected abstract void generateDocument(RtfDocumentArea rda,RtfSection sect) throws IOException;
-
+
void debugMsg(String msg)
{
System.err.println(msg);
}
-
+
protected void addIntroComments(RtfSection sect) throws IOException
{
final RtfParagraph para = sect.newParagraph();
-
+
para.newText("jfor RTF library test document.");
para.newLineBreak();
- para.newText(JForVersionInfo.getLongVersionInfo());
+// para.newText(JForVersionInfo.getLongVersionInfo());
para.newLineBreak();
para.newText("generated by class " + getClass().getName());
para.newLineBreak();