fix javadocs

git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1888805 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Andreas Beeker 2021-04-15 22:28:11 +00:00
parent e7a2df7dda
commit 7ab1c9c0fd
18 changed files with 166 additions and 192 deletions

View File

@ -25,7 +25,7 @@ import org.apache.poi.util.Beta;
import org.apache.poi.xssf.usermodel.XSSFSheet;
/**
* A variant of SXSSFSheet that uses a <code>RowGeneratorFunction</code></code> to lazily create rows.
* A variant of SXSSFSheet that uses a {@code RowGeneratorFunction} to lazily create rows.
*
* This variant is experimental and APIs may change at short notice.
*
@ -36,20 +36,20 @@ import org.apache.poi.xssf.usermodel.XSSFSheet;
@Beta
public class DeferredSXSSFSheet extends SXSSFSheet {
private RowGeneratorFunction rowGenerator;
public DeferredSXSSFSheet(DeferredSXSSFWorkbook workbook, XSSFSheet xSheet) throws IOException {
super(workbook, xSheet, workbook.getRandomAccessWindowSize());
}
@Override
public InputStream getWorksheetXMLInputStream() throws IOException {
throw new RuntimeException("Not supported by DeferredSXSSFSheet");
}
public void setRowGenerator(RowGeneratorFunction rowGenerator) {
this.rowGenerator = rowGenerator;
}
public void writeRows(OutputStream out) throws IOException {
// delayed creation of SheetDataWriter
_writer = ((DeferredSXSSFWorkbook) _workbook).createSheetDataWriter(out);

View File

@ -30,10 +30,10 @@ import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTDefinedName;
* Represents a defined named range in a SpreadsheetML workbook.
* <p>
* Defined names are descriptive text that is used to represents a cell, range of cells, formula, or constant value.
* Use easy-to-understand names, such as Products, to refer to hard to understand ranges, such as <code>Sales!C20:C30</code>.
* Use easy-to-understand names, such as Products, to refer to hard to understand ranges, such as {@code Sales!C20:C30}.
* </p>
* Example:
* <pre><blockquote>
* <pre>{@code
* XSSFWorkbook wb = new XSSFWorkbook();
* XSSFSheet sh = wb.createSheet("Sheet1");
*
@ -49,7 +49,7 @@ import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTDefinedName;
* name2.setLocalSheetId(0);
* name2.setRefersToFormula("Sheet1!$B$3");
*
* </blockquote></pre>
* }</pre>
*/
public final class XSSFName implements Name {
@ -79,11 +79,13 @@ public final class XSSFName implements Name {
public static final String BUILTIN_EXTRACT = "_xlnm.Extract:";
/**
* ?an be one of the following
* Can be one of the following
* <ul>
* <li> this defined name refers to a range to which an advanced filter has been
* applied. This represents the source data range, unfiltered.
* <li> This defined name refers to a range to which an AutoFilter has been
* applied
* </ul>
*/
public static final String BUILTIN_FILTER_DB = "_xlnm._FilterDatabase";
@ -102,8 +104,8 @@ public final class XSSFName implements Name {
*/
public static final String BUILTIN_SHEET_TITLE = "_xlnm.Sheet_Title";
private XSSFWorkbook _workbook;
private CTDefinedName _ctName;
private final XSSFWorkbook _workbook;
private final CTDefinedName _ctName;
/**
* Creates an XSSFName object - called internally by XSSFWorkbook.
@ -129,6 +131,7 @@ public final class XSSFName implements Name {
*
* @return text name of this defined name
*/
@Override
public String getNameName() {
return _ctName.getName();
}
@ -140,7 +143,7 @@ public final class XSSFName implements Name {
* <p>
* A name must always be unique within its scope. POI prevents you from defining a name that is not unique
* within its scope. However you can use the same name in different scopes. Example:
* <pre><blockquote>
* <pre>{@code
* //by default names are workbook-global
* XSSFName name;
* name = workbook.createName();
@ -158,11 +161,12 @@ public final class XSSFName implements Name {
* name.setSheetIndex(0);
* name.setNameName("sales_08"); //will throw an exception: "The sheet already contains this name (case-insensitive)"
*
* </blockquote></pre>
* </p>
* }</pre>
*
* @param name name of this defined name
* @throws IllegalArgumentException if the name is invalid or the workbook already contains this name (case-insensitive)
*/
@Override
public void setNameName(String name) {
validateName(name);
@ -180,6 +184,7 @@ public final class XSSFName implements Name {
_workbook.updateName(this, oldName);
}
@Override
public String getRefersToFormula() {
String result = _ctName.getStringValue();
if (result == null || result.length() < 1) {
@ -188,6 +193,7 @@ public final class XSSFName implements Name {
return result;
}
@Override
public void setRefersToFormula(String formulaText) {
XSSFEvaluationWorkbook fpb = XSSFEvaluationWorkbook.create(_workbook);
//validate through the FormulaParser
@ -196,6 +202,7 @@ public final class XSSFName implements Name {
_ctName.setStringValue(formulaText);
}
@Override
public boolean isDeleted(){
String formulaText = getRefersToFormula();
if (formulaText == null) {
@ -211,6 +218,7 @@ public final class XSSFName implements Name {
*
* @param index the sheet index this name applies to, -1 unsets this property making the name workbook-global
*/
@Override
public void setSheetIndex(int index) {
int lastSheetIx = _workbook.getNumberOfSheets() - 1;
if (index < -1 || index > lastSheetIx) {
@ -230,6 +238,7 @@ public final class XSSFName implements Name {
*
* @return the sheet index this name applies to, -1 if this name applies to the entire workbook
*/
@Override
public int getSheetIndex() {
return _ctName.isSetLocalSheetId() ? (int) _ctName.getLocalSheetId() : -1;
}
@ -238,8 +247,9 @@ public final class XSSFName implements Name {
* Indicates that the defined name refers to a user-defined function.
* This attribute is used when there is an add-in or other code project associated with the file.
*
* @param value <code>true</code> indicates the name refers to a function.
* @param value {@code true} indicates the name refers to a function.
*/
@Override
public void setFunction(boolean value) {
_ctName.setFunction(value);
}
@ -248,7 +258,7 @@ public final class XSSFName implements Name {
* Indicates that the defined name refers to a user-defined function.
* This attribute is used when there is an add-in or other code project associated with the file.
*
* @return <code>true</code> indicates the name refers to a function.
* @return {@code true} indicates the name refers to a function.
*/
public boolean getFunction() {
return _ctName.getFunction();
@ -282,6 +292,7 @@ public final class XSSFName implements Name {
* @return sheet name, which this named range referred to.
* Empty string if the referenced sheet name was not found.
*/
@Override
public String getSheetName() {
if (_ctName.isSetLocalSheetId()) {
// Given as explicit sheet id
@ -296,8 +307,9 @@ public final class XSSFName implements Name {
/**
* Is the name refers to a user-defined function ?
*
* @return <code>true</code> if this name refers to a user-defined function
* @return {@code true} if this name refers to a user-defined function
*/
@Override
public boolean isFunctionName() {
return getFunction();
}
@ -308,6 +320,7 @@ public final class XSSFName implements Name {
*
* @return true if this name is a hidden one
*/
@Override
public boolean isHidden() {
return _ctName.getHidden();
}
@ -317,6 +330,7 @@ public final class XSSFName implements Name {
*
* @return the user comment for this named range
*/
@Override
public String getComment() {
return _ctName.getComment();
}
@ -326,6 +340,7 @@ public final class XSSFName implements Name {
*
* @param comment the user comment for this named range
*/
@Override
public void setComment(String comment) {
_ctName.setComment(comment);
}
@ -337,12 +352,12 @@ public final class XSSFName implements Name {
/**
* Compares this name to the specified object.
* The result is <code>true</code> if the argument is XSSFName and the
* The result is {@code true} if the argument is XSSFName and the
* underlying CTDefinedName bean equals to the CTDefinedName representing this name
*
* @param o the object to compare this <code>XSSFName</code> against.
* @return <code>true</code> if the <code>XSSFName </code>are equal;
* <code>false</code> otherwise.
* @param o the object to compare this {@code XSSFName} against.
* @return {@code true} if the {@code XSSFName }are equal;
* {@code false} otherwise.
*/
@Override
public boolean equals(Object o) {
@ -372,8 +387,6 @@ public final class XSSFName implements Name {
* Case sensitivity: all names are case-insensitive
*
* Uniqueness: must be unique (for names with the same scope)
*
* @param name
*/
private static void validateName(String name) {

View File

@ -102,12 +102,12 @@ public class XSSFRow implements Row, Comparable<XSSFRow> {
/**
* Cell iterator over the physically defined cells:
* <blockquote><pre>
* <pre>{@code
* for (Iterator<Cell> it = row.cellIterator(); it.hasNext(); ) {
* Cell cell = it.next();
* ...
* }
* </pre></blockquote>
* }</pre>
*
* @return an iterator over cells in this row.
*/
@ -133,22 +133,22 @@ public class XSSFRow implements Row, Comparable<XSSFRow> {
}
/**
* Compares two <code>XSSFRow</code> objects. Two rows are equal if they belong to the same worksheet and
* Compares two {@code XSSFRow} objects. Two rows are equal if they belong to the same worksheet and
* their row indexes are equal.
*
* @param other the <code>XSSFRow</code> to be compared.
* @param other the {@code XSSFRow} to be compared.
* @return <ul>
* <li>
* the value <code>0</code> if the row number of this <code>XSSFRow</code> is
* equal to the row number of the argument <code>XSSFRow</code>
* the value {@code 0} if the row number of this {@code XSSFRow} is
* equal to the row number of the argument {@code XSSFRow}
* </li>
* <li>
* a value less than <code>0</code> if the row number of this this <code>XSSFRow</code> is
* numerically less than the row number of the argument <code>XSSFRow</code>
* a value less than {@code 0} if the row number of this this {@code XSSFRow} is
* numerically less than the row number of the argument {@code XSSFRow}
* </li>
* <li>
* a value greater than <code>0</code> if the row number of this this <code>XSSFRow</code> is
* numerically greater than the row number of the argument <code>XSSFRow</code>
* a value greater than {@code 0} if the row number of this this {@code XSSFRow} is
* numerically greater than the row number of the argument {@code XSSFRow}
* </li>
* </ul>
* @throws IllegalArgumentException if the argument row belongs to a different worksheet
@ -186,7 +186,7 @@ public class XSSFRow implements Row, Comparable<XSSFRow> {
* 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}.
* </p>
* @param columnIndex - the column number this cell represents
* @return Cell a high level representation of the created cell.
@ -359,7 +359,7 @@ public class XSSFRow implements Row, Comparable<XSSFRow> {
/**
* Set the height in "twips" or 1/20th of a point.
*
* @param height the height in "twips" or 1/20th of a point. <code>-1</code> resets to the default height
* @param height the height in "twips" or 1/20th of a point. {@code -1} resets to the default height
*/
@Override
public void setHeight(short height) {
@ -380,7 +380,7 @@ public class XSSFRow implements Row, Comparable<XSSFRow> {
/**
* Set the row's height in points.
*
* @param height the height in points. <code>-1</code> resets to the default height
* @param height the height in points. {@code -1} resets to the default height
*/
@Override
public void setHeightInPoints(float height) {

View File

@ -813,22 +813,19 @@ public class XSSFWorkbook extends POIXMLDocument implements Workbook, Date1904Su
/**
* Create a new sheet for this Workbook and return the high level representation.
* Use this to create new sheets.
*
* <p>
* Note that Excel allows sheet names up to 31 chars in length but other applications
* (such as OpenOffice) allow more. Some versions of Excel crash with names longer than 31 chars,
* others - truncate such names to 31 character.
* </p>
* Note that Excel allows sheet names up to 31 chars in length but other applications
* (such as OpenOffice) allow more. Some versions of Excel crash with names longer than 31 chars,
* others - truncate such names to 31 character.
* <p>
* POI's SpreadsheetAPI silently truncates the input argument to 31 characters.
* Example:
* POI's SpreadsheetAPI silently truncates the input argument to 31 characters.
* Example:
*
* <pre>{@code
* Sheet sheet = workbook.createSheet("My very long sheet name which is longer than 31 chars"); // will be truncated
* assert 31 == sheet.getSheetName().length();
* assert "My very long sheet name which i" == sheet.getSheetName();
* }</pre>
* </p>
* <pre>{@code
* Sheet sheet = workbook.createSheet("My very long sheet name which is longer than 31 chars"); // will be truncated
* assert 31 == sheet.getSheetName().length();
* assert "My very long sheet name which i" == sheet.getSheetName();
* }</pre>
*
* Except the 31-character constraint, Excel applies some other rules:
* <p>
@ -845,12 +842,10 @@ public class XSSFWorkbook extends POIXMLDocument implements Workbook, Date1904Su
* <li> closing square bracket (]) </li>
* </ul>
* The string MUST NOT begin or end with the single quote (') character.
* </p>
*
* <p>
* See {@link WorkbookUtil#createSafeSheetName(String nameProposal)}
* for a safe way to create valid names
* </p>
*
* @param sheetname sheetname to set for the sheet.
* @return Sheet representing the new sheet.
* @throws IllegalArgumentException if the name is null or invalid

View File

@ -50,9 +50,9 @@ public enum BreakClear {
* </li>
* <li> If this line is not broken into multiple regions, then treat this
* break as a text wrapping break of type none. </li>
* </ul>
* <li> If the parent paragraph is right to left, then these behaviors are
* also reversed. </li>
* </ul>
*/
LEFT(2),
@ -81,7 +81,7 @@ public enum BreakClear {
*/
ALL(4);
private static Map<Integer, BreakClear> imap = new HashMap<>();
private static final Map<Integer, BreakClear> imap = new HashMap<>();
static {
for (BreakClear p : values()) {
@ -91,7 +91,7 @@ public enum BreakClear {
private final int value;
private BreakClear(int val) {
BreakClear(int val) {
value = val;
}

View File

@ -90,7 +90,6 @@ public class XWPFEndnotes extends XWPFAbstractFootnotesEndnotes {
/**
* Remove the specified footnote if present.
*
* @param pos
* @return True if the footnote was removed.
* @since 4.0.0
*/
@ -134,9 +133,6 @@ public class XWPFEndnotes extends XWPFAbstractFootnotesEndnotes {
/**
* add an {@link XWPFEndnote} to the document
*
* @param endnote
* @throws IOException
*/
public void addEndnote(XWPFEndnote endnote) {
listFootnote.add(endnote);
@ -148,7 +144,6 @@ public class XWPFEndnotes extends XWPFAbstractFootnotesEndnotes {
*
* @param note Note to add
* @return New {@link XWPFEndnote}
* @throws IOException
*/
@Internal
public XWPFEndnote addEndnote(CTFtnEdn note) {
@ -164,6 +159,7 @@ public class XWPFEndnotes extends XWPFAbstractFootnotesEndnotes {
* @param id End note ID.
* @return The end note or null if not found.
*/
@Override
public XWPFEndnote getFootnoteById(int id) {
return (XWPFEndnote)super.getFootnoteById(id);
}

View File

@ -136,7 +136,6 @@ public class XWPFFootnotes extends XWPFAbstractFootnotesEndnotes {
* Add an {@link XWPFFootnote} to the document
*
* @param footnote Footnote to add
* @throws IOException
*/
public void addFootnote(XWPFFootnote footnote) {
listFootnote.add(footnote);
@ -147,7 +146,6 @@ public class XWPFFootnotes extends XWPFAbstractFootnotesEndnotes {
* Add a CT footnote to the document
*
* @param note CTFtnEdn to add.
* @throws IOException
*/
@Internal
public XWPFFootnote addFootnote(CTFtnEdn note) {

View File

@ -93,6 +93,7 @@ public abstract class XWPFHeaderFooter extends POIXMLDocumentPart implements IBo
return headerFooter;
}
@Override
public List<IBodyElement> getBodyElements() {
return Collections.unmodifiableList(bodyElements);
}
@ -104,6 +105,7 @@ public abstract class XWPFHeaderFooter extends POIXMLDocumentPart implements IBo
* there could be more in certain cases, or
* a table.
*/
@Override
public List<XWPFParagraph> getParagraphs() {
return Collections.unmodifiableList(paragraphs);
}
@ -117,6 +119,7 @@ public abstract class XWPFHeaderFooter extends POIXMLDocumentPart implements IBo
* complex headers/footers have a table or two
* in addition.
*/
@Override
public List<XWPFTable> getTables() throws ArrayIndexOutOfBoundsException {
return Collections.unmodifiableList(tables);
}
@ -129,9 +132,9 @@ public abstract class XWPFHeaderFooter extends POIXMLDocumentPart implements IBo
public String getText() {
StringBuilder t = new StringBuilder(64);
//TODO: simplify this to get ibody elements in order
for (int i = 0; i < paragraphs.size(); i++) {
if (!paragraphs.get(i).isEmpty()) {
String text = paragraphs.get(i).getText();
for (XWPFParagraph paragraph : paragraphs) {
if (!paragraph.isEmpty()) {
String text = paragraph.getText();
if (text != null && text.length() > 0) {
t.append(text);
t.append('\n');
@ -139,8 +142,8 @@ public abstract class XWPFHeaderFooter extends POIXMLDocumentPart implements IBo
}
}
for (int i = 0; i < tables.size(); i++) {
String text = tables.get(i).getText();
for (XWPFTable table : tables) {
String text = table.getText();
if (text != null && text.length() > 0) {
t.append(text);
t.append('\n');
@ -149,7 +152,7 @@ public abstract class XWPFHeaderFooter extends POIXMLDocumentPart implements IBo
for (IBodyElement bodyElement : getBodyElements()) {
if (bodyElement instanceof XWPFSDT) {
t.append(((XWPFSDT) bodyElement).getContent().getText() + '\n');
t.append(((XWPFSDT) bodyElement).getContent().getText()).append('\n');
}
}
return t.toString();
@ -167,9 +170,8 @@ public abstract class XWPFHeaderFooter extends POIXMLDocumentPart implements IBo
* if there is a corresponding {@link XWPFTable} of the parameter ctTable in the tableList of this header
* the method will return this table
* if there is no corresponding {@link XWPFTable} the method will return null
*
* @param ctTable
*/
@Override
public XWPFTable getTable(CTTbl ctTable) {
for (XWPFTable table : tables) {
if (table == null)
@ -193,6 +195,7 @@ public abstract class XWPFHeaderFooter extends POIXMLDocumentPart implements IBo
* Returns the paragraph that holds
* the text of the header or footer.
*/
@Override
public XWPFParagraph getParagraphArray(int pos) {
if(pos >= 0 && pos<paragraphs.size()){
return paragraphs.get(pos);
@ -283,9 +286,7 @@ public abstract class XWPFHeaderFooter extends POIXMLDocumentPart implements IBo
/**
* returns the PictureData by blipID
*
* @param blipID
* @return XWPFPictureData of a specificID
* @throws Exception
*/
public XWPFPictureData getPictureDataByID(String blipID) {
POIXMLDocumentPart relatedPart = getRelationById(blipID);
@ -368,9 +369,9 @@ public abstract class XWPFHeaderFooter extends POIXMLDocumentPart implements IBo
/**
* add a new paragraph at position of the cursor
*
* @param cursor
* @return the inserted paragraph
*/
@Override
public XWPFParagraph insertNewParagraph(XmlCursor cursor) {
if (isCursorInHdrF(cursor)) {
String uri = CTP.type.getName().getNamespaceURI();
@ -410,9 +411,9 @@ public abstract class XWPFHeaderFooter extends POIXMLDocumentPart implements IBo
/**
* @param cursor
* @return the inserted table
*/
@Override
public XWPFTable insertNewTbl(final XmlCursor cursor) {
if (isCursorInHdrF(cursor)) {
String uri = CTTbl.type.getName().getNamespaceURI();
@ -453,8 +454,6 @@ public abstract class XWPFHeaderFooter extends POIXMLDocumentPart implements IBo
/**
* verifies that cursor is on the right position
*
* @param cursor
*/
private boolean isCursorInHdrF(XmlCursor cursor) {
XmlCursor verify = cursor.newCursor();
@ -471,9 +470,8 @@ public abstract class XWPFHeaderFooter extends POIXMLDocumentPart implements IBo
/**
* Returns the 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);
@ -483,10 +481,8 @@ public abstract class XWPFHeaderFooter extends POIXMLDocumentPart implements IBo
/**
* inserts an existing XWPFTable to the arrays bodyElements and tables
*
* @param pos
* @param table
*/
@Override
public void insertTable(int pos, XWPFTable table) {
bodyElements.add(pos, table);
int i = 0;
@ -526,9 +522,8 @@ public abstract class XWPFHeaderFooter extends POIXMLDocumentPart implements IBo
/**
* get the TableCell which belongs to the TableCell
*
* @param cell
*/
@Override
public XWPFTableCell getTableCell(CTTc cell) {
XmlCursor cursor = cell.newCursor();
cursor.toParent();
@ -553,6 +548,7 @@ public abstract class XWPFHeaderFooter extends POIXMLDocumentPart implements IBo
return tableRow.getTableCell(cell);
}
@Override
public XWPFDocument getXWPFDocument() {
if (document != null) {
return document;
@ -567,9 +563,8 @@ public abstract class XWPFHeaderFooter extends POIXMLDocumentPart implements IBo
/**
* returns the Part, to which the body belongs, which you need for adding relationship to other parts
*
* @see org.apache.poi.xwpf.usermodel.IBody#getPart()
*/
@Override
public POIXMLDocumentPart getPart() {
return this;
}

View File

@ -33,11 +33,11 @@ import org.openxmlformats.schemas.officeDocument.x2006.sharedTypes.STOnOff1;
import org.openxmlformats.schemas.wordprocessingml.x2006.main.*;
/**
* <p>A Paragraph within a Document, Table, Header etc.</p>
* <p>
* <p>A paragraph has a lot of styling information, but the
* A Paragraph within a Document, Table, Header etc.<p>
*
* A paragraph has a lot of styling information, but the
* actual text (possibly along with more styling) is held on
* the child {@link XWPFRun}s.</p>
* the child {@link XWPFRun}s.
*/
public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Paragraph {
private final CTP paragraph;
@ -49,7 +49,7 @@ public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Para
protected List<XWPFRun> runs;
protected List<IRunElement> iruns;
private StringBuilder footnoteText = new StringBuilder(64);
private final StringBuilder footnoteText = new StringBuilder(64);
public XWPFParagraph(CTP prgrph, IBody part) {
this.paragraph = prgrph;
@ -176,8 +176,6 @@ public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Para
/**
* Return literal runs and sdt/content control objects.
*
* @return List<IRunElement>
*/
public List<IRunElement> getIRuns() {
return Collections.unmodifiableList(iruns);
@ -252,8 +250,6 @@ public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Para
/**
* setNumID of Paragraph
*
* @param numPos
*/
public void setNumID(BigInteger numPos) {
if (paragraph.getPPr() == null) {
@ -271,7 +267,6 @@ public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Para
/**
* setNumILvl of Paragraph
*
* @param iLvl
* @since 4.1.2
*/
public void setNumILvl(BigInteger iLvl) {
@ -484,13 +479,11 @@ public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Para
* Returns the paragraph alignment which shall be applied to text in this
* paragraph.
* <p>
* <p>
* If this element is not set on a given paragraph, its value is determined
* by the setting previously set at any level of the style hierarchy (i.e.
* that previous setting remains unchanged). If this setting is never
* specified in the style hierarchy, then no alignment is applied to the
* paragraph.
* </p>
*
* @return the paragraph alignment of this paragraph.
*/
@ -504,13 +497,11 @@ public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Para
* Specifies the paragraph alignment which shall be applied to text in this
* paragraph.
* <p>
* <p>
* If this element is not set on a given paragraph, its value is determined
* by the setting previously set at any level of the style hierarchy (i.e.
* that previous setting remains unchanged). If this setting is never
* specified in the style hierarchy, then no alignment is applied to the
* paragraph.
* </p>
*
* @param align the paragraph alignment to apply to this paragraph.
*/
@ -610,7 +601,6 @@ public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Para
* Specifies the border which shall be displayed above a set of paragraphs
* which have the same set of paragraph border settings.
* <p>
* <p>
* To determine if any two adjoining paragraphs shall have an individual top
* and bottom border or a between border, the set of borders on the two
* adjoining paragraphs are compared. If the border information on those two
@ -620,14 +610,13 @@ public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Para
* respectively. If this border specifies a space attribute, that value
* determines the space above the text (ignoring any spacing above) which
* should be left before this border is drawn, specified in points.
* </p>
* <p>
* If this element is omitted on a given paragraph, its value is determined
* by the setting previously set at any level of the style hierarchy (i.e.
* that previous setting remains unchanged). If this setting is never
* specified in the style hierarchy, then no between border shall be applied
* above identical paragraphs.
* </p>
* <p>
* <b>This border can only be a line border.</b>
*
* @param border one of the defined Border styles, see {@link Borders}
@ -1466,8 +1455,6 @@ public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Para
/**
* add a new run at the end of the position of
* the content of parameter run
*
* @param run
*/
protected void addRun(CTR run) {
int pos;
@ -1643,9 +1630,6 @@ public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Para
/**
* verifies that cursor is on the right position
*
* @param cursor
* @return
*/
private boolean isCursorInParagraph(XmlCursor cursor) {
XmlCursor verify = cursor.newCursor();
@ -1659,9 +1643,6 @@ public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Para
* this methods parse the paragraph and search for the string searched.
* If it finds the string, it will return true and the position of the String
* will be saved in the parameter startPos.
*
* @param searched
* @param startPos
*/
public TextSegment searchText(String searched, PositionInParagraph startPos) {
int startRun = startPos.getRun(),
@ -1731,8 +1712,6 @@ public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Para
/**
* get a Text
*
* @param segment
*/
public String getText(TextSegment segment) {
int runBegin = segment.getBeginRun();
@ -1770,7 +1749,6 @@ public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Para
/**
* removes a Run at the position pos in the paragraph
*
* @param pos
* @return true if the run was removed
*/
public boolean removeRun(int pos) {
@ -1810,9 +1788,7 @@ public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Para
/**
* Is there only one ctHyperlink in all runs
*
* @param run
* hyperlink run
* @return
* @param run hyperlink run
*/
private boolean isTheOnlyCTHyperlinkInRuns(XWPFHyperlinkRun run) {
CTHyperlink ctHyperlink = run.getCTHyperlink();
@ -1825,9 +1801,7 @@ public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Para
/**
* Is there only one ctField in all runs
*
* @param run
* field run
* @return
* @param run field run
*/
private boolean isTheOnlyCTFieldInRuns(XWPFFieldRun run) {
CTSimpleField ctField = run.getCTField();
@ -1838,8 +1812,6 @@ public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Para
/**
* returns the type of the BodyElement Paragraph
*
* @see org.apache.poi.xwpf.usermodel.IBodyElement#getElementType()
*/
@Override
public BodyElementType getElementType() {
@ -1876,8 +1848,6 @@ public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Para
/**
* adds a new Run to the Paragraph
*
* @param r
*/
public void addRun(XWPFRun r) {
if (!runs.contains(r)) {
@ -1887,8 +1857,6 @@ public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Para
/**
* return the XWPFRun-Element which owns the CTR run-Element
*
* @param r
*/
public XWPFRun getRun(CTR r) {
for (int i = 0; i < getRuns().size(); i++) {

View File

@ -73,9 +73,9 @@ public class XWPFSettings extends POIXMLDocumentPart {
* it sets the value of zoom
* <br>
* sample snippet from settings.xml
* <pre>
* &lt;w:zoom w:percent="50" /&gt;
* <pre>
* <pre>{@code
* <w:zoom w:percent="50" />
* }</pre>
*
* @return percentage as an integer of zoom level
*/
@ -97,9 +97,9 @@ public class XWPFSettings extends POIXMLDocumentPart {
* it sets the value of zoom
* <br>
* sample snippet from settings.xml
* <pre>
* &lt;w:zoom w:percent="50" /&gt;
* <pre>
* <pre>{@code
* <w:zoom w:percent="50" />
* }</pre>
*/
public void setZoomPercent(long zoomPercent) {
if (!ctSettings.isSetZoom()) {
@ -365,7 +365,7 @@ public class XWPFSettings extends POIXMLDocumentPart {
/**
* Check if revision tracking is turned on.
*
* @return <code>true</code> if revision tracking is turned on
* @return {@code true} if revision tracking is turned on
*/
public boolean isTrackRevisions() {
return ctSettings.isSetTrackRevisions();
@ -374,7 +374,7 @@ public class XWPFSettings extends POIXMLDocumentPart {
/**
* Enable or disable revision tracking.
*
* @param enable <code>true</code> to turn on revision tracking, <code>false</code> to turn off revision tracking
* @param enable {@code true} to turn on revision tracking, {@code false} to turn off revision tracking
*/
public void setTrackRevisions(boolean enable) {
if (enable) {
@ -432,8 +432,8 @@ public class XWPFSettings extends POIXMLDocumentPart {
/**
* Turn separate even-and-odd headings on or off
*
* @param enable <code>true</code> to turn on separate even and odd headings,
* <code>false</code> to turn off even and odd headings.
* @param enable {@code true} to turn on separate even and odd headings,
* {@code false} to turn off even and odd headings.
*/
public void setEvenAndOddHeadings(boolean enable) {
CTOnOff onOff = CTOnOff.Factory.newInstance();
@ -453,8 +453,8 @@ public class XWPFSettings extends POIXMLDocumentPart {
/**
* Turn mirrored margins on or off
*
* @param enable <code>true</code> to turn on mirrored margins,
* <code>false</code> to turn off mirrored marginss.
* @param enable {@code true} to turn on mirrored margins,
* {@code false} to turn off mirrored marginss.
*/
public void setMirrorMargins(boolean enable) {
CTOnOff onOff = CTOnOff.Factory.newInstance();

View File

@ -129,15 +129,15 @@ public final class HeadersFootersAtom extends RecordAtom {
/**
* record header
*/
private byte[] _header;
private final byte[] _header;
/**
* record data
*/
private byte[] _recdata;
private final byte[] _recdata;
/**
* Build an instance of <code>HeadersFootersAtom</code> from on-disk data
* Build an instance of {@code HeadersFootersAtom} from on-disk data
*/
protected HeadersFootersAtom(byte[] source, int start, int len) {
// Get the header
@ -148,7 +148,7 @@ public final class HeadersFootersAtom extends RecordAtom {
}
/**
* Create a new instance of <code>HeadersFootersAtom</code>
* Create a new instance of {@code HeadersFootersAtom}
*/
public HeadersFootersAtom() {
_recdata = new byte[4];
@ -158,6 +158,7 @@ public final class HeadersFootersAtom extends RecordAtom {
LittleEndian.putInt(_header, 4, _recdata.length);
}
@Override
public long getRecordType() {
return RecordTypes.HeadersFootersAtom.typeID;
}
@ -165,7 +166,8 @@ public final class HeadersFootersAtom extends RecordAtom {
/**
* Write the contents of the record back, so it can be written to disk
*/
public void writeOut(OutputStream out) throws IOException {
@Override
public void writeOut(OutputStream out) throws IOException {
out.write(_header);
out.write(_recdata);
}
@ -173,10 +175,9 @@ public final class HeadersFootersAtom extends RecordAtom {
/**
* A signed integer that specifies the format ID to be used to style the datetime.
* <p>
* It MUST be in the range [0, 12]. </br>
* It MUST be in the range [0, 12]. <p>
* This value is converted into a string as specified by the index field of the DateTimeMCAtom record.
* It MUST be ignored unless fHasTodayDate is TRUE.
* </b>
*
* @return A signed integer that specifies the format ID to be used to style the datetime.
*/
@ -196,6 +197,7 @@ public final class HeadersFootersAtom extends RecordAtom {
/**
* A bit mask specifying options for displaying headers and footers
*
* <ul>
* <li> A - {@link #fHasDate} (1 bit): A bit that specifies whether the date is displayed in the footer.
* <li> B - {@link #fHasTodayDate} (1 bit): A bit that specifies whether the current datetime is used for
* displaying the datetime.
@ -207,6 +209,7 @@ public final class HeadersFootersAtom extends RecordAtom {
* <li> F - {@link #fHasFooter} (1 bit): A bit that specifies whether the footer text specified by FooterAtom
* record is displayed.
* <li> reserved (10 bits): MUST be zero and MUST be ignored.
* </ul>
*
* @return A bit mask specifying options for displaying headers and footers
*/

View File

@ -121,12 +121,12 @@ public class InteractiveInfoAtom extends RecordAtom {
/**
* Record header.
*/
private byte[] _header;
private final byte[] _header;
/**
* Record data.
*/
private byte[] _data;
private final byte[] _data;
/**
* Constructs a brand new link related atom record.
@ -203,7 +203,7 @@ public class InteractiveInfoAtom extends RecordAtom {
/**
* Hyperlink Action.
* <p>
* see <code>ACTION_*</code> constants for the list of actions
* see {@code ACTION_*} constants for the list of actions
* </p>
*
* @return hyperlink action.
@ -215,7 +215,7 @@ public class InteractiveInfoAtom extends RecordAtom {
/**
* Hyperlink Action
* <p>
* see <code>ACTION_*</code> constants for the list of actions
* see {@code ACTION_*} constants for the list of actions
* </p>
*
* @param val hyperlink action.
@ -241,7 +241,7 @@ public class InteractiveInfoAtom extends RecordAtom {
/**
* Jump
* <p>
* see <code>JUMP_*</code> constants for the list of actions
* see {@code JUMP_*} constants for the list of actions
* </p>
*
* @return jump
@ -253,7 +253,7 @@ public class InteractiveInfoAtom extends RecordAtom {
/**
* Jump
* <p>
* see <code>JUMP_*</code> constants for the list of actions
* see {@code JUMP_*} constants for the list of actions
* </p>
*
* @param val jump
@ -264,12 +264,12 @@ public class InteractiveInfoAtom extends RecordAtom {
/**
* Flags
* <p>
* <ul>
* <li> Bit 1: Animated. If 1, then button is animated
* <li> Bit 2: Stop sound. If 1, then stop current sound when button is pressed.
* <li> Bit 3: CustomShowReturn. If 1, and this is a jump to custom show,
* then return to this slide after custom show.
* </p>
* </ul>
*/
public byte getFlags() {
return _data[11];
@ -277,12 +277,12 @@ public class InteractiveInfoAtom extends RecordAtom {
/**
* Flags
* <p>
* <ul>
* <li> Bit 1: Animated. If 1, then button is animated
* <li> Bit 2: Stop sound. If 1, then stop current sound when button is pressed.
* <li> Bit 3: CustomShowReturn. If 1, and this is a jump to custom show,
* then return to this slide after custom show.
* </p>
* </ul>
*/
public void setFlags(byte val) {
_data[11] = val;
@ -310,6 +310,7 @@ public class InteractiveInfoAtom extends RecordAtom {
* Gets the record type.
* @return the record type.
*/
@Override
public long getRecordType() { return RecordTypes.InteractiveInfoAtom.typeID; }
/**
@ -319,6 +320,7 @@ public class InteractiveInfoAtom extends RecordAtom {
* @param out the output stream to write to.
* @throws IOException if an error occurs.
*/
@Override
public void writeOut(OutputStream out) throws IOException {
out.write(_header);
out.write(_data);

View File

@ -38,7 +38,7 @@ import org.apache.poi.util.LittleEndianConsts;
* <br>
*
* Combination of effectType and effectDirection:
* <table>
* <table summary="">
* <tr><th>type</th><th>description</th><th>direction</th></tr>
* <tr><td>0</td><td>cut</td><td>0x00 = no transition, 0x01 = black transition</td></tr>
* <tr><td>1</td><td>random</td><td>0x00</td></tr>
@ -137,7 +137,7 @@ public class SSSlideInfoAtom extends RecordAtom {
private static final long _type = RecordTypes.SSSlideInfoAtom.typeID;
private byte[] _header;
private final byte[] _header;
/**
* A signed integer that specifies an amount of time, in milliseconds, to wait
@ -175,7 +175,7 @@ public class SSSlideInfoAtom extends RecordAtom {
* (0x00 = 0.75 seconds, 0x01 = 0.5 seconds, 0x02 = 0.25 seconds)
*/
private short _speed; // byte
private byte[] _unused; // 3-byte
private final byte[] _unused; // 3-byte
public SSSlideInfoAtom() {
_header = new byte[8];
@ -222,6 +222,7 @@ public class SSSlideInfoAtom extends RecordAtom {
* Write the contents of the record back, so it can be written
* to disk
*/
@Override
public void writeOut(OutputStream out) throws IOException {
// Header - size or type unchanged
out.write(_header);
@ -245,6 +246,7 @@ public class SSSlideInfoAtom extends RecordAtom {
/**
* We are of type 1017
*/
@Override
public long getRecordType() { return _type; }
@ -290,8 +292,6 @@ public class SSSlideInfoAtom extends RecordAtom {
/**
* Use one of the bitmasks MANUAL_ADVANCE_BIT ... CURSOR_VISIBLE_BIT
* @param bitmask
* @param enabled
*/
public void setEffectTransitionFlagByBit(int bitmask, boolean enabled) {
if (enabled) {

View File

@ -50,15 +50,15 @@ public final class HSLFHyperlink implements Hyperlink<HSLFShape,HSLFTextParagrap
public ExHyperlink getExHyperlink() {
return exHyper;
}
public InteractiveInfo getInfo() {
return info;
}
public TxInteractiveInfoAtom getTextRunInfo() {
return txinfo;
}
protected void setTextRunInfo(TxInteractiveInfoAtom txinfo) {
this.txinfo = txinfo;
}
@ -69,7 +69,7 @@ public final class HSLFHyperlink implements Hyperlink<HSLFShape,HSLFTextParagrap
*
* @param shape the shape which receives the hyperlink
* @return the new hyperlink
*
*
* @see HSLFSimpleShape#createHyperlink()
*/
/* package */ static HSLFHyperlink createHyperlink(HSLFSimpleShape shape) {
@ -94,7 +94,7 @@ public final class HSLFHyperlink implements Hyperlink<HSLFShape,HSLFTextParagrap
*
* @param run the run which receives the hyperlink
* @return the new hyperlink
*
*
* @see HSLFTextRun#createHyperlink()
*/
/* package */ static HSLFHyperlink createHyperlink(HSLFTextRun run) {
@ -109,22 +109,22 @@ public final class HSLFHyperlink implements Hyperlink<HSLFShape,HSLFTextParagrap
// this will be done, when the paragraph is saved
HSLFHyperlink hyper = new HSLFHyperlink(exHyper, info);
hyper.linkToNextSlide();
TxInteractiveInfoAtom txinfo = new TxInteractiveInfoAtom();
int startIdx = run.getTextParagraph().getStartIdxOfTextRun(run);
int endIdx = startIdx + run.getLength();
txinfo.setStartIndex(startIdx);
txinfo.setEndIndex(endIdx);
hyper.setTextRunInfo(txinfo);
run.setHyperlink(hyper);
return hyper;
}
/**
* Gets the type of the hyperlink action.
* Must be a <code>LINK_*</code> constant</code>
* Must be a {@code LINK_*} constant
*
* @return the hyperlink URL
* @see InteractiveInfoAtom
@ -300,8 +300,8 @@ public final class HSLFHyperlink implements Hyperlink<HSLFShape,HSLFTextParagrap
/**
* Find hyperlinks in a text shape
*
* @param shape <code>TextRun</code> to lookup hyperlinks in
* @return found hyperlinks or <code>null</code> if not found
* @param shape {@code TextRun} to lookup hyperlinks in
* @return found hyperlinks or {@code null} if not found
*/
public static List<HSLFHyperlink> find(HSLFTextShape shape){
return find(shape.getTextParagraphs());
@ -310,7 +310,7 @@ public final class HSLFHyperlink implements Hyperlink<HSLFShape,HSLFTextParagrap
/**
* Find hyperlinks in a text paragraph
*
* @param paragraphs List of <code>TextParagraph</code> to lookup hyperlinks
* @param paragraphs List of {@code TextParagraph} to lookup hyperlinks
* @return found hyperlinks
*/
@SuppressWarnings("resource")
@ -334,8 +334,8 @@ public final class HSLFHyperlink implements Hyperlink<HSLFShape,HSLFTextParagrap
/**
* Find hyperlink assigned to the supplied shape
*
* @param shape <code>Shape</code> to lookup hyperlink in
* @return found hyperlink or <code>null</code>
* @param shape {@code Shape} to lookup hyperlink in
* @return found hyperlink or {@code null}
*/
@SuppressWarnings("resource")
protected static HSLFHyperlink find(HSLFShape shape){

View File

@ -29,14 +29,14 @@ import java.util.function.BiConsumer;
* selected pen and the destination bitmap are combined. Following are the two operands used in these
* operations.
*
* <table>
* <table summary="">
* <tr><th>Operand</th><th>Meaning</th></tr>
* <tr><td>P</td><td>Selected pen</td></tr>
* <tr><td>D</td><td>Destination bitmap</td></tr>
* </table>
*
* Following are the Boolean operators used in these operations.
* <table>
* <table summary="">
* <tr><th>Operand</th><th>Meaning</th></tr>
* <tr><td>a</td><td>Bitwise AND</td></tr>
* <tr><td>n</td><td>Bitwise NOT (inverse)</td></tr>
@ -54,7 +54,7 @@ import java.util.function.BiConsumer;
* (in this case, the pen and destination values). For example, the operation indexes for the DPo and
* DPan operations are shown in the following list.
*
* <table>
* <table summary="">
* <tr><th>P</th><th>D</th><th>DPo</th><th>DPan</th></tr>
* <tr><td>0</td><td>0</td><td>0</td><td>1</td></tr>
* <tr><td>0</td><td>1</td><td>1</td><td>1</td></tr>

View File

@ -72,10 +72,12 @@ public class HwmfMisc {
* The META_SETRELABS record is reserved and not supported.
*/
public static class WmfSetRelabs implements HwmfRecord {
@Override
public HwmfRecordType getWmfRecordType() {
return HwmfRecordType.setRelabs;
}
@Override
public int init(LittleEndianInputStream leis, long recordSize, int recordFunction) throws IOException {
return 0;
}
@ -186,7 +188,7 @@ public class HwmfMisc {
public enum HwmfBkMode {
TRANSPARENT(0x0001), OPAQUE(0x0002);
int flag;
final int flag;
HwmfBkMode(int flag) {
this.flag = flag;
}
@ -201,10 +203,12 @@ public class HwmfMisc {
protected HwmfBkMode bkMode;
@Override
public HwmfRecordType getWmfRecordType() {
return HwmfRecordType.setBkMode;
}
@Override
public int init(LittleEndianInputStream leis, long recordSize, int recordFunction) throws IOException {
bkMode = HwmfBkMode.valueOf(leis.readUShort());
return LittleEndianConsts.SHORT_SIZE;
@ -752,7 +756,7 @@ public class HwmfMisc {
* The following table shows the relationship between values in the BrushStyle,
* ColorRef and BrushHatch fields in a LogBrush Object. Only supported brush styles are listed.
*
* <table>
* <table summary="">
* <tr>
* <th>BrushStyle</th>
* <th>ColorRef</th>

View File

@ -25,7 +25,7 @@ import java.util.Deque;
* the source, the selected brush, and the destination are combined. Following are the three operands
* used in these operations.
*
* <table>
* <table summary="">
* <tr><th>Operand</th><th>Meaning</th></tr>
* <tr><td>D</td><td>Destination bitmap</td></tr>
* <tr><td>P</td><td>Selected brush (also called pattern)</td></tr>
@ -33,7 +33,7 @@ import java.util.Deque;
* </table>
*
* Following are the Boolean operators used in these operations.
* <table>
* <table summary="">
* <tr><th>Operand</th><th>Meaning</th></tr>
* <tr><td>a</td><td>Bitwise AND</td></tr>
* <tr><td>n</td><td>Bitwise NOT (inverse)</td></tr>
@ -55,7 +55,7 @@ import java.util.Deque;
* values. For example, the operation indexes for the PSo and DPSoo operations are shown in the
* following list.
*
* <table>
* <table summary="">
* <tr><th>P</th><th>S</th><th>D</th><th>DPo</th><th>DPan</th></tr>
* <tr><td>0</td><td>0</td><td>0</td><td>0</td><td>0</td></tr>
* <tr><td>0</td><td>0</td><td>1</td><td>0</td><td>1</td></tr>

View File

@ -67,21 +67,19 @@ public abstract class HRESIAbstractType {
public String toString()
{
StringBuilder builder = new StringBuilder();
builder.append("[HRESI]\n");
builder.append(" .hres = ");
builder.append(" (").append(getHres()).append(" )\n");
builder.append(" .chHres = ");
builder.append(" (").append(getChHres()).append(" )\n");
builder.append("[/HRESI]\n");
return builder.toString();
return "[HRESI]\n" +
" .hres = " +
" (" + getHres() + " )\n" +
" .chHres = " +
" (" + getChHres() + " )\n" +
"[/HRESI]\n";
}
/**
* Hyphenation rule.
*
* @return One of
* <ul>
* <li>{@link #HRES_NO}
* <li>{@link #HRES_NORMAL}
* <li>{@link #HRES_ADD_LETTER_BEFORE}
@ -89,6 +87,7 @@ public abstract class HRESIAbstractType {
* <li>{@link #HRES_DELETE_LETTER_BEFORE}
* <li>{@link #HRES_CHANGE_LETTER_AFTER}
* <li>{@link #HRES_DELETE_BEFORE_CHANGE_BEFORE}
* </ul>
*/
public byte getHres()
{
@ -98,8 +97,8 @@ public abstract class HRESIAbstractType {
/**
* Hyphenation rule.
*
* @param field_1_hres
* One of
* @param field_1_hres One of
* <ul>
* <li>{@link #HRES_NO}
* <li>{@link #HRES_NORMAL}
* <li>{@link #HRES_ADD_LETTER_BEFORE}
@ -107,6 +106,7 @@ public abstract class HRESIAbstractType {
* <li>{@link #HRES_DELETE_LETTER_BEFORE}
* <li>{@link #HRES_CHANGE_LETTER_AFTER}
* <li>{@link #HRES_DELETE_BEFORE_CHANGE_BEFORE}
* </ul>
*/
public void setHres( byte field_1_hres )
{