diff options
author | Andreas Beeker <kiwiwings@apache.org> | 2021-04-13 22:46:12 +0000 |
---|---|---|
committer | Andreas Beeker <kiwiwings@apache.org> | 2021-04-13 22:46:12 +0000 |
commit | 7c67bba960e46433d8bf11674ef862153403cfdc (patch) | |
tree | c6b1941293f78701af45f1d1a73a3438442a93c1 | |
parent | 088d1dd19728d4a49f84d718e8399974b021f0b3 (diff) | |
download | poi-7c67bba960e46433d8bf11674ef862153403cfdc.tar.gz poi-7c67bba960e46433d8bf11674ef862153403cfdc.zip |
:poi-ooxml - fix javadocs - link to dependent/external project javadocs
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1888747 13f79535-47bb-0310-9956-ffa450edef68
19 files changed, 211 insertions, 285 deletions
diff --git a/poi-ooxml/build.gradle b/poi-ooxml/build.gradle index 5571000b27..9f67a73103 100644 --- a/poi-ooxml/build.gradle +++ b/poi-ooxml/build.gradle @@ -49,10 +49,9 @@ configurations { exclude group: 'xml-apis', module: 'xml-apis' } } - broken - tests + javadocs } dependencies { @@ -87,6 +86,9 @@ dependencies { testImplementation 'com.google.guava:guava:30.0-jre' broken "org.apache.xmlgraphics:batik-script:${batikVersion}" + + javadocs project(':poi') + javadocs project(':poi-scratchpad') } final String MODULE_NAME = 'org.apache.poi.ooxml' @@ -208,11 +210,20 @@ task fixBatik(type: Zip) { } javadoc { -// fails currently, need to fix the sources - failOnError = false -// if(JavaVersion.current().isJava9Compatible()) { -// options.addBooleanOption('html5', true) -// } + failOnError = true + doFirst { + options { + if (JavaVersion.current().isJava9Compatible()) { + addBooleanOption('html5', true) + } + links 'https://poi.apache.org/apidocs/dev/' + links 'https://docs.oracle.com/javase/8/docs/api/' + use = true + splitIndex = true + source = "1.8" + classpath += configurations.javadocs.files + } + } } artifacts { diff --git a/poi-ooxml/src/main/java/org/apache/poi/ooxml/util/XPathHelper.java b/poi-ooxml/src/main/java/org/apache/poi/ooxml/util/XPathHelper.java index 6677f01fb9..c374c12798 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/ooxml/util/XPathHelper.java +++ b/poi-ooxml/src/main/java/org/apache/poi/ooxml/util/XPathHelper.java @@ -73,7 +73,7 @@ public final class XPathHelper { /** * Internal code - API may change any time! * <p> - * The {@link #selectProperty(Class, String)} xquery method has some performance penalties, + * The XSLFShape.selectProperty(Class, String) xquery method has some performance penalties, * which can be workaround by using {@link XmlCursor}. This method also takes into account * that {@code AlternateContent} tags can occur anywhere on the given path. * <p> @@ -83,8 +83,7 @@ public final class XPathHelper { * <li>searching for a AlternateContent.Choice child</li> * <li>searching for a AlternateContent.Fallback child</li> * </ul> - * Currently POI OOXML is based on the first edition of the ECMA 376 schema, which doesn't - * allow AlternateContent tags to show up everywhere. The factory flag is + * The factory flag is * a workaround to process files based on a later edition. But it comes with the drawback: * any change on the returned XmlObject aren't saved back to the underlying document - * so it's a non updatable clone. If factory is null, a XmlException is diff --git a/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/PackagePartName.java b/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/PackagePartName.java index d2d38b06d5..a5270c069d 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/PackagePartName.java +++ b/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/PackagePartName.java @@ -244,7 +244,7 @@ public final class PackagePartName implements Comparable<PackagePartName> { String[] segments = partUri.toASCIIString() .replaceFirst("^"+PackagingURIHelper.FORWARD_SLASH_CHAR,"") .split(PackagingURIHelper.FORWARD_SLASH_STRING); - + if (segments.length < 1) { throw new InvalidFormatException( "A part name shall not have empty segments [M1.3]: " + partUri.getPath()); @@ -306,13 +306,13 @@ public final class PackagePartName implements Comparable<PackagePartName> { ) { continue; } - + if (c != '%') { throw new InvalidFormatException( "A segment shall not hold any characters other than pchar characters. [M1.6]"); - } - + } + // We certainly found an encoded character, check for length // now ( '%' HEXDIGIT HEXDIGIT) if ((length - i) < 2 || !isHexDigit(segment.charAt(i+1)) || !isHexDigit(segment.charAt(i+2))) { @@ -341,7 +341,7 @@ public final class PackagePartName implements Comparable<PackagePartName> { } } } - + /** * Throws an exception if the specified part name doesn't start with a * forward slash character '/'. [M1.4] @@ -415,7 +415,7 @@ public final class PackagePartName implements Comparable<PackagePartName> { /** * Retrieves the extension of the part name if any. If there is no extension - * returns an empty String. Example : '/document/content.xml' => 'xml' + * returns an empty String. Example : '/document/content.xml' => 'xml' * * @return The extension of the part name. */ @@ -526,7 +526,7 @@ public final class PackagePartName implements Comparable<PackagePartName> { // (non-null) > (null) return 1; } - + if (str1.equalsIgnoreCase(str2)) { return 0; } @@ -569,7 +569,7 @@ public final class PackagePartName implements Comparable<PackagePartName> { private static boolean isDigitOrLetter(char c) { return (c >= '0' && c <= '9') || (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z'); } - + private static boolean isHexDigit(char c) { return (c >= '0' && c <= '9') || (c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f'); } diff --git a/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/PackagingURIHelper.java b/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/PackagingURIHelper.java index bd1bce1b7e..58231a166a 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/PackagingURIHelper.java +++ b/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/PackagingURIHelper.java @@ -262,8 +262,8 @@ public final class PackagingURIHelper { * This flag violates [M1.4]: A part name shall start with a forward slash ('/') character, but * allows generating URIs compatible with MS Office and OpenOffice. * @return A fully relativize part name URI ('word/media/image1.gif', - * '/word/document.xml' => 'media/image1.gif') else - * <code>null</code>. + * '/word/document.xml' => 'media/image1.gif') else + * {@code null}. */ public static URI relativizeURI(URI sourceURI, URI targetURI, boolean msCompatible) { StringBuilder retVal = new StringBuilder(); @@ -390,8 +390,8 @@ public final class PackagingURIHelper { * @param targetURI * The target part URI. * @return A fully relativize part name URI ('word/media/image1.gif', - * '/word/document.xml' => 'media/image1.gif') else - * <code>null</code>. + * '/word/document.xml' => 'media/image1.gif') else + * {@code null}. */ public static URI relativizeURI(URI sourceURI, URI targetURI) { return relativizeURI(sourceURI, targetURI, false); @@ -620,7 +620,7 @@ public final class PackagingURIHelper { /** * Build a part name where the relationship should be stored ((ex - * /word/document.xml -> /word/_rels/document.xml.rels) + * /word/document.xml -> /word/_rels/document.xml.rels) * * @param partName * Source part URI @@ -728,10 +728,10 @@ public final class PackagingURIHelper { * percent-encode white spaces and characters above 0x80. * <p> * Examples: - * <blockquote><pre> + * <pre>{@code * 'Apache POI' --> 'Apache%20POI' * 'Apache\u0410POI' --> 'Apache%04%10POI' - * </pre></blockquote> + * }</pre> * @param s the string to encode * @return the encoded string */ diff --git a/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/ContentTypeManager.java b/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/ContentTypeManager.java index 5b356843c8..f9df88da44 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/ContentTypeManager.java +++ b/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/ContentTypeManager.java @@ -114,7 +114,7 @@ public abstract class ContentTypeManager { } /** - * Build association extention-> content type (will be stored in + * Build association extension-> content type (will be stored in * [Content_Types].xml) for example ContentType="image/png" Extension="png" * <p> * [M2.8]: When adding a new part to a package, the package implementer @@ -286,7 +286,7 @@ public abstract class ContentTypeManager { throw new IllegalArgumentException("contentType"); } - return (this.defaultContentType.containsValue(contentType) || + return (this.defaultContentType.containsValue(contentType) || (this.overrideContentType != null && this.overrideContentType.containsValue(contentType))); } diff --git a/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/unmarshallers/PackagePropertiesUnmarshaller.java b/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/unmarshallers/PackagePropertiesUnmarshaller.java index 278bffd9a1..20d30c443f 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/unmarshallers/PackagePropertiesUnmarshaller.java +++ b/poi-ooxml/src/main/java/org/apache/poi/openxml4j/opc/internal/unmarshallers/PackagePropertiesUnmarshaller.java @@ -217,23 +217,22 @@ public final class PackagePropertiesUnmarshaller implements PartUnmarshaller { * <p> * Rule M4.2: A format consumer shall consider the use of the Markup * Compatibility namespace to be an error. - * </p><p> + * <p> * Rule M4.3: Producers shall not create a document element that contains * refinements to the Dublin Core elements, except for the two specified in - * the schema: <dcterms:created> and <dcterms:modified> Consumers shall + * the schema: <dcterms:created> and <dcterms:modified> Consumers shall * consider a document element that violates this constraint to be an error. - * </p><p> + * <p> * Rule M4.4: Producers shall not create a document element that contains * the xml:lang attribute. Consumers shall consider a document element that * violates this constraint to be an error. - * </p><p> + * <p> * Rule M4.5: Producers shall not create a document element that contains - * the xsi:type attribute, except for a <dcterms:created> or - * <dcterms:modified> element where the xsi:type attribute shall be present + * the xsi:type attribute, except for a <dcterms:created> or + * <dcterms:modified> element where the xsi:type attribute shall be present * and shall hold the value dcterms:W3CDTF, where dcterms is the namespace * prefix of the Dublin Core namespace. Consumers shall consider a document * element that violates this constraint to be an error. - * </p> */ public void checkElementForOPCCompliance(Element el) throws InvalidFormatException { diff --git a/poi-ooxml/src/main/java/org/apache/poi/xssf/eventusermodel/ReadOnlySharedStringsTable.java b/poi-ooxml/src/main/java/org/apache/poi/xssf/eventusermodel/ReadOnlySharedStringsTable.java index bcc30c3f59..b501cb846e 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xssf/eventusermodel/ReadOnlySharedStringsTable.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/eventusermodel/ReadOnlySharedStringsTable.java @@ -46,37 +46,37 @@ import org.xml.sax.helpers.DefaultHandler; * <p>Note that each SI entry can have multiple T elements, if the * string is made up of bits with different formatting. * <p>Example input: - * <pre> -<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> -<sst xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" count="2" uniqueCount="2"> - <si> - <r> - <rPr> - <b /> - <sz val="11" /> - <color theme="1" /> - <rFont val="Calibri" /> - <family val="2" /> - <scheme val="minor" /> - </rPr> - <t>This:</t> - </r> - <r> - <rPr> - <sz val="11" /> - <color theme="1" /> - <rFont val="Calibri" /> - <family val="2" /> - <scheme val="minor" /> - </rPr> - <t xml:space="preserve">Causes Problems</t> - </r> - </si> - <si> - <t>This does not</t> - </si> -</sst> -* </pre> + * <pre>{@code + * <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> + * <sst xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" count="2" uniqueCount="2"> + * <si> + * <r> + * <rPr> + * <b /> + * <sz val="11" /> + * <color theme="1" /> + * <rFont val="Calibri" /> + * <family val="2" /> + * <scheme val="minor" /> + * </rPr> + * <t>This:</t> + * </r> + * <r> + * <rPr> + * <sz val="11" /> + * <color theme="1" /> + * <rFont val="Calibri" /> + * <family val="2" /> + * <scheme val="minor" /> + * </rPr> + * <t xml:space="preserve">Causes Problems</t> + * </r> + * </si> + * <si> + * <t>This does not</t> + * </si> + * </sst> + * }</pre> * */ public class ReadOnlySharedStringsTable extends DefaultHandler implements SharedStrings { @@ -157,7 +157,7 @@ public class ReadOnlySharedStringsTable extends DefaultHandler implements Shared this.includePhoneticRuns = includePhoneticRuns; readFrom(part.getInputStream()); } - + /** * Read this shared strings table from an XML file. * diff --git a/poi-ooxml/src/main/java/org/apache/poi/xssf/model/StylesTable.java b/poi-ooxml/src/main/java/org/apache/poi/xssf/model/StylesTable.java index a007608e26..767b69e226 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xssf/model/StylesTable.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/model/StylesTable.java @@ -89,8 +89,8 @@ public class StylesTable extends POIXMLDocumentPart implements Styles { * Changes the maximum number of data formats that may be in a style table * * @param num the upper limit on number of data formats in the styles table when adding new data formats - * @throws IllegalArgumentException if <code>num</code> < 0 - * @throws IllegalStateException if <code>num</code> < current number of data formats in the style table. + * @throws IllegalArgumentException if {@code num < 0} + * @throws IllegalStateException if {@code num < current number of data formats in the style table}. * Data formats must be explicitly removed before the limit can be decreased. */ public void setMaxNumberOfDataFormats(int num) { diff --git a/poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/SXSSFRow.java b/poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/SXSSFRow.java index 8d6e903d9d..531261e056 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/SXSSFRow.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/streaming/SXSSFRow.java @@ -113,11 +113,11 @@ public class SXSSFRow implements Row, Comparable<SXSSFRow> * Use this to create new cells within the row and return it. * <p> * The cell that is returned is a {@link CellType#BLANK}. The type can be changed - * either through calling <code>setCellValue</code> or <code>setCellType</code>. + * either through calling {@code setCellValue} or {@code setCellType}. * * @param column - the column number this cell represents * @return Cell a high level representation of the created cell. - * @throws IllegalArgumentException if columnIndex < 0 or greater than the maximum number of supported columns + * @throws IllegalArgumentException if columnIndex < 0 or greater than the maximum number of supported columns * (255 for *.xls, 1048576 for *.xlsx) */ @Override @@ -134,7 +134,7 @@ public class SXSSFRow implements Row, Comparable<SXSSFRow> * * @param column - the column number this cell represents * @return Cell a high level representation of the created cell. - * @throws IllegalArgumentException if columnIndex < 0 or greater than a maximum number of supported columns + * @throws IllegalArgumentException if columnIndex < 0 or greater than a maximum number of supported columns * (255 for *.xls, 1048576 for *.xlsx) */ @Override @@ -192,7 +192,7 @@ public class SXSSFRow implements Row, Comparable<SXSSFRow> * Set the row number of this row. * * @param rowNum the row number (0-based) - * @throws IllegalArgumentException if rowNum < 0 + * @throws IllegalArgumentException if rowNum < 0 */ @Override public void setRowNum(int rowNum) @@ -232,7 +232,7 @@ public class SXSSFRow implements Row, Comparable<SXSSFRow> * Returns the cell at the given (0 based) index, with the specified {@link org.apache.poi.ss.usermodel.Row.MissingCellPolicy} * * @return the cell at the given (0 based) index - * @throws IllegalArgumentException if cellnum < 0 or the specified MissingCellPolicy is invalid + * @throws IllegalArgumentException if cellnum < 0 or the specified MissingCellPolicy is invalid */ @Override public SXSSFCell getCell(int cellnum, MissingCellPolicy policy) diff --git a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFDxfStyleProvider.java b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFDxfStyleProvider.java index c68f16eb09..72fe8959a5 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFDxfStyleProvider.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFDxfStyleProvider.java @@ -29,18 +29,18 @@ import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTNumFmt; * Style based on a dxf record - e.g. table style element or conditional formatting rule */ public class XSSFDxfStyleProvider implements DifferentialStyleProvider { - + private final IndexedColorMap colorMap; private final BorderFormatting border; private final FontFormatting font; private final ExcelNumberFormat number; private final PatternFormatting fill; private final int stripeSize; - + /** * @param dxf - * @param stripeSize 0 for non-stripe styles, > 1 for stripes - * @param colorMap + * @param stripeSize 0 for non-stripe styles, > 1 for stripes + * @param colorMap */ public XSSFDxfStyleProvider(CTDxf dxf, int stripeSize, IndexedColorMap colorMap) { this.stripeSize = stripeSize; @@ -51,15 +51,15 @@ public class XSSFDxfStyleProvider implements DifferentialStyleProvider { number = null; fill = null; } else { - border = dxf.isSetBorder() ? new XSSFBorderFormatting(dxf.getBorder(), colorMap) : null; - font = dxf.isSetFont() ? new XSSFFontFormatting(dxf.getFont(), colorMap) : null; + border = dxf.isSetBorder() ? new XSSFBorderFormatting(dxf.getBorder(), colorMap) : null; + font = dxf.isSetFont() ? new XSSFFontFormatting(dxf.getFont(), colorMap) : null; if (dxf.isSetNumFmt()) { CTNumFmt numFmt = dxf.getNumFmt(); number = new ExcelNumberFormat((int) numFmt.getNumFmtId(), numFmt.getFormatCode()); } else { number = null; } - fill = dxf.isSetFill() ? new XSSFPatternFormatting(dxf.getFill(), colorMap) : null; + fill = dxf.isSetFill() ? new XSSFPatternFormatting(dxf.getFill(), colorMap) : null; } } @@ -78,7 +78,7 @@ public class XSSFDxfStyleProvider implements DifferentialStyleProvider { public PatternFormatting getPatternFormatting() { return fill; } - + public int getStripeSize() { return stripeSize; } diff --git a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFRichTextString.java b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFRichTextString.java index d71641b7de..432ee0191c 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFRichTextString.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFRichTextString.java @@ -442,7 +442,7 @@ public class XSSFRichTextString implements RichTextString { /** * - * CTRPrElt --> CTFont adapter + * CTRPrElt --> CTFont adapter */ protected static CTFont toCTFont(CTRPrElt pr){ CTFont ctFont = CTFont.Factory.newInstance(); diff --git a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFRow.java b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFRow.java index 2e285dc747..cfda49b0b0 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFRow.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/XSSFRow.java @@ -190,7 +190,7 @@ public class XSSFRow implements Row, Comparable<XSSFRow> { * </p> * @param columnIndex - the column number this cell represents * @return Cell a high level representation of the created cell. - * @throws IllegalArgumentException if columnIndex < 0 or greater than 16384, + * @throws IllegalArgumentException if columnIndex < 0 or greater than 16384, * the maximum number of columns supported by the SpreadsheetML format (.xlsx) */ @Override @@ -204,7 +204,7 @@ public class XSSFRow implements Row, Comparable<XSSFRow> { * @param columnIndex - the column number this cell represents * @param type - the cell's data type * @return XSSFCell a high level representation of the created cell. - * @throws IllegalArgumentException if the specified cell type is invalid, columnIndex < 0 + * @throws IllegalArgumentException if the specified cell type is invalid, columnIndex < 0 * or greater than 16384, the maximum number of columns supported by the SpreadsheetML format (.xlsx) */ @Override @@ -412,7 +412,7 @@ public class XSSFRow implements Row, Comparable<XSSFRow> { * Set the row number of this row. * * @param rowIndex the row number (0-based) - * @throws IllegalArgumentException if rowNum < 0 or greater than 1048575 + * @throws IllegalArgumentException if rowNum < 0 or greater than 1048575 */ @Override public void setRowNum(int rowIndex) { diff --git a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/extensions/XSSFHeaderFooter.java b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/extensions/XSSFHeaderFooter.java index 2ab58f6fa0..b404ac4618 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/extensions/XSSFHeaderFooter.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xssf/usermodel/extensions/XSSFHeaderFooter.java @@ -37,84 +37,84 @@ import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTHeaderFooter; *</p> * * This example shows the text "Center Bold Header" on the first line (center - * section), and the date on the second line (center section). &CCenter - * &"-,Bold"Bold &"-,Regular"Header_x000A_&D + * section), and the date on the second line (center section). &CCenter + * &"-,Bold"Bold &"-,Regular"Header_x000A_&D * * <b>General Rules:</b> There is no required order in which these codes must * appear. The first occurrence of the following codes turns the formatting ON, * the second occurrence turns it OFF again: * * <dl> - * <dt>&L</dt> + * <dt>&L</dt> * <dd>code for "left section" (there are three header / footer locations, * "left", "center", and "right"). When two or more occurrences of this section * marker exist, the contents from all markers are concatenated, in the order of * appearance, and placed into the left section.</dd> - * <dt>&P</dt> + * <dt>&P</dt> * <dd>code for "current page #"</dd> - * <dt>&N</dt> + * <dt>&N</dt> * <dd>code for "total pages"</dd> - * <dt>&font size</dt> + * <dt>&font size</dt> * <dd>code for "text font size", where font size is a font size in points.</dd> - * <dt>&K</dt> + * <dt>&K</dt> * <dd>code for "text font color" RGB Color is specified as RRGGBB Theme Color * is specifed as TTSNN where TT is the theme color Id, S is either "+" or "-" * of the tint/shade value, NN is the tint/shade value.</dd> - * <dt>&S</dt> + * <dt>&S</dt> * <dd>code for "text strikethrough" on / off</dd> - * <dt>&X</dt> + * <dt>&X</dt> * <dd>code for "text super script" on / off</dd> - * <dt>&Y</dt> + * <dt>&Y</dt> * <dd>code for "text subscript" on / off</dd> - * <dt>&C</dt> + * <dt>&C</dt> * <dd>code for "center section". When two or more occurrences of this section * marker exist, the contents from all markers are concatenated, in the order of * appearance, and placed into the center section. SpreadsheetML Reference * Material - Worksheets 1966</dd> - * <dt>&D</dt> + * <dt>&D</dt> * <dd>code for "date"</dd> - * <dt>&T</dt> + * <dt>&T</dt> * <dd>code for "time"</dd> - * <dt>&G</dt> + * <dt>&G</dt> * <dd>code for "picture as background"</dd> - * <dt>&U</dt> + * <dt>&U</dt> * <dd>code for "text single underline"</dd> - * <dt>&E</dt> + * <dt>&E</dt> * <dd>code for "double underline"</dd> - * <dt>&R</dt> + * <dt>&R</dt> * <dd>code for "right section". When two or more occurrences of this section * marker exist, the contents from all markers are concatenated, in the order of * appearance, and placed into the right section.</dd> - * <dt>&Z</dt> + * <dt>&Z</dt> * <dd>code for "this workbook's file path"</dd> - * <dt>&F</dt> + * <dt>&F</dt> * <dd>code for "this workbook's file name"</dd> - * <dt>&A</dt> + * <dt>&A</dt> * <dd>code for "sheet tab name"</dd> - * <dt>&+</dt> + * <dt>&+</dt> * <dd>code for add to page #.</dd> - * <dt>&-</dt> + * <dt>&-</dt> * <dd>code for subtract from page #.</dd> - * <dt>&"font name,font type" - code for "text font name" and "text font type", + * <dt>&"font name,font type" - code for "text font name" and "text font type", * where font name and font type are strings specifying the name and type of the * font, separated by a comma. When a hyphen appears in font name, it means * "none specified". Both of font name and font type can be localized - * values.</dd> - * <dt>&"-,Bold"</dt> + * values.</dt> + * <dt>&"-,Bold"</dt> * <dd>code for "bold font style"</dd> - * <dt>&B</dt> + * <dt>&B</dt> * <dd>also means "bold font style"</dd> - * <dt>&"-,Regular"</dt> + * <dt>&"-,Regular"</dt> * <dd>code for "regular font style"</dd> - * <dt>&"-,Italic"</dt> + * <dt>&"-,Italic"</dt> * <dd>code for "italic font style"</dd> - * <dt>&I</dt> + * <dt>&I</dt> * <dd>also means "italic font style"</dd> - * <dt>&"-,Bold Italic"</dt> + * <dt>&"-,Bold Italic"</dt> * <dd>code for "bold italic font style"</dd> - * <dt>&O</dt> + * <dt>&O</dt> * <dd>code for "outline style"</dd> - * <dt>&H</dt> + * <dt>&H</dt> * <dd>code for "shadow style"</dd> * </dl> * @@ -125,7 +125,7 @@ public abstract class XSSFHeaderFooter implements HeaderFooter { private CTHeaderFooter headerFooter; private boolean stripFields; - + /** * Create an instance of XSSFAbstractHeaderFooter from the supplied XML bean * diff --git a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/ICell.java b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/ICell.java index c89f939600..b6fa330faa 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/ICell.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/ICell.java @@ -21,7 +21,7 @@ package org.apache.poi.xwpf.usermodel; * {@link XWPFTableCell}, {@link XWPFSDTCell} * <p> * Schematically something like this: - * <tr><tc/><tc/><sdt><tc/></sdt></tr> + * {@code <tr><tc/><tc/><sdt><tc/></sdt></tr>} */ public interface ICell { } diff --git a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFAbstractFootnoteEndnote.java b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFAbstractFootnoteEndnote.java index ff509ecdc2..d1a86f2945 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFAbstractFootnoteEndnote.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFAbstractFootnoteEndnote.java @@ -35,7 +35,7 @@ import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTc; /** * Base class for both bottom-of-the-page footnotes {@link XWPFFootnote} and end - * notes {@link XWPFEndnote}). + * notes {@link XWPFEndnote}). * <p>The only significant difference between footnotes and * end notes is which part they go on. Footnotes are managed by the Footnotes part * {@link XWPFFootnotes} and end notes are managed by the Endnotes part {@link XWPFEndnotes}.</p> @@ -43,10 +43,10 @@ import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTTc; */ public abstract class XWPFAbstractFootnoteEndnote implements Iterable<XWPFParagraph>, IBody { - private List<XWPFParagraph> paragraphs = new ArrayList<>(); - private List<XWPFTable> tables = new ArrayList<>(); - private List<XWPFPictureData> pictures = new ArrayList<>(); - private List<IBodyElement> bodyElements = new ArrayList<>(); + private final List<XWPFParagraph> paragraphs = new ArrayList<>(); + private final List<XWPFTable> tables = new ArrayList<>(); + private final List<XWPFPictureData> pictures = new ArrayList<>(); + private final List<IBodyElement> bodyElements = new ArrayList<>(); protected CTFtnEdn ctFtnEdn; protected XWPFAbstractFootnotesEndnotes footnotes; protected XWPFDocument document; @@ -98,6 +98,7 @@ public abstract class XWPFAbstractFootnoteEndnote implements Iterable<XWPFParag * Get the list of {@link XWPFParagraph}s in the footnote. * @return List of paragraphs */ + @Override public List<XWPFParagraph> getParagraphs() { return paragraphs; } @@ -106,6 +107,7 @@ public abstract class XWPFAbstractFootnoteEndnote implements Iterable<XWPFParag * Get an iterator over the {@link XWPFParagraph}s in the footnote. * @return Iterator over the paragraph list. */ + @Override public Iterator<XWPFParagraph> iterator() { return paragraphs.iterator(); } @@ -114,6 +116,7 @@ public abstract class XWPFAbstractFootnoteEndnote implements Iterable<XWPFParag * Get the list of {@link XWPFTable}s in the footnote. * @return List of tables */ + @Override public List<XWPFTable> getTables() { return tables; } @@ -130,6 +133,7 @@ public abstract class XWPFAbstractFootnoteEndnote implements Iterable<XWPFParag * Gets the body elements ({@link IBodyElement}) of the footnote. * @return List of body elements. */ + @Override public List<IBodyElement> getBodyElements() { return bodyElements; } @@ -144,7 +148,7 @@ public abstract class XWPFAbstractFootnoteEndnote implements Iterable<XWPFParag /** * Set the underlying CTFtnEdn for the footnote. - * <p>Use {@link XWPFDocument#createFootnote()} to create new footnotes.</p> + * <p>Use {@link XWPFDocument#createFootnote()} to create new footnotes.</p> * @param footnote The CTFtnEdn object that will underly the footnote. */ public void setCTFtnEdn(CTFtnEdn footnote) { @@ -155,8 +159,8 @@ public abstract class XWPFAbstractFootnoteEndnote implements Iterable<XWPFParag * Gets the {@link XWPFTable} at the specified position from the footnote's table array. * @param pos in table array * @return The {@link XWPFTable} at position pos, or null if there is no table at position pos. - * @see org.apache.poi.xwpf.usermodel.IBody#getTableArray(int) */ + @Override public XWPFTable getTableArray(int pos) { if (pos >= 0 && pos < tables.size()) { return tables.get(pos); @@ -165,12 +169,12 @@ public abstract class XWPFAbstractFootnoteEndnote implements Iterable<XWPFParag } /** - * Inserts an existing {@link XWPFTable) into the arrays bodyElements and tables. + * Inserts an existing XWPFTable into the arrays bodyElements and tables. * * @param pos Position, in the bodyElements array, to insert the table - * @param table {@link XWPFTable) to be inserted - * @see org.apache.poi.xwpf.usermodel.IBody#insertTable(int pos, XWPFTable table) + * @param table XWPFTable to be inserted */ + @Override public void insertTable(int pos, XWPFTable table) { bodyElements.add(pos, table); int i = 0; @@ -185,14 +189,12 @@ public abstract class XWPFAbstractFootnoteEndnote implements Iterable<XWPFParag } /** - * if there is a corresponding {@link XWPFTable} of the parameter + * if there is a corresponding {@link XWPFTable} of the parameter * ctTable in the tableList of this header - * the method will return this table, or null if there is no + * the method will return this table, or null if there is no * corresponding {@link XWPFTable}. - * - * @param ctTable - * @see org.apache.poi.xwpf.usermodel.IBody#getTable(CTTbl ctTable) */ + @Override public XWPFTable getTable(CTTbl ctTable) { for (XWPFTable table : tables) { if (table == null) @@ -216,9 +218,8 @@ public abstract class XWPFAbstractFootnoteEndnote implements Iterable<XWPFParag * Returns the {@link XWPFParagraph} at position pos in footnote's paragraph array. * @param pos Array position of the paragraph to get. * @return the {@link XWPFParagraph} at position pos, or null if there is no paragraph at that position. - * - * @see org.apache.poi.xwpf.usermodel.IBody#getParagraphArray(int pos) */ + @Override public XWPFParagraph getParagraphArray(int pos) { if(pos >=0 && pos < paragraphs.size()) { return paragraphs.get(pos); @@ -229,10 +230,9 @@ public abstract class XWPFAbstractFootnoteEndnote implements Iterable<XWPFParag /** * get the {@link XWPFTableCell} that belongs to the CTTc cell. * - * @param cell * @return {@link XWPFTableCell} that corresponds to the CTTc cell, if there is one, otherwise null. - * @see org.apache.poi.xwpf.usermodel.IBody#getTableCell(CTTc cell) */ + @Override public XWPFTableCell getTableCell(CTTc cell) { XmlCursor cursor = cell.newCursor(); cursor.toParent(); @@ -262,7 +262,6 @@ public abstract class XWPFAbstractFootnoteEndnote implements Iterable<XWPFParag /** * Verifies that cursor is on the right position. * - * @param cursor * @return true if the cursor is within a CTFtnEdn element. */ private boolean isCursorInFtn(XmlCursor cursor) { @@ -284,10 +283,9 @@ public abstract class XWPFAbstractFootnoteEndnote implements Iterable<XWPFParag /** * Insert a table constructed from OOXML table markup. - * @param cursor * @return the inserted {@link XWPFTable} - * @see org.apache.poi.xwpf.usermodel.IBody#insertNewTbl(XmlCursor cursor) */ + @Override public XWPFTable insertNewTbl(XmlCursor cursor) { if (isCursorInFtn(cursor)) { String uri = CTTbl.type.getName().getNamespaceURI(); @@ -327,10 +325,9 @@ public abstract class XWPFAbstractFootnoteEndnote implements Iterable<XWPFParag /** * Add a new {@link XWPFParagraph} at position of the cursor. * - * @param cursor * @return The inserted {@link XWPFParagraph} - * @see org.apache.poi.xwpf.usermodel.IBody#insertNewParagraph(XmlCursor cursor) */ + @Override public XWPFParagraph insertNewParagraph(final XmlCursor cursor) { if (isCursorInFtn(cursor)) { String uri = CTP.type.getName().getNamespaceURI(); @@ -398,8 +395,8 @@ public abstract class XWPFAbstractFootnoteEndnote implements Iterable<XWPFParag /** * Get the {@link XWPFDocument} the footnote is part of. - * @see org.apache.poi.xwpf.usermodel.IBody#getXWPFDocument() */ + @Override public XWPFDocument getXWPFDocument() { return document; } @@ -407,9 +404,8 @@ public abstract class XWPFAbstractFootnoteEndnote implements Iterable<XWPFParag /** * Get the Part to which the footnote belongs, which you need for adding relationships to other parts * @return {@link POIXMLDocumentPart} that contains the footnote. - * - * @see org.apache.poi.xwpf.usermodel.IBody#getPart() */ + @Override public POIXMLDocumentPart getPart() { return footnotes; } @@ -417,9 +413,8 @@ public abstract class XWPFAbstractFootnoteEndnote implements Iterable<XWPFParag /** * Get the part type {@link BodyType} of the footnote. * @return The {@link BodyType} value. - * - * @see org.apache.poi.xwpf.usermodel.IBody#getPartType() */ + @Override public BodyType getPartType() { return BodyType.FOOTNOTE; } @@ -447,7 +442,7 @@ public abstract class XWPFAbstractFootnoteEndnote implements Iterable<XWPFParag paragraphs.add(p); bodyElements.add(p); - // If the paragraph is the first paragraph in the footnote, + // If the paragraph is the first paragraph in the footnote, // ensure that it has a footnote reference run. if (p.equals(getParagraphs().get(0))) { @@ -459,9 +454,9 @@ public abstract class XWPFAbstractFootnoteEndnote implements Iterable<XWPFParag /** * Ensure that the specified paragraph has a reference marker for this * footnote by adding a footnote reference if one is not found. - * <p>This method is for the first paragraph in the footnote, not + * <p>This method is for the first paragraph in the footnote, not * paragraphs that will refer to the footnote. For references to - * the footnote, use {@link XWPFParagraph#addFootnoteReference(XWPFFootnote)}. + * the footnote, use {@link XWPFParagraph#addFootnoteReference(XWPFAbstractFootnoteEndnote)}. * </p> * <p>The first run of the first paragraph in a footnote should * contain a {@link CTFtnEdnRef} object.</p> @@ -491,7 +486,7 @@ public abstract class XWPFAbstractFootnoteEndnote implements Iterable<XWPFParag /** * Appends a new {@link XWPFTable} to this footnote * @param rows Number of rows to initialize the table with - * @param cols Number of columns to initialize the table with + * @param cols Number of columns to initialize the table with * @return the new {@link XWPFTable} with the specified number of rows and columns * @since 4.0.0 */ diff --git a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFEndnote.java b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFEndnote.java index f18c1c118a..7c24e851d7 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFEndnote.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFEndnote.java @@ -26,14 +26,14 @@ import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTR; * <p>End notes are collected at the end of a document or section rather than * at the bottom of a page.</p> * <p>Create a new footnote using {@link XWPFDocument#createEndnote()} or - * {@link XWPFEndnotes#createFootnote()}.</p> + * {@link XWPFEndnotes#createEndnote()}.</p> * <p>The first body element of a footnote should (or possibly must) be a paragraph * with the first run containing a CTFtnEdnRef object. The {@link XWPFFootnote#createParagraph()} * and {@link XWPFFootnote#createTable()} methods do this for you.</p> * <p>Footnotes have IDs that are unique across all footnotes in the document. You use * the footnote ID to create a reference to a footnote from within a paragraph.</p> * <p>To create a reference to a footnote within a paragraph you create a run - * with a CTFtnEdnRef that specifies the ID of the target paragraph. + * with a CTFtnEdnRef that specifies the ID of the target paragraph. * The {@link XWPFParagraph#addFootnoteReference(XWPFAbstractFootnoteEndnote)} * method does this for you.</p> * @since 4.0.0 @@ -55,9 +55,9 @@ public class XWPFEndnote extends XWPFAbstractFootnoteEndnote { /** * Ensure that the specified paragraph has a reference marker for this * end note by adding a footnote reference if one is not found. - * <p>This method is for the first paragraph in the footnote, not + * <p>This method is for the first paragraph in the footnote, not * paragraphs that will refer to the footnote. For references to - * the footnote, use {@link XWPFParagraph#addFootnoteReference(XWPFAbstractFootnoteEndnote))}. + * the footnote, use {@link XWPFParagraph#addFootnoteReference(XWPFAbstractFootnoteEndnote)}. * </p> * <p>The first run of the first paragraph in a footnote should * contain a {@link CTFtnEdnRef} object.</p> @@ -66,7 +66,7 @@ public class XWPFEndnote extends XWPFAbstractFootnoteEndnote { * @since 4.0.0 */ public void ensureFootnoteRef(XWPFParagraph p) { - + XWPFRun r = null; if (p.getRuns().size() > 0) { r = p.getRuns().get(0); @@ -86,7 +86,7 @@ public class XWPFEndnote extends XWPFAbstractFootnoteEndnote { ctr.addNewRPr().addNewRStyle().setVal("FootnoteReference"); ctr.addNewEndnoteRef(); } - + } } diff --git a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFFootnote.java b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFFootnote.java index 77459ecc87..52584c310c 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFFootnote.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFFootnote.java @@ -31,12 +31,12 @@ import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTR; * <p>Footnotes have IDs that are unique across all footnotes in the document. You use * the footnote ID to create a reference to a footnote from within a paragraph.</p> * <p>To create a reference to a footnote within a paragraph you create a run - * with a CTFtnEdnRef that specifies the ID of the target paragraph. + * with a CTFtnEdnRef that specifies the ID of the target paragraph. * The {@link XWPFParagraph#addFootnoteReference(XWPFAbstractFootnoteEndnote)} * method does this for you.</p> */ public class XWPFFootnote extends XWPFAbstractFootnoteEndnote { - + @Internal public XWPFFootnote(CTFtnEdn note, XWPFAbstractFootnotesEndnotes xFootnotes) { super(note, xFootnotes); @@ -46,13 +46,13 @@ public class XWPFFootnote extends XWPFAbstractFootnoteEndnote { public XWPFFootnote(XWPFDocument document, CTFtnEdn body) { super(document, body); } - + /** * Ensure that the specified paragraph has a reference marker for this * footnote by adding a footnote reference if one is not found. - * <p>This method is for the first paragraph in the footnote, not + * <p>This method is for the first paragraph in the footnote, not * paragraphs that will refer to the footnote. For references to - * the footnote, use {@link XWPFParagraph#addFootnoteReference(XWPFFootnote)}. + * the footnote, use {@link XWPFParagraph#addFootnoteReference(XWPFAbstractFootnoteEndnote)}. * </p> * <p>The first run of the first paragraph in a footnote should * contain a {@link CTFtnEdnRef} object.</p> @@ -61,7 +61,7 @@ public class XWPFFootnote extends XWPFAbstractFootnoteEndnote { * @since 4.0.0 */ public void ensureFootnoteRef(XWPFParagraph p) { - + XWPFRun r = null; if (p.getRuns().size() > 0) { r = p.getRuns().get(0); @@ -81,6 +81,6 @@ public class XWPFFootnote extends XWPFAbstractFootnoteEndnote { ctr.addNewRPr().addNewRStyle().setVal("FootnoteReference"); ctr.addNewFootnoteRef(); } - + } } diff --git a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFRun.java b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFRun.java index ee741bace4..c9176437a7 100644 --- a/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFRun.java +++ b/poi-ooxml/src/main/java/org/apache/poi/xwpf/usermodel/XWPFRun.java @@ -215,7 +215,7 @@ public class XWPFRun implements ISDTContents, IRunElement, CharacterRun { /** * @return The {@link XWPFDocument} instance, this run belongs to, or - * <code>null</code> if parent structure (paragraph > document) is not properly set. + * {@code null} if parent structure (paragraph > document) is not properly set. */ public XWPFDocument getDocument() { if (parent != null) { @@ -258,7 +258,7 @@ public class XWPFRun implements ISDTContents, IRunElement, CharacterRun { * Whether the bold property shall be applied to all non-complex script * characters in the contents of this run when displayed in a document * - * @return <code>true</code> if the bold property is applied + * @return {@code true} if the bold property is applied */ @Override public boolean isBold() { @@ -275,7 +275,7 @@ public class XWPFRun implements ISDTContents, IRunElement, CharacterRun { * direct formatting. When used as part of a style definition, setting this * property shall toggle the current state of that property as specified up * to this point in the hierarchy (i.e. applied to not applied, and vice - * versa). Setting it to <code>false</code> (or an equivalent) shall + * versa). Setting it to {@code false} (or an equivalent) shall * result in the current setting remaining unchanged. However, when used as * direct formatting, setting this property to true or false shall set the * absolute state of the resulting property. @@ -287,7 +287,7 @@ public class XWPFRun implements ISDTContents, IRunElement, CharacterRun { * applied to non-complex script characters. * </p> * - * @param value <code>true</code> if the bold property is applied to + * @param value {@code true} if the bold property is applied to * this run */ @Override @@ -326,7 +326,7 @@ public class XWPFRun implements ISDTContents, IRunElement, CharacterRun { /** * Return the string content of this text run * - * @return the text of this text run or <code>null</code> if not set + * @return the text of this text run or {@code null} if not set */ public String getText(int pos) { return run.sizeOfTArray() == 0 ? null : run.getTArray(pos) @@ -368,7 +368,7 @@ public class XWPFRun implements ISDTContents, IRunElement, CharacterRun { * Whether the italic property should be applied to all non-complex script * characters in the contents of this run when displayed in a document. * - * @return <code>true</code> if the italic property is applied + * @return {@code true} if the italic property is applied */ @Override public boolean isItalic() { @@ -380,25 +380,22 @@ public class XWPFRun implements ISDTContents, IRunElement, CharacterRun { * Whether the bold property shall be applied to all non-complex script * characters in the contents of this run when displayed in a document * <p> - * <p> * This formatting property is a toggle property, which specifies that its * behavior differs between its use within a style definition and its use as * direct formatting. When used as part of a style definition, setting this * property shall toggle the current state of that property as specified up * to this point in the hierarchy (i.e. applied to not applied, and vice - * versa). Setting it to <code>false</code> (or an equivalent) shall + * versa). Setting it to {@code false} (or an equivalent) shall * result in the current setting remaining unchanged. However, when used as * direct formatting, setting this property to true or false shall set the * absolute state of the resulting property. - * </p> * <p> * If this element is not present, the default value is to leave the * formatting applied at previous level in the style hierarchy. If this * element is never applied in the style hierarchy, then bold shall not be * applied to non-complex script characters. - * </p> * - * @param value <code>true</code> if the italic property is applied to + * @param value {@code true} if the italic property is applied to * this run */ @Override @@ -412,7 +409,7 @@ public class XWPFRun implements ISDTContents, IRunElement, CharacterRun { * Get the underline setting for the run. * * @return the Underline pattern applied to this run - * @see (@link UnderlinePatterns} + * @see UnderlinePatterns */ public UnderlinePatterns getUnderline() { UnderlinePatterns value = UnderlinePatterns.NONE; @@ -438,10 +435,11 @@ public class XWPFRun implements ISDTContents, IRunElement, CharacterRun { * * @param value - * underline type - * @see {@link UnderlinePatterns} : all possible patterns that could be applied + * @see UnderlinePatterns */ public void setUnderline(UnderlinePatterns value) { CTUnderline underline = getCTUnderline(true); + assert(underline != null); underline.setVal(STUnderline.Enum.forInt(value.getValue())); } @@ -463,7 +461,8 @@ public class XWPFRun implements ISDTContents, IRunElement, CharacterRun { */ public void setUnderlineColor(String color) { CTUnderline underline = getCTUnderline(true); - SimpleValue svColor = null; + assert(underline != null); + SimpleValue svColor; if (color.equals("auto")) { STHexColorAuto hexColor = STHexColorAuto.Factory.newInstance(); hexColor.setEnumValue(STHexColorAuto.Enum.forString(color)); @@ -484,6 +483,7 @@ public class XWPFRun implements ISDTContents, IRunElement, CharacterRun { */ public void setUnderlineThemeColor(String themeColor) { CTUnderline underline = getCTUnderline(true); + assert(underline != null); STThemeColor.Enum val = STThemeColor.Enum.forString(themeColor); if (val != null) { underline.setThemeColor(val); @@ -513,6 +513,7 @@ public class XWPFRun implements ISDTContents, IRunElement, CharacterRun { */ public String getUnderlineColor() { CTUnderline underline = getCTUnderline(true); + assert(underline != null); String colorName = "auto"; Object rawValue = underline.getColor(); if (rawValue != null) { @@ -530,7 +531,7 @@ public class XWPFRun implements ISDTContents, IRunElement, CharacterRun { * Specifies that the contents of this run shall be displayed with a single * horizontal line through the center of the line. * - * @return <code>true</code> if the strike property is applied + * @return {@code true} if the strike property is applied */ @Override public boolean isStrikeThrough() { @@ -559,7 +560,7 @@ public class XWPFRun implements ISDTContents, IRunElement, CharacterRun { * not be applied to the contents of this run. * </p> * - * @param value <code>true</code> if the strike property is applied to + * @param value {@code true} if the strike property is applied to * this run */ @Override @@ -583,7 +584,7 @@ public class XWPFRun implements ISDTContents, IRunElement, CharacterRun { * Specifies that the contents of this run shall be displayed with a double * horizontal line through the center of the line. * - * @return <code>true</code> if the double strike property is applied + * @return {@code true} if the double strike property is applied */ @Override public boolean isDoubleStrikeThrough() { @@ -714,10 +715,7 @@ public class XWPFRun implements ISDTContents, IRunElement, CharacterRun { return false; } STHighlightColor.Enum val = pr.getHighlightArray(0).getVal(); - if (val == null || val == STHighlightColor.NONE) { - return false; - } - return true; + return val != null && val != STHighlightColor.NONE; } // TODO Provide a wrapper round STHighlightColor, then expose getter/setter // for the highlight colour. Ideally also then add to CharacterRun interface @@ -1178,13 +1176,10 @@ public class XWPFRun implements ISDTContents, IRunElement, CharacterRun { * this method add chart template into document * * @param chartRelId relation id of chart in document relation file - * @throws InvalidFormatException - * @throws IOException * @since POI 4.0.0 */ @Internal - public CTInline addChart(String chartRelId) - throws InvalidFormatException, IOException { + public CTInline addChart(String chartRelId) throws InvalidFormatException, IOException { try { CTInline inline = run.addNewDrawing().addNewInline(); @@ -1422,7 +1417,7 @@ public class XWPFRun implements ISDTContents, IRunElement, CharacterRun { /** * @see <a href="http://msdn.microsoft.com/en-us/library/ff533743(v=office.12).aspx">[MS-OI29500] Run Fonts</a> */ - public static enum FontCharRange { + public enum FontCharRange { ascii /* char 0-127 */, cs /* complex symbol */, eastAsia /* east asia */, @@ -1461,7 +1456,7 @@ public class XWPFRun implements ISDTContents, IRunElement, CharacterRun { /** * Set the highlight color for the run. Silently does nothing of colorName is not a recognized value. * - * @param colorName The name of the color as defined in the ST_HighlightColor simple type ({@link STHightlightColor}) + * @param colorName The name of the color as defined in the ST_HighlightColor simple type ({@link STHighlightColor}) * @since 4.0.0 */ public void setTextHighlightColor(String colorName) { diff --git a/poi-scratchpad/src/main/java/org/apache/poi/hwpf/model/types/CHPAbstractType.java b/poi-scratchpad/src/main/java/org/apache/poi/hwpf/model/types/CHPAbstractType.java index e18a3e724b..4e9c83f585 100644 --- a/poi-scratchpad/src/main/java/org/apache/poi/hwpf/model/types/CHPAbstractType.java +++ b/poi-scratchpad/src/main/java/org/apache/poi/hwpf/model/types/CHPAbstractType.java @@ -924,12 +924,7 @@ public abstract class CHPAbstractType { /** * Emphasis mark. * - * @return One of - * <li>{@link #KCD_NON} - * <li>{@link #KCD_DOT} - * <li>{@link #KCD_COMMA} - * <li>{@link #KCD_CIRCLE} - * <li>{@link #KCD_UNDER_DOT} + * @return One of {@link #KCD_NON},{@link #KCD_DOT},{@link #KCD_COMMA},{@link #KCD_CIRCLE},{@link #KCD_UNDER_DOT} */ @Internal public byte getKcd() @@ -940,13 +935,7 @@ public abstract class CHPAbstractType { /** * Emphasis mark. * - * @param field_13_kcd - * One of - * <li>{@link #KCD_NON} - * <li>{@link #KCD_DOT} - * <li>{@link #KCD_COMMA} - * <li>{@link #KCD_CIRCLE} - * <li>{@link #KCD_UNDER_DOT} + * @param field_13_kcd One of {@link #KCD_NON}, {@link #KCD_DOT}, {@link #KCD_COMMA}, {@link #KCD_CIRCLE}, {@link #KCD_UNDER_DOT} */ @Internal public void setKcd( byte field_13_kcd ) @@ -975,10 +964,7 @@ public abstract class CHPAbstractType { /** * Superscript/subscript indices. * - * @return One of - * <li>{@link #ISS_NONE} - * <li>{@link #ISS_SUPERSCRIPTED} - * <li>{@link #ISS_SUBSCRIPTED} + * @return One of {@link #ISS_NONE},{@link #ISS_SUPERSCRIPTED},{@link #ISS_SUBSCRIPTED} */ @Internal public byte getIss() @@ -989,11 +975,7 @@ public abstract class CHPAbstractType { /** * Superscript/subscript indices. * - * @param field_15_iss - * One of - * <li>{@link #ISS_NONE} - * <li>{@link #ISS_SUPERSCRIPTED} - * <li>{@link #ISS_SUBSCRIPTED} + * @param field_15_iss One of {@link #ISS_NONE},{@link #ISS_SUPERSCRIPTED},{@link #ISS_SUBSCRIPTED} */ @Internal public void setIss( byte field_15_iss ) @@ -1058,27 +1040,11 @@ public abstract class CHPAbstractType { /** * Underline code. * - * @return One of - * <li>{@link #KUL_NONE} - * <li>{@link #KUL_SINGLE} - * <li>{@link #KUL_BY_WORD} - * <li>{@link #KUL_DOUBLE} - * <li>{@link #KUL_DOTTED} - * <li>{@link #KUL_HIDDEN} - * <li>{@link #KUL_THICK} - * <li>{@link #KUL_DASH} - * <li>{@link #KUL_DOT} - * <li>{@link #KUL_DOT_DASH} - * <li>{@link #KUL_DOT_DOT_DASH} - * <li>{@link #KUL_WAVE} - * <li>{@link #KUL_DOTTED_HEAVY} - * <li>{@link #KUL_DASHED_HEAVY} - * <li>{@link #KUL_DOT_DASH_HEAVY} - * <li>{@link #KUL_DOT_DOT_DASH_HEAVY} - * <li>{@link #KUL_WAVE_HEAVY} - * <li>{@link #KUL_DASH_LONG} - * <li>{@link #KUL_WAVE_DOUBLE} - * <li>{@link #KUL_DASH_LONG_HEAVY} + * @return One of {@link #KUL_NONE},{@link #KUL_SINGLE},{@link #KUL_BY_WORD},{@link #KUL_DOUBLE}, + * {@link #KUL_DOTTED},{@link #KUL_HIDDEN},{@link #KUL_THICK},{@link #KUL_DASH},{@link #KUL_DOT}, + * {@link #KUL_DOT_DASH},{@link #KUL_DOT_DOT_DASH},{@link #KUL_WAVE},{@link #KUL_DOTTED_HEAVY}, + * {@link #KUL_DASHED_HEAVY},{@link #KUL_DOT_DASH_HEAVY},{@link #KUL_DOT_DOT_DASH_HEAVY}, + * {@link #KUL_WAVE_HEAVY},{@link #KUL_DASH_LONG},{@link #KUL_WAVE_DOUBLE},{@link #KUL_DASH_LONG_HEAVY} */ @Internal public byte getKul() @@ -1089,28 +1055,11 @@ public abstract class CHPAbstractType { /** * Underline code. * - * @param field_19_kul - * One of - * <li>{@link #KUL_NONE} - * <li>{@link #KUL_SINGLE} - * <li>{@link #KUL_BY_WORD} - * <li>{@link #KUL_DOUBLE} - * <li>{@link #KUL_DOTTED} - * <li>{@link #KUL_HIDDEN} - * <li>{@link #KUL_THICK} - * <li>{@link #KUL_DASH} - * <li>{@link #KUL_DOT} - * <li>{@link #KUL_DOT_DASH} - * <li>{@link #KUL_DOT_DOT_DASH} - * <li>{@link #KUL_WAVE} - * <li>{@link #KUL_DOTTED_HEAVY} - * <li>{@link #KUL_DASHED_HEAVY} - * <li>{@link #KUL_DOT_DASH_HEAVY} - * <li>{@link #KUL_DOT_DOT_DASH_HEAVY} - * <li>{@link #KUL_WAVE_HEAVY} - * <li>{@link #KUL_DASH_LONG} - * <li>{@link #KUL_WAVE_DOUBLE} - * <li>{@link #KUL_DASH_LONG_HEAVY} + * @param field_19_kul One of,{@link #KUL_NONE},{@link #KUL_SINGLE},{@link #KUL_BY_WORD},{@link #KUL_DOUBLE}, + * {@link #KUL_DOTTED},{@link #KUL_HIDDEN},{@link #KUL_THICK},{@link #KUL_DASH},{@link #KUL_DOT}, + * {@link #KUL_DOT_DASH},{@link #KUL_DOT_DOT_DASH},{@link #KUL_WAVE},{@link #KUL_DOTTED_HEAVY}, + * {@link #KUL_DASHED_HEAVY},{@link #KUL_DOT_DASH_HEAVY},{@link #KUL_DOT_DOT_DASH_HEAVY}, + * {@link #KUL_WAVE_HEAVY},{@link #KUL_DASH_LONG},{@link #KUL_WAVE_DOUBLE},{@link #KUL_DASH_LONG_HEAVY} */ @Internal public void setKul( byte field_19_kul ) @@ -1229,14 +1178,9 @@ public abstract class CHPAbstractType { /** * Text animation. * - * @return One of - * <li>{@link #SFXTTEXT_NO} - * <li>{@link #SFXTTEXT_LAS_VEGAS_LIGHTS} - * <li>{@link #SFXTTEXT_BACKGROUND_BLINK} - * <li>{@link #SFXTTEXT_SPARKLE_TEXT} - * <li>{@link #SFXTTEXT_MARCHING_ANTS} - * <li>{@link #SFXTTEXT_MARCHING_RED_ANTS} - * <li>{@link #SFXTTEXT_SHIMMER} + * @return One of {@link #SFXTTEXT_NO},{@link #SFXTTEXT_LAS_VEGAS_LIGHTS},{@link #SFXTTEXT_BACKGROUND_BLINK}, + * {@link #SFXTTEXT_SPARKLE_TEXT},{@link #SFXTTEXT_MARCHING_ANTS},{@link #SFXTTEXT_MARCHING_RED_ANTS}, + * {@link #SFXTTEXT_SHIMMER} */ @Internal public byte getSfxtText() @@ -1247,15 +1191,7 @@ public abstract class CHPAbstractType { /** * Text animation. * - * @param field_26_sfxtText - * One of - * <li>{@link #SFXTTEXT_NO} - * <li>{@link #SFXTTEXT_LAS_VEGAS_LIGHTS} - * <li>{@link #SFXTTEXT_BACKGROUND_BLINK} - * <li>{@link #SFXTTEXT_SPARKLE_TEXT} - * <li>{@link #SFXTTEXT_MARCHING_ANTS} - * <li>{@link #SFXTTEXT_MARCHING_RED_ANTS} - * <li>{@link #SFXTTEXT_SHIMMER} + * @param field_26_sfxtText One of {@link #SFXTTEXT_NO},{@link #SFXTTEXT_LAS_VEGAS_LIGHTS},{@link #SFXTTEXT_BACKGROUND_BLINK},{@link #SFXTTEXT_SPARKLE_TEXT},{@link #SFXTTEXT_MARCHING_ANTS},{@link #SFXTTEXT_MARCHING_RED_ANTS},{@link #SFXTTEXT_SHIMMER} */ @Internal public void setSfxtText( byte field_26_sfxtText ) @@ -1932,11 +1868,7 @@ public abstract class CHPAbstractType { /** * Line BReak code for xchCRJ. * - * @return One of - * <li>{@link #LBRCRJ_NONE} - * <li>{@link #LBRCRJ_LEFT} - * <li>{@link #LBRCRJ_RIGHT} - * <li>{@link #LBRCRJ_BOTH} + * @return One of {@link #LBRCRJ_NONE},{@link #LBRCRJ_LEFT},{@link #LBRCRJ_RIGHT},{@link #LBRCRJ_BOTH} */ @Internal public byte getLbrCRJ() @@ -1947,12 +1879,7 @@ public abstract class CHPAbstractType { /** * Line BReak code for xchCRJ. * - * @param field_64_lbrCRJ - * One of - * <li>{@link #LBRCRJ_NONE} - * <li>{@link #LBRCRJ_LEFT} - * <li>{@link #LBRCRJ_RIGHT} - * <li>{@link #LBRCRJ_BOTH} + * @param field_64_lbrCRJ One of {@link #LBRCRJ_NONE},{@link #LBRCRJ_LEFT},{@link #LBRCRJ_RIGHT},{@link #LBRCRJ_BOTH} */ @Internal public void setLbrCRJ( byte field_64_lbrCRJ ) |