public RtfParagraph newParagraph() throws IOException {
closeAll();
- para = new RtfParagraph(this, m_writer);
+ para = new RtfParagraph(this, writer);
return para;
}
public RtfParagraph newParagraph(RtfAttributes attrs) throws IOException {
closeAll();
- para = new RtfParagraph(this, m_writer, attrs);
+ para = new RtfParagraph(this, writer, attrs);
return para;
}
public RtfExternalGraphic newImage() throws IOException {
closeAll();
- externalGraphic = new RtfExternalGraphic(this, m_writer);
+ externalGraphic = new RtfExternalGraphic(this, writer);
return externalGraphic;
}
*/
public RtfTable newTable(RtfAttributes attrs, ITableColumnsInfo tc) throws IOException {
closeAll();
- table = new RtfTable(this, m_writer, attrs, tc);
+ table = new RtfTable(this, writer, attrs, tc);
return table;
}
/** close current table if any and start a new one */
public RtfTable newTable(ITableColumnsInfo tc) throws IOException {
closeAll();
- table = new RtfTable(this, m_writer, tc);
+ table = new RtfTable(this, writer, tc);
return table;
}
}
\ No newline at end of file
//changed. Now using writeStarControlWord
this.writeStarControlWord (tag);
- m_writer.write (bookmark);
+ writer.write (bookmark);
this.writeGroupMark (false);
}
mBookmark.close ();
}
- mBookmark = new RtfBookmark (this, m_writer, bookmark);
+ mBookmark = new RtfBookmark (this, writer, bookmark);
return mBookmark;
}
public class RtfDocumentArea
extends RtfContainer {
- private RtfSection m_currentSection;
+ private RtfSection currentSection;
/** Create an RTF element as a child of given container */
RtfDocumentArea(RtfFile f, Writer w) throws IOException {
super(f, w);
}
- /** close current RtfSection if any and create a new one */
+ /**
+ * Close current RtfSection if any and create a new one
+ * @throws IOException for I/O problems
+ * @return the new RtfSection
+ */
public RtfSection newSection() throws IOException {
- if (m_currentSection != null) {
- m_currentSection.close();
+ if (currentSection != null) {
+ currentSection.close();
}
- m_currentSection = new RtfSection(this, m_writer);
- return m_currentSection;
+ currentSection = new RtfSection(this, writer);
+ return currentSection;
}
}
\ No newline at end of file
* @author Andreas Putz a.putz@skynamics.com
*/
public abstract class RtfElement {
- protected final Writer m_writer;
- protected final RtfContainer m_parent;
- protected final RtfAttributes m_attrib;
- private boolean m_written;
- private boolean m_closed;
- private final int m_id;
- private static int m_idCounter;
+ /** Writer to be used */
+ protected final Writer writer;
+ /** parent element */
+ protected final RtfContainer parent;
+ /** attributes of the element */
+ protected final RtfAttributes attrib;
+ private boolean written;
+ private boolean closed;
+ private final int id;
+ private static int idCounter;
/** Create an RTF element as a child of given container */
RtfElement(RtfContainer parent, Writer w) throws IOException {
this(parent, w, null);
}
-
/** Create an RTF element as a child of given container with given attributes */
RtfElement(RtfContainer parent, Writer w, RtfAttributes attr) throws IOException {
- m_id = m_idCounter++;
- m_parent = parent;
- m_attrib = (attr != null ? attr : new RtfAttributes());
- if (m_parent != null) {
- m_parent.addChild(this);
+ id = idCounter++;
+ this.parent = parent;
+ attrib = (attr != null ? attr : new RtfAttributes());
+ if (this.parent != null) {
+ this.parent.addChild(this);
}
- m_writer = w;
- m_written = false;
+ writer = w;
+ written = false;
}
- /** Does nothing, meant to allow elements to write themselves without waiting
- * for write(), but not implemented yet */
+ /**
+ * Does nothing, meant to allow elements to write themselves without waiting
+ * for write(), but not implemented yet
+ * @throws IOException for I/O problems
+ */
public final void close() throws IOException {
- m_closed = true;
+ closed = true;
}
- /** write the RTF code of this element to our Writer */
+ /**
+ * Write the RTF code of this element to our Writer
+ * @throws IOException for I/O problems
+ */
public final void writeRtf() throws IOException {
- if (!m_written) {
- m_written = true;
+ if (!written) {
+ written = true;
if (okToWriteRtf()) {
writeRtfPrefix();
writeRtfContent();
}
}
- /** write an RTF control word to our Writer */
+ /**
+ * Write an RTF control word to our Writer
+ * @param word RTF control word to write
+ * @throws IOException for I/O problems
+ */
protected final void writeControlWord(String word)
throws IOException {
- m_writer.write('\\');
- m_writer.write(word);
- m_writer.write(' ');
+ writer.write('\\');
+ writer.write(word);
+ writer.write(' ');
}
- /** write an RTF control word to our Writer, preceeded by a star '*'
- * meaning "ignore this if you don't know what it means"
+ /**
+ * Write an RTF control word to our Writer, preceeded by a star '*'
+ * meaning "ignore this if you don't know what it means"
+ * @param word RTF control word to write
+ * @throws IOException for I/O problems
*/
protected final void writeStarControlWord(String word)
throws IOException {
- m_writer.write("\\*\\");
- m_writer.write(word);
- m_writer.write(' ');
+ writer.write("\\*\\");
+ writer.write(word);
+ writer.write(' ');
}
+ /**
+ * Same as writeStarControlWord(String word), except with no space behind it
+ * @param word RTF control word to write
+ * @throws IOException for I/O problems
+ */
protected final void writeStarControlWordNS(String word)
throws IOException {
- m_writer.write("\\*\\");
- m_writer.write(word);
+ writer.write("\\*\\");
+ writer.write(word);
}
- /** write rtf control word without the space behind it */
+ /**
+ * Write rtf control word without the space behind it
+ * @param word RTF control word to write
+ * @throws IOException for I/O problems
+ */
protected final void writeControlWordNS(String word)
throws IOException {
- m_writer.write('\\');
- m_writer.write(word);
+ writer.write('\\');
+ writer.write(word);
}
- /** called before writeRtfContent() */
+ /**
+ * Called before writeRtfContent()
+ * @throws IOException for I/O problems
+ */
protected void writeRtfPrefix() throws IOException {
}
- /** must be implemented to write RTF content to m_writer */
+ /**
+ * Must be implemented to write RTF content to m_writer
+ * @throws IOException for I/O problems
+ */
protected abstract void writeRtfContent() throws IOException;
- /** called after writeRtfContent() */
+ /**
+ * Called after writeRtfContent()
+ * @throws IOException for I/O problems
+ */
protected void writeRtfSuffix() throws IOException {
}
- /** Write a start or end group mark */
+ /**
+ * Write a start or end group mark
+ * @param isStart set to true if this is a start mark
+ * @throws IOException for I/O problems
+ */
protected final void writeGroupMark(boolean isStart)
throws IOException {
- m_writer.write(isStart ? "{" : "}");
+ writer.write(isStart ? "{" : "}");
}
- /** write given attribute values to our Writer
- * @param nameList if given, only attribute names from this list are considered
+ /**
+ * Write given attribute values to our Writer
+ * @param attr RtfAttributes to be written
+ * @param nameList if given, only attribute names from this list are considered
+ * @throws IOException for I/O problems
*/
protected void writeAttributes(RtfAttributes attr, String [] nameList)
throws IOException {
}
}
- /** write one attribute to our Writer */
+ /**
+ * Write one attribute to our Writer
+ * @param name name of attribute to write
+ * @param value value of attribute to be written
+ * @throws IOException for I/O problems
+ */
protected void writeOneAttribute(String name, Object value)
throws IOException {
String cw = name;
}
writeControlWord(cw);
}
- /** write one attribute to our Writer without a space*/
+
+ /**
+ * Write one attribute to our Writer without a space
+ * @param name name of attribute to write
+ * @param value value of attribute to be written
+ * @throws IOException for I/O problems
+ */
protected void writeOneAttributeNS(String name, Object value)
throws IOException {
String cw = name;
writeControlWordNS(cw);
}
- /** can be overridden to suppress all RTF output */
+ /**
+ * can be overridden to suppress all RTF output
+ * @return true if this object can be written into the RTF
+ */
protected boolean okToWriteRtf() {
return true;
}
w.flush();
}
- /** minimal debugging display */
+ /**
+ * minimal debugging display
+ * @return String representation of object
+ */
public String toString() {
- return (this == null) ? "null" : (this.getClass().getName() + " #" + m_id);
+ return (this == null) ? "null" : (this.getClass().getName() + " #" + id);
}
/** true if close() has been called */
boolean isClosed() {
- return m_closed;
+ return closed;
}
/** access our RtfFile, which is always the topmost parent */
RtfFile getRtfFile() {
// go up the chain of parents until we find the topmost one
RtfElement result = this;
- while (result.m_parent != null) {
- result = result.m_parent;
+ while (result.parent != null) {
+ result = result.parent;
}
// topmost parent must be an RtfFile
RtfElement getParentOfClass(Class c) {
RtfElement result = null;
RtfElement current = this;
- while (current.m_parent != null) {
- current = current.m_parent;
+ while (current.parent != null) {
+ current = current.parent;
if (c.isAssignableFrom(current.getClass())) {
result = current;
break;
return result;
}
- /** true if this element would generate no "useful" RTF content */
+ /**
+ * @return true if this element would generate no "useful" RTF content
+ */
public abstract boolean isEmpty();
-
+ /**
+ * Make a visible entry in the RTF for an exception
+ * @param ie Exception to flag
+ * @throws IOException for I/O problems
+ */
protected void writeExceptionInRtf(Exception ie)
throws IOException {
writeGroupMark(true);
writeControlWord("fs48");
// RtfStringConverter.getInstance().writeRtfString(m_writer,
// JForVersionInfo.getShortVersionInfo() + ": ");
- RtfStringConverter.getInstance().writeRtfString(m_writer, ie.getClass().getName());
+ RtfStringConverter.getInstance().writeRtfString(writer, ie.getClass().getName());
writeControlWord("fs20");
- RtfStringConverter.getInstance().writeRtfString(m_writer, " " + ie.toString());
+ RtfStringConverter.getInstance().writeRtfString(writer, " " + ie.toString());
writeControlWord("par");
writeGroupMark(false);
}
- // Added by Normand Masse
- // Used for attribute inheritance
+ /**
+ * Added by Normand Masse
+ * Used for attribute inheritance
+ * @return RtfAttributes
+ */
public RtfAttributes getRtfAttributes() {
- return m_attrib;
+ return attrib;
}
}
\ No newline at end of file
*/
protected void writeRtfContentWithException() throws IOException {
- if (m_writer == null) {
+ if (writer == null) {
return;
}
String linkToRoot = System.getProperty("jfor_link_to_root");
if (linkToRoot != null) {
- m_writer.write("{\\field {\\* \\fldinst { INCLUDEPICTURE \"");
- m_writer.write(linkToRoot);
+ writer.write("{\\field {\\* \\fldinst { INCLUDEPICTURE \"");
+ writer.write(linkToRoot);
File urlFile = new File(url.getFile());
- m_writer.write(urlFile.getName());
- m_writer.write("\" \\\\* MERGEFORMAT \\\\d }}}");
+ writer.write(urlFile.getName());
+ writer.write("\" \\\\* MERGEFORMAT \\\\d }}}");
return;
}
char[] chars = new char[len];
buf.getChars(0, len, chars, 0);
- m_writer.write(chars);
+ writer.write(chars);
// Writes the end of RTF image
RtfTableCell createExtraCell(int rowIndex, int xOffset, int cellWidth,
RtfAttributes parentCellAttributes)
throws IOException {
- final RtfTableCell c = new RtfTableCell(null, m_writer, cellWidth,
+ final RtfTableCell c = new RtfTableCell(null, writer, cellWidth,
parentCellAttributes, DEFAULT_IDNUM);
m_cells.add(new PositionedCell(c, rowIndex, xOffset));
return c;
return;
}
- final RtfTableRow row = new RtfTableRow(null, m_writer, DEFAULT_IDNUM);
+ final RtfTableRow row = new RtfTableRow(null, writer, DEFAULT_IDNUM);
int cellIndex = 0;
// Get the context of the table that holds the nested table
xOffset += parentITableColumnsInfo.getColumnWidth();
// Create the empty cell merged vertically
row.newTableCellMergedVertically((int)parentITableColumnsInfo.getColumnWidth(),
- pc.cell.m_attrib);
+ pc.cell.attrib);
// Select next column in order to have its width
parentITableColumnsInfo.selectNextColumn();
}
// => in fact the m_attrib below (last argument) is
// empty => should be the attributes of the above cells.
row.newTableCellMergedVertically((int)parentITableColumnsInfo.getColumnWidth(),
- m_attrib);
+ attrib);
// Select next column in order to have its width
parentITableColumnsInfo.selectNextColumn();
}
if (m_header != null) {
throw new RtfStructureException("startHeader called more than once");
}
- m_header = new RtfHeader(this, m_writer);
- m_listTableContainer = new RtfContainer(this, m_writer);
+ m_header = new RtfHeader(this, writer);
+ m_listTableContainer = new RtfContainer(this, writer);
return m_header;
}
public RtfListTable startListTable(RtfAttributes attr)
throws IOException {
listNum++;
- m_listTable = new RtfListTable(this, m_writer, new Integer(listNum), attr);
+ m_listTable = new RtfListTable(this, writer, new Integer(listNum), attr);
m_listTableContainer.addChild(m_listTable);
return m_listTable;
}
startHeader();
}
m_header.close();
- m_pageArea = new RtfPageArea(this, m_writer);
+ m_pageArea = new RtfPageArea(this, writer);
addChild(m_pageArea);
return m_pageArea;
}
startHeader();
}
m_header.close();
- m_docArea = new RtfDocumentArea(this, m_writer);
+ m_docArea = new RtfDocumentArea(this, writer);
addChild(m_docArea);
return m_docArea;
}
/** must be called when done creating the document */
public synchronized void flush() throws IOException {
writeRtf();
- m_writer.flush();
+ writer.flush();
}
/** minimal test and usage example */
/** write our contents to m_writer. */
protected void writeRtfContent() throws IOException {
- RtfFontManager.getInstance ().writeFonts ((RtfHeader)m_parent);
+ RtfFontManager.getInstance ().writeFonts ((RtfHeader)parent);
}
/** true if this element would generate no "useful" RTF content */
final Map.Entry entry = (Map.Entry)it.next();
writeGroupMark(true);
writeControlWord("propname");
- RtfStringConverter.getInstance().writeRtfString(m_writer,
+ RtfStringConverter.getInstance().writeRtfString(writer,
entry.getKey().toString());
writeGroupMark(false);
writeControlWord("proptype30");
writeGroupMark(true);
writeControlWord("staticval");
- RtfStringConverter.getInstance().writeRtfString(m_writer,
+ RtfStringConverter.getInstance().writeRtfString(writer,
entry.getValue().toString());
writeGroupMark(false);
}
* 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);
+ writer.write(toWrite);
}
/** write to our Writer using an RtfStringConverter */
void writeRtfString(String toWrite) throws IOException {
- RtfStringConverter.getInstance().writeRtfString(m_writer, toWrite);
+ RtfStringConverter.getInstance().writeRtfString(writer, toWrite);
}
}
super.writeGroupMark (true);
super.writeStarControlWord ("fldinst");
- m_writer.write ("HYPERLINK \"" + url + "\" ");
+ writer.write ("HYPERLINK \"" + url + "\" ");
super.writeGroupMark (false);
super.writeGroupMark (true);
super.writeControlWord ("fldrslt");
// start a group for this paragraph and write our own attributes if needed
- if (m_attrib != null && m_attrib.isSet ("cs")) {
+ if (attrib != null && attrib.isSet ("cs")) {
writeGroupMark (true);
- writeAttributes(m_attrib, new String [] {"cs"});
+ writeAttributes(attrib, new String [] {"cs"});
}
}
* @exception IOException On error
*/
public void writeRtfSuffix () throws IOException {
- if (m_attrib != null && m_attrib.isSet ("cs")) {
+ if (attrib != null && attrib.isSet ("cs")) {
writeGroupMark (false);
}
super.writeGroupMark (false);
*/
public RtfText newText (String str, RtfAttributes attr) throws IOException {
closeAll ();
- mText = new RtfText (this, m_writer, str, attr);
+ mText = new RtfText (this, writer, str, attr);
return mText;
}
/** IRtfTextContainer requirement: return a copy of our attributes */
public RtfAttributes getTextContainerAttributes() {
- if (m_attrib == null) {
+ if (attrib == null) {
return null;
}
- return (RtfAttributes) this.m_attrib.clone ();
+ return (RtfAttributes) this.attrib.clone ();
}
/** add a line break */
public void newLineBreak () throws IOException {
- new RtfLineBreak (this, m_writer);
+ new RtfLineBreak (this, writer);
}
writeControlWord("pard");
}
- writeOneAttribute(RtfText.LEFT_INDENT_FIRST, m_attrib.getValue(RtfListTable.LIST_INDENT));
- writeOneAttribute(RtfText.LEFT_INDENT_BODY, m_attrib.getValue(RtfText.LEFT_INDENT_BODY));
+ writeOneAttribute(RtfText.LEFT_INDENT_FIRST, attrib.getValue(RtfListTable.LIST_INDENT));
+ writeOneAttribute(RtfText.LEFT_INDENT_BODY, attrib.getValue(RtfText.LEFT_INDENT_BODY));
// put the whole list in a group
writeGroupMark(true);
writeOneAttribute(RtfListTable.LIST_NUMBER,
(m_listTable.getListNumber()).toString());
writeOneAttribute("pnindent",
- m_attrib.getValue(RtfListTable.LIST_INDENT));
+ attrib.getValue(RtfListTable.LIST_INDENT));
writeControlWord("pnf1");
writeGroupMark(true);
writeControlWord("pndec");
(m_numberingStyle.isBulletedList) ? "2" : "0");
writeControlWord("pndec");
writeOneAttribute("pnstart",
- m_attrib.getValue(RtfListTable.LIST_START_AT));
+ attrib.getValue(RtfListTable.LIST_START_AT));
writeOneAttribute("pnindent",
- m_attrib.getValue(RtfListTable.LIST_INDENT));
+ attrib.getValue(RtfListTable.LIST_INDENT));
writeControlWord("pntxta.");
}
if (m_item != null) {
m_item.close();
}
- m_item = new RtfListItem(this, m_writer);
+ m_item = new RtfListItem(this, writer);
return m_item;
}
RtfListItemParagraph(RtfListItem rli, RtfAttributes attrs)
throws IOException {
- super(rli, rli.m_writer, attrs);
+ super(rli, rli.writer, attrs);
}
protected void writeRtfPrefix() throws IOException {
Date runTime = new Date();
Random listIdGenerator = new Random(runTime.getTime());
listId = new Integer(listIdGenerator.nextInt());
- m_attrib.set(LIST_ID, listId.toString());
+ attrib.set(LIST_ID, listId.toString());
listTemplateId = new Integer(listIdGenerator.nextInt());
- m_attrib.set(LIST_NUMBER_TYPE, 0);
+ attrib.set(LIST_NUMBER_TYPE, 0);
}
public void setParentList(RtfList parent) {
// bullet definition for bulleted lists
// Chris Scott's version was "\\\'01\\u-3913 ?;"
// 'b7 is what was used in jfor V0.5.2
- m_attrib.set(LIST_TEXT_FORM, "\\\'01\\'b7 ?;");
- m_attrib.set(LIST_NUM_POSITION);
- m_attrib.set(LIST_NUMBER_TYPE, 23);
- m_attrib.set(LIST_FONT_TYPE, 2);
+ attrib.set(LIST_TEXT_FORM, "\\\'01\\'b7 ?;");
+ attrib.set(LIST_NUM_POSITION);
+ attrib.set(LIST_NUMBER_TYPE, 23);
+ attrib.set(LIST_FONT_TYPE, 2);
} else {
- m_attrib.set(LIST_TEXT_FORM, "\\\'03\\\'00. ;");
- m_attrib.set(LIST_NUM_POSITION, "\\\'01;");
- m_attrib.set(LIST_NUMBER_TYPE, 0);
- m_attrib.set(LIST_FONT_TYPE, 0);
+ attrib.set(LIST_TEXT_FORM, "\\\'03\\\'00. ;");
+ attrib.set(LIST_NUM_POSITION, "\\\'01;");
+ attrib.set(LIST_NUMBER_TYPE, 0);
+ attrib.set(LIST_FONT_TYPE, 0);
}
}
writeControlWordNS(LIST);
writeOneAttributeNS(LIST_TEMPLATE_ID, listTemplateId.toString());
- writeOneAttributeNS(LIST, m_attrib.getValue(LIST));
+ writeOneAttributeNS(LIST, attrib.getValue(LIST));
writeGroupMark(true);
writeControlWordNS(LIST_LEVEL);
- writeOneAttributeNS(LIST_NUMBER_TYPE, m_attrib.getValue(LIST_NUMBER_TYPE));
- writeOneAttributeNS(LIST_JUSTIFICATION, m_attrib.getValue(LIST_JUSTIFICATION));
- writeOneAttributeNS(LIST_FOLLOWING_CHAR, m_attrib.getValue(LIST_FOLLOWING_CHAR));
- writeOneAttributeNS(LIST_START_AT, m_attrib.getValue(LIST_START_AT));
+ writeOneAttributeNS(LIST_NUMBER_TYPE, attrib.getValue(LIST_NUMBER_TYPE));
+ writeOneAttributeNS(LIST_JUSTIFICATION, attrib.getValue(LIST_JUSTIFICATION));
+ writeOneAttributeNS(LIST_FOLLOWING_CHAR, attrib.getValue(LIST_FOLLOWING_CHAR));
+ writeOneAttributeNS(LIST_START_AT, attrib.getValue(LIST_START_AT));
writeOneAttributeNS(LIST_SPACE, new Integer(0));
- writeOneAttributeNS(LIST_INDENT, m_attrib.getValue(LIST_INDENT));
+ writeOneAttributeNS(LIST_INDENT, attrib.getValue(LIST_INDENT));
writeGroupMark(true);
- writeOneAttributeNS(LIST_TEXT_FORM, m_attrib.getValue(LIST_TEXT_FORM));
+ writeOneAttributeNS(LIST_TEXT_FORM, attrib.getValue(LIST_TEXT_FORM));
writeGroupMark(false);
writeGroupMark(true);
- writeOneAttributeNS(LIST_NUM_POSITION, m_attrib.getValue(LIST_NUM_POSITION));
+ writeOneAttributeNS(LIST_NUM_POSITION, attrib.getValue(LIST_NUM_POSITION));
writeGroupMark(false);
- writeOneAttributeNS(LIST_FONT_TYPE, m_attrib.getValue(LIST_FONT_TYPE));
+ writeOneAttributeNS(LIST_FONT_TYPE, attrib.getValue(LIST_FONT_TYPE));
writeGroupMark(false);
writeGroupMark(true);
writeControlWordNS(LIST_NAME);
if (m_currentPage != null) {
m_currentPage.close();
}
- m_currentPage = new RtfPage(this, m_writer, attr);
+ m_currentPage = new RtfPage(this, writer, attr);
return m_currentPage;
}
*/
RtfPageNumber(RtfParagraph parent, Writer w) throws IOException {
// Adds the attributes of the parent paragraph
- super((RtfContainer)parent, w, parent.m_attrib);
+ super((RtfContainer)parent, w, parent.attrib);
// copy parent's text attributes
if (parent.getTextAttributes() != null) {
- m_attrib.set(parent.getTextAttributes());
+ attrib.set(parent.getTextAttributes());
}
}
writeGroupMark(true);
writeControlWord(RTF_FIELD);
writeGroupMark(true);
- writeAttributes(m_attrib, RtfText.ATTR_NAMES); // Added by Boris Poudérous
+ writeAttributes(attrib, RtfText.ATTR_NAMES); // Added by Boris Poudérous
writeStarControlWord(RTF_FIELD_PAGE);
writeGroupMark(false);
writeGroupMark(true);
RtfPageNumberCitation (RtfParagraph parent, Writer w, String id)
throws IOException {
// add the attributes ant text attributes of the parent paragraph
- super((RtfContainer)parent, w, parent.m_attrib);
+ super((RtfContainer)parent, w, parent.attrib);
if (parent.getTextAttributes() != null) {
- m_attrib.set(parent.getTextAttributes());
+ attrib.set(parent.getTextAttributes());
}
this.id = id;
}
writeGroupMark(true);
writeControlWord(RTF_FIELD);
writeGroupMark(true);
- writeAttributes(m_attrib, RtfText.ATTR_NAMES); // Added by Boris Poudérous
+ writeAttributes(attrib, RtfText.ATTR_NAMES); // Added by Boris Poudérous
writeStarControlWord(pageRef);
writeGroupMark(false);
writeGroupMark(true);
/** IRtfTextContainer requirement: return a copy of our attributes */
public RtfAttributes getTextContainerAttributes() {
- if (m_attrib == null) {
+ if (attrib == null) {
return null;
}
- return (RtfAttributes)this.m_attrib.clone();
+ return (RtfAttributes)this.attrib.clone();
}
/** overridden to write our attributes before our content */
protected void writeRtfPrefix() throws IOException {
// collapse whitespace before writing out
// TODO could be made configurable
- if (m_attrib != null && m_attrib.isSet("WhiteSpaceFalse")) {
- m_attrib.unset("WhiteSpaceFalse");
+ if (attrib != null && attrib.isSet("WhiteSpaceFalse")) {
+ attrib.unset("WhiteSpaceFalse");
} else {
new WhitespaceCollapser(this);
}
// do not write text attributes here, they are handled
// by RtfText
- writeAttributes(m_attrib, PARA_ATTRIBUTES);
+ writeAttributes(attrib, PARA_ATTRIBUTES);
// Added by Normand Masse
// Write alignment attributes after \intbl for cells
- if (m_attrib.isSet("intbl") && mustWriteAttributes()) {
- writeAttributes(m_attrib, RtfText.ALIGNMENT);
+ if (attrib.isSet("intbl") && mustWriteAttributes()) {
+ writeAttributes(attrib, RtfText.ALIGNMENT);
}
//Set keepn if needed (Keep paragraph with the next paragraph)
// writeAttributes(m_attrib, new String [] {"cs"});
// Added by Normand Masse
// If \intbl then attributes have already been written (see higher in method)
- if (!m_attrib.isSet("intbl")) {
- writeAttributes(m_attrib, RtfText.ALIGNMENT);
+ if (!attrib.isSet("intbl")) {
+ writeAttributes(attrib, RtfText.ALIGNMENT);
}
//this line added by Chris Scott, Westinghouse
- writeAttributes(m_attrib, RtfText.BORDER);
- writeAttributes(m_attrib, RtfText.INDENT);
- writeAttributes(m_attrib, RtfText.TABS);
+ writeAttributes(attrib, RtfText.BORDER);
+ writeAttributes(attrib, RtfText.INDENT);
+ writeAttributes(attrib, RtfText.TABS);
if (writeForBreak) {
writeControlWord("pard\\par");
}
protected void writeRtfSuffix() throws IOException {
// sometimes the end of paragraph mark must be suppressed in table cells
boolean writeMark = true;
- if (m_parent instanceof RtfTableCell) {
- writeMark = ((RtfTableCell)m_parent).paragraphNeedsPar(this);
+ if (parent instanceof RtfTableCell) {
+ writeMark = ((RtfTableCell)parent).paragraphNeedsPar(this);
}
if (writeMark) {
writeControlWord("par");
*/
public RtfText newText(String str, RtfAttributes attr) throws IOException {
closeAll();
- m_text = new RtfText(this, m_writer, str, attr);
+ m_text = new RtfText(this, writer, str, attr);
return m_text;
}
/** add a page break */
public void newPageBreak() throws IOException {
writeForBreak = true;
- new RtfPageBreak(this, m_writer);
+ new RtfPageBreak(this, writer);
}
/** add a line break */
public void newLineBreak() throws IOException {
- new RtfLineBreak(this, m_writer);
+ new RtfLineBreak(this, writer);
}
public RtfPageNumber newPageNumber()throws IOException {
- m_pageNumber = new RtfPageNumber(this, m_writer);
+ m_pageNumber = new RtfPageNumber(this, writer);
return m_pageNumber;
}
* Added by Boris POUDEROUS on 2002/07/09
*/
public RtfPageNumberCitation newPageNumberCitation(String id) throws IOException {
- m_pageNumberCitation = new RtfPageNumberCitation(this, m_writer, id);
+ m_pageNumberCitation = new RtfPageNumberCitation(this, writer, id);
return m_pageNumberCitation;
}
/** Creates a new hyperlink. */
public RtfHyperLink newHyperLink(String str, RtfAttributes attr) throws IOException {
- m_hyperlink = new RtfHyperLink(this, m_writer, str, attr);
+ m_hyperlink = new RtfHyperLink(this, writer, str, attr);
return m_hyperlink;
}
/** start a new external graphic after closing all other elements */
public RtfExternalGraphic newImage() throws IOException {
closeAll();
- m_externalGraphic = new RtfExternalGraphic(this, m_writer);
+ m_externalGraphic = new RtfExternalGraphic(this, writer);
return m_externalGraphic;
}
protected boolean okToWriteRtf() {
boolean result = super.okToWriteRtf();
- if (m_parent.getOptions().ignoreEmptyParagraphs() && getChildCount() == 0) {
+ if (parent.getOptions().ignoreEmptyParagraphs() && getChildCount() == 0) {
// TODO should test that this is the last RtfParagraph in the cell instead
// of simply testing for last child??
result = false;
/** start a new external graphic after closing current paragraph, list and table */
public RtfExternalGraphic newImage() throws IOException {
closeAll();
- m_externalGraphic = new RtfExternalGraphic(this, m_writer);
+ m_externalGraphic = new RtfExternalGraphic(this, writer);
return m_externalGraphic;
}
/** start a new paragraph after closing current paragraph, list and table */
public RtfParagraph newParagraph(RtfAttributes attrs) throws IOException {
closeAll();
- m_paragraph = new RtfParagraph(this, m_writer, attrs);
+ m_paragraph = new RtfParagraph(this, writer, attrs);
return m_paragraph;
}
/** close current paragraph if any and start a new one */
public RtfParagraphKeepTogether newParagraphKeepTogether() throws IOException {
- return new RtfParagraphKeepTogether(this, m_writer);
+ return new RtfParagraphKeepTogether(this, writer);
}
/** start a new table after closing current paragraph, list and table
*/
public RtfTable newTable(ITableColumnsInfo tc) throws IOException {
closeAll();
- m_table = new RtfTable(this, m_writer, tc);
+ m_table = new RtfTable(this, writer, tc);
return m_table;
}
*/
public RtfTable newTable(RtfAttributes attrs, ITableColumnsInfo tc) throws IOException {
closeAll();
- m_table = new RtfTable(this, m_writer, attrs, tc);
+ m_table = new RtfTable(this, writer, attrs, tc);
return m_table;
}
/** start a new list after closing current paragraph, list and table */
public RtfList newList(RtfAttributes attrs) throws IOException {
closeAll();
- m_list = new RtfList(this, m_writer, attrs);
+ m_list = new RtfList(this, writer, attrs);
return m_list;
}
/** IRtfBeforeContainer */
public RtfBefore newBefore(RtfAttributes attrs) throws IOException {
closeAll();
- m_before = new RtfBefore(this, m_writer, attrs);
+ m_before = new RtfBefore(this, writer, attrs);
return m_before;
}
/** IRtfAfterContainer */
public RtfAfter newAfter(RtfAttributes attrs) throws IOException {
closeAll();
- m_after = new RtfAfter(this, m_writer, attrs);
+ m_after = new RtfAfter(this, writer, attrs);
return m_after;
}
public RtfJforCmd newJforCmd(RtfAttributes attrs) throws IOException {
- m_jforCmd = new RtfJforCmd(this, m_writer, attrs);
+ m_jforCmd = new RtfJforCmd(this, writer, attrs);
return m_jforCmd;
}
}
highestRow++;
- m_row = new RtfTableRow(this, m_writer, m_attrib, highestRow);
+ m_row = new RtfTableRow(this, writer, attrib, highestRow);
return m_row;
}
/** close current row if any and start a new one */
public RtfTableRow newTableRow(RtfAttributes attrs) throws IOException {
RtfAttributes attr = null;
- if (m_attrib != null) {
- attr = (RtfAttributes) m_attrib.clone ();
+ if (attrib != null) {
+ attr = (RtfAttributes) attrib.clone ();
attr.set (attrs);
} else {
attr = attrs;
}
highestRow++;
- m_row = new RtfTableRow(this, m_writer, attr, highestRow);
+ m_row = new RtfTableRow(this, writer, attr, highestRow);
return m_row;
}
// Get the number of columns spanned
int nbMergedCells = ((Integer)attrs.getValue("number-columns-spanned")).intValue();
- if (parent.m_parent instanceof RtfTable) {
+ if (parent.parent instanceof RtfTable) {
// Get the context of the current table in order to get the width of each column
ITableColumnsInfo ITableColumnsInfo =
- ((RtfTable)parent.m_parent).getITableColumnsInfo();
+ ((RtfTable)parent.parent).getITableColumnsInfo();
ITableColumnsInfo.selectFirstColumn();
// Reach the column index in table context corresponding to the current column cell
}
attrs.set("intbl");
- m_paragraph = new RtfParagraph(this, m_writer, attrs);
+ m_paragraph = new RtfParagraph(this, writer, attrs);
- if (m_paragraph.m_attrib.isSet("qc")) {
+ if (m_paragraph.attrib.isSet("qc")) {
set_center = true;
attrs.set("qc");
- } else if (m_paragraph.m_attrib.isSet("qr")) {
+ } else if (m_paragraph.attrib.isSet("qr")) {
set_right = true;
attrs.set("qr");
} else {
/** start a new external graphic after closing current paragraph, list and table */
public RtfExternalGraphic newImage() throws IOException {
closeAll();
- m_externalGraphic = new RtfExternalGraphic(this, m_writer);
+ m_externalGraphic = new RtfExternalGraphic(this, writer);
return m_externalGraphic;
}
/** start a new list after closing current paragraph, list and table */
public RtfList newList(RtfAttributes attrib) throws IOException {
closeAll();
- m_list = new RtfList(this, m_writer, attrib);
+ m_list = new RtfList(this, writer, attrib);
return m_list;
}
/** start a new nested table after closing current paragraph, list and table */
public RtfTable newTable(ITableColumnsInfo tc) throws IOException {
closeAll();
- m_table = new RtfTable(this, m_writer, tc);
+ m_table = new RtfTable(this, writer, tc);
return m_table;
}
public RtfTable newTable(RtfAttributes attrs, ITableColumnsInfo tc) throws IOException
{
closeAll();
- m_table = new RtfTable(this,m_writer, attrs, tc); // Added tc Boris Poudérous 07/22/2002
+ m_table = new RtfTable(this,writer, attrs, tc); // Added tc Boris Poudérous 07/22/2002
return m_table;
}
* Added by Boris POUDEROUS on 2002/06/26
*/
// Cell background color processing :
- writeAttributes (m_attrib, ITableAttributes.CELL_COLOR);
+ writeAttributes (attrib, ITableAttributes.CELL_COLOR);
/** - end - */
- writeAttributes (m_attrib, ITableAttributes.ATTRIB_CELL_PADDING);
- writeAttributes (m_attrib, ITableAttributes.CELL_BORDER);
- writeAttributes (m_attrib, BorderAttributesConverter.BORDERS);
+ writeAttributes (attrib, ITableAttributes.ATTRIB_CELL_PADDING);
+ writeAttributes (attrib, ITableAttributes.CELL_BORDER);
+ writeAttributes (attrib, BorderAttributesConverter.BORDERS);
// cell width
final int xPos = widthOffset + this.m_cellWidth;
// attributes to the new cells (in order not to have cell without
// border for example)
extraCell = m_parentRow.getExtraRowSet().createExtraCell(extraRowIndex,
- m_widthOffset, this.getCellWidth(), m_attrib);
+ m_widthOffset, this.getCellWidth(), attrib);
extraRowIndex++;
} else if (extraCell != null) {
/** close current cell if any and start a new one */
public RtfTableCell newTableCell(int cellWidth) throws IOException {
highestCell++;
- m_cell = new RtfTableCell(this, m_writer, cellWidth, highestCell);
+ m_cell = new RtfTableCell(this, writer, cellWidth, highestCell);
return m_cell;
}
/** close current cell if any and start a new one */
public RtfTableCell newTableCell(int cellWidth, RtfAttributes attrs) throws IOException {
highestCell++;
- m_cell = new RtfTableCell(this, m_writer, cellWidth, attrs, highestCell);
+ m_cell = new RtfTableCell(this, writer, cellWidth, attrs, highestCell);
return m_cell;
}
public RtfTableCell newTableCellMergedVertically(int cellWidth,
RtfAttributes attrs) throws IOException {
highestCell++;
- m_cell = new RtfTableCell (this, m_writer, cellWidth, attrs, highestCell);
+ m_cell = new RtfTableCell (this, writer, cellWidth, attrs, highestCell);
m_cell.setVMerge(RtfTableCell.MERGE_WITH_PREVIOUS);
return m_cell;
}
RtfAttributes wAttributes = (RtfAttributes)attrs.clone();
wAttributes.unset("number-columns-spanned");
- m_cell = new RtfTableCell(this, m_writer, cellWidth, wAttributes, highestCell);
+ m_cell = new RtfTableCell(this, writer, cellWidth, wAttributes, highestCell);
m_cell.setHMerge(RtfTableCell.MERGE_WITH_PREVIOUS);
return m_cell;
}
// create new extra row set to allow our cells to put nested tables
// in rows that will be rendered after this one
- m_extraRowSet = new RtfExtraRowSet(m_writer);
+ m_extraRowSet = new RtfExtraRowSet(writer);
// render the row and cells definitions
writeControlWord("trowd");
//check for keep-together
- if (m_attrib != null && m_attrib.isSet(ITableAttributes.ROW_KEEP_TOGETHER)) {
+ if (attrib != null && attrib.isSet(ITableAttributes.ROW_KEEP_TOGETHER)) {
writeControlWord(ROW_KEEP_TOGETHER);
}
writePaddingAttributes();
// if we have attributes, manipulate border properties
- final RtfTable parentTable = (RtfTable) m_parent;
- if (m_attrib != null && parentTable != null) {
+ final RtfTable parentTable = (RtfTable) parent;
+ if (attrib != null && parentTable != null) {
//if table is only one row long
if (isFirstRow() && parentTable.isHighestRow(id)) {
- m_attrib.unset(ITableAttributes.ROW_BORDER_HORIZONTAL);
+ attrib.unset(ITableAttributes.ROW_BORDER_HORIZONTAL);
//or if row is the first row
} else if (isFirstRow()) {
- m_attrib.unset(ITableAttributes.ROW_BORDER_BOTTOM);
+ attrib.unset(ITableAttributes.ROW_BORDER_BOTTOM);
//or if row is the last row
} else if (parentTable.isHighestRow(id)) {
- m_attrib.unset(ITableAttributes.ROW_BORDER_TOP);
+ attrib.unset(ITableAttributes.ROW_BORDER_TOP);
//else the row is an inside row
} else {
- m_attrib.unset(ITableAttributes.ROW_BORDER_BOTTOM);
- m_attrib.unset(ITableAttributes.ROW_BORDER_TOP);
+ attrib.unset(ITableAttributes.ROW_BORDER_BOTTOM);
+ attrib.unset(ITableAttributes.ROW_BORDER_TOP);
}
}
- writeAttributes(m_attrib, ITableAttributes.ROW_BORDER);
- writeAttributes(m_attrib, ITableAttributes.CELL_BORDER);
- writeAttributes(m_attrib, BorderAttributesConverter.BORDERS);
+ writeAttributes(attrib, ITableAttributes.ROW_BORDER);
+ writeAttributes(attrib, ITableAttributes.CELL_BORDER);
+ writeAttributes(attrib, BorderAttributesConverter.BORDERS);
/**
* Added by Boris POUDEROUS on 07/02/2002
if (index == 0) {
if (!cell.getRtfAttributes().isSet(ITableAttributes.CELL_BORDER_LEFT)) {
cell.getRtfAttributes().set(ITableAttributes.CELL_BORDER_LEFT,
- (String)m_attrib.getValue(ITableAttributes.ROW_BORDER_LEFT));
+ (String)attrib.getValue(ITableAttributes.ROW_BORDER_LEFT));
}
}
if (index == this.getChildCount() - 1) {
if (!cell.getRtfAttributes().isSet(ITableAttributes.CELL_BORDER_RIGHT)) {
cell.getRtfAttributes().set(ITableAttributes.CELL_BORDER_RIGHT,
- (String)m_attrib.getValue(ITableAttributes.ROW_BORDER_RIGHT));
+ (String)attrib.getValue(ITableAttributes.ROW_BORDER_RIGHT));
}
}
if (isFirstRow()) {
if (!cell.getRtfAttributes().isSet(ITableAttributes.CELL_BORDER_TOP)) {
cell.getRtfAttributes().set(ITableAttributes.CELL_BORDER_TOP,
- (String)m_attrib.getValue(ITableAttributes.ROW_BORDER_TOP));
+ (String)attrib.getValue(ITableAttributes.ROW_BORDER_TOP));
}
}
if (parentTable.isHighestRow(id)) {
if (!cell.getRtfAttributes().isSet(ITableAttributes.CELL_BORDER_BOTTOM)) {
cell.getRtfAttributes().set(ITableAttributes.CELL_BORDER_BOTTOM,
- (String)m_attrib.getValue(ITableAttributes.ROW_BORDER_BOTTOM));
+ (String)attrib.getValue(ITableAttributes.ROW_BORDER_BOTTOM));
}
}
// use RTF 1.6 definitions - try to compute a reasonable RTF 1.5 value
// out of them if present
// how to do vertical padding with RTF 1.5?
- if (m_attrib != null && !m_attrib.isSet(ATTR_RTF_15_TRGAPH)) {
+ if (attrib != null && !attrib.isSet(ATTR_RTF_15_TRGAPH)) {
int gaph = -1;
try {
// set (RTF 1.5) gaph to the average of the (RTF 1.6) left and right padding values
- final Integer leftPadStr = (Integer)m_attrib.getValue(ATTR_ROW_PADDING_LEFT);
+ final Integer leftPadStr = (Integer)attrib.getValue(ATTR_ROW_PADDING_LEFT);
if (leftPadStr != null) {
gaph = leftPadStr.intValue();
}
- final Integer rightPadStr = (Integer)m_attrib.getValue(ATTR_ROW_PADDING_RIGHT);
+ final Integer rightPadStr = (Integer)attrib.getValue(ATTR_ROW_PADDING_RIGHT);
if (rightPadStr != null) {
gaph = (gaph + rightPadStr.intValue()) / 2;
}
// getRtfFile().getLog().logWarning(msg);
}
if (gaph >= 0) {
- m_attrib.set(ATTR_RTF_15_TRGAPH, gaph);
+ attrib.set(ATTR_RTF_15_TRGAPH, gaph);
}
}
// write all padding attributes
- writeAttributes(m_attrib, ATTRIB_ROW_PADDING);
+ writeAttributes(attrib, ATTRIB_ROW_PADDING);
}
public boolean isFirstRow() {
if (m_attr != null && mustWriteAttributes()) {
writeAttributes(m_attr, RtfText.ATTR_NAMES);
}
- RtfStringConverter.getInstance().writeRtfString(m_writer, m_text);
+ RtfStringConverter.getInstance().writeRtfString(writer, m_text);
writeGroupMark(false);
}
/** IRtfTextContainer requirement:
* @return a copy of our attributes */
public RtfAttributes getTextContainerAttributes() {
- if (m_attrib == null) {
+ if (attrib == null) {
return null;
}
- return (RtfAttributes)this.m_attrib.clone();
+ return (RtfAttributes)this.attrib.clone();
}
/** direct access to our text */