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.
*
@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);
* 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");
*
* name2.setLocalSheetId(0);
* name2.setRefersToFormula("Sheet1!$B$3");
*
- * </blockquote></pre>
+ * }</pre>
*/
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";
*/
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.
*
* @return text name of this defined name
*/
+ @Override
public String getNameName() {
return _ctName.getName();
}
* <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();
* 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);
_workbook.updateName(this, oldName);
}
+ @Override
public String getRefersToFormula() {
String result = _ctName.getStringValue();
if (result == null || result.length() < 1) {
return result;
}
+ @Override
public void setRefersToFormula(String formulaText) {
XSSFEvaluationWorkbook fpb = XSSFEvaluationWorkbook.create(_workbook);
//validate through the FormulaParser
_ctName.setStringValue(formulaText);
}
+ @Override
public boolean isDeleted(){
String formulaText = getRefersToFormula();
if (formulaText == null) {
*
* @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) {
*
* @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;
}
* 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);
}
* 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();
* @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
/**
* 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();
}
*
* @return true if this name is a hidden one
*/
+ @Override
public boolean isHidden() {
return _ctName.getHidden();
}
*
* @return the user comment for this named range
*/
+ @Override
public String getComment() {
return _ctName.getComment();
}
*
* @param comment the user comment for this named range
*/
+ @Override
public void setComment(String comment) {
_ctName.setComment(comment);
}
/**
* 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) {
* 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) {
/**
* 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.
*/
}
/**
- * 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
* 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.
/**
* 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) {
/**
* 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) {
/**
* 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:
- *
- * <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>
+ * 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>
*
* Except the 31-character constraint, Excel applies some other rules:
* <p>
* <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
* </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),
*/
ALL(4);
- private static Map<Integer, BreakClear> imap = new HashMap<>();
+ private static final Map<Integer, BreakClear> imap = new HashMap<>();
static {
for (BreakClear p : values()) {
private final int value;
- private BreakClear(int val) {
+ BreakClear(int val) {
value = val;
}
/**
* Remove the specified footnote if present.
*
- * @param pos
* @return True if the footnote was removed.
* @since 4.0.0
*/
/**
* add an {@link XWPFEndnote} to the document
- *
- * @param endnote
- * @throws IOException
*/
public void addEndnote(XWPFEndnote endnote) {
listFootnote.add(endnote);
*
* @param note Note to add
* @return New {@link XWPFEndnote}
- * @throws IOException
*/
@Internal
public XWPFEndnote addEndnote(CTFtnEdn note) {
* @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);
}
* Add an {@link XWPFFootnote} to the document
*
* @param footnote Footnote to add
- * @throws IOException
*/
public void addFootnote(XWPFFootnote footnote) {
listFootnote.add(footnote);
* Add a CT footnote to the document
*
* @param note CTFtnEdn to add.
- * @throws IOException
*/
@Internal
public XWPFFootnote addFootnote(CTFtnEdn note) {
return headerFooter;
}
+ @Override
public List<IBodyElement> getBodyElements() {
return Collections.unmodifiableList(bodyElements);
}
* there could be more in certain cases, or
* a table.
*/
+ @Override
public List<XWPFParagraph> getParagraphs() {
return Collections.unmodifiableList(paragraphs);
}
* complex headers/footers have a table or two
* in addition.
*/
+ @Override
public List<XWPFTable> getTables() throws ArrayIndexOutOfBoundsException {
return Collections.unmodifiableList(tables);
}
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');
}
}
- 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');
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();
* 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)
* 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);
/**
* returns the PictureData by blipID
*
- * @param blipID
* @return XWPFPictureData of a specificID
- * @throws Exception
*/
public XWPFPictureData getPictureDataByID(String blipID) {
POIXMLDocumentPart relatedPart = getRelationById(blipID);
/**
* 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();
/**
- * @param cursor
* @return the inserted table
*/
+ @Override
public XWPFTable insertNewTbl(final XmlCursor cursor) {
if (isCursorInHdrF(cursor)) {
String uri = CTTbl.type.getName().getNamespaceURI();
/**
* verifies that cursor is on the right position
- *
- * @param cursor
*/
private boolean isCursorInHdrF(XmlCursor cursor) {
XmlCursor verify = cursor.newCursor();
/**
* 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);
/**
* 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;
/**
* get the TableCell which belongs to the TableCell
- *
- * @param cell
*/
+ @Override
public XWPFTableCell getTableCell(CTTc cell) {
XmlCursor cursor = cell.newCursor();
cursor.toParent();
return tableRow.getTableCell(cell);
}
+ @Override
public XWPFDocument getXWPFDocument() {
if (document != null) {
return document;
/**
* 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;
}
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;
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;
/**
* Return literal runs and sdt/content control objects.
- *
- * @return List<IRunElement>
*/
public List<IRunElement> getIRuns() {
return Collections.unmodifiableList(iruns);
/**
* setNumID of Paragraph
- *
- * @param numPos
*/
public void setNumID(BigInteger numPos) {
if (paragraph.getPPr() == null) {
/**
* setNumILvl of Paragraph
*
- * @param iLvl
* @since 4.1.2
*/
public void setNumILvl(BigInteger iLvl) {
* 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.
*/
* 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.
*/
* 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
* 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}
/**
* 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;
/**
* verifies that cursor is on the right position
- *
- * @param cursor
- * @return
*/
private boolean isCursorInParagraph(XmlCursor cursor) {
XmlCursor verify = cursor.newCursor();
* 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(),
/**
* get a Text
- *
- * @param segment
*/
public String getText(TextSegment segment) {
int runBegin = segment.getBeginRun();
/**
* removes a Run at the position pos in the paragraph
*
- * @param pos
* @return true if the run was removed
*/
public boolean removeRun(int pos) {
/**
* 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();
/**
* 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();
/**
* returns the type of the BodyElement Paragraph
- *
- * @see org.apache.poi.xwpf.usermodel.IBodyElement#getElementType()
*/
@Override
public BodyElementType getElementType() {
/**
* adds a new Run to the Paragraph
- *
- * @param r
*/
public void addRun(XWPFRun r) {
if (!runs.contains(r)) {
/**
* 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++) {
* it sets the value of zoom
* <br>
* sample snippet from settings.xml
- * <pre>
- * <w:zoom w:percent="50" />
- * <pre>
+ * <pre>{@code
+ * <w:zoom w:percent="50" />
+ * }</pre>
*
* @return percentage as an integer of zoom level
*/
* it sets the value of zoom
* <br>
* sample snippet from settings.xml
- * <pre>
- * <w:zoom w:percent="50" />
- * <pre>
+ * <pre>{@code
+ * <w:zoom w:percent="50" />
+ * }</pre>
*/
public void setZoomPercent(long zoomPercent) {
if (!ctSettings.isSetZoom()) {
/**
* 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();
/**
* 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) {
/**
* 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();
/**
* 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();
/**
* 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
}
/**
- * Create a new instance of <code>HeadersFootersAtom</code>
+ * Create a new instance of {@code HeadersFootersAtom}
*/
public HeadersFootersAtom() {
_recdata = new byte[4];
LittleEndian.putInt(_header, 4, _recdata.length);
}
+ @Override
public long getRecordType() {
return RecordTypes.HeadersFootersAtom.typeID;
}
/**
* 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);
}
/**
* 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.
*/
/**
* 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.
* <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
*/
/**
* 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.
/**
* 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.
/**
* 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.
/**
* Jump
* <p>
- * see <code>JUMP_*</code> constants for the list of actions
+ * see {@code JUMP_*} constants for the list of actions
* </p>
*
* @return jump
/**
* 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
/**
* 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];
/**
* 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;
* Gets the record type.
* @return the record type.
*/
+ @Override
public long getRecordType() { return RecordTypes.InteractiveInfoAtom.typeID; }
/**
* @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);
* <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>
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
* (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];
* 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);
/**
* We are of type 1017
*/
+ @Override
public long getRecordType() { return _type; }
/**
* Use one of the bitmasks MANUAL_ADVANCE_BIT ... CURSOR_VISIBLE_BIT
- * @param bitmask
- * @param enabled
*/
public void setEffectTransitionFlagByBit(int bitmask, boolean enabled) {
if (enabled) {
public ExHyperlink getExHyperlink() {
return exHyper;
}
-
+
public InteractiveInfo getInfo() {
return info;
}
-
+
public TxInteractiveInfoAtom getTextRunInfo() {
return txinfo;
}
-
+
protected void setTextRunInfo(TxInteractiveInfoAtom txinfo) {
this.txinfo = txinfo;
}
*
* @param shape the shape which receives the hyperlink
* @return the new hyperlink
- *
+ *
* @see HSLFSimpleShape#createHyperlink()
*/
/* package */ static HSLFHyperlink createHyperlink(HSLFSimpleShape shape) {
*
* @param run the run which receives the hyperlink
* @return the new hyperlink
- *
+ *
* @see HSLFTextRun#createHyperlink()
*/
/* package */ static HSLFHyperlink createHyperlink(HSLFTextRun run) {
// 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
/**
* 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());
/**
* 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")
/**
* 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){
* 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>
* (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>
* 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;
}
public enum HwmfBkMode {
TRANSPARENT(0x0001), OPAQUE(0x0002);
- int flag;
+ final int flag;
HwmfBkMode(int flag) {
this.flag = flag;
}
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;
* 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>
* 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>
* </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>
* 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>
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}
* <li>{@link #HRES_DELETE_LETTER_BEFORE}
* <li>{@link #HRES_CHANGE_LETTER_AFTER}
* <li>{@link #HRES_DELETE_BEFORE_CHANGE_BEFORE}
+ * </ul>
*/
public byte getHres()
{
/**
* 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}
* <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 )
{