git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1849718 13f79535-47bb-0310-9956-ffa450edef68tags/REL_4_1_0
@@ -458,6 +458,8 @@ public class PropertyIDMap implements Map<Long,String> { | |||
/** | |||
* Returns a property map, which is only used as a fallback, i.e. if available, the correct map | |||
* for {@link DocumentSummaryInformation} or {@link SummaryInformation} should be used. | |||
* | |||
* @return the resulting property map | |||
*/ | |||
public static synchronized PropertyIDMap getFallbackProperties() { | |||
if (fallbackProperties == null) { |
@@ -135,7 +135,7 @@ public final class SSTRecord extends ContinuableRecord { | |||
* @return string representation | |||
*/ | |||
public String toString() { | |||
StringBuffer buffer = new StringBuffer(); | |||
StringBuilder buffer = new StringBuilder(); | |||
buffer.append( "[SST]\n" ); | |||
buffer.append( " .numstrings = " ) | |||
@@ -145,7 +145,7 @@ public final class SSTRecord extends ContinuableRecord { | |||
for ( int k = 0; k < field_3_strings.size(); k++ ) | |||
{ | |||
UnicodeString s = field_3_strings.get( k ); | |||
buffer.append( " .string_" + k + " = " ) | |||
buffer.append(" .string_").append(k).append(" = ") | |||
.append( s.getDebugInfo() ).append( "\n" ); | |||
} | |||
buffer.append( "[/SST]\n" ); | |||
@@ -161,7 +161,7 @@ public final class SSTRecord extends ContinuableRecord { | |||
* <P> | |||
* The data consists of sets of string data. This string data is | |||
* arranged as follows: | |||
* </P><P> | |||
* </P> | |||
* <pre> | |||
* short string_length; // length of string data | |||
* byte string_flag; // flag specifying special string | |||
@@ -176,9 +176,10 @@ public final class SSTRecord extends ContinuableRecord { | |||
* byte[] extension; // optional extension (length of array | |||
* // is extend_length) | |||
* </pre> | |||
* </P><P> | |||
* <P> | |||
* The string_flag is bit mapped as follows: | |||
* </P><P> | |||
* </P> | |||
* <P> | |||
* <TABLE summary="string_flag mapping"> | |||
* <TR> | |||
* <TH>Bit number</TH> |
@@ -27,19 +27,16 @@ import org.apache.poi.util.StringUtil; | |||
* Stores the cached result of a text formula | |||
*/ | |||
public final class StringRecord extends ContinuableRecord { | |||
public final static short sid = 0x0207; | |||
private boolean _is16bitUnicode; | |||
private String _text; | |||
public StringRecord() | |||
{ | |||
public StringRecord() { | |||
} | |||
/** | |||
* @param in the RecordInputstream to read the record from | |||
* @param in the RecordInputStream to read the record from | |||
*/ | |||
public StringRecord( RecordInputStream in) { | |||
int field_1_string_length = in.readUShort(); | |||
@@ -52,13 +49,11 @@ public final class StringRecord extends ContinuableRecord { | |||
} | |||
} | |||
protected void serialize(ContinuableRecordOutput out) { | |||
out.writeShort(_text.length()); | |||
out.writeStringData(_text); | |||
} | |||
public short getSid() | |||
{ | |||
return sid; | |||
@@ -72,24 +67,20 @@ public final class StringRecord extends ContinuableRecord { | |||
return _text; | |||
} | |||
/** | |||
* Sets the string represented by this record. | |||
* | |||
* @param string The string-value for this record | |||
*/ | |||
public void setString(String string) { | |||
_text = string; | |||
_is16bitUnicode = StringUtil.hasMultibyte(string); | |||
} | |||
public String toString() | |||
{ | |||
StringBuffer buffer = new StringBuffer(); | |||
buffer.append("[STRING]\n"); | |||
buffer.append(" .string = ") | |||
.append(_text).append("\n"); | |||
buffer.append("[/STRING]\n"); | |||
return buffer.toString(); | |||
public String toString() { | |||
return "[STRING]\n" + | |||
" .string = " + _text + "\n" + | |||
"[/STRING]\n"; | |||
} | |||
public Object clone() { |
@@ -120,6 +120,8 @@ public final class StyleRecord extends StandardRecord { | |||
/** | |||
* set the row or column level of the style (if builtin 1||2) | |||
* | |||
* @param level The outline-level | |||
*/ | |||
public void setOutlineStyleLevel(int level) { | |||
field_3_outline_style_level = level & 0x00FF; |
@@ -221,6 +221,8 @@ public final class TextObjectRecord extends ContinuableRecord { | |||
/** | |||
* Sets the Horizontal text alignment field value. | |||
* | |||
* @param value The horizontal alignment, use one of the HORIZONTAL_TEXT_ALIGNMENT_... constants in this class | |||
*/ | |||
public void setHorizontalTextAlignment(int value) { | |||
field_1_options = HorizontalTextAlignment.setValue(field_1_options, value); | |||
@@ -235,6 +237,8 @@ public final class TextObjectRecord extends ContinuableRecord { | |||
/** | |||
* Sets the Vertical text alignment field value. | |||
* | |||
* @param value The vertical alignment, use one of the VERTIUCAL_TEST_ALIGNMENT_... constants in this class | |||
*/ | |||
public void setVerticalTextAlignment(int value) { | |||
field_1_options = VerticalTextAlignment.setValue(field_1_options, value); | |||
@@ -249,6 +253,8 @@ public final class TextObjectRecord extends ContinuableRecord { | |||
/** | |||
* Sets the text locked field value. | |||
* | |||
* @param value If the text should be locked | |||
*/ | |||
public void setTextLocked(boolean value) { | |||
field_1_options = textLocked.setBoolean(field_1_options, value); | |||
@@ -295,7 +301,7 @@ public final class TextObjectRecord extends ContinuableRecord { | |||
} | |||
public String toString() { | |||
StringBuffer sb = new StringBuffer(); | |||
StringBuilder sb = new StringBuilder(); | |||
sb.append("[TXO]\n"); | |||
sb.append(" .options = ").append(HexDump.shortToHex(field_1_options)).append("\n"); | |||
@@ -322,7 +328,6 @@ public final class TextObjectRecord extends ContinuableRecord { | |||
public Object clone() { | |||
TextObjectRecord rec = new TextObjectRecord(); | |||
rec._text = _text; | |||
rec.field_1_options = field_1_options; | |||
rec.field_2_textOrientation = field_2_textOrientation; |
@@ -127,6 +127,8 @@ public final class UnknownRecord extends StandardRecord { | |||
/** | |||
* These BIFF record types are known but still uninterpreted by POI | |||
* | |||
* @param sid The identifier for an unknown record type | |||
* | |||
* @return the documented name of this BIFF record type, <code>null</code> if unknown to POI | |||
*/ | |||
public static String getBiffName(int sid) { |
@@ -49,12 +49,10 @@ public final class WSBoolRecord extends StandardRecord { | |||
private static final BitField alternateexpression = BitFieldFactory.getInstance(0x40); // whether to use alternate expression eval | |||
private static final BitField alternateformula = BitFieldFactory.getInstance(0x80); // whether to use alternate formula entry | |||
public WSBoolRecord() | |||
{ | |||
public WSBoolRecord() { | |||
} | |||
public WSBoolRecord(RecordInputStream in) | |||
{ | |||
public WSBoolRecord(RecordInputStream in) { | |||
byte[] data = in.readRemainder(); | |||
field_1_wsbool = | |||
data[ 1 ]; // backwards because theoretically this is one short field | |||
@@ -70,10 +68,10 @@ public final class WSBoolRecord extends StandardRecord { | |||
/** | |||
* set first byte (see bit setters) | |||
* | |||
* @param bool1 Set boolean 1 of this record | |||
*/ | |||
public void setWSBool1(byte bool1) | |||
{ | |||
public void setWSBool1(byte bool1) { | |||
field_1_wsbool = bool1; | |||
} | |||
@@ -83,7 +81,6 @@ public final class WSBoolRecord extends StandardRecord { | |||
* show automatic page breaks or not | |||
* @param ab whether to show auto page breaks | |||
*/ | |||
public void setAutobreaks(boolean ab) | |||
{ | |||
field_1_wsbool = autobreaks.setByteBoolean(field_1_wsbool, ab); | |||
@@ -93,7 +90,6 @@ public final class WSBoolRecord extends StandardRecord { | |||
* set whether sheet is a dialog sheet or not | |||
* @param isDialog or not | |||
*/ | |||
public void setDialog(boolean isDialog) | |||
{ | |||
field_1_wsbool = dialog.setByteBoolean(field_1_wsbool, isDialog); | |||
@@ -103,7 +99,6 @@ public final class WSBoolRecord extends StandardRecord { | |||
* set if row summaries appear below detail in the outline | |||
* @param below or not | |||
*/ | |||
public void setRowSumsBelow(boolean below) | |||
{ | |||
field_1_wsbool = rowsumsbelow.setByteBoolean(field_1_wsbool, below); | |||
@@ -113,7 +108,6 @@ public final class WSBoolRecord extends StandardRecord { | |||
* set if col summaries appear right of the detail in the outline | |||
* @param right or not | |||
*/ | |||
public void setRowSumsRight(boolean right) | |||
{ | |||
field_1_wsbool = rowsumsright.setByteBoolean(field_1_wsbool, right); | |||
@@ -123,8 +117,9 @@ public final class WSBoolRecord extends StandardRecord { | |||
/** | |||
* set the second byte (see bit setters) | |||
* | |||
* @param bool2 Set boolean 2 of this record | |||
*/ | |||
public void setWSBool2(byte bool2) | |||
{ | |||
field_2_wsbool = bool2; | |||
@@ -136,7 +131,6 @@ public final class WSBoolRecord extends StandardRecord { | |||
* fit to page option is on | |||
* @param fit2page fit or not | |||
*/ | |||
public void setFitToPage(boolean fit2page) | |||
{ | |||
field_2_wsbool = fittopage.setByteBoolean(field_2_wsbool, fit2page); | |||
@@ -147,7 +141,6 @@ public final class WSBoolRecord extends StandardRecord { | |||
* | |||
* @param guts or no guts (or glory) | |||
*/ | |||
public void setDisplayGuts(boolean guts) | |||
{ | |||
field_2_wsbool = displayguts.setByteBoolean(field_2_wsbool, guts); | |||
@@ -157,7 +150,6 @@ public final class WSBoolRecord extends StandardRecord { | |||
* whether alternate expression evaluation is on | |||
* @param altexp alternative expression evaluation or not | |||
*/ | |||
public void setAlternateExpression(boolean altexp) | |||
{ | |||
field_2_wsbool = alternateexpression.setByteBoolean(field_2_wsbool, | |||
@@ -168,7 +160,6 @@ public final class WSBoolRecord extends StandardRecord { | |||
* whether alternative formula entry is on | |||
* @param formula alternative formulas or not | |||
*/ | |||
public void setAlternateFormula(boolean formula) | |||
{ | |||
field_2_wsbool = alternateformula.setByteBoolean(field_2_wsbool, | |||
@@ -179,8 +170,9 @@ public final class WSBoolRecord extends StandardRecord { | |||
/** | |||
* get first byte (see bit getters) | |||
* | |||
* @return boolean 1 of this record | |||
*/ | |||
public byte getWSBool1() | |||
{ | |||
return field_1_wsbool; | |||
@@ -192,7 +184,6 @@ public final class WSBoolRecord extends StandardRecord { | |||
* show automatic page breaks or not | |||
* @return whether to show auto page breaks | |||
*/ | |||
public boolean getAutobreaks() | |||
{ | |||
return autobreaks.isSet(field_1_wsbool); | |||
@@ -202,7 +193,6 @@ public final class WSBoolRecord extends StandardRecord { | |||
* get whether sheet is a dialog sheet or not | |||
* @return isDialog or not | |||
*/ | |||
public boolean getDialog() | |||
{ | |||
return dialog.isSet(field_1_wsbool); | |||
@@ -212,7 +202,6 @@ public final class WSBoolRecord extends StandardRecord { | |||
* get if row summaries appear below detail in the outline | |||
* @return below or not | |||
*/ | |||
public boolean getRowSumsBelow() | |||
{ | |||
return rowsumsbelow.isSet(field_1_wsbool); | |||
@@ -222,7 +211,6 @@ public final class WSBoolRecord extends StandardRecord { | |||
* get if col summaries appear right of the detail in the outline | |||
* @return right or not | |||
*/ | |||
public boolean getRowSumsRight() | |||
{ | |||
return rowsumsright.isSet(field_1_wsbool); | |||
@@ -232,10 +220,10 @@ public final class WSBoolRecord extends StandardRecord { | |||
/** | |||
* get the second byte (see bit getters) | |||
* | |||
* @return boolean 1 of this record | |||
*/ | |||
public byte getWSBool2() | |||
{ | |||
public byte getWSBool2() { | |||
return field_2_wsbool; | |||
} | |||
@@ -245,9 +233,7 @@ public final class WSBoolRecord extends StandardRecord { | |||
* fit to page option is on | |||
* @return fit or not | |||
*/ | |||
public boolean getFitToPage() | |||
{ | |||
public boolean getFitToPage() { | |||
return fittopage.isSet(field_2_wsbool); | |||
} | |||
@@ -256,9 +242,7 @@ public final class WSBoolRecord extends StandardRecord { | |||
* | |||
* @return guts or no guts (or glory) | |||
*/ | |||
public boolean getDisplayGuts() | |||
{ | |||
public boolean getDisplayGuts() { | |||
return displayguts.isSet(field_2_wsbool); | |||
} | |||
@@ -266,9 +250,7 @@ public final class WSBoolRecord extends StandardRecord { | |||
* whether alternate expression evaluation is on | |||
* @return alternative expression evaluation or not | |||
*/ | |||
public boolean getAlternateExpression() | |||
{ | |||
public boolean getAlternateExpression() { | |||
return alternateexpression.isSet(field_2_wsbool); | |||
} | |||
@@ -276,9 +258,7 @@ public final class WSBoolRecord extends StandardRecord { | |||
* whether alternative formula entry is on | |||
* @return alternative formulas or not | |||
*/ | |||
public boolean getAlternateFormula() | |||
{ | |||
public boolean getAlternateFormula() { | |||
return alternateformula.isSet(field_2_wsbool); | |||
} | |||
@@ -81,9 +81,9 @@ public final class WindowTwoRecord extends StandardRecord { | |||
/** | |||
* set the options bitmask or just use the bit setters. | |||
* @param options | |||
* | |||
* @param options Which options to set for this record | |||
*/ | |||
public void setOptions(short options) | |||
{ | |||
field_1_options = options; | |||
@@ -95,7 +95,6 @@ public final class WindowTwoRecord extends StandardRecord { | |||
* set whether the window should display formulas | |||
* @param formulas or not | |||
*/ | |||
public void setDisplayFormulas(boolean formulas) | |||
{ | |||
field_1_options = displayFormulas.setShortBoolean(field_1_options, formulas); | |||
@@ -105,7 +104,6 @@ public final class WindowTwoRecord extends StandardRecord { | |||
* set whether the window should display gridlines | |||
* @param gridlines or not | |||
*/ | |||
public void setDisplayGridlines(boolean gridlines) | |||
{ | |||
field_1_options = displayGridlines.setShortBoolean(field_1_options, gridlines); | |||
@@ -115,7 +113,6 @@ public final class WindowTwoRecord extends StandardRecord { | |||
* set whether the window should display row and column headings | |||
* @param headings or not | |||
*/ | |||
public void setDisplayRowColHeadings(boolean headings) | |||
{ | |||
field_1_options = displayRowColHeadings.setShortBoolean(field_1_options, headings); | |||
@@ -125,7 +122,6 @@ public final class WindowTwoRecord extends StandardRecord { | |||
* set whether the window should freeze panes | |||
* @param freezepanes freeze panes or not | |||
*/ | |||
public void setFreezePanes(boolean freezepanes) | |||
{ | |||
field_1_options = freezePanes.setShortBoolean(field_1_options, freezepanes); | |||
@@ -135,7 +131,6 @@ public final class WindowTwoRecord extends StandardRecord { | |||
* set whether the window should display zero values | |||
* @param zeros or not | |||
*/ | |||
public void setDisplayZeros(boolean zeros) | |||
{ | |||
field_1_options = displayZeros.setShortBoolean(field_1_options, zeros); | |||
@@ -145,7 +140,6 @@ public final class WindowTwoRecord extends StandardRecord { | |||
* set whether the window should display a default header | |||
* @param header or not | |||
*/ | |||
public void setDefaultHeader(boolean header) | |||
{ | |||
field_1_options = defaultHeader.setShortBoolean(field_1_options, header); | |||
@@ -155,7 +149,6 @@ public final class WindowTwoRecord extends StandardRecord { | |||
* is this arabic? | |||
* @param isarabic arabic or not | |||
*/ | |||
public void setArabic(boolean isarabic) | |||
{ | |||
field_1_options = arabic.setShortBoolean(field_1_options, isarabic); | |||
@@ -165,7 +158,6 @@ public final class WindowTwoRecord extends StandardRecord { | |||
* set whether the outline symbols are displaed | |||
* @param guts symbols or not | |||
*/ | |||
public void setDisplayGuts(boolean guts) | |||
{ | |||
field_1_options = displayGuts.setShortBoolean(field_1_options, guts); | |||
@@ -175,7 +167,6 @@ public final class WindowTwoRecord extends StandardRecord { | |||
* freeze unsplit panes or not | |||
* @param freeze or not | |||
*/ | |||
public void setFreezePanesNoSplit(boolean freeze) | |||
{ | |||
field_1_options = freezePanesNoSplit.setShortBoolean(field_1_options, freeze); | |||
@@ -185,7 +176,6 @@ public final class WindowTwoRecord extends StandardRecord { | |||
* sheet tab is selected | |||
* @param sel selected or not | |||
*/ | |||
public void setSelected(boolean sel) | |||
{ | |||
field_1_options = selected.setShortBoolean(field_1_options, sel); | |||
@@ -203,7 +193,6 @@ public final class WindowTwoRecord extends StandardRecord { | |||
* was the sheet saved in page break view | |||
* @param p pagebreaksaved or not | |||
*/ | |||
public void setSavedInPageBreakPreview(boolean p) | |||
{ | |||
field_1_options = savedInPageBreakPreview.setShortBoolean(field_1_options, p); | |||
@@ -215,7 +204,6 @@ public final class WindowTwoRecord extends StandardRecord { | |||
* set the top row visible in the window | |||
* @param topRow top row visible | |||
*/ | |||
public void setTopRow(short topRow) | |||
{ | |||
field_2_top_row = topRow; | |||
@@ -225,7 +213,6 @@ public final class WindowTwoRecord extends StandardRecord { | |||
* set the leftmost column displayed in the window | |||
* @param leftCol leftmost column | |||
*/ | |||
public void setLeftCol(short leftCol) | |||
{ | |||
field_3_left_col = leftCol; | |||
@@ -233,19 +220,19 @@ public final class WindowTwoRecord extends StandardRecord { | |||
/** | |||
* set the palette index for the header color | |||
* @param color | |||
* | |||
* @param color Which color to use for the header, see the specification for details | |||
*/ | |||
public void setHeaderColor(int color) | |||
{ | |||
field_4_header_color = color; | |||
} | |||
/** | |||
* zoom magification in page break view | |||
* @param zoom | |||
* zoom magnification in page break view | |||
* | |||
* @param zoom The zoom-level to use for the page-break view | |||
*/ | |||
public void setPageBreakZoom(short zoom) | |||
{ | |||
field_5_page_break_zoom = zoom; | |||
@@ -253,9 +240,9 @@ public final class WindowTwoRecord extends StandardRecord { | |||
/** | |||
* set the zoom magnification in normal view | |||
* @param zoom | |||
* | |||
* @param zoom The zoom-level to use for the normal view | |||
*/ | |||
public void setNormalZoom(short zoom) | |||
{ | |||
field_6_normal_zoom = zoom; | |||
@@ -263,8 +250,9 @@ public final class WindowTwoRecord extends StandardRecord { | |||
/** | |||
* set the reserved (don't do this) value | |||
* | |||
* @param reserved reserved value usually does not need to be set | |||
*/ | |||
public void setReserved(int reserved) | |||
{ | |||
field_7_reserved = reserved; | |||
@@ -274,7 +262,6 @@ public final class WindowTwoRecord extends StandardRecord { | |||
* get the options bitmask or just use the bit setters. | |||
* @return options | |||
*/ | |||
public short getOptions() | |||
{ | |||
return field_1_options; | |||
@@ -286,7 +273,6 @@ public final class WindowTwoRecord extends StandardRecord { | |||
* get whether the window should display formulas | |||
* @return formulas or not | |||
*/ | |||
public boolean getDisplayFormulas() | |||
{ | |||
return displayFormulas.isSet(field_1_options); | |||
@@ -296,7 +282,6 @@ public final class WindowTwoRecord extends StandardRecord { | |||
* get whether the window should display gridlines | |||
* @return gridlines or not | |||
*/ | |||
public boolean getDisplayGridlines() | |||
{ | |||
return displayGridlines.isSet(field_1_options); | |||
@@ -306,7 +291,6 @@ public final class WindowTwoRecord extends StandardRecord { | |||
* get whether the window should display row and column headings | |||
* @return headings or not | |||
*/ | |||
public boolean getDisplayRowColHeadings() | |||
{ | |||
return displayRowColHeadings.isSet(field_1_options); | |||
@@ -316,7 +300,6 @@ public final class WindowTwoRecord extends StandardRecord { | |||
* get whether the window should freeze panes | |||
* @return freeze panes or not | |||
*/ | |||
public boolean getFreezePanes() | |||
{ | |||
return freezePanes.isSet(field_1_options); | |||
@@ -326,7 +309,6 @@ public final class WindowTwoRecord extends StandardRecord { | |||
* get whether the window should display zero values | |||
* @return zeros or not | |||
*/ | |||
public boolean getDisplayZeros() | |||
{ | |||
return displayZeros.isSet(field_1_options); | |||
@@ -336,7 +318,6 @@ public final class WindowTwoRecord extends StandardRecord { | |||
* get whether the window should display a default header | |||
* @return header or not | |||
*/ | |||
public boolean getDefaultHeader() | |||
{ | |||
return defaultHeader.isSet(field_1_options); | |||
@@ -346,7 +327,6 @@ public final class WindowTwoRecord extends StandardRecord { | |||
* is this arabic? | |||
* @return arabic or not | |||
*/ | |||
public boolean getArabic() | |||
{ | |||
return arabic.isSet(field_1_options); | |||
@@ -356,7 +336,6 @@ public final class WindowTwoRecord extends StandardRecord { | |||
* get whether the outline symbols are displaed | |||
* @return symbols or not | |||
*/ | |||
public boolean getDisplayGuts() | |||
{ | |||
return displayGuts.isSet(field_1_options); | |||
@@ -366,7 +345,6 @@ public final class WindowTwoRecord extends StandardRecord { | |||
* freeze unsplit panes or not | |||
* @return freeze or not | |||
*/ | |||
public boolean getFreezePanesNoSplit() | |||
{ | |||
return freezePanesNoSplit.isSet(field_1_options); | |||
@@ -376,7 +354,6 @@ public final class WindowTwoRecord extends StandardRecord { | |||
* sheet tab is selected | |||
* @return selected or not | |||
*/ | |||
public boolean getSelected() | |||
{ | |||
return selected.isSet(field_1_options); | |||
@@ -386,7 +363,6 @@ public final class WindowTwoRecord extends StandardRecord { | |||
* is the sheet currently displayed in the window | |||
* @return displayed or not | |||
*/ | |||
public boolean isActive() { | |||
return active.isSet(field_1_options); | |||
} | |||
@@ -395,7 +371,6 @@ public final class WindowTwoRecord extends StandardRecord { | |||
* was the sheet saved in page break view | |||
* @return pagebreaksaved or not | |||
*/ | |||
public boolean getSavedInPageBreakPreview() | |||
{ | |||
return savedInPageBreakPreview.isSet(field_1_options); | |||
@@ -407,7 +382,6 @@ public final class WindowTwoRecord extends StandardRecord { | |||
* get the top row visible in the window | |||
* @return toprow | |||
*/ | |||
public short getTopRow() | |||
{ | |||
return field_2_top_row; | |||
@@ -417,7 +391,6 @@ public final class WindowTwoRecord extends StandardRecord { | |||
* get the leftmost column displayed in the window | |||
* @return leftmost | |||
*/ | |||
public short getLeftCol() | |||
{ | |||
return field_3_left_col; | |||
@@ -427,7 +400,6 @@ public final class WindowTwoRecord extends StandardRecord { | |||
* get the palette index for the header color | |||
* @return color | |||
*/ | |||
public int getHeaderColor() | |||
{ | |||
return field_4_header_color; | |||
@@ -437,7 +409,6 @@ public final class WindowTwoRecord extends StandardRecord { | |||
* zoom magification in page break view | |||
* @return zoom | |||
*/ | |||
public short getPageBreakZoom() | |||
{ | |||
return field_5_page_break_zoom; | |||
@@ -447,7 +418,6 @@ public final class WindowTwoRecord extends StandardRecord { | |||
* get the zoom magnification in normal view | |||
* @return zoom | |||
*/ | |||
public short getNormalZoom() | |||
{ | |||
return field_6_normal_zoom; | |||
@@ -457,57 +427,33 @@ public final class WindowTwoRecord extends StandardRecord { | |||
* get the reserved bits - why would you do this? | |||
* @return reserved stuff -probably garbage | |||
*/ | |||
public int getReserved() | |||
{ | |||
return field_7_reserved; | |||
} | |||
public String toString() | |||
{ | |||
StringBuffer buffer = new StringBuffer(); | |||
buffer.append("[WINDOW2]\n"); | |||
buffer.append(" .options = ") | |||
.append(Integer.toHexString(getOptions())).append("\n"); | |||
buffer.append(" .dispformulas= ").append(getDisplayFormulas()) | |||
.append("\n"); | |||
buffer.append(" .dispgridlins= ").append(getDisplayGridlines()) | |||
.append("\n"); | |||
buffer.append(" .disprcheadin= ") | |||
.append(getDisplayRowColHeadings()).append("\n"); | |||
buffer.append(" .freezepanes = ").append(getFreezePanes()) | |||
.append("\n"); | |||
buffer.append(" .displayzeros= ").append(getDisplayZeros()) | |||
.append("\n"); | |||
buffer.append(" .defaultheadr= ").append(getDefaultHeader()) | |||
.append("\n"); | |||
buffer.append(" .arabic = ").append(getArabic()) | |||
.append("\n"); | |||
buffer.append(" .displayguts = ").append(getDisplayGuts()) | |||
.append("\n"); | |||
buffer.append(" .frzpnsnosplt= ") | |||
.append(getFreezePanesNoSplit()).append("\n"); | |||
buffer.append(" .selected = ").append(getSelected()) | |||
.append("\n"); | |||
buffer.append(" .active = ").append(isActive()) | |||
.append("\n"); | |||
buffer.append(" .svdinpgbrkpv= ") | |||
.append(getSavedInPageBreakPreview()).append("\n"); | |||
buffer.append(" .toprow = ") | |||
.append(Integer.toHexString(getTopRow())).append("\n"); | |||
buffer.append(" .leftcol = ") | |||
.append(Integer.toHexString(getLeftCol())).append("\n"); | |||
buffer.append(" .headercolor = ") | |||
.append(Integer.toHexString(getHeaderColor())).append("\n"); | |||
buffer.append(" .pagebreakzoom = ") | |||
.append(Integer.toHexString(getPageBreakZoom())).append("\n"); | |||
buffer.append(" .normalzoom = ") | |||
.append(Integer.toHexString(getNormalZoom())).append("\n"); | |||
buffer.append(" .reserved = ") | |||
.append(Integer.toHexString(getReserved())).append("\n"); | |||
buffer.append("[/WINDOW2]\n"); | |||
return buffer.toString(); | |||
public String toString() { | |||
return "[WINDOW2]\n" + | |||
" .options = " + Integer.toHexString(getOptions()) + "\n" + | |||
" .dispformulas= " + getDisplayFormulas() + "\n" + | |||
" .dispgridlins= " + getDisplayGridlines() + "\n" + | |||
" .disprcheadin= " + getDisplayRowColHeadings() + "\n" + | |||
" .freezepanes = " + getFreezePanes() + "\n" + | |||
" .displayzeros= " + getDisplayZeros() + "\n" + | |||
" .defaultheadr= " + getDefaultHeader() + "\n" + | |||
" .arabic = " + getArabic() + "\n" + | |||
" .displayguts = " + getDisplayGuts() + "\n" + | |||
" .frzpnsnosplt= " + getFreezePanesNoSplit() + "\n" + | |||
" .selected = " + getSelected() + "\n" + | |||
" .active = " + isActive() + "\n" + | |||
" .svdinpgbrkpv= " + getSavedInPageBreakPreview() + "\n" + | |||
" .toprow = " + Integer.toHexString(getTopRow()) + "\n" + | |||
" .leftcol = " + Integer.toHexString(getLeftCol()) + "\n" + | |||
" .headercolor = " + Integer.toHexString(getHeaderColor()) + "\n" + | |||
" .pagebreakzoom = " + Integer.toHexString(getPageBreakZoom()) + "\n" + | |||
" .normalzoom = " + Integer.toHexString(getNormalZoom()) + "\n" + | |||
" .reserved = " + Integer.toHexString(getReserved()) + "\n" + | |||
"[/WINDOW2]\n"; | |||
} | |||
public void serialize(LittleEndianOutput out) { |
@@ -123,6 +123,8 @@ public final class CFRecordsAggregate extends RecordAggregate { | |||
/** | |||
* Create a deep clone of the record | |||
* | |||
* @return A new object with the same values as this record | |||
*/ | |||
public CFRecordsAggregate cloneCFAggregate() { | |||
CFRuleBase[] newRecs = new CFRuleBase[rules.size()]; | |||
@@ -215,6 +217,9 @@ public final class CFRecordsAggregate extends RecordAggregate { | |||
} | |||
/** | |||
* @param shifter The {@link FormulaShifter} to use | |||
* @param currentExternSheetIx The index for extern sheets | |||
* | |||
* @return <code>false</code> if this whole {@link CFHeaderRecord} / {@link CFRuleRecord}s should be deleted | |||
*/ | |||
public boolean updateFormulasAfterCellShift(FormulaShifter shifter, int currentExternSheetIx) { |
@@ -34,6 +34,8 @@ public abstract class RecordAggregate extends RecordBase { | |||
* that they should be written to file. Implementors may or may not return the actual | |||
* {@link Record}s being used to manage POI's internal implementation. Callers should not | |||
* assume either way, and therefore only attempt to modify those {@link Record}s after cloning | |||
* | |||
* @param rv The visitor to use for callbacks while walking this object | |||
*/ | |||
public abstract void visitContainedRecords(RecordVisitor rv); | |||
@@ -74,8 +74,7 @@ public final class HSSFRichTextString implements Comparable<HSSFRichTextString>, | |||
private InternalWorkbook _book; | |||
private LabelSSTRecord _record; | |||
public HSSFRichTextString() | |||
{ | |||
public HSSFRichTextString() { | |||
this(""); | |||
} | |||
@@ -129,8 +128,7 @@ public final class HSSFRichTextString implements Comparable<HSSFRichTextString>, | |||
* @param endIndex The end index to apply the font to (exclusive) | |||
* @param fontIndex The font to use. | |||
*/ | |||
public void applyFont(int startIndex, int endIndex, short fontIndex) | |||
{ | |||
public void applyFont(int startIndex, int endIndex, short fontIndex) { | |||
if (startIndex > endIndex) | |||
throw new IllegalArgumentException("Start index must be less than end index."); | |||
if (startIndex < 0 || endIndex > length()) | |||
@@ -171,8 +169,7 @@ public final class HSSFRichTextString implements Comparable<HSSFRichTextString>, | |||
* @param endIndex The end index to apply to font to (exclusive) | |||
* @param font The index of the font to use. | |||
*/ | |||
public void applyFont(int startIndex, int endIndex, Font font) | |||
{ | |||
public void applyFont(int startIndex, int endIndex, Font font) { | |||
applyFont(startIndex, endIndex, font.getIndex()); | |||
} | |||
@@ -180,8 +177,7 @@ public final class HSSFRichTextString implements Comparable<HSSFRichTextString>, | |||
* Sets the font of the entire string. | |||
* @param font The font to use. | |||
*/ | |||
public void applyFont(Font font) | |||
{ | |||
public void applyFont(Font font) { | |||
applyFont(0, _string.getCharCount(), font); | |||
} | |||
@@ -197,8 +193,7 @@ public final class HSSFRichTextString implements Comparable<HSSFRichTextString>, | |||
/** | |||
* Returns the plain string representation. | |||
*/ | |||
public String getString() | |||
{ | |||
public String getString() { | |||
return _string.getString(); | |||
} | |||
@@ -243,8 +238,7 @@ public final class HSSFRichTextString implements Comparable<HSSFRichTextString>, | |||
* index or null if no font is being applied or the | |||
* index is out of range. | |||
*/ | |||
public short getFontAtIndex( int index ) | |||
{ | |||
public short getFontAtIndex( int index ) { | |||
int size = _string.getFormatRunCount(); | |||
UnicodeString.FormatRun currentRun = null; | |||
for (int i=0;i<size;i++) { | |||
@@ -266,8 +260,7 @@ public final class HSSFRichTextString implements Comparable<HSSFRichTextString>, | |||
* | |||
* @see #NO_FONT | |||
*/ | |||
public int numFormattingRuns() | |||
{ | |||
public int numFormattingRuns() { | |||
return _string.getFormatRunCount(); | |||
} | |||
@@ -276,8 +269,7 @@ public final class HSSFRichTextString implements Comparable<HSSFRichTextString>, | |||
* @param index the index of the formatting run | |||
* @return the index within the string. | |||
*/ | |||
public int getIndexOfFormattingRun(int index) | |||
{ | |||
public int getIndexOfFormattingRun(int index) { | |||
UnicodeString.FormatRun r = _string.getFormatRun(index); | |||
return r.getCharacterPos(); | |||
} | |||
@@ -288,8 +280,7 @@ public final class HSSFRichTextString implements Comparable<HSSFRichTextString>, | |||
* @param index the index of the formatting run | |||
* @return the font number used. | |||
*/ | |||
public short getFontOfFormattingRun(int index) | |||
{ | |||
public short getFontOfFormattingRun(int index) { | |||
UnicodeString.FormatRun r = _string.getFormatRun(index); | |||
return r.getFontIndex(); | |||
} | |||
@@ -320,8 +311,7 @@ public final class HSSFRichTextString implements Comparable<HSSFRichTextString>, | |||
/** | |||
* @return the plain text representation of this string. | |||
*/ | |||
public String toString() | |||
{ | |||
public String toString() { | |||
return _string.toString(); | |||
} | |||
@@ -330,8 +320,7 @@ public final class HSSFRichTextString implements Comparable<HSSFRichTextString>, | |||
* | |||
* @param fontIndex the font to apply. | |||
*/ | |||
public void applyFont( short fontIndex ) | |||
{ | |||
public void applyFont( short fontIndex ) { | |||
applyFont(0, _string.getCharCount(), fontIndex); | |||
} | |||
} |
@@ -36,6 +36,9 @@ import org.apache.poi.hssf.record.TextObjectRecord; | |||
import org.apache.poi.ss.usermodel.RichTextString; | |||
import org.apache.poi.ss.usermodel.SimpleShape; | |||
import static org.apache.poi.hssf.record.TextObjectRecord.HORIZONTAL_TEXT_ALIGNMENT_CENTERED; | |||
import static org.apache.poi.hssf.record.TextObjectRecord.VERTICAL_TEXT_ALIGNMENT_CENTER; | |||
/** | |||
* Represents a simple shape such as a line, rectangle or oval. | |||
*/ | |||
@@ -94,8 +97,8 @@ public class HSSFSimpleShape extends HSSFShape implements SimpleShape | |||
protected TextObjectRecord createTextObjRecord(){ | |||
TextObjectRecord obj = new TextObjectRecord(); | |||
obj.setHorizontalTextAlignment(2); | |||
obj.setVerticalTextAlignment(2); | |||
obj.setHorizontalTextAlignment(HORIZONTAL_TEXT_ALIGNMENT_CENTERED); | |||
obj.setVerticalTextAlignment(VERTICAL_TEXT_ALIGNMENT_CENTER); | |||
obj.setTextLocked(true); | |||
obj.setTextOrientation(TextObjectRecord.TEXT_ORIENTATION_NONE); | |||
obj.setStr(new HSSFRichTextString("")); |
@@ -24,12 +24,14 @@ import java.awt.geom.Path2D; | |||
/** | |||
* A path command in DrawingML. One of: | |||
* | |||
* <li>arcTo | |||
* <li>moveTo | |||
* <li>lineTo | |||
* <li>cubicBezTo | |||
* <li>quadBezTo | |||
* <li>close | |||
*<ul> | |||
* <li>arcTo</li> | |||
* <li>moveTo/li> | |||
* <li>lineTo/li> | |||
* <li>cubicBezTo/li> | |||
* <li>quadBezTo/li> | |||
* <li>close/li> | |||
* </ul> | |||
*/ | |||
public interface PathCommand { | |||
/** |
@@ -146,8 +146,8 @@ public interface TextParagraph< | |||
* The amount of vertical white space before the paragraph | |||
* This may be specified in two different ways, percentage spacing and font point spacing: | |||
* <p> | |||
* If spaceBefore >= 0, then space is a percentage of normal line height. | |||
* If spaceBefore < 0, the absolute value in points | |||
* If spaceBefore >= 0, then space is a percentage of normal line height. | |||
* If spaceBefore < 0, the absolute value in points | |||
* </p> | |||
* | |||
* @return the vertical white space before the paragraph, or null if unset | |||
@@ -158,8 +158,8 @@ public interface TextParagraph< | |||
* Set the amount of vertical white space that will be present before the paragraph. | |||
* This space is specified in either percentage or points: | |||
* <p> | |||
* If spaceBefore >= 0, then space is a percentage of normal line height. | |||
* If spaceBefore < 0, the absolute value of linespacing is the spacing in points | |||
* If spaceBefore >= 0, then space is a percentage of normal line height. | |||
* If spaceBefore < 0, the absolute value of linespacing is the spacing in points | |||
* </p> | |||
* Examples: | |||
* <pre><code> | |||
@@ -179,8 +179,8 @@ public interface TextParagraph< | |||
* The amount of vertical white space after the paragraph | |||
* This may be specified in two different ways, percentage spacing and font point spacing: | |||
* <p> | |||
* If spaceBefore >= 0, then space is a percentage of normal line height. | |||
* If spaceBefore < 0, the absolute value of linespacing is the spacing in points | |||
* If spaceBefore >= 0, then space is a percentage of normal line height. | |||
* If spaceBefore < 0, the absolute value of linespacing is the spacing in points | |||
* </p> | |||
* | |||
* @return the vertical white space after the paragraph or null, if unset | |||
@@ -191,8 +191,8 @@ public interface TextParagraph< | |||
* Set the amount of vertical white space that will be present after the paragraph. | |||
* This space is specified in either percentage or points: | |||
* <p> | |||
* If spaceAfter >= 0, then space is a percentage of normal line height. | |||
* If spaceAfter < 0, the absolute value of linespacing is the spacing in points | |||
* If spaceAfter >= 0, then space is a percentage of normal line height. | |||
* If spaceAfter < 0, the absolute value of linespacing is the spacing in points | |||
* </p> | |||
* Examples: | |||
* <pre><code> | |||
@@ -283,8 +283,8 @@ public interface TextParagraph< | |||
* This element specifies the vertical line spacing that is to be used within a paragraph. | |||
* This may be specified in two different ways, percentage spacing and font point spacing: | |||
* <p> | |||
* If linespacing >= 0, then linespacing is a percentage of normal line height | |||
* If linespacing < 0, the absolute value of linespacing is the spacing in points | |||
* If linespacing >= 0, then linespacing is a percentage of normal line height | |||
* If linespacing < 0, the absolute value of linespacing is the spacing in points | |||
* </p> | |||
* Examples: | |||
* <pre><code> |
@@ -823,7 +823,7 @@ public final class WorkbookEvaluator { | |||
* <p> | |||
* Returns a single value e.g. a cell formula result or boolean value for conditional formatting. | |||
* | |||
* @param formula | |||
* @param formula The formula to evaluate | |||
* @param target cell context for the operation | |||
* @param region containing the cell | |||
* @return value | |||
@@ -840,8 +840,8 @@ public final class WorkbookEvaluator { | |||
* offset position relative to the top left of the range. | |||
* <p> | |||
* Returns a ValueEval that may be one or more values, such as the allowed values for a data validation constraint. | |||
* | |||
* @param formula | |||
* | |||
* @param formula The formula to evaluate | |||
* @param target cell context for the operation | |||
* @param region containing the cell | |||
* @return ValueEval for one or more values |
@@ -35,10 +35,10 @@ public final class OperandResolver { | |||
private static final String Digits = "(\\p{Digit}+)"; | |||
private static final String Exp = "[eE][+-]?"+Digits; | |||
private static final String fpRegex = | |||
("[\\x00-\\x20]*" + | |||
"[+-]?(" + | |||
"((("+Digits+"(\\.)?("+Digits+"?)("+Exp+")?)|"+ | |||
"(\\.("+Digits+")("+Exp+")?))))"+ | |||
("[\\x00-\\x20]*" + | |||
"[+-]?(" + | |||
"("+Digits+"(\\.)?("+Digits+"?)("+Exp+")?)|"+ | |||
"(\\."+Digits+"("+Exp+")?))"+ | |||
"[\\x00-\\x20]*"); | |||
@@ -54,7 +54,7 @@ public final class OperandResolver { | |||
* @param srcCellCol used when arg is a single row AreaRef | |||
* @return a <tt>NumberEval</tt>, <tt>StringEval</tt>, <tt>BoolEval</tt> or <tt>BlankEval</tt>. | |||
* Never <code>null</code> or <tt>ErrorEval</tt>. | |||
* @throws EvaluationException(#VALUE!) if srcCellRow or srcCellCol do not properly index into | |||
* @throws EvaluationException if srcCellRow or srcCellCol do not properly index into | |||
* an AreaEval. If the actual value retrieved is an ErrorEval, a corresponding | |||
* EvaluationException is thrown. | |||
*/ | |||
@@ -243,7 +243,7 @@ public final class OperandResolver { | |||
* @param ev must be a {@link NumberEval}, {@link StringEval}, {@link BoolEval} or | |||
* {@link BlankEval} | |||
* @return actual, parsed or interpreted double value (respectively). | |||
* @throws EvaluationException(#VALUE!) only if a StringEval is supplied and cannot be parsed | |||
* @throws EvaluationException if a StringEval is supplied and cannot be parsed | |||
* as a double (See <tt>parseDouble()</tt> for allowable formats). | |||
* @throws RuntimeException if the supplied parameter is not {@link NumberEval}, | |||
* {@link StringEval}, {@link BoolEval} or {@link BlankEval} | |||
@@ -329,10 +329,6 @@ public final class OperandResolver { | |||
return Boolean.valueOf(((BoolEval) ve).getBooleanValue()); | |||
} | |||
if (ve == BlankEval.instance) { | |||
return null; | |||
} | |||
if (ve instanceof StringEval) { | |||
if (stringsAreBlanks) { | |||
return null; |
@@ -42,18 +42,18 @@ public abstract class RelationalOperationEval extends Fixed2ArgFunction implemen | |||
* for the relational operators Evals. | |||
* | |||
* <pre> | |||
* Bool.TRUE > any number. | |||
* Bool > any string. ALWAYS | |||
* Bool.TRUE > Bool.FALSE | |||
* Bool.TRUE > any number. | |||
* Bool > any string. ALWAYS | |||
* Bool.TRUE > Bool.FALSE | |||
* Bool.FALSE == Blank | |||
* | |||
* Strings are never converted to numbers or booleans | |||
* String > any number. ALWAYS | |||
* Non-empty String > Blank | |||
* String > any number. ALWAYS | |||
* Non-empty String > Blank | |||
* Empty String == Blank | |||
* String are sorted dictionary wise | |||
* | |||
* Blank > Negative numbers | |||
* Blank > Negative numbers | |||
* Blank == 0 | |||
* Blank < Positive numbers | |||
* </pre> |
@@ -265,7 +265,7 @@ public interface Font { | |||
void setCharSet(int charset); | |||
/** | |||
* get the index within the XSSFWorkbook (sequence within the collection of Font objects) | |||
* Get the index within the XSSFWorkbook (sequence within the collection of Font objects) | |||
* | |||
* @return unique index number of the underlying record this Font represents (probably you don't care | |||
* unless you're comparing which one is which) |
@@ -60,7 +60,7 @@ public abstract class BaseRowColShifter { | |||
/** | |||
* Update conditional formatting | |||
* @param formulaShifter | |||
* @param formulaShifter The {@link FormulaShifter} to use | |||
*/ | |||
public abstract void updateConditionalFormatting(FormulaShifter formulaShifter); | |||
@@ -51,24 +51,21 @@ public final class TestTextObjectBaseRecord extends TestCase { | |||
"02 00 00 00 00 00 00 00 " | |||
); | |||
public void testLoad() { | |||
RecordInputStream in = TestcaseRecordInputStream.create(data); | |||
TextObjectRecord record = new TextObjectRecord(in); | |||
assertEquals(TextObjectRecord.HORIZONTAL_TEXT_ALIGNMENT_CENTERED, record.getHorizontalTextAlignment()); | |||
assertEquals(TextObjectRecord.VERTICAL_TEXT_ALIGNMENT_JUSTIFY, record.getVerticalTextAlignment()); | |||
assertEquals(true, record.isTextLocked()); | |||
assertTrue(record.isTextLocked()); | |||
assertEquals(TextObjectRecord.TEXT_ORIENTATION_ROT_RIGHT, record.getTextOrientation()); | |||
assertEquals(49, record.getRecordSize() ); | |||
} | |||
public void testStore() | |||
{ | |||
public void testStore() { | |||
TextObjectRecord record = new TextObjectRecord(); | |||
HSSFRichTextString str = new HSSFRichTextString("AB"); | |||
str.applyFont(0, 2, (short)0x0018); | |||
str.applyFont(2, 2, (short)0x0320); |
@@ -28,31 +28,23 @@ import junit.framework.TestCase; | |||
public final class TestOperandResolver extends TestCase { | |||
public void testParseDouble_bug48472() { | |||
String value = "-"; | |||
Double resolvedValue = null; | |||
final Double resolvedValue; | |||
try { | |||
resolvedValue = OperandResolver.parseDouble(value); | |||
resolvedValue = OperandResolver.parseDouble("-"); | |||
} catch (StringIndexOutOfBoundsException e) { | |||
throw new AssertionFailedError("Identified bug 48472"); | |||
} | |||
assertEquals(null, resolvedValue); | |||
assertNull(resolvedValue); | |||
} | |||
public void testParseDouble_bug49723() { | |||
String value = ".1"; | |||
Double resolvedValue = null; | |||
resolvedValue = OperandResolver.parseDouble(value); | |||
Double resolvedValue = OperandResolver.parseDouble(value); | |||
assertNotNull("Identified bug 49723", resolvedValue); | |||
} | |||
/** | |||
@@ -61,14 +53,13 @@ public final class TestOperandResolver extends TestCase { | |||
* | |||
*/ | |||
public void testParseDoubleValidStrings() { | |||
String[] values = new String[]{".19", "0.19", "1.9", "1E4", "-.19", "-0.19", "8.5","-1E4", ".5E6","+1.5","+1E5", " +1E5 "}; | |||
String[] values = new String[]{".19", "0.19", "1.9", "1E4", "-.19", "-0.19", | |||
"8.5","-1E4", ".5E6","+1.5","+1E5", " +1E5 ", " 123 ", "1E4", "-123" }; | |||
for (String value : values) { | |||
assertTrue(OperandResolver.parseDouble(value) != null); | |||
assertNotNull(OperandResolver.parseDouble(value)); | |||
assertEquals(OperandResolver.parseDouble(value), Double.parseDouble(value)); | |||
} | |||
} | |||
/** | |||
@@ -77,13 +68,10 @@ public final class TestOperandResolver extends TestCase { | |||
* | |||
*/ | |||
public void testParseDoubleInvalidStrings() { | |||
String[] values = new String[]{"-", "ABC", "-X", "1E5a", "Infinity", "NaN", ".5F", "1,000"}; | |||
for (String value : values) { | |||
assertEquals(null, OperandResolver.parseDouble(value)); | |||
assertNull(OperandResolver.parseDouble(value)); | |||
} | |||
} | |||
} |