Remove unnecessary local variables
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1808518 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
7937da6a10
commit
5341a131de
@ -139,8 +139,7 @@ public String[][] getParameterInfo() {
|
|||||||
System.out.println(field);
|
System.out.println(field);
|
||||||
field = uc.getHeaderField(i);
|
field = uc.getHeaderField(i);
|
||||||
}
|
}
|
||||||
BufferedInputStream is = new BufferedInputStream(uc.getInputStream());
|
return new BufferedInputStream(uc.getInputStream());
|
||||||
return is;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -40,8 +40,7 @@ public final class Word2Forrest
|
|||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public Word2Forrest(HWPFDocument doc, OutputStream stream) throws IOException
|
public Word2Forrest(HWPFDocument doc, OutputStream stream) throws IOException
|
||||||
{
|
{
|
||||||
OutputStreamWriter out = new OutputStreamWriter (stream, Charset.forName("UTF-8"));
|
_out = new OutputStreamWriter (stream, Charset.forName("UTF-8"));
|
||||||
_out = out;
|
|
||||||
_doc = doc;
|
_doc = doc;
|
||||||
|
|
||||||
init ();
|
init ();
|
||||||
|
@ -75,11 +75,8 @@ public class CalculateMortgage implements FreeRefFunction {
|
|||||||
public double calculateMortgagePayment( double p, double r, double y ) {
|
public double calculateMortgagePayment( double p, double r, double y ) {
|
||||||
double i = r / 12 ;
|
double i = r / 12 ;
|
||||||
double n = y * 12 ;
|
double n = y * 12 ;
|
||||||
|
|
||||||
double principalAndInterest =
|
return p * (( i * Math.pow((1 + i),n ) ) / ( Math.pow((1 + i),n) - 1));
|
||||||
p * (( i * Math.pow((1 + i),n ) ) / ( Math.pow((1 + i),n) - 1)) ;
|
|
||||||
|
|
||||||
return principalAndInterest ;
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Excel does not support infinities and NaNs, rather, it gives a #NUM! error in these cases
|
* Excel does not support infinities and NaNs, rather, it gives a #NUM! error in these cases
|
||||||
|
@ -154,9 +154,8 @@ public class ExcelAntWorkbookUtil extends Typedef {
|
|||||||
}
|
}
|
||||||
|
|
||||||
UDFFinder udff1 = new DefaultUDFFinder(names, functions);
|
UDFFinder udff1 = new DefaultUDFFinder(names, functions);
|
||||||
UDFFinder udff = new AggregatingUDFFinder(udff1);
|
|
||||||
|
|
||||||
return udff;
|
return new AggregatingUDFFinder(udff1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,11 +77,8 @@ public class CalculateMortgageFunction implements FreeRefFunction {
|
|||||||
public double calculateMortgagePayment( double p, double r, double y ) {
|
public double calculateMortgagePayment( double p, double r, double y ) {
|
||||||
double i = r / 12 ;
|
double i = r / 12 ;
|
||||||
double n = y * 12 ;
|
double n = y * 12 ;
|
||||||
|
|
||||||
double principalAndInterest =
|
return p * (( i * Math.pow((1 + i),n ) ) / ( Math.pow((1 + i),n) - 1));
|
||||||
p * (( i * Math.pow((1 + i),n ) ) / ( Math.pow((1 + i),n) - 1)) ;
|
|
||||||
|
|
||||||
return principalAndInterest ;
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Excel does not support infinities and NaNs, rather, it gives a #NUM! error in these cases
|
* Excel does not support infinities and NaNs, rather, it gives a #NUM! error in these cases
|
||||||
|
@ -218,12 +218,11 @@ public class EscherColorRef {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public int[] getRGB() {
|
public int[] getRGB() {
|
||||||
int rgb[] = {
|
return new int[]{
|
||||||
FLAG_RED.getValue(colorRef),
|
FLAG_RED.getValue(colorRef),
|
||||||
FLAG_GREEN.getValue(colorRef),
|
FLAG_GREEN.getValue(colorRef),
|
||||||
FLAG_BLUE.getValue(colorRef)
|
FLAG_BLUE.getValue(colorRef)
|
||||||
};
|
};
|
||||||
return rgb;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -391,8 +391,7 @@ public class PropertySet {
|
|||||||
*/
|
*/
|
||||||
try {
|
try {
|
||||||
final byte[] buffer = IOUtils.peekFirstNBytes(stream, BUFFER_SIZE);
|
final byte[] buffer = IOUtils.peekFirstNBytes(stream, BUFFER_SIZE);
|
||||||
final boolean isPropertySetStream = isPropertySetStream(buffer, 0, buffer.length);
|
return isPropertySetStream(buffer, 0, buffer.length);
|
||||||
return isPropertySetStream;
|
|
||||||
} catch (EmptyFileException e) {
|
} catch (EmptyFileException e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -955,8 +955,7 @@ public class Section {
|
|||||||
for (int i = 0; i < pa.length; i++) {
|
for (int i = 0; i < pa.length; i++) {
|
||||||
hashCode += pa[i].hashCode();
|
hashCode += pa[i].hashCode();
|
||||||
}
|
}
|
||||||
final int returnHashCode = (int) (hashCode & 0x0ffffffffL);
|
return (int) (hashCode & 0x0ffffffffL);
|
||||||
return returnHashCode;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -198,9 +198,8 @@ public final class Thumbnail {
|
|||||||
*/
|
*/
|
||||||
public long getClipboardFormatTag()
|
public long getClipboardFormatTag()
|
||||||
{
|
{
|
||||||
long clipboardFormatTag = LittleEndian.getInt(getThumbnail(),
|
return (long) LittleEndian.getInt(getThumbnail(),
|
||||||
OFFSET_CFTAG);
|
OFFSET_CFTAG);
|
||||||
return clipboardFormatTag;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -143,12 +143,9 @@ public class HPSFPropertiesExtractor extends POIOLE2TextExtractor {
|
|||||||
|
|
||||||
public static void main(String[] args) throws IOException {
|
public static void main(String[] args) throws IOException {
|
||||||
for (String file : args) {
|
for (String file : args) {
|
||||||
HPSFPropertiesExtractor ext = new HPSFPropertiesExtractor(
|
try (HPSFPropertiesExtractor ext = new HPSFPropertiesExtractor(
|
||||||
new NPOIFSFileSystem(new File(file)));
|
new NPOIFSFileSystem(new File(file)))) {
|
||||||
try {
|
|
||||||
System.out.println(ext.getText());
|
System.out.println(ext.getText());
|
||||||
} finally {
|
|
||||||
ext.close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -422,8 +422,7 @@ public final class BiffViewer {
|
|||||||
} else {
|
} else {
|
||||||
boolean dumpInterpretedRecords = cmdArgs.shouldDumpRecordInterpretations();
|
boolean dumpInterpretedRecords = cmdArgs.shouldDumpRecordInterpretations();
|
||||||
boolean dumpHex = cmdArgs.shouldDumpBiffHex();
|
boolean dumpHex = cmdArgs.shouldDumpBiffHex();
|
||||||
boolean zeroAlignHexDump = dumpInterpretedRecords; // TODO - fix non-zeroAlign
|
runBiffViewer(pw, is, dumpInterpretedRecords, dumpHex, dumpInterpretedRecords,
|
||||||
runBiffViewer(pw, is, dumpInterpretedRecords, dumpHex, zeroAlignHexDump,
|
|
||||||
cmdArgs.suppressHeader());
|
cmdArgs.suppressHeader());
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
|
@ -491,10 +491,8 @@ public final class InternalWorkbook {
|
|||||||
"There are only " + numfonts
|
"There are only " + numfonts
|
||||||
+ " font records, you asked for " + idx);
|
+ " font records, you asked for " + idx);
|
||||||
}
|
}
|
||||||
FontRecord retval =
|
|
||||||
( FontRecord ) records.get((records.getFontpos() - (numfonts - 1)) + index);
|
|
||||||
|
|
||||||
return retval;
|
return ( FontRecord ) records.get((records.getFontpos() - (numfonts - 1)) + index);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -867,10 +865,8 @@ public final class InternalWorkbook {
|
|||||||
int xfptr = records.getXfpos() - (numxfs - 1);
|
int xfptr = records.getXfpos() - (numxfs - 1);
|
||||||
|
|
||||||
xfptr += index;
|
xfptr += index;
|
||||||
ExtendedFormatRecord retval =
|
|
||||||
( ExtendedFormatRecord ) records.get(xfptr);
|
|
||||||
|
|
||||||
return retval;
|
return ( ExtendedFormatRecord ) records.get(xfptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -36,8 +36,7 @@ public abstract class CFHeaderBase extends StandardRecord implements Cloneable {
|
|||||||
protected CFHeaderBase() {
|
protected CFHeaderBase() {
|
||||||
}
|
}
|
||||||
protected CFHeaderBase(CellRangeAddress[] regions, int nRules) {
|
protected CFHeaderBase(CellRangeAddress[] regions, int nRules) {
|
||||||
CellRangeAddress[] unmergedRanges = regions;
|
CellRangeAddress[] mergeCellRanges = CellRangeUtil.mergeCellRanges(regions);
|
||||||
CellRangeAddress[] mergeCellRanges = CellRangeUtil.mergeCellRanges(unmergedRanges);
|
|
||||||
setCellRanges(mergeCellRanges);
|
setCellRanges(mergeCellRanges);
|
||||||
field_1_numcf = nRules;
|
field_1_numcf = nRules;
|
||||||
}
|
}
|
||||||
|
@ -77,8 +77,7 @@ public final class EndSubRecord extends SubRecord implements Cloneable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EndSubRecord clone() {
|
public EndSubRecord clone() {
|
||||||
EndSubRecord rec = new EndSubRecord();
|
|
||||||
|
return new EndSubRecord();
|
||||||
return rec;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -522,8 +522,7 @@ public final class EscherAggregate extends AbstractEscherHolderRecord {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (NoteRecord noteRecord : tailRec.values()) {
|
for (NoteRecord noteRecord : tailRec.values()) {
|
||||||
Record rec = noteRecord;
|
pos += noteRecord.serialize(pos, data);
|
||||||
pos += rec.serialize(pos, data);
|
|
||||||
}
|
}
|
||||||
int bytesWritten = pos - offset;
|
int bytesWritten = pos - offset;
|
||||||
if (bytesWritten != getRecordSize())
|
if (bytesWritten != getRecordSize())
|
||||||
|
@ -128,8 +128,7 @@ public final class FormatRecord extends StandardRecord implements Cloneable {
|
|||||||
throw new IllegalArgumentException("Bad requested string length (" + requestedLength + ")");
|
throw new IllegalArgumentException("Bad requested string length (" + requestedLength + ")");
|
||||||
}
|
}
|
||||||
char[] buf = null;
|
char[] buf = null;
|
||||||
boolean isCompressedEncoding = pIsCompressedEncoding;
|
int availableChars = pIsCompressedEncoding ? ris.remaining() : ris.remaining() / LittleEndianConsts.SHORT_SIZE;
|
||||||
int availableChars = isCompressedEncoding ? ris.remaining() : ris.remaining() / LittleEndianConsts.SHORT_SIZE;
|
|
||||||
//everything worked out. Great!
|
//everything worked out. Great!
|
||||||
int remaining = ris.remaining();
|
int remaining = ris.remaining();
|
||||||
if (requestedLength == availableChars) {
|
if (requestedLength == availableChars) {
|
||||||
@ -142,7 +141,7 @@ public final class FormatRecord extends StandardRecord implements Cloneable {
|
|||||||
}
|
}
|
||||||
for (int i = 0; i < buf.length; i++) {
|
for (int i = 0; i < buf.length; i++) {
|
||||||
char ch;
|
char ch;
|
||||||
if (isCompressedEncoding) {
|
if (pIsCompressedEncoding) {
|
||||||
ch = (char) ris.readUByte();
|
ch = (char) ris.readUByte();
|
||||||
} else {
|
} else {
|
||||||
ch = (char) ris.readShort();
|
ch = (char) ris.readShort();
|
||||||
|
@ -82,8 +82,7 @@ public final class MergeCellsRecord extends StandardRecord implements Cloneable
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void serialize(LittleEndianOutput out) {
|
public void serialize(LittleEndianOutput out) {
|
||||||
int nItems = _numberOfRegions;
|
out.writeShort(_numberOfRegions);
|
||||||
out.writeShort(nItems);
|
|
||||||
for (int i = 0; i < _numberOfRegions; i++) {
|
for (int i = 0; i < _numberOfRegions; i++) {
|
||||||
_regions[_startIndex + i].serialize(out);
|
_regions[_startIndex + i].serialize(out);
|
||||||
}
|
}
|
||||||
|
@ -84,22 +84,21 @@ public final class NameCommentRecord extends StandardRecord {
|
|||||||
* @param ris the RecordInputstream to read the record from
|
* @param ris the RecordInputstream to read the record from
|
||||||
*/
|
*/
|
||||||
public NameCommentRecord(final RecordInputStream ris) {
|
public NameCommentRecord(final RecordInputStream ris) {
|
||||||
final LittleEndianInput in = ris;
|
field_1_record_type = ris.readShort();
|
||||||
field_1_record_type = in.readShort();
|
field_2_frt_cell_ref_flag = ris.readShort();
|
||||||
field_2_frt_cell_ref_flag = in.readShort();
|
field_3_reserved = ris.readLong();
|
||||||
field_3_reserved = in.readLong();
|
final int field_4_name_length = ris.readShort();
|
||||||
final int field_4_name_length = in.readShort();
|
final int field_5_comment_length = ris.readShort();
|
||||||
final int field_5_comment_length = in.readShort();
|
|
||||||
|
|
||||||
if (in.readByte() == 0) {
|
if (ris.readByte() == 0) {
|
||||||
field_6_name_text = StringUtil.readCompressedUnicode(in, field_4_name_length);
|
field_6_name_text = StringUtil.readCompressedUnicode(ris, field_4_name_length);
|
||||||
} else {
|
} else {
|
||||||
field_6_name_text = StringUtil.readUnicodeLE(in, field_4_name_length);
|
field_6_name_text = StringUtil.readUnicodeLE(ris, field_4_name_length);
|
||||||
}
|
}
|
||||||
if (in.readByte() == 0) {
|
if (ris.readByte() == 0) {
|
||||||
field_7_comment_text = StringUtil.readCompressedUnicode(in, field_5_comment_length);
|
field_7_comment_text = StringUtil.readCompressedUnicode(ris, field_5_comment_length);
|
||||||
} else {
|
} else {
|
||||||
field_7_comment_text = StringUtil.readUnicodeLE(in, field_5_comment_length);
|
field_7_comment_text = StringUtil.readUnicodeLE(ris, field_5_comment_length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,13 +103,12 @@ public final class RecordFactoryInputStream {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public RecordInputStream createDecryptingStream(InputStream original) {
|
public RecordInputStream createDecryptingStream(InputStream original) {
|
||||||
FilePassRecord fpr = _filePassRec;
|
String userPassword = Biff8EncryptionKey.getCurrentUserPassword();
|
||||||
String userPassword = Biff8EncryptionKey.getCurrentUserPassword();
|
|
||||||
if (userPassword == null) {
|
if (userPassword == null) {
|
||||||
userPassword = Decryptor.DEFAULT_PASSWORD;
|
userPassword = Decryptor.DEFAULT_PASSWORD;
|
||||||
}
|
}
|
||||||
|
|
||||||
EncryptionInfo info = fpr.getEncryptionInfo();
|
EncryptionInfo info = _filePassRec.getEncryptionInfo();
|
||||||
try {
|
try {
|
||||||
if (!info.getDecryptor().verifyPassword(userPassword)) {
|
if (!info.getDecryptor().verifyPassword(userPassword)) {
|
||||||
throw new EncryptedDocumentException(
|
throw new EncryptedDocumentException(
|
||||||
|
@ -363,12 +363,11 @@ public final class ColumnInfoRecordsAggregate extends RecordAggregate implements
|
|||||||
attemptMergeColInfoRecords(k);
|
attemptMergeColInfoRecords(k);
|
||||||
} else {
|
} else {
|
||||||
//split to 3 records
|
//split to 3 records
|
||||||
ColumnInfoRecord ciStart = ci;
|
ColumnInfoRecord ciMid = copyColInfo(ci);
|
||||||
ColumnInfoRecord ciMid = copyColInfo(ci);
|
|
||||||
ColumnInfoRecord ciEnd = copyColInfo(ci);
|
ColumnInfoRecord ciEnd = copyColInfo(ci);
|
||||||
int lastcolumn = ci.getLastColumn();
|
int lastcolumn = ci.getLastColumn();
|
||||||
|
|
||||||
ciStart.setLastColumn(targetColumnIx - 1);
|
ci.setLastColumn(targetColumnIx - 1);
|
||||||
|
|
||||||
ciMid.setFirstColumn(targetColumnIx);
|
ciMid.setFirstColumn(targetColumnIx);
|
||||||
ciMid.setLastColumn(targetColumnIx);
|
ciMid.setLastColumn(targetColumnIx);
|
||||||
|
@ -46,13 +46,12 @@ public final class MergedCellsTable extends RecordAggregate {
|
|||||||
* @param rs
|
* @param rs
|
||||||
*/
|
*/
|
||||||
public void read(RecordStream rs) {
|
public void read(RecordStream rs) {
|
||||||
List<CellRangeAddress> temp = _mergedRegions;
|
while (rs.peekNextClass() == MergeCellsRecord.class) {
|
||||||
while (rs.peekNextClass() == MergeCellsRecord.class) {
|
|
||||||
MergeCellsRecord mcr = (MergeCellsRecord) rs.getNext();
|
MergeCellsRecord mcr = (MergeCellsRecord) rs.getNext();
|
||||||
int nRegions = mcr.getNumAreas();
|
int nRegions = mcr.getNumAreas();
|
||||||
for (int i = 0; i < nRegions; i++) {
|
for (int i = 0; i < nRegions; i++) {
|
||||||
CellRangeAddress cra = mcr.getAreaAt(i);
|
CellRangeAddress cra = mcr.getAreaAt(i);
|
||||||
temp.add(cra);
|
_mergedRegions.add(cra);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -67,10 +66,9 @@ public final class MergedCellsTable extends RecordAggregate {
|
|||||||
int nMergedCellsRecords = nRegions / MAX_MERGED_REGIONS;
|
int nMergedCellsRecords = nRegions / MAX_MERGED_REGIONS;
|
||||||
int nLeftoverMergedRegions = nRegions % MAX_MERGED_REGIONS;
|
int nLeftoverMergedRegions = nRegions % MAX_MERGED_REGIONS;
|
||||||
|
|
||||||
int result = nMergedCellsRecords
|
return nMergedCellsRecords
|
||||||
* (4 + CellRangeAddressList.getEncodedSize(MAX_MERGED_REGIONS)) + 4
|
* (4 + CellRangeAddressList.getEncodedSize(MAX_MERGED_REGIONS)) + 4
|
||||||
+ CellRangeAddressList.getEncodedSize(nLeftoverMergedRegions);
|
+ CellRangeAddressList.getEncodedSize(nLeftoverMergedRegions);
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void visitContainedRecords(RecordVisitor rv) {
|
public void visitContainedRecords(RecordVisitor rv) {
|
||||||
|
@ -172,8 +172,7 @@ public final class SharedValueManager {
|
|||||||
_groupsCache.put(getKeyForCache(group._firstCell),group);
|
_groupsCache.put(getKeyForCache(group._firstCell),group);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SharedFormulaGroup sfg = _groupsCache.get(getKeyForCache(cellRef));
|
return _groupsCache.get(getKeyForCache(cellRef));
|
||||||
return sfg;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Integer getKeyForCache(final CellReference cellRef) {
|
private Integer getKeyForCache(final CellReference cellRef) {
|
||||||
|
@ -66,8 +66,7 @@ public final class BeginRecord extends StandardRecord implements Cloneable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public BeginRecord clone() {
|
public BeginRecord clone() {
|
||||||
BeginRecord br = new BeginRecord();
|
// No data so nothing to copy
|
||||||
// No data so nothing to copy
|
return new BeginRecord();
|
||||||
return br;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -67,8 +67,7 @@ public final class EndRecord extends StandardRecord implements Cloneable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EndRecord clone() {
|
public EndRecord clone() {
|
||||||
EndRecord er = new EndRecord();
|
// No data so nothing to copy
|
||||||
// No data so nothing to copy
|
return new EndRecord();
|
||||||
return er;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -64,8 +64,6 @@ public final class PlotAreaRecord extends StandardRecord {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Object clone() {
|
public Object clone() {
|
||||||
PlotAreaRecord rec = new PlotAreaRecord();
|
return new PlotAreaRecord();
|
||||||
|
|
||||||
return rec;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -151,9 +151,8 @@ public class EscherGraphics extends Graphics
|
|||||||
@Override
|
@Override
|
||||||
public Graphics create()
|
public Graphics create()
|
||||||
{
|
{
|
||||||
EscherGraphics g = new EscherGraphics(escherGroup, workbook,
|
return new EscherGraphics(escherGroup, workbook,
|
||||||
foreground, font, verticalPointsPerPixel );
|
foreground, font, verticalPointsPerPixel );
|
||||||
return g;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -127,8 +127,7 @@ public final class EscherGraphics2d extends Graphics2D {
|
|||||||
|
|
||||||
public Graphics create()
|
public Graphics create()
|
||||||
{
|
{
|
||||||
EscherGraphics2d g2d = new EscherGraphics2d(_escherGraphics);
|
return new EscherGraphics2d(_escherGraphics);
|
||||||
return g2d;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dispose()
|
public void dispose()
|
||||||
|
@ -108,8 +108,7 @@ public final class HSSFRichTextString implements Comparable<HSSFRichTextString>,
|
|||||||
private UnicodeString cloneStringIfRequired() {
|
private UnicodeString cloneStringIfRequired() {
|
||||||
if (_book == null)
|
if (_book == null)
|
||||||
return _string;
|
return _string;
|
||||||
UnicodeString s = (UnicodeString)_string.clone();
|
return (UnicodeString)_string.clone();
|
||||||
return s;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addToSSTIfRequired() {
|
private void addToSSTIfRequired() {
|
||||||
|
@ -570,7 +570,6 @@ public class CryptoFunctions {
|
|||||||
/*
|
/*
|
||||||
* SET Intermediate3 TO Intermediate1 BITWISE OR Intermediate2
|
* SET Intermediate3 TO Intermediate1 BITWISE OR Intermediate2
|
||||||
*/
|
*/
|
||||||
short intermediate3 = (short)(intermediate1 | intermediate2);
|
return (short)(intermediate1 | intermediate2);
|
||||||
return intermediate3;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -125,8 +125,7 @@ public class BinaryRC4Decryptor extends Decryptor implements Cloneable {
|
|||||||
|
|
||||||
hash = new byte[5];
|
hash = new byte[5];
|
||||||
System.arraycopy(hashAlg.digest(), 0, hash, 0, 5);
|
System.arraycopy(hashAlg.digest(), 0, hash, 0, 5);
|
||||||
SecretKey skey = new SecretKeySpec(hash, ver.getCipherAlgorithm().jceId);
|
return new SecretKeySpec(hash, ver.getCipherAlgorithm().jceId);
|
||||||
return skey;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -82,8 +82,7 @@ public class BinaryRC4Encryptor extends Encryptor implements Cloneable {
|
|||||||
@Override
|
@Override
|
||||||
public OutputStream getDataStream(DirectoryNode dir)
|
public OutputStream getDataStream(DirectoryNode dir)
|
||||||
throws IOException, GeneralSecurityException {
|
throws IOException, GeneralSecurityException {
|
||||||
OutputStream countStream = new BinaryRC4CipherOutputStream(dir);
|
return new BinaryRC4CipherOutputStream(dir);
|
||||||
return countStream;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -134,8 +134,7 @@ public class CryptoAPIDecryptor extends Decryptor implements Cloneable {
|
|||||||
MessageDigest hashAlg = CryptoFunctions.getMessageDigest(hashAlgo);
|
MessageDigest hashAlg = CryptoFunctions.getMessageDigest(hashAlgo);
|
||||||
hashAlg.update(ver.getSalt());
|
hashAlg.update(ver.getSalt());
|
||||||
byte hash[] = hashAlg.digest(StringUtil.getToUnicodeLE(password));
|
byte hash[] = hashAlg.digest(StringUtil.getToUnicodeLE(password));
|
||||||
SecretKey skey = new SecretKeySpec(hash, ver.getCipherAlgorithm().jceId);
|
return new SecretKeySpec(hash, ver.getCipherAlgorithm().jceId);
|
||||||
return skey;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -98,8 +98,7 @@ public class StandardDecryptor extends Decryptor implements Cloneable {
|
|||||||
|
|
||||||
byte[] key = Arrays.copyOf(x3, keySize);
|
byte[] key = Arrays.copyOf(x3, keySize);
|
||||||
|
|
||||||
SecretKey skey = new SecretKeySpec(key, ver.getCipherAlgorithm().jceId);
|
return new SecretKeySpec(key, ver.getCipherAlgorithm().jceId);
|
||||||
return skey;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static byte[] fillAndXor(byte hash[], byte fillByte) {
|
protected static byte[] fillAndXor(byte hash[], byte fillByte) {
|
||||||
|
@ -256,9 +256,8 @@ public class POIFSDocumentPath
|
|||||||
}
|
}
|
||||||
String[] parentComponents = new String[ length ];
|
String[] parentComponents = new String[ length ];
|
||||||
System.arraycopy(components, 0, parentComponents, 0, length);
|
System.arraycopy(components, 0, parentComponents, 0, length);
|
||||||
POIFSDocumentPath parent = new POIFSDocumentPath(parentComponents);
|
|
||||||
|
return new POIFSDocumentPath(parentComponents);
|
||||||
return parent;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -38,10 +38,9 @@ public final class SmallBlockTableReader {
|
|||||||
blockList.fetchBlocks(root.getStartBlock(), -1);
|
blockList.fetchBlocks(root.getStartBlock(), -1);
|
||||||
|
|
||||||
// Turn that into a list
|
// Turn that into a list
|
||||||
BlockList list =new SmallDocumentBlockList(
|
|
||||||
SmallDocumentBlock.extract(bigBlockSize, smallBlockBlocks));
|
|
||||||
|
|
||||||
return list;
|
return new SmallDocumentBlockList(
|
||||||
|
SmallDocumentBlock.extract(bigBlockSize, smallBlockBlocks));
|
||||||
}
|
}
|
||||||
private static BlockAllocationTableReader prepareReader(
|
private static BlockAllocationTableReader prepareReader(
|
||||||
final POIFSBigBlockSize bigBlockSize,
|
final POIFSBigBlockSize bigBlockSize,
|
||||||
|
@ -256,9 +256,8 @@ public class DrawPaint {
|
|||||||
LOG.log(POILogger.ERROR, "Can't load image data");
|
LOG.log(POILogger.ERROR, "Can't load image data");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
Paint paint = new java.awt.TexturePaint(image, textAnchor);
|
|
||||||
|
|
||||||
return paint;
|
return new java.awt.TexturePaint(image, textAnchor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -174,8 +174,7 @@ public enum AutoNumberingScheme {
|
|||||||
public String format(int value) {
|
public String format(int value) {
|
||||||
String index = formatIndex(value);
|
String index = formatIndex(value);
|
||||||
String cased = formatCase(index);
|
String cased = formatCase(index);
|
||||||
String seperated = formatSeperator(cased);
|
return formatSeperator(cased);
|
||||||
return seperated;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String formatSeperator(String cased) {
|
private String formatSeperator(String cased) {
|
||||||
|
@ -245,13 +245,12 @@ public class CellNumberFormatter extends CellFormatter {
|
|||||||
} else {
|
} else {
|
||||||
StringBuffer fmtBuf = new StringBuffer();
|
StringBuffer fmtBuf = new StringBuffer();
|
||||||
boolean first = true;
|
boolean first = true;
|
||||||
List<Special> specialList = integerSpecials;
|
|
||||||
if (integerSpecials.size() == 1) {
|
if (integerSpecials.size() == 1) {
|
||||||
// If we don't do this, we get ".6e5" instead of "6e4"
|
// If we don't do this, we get ".6e5" instead of "6e4"
|
||||||
fmtBuf.append("0");
|
fmtBuf.append("0");
|
||||||
first = false;
|
first = false;
|
||||||
} else
|
} else
|
||||||
for (Special s : specialList) {
|
for (Special s : integerSpecials) {
|
||||||
if (isDigitFmt(s)) {
|
if (isDigitFmt(s)) {
|
||||||
fmtBuf.append(first ? '#' : '0');
|
fmtBuf.append(first ? '#' : '0');
|
||||||
first = false;
|
first = false;
|
||||||
|
@ -132,13 +132,12 @@ public abstract class BaseFormulaEvaluator implements FormulaEvaluator, Workbook
|
|||||||
if (cell == null) {
|
if (cell == null) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
Cell result = cell;
|
|
||||||
if (cell.getCellTypeEnum() == CellType.FORMULA) {
|
if (cell.getCellTypeEnum() == CellType.FORMULA) {
|
||||||
CellValue cv = evaluateFormulaCellValue(cell);
|
CellValue cv = evaluateFormulaCellValue(cell);
|
||||||
setCellValue(cell, cv);
|
setCellValue(cell, cv);
|
||||||
setCellType(cell, cv); // cell will no longer be a formula cell
|
setCellType(cell, cv); // cell will no longer be a formula cell
|
||||||
}
|
}
|
||||||
return result;
|
return cell;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract CellValue evaluateFormulaCellValue(Cell cell);
|
protected abstract CellValue evaluateFormulaCellValue(Cell cell);
|
||||||
|
@ -421,13 +421,12 @@ public class EvaluationConditionalFormatRule implements Comparable<EvaluationCon
|
|||||||
return getMeaningfulValues(region, false, new ValueFunction() {
|
return getMeaningfulValues(region, false, new ValueFunction() {
|
||||||
@Override
|
@Override
|
||||||
public Set<ValueAndFormat> evaluate(List<ValueAndFormat> allValues) {
|
public Set<ValueAndFormat> evaluate(List<ValueAndFormat> allValues) {
|
||||||
List<ValueAndFormat> values = allValues;
|
|
||||||
final ConditionFilterData conf = rule.getFilterConfiguration();
|
final ConditionFilterData conf = rule.getFilterConfiguration();
|
||||||
|
|
||||||
if (! conf.getBottom()) {
|
if (! conf.getBottom()) {
|
||||||
Collections.sort(values, Collections.reverseOrder());
|
Collections.sort(allValues, Collections.reverseOrder());
|
||||||
} else {
|
} else {
|
||||||
Collections.sort(values);
|
Collections.sort(allValues);
|
||||||
}
|
}
|
||||||
|
|
||||||
int limit = (int) conf.getRank();
|
int limit = (int) conf.getRank();
|
||||||
@ -447,15 +446,14 @@ public class EvaluationConditionalFormatRule implements Comparable<EvaluationCon
|
|||||||
return getMeaningfulValues(region, true, new ValueFunction() {
|
return getMeaningfulValues(region, true, new ValueFunction() {
|
||||||
@Override
|
@Override
|
||||||
public Set<ValueAndFormat> evaluate(List<ValueAndFormat> allValues) {
|
public Set<ValueAndFormat> evaluate(List<ValueAndFormat> allValues) {
|
||||||
List<ValueAndFormat> values = allValues;
|
Collections.sort(allValues);
|
||||||
Collections.sort(values);
|
|
||||||
|
|
||||||
final Set<ValueAndFormat> unique = new HashSet<>();
|
final Set<ValueAndFormat> unique = new HashSet<>();
|
||||||
|
|
||||||
for (int i=0; i < values.size(); i++) {
|
for (int i = 0; i < allValues.size(); i++) {
|
||||||
final ValueAndFormat v = values.get(i);
|
final ValueAndFormat v = allValues.get(i);
|
||||||
// skip this if the current value matches the next one, or is the last one and matches the previous one
|
// skip this if the current value matches the next one, or is the last one and matches the previous one
|
||||||
if ( (i < values.size()-1 && v.equals(values.get(i+1)) ) || ( i > 0 && i == values.size()-1 && v.equals(values.get(i-1)) ) ) {
|
if ( (i < allValues.size()-1 && v.equals(allValues.get(i+1)) ) || ( i > 0 && i == allValues.size()-1 && v.equals(allValues.get(i-1)) ) ) {
|
||||||
// current value matches next value, skip both
|
// current value matches next value, skip both
|
||||||
i++;
|
i++;
|
||||||
continue;
|
continue;
|
||||||
@ -472,15 +470,14 @@ public class EvaluationConditionalFormatRule implements Comparable<EvaluationCon
|
|||||||
return getMeaningfulValues(region, true, new ValueFunction() {
|
return getMeaningfulValues(region, true, new ValueFunction() {
|
||||||
@Override
|
@Override
|
||||||
public Set<ValueAndFormat> evaluate(List<ValueAndFormat> allValues) {
|
public Set<ValueAndFormat> evaluate(List<ValueAndFormat> allValues) {
|
||||||
List<ValueAndFormat> values = allValues;
|
Collections.sort(allValues);
|
||||||
Collections.sort(values);
|
|
||||||
|
|
||||||
final Set<ValueAndFormat> dup = new HashSet<>();
|
final Set<ValueAndFormat> dup = new HashSet<>();
|
||||||
|
|
||||||
for (int i=0; i < values.size(); i++) {
|
for (int i = 0; i < allValues.size(); i++) {
|
||||||
final ValueAndFormat v = values.get(i);
|
final ValueAndFormat v = allValues.get(i);
|
||||||
// skip this if the current value matches the next one, or is the last one and matches the previous one
|
// skip this if the current value matches the next one, or is the last one and matches the previous one
|
||||||
if ( (i < values.size()-1 && v.equals(values.get(i+1)) ) || ( i > 0 && i == values.size()-1 && v.equals(values.get(i-1)) ) ) {
|
if ( (i < allValues.size()-1 && v.equals(allValues.get(i+1)) ) || ( i > 0 && i == allValues.size()-1 && v.equals(allValues.get(i-1)) ) ) {
|
||||||
// current value matches next value, add one
|
// current value matches next value, add one
|
||||||
dup.add(v);
|
dup.add(v);
|
||||||
i++;
|
i++;
|
||||||
@ -499,19 +496,18 @@ public class EvaluationConditionalFormatRule implements Comparable<EvaluationCon
|
|||||||
List<ValueAndFormat> values = new ArrayList<>(getMeaningfulValues(region, false, new ValueFunction() {
|
List<ValueAndFormat> values = new ArrayList<>(getMeaningfulValues(region, false, new ValueFunction() {
|
||||||
@Override
|
@Override
|
||||||
public Set<ValueAndFormat> evaluate(List<ValueAndFormat> allValues) {
|
public Set<ValueAndFormat> evaluate(List<ValueAndFormat> allValues) {
|
||||||
List<ValueAndFormat> values = allValues;
|
|
||||||
double total = 0;
|
double total = 0;
|
||||||
ValueEval[] pop = new ValueEval[values.size()];
|
ValueEval[] pop = new ValueEval[allValues.size()];
|
||||||
for (int i = 0; i < values.size(); i++) {
|
for (int i = 0; i < allValues.size(); i++) {
|
||||||
ValueAndFormat v = values.get(i);
|
ValueAndFormat v = allValues.get(i);
|
||||||
total += v.value.doubleValue();
|
total += v.value.doubleValue();
|
||||||
pop[i] = new NumberEval(v.value.doubleValue());
|
pop[i] = new NumberEval(v.value.doubleValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
final Set<ValueAndFormat> avgSet = new LinkedHashSet<>(1);
|
final Set<ValueAndFormat> avgSet = new LinkedHashSet<>(1);
|
||||||
avgSet.add(new ValueAndFormat(new Double(values.size() == 0 ? 0 : total / values.size()), null));
|
avgSet.add(new ValueAndFormat(new Double(allValues.size() == 0 ? 0 : total / allValues.size()), null));
|
||||||
|
|
||||||
final double stdDev = values.size() <= 1 ? 0 : ((NumberEval) AggregateFunction.STDEV.evaluate(pop, 0, 0)).getNumberValue();
|
final double stdDev = allValues.size() <= 1 ? 0 : ((NumberEval) AggregateFunction.STDEV.evaluate(pop, 0, 0)).getNumberValue();
|
||||||
avgSet.add(new ValueAndFormat(new Double(stdDev), null));
|
avgSet.add(new ValueAndFormat(new Double(stdDev), null));
|
||||||
return avgSet;
|
return avgSet;
|
||||||
}
|
}
|
||||||
|
@ -125,8 +125,7 @@ public final class WorkbookEvaluator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* package */ EvaluationName getName(String name, int sheetIndex) {
|
/* package */ EvaluationName getName(String name, int sheetIndex) {
|
||||||
EvaluationName evalName = _workbook.getName(name, sheetIndex);
|
return _workbook.getName(name, sheetIndex);
|
||||||
return evalName;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean isDebugLogEnabled() {
|
private static boolean isDebugLogEnabled() {
|
||||||
|
@ -342,8 +342,7 @@ public final class DStarRunner implements Function3Arg {
|
|||||||
// Construct double from condition.
|
// Construct double from condition.
|
||||||
double conditionValue = 0.0;
|
double conditionValue = 0.0;
|
||||||
try {
|
try {
|
||||||
int intValue = Integer.parseInt(condition);
|
conditionValue = Integer.parseInt(condition);
|
||||||
conditionValue = intValue;
|
|
||||||
} catch (NumberFormatException e) { // It's not an int.
|
} catch (NumberFormatException e) { // It's not an int.
|
||||||
try {
|
try {
|
||||||
conditionValue = Double.parseDouble(condition);
|
conditionValue = Double.parseDouble(condition);
|
||||||
|
@ -40,8 +40,7 @@ public class Finance {
|
|||||||
*/
|
*/
|
||||||
// http://arachnoid.com/lutusp/finance.html
|
// http://arachnoid.com/lutusp/finance.html
|
||||||
static public double pmt(double r, int nper, double pv, double fv, int type) {
|
static public double pmt(double r, int nper, double pv, double fv, int type) {
|
||||||
double pmt = -r * (pv * Math.pow(1 + r, nper) + fv) / ((1 + r*type) * (Math.pow(1 + r, nper) - 1));
|
return -r * (pv * Math.pow(1 + r, nper) + fv) / ((1 + r*type) * (Math.pow(1 + r, nper) - 1));
|
||||||
return pmt;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -153,8 +152,7 @@ public class Finance {
|
|||||||
*/
|
*/
|
||||||
//http://en.wikipedia.org/wiki/Future_value
|
//http://en.wikipedia.org/wiki/Future_value
|
||||||
static public double fv(double r, int nper, double pmt, double pv, int type) {
|
static public double fv(double r, int nper, double pmt, double pv, int type) {
|
||||||
double fv = -(pv * Math.pow(1 + r, nper) + pmt * (1+r*type) * (Math.pow(1 + r, nper) - 1) / r);
|
return -(pv * Math.pow(1 + r, nper) + pmt * (1+r*type) * (Math.pow(1 + r, nper) - 1) / r);
|
||||||
return fv;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -93,18 +93,17 @@ public final class Index implements Function2Arg, Function3Arg, Function4Arg {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static TwoDEval convertFirstArg(ValueEval arg0) {
|
private static TwoDEval convertFirstArg(ValueEval arg0) {
|
||||||
ValueEval firstArg = arg0;
|
if (arg0 instanceof RefEval) {
|
||||||
if (firstArg instanceof RefEval) {
|
|
||||||
// convert to area ref for simpler code in getValueFromArea()
|
// convert to area ref for simpler code in getValueFromArea()
|
||||||
return ((RefEval)firstArg).offset(0, 0, 0, 0);
|
return ((RefEval) arg0).offset(0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
if((firstArg instanceof TwoDEval)) {
|
if((arg0 instanceof TwoDEval)) {
|
||||||
return (TwoDEval) firstArg;
|
return (TwoDEval) arg0;
|
||||||
}
|
}
|
||||||
// else the other variation of this function takes an array as the first argument
|
// else the other variation of this function takes an array as the first argument
|
||||||
// it seems like interface 'ArrayEval' does not even exist yet
|
// it seems like interface 'ArrayEval' does not even exist yet
|
||||||
throw new RuntimeException("Incomplete code - cannot handle first arg of type ("
|
throw new RuntimeException("Incomplete code - cannot handle first arg of type ("
|
||||||
+ firstArg.getClass().getName() + ")");
|
+ arg0.getClass().getName() + ")");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -365,11 +365,10 @@ public abstract class NumericFunction implements Function {
|
|||||||
double d0 = NumericFunction.singleOperandEvaluate(arg0, srcRowIndex, srcColumnIndex);
|
double d0 = NumericFunction.singleOperandEvaluate(arg0, srcRowIndex, srcColumnIndex);
|
||||||
double d1 = NumericFunction.singleOperandEvaluate(arg1, srcRowIndex, srcColumnIndex);
|
double d1 = NumericFunction.singleOperandEvaluate(arg1, srcRowIndex, srcColumnIndex);
|
||||||
double logE = Math.log(d0);
|
double logE = Math.log(d0);
|
||||||
double base = d1;
|
if (Double.compare(d1, Math.E) == 0) {
|
||||||
if (Double.compare(base, Math.E) == 0) {
|
|
||||||
result = logE;
|
result = logE;
|
||||||
} else {
|
} else {
|
||||||
result = logE / Math.log(base);
|
result = logE / Math.log(d1);
|
||||||
}
|
}
|
||||||
NumericFunction.checkValue(result);
|
NumericFunction.checkValue(result);
|
||||||
} catch (EvaluationException e) {
|
} catch (EvaluationException e) {
|
||||||
|
@ -78,8 +78,7 @@ public final class AttrPtg extends ControlPtg {
|
|||||||
_options = in.readByte();
|
_options = in.readByte();
|
||||||
_data = in.readShort();
|
_data = in.readShort();
|
||||||
if (isOptimizedChoose()) {
|
if (isOptimizedChoose()) {
|
||||||
int nCases = _data;
|
int[] jumpTable = new int[(int) _data];
|
||||||
int[] jumpTable = new int[nCases];
|
|
||||||
for (int i = 0; i < jumpTable.length; i++) {
|
for (int i = 0; i < jumpTable.length; i++) {
|
||||||
jumpTable[i] = in.readUShort();
|
jumpTable[i] = in.readUShort();
|
||||||
}
|
}
|
||||||
|
@ -79,9 +79,8 @@ public final class NameXPtg extends OperandPtg implements WorkbookDependentFormu
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String toString(){
|
public String toString(){
|
||||||
String retValue = "NameXPtg:[sheetRefIndex:" + _sheetRefIndex +
|
return "NameXPtg:[sheetRefIndex:" + _sheetRefIndex +
|
||||||
" , nameNumber:" + _nameNumber + "]" ;
|
" , nameNumber:" + _nameNumber + "]";
|
||||||
return retValue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte getDefaultOperandClass() {
|
public byte getDefaultOperandClass() {
|
||||||
|
@ -153,7 +153,7 @@ public class CellCopyPolicy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Builder createBuilder() {
|
public Builder createBuilder() {
|
||||||
final Builder builder = new Builder()
|
return new Builder()
|
||||||
.cellValue(copyCellValue)
|
.cellValue(copyCellValue)
|
||||||
.cellStyle(copyCellStyle)
|
.cellStyle(copyCellStyle)
|
||||||
.cellFormula(copyCellFormula)
|
.cellFormula(copyCellFormula)
|
||||||
@ -162,7 +162,6 @@ public class CellCopyPolicy {
|
|||||||
.rowHeight(copyRowHeight)
|
.rowHeight(copyRowHeight)
|
||||||
.condenseRows(condenseRows)
|
.condenseRows(condenseRows)
|
||||||
.mergedRegions(copyMergedRegions);
|
.mergedRegions(copyMergedRegions);
|
||||||
return builder;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -299,10 +299,9 @@ public abstract class CellRangeAddressBase {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
int code = (getMinColumn() +
|
return (getMinColumn() +
|
||||||
(getMaxColumn() << 8) +
|
(getMaxColumn() << 8) +
|
||||||
(getMinRow() << 16) +
|
(getMinRow() << 16) +
|
||||||
(getMaxRow() << 24));
|
(getMaxRow() << 24));
|
||||||
return code;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -397,8 +397,7 @@ public class CellReference {
|
|||||||
String col = matcher.group(1);
|
String col = matcher.group(1);
|
||||||
String row = matcher.group(2);
|
String row = matcher.group(2);
|
||||||
|
|
||||||
CellRefParts cellRefParts = new CellRefParts(sheetName, row, col);
|
return new CellRefParts(sheetName, row, col);
|
||||||
return cellRefParts;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String parseSheetName(String reference, int indexOfSheetNameDelimiter) {
|
private static String parseSheetName(String reference, int indexOfSheetNameDelimiter) {
|
||||||
|
@ -62,8 +62,7 @@ final class ExpandedDouble {
|
|||||||
_significand = frac.shiftLeft(expAdj);
|
_significand = frac.shiftLeft(expAdj);
|
||||||
_binaryExponent = (biasedExp & 0x07FF) - 1023 - expAdj;
|
_binaryExponent = (biasedExp & 0x07FF) - 1023 - expAdj;
|
||||||
} else {
|
} else {
|
||||||
BigInteger frac = getFrac(rawBits);
|
_significand = getFrac(rawBits);
|
||||||
_significand = frac;
|
|
||||||
_binaryExponent = (biasedExp & 0x07FF) - 1023;
|
_binaryExponent = (biasedExp & 0x07FF) - 1023;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -210,12 +210,10 @@ public class ImageUtils {
|
|||||||
anchor.setRow2(row2);
|
anchor.setRow2(row2);
|
||||||
anchor.setDy2(dy2);
|
anchor.setDy2(dy2);
|
||||||
|
|
||||||
Dimension dim = new Dimension(
|
return new Dimension(
|
||||||
(int)Math.round(scaledWidth*EMU_PER_PIXEL),
|
(int)Math.round(scaledWidth*EMU_PER_PIXEL),
|
||||||
(int)Math.round(scaledHeight*EMU_PER_PIXEL)
|
(int)Math.round(scaledHeight*EMU_PER_PIXEL)
|
||||||
);
|
);
|
||||||
|
|
||||||
return dim;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -209,8 +209,7 @@ public final class PackagingURIHelper {
|
|||||||
public static URI getPath(URI uri) {
|
public static URI getPath(URI uri) {
|
||||||
if (uri != null) {
|
if (uri != null) {
|
||||||
String path = uri.getPath();
|
String path = uri.getPath();
|
||||||
int len = path.length();
|
int num2 = path.length();
|
||||||
int num2 = len;
|
|
||||||
while (--num2 >= 0) {
|
while (--num2 >= 0) {
|
||||||
char ch1 = path.charAt(num2);
|
char ch1 = path.charAt(num2);
|
||||||
if (ch1 == PackagingURIHelper.FORWARD_SLASH_CHAR) {
|
if (ch1 == PackagingURIHelper.FORWARD_SLASH_CHAR) {
|
||||||
|
@ -41,8 +41,7 @@ public final class FileHelper {
|
|||||||
public static File getDirectory(File f) {
|
public static File getDirectory(File f) {
|
||||||
if (f != null) {
|
if (f != null) {
|
||||||
String path = f.getPath();
|
String path = f.getPath();
|
||||||
int len = path.length();
|
int num2 = path.length();
|
||||||
int num2 = len;
|
|
||||||
while (--num2 >= 0) {
|
while (--num2 >= 0) {
|
||||||
char ch1 = path.charAt(num2);
|
char ch1 = path.charAt(num2);
|
||||||
if (ch1 == File.separatorChar) {
|
if (ch1 == File.separatorChar) {
|
||||||
|
@ -220,8 +220,7 @@ public class AgileEncryptor extends Encryptor implements Cloneable {
|
|||||||
public OutputStream getDataStream(DirectoryNode dir)
|
public OutputStream getDataStream(DirectoryNode dir)
|
||||||
throws IOException, GeneralSecurityException {
|
throws IOException, GeneralSecurityException {
|
||||||
// TODO: initialize headers
|
// TODO: initialize headers
|
||||||
AgileCipherOutputStream countStream = new AgileCipherOutputStream(dir);
|
return new AgileCipherOutputStream(dir);
|
||||||
return countStream;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -357,8 +357,7 @@ public class SignatureInfo implements SignatureConfigurable {
|
|||||||
digestInfoValueBuf.write(signatureConfig.getHashMagic());
|
digestInfoValueBuf.write(signatureConfig.getHashMagic());
|
||||||
digestInfoValueBuf.write(digest);
|
digestInfoValueBuf.write(digest);
|
||||||
byte[] digestInfoValue = digestInfoValueBuf.toByteArray();
|
byte[] digestInfoValue = digestInfoValueBuf.toByteArray();
|
||||||
byte[] signatureValue = cipher.doFinal(digestInfoValue);
|
return cipher.doFinal(digestInfoValue);
|
||||||
return signatureValue;
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new EncryptedDocumentException(e);
|
throw new EncryptedDocumentException(e);
|
||||||
}
|
}
|
||||||
|
@ -78,8 +78,7 @@ import org.openxmlformats.schemas.presentationml.x2006.main.NotesMasterDocument;
|
|||||||
try {
|
try {
|
||||||
try {
|
try {
|
||||||
NotesMasterDocument doc = NotesMasterDocument.Factory.parse(is, DEFAULT_XML_OPTIONS);
|
NotesMasterDocument doc = NotesMasterDocument.Factory.parse(is, DEFAULT_XML_OPTIONS);
|
||||||
CTNotesMaster slide = doc.getNotesMaster();
|
return doc.getNotesMaster();
|
||||||
return slide;
|
|
||||||
} finally {
|
} finally {
|
||||||
is.close();
|
is.close();
|
||||||
}
|
}
|
||||||
|
@ -90,8 +90,7 @@ public class XSLFShadow extends XSLFShape implements Shadow<XSLFShape,XSLFTextPa
|
|||||||
public Color getFillColor() {
|
public Color getFillColor() {
|
||||||
SolidPaint ps = getFillStyle();
|
SolidPaint ps = getFillStyle();
|
||||||
if (ps == null) return null;
|
if (ps == null) return null;
|
||||||
Color col = DrawPaint.applyColorTransform(ps.getSolidColor());
|
return DrawPaint.applyColorTransform(ps.getSolidColor());
|
||||||
return col;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -485,8 +485,7 @@ public abstract class XSLFTextShape extends XSLFSimpleShape
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Insets2D getInsets() {
|
public Insets2D getInsets() {
|
||||||
Insets2D insets = new Insets2D(getTopInset(), getLeftInset(), getBottomInset(), getRightInset());
|
return new Insets2D(getTopInset(), getLeftInset(), getBottomInset(), getRightInset());
|
||||||
return insets;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -223,8 +223,7 @@ public class XSSFComment implements Comment {
|
|||||||
for (String s : position.split(",")) {
|
for (String s : position.split(",")) {
|
||||||
pos[i++] = Integer.parseInt(s.trim());
|
pos[i++] = Integer.parseInt(s.trim());
|
||||||
}
|
}
|
||||||
XSSFClientAnchor ca = new XSSFClientAnchor(pos[1]*EMU_PER_PIXEL, pos[3]*EMU_PER_PIXEL, pos[5]*EMU_PER_PIXEL, pos[7]*EMU_PER_PIXEL, pos[0], pos[2], pos[4], pos[6]);
|
return new XSSFClientAnchor(pos[1]*EMU_PER_PIXEL, pos[3]*EMU_PER_PIXEL, pos[5]*EMU_PER_PIXEL, pos[7]*EMU_PER_PIXEL, pos[0], pos[2], pos[4], pos[6]);
|
||||||
return ca;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -122,8 +122,7 @@ public class XSSFFont implements Font {
|
|||||||
*/
|
*/
|
||||||
public int getCharSet() {
|
public int getCharSet() {
|
||||||
CTIntProperty charset = _ctFont.sizeOfCharsetArray() == 0 ? null : _ctFont.getCharsetArray(0);
|
CTIntProperty charset = _ctFont.sizeOfCharsetArray() == 0 ? null : _ctFont.getCharsetArray(0);
|
||||||
int val = charset == null ? FontCharset.ANSI.getValue() : FontCharset.valueOf(charset.getVal()).getValue();
|
return charset == null ? FontCharset.ANSI.getValue() : FontCharset.valueOf(charset.getVal()).getValue();
|
||||||
return val;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -214,8 +213,7 @@ public class XSSFFont implements Font {
|
|||||||
private double getFontHeightRaw() {
|
private double getFontHeightRaw() {
|
||||||
CTFontSize size = _ctFont.sizeOfSzArray() == 0 ? null : _ctFont.getSzArray(0);
|
CTFontSize size = _ctFont.sizeOfSzArray() == 0 ? null : _ctFont.getSzArray(0);
|
||||||
if (size != null) {
|
if (size != null) {
|
||||||
double fontHeight = size.getVal();
|
return size.getVal();
|
||||||
return fontHeight;
|
|
||||||
}
|
}
|
||||||
return DEFAULT_FONT_SIZE;
|
return DEFAULT_FONT_SIZE;
|
||||||
}
|
}
|
||||||
|
@ -225,8 +225,7 @@ public class XSSFPivotTable extends POIXMLDocumentPart {
|
|||||||
|
|
||||||
protected AreaReference getPivotArea() {
|
protected AreaReference getPivotArea() {
|
||||||
final Workbook wb = getDataSheet().getWorkbook();
|
final Workbook wb = getDataSheet().getWorkbook();
|
||||||
AreaReference pivotArea = getPivotCacheDefinition().getPivotArea(wb);
|
return getPivotCacheDefinition().getPivotArea(wb);
|
||||||
return pivotArea;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -612,8 +612,7 @@ public class XSSFTextParagraph implements Iterable<XSSFTextRun>{
|
|||||||
};
|
};
|
||||||
fetchParagraphProperty(fetcher);
|
fetchParagraphProperty(fetcher);
|
||||||
|
|
||||||
double spcBef = fetcher.getValue() == null ? 0 : fetcher.getValue();
|
return fetcher.getValue() == null ? 0 : fetcher.getValue();
|
||||||
return spcBef;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -74,8 +74,7 @@ public class XSSFSingleXmlCell {
|
|||||||
public String getXpath(){
|
public String getXpath(){
|
||||||
CTXmlCellPr xmlCellPr = singleXmlCell.getXmlCellPr();
|
CTXmlCellPr xmlCellPr = singleXmlCell.getXmlCellPr();
|
||||||
CTXmlPr xmlPr = xmlCellPr.getXmlPr();
|
CTXmlPr xmlPr = xmlCellPr.getXmlPr();
|
||||||
String xpath = xmlPr.getXpath();
|
return xmlPr.getXpath();
|
||||||
return xpath;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getMapId(){
|
public long getMapId(){
|
||||||
|
@ -1431,8 +1431,7 @@ public class XWPFDocument extends POIXMLDocument implements Document, IBody {
|
|||||||
public XWPFPictureData getPictureDataByID(String blipID) {
|
public XWPFPictureData getPictureDataByID(String blipID) {
|
||||||
POIXMLDocumentPart relatedPart = getRelationById(blipID);
|
POIXMLDocumentPart relatedPart = getRelationById(blipID);
|
||||||
if (relatedPart instanceof XWPFPictureData) {
|
if (relatedPart instanceof XWPFPictureData) {
|
||||||
XWPFPictureData xwpfPicData = (XWPFPictureData) relatedPart;
|
return (XWPFPictureData) relatedPart;
|
||||||
return xwpfPicData;
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -1378,9 +1378,8 @@ public class XWPFParagraph implements IBodyElement, IRunBody, ISDTContents, Para
|
|||||||
* a new instance.
|
* a new instance.
|
||||||
*/
|
*/
|
||||||
private CTPPr getCTPPr() {
|
private CTPPr getCTPPr() {
|
||||||
CTPPr pr = paragraph.getPPr() == null ? paragraph.addNewPPr()
|
return paragraph.getPPr() == null ? paragraph.addNewPPr()
|
||||||
: paragraph.getPPr();
|
: paragraph.getPPr();
|
||||||
return pr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -106,8 +106,7 @@ public class PkiTestUtils {
|
|||||||
SecureRandom random = new SecureRandom();
|
SecureRandom random = new SecureRandom();
|
||||||
keyPairGenerator.initialize(new RSAKeyGenParameterSpec(1024,
|
keyPairGenerator.initialize(new RSAKeyGenParameterSpec(1024,
|
||||||
RSAKeyGenParameterSpec.F4), random);
|
RSAKeyGenParameterSpec.F4), random);
|
||||||
KeyPair keyPair = keyPairGenerator.generateKeyPair();
|
return keyPairGenerator.generateKeyPair();
|
||||||
return keyPair;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static X509Certificate generateCertificate(PublicKey subjectPublicKey,
|
static X509Certificate generateCertificate(PublicKey subjectPublicKey,
|
||||||
@ -218,8 +217,7 @@ public class PkiTestUtils {
|
|||||||
documentBuilderFactory.setNamespaceAware(true);
|
documentBuilderFactory.setNamespaceAware(true);
|
||||||
DocumentBuilder documentBuilder = documentBuilderFactory
|
DocumentBuilder documentBuilder = documentBuilderFactory
|
||||||
.newDocumentBuilder();
|
.newDocumentBuilder();
|
||||||
Document document = documentBuilder.parse(inputSource);
|
return documentBuilder.parse(inputSource);
|
||||||
return document;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static String toString(Node dom) throws TransformerException {
|
static String toString(Node dom) throws TransformerException {
|
||||||
@ -310,8 +308,7 @@ public class PkiTestUtils {
|
|||||||
|
|
||||||
|
|
||||||
OCSPRespBuilder ocspRespBuilder = new OCSPRespBuilder();
|
OCSPRespBuilder ocspRespBuilder = new OCSPRespBuilder();
|
||||||
OCSPResp ocspResp = ocspRespBuilder.build(OCSPRespBuilder.SUCCESSFUL, basicOCSPResp);
|
|
||||||
|
|
||||||
return ocspResp;
|
return ocspRespBuilder.build(OCSPRespBuilder.SUCCESSFUL, basicOCSPResp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -341,8 +341,7 @@ public class TestXSSFDataValidation extends BaseTestDataValidation {
|
|||||||
DataValidationHelper dataValidationHelper = sheet.getDataValidationHelper();
|
DataValidationHelper dataValidationHelper = sheet.getDataValidationHelper();
|
||||||
|
|
||||||
DataValidationConstraint constraint = dataValidationHelper.createCustomConstraint("true");
|
DataValidationConstraint constraint = dataValidationHelper.createCustomConstraint("true");
|
||||||
final XSSFDataValidation validation = (XSSFDataValidation) dataValidationHelper.createValidation(constraint, new CellRangeAddressList(0, 0, 0, 0));
|
return (XSSFDataValidation) dataValidationHelper.createValidation(constraint, new CellRangeAddressList(0, 0, 0, 0));
|
||||||
return validation;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -722,8 +722,7 @@ public final class TestXSSFSheet extends BaseTestXSheet {
|
|||||||
|
|
||||||
// Now check the low level stuff, and check that's all
|
// Now check the low level stuff, and check that's all
|
||||||
// been set correctly
|
// been set correctly
|
||||||
XSSFSheet xs = sheet;
|
CTWorksheet cts = sheet.getCTWorksheet();
|
||||||
CTWorksheet cts = xs.getCTWorksheet();
|
|
||||||
|
|
||||||
assertEquals(1, cts.sizeOfColsArray());
|
assertEquals(1, cts.sizeOfColsArray());
|
||||||
CTCols cols = cts.getColsArray(0);
|
CTCols cols = cts.getColsArray(0);
|
||||||
|
@ -166,8 +166,6 @@ public final class SlideIdListing {
|
|||||||
long type = LittleEndian.getUShort(fileContents, pos+2);
|
long type = LittleEndian.getUShort(fileContents, pos+2);
|
||||||
long rlen = LittleEndian.getUInt(fileContents, pos+4);
|
long rlen = LittleEndian.getUInt(fileContents, pos+4);
|
||||||
|
|
||||||
Record r = Record.createRecordForType(type,fileContents,pos,(int)rlen+8);
|
return Record.createRecordForType(type,fileContents,pos,(int)rlen+8);
|
||||||
|
|
||||||
return r;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -124,8 +124,6 @@ public final class UserEditAndPersistListing {
|
|||||||
long type = LittleEndian.getUShort(fileContents, pos+2);
|
long type = LittleEndian.getUShort(fileContents, pos+2);
|
||||||
long rlen = LittleEndian.getUInt(fileContents, pos+4);
|
long rlen = LittleEndian.getUInt(fileContents, pos+4);
|
||||||
|
|
||||||
Record r = Record.createRecordForType(type,fileContents,pos,(int)rlen+8);
|
return Record.createRecordForType(type,fileContents,pos,(int)rlen+8);
|
||||||
|
|
||||||
return r;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -144,8 +144,7 @@ public final class QuickButCruddyTextExtractor {
|
|||||||
|
|
||||||
// Start walking the file, looking for the records
|
// Start walking the file, looking for the records
|
||||||
while(walkPos != -1) {
|
while(walkPos != -1) {
|
||||||
int newPos = findTextRecords(walkPos,textV);
|
walkPos = findTextRecords(walkPos,textV);
|
||||||
walkPos = newPos;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return what we find
|
// Return what we find
|
||||||
|
@ -182,8 +182,7 @@ public final class ColorSchemeAtom extends RecordAtom {
|
|||||||
byte[] with_zero = new byte[4];
|
byte[] with_zero = new byte[4];
|
||||||
System.arraycopy(rgb,0,with_zero,0,3);
|
System.arraycopy(rgb,0,with_zero,0,3);
|
||||||
with_zero[3] = 0;
|
with_zero[3] = 0;
|
||||||
int ret = LittleEndian.getInt(with_zero,0);
|
return LittleEndian.getInt(with_zero,0);
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -137,8 +137,7 @@ public abstract class Record
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Turn the vector into an array, and return
|
// Turn the vector into an array, and return
|
||||||
Record[] cRecords = children.toArray( new Record[children.size()] );
|
return children.toArray( new Record[children.size()] );
|
||||||
return cRecords;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -192,8 +192,7 @@ public final class TextRulerAtom extends RecordAtom {
|
|||||||
0x00, 0x00, (byte)0xA6, 0x0F, 0x0A, 0x00, 0x00, 0x00,
|
0x00, 0x00, (byte)0xA6, 0x0F, 0x0A, 0x00, 0x00, 0x00,
|
||||||
0x10, 0x03, 0x00, 0x00, (byte)0xF9, 0x00, 0x41, 0x01, 0x41, 0x01
|
0x10, 0x03, 0x00, 0x00, (byte)0xF9, 0x00, 0x41, 0x01, 0x41, 0x01
|
||||||
};
|
};
|
||||||
TextRulerAtom ruler = new TextRulerAtom(data, 0, data.length);
|
return new TextRulerAtom(data, 0, data.length);
|
||||||
return ruler;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setParagraphIndent(short tetxOffset, short bulletOffset){
|
public void setParagraphIndent(short tetxOffset, short bulletOffset){
|
||||||
|
@ -221,14 +221,13 @@ implements HSLFShapeContainer, GroupShape<HSLFShape,HSLFTextParagraph> {
|
|||||||
x2 = clientAnchor.getDx1();
|
x2 = clientAnchor.getDx1();
|
||||||
y2 = clientAnchor.getRow1();
|
y2 = clientAnchor.getRow1();
|
||||||
}
|
}
|
||||||
Rectangle2D anchor= new Rectangle2D.Double(
|
|
||||||
|
return new Rectangle2D.Double(
|
||||||
(x1 == -1 ? -1 : Units.masterToPoints(x1)),
|
(x1 == -1 ? -1 : Units.masterToPoints(x1)),
|
||||||
(y1 == -1 ? -1 : Units.masterToPoints(y1)),
|
(y1 == -1 ? -1 : Units.masterToPoints(y1)),
|
||||||
(x2 == -1 ? -1 : Units.masterToPoints(x2-x1)),
|
(x2 == -1 ? -1 : Units.masterToPoints(x2-x1)),
|
||||||
(y2 == -1 ? -1 : Units.masterToPoints(y2-y1))
|
(y2 == -1 ? -1 : Units.masterToPoints(y2-y1))
|
||||||
);
|
);
|
||||||
|
|
||||||
return anchor;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -168,14 +168,13 @@ public abstract class HSLFShape implements Shape<HSLFShape,HSLFTextParagraph> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: find out where this -1 value comes from at #57820 (link to ms docs?)
|
// TODO: find out where this -1 value comes from at #57820 (link to ms docs?)
|
||||||
Rectangle2D anchor = new Rectangle2D.Double(
|
|
||||||
|
return new Rectangle2D.Double(
|
||||||
(x1 == -1 ? -1 : Units.masterToPoints(x1)),
|
(x1 == -1 ? -1 : Units.masterToPoints(x1)),
|
||||||
(y1 == -1 ? -1 : Units.masterToPoints(y1)),
|
(y1 == -1 ? -1 : Units.masterToPoints(y1)),
|
||||||
(x2 == -1 ? -1 : Units.masterToPoints(x2-x1)),
|
(x2 == -1 ? -1 : Units.masterToPoints(x2-x1)),
|
||||||
(y2 == -1 ? -1 : Units.masterToPoints(y2-y1))
|
(y2 == -1 ? -1 : Units.masterToPoints(y2-y1))
|
||||||
);
|
);
|
||||||
|
|
||||||
return anchor;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -131,8 +131,7 @@ public abstract class HSLFSimpleShape extends HSLFShape implements SimpleShape<H
|
|||||||
public double getLineWidth(){
|
public double getLineWidth(){
|
||||||
AbstractEscherOptRecord opt = getEscherOptRecord();
|
AbstractEscherOptRecord opt = getEscherOptRecord();
|
||||||
EscherSimpleProperty prop = getEscherProperty(opt, EscherProperties.LINESTYLE__LINEWIDTH);
|
EscherSimpleProperty prop = getEscherProperty(opt, EscherProperties.LINESTYLE__LINEWIDTH);
|
||||||
double width = (prop == null) ? DEFAULT_LINE_WIDTH : Units.toPoints(prop.getPropertyValue());
|
return (prop == null) ? DEFAULT_LINE_WIDTH : Units.toPoints(prop.getPropertyValue());
|
||||||
return width;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -402,8 +402,7 @@ implements HSLFShapeContainer, TableShape<HSLFShape,HSLFTextParagraph> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: check for merged cols
|
// TODO: check for merged cols
|
||||||
double width = cells[0][col].getAnchor().getWidth();
|
return cells[0][col].getAnchor().getWidth();
|
||||||
return width;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1212,8 +1212,7 @@ public final class HSLFTextParagraph implements TextParagraph<HSLFShape,HSLFText
|
|||||||
* representation
|
* representation
|
||||||
*/
|
*/
|
||||||
protected static String toInternalString(String s) {
|
protected static String toInternalString(String s) {
|
||||||
String ns = s.replaceAll("\\r?\\n", "\r");
|
return s.replaceAll("\\r?\\n", "\r");
|
||||||
return ns;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -415,8 +415,7 @@ public final class HSLFTextRun implements TextRun {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
Color color = HSLFTextParagraph.getColorFromColorIndexStruct(tp.getValue(), parentParagraph.getSheet());
|
Color color = HSLFTextParagraph.getColorFromColorIndexStruct(tp.getValue(), parentParagraph.getSheet());
|
||||||
SolidPaint ps = DrawPaint.createSolidPaint(color);
|
return DrawPaint.createSolidPaint(color);
|
||||||
return ps;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -723,8 +723,7 @@ implements TextShape<HSLFShape,HSLFTextParagraph> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Insets2D getInsets() {
|
public Insets2D getInsets() {
|
||||||
Insets2D insets = new Insets2D(getTopInset(), getLeftInset(), getBottomInset(), getRightInset());
|
return new Insets2D(getTopInset(), getLeftInset(), getBottomInset(), getRightInset());
|
||||||
return insets;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -185,11 +185,10 @@ public class AbstractExcelUtils
|
|||||||
{
|
{
|
||||||
CellRangeAddress[] mergedRangeRowInfo = rowNumber < mergedRanges.length ? mergedRanges[rowNumber]
|
CellRangeAddress[] mergedRangeRowInfo = rowNumber < mergedRanges.length ? mergedRanges[rowNumber]
|
||||||
: null;
|
: null;
|
||||||
CellRangeAddress cellRangeAddress = mergedRangeRowInfo != null
|
|
||||||
|
return mergedRangeRowInfo != null
|
||||||
&& columnNumber < mergedRangeRowInfo.length ? mergedRangeRowInfo[columnNumber]
|
&& columnNumber < mergedRangeRowInfo.length ? mergedRangeRowInfo[columnNumber]
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
return cellRangeAddress;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static boolean isEmpty( String str )
|
static boolean isEmpty( String str )
|
||||||
|
@ -154,8 +154,7 @@ public class ExcelToHtmlConverter extends AbstractExcelConverter
|
|||||||
XMLHelper.getDocumentBuilderFactory().newDocumentBuilder()
|
XMLHelper.getDocumentBuilderFactory().newDocumentBuilder()
|
||||||
.newDocument() );
|
.newDocument() );
|
||||||
excelToHtmlConverter.processWorkbook( workbook );
|
excelToHtmlConverter.processWorkbook( workbook );
|
||||||
Document doc = excelToHtmlConverter.getDocument();
|
return excelToHtmlConverter.getDocument();
|
||||||
return doc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private String cssClassContainerCell;
|
private String cssClassContainerCell;
|
||||||
|
@ -597,8 +597,7 @@ public final class HSSFChart {
|
|||||||
|
|
||||||
private PlotAreaRecord createPlotAreaRecord()
|
private PlotAreaRecord createPlotAreaRecord()
|
||||||
{
|
{
|
||||||
PlotAreaRecord r = new PlotAreaRecord( );
|
return new PlotAreaRecord( );
|
||||||
return r;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private AxisLineFormatRecord createAxisLineFormatRecord( short format )
|
private AxisLineFormatRecord createAxisLineFormatRecord( short format )
|
||||||
|
@ -667,7 +667,6 @@ public final class HWPFDocument extends HWPFDocumentCore {
|
|||||||
|
|
||||||
// get fcMin and fcMac because we will be writing the actual text with the
|
// get fcMin and fcMac because we will be writing the actual text with the
|
||||||
// complex table.
|
// complex table.
|
||||||
int fcMin = mainOffset;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* clx (encoding of the sprm lists for a complex file and piece table
|
* clx (encoding of the sprm lists for a complex file and piece table
|
||||||
@ -736,7 +735,7 @@ public final class HWPFDocument extends HWPFDocumentCore {
|
|||||||
|
|
||||||
// write out the CHPBinTable.
|
// write out the CHPBinTable.
|
||||||
_fib.setFcPlcfbteChpx(tableOffset);
|
_fib.setFcPlcfbteChpx(tableOffset);
|
||||||
_cbt.writeTo(wordDocumentStream, tableStream, fcMin, _cft.getTextPieceTable());
|
_cbt.writeTo(wordDocumentStream, tableStream, mainOffset, _cft.getTextPieceTable());
|
||||||
_fib.setLcbPlcfbteChpx(tableStream.size() - tableOffset);
|
_fib.setLcbPlcfbteChpx(tableStream.size() - tableOffset);
|
||||||
tableOffset = tableStream.size();
|
tableOffset = tableStream.size();
|
||||||
|
|
||||||
@ -892,7 +891,7 @@ public final class HWPFDocument extends HWPFDocumentCore {
|
|||||||
tableOffset = tableStream.size();
|
tableOffset = tableStream.size();
|
||||||
|
|
||||||
// set some variables in the FileInformationBlock.
|
// set some variables in the FileInformationBlock.
|
||||||
_fib.getFibBase().setFcMin(fcMin);
|
_fib.getFibBase().setFcMin(mainOffset);
|
||||||
_fib.getFibBase().setFcMac(fcMac);
|
_fib.getFibBase().setFcMac(fcMac);
|
||||||
_fib.setCbMac(wordDocumentStream.size());
|
_fib.setCbMac(wordDocumentStream.size());
|
||||||
|
|
||||||
|
@ -194,8 +194,7 @@ public abstract class AbstractWordConverter
|
|||||||
original.bold = characterRun.isBold();
|
original.bold = characterRun.isBold();
|
||||||
original.italic = characterRun.isItalic();
|
original.italic = characterRun.isItalic();
|
||||||
original.fontName = characterRun.getFontName();
|
original.fontName = characterRun.getFontName();
|
||||||
Triplet updated = getFontReplacer().update( original );
|
return getFontReplacer().update( original );
|
||||||
return updated;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract Document getDocument();
|
public abstract Document getDocument();
|
||||||
|
@ -111,8 +111,7 @@ public class HtmlDocumentFacade
|
|||||||
stringBuilder.append( "}\n" );
|
stringBuilder.append( "}\n" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
final String stylesheetText = stringBuilder.toString();
|
return stringBuilder.toString();
|
||||||
return stylesheetText;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Element createBlock()
|
public Element createBlock()
|
||||||
@ -179,8 +178,7 @@ public class HtmlDocumentFacade
|
|||||||
|
|
||||||
public Element createSelect()
|
public Element createSelect()
|
||||||
{
|
{
|
||||||
Element result = document.createElement( "select" );
|
return document.createElement( "select" );
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Element createTable()
|
public Element createTable()
|
||||||
|
@ -118,8 +118,7 @@ public class RecordUtil
|
|||||||
|
|
||||||
for ( int x = 0; x < parentSize; x++ )
|
for ( int x = 0; x < parentSize; x++ )
|
||||||
{
|
{
|
||||||
int temp = mask;
|
numBits += ( mask >> x ) & 0x1;
|
||||||
numBits += ( temp >> x ) & 0x1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( numBits == 1 )
|
if ( numBits == 1 )
|
||||||
|
@ -226,8 +226,7 @@ public class CHPBinTable
|
|||||||
final int boundary = objBoundary.intValue();
|
final int boundary = objBoundary.intValue();
|
||||||
|
|
||||||
final int startInclusive = lastTextRunStart;
|
final int startInclusive = lastTextRunStart;
|
||||||
final int endExclusive = boundary;
|
lastTextRunStart = boundary;
|
||||||
lastTextRunStart = endExclusive;
|
|
||||||
|
|
||||||
int startPosition = binarySearch( oldChpxSortedByStartPos, boundary );
|
int startPosition = binarySearch( oldChpxSortedByStartPos, boundary );
|
||||||
startPosition = Math.abs( startPosition );
|
startPosition = Math.abs( startPosition );
|
||||||
@ -246,7 +245,7 @@ public class CHPBinTable
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
int left = Math.max( startInclusive, chpx.getStart() );
|
int left = Math.max( startInclusive, chpx.getStart() );
|
||||||
int right = Math.min( endExclusive, chpx.getEnd() );
|
int right = Math.min(boundary, chpx.getEnd() );
|
||||||
|
|
||||||
if ( left < right )
|
if ( left < right )
|
||||||
{
|
{
|
||||||
@ -258,10 +257,10 @@ public class CHPBinTable
|
|||||||
{
|
{
|
||||||
logger.log( POILogger.WARN, "Text piece [",
|
logger.log( POILogger.WARN, "Text piece [",
|
||||||
Integer.valueOf( startInclusive ), "; ",
|
Integer.valueOf( startInclusive ), "; ",
|
||||||
Integer.valueOf( endExclusive ),
|
Integer.valueOf(boundary),
|
||||||
") has no CHPX. Creating new one." );
|
") has no CHPX. Creating new one." );
|
||||||
// create it manually
|
// create it manually
|
||||||
CHPX chpx = new CHPX( startInclusive, endExclusive,
|
CHPX chpx = new CHPX( startInclusive, boundary,
|
||||||
new SprmBuffer( 0 ) );
|
new SprmBuffer( 0 ) );
|
||||||
newChpxs.add( chpx );
|
newChpxs.add( chpx );
|
||||||
continue;
|
continue;
|
||||||
@ -272,7 +271,7 @@ public class CHPBinTable
|
|||||||
// can we reuse existing?
|
// can we reuse existing?
|
||||||
CHPX existing = chpxs.get( 0 );
|
CHPX existing = chpxs.get( 0 );
|
||||||
if ( existing.getStart() == startInclusive
|
if ( existing.getStart() == startInclusive
|
||||||
&& existing.getEnd() == endExclusive )
|
&& existing.getEnd() == boundary)
|
||||||
{
|
{
|
||||||
newChpxs.add( existing );
|
newChpxs.add( existing );
|
||||||
continue;
|
continue;
|
||||||
@ -286,7 +285,7 @@ public class CHPBinTable
|
|||||||
{
|
{
|
||||||
sprmBuffer.append( chpx.getGrpprl(), 0 );
|
sprmBuffer.append( chpx.getGrpprl(), 0 );
|
||||||
}
|
}
|
||||||
CHPX newChpx = new CHPX( startInclusive, endExclusive, sprmBuffer );
|
CHPX newChpx = new CHPX( startInclusive, boundary, sprmBuffer );
|
||||||
newChpxs.add( newChpx );
|
newChpxs.add( newChpx );
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
|
@ -72,9 +72,8 @@ public final class CHPX extends BytePropertyNode<CHPX>
|
|||||||
}
|
}
|
||||||
|
|
||||||
CharacterProperties baseStyle = ss.getCharacterStyle( istd );
|
CharacterProperties baseStyle = ss.getCharacterStyle( istd );
|
||||||
CharacterProperties props = CharacterSprmUncompressor.uncompressCHP(
|
return CharacterSprmUncompressor.uncompressCHP(
|
||||||
ss, baseStyle, getGrpprl(), 0 );
|
ss, baseStyle, getGrpprl(), 0 );
|
||||||
return props;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
|
@ -151,8 +151,7 @@ public final class ListTables
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if(level < lst.numLevels()) {
|
if(level < lst.numLevels()) {
|
||||||
ListLevel lvl = lst.getLevels()[level];
|
return lst.getLevels()[level];
|
||||||
return lvl;
|
|
||||||
}
|
}
|
||||||
if (log.check(POILogger.WARN)) {
|
if (log.check(POILogger.WARN)) {
|
||||||
log.log(POILogger.WARN, "Requested level " + level + " which was greater than the maximum defined (" + lst.numLevels() + ")");
|
log.log(POILogger.WARN, "Requested level " + level + " which was greater than the maximum defined (" + lst.numLevels() + ")");
|
||||||
|
@ -361,8 +361,6 @@ public final class PAPFormattedDiskPage extends FormattedDiskPage {
|
|||||||
{
|
{
|
||||||
int pheOffset = _offset + 1 + (((_crun + 1) * 4) + (index * 13));
|
int pheOffset = _offset + 1 + (((_crun + 1) * 4) + (index * 13));
|
||||||
|
|
||||||
ParagraphHeight phe = new ParagraphHeight(_fkp, pheOffset);
|
return new ParagraphHeight(_fkp, pheOffset);
|
||||||
|
|
||||||
return phe;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -151,8 +151,7 @@ public final class PAPX extends BytePropertyNode<PAPX> {
|
|||||||
|
|
||||||
short istd = getIstd();
|
short istd = getIstd();
|
||||||
ParagraphProperties baseStyle = ss.getParagraphStyle(istd);
|
ParagraphProperties baseStyle = ss.getParagraphStyle(istd);
|
||||||
ParagraphProperties props = ParagraphSprmUncompressor.uncompressPAP(baseStyle, getGrpprl(), 2);
|
return ParagraphSprmUncompressor.uncompressPAP(baseStyle, getGrpprl(), 2);
|
||||||
return props;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -64,8 +64,7 @@ public class PlexOfField
|
|||||||
}
|
}
|
||||||
|
|
||||||
public String toString() {
|
public String toString() {
|
||||||
String str = String.format(Locale.ROOT, "[%d, %d) - FLD - 0x%x; 0x%x"
|
return String.format(Locale.ROOT, "[%d, %d) - FLD - 0x%x; 0x%x"
|
||||||
, getFcStart(), getFcEnd(), fld.getBoundaryType(), fld.getFlt());
|
, getFcStart(), getFcEnd(), fld.getBoundaryType(), fld.getFlt());
|
||||||
return str;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -89,14 +89,13 @@ public class SectionTable
|
|||||||
// Some files seem to lie about their unicode status, which
|
// Some files seem to lie about their unicode status, which
|
||||||
// is very very pesky. Try to work around these, but this
|
// is very very pesky. Try to work around these, but this
|
||||||
// is getting on for black magic...
|
// is getting on for black magic...
|
||||||
int mainEndsAt = mainLength;
|
|
||||||
boolean matchAt = false;
|
boolean matchAt = false;
|
||||||
boolean matchHalf = false;
|
boolean matchHalf = false;
|
||||||
for (int i=0; i<_sections.size(); i++) {
|
for (int i=0; i<_sections.size(); i++) {
|
||||||
SEPX s = _sections.get(i);
|
SEPX s = _sections.get(i);
|
||||||
if (s.getEnd() == mainEndsAt) {
|
if (s.getEnd() == mainLength) {
|
||||||
matchAt = true;
|
matchAt = true;
|
||||||
} else if(s.getEnd() == mainEndsAt || s.getEnd() == mainEndsAt-1) {
|
} else if(s.getEnd() == mainLength || s.getEnd() == mainLength -1) {
|
||||||
matchHalf = true;
|
matchHalf = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -107,11 +107,10 @@ public final class StyleDescription implements HDFType
|
|||||||
_name = StringUtil.getFromUnicodeLE(std, nameStart, (nameLength*multiplier)/2);
|
_name = StringUtil.getFromUnicodeLE(std, nameStart, (nameLength*multiplier)/2);
|
||||||
|
|
||||||
//length then null terminator.
|
//length then null terminator.
|
||||||
int grupxStart = ((nameLength + 1) * multiplier) + nameStart;
|
|
||||||
|
|
||||||
// the spec only refers to two possible upxs but it mentions
|
// the spec only refers to two possible upxs but it mentions
|
||||||
// that more may be added in the future
|
// that more may be added in the future
|
||||||
int varOffset = grupxStart;
|
int varOffset = ((nameLength + 1) * multiplier) + nameStart;
|
||||||
int countOfUPX = _stdfBase.getCupx();
|
int countOfUPX = _stdfBase.getCupx();
|
||||||
_upxs = new UPX[countOfUPX];
|
_upxs = new UPX[countOfUPX];
|
||||||
for(int x = 0; x < countOfUPX; x++)
|
for(int x = 0; x < countOfUPX; x++)
|
||||||
|
@ -73,12 +73,11 @@ public class TextPiece extends PropertyNode<TextPiece> {
|
|||||||
* Create the StringBuilder from the text and unicode flag
|
* Create the StringBuilder from the text and unicode flag
|
||||||
*/
|
*/
|
||||||
private static StringBuilder buildInitSB(byte[] text, PieceDescriptor pd) {
|
private static StringBuilder buildInitSB(byte[] text, PieceDescriptor pd) {
|
||||||
byte[] textBuffer = text;
|
|
||||||
if (StringUtil.BIG5.equals(pd.getCharset())) {
|
if (StringUtil.BIG5.equals(pd.getCharset())) {
|
||||||
return new StringBuilder(CodePageUtil.cp950ToString(text, 0, text.length));
|
return new StringBuilder(CodePageUtil.cp950ToString(text, 0, text.length));
|
||||||
}
|
}
|
||||||
|
|
||||||
String str = new String(textBuffer, 0, textBuffer.length, (pd.isUnicode()) ? StringUtil.UTF16LE : pd.getCharset());
|
String str = new String(text, 0, text.length, (pd.isUnicode()) ? StringUtil.UTF16LE : pd.getCharset());
|
||||||
return new StringBuilder(str);
|
return new StringBuilder(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -657,8 +657,7 @@ public final class CharacterRun extends Range
|
|||||||
getPicOffset() );
|
getPicOffset() );
|
||||||
FFData ffData = new FFData( data.getBinData(), 0 );
|
FFData ffData = new FFData( data.getBinData(), 0 );
|
||||||
|
|
||||||
String[] values = ffData.getDropList();
|
return ffData.getDropList();
|
||||||
return values;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -54,15 +54,14 @@ public final class DateAndTime
|
|||||||
|
|
||||||
public Calendar getDate() {
|
public Calendar getDate() {
|
||||||
// TODO Discover if the timezone is stored somewhere else or not
|
// TODO Discover if the timezone is stored somewhere else or not
|
||||||
Calendar cal = LocaleUtil.getLocaleCalendar(
|
return LocaleUtil.getLocaleCalendar(
|
||||||
_years.getValue(_info2)+1900,
|
_years.getValue(_info2)+1900,
|
||||||
_months.getValue(_info2)-1,
|
_months.getValue(_info2)-1,
|
||||||
_dom.getValue(_info),
|
_dom.getValue(_info),
|
||||||
_hours.getValue(_info),
|
_hours.getValue(_info),
|
||||||
_minutes.getValue(_info),
|
_minutes.getValue(_info),
|
||||||
0
|
0
|
||||||
);
|
);
|
||||||
return cal;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void serialize(byte[] buf, int offset)
|
public void serialize(byte[] buf, int offset)
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user