vmote 2003/07/03 11:31:11 Modified: src/java/org/apache/fop/rtf/rtflib/rtfdoc RtfParagraph.java RtfParagraphKeepTogether.java RtfSection.java Log: style changes only, mostly javadoc comments and refactoring of names Revision Changes Path 1.7 +92 -42 xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfParagraph.java Index: RtfParagraph.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfParagraph.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- RtfParagraph.java 2 Jul 2003 16:59:54 -0000 1.6 +++ RtfParagraph.java 3 Jul 2003 18:31:11 -0000 1.7 @@ -72,14 +72,14 @@ implements IRtfTextContainer, IRtfPageBreakContainer, IRtfHyperLinkContainer, IRtfExternalGraphicContainer, IRtfPageNumberContainer, IRtfPageNumberCitationContainer { - private RtfText m_text; - private RtfHyperLink m_hyperlink; - private RtfExternalGraphic m_externalGraphic; - private RtfPageNumber m_pageNumber; - private RtfPageNumberCitation m_pageNumberCitation; + private RtfText text; + private RtfHyperLink hyperlink; + private RtfExternalGraphic externalGraphic; + private RtfPageNumber pageNumber; + private RtfPageNumberCitation pageNumberCitation; // Above line added by Boris POUDEROUS on 2002/07/09 - private boolean m_keepn = false; - private boolean m_resetProperties = false; + private boolean keepn = false; + private boolean resetProperties = false; /* needed for importing Rtf into FrameMaker FrameMaker is not as forgiving as word in rtf @@ -102,21 +102,28 @@ super((RtfContainer)parent, w, attr); } + /** + * Accessor for the paragraph text + * @return the paragraph text + */ public String getText() { - return (m_text.getText()); + return (text.getText()); } /** Set the keepn attribute for this paragraph */ public void setKeepn() { - this.m_keepn = true; + this.keepn = true; } /** Force reset properties */ public void setResetProperties() { - this.m_resetProperties = true; + this.resetProperties = true; } - /** IRtfTextContainer requirement: return a copy of our attributes */ + /** + * IRtfTextContainer requirement: return a copy of our attributes + * @return a copy of this paragraphs attributes + */ public RtfAttributes getTextContainerAttributes() { if (attrib == null) { return null; @@ -124,7 +131,10 @@ return (RtfAttributes)this.attrib.clone(); } - /** overridden to write our attributes before our content */ + /** + * Overridden to write our attributes before our content + * @throws IOException for I/O problems + */ protected void writeRtfPrefix() throws IOException { // collapse whitespace before writing out // TODO could be made configurable @@ -135,7 +145,7 @@ } //Reset paragraph properties if needed - if (m_resetProperties) { + if (resetProperties) { writeControlWord("pard"); } @@ -149,7 +159,7 @@ } //Set keepn if needed (Keep paragraph with the next paragraph) - if (m_keepn) { + if (keepn) { writeControlWord("keepn"); } @@ -177,7 +187,10 @@ } - /** overridden to close paragraph */ + /** + * Overridden to close paragraph + * @throws IOException for I/O problems + */ protected void writeRtfSuffix() throws IOException { // sometimes the end of paragraph mark must be suppressed in table cells boolean writeMark = true; @@ -195,68 +208,99 @@ } - /** close current text run if any and start a new one with default attributes - * @param str if not null, added to the RtfText created + /** + * Close current text run if any and start a new one with default attributes + * @param str if not null, added to the RtfText created + * @return the new RtfText object + * @throws IOException for I/O problems */ public RtfText newText(String str) throws IOException { return newText(str, null); } - /** close current text run if any and start a new one - * @param str if not null, added to the RtfText created + /** + * Close current text run if any and start a new one + * @param str if not null, added to the RtfText created + * @param attr attributes of the text + * @return the new RtfText object + * @throws IOException for I/O problems */ public RtfText newText(String str, RtfAttributes attr) throws IOException { closeAll(); - m_text = new RtfText(this, writer, str, attr); - return m_text; + text = new RtfText(this, writer, str, attr); + return text; } - /** add a page break */ + /** + * add a page break + * @throws IOException for I/O problems + */ public void newPageBreak() throws IOException { writeForBreak = true; new RtfPageBreak(this, writer); } - /** add a line break */ + /** + * add a line break + * @throws IOException for I/O problems + */ public void newLineBreak() throws IOException { new RtfLineBreak(this, writer); } + /** + * Add a page number + * @return new RtfPageNumber object + * @throws IOException for I/O problems + */ public RtfPageNumber newPageNumber()throws IOException { - m_pageNumber = new RtfPageNumber(this, writer); - return m_pageNumber; + pageNumber = new RtfPageNumber(this, writer); + return pageNumber; } /** * Added by Boris POUDEROUS on 2002/07/09 + * @param id string containing the citation text + * @return the new RtfPageNumberCitation object + * @throws IOException for I/O problems */ public RtfPageNumberCitation newPageNumberCitation(String id) throws IOException { - m_pageNumberCitation = new RtfPageNumberCitation(this, writer, id); - return m_pageNumberCitation; + pageNumberCitation = new RtfPageNumberCitation(this, writer, id); + return pageNumberCitation; } - /** Creates a new hyperlink. */ + /** + * Creates a new hyperlink. + * @param str string containing the hyperlink text + * @param attr attributes of new hyperlink + * @return the new RtfHyperLink object + * @throws IOException for I/O problems + */ public RtfHyperLink newHyperLink(String str, RtfAttributes attr) throws IOException { - m_hyperlink = new RtfHyperLink(this, writer, str, attr); - return m_hyperlink; + hyperlink = new RtfHyperLink(this, writer, str, attr); + return hyperlink; } - /** start a new external graphic after closing all other elements */ + /** + * Start a new external graphic after closing all other elements + * @return the new RtfExternalGraphic + * @throws IOException for I/O problems + */ public RtfExternalGraphic newImage() throws IOException { closeAll(); - m_externalGraphic = new RtfExternalGraphic(this, writer); - return m_externalGraphic; + externalGraphic = new RtfExternalGraphic(this, writer); + return externalGraphic; } private void closeCurrentText() throws IOException { - if (m_text != null) { - m_text.close(); + if (text != null) { + text.close(); } } private void closeCurrentHyperLink() throws IOException { - if (m_hyperlink != null) { - m_hyperlink.close(); + if (hyperlink != null) { + hyperlink.close(); } } @@ -265,7 +309,10 @@ closeCurrentHyperLink(); } - /** depending on RtfOptions, do not emit any RTF for empty paragraphs */ + /** + * Depending on RtfOptions, do not emit any RTF for empty paragraphs + * @return true if RTF should be written + */ protected boolean okToWriteRtf() { boolean result = super.okToWriteRtf(); @@ -313,11 +360,14 @@ return getChildCount() > 0; } - /** get the attributes of our text */ + /** + * accessor for text attributes + * @return attributes of the text + */ public RtfAttributes getTextAttributes() { - if (m_text == null) { + if (text == null) { return null; } - return m_text.getTextAttributes(); + return text.getTextAttributes(); } } 1.5 +25 -10 xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfParagraphKeepTogether.java Index: RtfParagraphKeepTogether.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfParagraphKeepTogether.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- RtfParagraphKeepTogether.java 30 Jun 2003 06:10:05 -0000 1.4 +++ RtfParagraphKeepTogether.java 3 Jul 2003 18:31:11 -0000 1.5 @@ -62,12 +62,19 @@ import java.io.Writer; import java.io.IOException; +/** + * Models the keep together attributes of paragraphs + */ public class RtfParagraphKeepTogether extends RtfContainer { + /** constant for unset status */ public static final int STATUS_NULL = 0; + /** constant for open paragraph */ public static final int STATUS_OPEN_PARAGRAPH = 1; + /** constant for close paragraph */ public static final int STATUS_CLOSE_PARAGRAPH = 2; - private int m_status = STATUS_NULL; + + private int status = STATUS_NULL; /** RtfParagraphKeepTogether*/ @@ -75,34 +82,42 @@ super((RtfContainer)parent, w); } - + /** + * Write the content + * @throws IOException for I/O problems + */ protected void writeRtfContent() throws IOException { //First reet paragraph properties // create a new one with keepn - if (m_status == STATUS_OPEN_PARAGRAPH) { + if (status == STATUS_OPEN_PARAGRAPH) { writeControlWord("pard"); writeControlWord("par"); writeControlWord("keepn"); writeGroupMark(true); - m_status = STATUS_NULL; + status = STATUS_NULL; } - if (m_status == STATUS_CLOSE_PARAGRAPH) { + if (status == STATUS_CLOSE_PARAGRAPH) { writeGroupMark(false); - m_status = STATUS_NULL; + status = STATUS_NULL; } } - + /** + * set the status + * @param status the status to be set + */ public void setStatus(int status) { - m_status = status; + this.status = status; } - /** true if this element would generate no "useful" RTF content */ + /** + * @return true if this element would generate no "useful" RTF content + */ public boolean isEmpty() { return false; } 1.8 +102 -52 xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfSection.java Index: RtfSection.java =================================================================== RCS file: /home/cvs/xml-fop/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfSection.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- RtfSection.java 2 Jul 2003 16:59:54 -0000 1.7 +++ RtfSection.java 3 Jul 2003 18:31:11 -0000 1.8 @@ -77,129 +77,179 @@ IRtfParagraphKeepTogetherContainer, IRtfAfterContainer, IRtfJforCmdContainer { - private RtfParagraph m_paragraph; - private RtfTable m_table; - private RtfList m_list; - private RtfExternalGraphic m_externalGraphic; - private RtfBefore m_before; - private RtfAfter m_after; - private RtfJforCmd m_jforCmd; + private RtfParagraph paragraph; + private RtfTable table; + private RtfList list; + private RtfExternalGraphic externalGraphic; + private RtfBefore before; + private RtfAfter after; + private RtfJforCmd jforCmd; /** Create an RTF container as a child of given container */ RtfSection(RtfDocumentArea parent, Writer w) throws IOException { super(parent, w); } - /** start a new external graphic after closing current paragraph, list and table */ + /** + * Start a new external graphic after closing current paragraph, list and table + * @return new RtfExternalGraphic object + * @throws IOException for I/O problems + */ public RtfExternalGraphic newImage() throws IOException { closeAll(); - m_externalGraphic = new RtfExternalGraphic(this, writer); - return m_externalGraphic; + externalGraphic = new RtfExternalGraphic(this, writer); + return externalGraphic; } - /** start a new paragraph after closing current paragraph, list and table */ + /** + * Start a new paragraph after closing current paragraph, list and table + * @param attrs attributes for new RtfParagraph + * @return new RtfParagraph object + * @throws IOException for I/O problems + */ public RtfParagraph newParagraph(RtfAttributes attrs) throws IOException { closeAll(); - m_paragraph = new RtfParagraph(this, writer, attrs); - return m_paragraph; + paragraph = new RtfParagraph(this, writer, attrs); + return paragraph; } - /** close current paragraph if any and start a new one with default attributes */ + /** + * Close current paragraph if any and start a new one with default attributes + * @return new RtfParagraph + * @throws IOException for I/O problems + */ public RtfParagraph newParagraph() throws IOException { return newParagraph(null); } - /** close current paragraph if any and start a new one */ + /** + * Close current paragraph if any and start a new one + * @return new RtfParagraphKeepTogether + * @throws IOException for I/O problems + */ public RtfParagraphKeepTogether newParagraphKeepTogether() throws IOException { return new RtfParagraphKeepTogether(this, writer); } - /** start a new table after closing current paragraph, list and table - * @param tc Table context used for number-columns-spanned attribute (added by - * Boris Poudérous on july 2002) - */ + /** + * Start a new table after closing current paragraph, list and table + * @param tc Table context used for number-columns-spanned attribute (added by + * Boris Poudérous on july 2002) + * @return new RtfTable object + * @throws IOException for I/O problems + */ public RtfTable newTable(ITableColumnsInfo tc) throws IOException { closeAll(); - m_table = new RtfTable(this, writer, tc); - return m_table; + table = new RtfTable(this, writer, tc); + return table; } - /** start a new table after closing current paragraph, list and table - * @param tc Table context used for number-columns-spanned attribute (added by - * Boris Poudérous on july 2002) - */ + /** + * Start a new table after closing current paragraph, list and table + * @param attrs attributes of new RtfTable + * @param tc Table context used for number-columns-spanned attribute (added by + * Boris Poudérous on july 2002) + * @return new RtfTable object + * @throws IOException for I/O problems + */ public RtfTable newTable(RtfAttributes attrs, ITableColumnsInfo tc) throws IOException { closeAll(); - m_table = new RtfTable(this, writer, attrs, tc); - return m_table; + table = new RtfTable(this, writer, attrs, tc); + return table; } - /** start a new list after closing current paragraph, list and table */ + /** + * Start a new list after closing current paragraph, list and table + * @param attrs attributes of new RftList object + * @return new RtfList + * @throws IOException for I/O problems + */ public RtfList newList(RtfAttributes attrs) throws IOException { closeAll(); - m_list = new RtfList(this, writer, attrs); - return m_list; + list = new RtfList(this, writer, attrs); + return list; } - /** IRtfBeforeContainer */ + /** + * IRtfBeforeContainer + * @param attrs attributes of new RtfBefore object + * @return new RtfBefore object + * @throws IOException for I/O problems + */ public RtfBefore newBefore(RtfAttributes attrs) throws IOException { closeAll(); - m_before = new RtfBefore(this, writer, attrs); - return m_before; + before = new RtfBefore(this, writer, attrs); + return before; } - /** IRtfAfterContainer */ + /** + * IRtfAfterContainer + * @param attrs attributes of new RtfAfter object + * @return new RtfAfter object + * @throws IOException for I/O problems + */ public RtfAfter newAfter(RtfAttributes attrs) throws IOException { closeAll(); - m_after = new RtfAfter(this, writer, attrs); - return m_after; + after = new RtfAfter(this, writer, attrs); + return after; } - + /** + * + * @param attrs attributes of new RtfJforCmd + * @return the new RtfJforCmd + * @throws IOException for I/O problems + */ public RtfJforCmd newJforCmd(RtfAttributes attrs) throws IOException { - m_jforCmd = new RtfJforCmd(this, writer, attrs); - return m_jforCmd; + jforCmd = new RtfJforCmd(this, writer, attrs); + return jforCmd; } - /** can be overridden to write RTF prefix code, what comes before our children */ + /** + * Can be overridden to write RTF prefix code, what comes before our children + * @throws IOException for I/O problems + */ protected void writeRtfPrefix() throws IOException { writeControlWord("sectd"); } - /** can be overridden to write RTF suffix code, what comes after our children */ + /** + * Can be overridden to write RTF suffix code, what comes after our children + * @throws IOException for I/O problems + */ protected void writeRtfSuffix() throws IOException { writeControlWord("sect"); } private void closeCurrentTable() throws IOException { - if (m_table != null) { - m_table.close(); + if (table != null) { + table.close(); } } private void closeCurrentParagraph() throws IOException { - if (m_paragraph != null) { - m_paragraph.close(); + if (paragraph != null) { + paragraph.close(); } } private void closeCurrentList() throws IOException { - if (m_list != null) { - m_list.close(); + if (list != null) { + list.close(); } } private void closeCurrentExternalGraphic() throws IOException { - if (m_externalGraphic != null) { - m_externalGraphic.close(); + if (externalGraphic != null) { + externalGraphic.close(); } } private void closeCurrentBefore() throws IOException { - if (m_before != null) { - m_before.close(); + if (before != null) { + before.close(); } }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]