From: William Victor Mote Date: Thu, 3 Jul 2003 18:31:11 +0000 (+0000) Subject: style changes only, mostly javadoc comments and refactoring of names X-Git-Tag: Root_Temp_KnuthStylePageBreaking~1357 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=d51da4e60e2fbba68fd8eb38460e7d6eb56ba7aa;p=xmlgraphics-fop.git style changes only, mostly javadoc comments and refactoring of names git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@196566 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfParagraph.java b/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfParagraph.java index ca0aa8c2d..664f49c27 100755 --- a/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfParagraph.java +++ b/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfParagraph.java @@ -72,14 +72,14 @@ public class RtfParagraph extends RtfBookmarkContainerImpl 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 @@ implements IRtfTextContainer, IRtfPageBreakContainer, IRtfHyperLinkContainer, 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 @@ implements IRtfTextContainer, IRtfPageBreakContainer, IRtfHyperLinkContainer, 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 @@ implements IRtfTextContainer, IRtfPageBreakContainer, IRtfHyperLinkContainer, } //Reset paragraph properties if needed - if (m_resetProperties) { + if (resetProperties) { writeControlWord("pard"); } @@ -149,7 +159,7 @@ implements IRtfTextContainer, IRtfPageBreakContainer, IRtfHyperLinkContainer, } //Set keepn if needed (Keep paragraph with the next paragraph) - if (m_keepn) { + if (keepn) { writeControlWord("keepn"); } @@ -177,7 +187,10 @@ implements IRtfTextContainer, IRtfPageBreakContainer, IRtfHyperLinkContainer, } - /** 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 @@ implements IRtfTextContainer, IRtfPageBreakContainer, IRtfHyperLinkContainer, } - /** 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 @@ implements IRtfTextContainer, IRtfPageBreakContainer, IRtfHyperLinkContainer, 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 @@ implements IRtfTextContainer, IRtfPageBreakContainer, IRtfHyperLinkContainer, 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(); } } diff --git a/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfParagraphKeepTogether.java b/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfParagraphKeepTogether.java index c09d96e33..40317a71d 100644 --- a/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfParagraphKeepTogether.java +++ b/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfParagraphKeepTogether.java @@ -62,12 +62,19 @@ package org.apache.fop.rtf.rtflib.rtfdoc; 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 @@ public class RtfParagraphKeepTogether extends RtfContainer { 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; } diff --git a/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfSection.java b/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfSection.java index 0723222d7..2ab15a40a 100755 --- a/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfSection.java +++ b/src/java/org/apache/fop/rtf/rtflib/rtfdoc/RtfSection.java @@ -77,129 +77,179 @@ implements 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(); } }