javadocs fixes (jdk8)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1751387 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
e4d673ddc3
commit
3ef17caad7
@ -32,6 +32,10 @@ public final class RecordStream {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a RecordStream bounded by startIndex and endIndex
|
* Creates a RecordStream bounded by startIndex and endIndex
|
||||||
|
*
|
||||||
|
* @param inputList the list to iterate over
|
||||||
|
* @param startIndex the start index within the list
|
||||||
|
* @param endIx the end index within the list, which is the index of the end element + 1
|
||||||
*/
|
*/
|
||||||
public RecordStream(List<Record> inputList, int startIndex, int endIx) {
|
public RecordStream(List<Record> inputList, int startIndex, int endIx) {
|
||||||
_list = inputList;
|
_list = inputList;
|
||||||
|
@ -43,6 +43,8 @@ public final class RowBlocksReader {
|
|||||||
/**
|
/**
|
||||||
* Also collects any loose MergeCellRecords and puts them in the supplied
|
* Also collects any loose MergeCellRecords and puts them in the supplied
|
||||||
* mergedCellsTable
|
* mergedCellsTable
|
||||||
|
*
|
||||||
|
* @param rs the record stream
|
||||||
*/
|
*/
|
||||||
public RowBlocksReader(RecordStream rs) {
|
public RowBlocksReader(RecordStream rs) {
|
||||||
List<Record> plainRecords = new ArrayList<Record>();
|
List<Record> plainRecords = new ArrayList<Record>();
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
package org.apache.poi.hssf.record;
|
package org.apache.poi.hssf.record;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.poi.ddf.DefaultEscherRecordFactory;
|
import org.apache.poi.ddf.DefaultEscherRecordFactory;
|
||||||
@ -32,9 +31,6 @@ import org.apache.poi.hssf.util.LazilyConcatenatedByteArray;
|
|||||||
/**
|
/**
|
||||||
* The escher container record is used to hold escher records. It is abstract and
|
* The escher container record is used to hold escher records. It is abstract and
|
||||||
* must be subclassed for maximum benefit.
|
* must be subclassed for maximum benefit.
|
||||||
*
|
|
||||||
* @author Glen Stampoultzis (glens at apache.org)
|
|
||||||
* @author Michael Zalewski (zalewski at optonline.net)
|
|
||||||
*/
|
*/
|
||||||
public abstract class AbstractEscherHolderRecord extends Record implements Cloneable {
|
public abstract class AbstractEscherHolderRecord extends Record implements Cloneable {
|
||||||
private static boolean DESERIALISE;
|
private static boolean DESERIALISE;
|
||||||
@ -46,8 +42,8 @@ public abstract class AbstractEscherHolderRecord extends Record implements Clone
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<EscherRecord> escherRecords;
|
private final List<EscherRecord> escherRecords;
|
||||||
private LazilyConcatenatedByteArray rawDataContainer = new LazilyConcatenatedByteArray();
|
private final LazilyConcatenatedByteArray rawDataContainer = new LazilyConcatenatedByteArray();
|
||||||
|
|
||||||
public AbstractEscherHolderRecord()
|
public AbstractEscherHolderRecord()
|
||||||
{
|
{
|
||||||
@ -85,6 +81,7 @@ public abstract class AbstractEscherHolderRecord extends Record implements Clone
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
StringBuffer buffer = new StringBuffer();
|
StringBuffer buffer = new StringBuffer();
|
||||||
@ -93,9 +90,7 @@ public abstract class AbstractEscherHolderRecord extends Record implements Clone
|
|||||||
buffer.append('[' + getRecordName() + ']' + nl);
|
buffer.append('[' + getRecordName() + ']' + nl);
|
||||||
if (escherRecords.size() == 0)
|
if (escherRecords.size() == 0)
|
||||||
buffer.append("No Escher Records Decoded" + nl);
|
buffer.append("No Escher Records Decoded" + nl);
|
||||||
for ( Iterator<EscherRecord> iterator = escherRecords.iterator(); iterator.hasNext(); )
|
for (EscherRecord r : escherRecords) {
|
||||||
{
|
|
||||||
EscherRecord r = iterator.next();
|
|
||||||
buffer.append(r.toString());
|
buffer.append(r.toString());
|
||||||
}
|
}
|
||||||
buffer.append("[/" + getRecordName() + ']' + nl);
|
buffer.append("[/" + getRecordName() + ']' + nl);
|
||||||
@ -105,6 +100,7 @@ public abstract class AbstractEscherHolderRecord extends Record implements Clone
|
|||||||
|
|
||||||
protected abstract String getRecordName();
|
protected abstract String getRecordName();
|
||||||
|
|
||||||
|
@Override
|
||||||
public int serialize(int offset, byte[] data)
|
public int serialize(int offset, byte[] data)
|
||||||
{
|
{
|
||||||
LittleEndian.putShort( data, 0 + offset, getSid() );
|
LittleEndian.putShort( data, 0 + offset, getSid() );
|
||||||
@ -121,14 +117,13 @@ public abstract class AbstractEscherHolderRecord extends Record implements Clone
|
|||||||
LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
|
LittleEndian.putShort(data, 2 + offset, (short)(getRecordSize() - 4));
|
||||||
|
|
||||||
int pos = offset + 4;
|
int pos = offset + 4;
|
||||||
for ( Iterator<EscherRecord> iterator = escherRecords.iterator(); iterator.hasNext(); )
|
for (EscherRecord r : escherRecords) {
|
||||||
{
|
|
||||||
EscherRecord r = iterator.next();
|
|
||||||
pos += r.serialize( pos, data, new NullEscherSerializationListener() );
|
pos += r.serialize( pos, data, new NullEscherSerializationListener() );
|
||||||
}
|
}
|
||||||
return getRecordSize();
|
return getRecordSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public int getRecordSize() {
|
public int getRecordSize() {
|
||||||
byte[] rawData = getRawData();
|
byte[] rawData = getRawData();
|
||||||
if (escherRecords.size() == 0 && rawData != null) {
|
if (escherRecords.size() == 0 && rawData != null) {
|
||||||
@ -136,9 +131,7 @@ public abstract class AbstractEscherHolderRecord extends Record implements Clone
|
|||||||
return rawData.length;
|
return rawData.length;
|
||||||
}
|
}
|
||||||
int size = 0;
|
int size = 0;
|
||||||
for ( Iterator<EscherRecord> iterator = escherRecords.iterator(); iterator.hasNext(); )
|
for (EscherRecord r : escherRecords) {
|
||||||
{
|
|
||||||
EscherRecord r = iterator.next();
|
|
||||||
size += r.getRecordSize();
|
size += r.getRecordSize();
|
||||||
}
|
}
|
||||||
return size;
|
return size;
|
||||||
@ -146,6 +139,7 @@ public abstract class AbstractEscherHolderRecord extends Record implements Clone
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
public abstract short getSid();
|
public abstract short getSid();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -177,10 +171,11 @@ public abstract class AbstractEscherHolderRecord extends Record implements Clone
|
|||||||
* If we have a EscherContainerRecord as one of our
|
* If we have a EscherContainerRecord as one of our
|
||||||
* children (and most top level escher holders do),
|
* children (and most top level escher holders do),
|
||||||
* then return that.
|
* then return that.
|
||||||
|
*
|
||||||
|
* @return the EscherContainerRecord or {@code null} if no child is a container record
|
||||||
*/
|
*/
|
||||||
public EscherContainerRecord getEscherContainer() {
|
public EscherContainerRecord getEscherContainer() {
|
||||||
for(Iterator<EscherRecord> it = escherRecords.iterator(); it.hasNext();) {
|
for (EscherRecord er : escherRecords) {
|
||||||
EscherRecord er = it.next();
|
|
||||||
if(er instanceof EscherContainerRecord) {
|
if(er instanceof EscherContainerRecord) {
|
||||||
return (EscherContainerRecord)er;
|
return (EscherContainerRecord)er;
|
||||||
}
|
}
|
||||||
@ -192,22 +187,25 @@ public abstract class AbstractEscherHolderRecord extends Record implements Clone
|
|||||||
* Descends into all our children, returning the
|
* Descends into all our children, returning the
|
||||||
* first EscherRecord with the given id, or null
|
* first EscherRecord with the given id, or null
|
||||||
* if none found
|
* if none found
|
||||||
|
*
|
||||||
|
* @param id the record to look for
|
||||||
|
*
|
||||||
|
* @return the record or {@code null} if it can't be found
|
||||||
*/
|
*/
|
||||||
public EscherRecord findFirstWithId(short id) {
|
public EscherRecord findFirstWithId(short id) {
|
||||||
return findFirstWithId(id, getEscherRecords());
|
return findFirstWithId(id, getEscherRecords());
|
||||||
}
|
}
|
||||||
|
|
||||||
private EscherRecord findFirstWithId(short id, List<EscherRecord> records) {
|
private EscherRecord findFirstWithId(short id, List<EscherRecord> records) {
|
||||||
// Check at our level
|
// Check at our level
|
||||||
for(Iterator<EscherRecord> it = records.iterator(); it.hasNext();) {
|
for (EscherRecord r : records) {
|
||||||
EscherRecord r = it.next();
|
|
||||||
if(r.getRecordId() == id) {
|
if(r.getRecordId() == id) {
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Then check our children in turn
|
// Then check our children in turn
|
||||||
for(Iterator<EscherRecord> it = records.iterator(); it.hasNext();) {
|
for (EscherRecord r : records) {
|
||||||
EscherRecord r = it.next();
|
|
||||||
if(r.isContainerRecord()) {
|
if(r.isContainerRecord()) {
|
||||||
EscherRecord found = findFirstWithId(id, r.getChildRecords());
|
EscherRecord found = findFirstWithId(id, r.getChildRecords());
|
||||||
if(found != null) {
|
if(found != null) {
|
||||||
@ -229,6 +227,8 @@ public abstract class AbstractEscherHolderRecord extends Record implements Clone
|
|||||||
/**
|
/**
|
||||||
* Big drawing group records are split but it's easier to deal with them
|
* Big drawing group records are split but it's easier to deal with them
|
||||||
* as a whole group so we need to join them together.
|
* as a whole group so we need to join them together.
|
||||||
|
*
|
||||||
|
* @param record the record data to concatenate to the end
|
||||||
*/
|
*/
|
||||||
public void join( AbstractEscherHolderRecord record )
|
public void join( AbstractEscherHolderRecord record )
|
||||||
{
|
{
|
||||||
|
@ -20,13 +20,21 @@ public interface BiffHeaderInput {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Read an unsigned short from the stream without decrypting
|
* Read an unsigned short from the stream without decrypting
|
||||||
|
*
|
||||||
|
* @return the record sid
|
||||||
*/
|
*/
|
||||||
int readRecordSID();
|
int readRecordSID();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read an unsigned short from the stream without decrypting
|
* Read an unsigned short from the stream without decrypting
|
||||||
|
*
|
||||||
|
* @return the data size
|
||||||
*/
|
*/
|
||||||
int readDataSize();
|
int readDataSize();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the available bytes
|
||||||
|
*/
|
||||||
int available();
|
int available();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -33,9 +33,7 @@ import org.apache.poi.ss.util.WorkbookUtil;
|
|||||||
* Description: Defines a sheet within a workbook. Basically stores the sheet name
|
* Description: Defines a sheet within a workbook. Basically stores the sheet name
|
||||||
* and tells where the Beginning of file record is within the HSSF
|
* and tells where the Beginning of file record is within the HSSF
|
||||||
* file. <P>
|
* file. <P>
|
||||||
* REFERENCE: PG 291 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
|
* REFERENCE: PG 291 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)
|
||||||
* @author Andrew C. Oliver (acoliver at apache dot org)
|
|
||||||
* @author Sergei Kozello (sergeikozello at mail.ru)
|
|
||||||
*/
|
*/
|
||||||
public final class BoundSheetRecord extends StandardRecord {
|
public final class BoundSheetRecord extends StandardRecord {
|
||||||
public final static short sid = 0x0085;
|
public final static short sid = 0x0085;
|
||||||
@ -58,6 +56,8 @@ public final class BoundSheetRecord extends StandardRecord {
|
|||||||
*
|
*
|
||||||
* UNICODE: sid + len + bof + flags + len(str) + unicode + str 2 + 2 + 4 + 2 +
|
* UNICODE: sid + len + bof + flags + len(str) + unicode + str 2 + 2 + 4 + 2 +
|
||||||
* 1 + 1 + 2 * len(str)
|
* 1 + 1 + 2 * len(str)
|
||||||
|
*
|
||||||
|
* @param in the record stream to read from
|
||||||
*/
|
*/
|
||||||
public BoundSheetRecord(RecordInputStream in) {
|
public BoundSheetRecord(RecordInputStream in) {
|
||||||
field_1_position_of_BOF = in.readInt();
|
field_1_position_of_BOF = in.readInt();
|
||||||
@ -154,6 +154,8 @@ public final class BoundSheetRecord extends StandardRecord {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Is the sheet hidden? Different from very hidden
|
* Is the sheet hidden? Different from very hidden
|
||||||
|
*
|
||||||
|
* @return {@code true} if hidden
|
||||||
*/
|
*/
|
||||||
public boolean isHidden() {
|
public boolean isHidden() {
|
||||||
return hiddenFlag.isSet(field_2_option_flags);
|
return hiddenFlag.isSet(field_2_option_flags);
|
||||||
@ -161,6 +163,8 @@ public final class BoundSheetRecord extends StandardRecord {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Is the sheet hidden? Different from very hidden
|
* Is the sheet hidden? Different from very hidden
|
||||||
|
*
|
||||||
|
* @param hidden {@code true} if hidden
|
||||||
*/
|
*/
|
||||||
public void setHidden(boolean hidden) {
|
public void setHidden(boolean hidden) {
|
||||||
field_2_option_flags = hiddenFlag.setBoolean(field_2_option_flags, hidden);
|
field_2_option_flags = hiddenFlag.setBoolean(field_2_option_flags, hidden);
|
||||||
@ -168,6 +172,8 @@ public final class BoundSheetRecord extends StandardRecord {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Is the sheet very hidden? Different from (normal) hidden
|
* Is the sheet very hidden? Different from (normal) hidden
|
||||||
|
*
|
||||||
|
* @return {@code true} if very hidden
|
||||||
*/
|
*/
|
||||||
public boolean isVeryHidden() {
|
public boolean isVeryHidden() {
|
||||||
return veryHiddenFlag.isSet(field_2_option_flags);
|
return veryHiddenFlag.isSet(field_2_option_flags);
|
||||||
@ -175,6 +181,8 @@ public final class BoundSheetRecord extends StandardRecord {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Is the sheet very hidden? Different from (normal) hidden
|
* Is the sheet very hidden? Different from (normal) hidden
|
||||||
|
*
|
||||||
|
* @param veryHidden {@code true} if very hidden
|
||||||
*/
|
*/
|
||||||
public void setVeryHidden(boolean veryHidden) {
|
public void setVeryHidden(boolean veryHidden) {
|
||||||
field_2_option_flags = veryHiddenFlag.setBoolean(field_2_option_flags, veryHidden);
|
field_2_option_flags = veryHiddenFlag.setBoolean(field_2_option_flags, veryHidden);
|
||||||
@ -183,6 +191,10 @@ public final class BoundSheetRecord extends StandardRecord {
|
|||||||
/**
|
/**
|
||||||
* Converts a List of {@link BoundSheetRecord}s to an array and sorts by the position of their
|
* Converts a List of {@link BoundSheetRecord}s to an array and sorts by the position of their
|
||||||
* BOFs.
|
* BOFs.
|
||||||
|
*
|
||||||
|
* @param boundSheetRecords the boundSheetRecord list to arrayify
|
||||||
|
*
|
||||||
|
* @return the sorted boundSheetRecords
|
||||||
*/
|
*/
|
||||||
public static BoundSheetRecord[] orderByBofPosition(List<BoundSheetRecord> boundSheetRecords) {
|
public static BoundSheetRecord[] orderByBofPosition(List<BoundSheetRecord> boundSheetRecords) {
|
||||||
BoundSheetRecord[] bsrs = new BoundSheetRecord[boundSheetRecords.size()];
|
BoundSheetRecord[] bsrs = new BoundSheetRecord[boundSheetRecords.size()];
|
||||||
@ -190,6 +202,7 @@ public final class BoundSheetRecord extends StandardRecord {
|
|||||||
Arrays.sort(bsrs, BOFComparator);
|
Arrays.sort(bsrs, BOFComparator);
|
||||||
return bsrs;
|
return bsrs;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final Comparator<BoundSheetRecord> BOFComparator = new Comparator<BoundSheetRecord>() {
|
private static final Comparator<BoundSheetRecord> BOFComparator = new Comparator<BoundSheetRecord>() {
|
||||||
|
|
||||||
public int compare(BoundSheetRecord bsr1, BoundSheetRecord bsr2) {
|
public int compare(BoundSheetRecord bsr1, BoundSheetRecord bsr2) {
|
||||||
|
@ -97,14 +97,27 @@ public final class CFRule12Record extends CFRuleBase implements FutureRecord, Cl
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new comparison operation rule
|
* Creates a new comparison operation rule
|
||||||
|
*
|
||||||
|
* @param sheet the sheet
|
||||||
|
* @param formulaText the first formula text
|
||||||
|
*
|
||||||
|
* @return a new comparison operation rule
|
||||||
*/
|
*/
|
||||||
public static CFRule12Record create(HSSFSheet sheet, String formulaText) {
|
public static CFRule12Record create(HSSFSheet sheet, String formulaText) {
|
||||||
Ptg[] formula1 = parseFormula(formulaText, sheet);
|
Ptg[] formula1 = parseFormula(formulaText, sheet);
|
||||||
return new CFRule12Record(CONDITION_TYPE_FORMULA, ComparisonOperator.NO_COMPARISON,
|
return new CFRule12Record(CONDITION_TYPE_FORMULA, ComparisonOperator.NO_COMPARISON,
|
||||||
formula1, null, null);
|
formula1, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new comparison operation rule
|
* Creates a new comparison operation rule
|
||||||
|
*
|
||||||
|
* @param sheet the sheet
|
||||||
|
* @param comparisonOperation the comparison operation
|
||||||
|
* @param formulaText1 the first formula text
|
||||||
|
* @param formulaText2 the second formula text
|
||||||
|
*
|
||||||
|
* @return a new comparison operation rule
|
||||||
*/
|
*/
|
||||||
public static CFRule12Record create(HSSFSheet sheet, byte comparisonOperation,
|
public static CFRule12Record create(HSSFSheet sheet, byte comparisonOperation,
|
||||||
String formulaText1, String formulaText2) {
|
String formulaText1, String formulaText2) {
|
||||||
@ -113,8 +126,17 @@ public final class CFRule12Record extends CFRuleBase implements FutureRecord, Cl
|
|||||||
return new CFRule12Record(CONDITION_TYPE_CELL_VALUE_IS, comparisonOperation,
|
return new CFRule12Record(CONDITION_TYPE_CELL_VALUE_IS, comparisonOperation,
|
||||||
formula1, formula2, null);
|
formula1, formula2, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new comparison operation rule
|
* Creates a new comparison operation rule
|
||||||
|
*
|
||||||
|
* @param sheet the sheet
|
||||||
|
* @param comparisonOperation the comparison operation
|
||||||
|
* @param formulaText1 the first formula text
|
||||||
|
* @param formulaText2 the second formula text
|
||||||
|
* @param formulaTextScale the scale to apply for the comparison
|
||||||
|
*
|
||||||
|
* @return a new comparison operation rule
|
||||||
*/
|
*/
|
||||||
public static CFRule12Record create(HSSFSheet sheet, byte comparisonOperation,
|
public static CFRule12Record create(HSSFSheet sheet, byte comparisonOperation,
|
||||||
String formulaText1, String formulaText2, String formulaTextScale) {
|
String formulaText1, String formulaText2, String formulaTextScale) {
|
||||||
@ -124,8 +146,14 @@ public final class CFRule12Record extends CFRuleBase implements FutureRecord, Cl
|
|||||||
return new CFRule12Record(CONDITION_TYPE_CELL_VALUE_IS, comparisonOperation,
|
return new CFRule12Record(CONDITION_TYPE_CELL_VALUE_IS, comparisonOperation,
|
||||||
formula1, formula2, formula3);
|
formula1, formula2, formula3);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new Data Bar formatting
|
* Creates a new Data Bar formatting
|
||||||
|
*
|
||||||
|
* @param sheet the sheet
|
||||||
|
* @param color the data bar color
|
||||||
|
*
|
||||||
|
* @return a new Data Bar formatting
|
||||||
*/
|
*/
|
||||||
public static CFRule12Record create(HSSFSheet sheet, ExtendedColor color) {
|
public static CFRule12Record create(HSSFSheet sheet, ExtendedColor color) {
|
||||||
CFRule12Record r = new CFRule12Record(CONDITION_TYPE_DATA_BAR,
|
CFRule12Record r = new CFRule12Record(CONDITION_TYPE_DATA_BAR,
|
||||||
@ -145,8 +173,14 @@ public final class CFRule12Record extends CFRuleBase implements FutureRecord, Cl
|
|||||||
|
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new Icon Set / Multi-State formatting
|
* Creates a new Icon Set / Multi-State formatting
|
||||||
|
*
|
||||||
|
* @param sheet the sheet
|
||||||
|
* @param iconSet the icon set
|
||||||
|
*
|
||||||
|
* @return a new Icon Set / Multi-State formatting
|
||||||
*/
|
*/
|
||||||
public static CFRule12Record create(HSSFSheet sheet, IconSet iconSet) {
|
public static CFRule12Record create(HSSFSheet sheet, IconSet iconSet) {
|
||||||
Threshold[] ts = new Threshold[iconSet.num];
|
Threshold[] ts = new Threshold[iconSet.num];
|
||||||
@ -161,8 +195,13 @@ public final class CFRule12Record extends CFRuleBase implements FutureRecord, Cl
|
|||||||
imf.setThresholds(ts);
|
imf.setThresholds(ts);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new Color Scale / Color Gradient formatting
|
* Creates a new Color Scale / Color Gradient formatting
|
||||||
|
*
|
||||||
|
* @param sheet the sheet
|
||||||
|
*
|
||||||
|
* @return a new Color Scale / Color Gradient formatting
|
||||||
*/
|
*/
|
||||||
public static CFRule12Record createColorScale(HSSFSheet sheet) {
|
public static CFRule12Record createColorScale(HSSFSheet sheet) {
|
||||||
int numPoints = 3;
|
int numPoints = 3;
|
||||||
|
@ -139,7 +139,12 @@ public abstract class CFRuleBase extends StandardRecord implements Cloneable {
|
|||||||
private Formula formula1;
|
private Formula formula1;
|
||||||
private Formula formula2;
|
private Formula formula2;
|
||||||
|
|
||||||
/** Creates new CFRuleRecord */
|
/**
|
||||||
|
* Creates new CFRuleRecord
|
||||||
|
*
|
||||||
|
* @param conditionType the condition type
|
||||||
|
* @param comparisonOperation the comparison operation
|
||||||
|
*/
|
||||||
protected CFRuleBase(byte conditionType, byte comparisonOperation) {
|
protected CFRuleBase(byte conditionType, byte comparisonOperation) {
|
||||||
setConditionType(conditionType);
|
setConditionType(conditionType);
|
||||||
setComparisonOperation(comparisonOperation);
|
setComparisonOperation(comparisonOperation);
|
||||||
|
@ -59,6 +59,11 @@ public final class CFRuleRecord extends CFRuleBase implements Cloneable {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new comparison operation rule
|
* Creates a new comparison operation rule
|
||||||
|
*
|
||||||
|
* @param sheet the sheet
|
||||||
|
* @param formulaText the formula text
|
||||||
|
*
|
||||||
|
* @return a new comparison operation rule
|
||||||
*/
|
*/
|
||||||
public static CFRuleRecord create(HSSFSheet sheet, String formulaText) {
|
public static CFRuleRecord create(HSSFSheet sheet, String formulaText) {
|
||||||
Ptg[] formula1 = parseFormula(formulaText, sheet);
|
Ptg[] formula1 = parseFormula(formulaText, sheet);
|
||||||
@ -67,6 +72,13 @@ public final class CFRuleRecord extends CFRuleBase implements Cloneable {
|
|||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Creates a new comparison operation rule
|
* Creates a new comparison operation rule
|
||||||
|
*
|
||||||
|
* @param sheet the sheet
|
||||||
|
* @param comparisonOperation the comparison operation
|
||||||
|
* @param formulaText1 the first formula text
|
||||||
|
* @param formulaText2 the second formula text
|
||||||
|
*
|
||||||
|
* @return a new comparison operation rule
|
||||||
*/
|
*/
|
||||||
public static CFRuleRecord create(HSSFSheet sheet, byte comparisonOperation,
|
public static CFRuleRecord create(HSSFSheet sheet, byte comparisonOperation,
|
||||||
String formulaText1, String formulaText2) {
|
String formulaText1, String formulaText2) {
|
||||||
@ -87,6 +99,7 @@ public final class CFRuleRecord extends CFRuleBase implements Cloneable {
|
|||||||
setFormula2(Formula.read(field_4_formula2_len, in));
|
setFormula2(Formula.read(field_4_formula2_len, in));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public short getSid() {
|
public short getSid() {
|
||||||
return sid;
|
return sid;
|
||||||
}
|
}
|
||||||
@ -98,6 +111,7 @@ public final class CFRuleRecord extends CFRuleBase implements Cloneable {
|
|||||||
*
|
*
|
||||||
* @param out the stream to write to
|
* @param out the stream to write to
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public void serialize(LittleEndianOutput out) {
|
public void serialize(LittleEndianOutput out) {
|
||||||
int formula1Len=getFormulaSize(getFormula1());
|
int formula1Len=getFormulaSize(getFormula1());
|
||||||
int formula2Len=getFormulaSize(getFormula2());
|
int formula2Len=getFormulaSize(getFormula2());
|
||||||
@ -113,12 +127,14 @@ public final class CFRuleRecord extends CFRuleBase implements Cloneable {
|
|||||||
getFormula2().serializeTokens(out);
|
getFormula2().serializeTokens(out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected int getDataSize() {
|
protected int getDataSize() {
|
||||||
return 6 + getFormattingBlockSize() +
|
return 6 + getFormattingBlockSize() +
|
||||||
getFormulaSize(getFormula1())+
|
getFormulaSize(getFormula1())+
|
||||||
getFormulaSize(getFormula2());
|
getFormulaSize(getFormula2());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
StringBuffer buffer = new StringBuffer();
|
StringBuffer buffer = new StringBuffer();
|
||||||
buffer.append("[CFRULE]\n");
|
buffer.append("[CFRULE]\n");
|
||||||
|
@ -23,8 +23,6 @@ import org.apache.poi.util.LittleEndianOutput;
|
|||||||
/**
|
/**
|
||||||
* Base class for all cell value records (implementors of {@link CellValueRecordInterface}).
|
* Base class for all cell value records (implementors of {@link CellValueRecordInterface}).
|
||||||
* Subclasses are expected to manage the cell data values (of various types).
|
* Subclasses are expected to manage the cell data values (of various types).
|
||||||
*
|
|
||||||
* @author Josh Micich
|
|
||||||
*/
|
*/
|
||||||
public abstract class CellRecord extends StandardRecord implements CellValueRecordInterface {
|
public abstract class CellRecord extends StandardRecord implements CellValueRecordInterface {
|
||||||
private int _rowIndex;
|
private int _rowIndex;
|
||||||
@ -41,10 +39,12 @@ public abstract class CellRecord extends StandardRecord implements CellValueReco
|
|||||||
_formatIndex = in.readUShort();
|
_formatIndex = in.readUShort();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public final void setRow(int row) {
|
public final void setRow(int row) {
|
||||||
_rowIndex = row;
|
_rowIndex = row;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public final void setColumn(short col) {
|
public final void setColumn(short col) {
|
||||||
_columnIndex = col;
|
_columnIndex = col;
|
||||||
}
|
}
|
||||||
@ -55,14 +55,17 @@ public abstract class CellRecord extends StandardRecord implements CellValueReco
|
|||||||
* @see org.apache.poi.hssf.record.ExtendedFormatRecord
|
* @see org.apache.poi.hssf.record.ExtendedFormatRecord
|
||||||
* @param xf index to the XF record
|
* @param xf index to the XF record
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public final void setXFIndex(short xf) {
|
public final void setXFIndex(short xf) {
|
||||||
_formatIndex = xf;
|
_formatIndex = xf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public final int getRow() {
|
public final int getRow() {
|
||||||
return _rowIndex;
|
return _rowIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public final short getColumn() {
|
public final short getColumn() {
|
||||||
return (short) _columnIndex;
|
return (short) _columnIndex;
|
||||||
}
|
}
|
||||||
@ -73,6 +76,7 @@ public abstract class CellRecord extends StandardRecord implements CellValueReco
|
|||||||
* @see org.apache.poi.hssf.record.ExtendedFormatRecord
|
* @see org.apache.poi.hssf.record.ExtendedFormatRecord
|
||||||
* @return index to the XF record
|
* @return index to the XF record
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public final short getXFIndex() {
|
public final short getXFIndex() {
|
||||||
return (short) _formatIndex;
|
return (short) _formatIndex;
|
||||||
}
|
}
|
||||||
@ -96,16 +100,22 @@ public abstract class CellRecord extends StandardRecord implements CellValueReco
|
|||||||
* Append specific debug info (used by {@link #toString()} for the value
|
* Append specific debug info (used by {@link #toString()} for the value
|
||||||
* contained in this record. Trailing new-line should not be appended
|
* contained in this record. Trailing new-line should not be appended
|
||||||
* (superclass does that).
|
* (superclass does that).
|
||||||
|
*
|
||||||
|
* @param sb the StringBuilder to write to
|
||||||
*/
|
*/
|
||||||
protected abstract void appendValueText(StringBuilder sb);
|
protected abstract void appendValueText(StringBuilder sb);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the debug info BIFF record type name (used by {@link #toString()}.
|
* Gets the debug info BIFF record type name (used by {@link #toString()}.
|
||||||
|
*
|
||||||
|
* @return the record type name
|
||||||
*/
|
*/
|
||||||
protected abstract String getRecordName();
|
protected abstract String getRecordName();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* writes out the value data for this cell record
|
* writes out the value data for this cell record
|
||||||
|
*
|
||||||
|
* @param out the output
|
||||||
*/
|
*/
|
||||||
protected abstract void serializeValue(LittleEndianOutput out);
|
protected abstract void serializeValue(LittleEndianOutput out);
|
||||||
|
|
||||||
|
@ -195,7 +195,9 @@ public final class ColumnInfoRecord extends StandardRecord implements Cloneable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return <code>true</code> if the format, options and column width match
|
* @param other the format to match with
|
||||||
|
*
|
||||||
|
* @return {@code true} if the format, options and column width match
|
||||||
*/
|
*/
|
||||||
public boolean formatMatches(ColumnInfoRecord other) {
|
public boolean formatMatches(ColumnInfoRecord other) {
|
||||||
if (_xfIndex != other._xfIndex) {
|
if (_xfIndex != other._xfIndex) {
|
||||||
|
@ -91,6 +91,7 @@ public final class CommonObjectDataSubRecord extends SubRecord implements Clonea
|
|||||||
field_6_reserved3 = in.readInt();
|
field_6_reserved3 = in.readInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
StringBuffer buffer = new StringBuffer();
|
StringBuffer buffer = new StringBuffer();
|
||||||
@ -129,6 +130,7 @@ public final class CommonObjectDataSubRecord extends SubRecord implements Clonea
|
|||||||
return buffer.toString();
|
return buffer.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
public void serialize(LittleEndianOutput out) {
|
public void serialize(LittleEndianOutput out) {
|
||||||
|
|
||||||
out.writeShort(sid);
|
out.writeShort(sid);
|
||||||
@ -142,10 +144,14 @@ public final class CommonObjectDataSubRecord extends SubRecord implements Clonea
|
|||||||
out.writeInt(field_6_reserved3);
|
out.writeInt(field_6_reserved3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
protected int getDataSize() {
|
protected int getDataSize() {
|
||||||
return 2 + 2 + 2 + 4 + 4 + 4;
|
return 2 + 2 + 2 + 4 + 4 + 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the record sid
|
||||||
|
*/
|
||||||
public short getSid()
|
public short getSid()
|
||||||
{
|
{
|
||||||
return sid;
|
return sid;
|
||||||
@ -250,6 +256,8 @@ public final class CommonObjectDataSubRecord extends SubRecord implements Clonea
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the object id field for the CommonObjectData record.
|
* Get the object id field for the CommonObjectData record.
|
||||||
|
*
|
||||||
|
* @return the object id field
|
||||||
*/
|
*/
|
||||||
public int getObjectId()
|
public int getObjectId()
|
||||||
{
|
{
|
||||||
@ -258,6 +266,8 @@ public final class CommonObjectDataSubRecord extends SubRecord implements Clonea
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the object id field for the CommonObjectData record.
|
* Set the object id field for the CommonObjectData record.
|
||||||
|
*
|
||||||
|
* @param field_2_objectId the object id field
|
||||||
*/
|
*/
|
||||||
public void setObjectId(int field_2_objectId)
|
public void setObjectId(int field_2_objectId)
|
||||||
{
|
{
|
||||||
@ -266,6 +276,8 @@ public final class CommonObjectDataSubRecord extends SubRecord implements Clonea
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the option field for the CommonObjectData record.
|
* Get the option field for the CommonObjectData record.
|
||||||
|
*
|
||||||
|
* @return the option field
|
||||||
*/
|
*/
|
||||||
public short getOption()
|
public short getOption()
|
||||||
{
|
{
|
||||||
@ -274,6 +286,8 @@ public final class CommonObjectDataSubRecord extends SubRecord implements Clonea
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the option field for the CommonObjectData record.
|
* Set the option field for the CommonObjectData record.
|
||||||
|
*
|
||||||
|
* @param field_3_option the option field
|
||||||
*/
|
*/
|
||||||
public void setOption(short field_3_option)
|
public void setOption(short field_3_option)
|
||||||
{
|
{
|
||||||
@ -282,6 +296,8 @@ public final class CommonObjectDataSubRecord extends SubRecord implements Clonea
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the reserved1 field for the CommonObjectData record.
|
* Get the reserved1 field for the CommonObjectData record.
|
||||||
|
*
|
||||||
|
* @return the reserved1 field
|
||||||
*/
|
*/
|
||||||
public int getReserved1()
|
public int getReserved1()
|
||||||
{
|
{
|
||||||
@ -290,6 +306,8 @@ public final class CommonObjectDataSubRecord extends SubRecord implements Clonea
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the reserved1 field for the CommonObjectData record.
|
* Set the reserved1 field for the CommonObjectData record.
|
||||||
|
*
|
||||||
|
* @param field_4_reserved1 the reserved1 field
|
||||||
*/
|
*/
|
||||||
public void setReserved1(int field_4_reserved1)
|
public void setReserved1(int field_4_reserved1)
|
||||||
{
|
{
|
||||||
@ -298,6 +316,8 @@ public final class CommonObjectDataSubRecord extends SubRecord implements Clonea
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the reserved2 field for the CommonObjectData record.
|
* Get the reserved2 field for the CommonObjectData record.
|
||||||
|
*
|
||||||
|
* @return the reserved2 field
|
||||||
*/
|
*/
|
||||||
public int getReserved2()
|
public int getReserved2()
|
||||||
{
|
{
|
||||||
@ -306,6 +326,8 @@ public final class CommonObjectDataSubRecord extends SubRecord implements Clonea
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the reserved2 field for the CommonObjectData record.
|
* Set the reserved2 field for the CommonObjectData record.
|
||||||
|
*
|
||||||
|
* @param field_5_reserved2 the reserved2 field
|
||||||
*/
|
*/
|
||||||
public void setReserved2(int field_5_reserved2)
|
public void setReserved2(int field_5_reserved2)
|
||||||
{
|
{
|
||||||
@ -314,6 +336,8 @@ public final class CommonObjectDataSubRecord extends SubRecord implements Clonea
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the reserved3 field for the CommonObjectData record.
|
* Get the reserved3 field for the CommonObjectData record.
|
||||||
|
*
|
||||||
|
* @return the reserved3 field
|
||||||
*/
|
*/
|
||||||
public int getReserved3()
|
public int getReserved3()
|
||||||
{
|
{
|
||||||
@ -322,6 +346,8 @@ public final class CommonObjectDataSubRecord extends SubRecord implements Clonea
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the reserved3 field for the CommonObjectData record.
|
* Set the reserved3 field for the CommonObjectData record.
|
||||||
|
*
|
||||||
|
* @param field_6_reserved3 the reserved3 field
|
||||||
*/
|
*/
|
||||||
public void setReserved3(int field_6_reserved3)
|
public void setReserved3(int field_6_reserved3)
|
||||||
{
|
{
|
||||||
@ -331,6 +357,8 @@ public final class CommonObjectDataSubRecord extends SubRecord implements Clonea
|
|||||||
/**
|
/**
|
||||||
* Sets the locked field value.
|
* Sets the locked field value.
|
||||||
* true if object is locked when sheet has been protected
|
* true if object is locked when sheet has been protected
|
||||||
|
*
|
||||||
|
* @param value {@code true} if object is locked when sheet has been protected
|
||||||
*/
|
*/
|
||||||
public void setLocked(boolean value)
|
public void setLocked(boolean value)
|
||||||
{
|
{
|
||||||
@ -349,6 +377,8 @@ public final class CommonObjectDataSubRecord extends SubRecord implements Clonea
|
|||||||
/**
|
/**
|
||||||
* Sets the printable field value.
|
* Sets the printable field value.
|
||||||
* object appears when printed
|
* object appears when printed
|
||||||
|
*
|
||||||
|
* @param value {@code true} if object appears when printed
|
||||||
*/
|
*/
|
||||||
public void setPrintable(boolean value)
|
public void setPrintable(boolean value)
|
||||||
{
|
{
|
||||||
@ -367,6 +397,8 @@ public final class CommonObjectDataSubRecord extends SubRecord implements Clonea
|
|||||||
/**
|
/**
|
||||||
* Sets the autofill field value.
|
* Sets the autofill field value.
|
||||||
* whether object uses an automatic fill style
|
* whether object uses an automatic fill style
|
||||||
|
*
|
||||||
|
* @param value {@code true} if object uses an automatic fill style
|
||||||
*/
|
*/
|
||||||
public void setAutofill(boolean value)
|
public void setAutofill(boolean value)
|
||||||
{
|
{
|
||||||
@ -385,6 +417,8 @@ public final class CommonObjectDataSubRecord extends SubRecord implements Clonea
|
|||||||
/**
|
/**
|
||||||
* Sets the autoline field value.
|
* Sets the autoline field value.
|
||||||
* whether object uses an automatic line style
|
* whether object uses an automatic line style
|
||||||
|
*
|
||||||
|
* @param value {@code true} if object uses an automatic line style
|
||||||
*/
|
*/
|
||||||
public void setAutoline(boolean value)
|
public void setAutoline(boolean value)
|
||||||
{
|
{
|
||||||
|
@ -20,18 +20,20 @@ package org.apache.poi.hssf.record;
|
|||||||
/**
|
/**
|
||||||
* The margin interface is a parent used to define left, right, top and bottom margins.
|
* The margin interface is a parent used to define left, right, top and bottom margins.
|
||||||
* This allows much of the code to be generic when it comes to handling margins.
|
* This allows much of the code to be generic when it comes to handling margins.
|
||||||
*
|
|
||||||
* @author Shawn Laubach (slaubach at apache dot org)
|
|
||||||
*/
|
*/
|
||||||
public interface Margin {
|
public interface Margin {
|
||||||
// TODO - introduce MarginBaseRecord
|
// TODO - introduce MarginBaseRecord
|
||||||
/**
|
/**
|
||||||
* Get the margin field for the Margin.
|
* Get the margin field for the Margin.
|
||||||
|
*
|
||||||
|
* @return the margin
|
||||||
*/
|
*/
|
||||||
public double getMargin();
|
public double getMargin();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the margin field for the Margin.
|
* Set the margin field for the Margin.
|
||||||
|
*
|
||||||
|
* @param field_1_margin the margin
|
||||||
*/
|
*/
|
||||||
public void setMargin(double field_1_margin);
|
public void setMargin(double field_1_margin);
|
||||||
}
|
}
|
||||||
|
@ -24,8 +24,6 @@ import org.apache.poi.util.LittleEndianOutput;
|
|||||||
/**
|
/**
|
||||||
* Common base class for {@link SharedFormulaRecord}, {@link ArrayRecord} and
|
* Common base class for {@link SharedFormulaRecord}, {@link ArrayRecord} and
|
||||||
* {@link TableRecord} which are have similarities.
|
* {@link TableRecord} which are have similarities.
|
||||||
*
|
|
||||||
* @author Josh Micich
|
|
||||||
*/
|
*/
|
||||||
public abstract class SharedValueRecordBase extends StandardRecord {
|
public abstract class SharedValueRecordBase extends StandardRecord {
|
||||||
|
|
||||||
@ -86,8 +84,12 @@ public abstract class SharedValueRecordBase extends StandardRecord {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return <code>true</code> if (rowIx, colIx) is within the range ({@link #getRange()})
|
* @param rowIx the row index
|
||||||
* of this shared value object.
|
* @param colIx the column index
|
||||||
|
*
|
||||||
|
* @return {@code true} if (rowIx, colIx) is within the range of this shared value object.
|
||||||
|
*
|
||||||
|
* @see #getRange()
|
||||||
*/
|
*/
|
||||||
public final boolean isInRange(int rowIx, int colIx) {
|
public final boolean isInRange(int rowIx, int colIx) {
|
||||||
CellRangeAddress8Bit r = _range;
|
CellRangeAddress8Bit r = _range;
|
||||||
@ -97,8 +99,15 @@ public abstract class SharedValueRecordBase extends StandardRecord {
|
|||||||
&& r.getLastColumn() >= colIx;
|
&& r.getLastColumn() >= colIx;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @return <code>true</code> if (rowIx, colIx) describes the first cell in this shared value
|
* @return {@code true} if (rowIx, colIx) describes the first cell in this shared value
|
||||||
* object's range ({@link #getRange()})
|
* object's range
|
||||||
|
*
|
||||||
|
* @param rowIx the row index
|
||||||
|
* @param colIx the column index
|
||||||
|
*
|
||||||
|
* @return {@code true} if its the first cell in this shared value object range
|
||||||
|
*
|
||||||
|
* @see #getRange()
|
||||||
*/
|
*/
|
||||||
public final boolean isFirstCell(int rowIx, int colIx) {
|
public final boolean isFirstCell(int rowIx, int colIx) {
|
||||||
CellRangeAddress8Bit r = getRange();
|
CellRangeAddress8Bit r = getRange();
|
||||||
|
@ -60,6 +60,8 @@ public abstract class StandardRecord extends Record {
|
|||||||
* {@link org.apache.poi.hssf.record.Record#getRecordSize()}} minus four
|
* {@link org.apache.poi.hssf.record.Record#getRecordSize()}} minus four
|
||||||
* ( record header consisting of a 'ushort sid' and 'ushort reclength' has already been written
|
* ( record header consisting of a 'ushort sid' and 'ushort reclength' has already been written
|
||||||
* by their superclass).
|
* by their superclass).
|
||||||
|
*
|
||||||
|
* @param out the output object
|
||||||
*/
|
*/
|
||||||
protected abstract void serialize(LittleEndianOutput out);
|
protected abstract void serialize(LittleEndianOutput out);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user