Fixed unused imports compiler warnings (and some others)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@805262 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
37bbf5d179
commit
995d8fe73f
@ -1,195 +0,0 @@
|
|||||||
/* ====================================================================
|
|
||||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
|
||||||
contributor license agreements. See the NOTICE file distributed with
|
|
||||||
this work for additional information regarding copyright ownership.
|
|
||||||
The ASF licenses this file to You under the Apache License, Version 2.0
|
|
||||||
(the "License"); you may not use this file except in compliance with
|
|
||||||
the License. You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software
|
|
||||||
distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
See the License for the specific language governing permissions and
|
|
||||||
limitations under the License.
|
|
||||||
==================================================================== */
|
|
||||||
|
|
||||||
|
|
||||||
package org.apache.poi.hssf.dev;
|
|
||||||
|
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
|
|
||||||
import org.apache.poi.hssf.record.*;
|
|
||||||
import org.apache.poi.hssf.eventmodel.*;
|
|
||||||
import org.apache.poi.hssf.eventusermodel.*;
|
|
||||||
import org.apache.poi.hssf.usermodel.*;
|
|
||||||
|
|
||||||
import org.apache.poi.hssf.eventusermodel.HSSFRequest;
|
|
||||||
import org.apache.poi.hssf.eventusermodel.HSSFListener;
|
|
||||||
import org.apache.poi.hssf.eventusermodel.HSSFEventFactory;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Event Factory version of HSSF test class.
|
|
||||||
* @author andy
|
|
||||||
*/
|
|
||||||
//JMH
|
|
||||||
//public class EFHSSF
|
|
||||||
//{
|
|
||||||
// String infile;
|
|
||||||
// String outfile;
|
|
||||||
// HSSFWorkbook workbook = null;
|
|
||||||
// HSSFSheet cursheet = null;
|
|
||||||
//
|
|
||||||
// /** Creates a new instance of EFHSSF */
|
|
||||||
//
|
|
||||||
// public EFHSSF()
|
|
||||||
// {
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public void setInputFile(String infile)
|
|
||||||
// {
|
|
||||||
// this.infile = infile;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public void setOutputFile(String outfile)
|
|
||||||
// {
|
|
||||||
// this.outfile = outfile;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public void run()
|
|
||||||
// throws IOException
|
|
||||||
// {
|
|
||||||
// FileInputStream fin = new FileInputStream(infile);
|
|
||||||
// POIFSFileSystem poifs = new POIFSFileSystem(fin);
|
|
||||||
// InputStream din = poifs.createDocumentInputStream("Workbook");
|
|
||||||
// HSSFRequest req = new HSSFRequest();
|
|
||||||
//
|
|
||||||
// req.addListenerForAllRecords(new EFHSSFListener(this));
|
|
||||||
// HSSFEventFactory factory = new HSSFEventFactory();
|
|
||||||
//
|
|
||||||
// factory.processEvents(req, din);
|
|
||||||
// fin.close();
|
|
||||||
// din.close();
|
|
||||||
// FileOutputStream fout = new FileOutputStream(outfile);
|
|
||||||
//
|
|
||||||
// workbook.write(fout);
|
|
||||||
// fout.close();
|
|
||||||
// System.out.println("done.");
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public void recordHandler(Record record)
|
|
||||||
// {
|
|
||||||
// HSSFRow row = null;
|
|
||||||
// HSSFCell cell = null;
|
|
||||||
// int sheetnum = -1;
|
|
||||||
//
|
|
||||||
// switch (record.getSid())
|
|
||||||
// {
|
|
||||||
//
|
|
||||||
// case BOFRecord.sid :
|
|
||||||
// BOFRecord bof = ( BOFRecord ) record;
|
|
||||||
//
|
|
||||||
// if (bof.getType() == bof.TYPE_WORKBOOK)
|
|
||||||
// {
|
|
||||||
// workbook = new HSSFWorkbook();
|
|
||||||
// }
|
|
||||||
// else if (bof.getType() == bof.TYPE_WORKSHEET)
|
|
||||||
// {
|
|
||||||
// sheetnum++;
|
|
||||||
// cursheet = workbook.getSheetAt(sheetnum);
|
|
||||||
// }
|
|
||||||
// break;
|
|
||||||
//
|
|
||||||
// case BoundSheetRecord.sid :
|
|
||||||
// BoundSheetRecord bsr = ( BoundSheetRecord ) record;
|
|
||||||
//
|
|
||||||
// workbook.createSheet(bsr.getSheetname());
|
|
||||||
// break;
|
|
||||||
//
|
|
||||||
// case RowRecord.sid :
|
|
||||||
// RowRecord rowrec = ( RowRecord ) record;
|
|
||||||
//
|
|
||||||
// cursheet.createRow(rowrec.getRowNumber());
|
|
||||||
// break;
|
|
||||||
//
|
|
||||||
// case NumberRecord.sid :
|
|
||||||
// NumberRecord numrec = ( NumberRecord ) record;
|
|
||||||
//
|
|
||||||
// row = cursheet.getRow(numrec.getRow());
|
|
||||||
// cell = row.createCell(numrec.getColumn(),
|
|
||||||
// HSSFCell.CELL_TYPE_NUMERIC);
|
|
||||||
// cell.setCellValue(numrec.getValue());
|
|
||||||
// break;
|
|
||||||
//
|
|
||||||
// case SSTRecord.sid :
|
|
||||||
// SSTRecord sstrec = ( SSTRecord ) record;
|
|
||||||
//
|
|
||||||
// for (int k = 0; k < sstrec.getNumUniqueStrings(); k++)
|
|
||||||
// {
|
|
||||||
// workbook.addSSTString(new UnicodeString(sstrec.getString(k)));
|
|
||||||
// }
|
|
||||||
// break;
|
|
||||||
//
|
|
||||||
// case LabelSSTRecord.sid :
|
|
||||||
// LabelSSTRecord lrec = ( LabelSSTRecord ) record;
|
|
||||||
//
|
|
||||||
// row = cursheet.getRow(lrec.getRow());
|
|
||||||
// cell = row.createCell(lrec.getColumn(),
|
|
||||||
// HSSFCell.CELL_TYPE_STRING);
|
|
||||||
// cell.setCellValue(workbook.getSSTString(lrec.getSSTIndex()));
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public static void main(String [] args)
|
|
||||||
// {
|
|
||||||
// if ((args.length < 2) || !args[ 0 ].equals("--help"))
|
|
||||||
// {
|
|
||||||
// try
|
|
||||||
// {
|
|
||||||
// EFHSSF viewer = new EFHSSF();
|
|
||||||
//
|
|
||||||
// viewer.setInputFile(args[ 0 ]);
|
|
||||||
// viewer.setOutputFile(args[ 1 ]);
|
|
||||||
// viewer.run();
|
|
||||||
// }
|
|
||||||
// catch (IOException e)
|
|
||||||
// {
|
|
||||||
// e.printStackTrace();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
// {
|
|
||||||
// System.out.println("EFHSSF");
|
|
||||||
// System.out.println(
|
|
||||||
// "General testbed for HSSFEventFactory based testing and "
|
|
||||||
// + "Code examples");
|
|
||||||
// System.out.println("Usage: java org.apache.poi.hssf.dev.EFHSSF "
|
|
||||||
// + "file1 file2");
|
|
||||||
// System.out.println(
|
|
||||||
// " --will rewrite the file reading with the event api");
|
|
||||||
// System.out.println("and writing with the standard API");
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
//class EFHSSFListener
|
|
||||||
// implements HSSFListener
|
|
||||||
//{
|
|
||||||
// EFHSSF efhssf;
|
|
||||||
//
|
|
||||||
// public EFHSSFListener(EFHSSF efhssf)
|
|
||||||
// {
|
|
||||||
// this.efhssf = efhssf;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// public void processRecord(Record record)
|
|
||||||
// {
|
|
||||||
// efhssf.recordHandler(record);
|
|
||||||
// }
|
|
||||||
//}
|
|
@ -14,16 +14,23 @@
|
|||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
==================================================================== */
|
==================================================================== */
|
||||||
|
|
||||||
package org.apache.poi.hssf.model;
|
package org.apache.poi.hssf.model;
|
||||||
|
|
||||||
import org.apache.poi.hssf.record.*;
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.apache.poi.ddf.EscherOptRecord;
|
||||||
|
import org.apache.poi.ddf.EscherProperties;
|
||||||
|
import org.apache.poi.ddf.EscherProperty;
|
||||||
|
import org.apache.poi.ddf.EscherSimpleProperty;
|
||||||
|
import org.apache.poi.hssf.record.CommonObjectDataSubRecord;
|
||||||
|
import org.apache.poi.hssf.record.NoteRecord;
|
||||||
|
import org.apache.poi.hssf.record.NoteStructureSubRecord;
|
||||||
|
import org.apache.poi.hssf.record.ObjRecord;
|
||||||
|
import org.apache.poi.hssf.record.SubRecord;
|
||||||
import org.apache.poi.hssf.usermodel.HSSFComment;
|
import org.apache.poi.hssf.usermodel.HSSFComment;
|
||||||
import org.apache.poi.hssf.usermodel.HSSFShape;
|
import org.apache.poi.hssf.usermodel.HSSFShape;
|
||||||
import org.apache.poi.util.LittleEndian;
|
|
||||||
import org.apache.poi.ddf.*;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Iterator;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a cell comment.
|
* Represents a cell comment.
|
||||||
@ -32,9 +39,9 @@ import java.util.Iterator;
|
|||||||
*
|
*
|
||||||
* @author Yegor Kozlov
|
* @author Yegor Kozlov
|
||||||
*/
|
*/
|
||||||
public class CommentShape extends TextboxShape {
|
public final class CommentShape extends TextboxShape {
|
||||||
|
|
||||||
private NoteRecord note;
|
private NoteRecord _note;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates the low-level records for a comment.
|
* Creates the low-level records for a comment.
|
||||||
@ -46,10 +53,10 @@ public class CommentShape extends TextboxShape {
|
|||||||
{
|
{
|
||||||
super(hssfShape, shapeId);
|
super(hssfShape, shapeId);
|
||||||
|
|
||||||
note = createNoteRecord(hssfShape, shapeId);
|
_note = createNoteRecord(hssfShape, shapeId);
|
||||||
|
|
||||||
ObjRecord obj = getObjRecord();
|
ObjRecord obj = getObjRecord();
|
||||||
List records = obj.getSubRecords();
|
List<SubRecord> records = obj.getSubRecords();
|
||||||
int cmoIdx = 0;
|
int cmoIdx = 0;
|
||||||
for (int i = 0; i < records.size(); i++) {
|
for (int i = 0; i < records.size(); i++) {
|
||||||
Object r = records.get(i);
|
Object r = records.get(i);
|
||||||
@ -96,9 +103,9 @@ public class CommentShape extends TextboxShape {
|
|||||||
super.addStandardOptions(shape, opt);
|
super.addStandardOptions(shape, opt);
|
||||||
|
|
||||||
//remove unnecessary properties inherited from TextboxShape
|
//remove unnecessary properties inherited from TextboxShape
|
||||||
java.util.List props = opt.getEscherProperties();
|
List<EscherProperty> props = opt.getEscherProperties();
|
||||||
for ( Iterator iterator = props.iterator(); iterator.hasNext(); ) {
|
for (Iterator<EscherProperty> iterator = props.iterator(); iterator.hasNext(); ) {
|
||||||
EscherProperty prop = (EscherProperty) iterator.next();
|
EscherProperty prop = iterator.next();
|
||||||
switch (prop.getId()){
|
switch (prop.getId()){
|
||||||
case EscherProperties.TEXT__TEXTLEFT:
|
case EscherProperties.TEXT__TEXTLEFT:
|
||||||
case EscherProperties.TEXT__TEXTRIGHT:
|
case EscherProperties.TEXT__TEXTRIGHT:
|
||||||
@ -127,7 +134,6 @@ public class CommentShape extends TextboxShape {
|
|||||||
*/
|
*/
|
||||||
public NoteRecord getNoteRecord()
|
public NoteRecord getNoteRecord()
|
||||||
{
|
{
|
||||||
return note;
|
return _note;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -72,7 +72,6 @@ import org.apache.poi.hssf.record.StyleRecord;
|
|||||||
import org.apache.poi.hssf.record.SupBookRecord;
|
import org.apache.poi.hssf.record.SupBookRecord;
|
||||||
import org.apache.poi.hssf.record.TabIdRecord;
|
import org.apache.poi.hssf.record.TabIdRecord;
|
||||||
import org.apache.poi.hssf.record.UnicodeString;
|
import org.apache.poi.hssf.record.UnicodeString;
|
||||||
import org.apache.poi.hssf.record.UnknownRecord;
|
|
||||||
import org.apache.poi.hssf.record.UseSelFSRecord;
|
import org.apache.poi.hssf.record.UseSelFSRecord;
|
||||||
import org.apache.poi.hssf.record.WindowOneRecord;
|
import org.apache.poi.hssf.record.WindowOneRecord;
|
||||||
import org.apache.poi.hssf.record.WindowProtectRecord;
|
import org.apache.poi.hssf.record.WindowProtectRecord;
|
||||||
|
@ -22,7 +22,6 @@ import org.apache.poi.hssf.record.cf.BorderFormatting;
|
|||||||
import org.apache.poi.hssf.record.cf.FontFormatting;
|
import org.apache.poi.hssf.record.cf.FontFormatting;
|
||||||
import org.apache.poi.hssf.record.cf.PatternFormatting;
|
import org.apache.poi.hssf.record.cf.PatternFormatting;
|
||||||
import org.apache.poi.hssf.record.formula.Ptg;
|
import org.apache.poi.hssf.record.formula.Ptg;
|
||||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
||||||
import org.apache.poi.hssf.usermodel.HSSFSheet;
|
import org.apache.poi.hssf.usermodel.HSSFSheet;
|
||||||
import org.apache.poi.ss.formula.Formula;
|
import org.apache.poi.ss.formula.Formula;
|
||||||
import org.apache.poi.ss.formula.FormulaType;
|
import org.apache.poi.ss.formula.FormulaType;
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
package org.apache.poi.hssf.record;
|
package org.apache.poi.hssf.record;
|
||||||
|
|
||||||
import org.apache.poi.util.HexDump;
|
import org.apache.poi.util.HexDump;
|
||||||
import org.apache.poi.util.LittleEndian;
|
|
||||||
import org.apache.poi.util.LittleEndianOutput;
|
import org.apache.poi.util.LittleEndianOutput;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
|
|
||||||
package org.apache.poi.hssf.record;
|
package org.apache.poi.hssf.record;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.lang.reflect.Constructor;
|
import java.lang.reflect.Constructor;
|
||||||
import java.lang.reflect.InvocationTargetException;
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
@ -19,7 +19,6 @@ package org.apache.poi.hssf.record;
|
|||||||
|
|
||||||
import org.apache.poi.hssf.util.CellRangeAddress8Bit;
|
import org.apache.poi.hssf.util.CellRangeAddress8Bit;
|
||||||
import org.apache.poi.util.HexDump;
|
import org.apache.poi.util.HexDump;
|
||||||
import org.apache.poi.util.LittleEndian;
|
|
||||||
import org.apache.poi.util.LittleEndianOutput;
|
import org.apache.poi.util.LittleEndianOutput;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
|
|
||||||
package org.apache.poi.hssf.record;
|
package org.apache.poi.hssf.record;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
|
|
||||||
import org.apache.poi.hssf.record.formula.Area3DPtg;
|
import org.apache.poi.hssf.record.formula.Area3DPtg;
|
||||||
@ -26,7 +25,6 @@ import org.apache.poi.hssf.record.formula.Ptg;
|
|||||||
import org.apache.poi.hssf.record.formula.Ref3DPtg;
|
import org.apache.poi.hssf.record.formula.Ref3DPtg;
|
||||||
import org.apache.poi.hssf.record.formula.RefPtg;
|
import org.apache.poi.hssf.record.formula.RefPtg;
|
||||||
import org.apache.poi.util.HexDump;
|
import org.apache.poi.util.HexDump;
|
||||||
import org.apache.poi.util.LittleEndian;
|
|
||||||
import org.apache.poi.util.LittleEndianByteArrayInputStream;
|
import org.apache.poi.util.LittleEndianByteArrayInputStream;
|
||||||
import org.apache.poi.util.LittleEndianInput;
|
import org.apache.poi.util.LittleEndianInput;
|
||||||
import org.apache.poi.util.LittleEndianOutput;
|
import org.apache.poi.util.LittleEndianOutput;
|
||||||
@ -37,6 +35,7 @@ import org.apache.poi.util.LittleEndianOutputStream;
|
|||||||
*/
|
*/
|
||||||
public abstract class SubRecord {
|
public abstract class SubRecord {
|
||||||
protected SubRecord() {
|
protected SubRecord() {
|
||||||
|
// no fields to initialise
|
||||||
}
|
}
|
||||||
|
|
||||||
public static SubRecord createSubRecord(LittleEndianInput in) {
|
public static SubRecord createSubRecord(LittleEndianInput in) {
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
|
|
||||||
package org.apache.poi.hssf.record.formula;
|
package org.apache.poi.hssf.record.formula;
|
||||||
|
|
||||||
import org.apache.poi.hssf.record.UnicodeString;
|
|
||||||
import org.apache.poi.hssf.record.constant.ConstantValueParser;
|
import org.apache.poi.hssf.record.constant.ConstantValueParser;
|
||||||
import org.apache.poi.hssf.record.constant.ErrorConstant;
|
import org.apache.poi.hssf.record.constant.ErrorConstant;
|
||||||
import org.apache.poi.util.LittleEndianInput;
|
import org.apache.poi.util.LittleEndianInput;
|
||||||
|
@ -22,7 +22,6 @@ import org.apache.poi.util.BitField;
|
|||||||
import org.apache.poi.util.BitFieldFactory;
|
import org.apache.poi.util.BitFieldFactory;
|
||||||
import org.apache.poi.util.LittleEndianInput;
|
import org.apache.poi.util.LittleEndianInput;
|
||||||
import org.apache.poi.util.LittleEndianOutput;
|
import org.apache.poi.util.LittleEndianOutput;
|
||||||
import org.apache.poi.ss.SpreadsheetVersion;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ReferencePtgBase - handles references (such as A1, A2, IA4)
|
* ReferencePtgBase - handles references (such as A1, A2, IA4)
|
||||||
|
@ -19,7 +19,6 @@ package org.apache.poi.hssf.record.formula.atp;
|
|||||||
|
|
||||||
import org.apache.poi.hssf.record.formula.eval.BoolEval;
|
import org.apache.poi.hssf.record.formula.eval.BoolEval;
|
||||||
import org.apache.poi.hssf.record.formula.eval.ErrorEval;
|
import org.apache.poi.hssf.record.formula.eval.ErrorEval;
|
||||||
import org.apache.poi.hssf.record.formula.eval.ValueEval;
|
|
||||||
import org.apache.poi.hssf.record.formula.eval.EvaluationException;
|
import org.apache.poi.hssf.record.formula.eval.EvaluationException;
|
||||||
import org.apache.poi.hssf.record.formula.eval.OperandResolver;
|
import org.apache.poi.hssf.record.formula.eval.OperandResolver;
|
||||||
import org.apache.poi.hssf.record.formula.eval.ValueEval;
|
import org.apache.poi.hssf.record.formula.eval.ValueEval;
|
||||||
|
@ -22,15 +22,14 @@ import java.util.GregorianCalendar;
|
|||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import org.apache.poi.hssf.record.formula.eval.ErrorEval;
|
import org.apache.poi.hssf.record.formula.eval.ErrorEval;
|
||||||
import org.apache.poi.hssf.record.formula.eval.ValueEval;
|
|
||||||
import org.apache.poi.hssf.record.formula.eval.EvaluationException;
|
import org.apache.poi.hssf.record.formula.eval.EvaluationException;
|
||||||
import org.apache.poi.hssf.record.formula.eval.NumberEval;
|
import org.apache.poi.hssf.record.formula.eval.NumberEval;
|
||||||
import org.apache.poi.hssf.record.formula.eval.OperandResolver;
|
import org.apache.poi.hssf.record.formula.eval.OperandResolver;
|
||||||
import org.apache.poi.hssf.record.formula.eval.StringEval;
|
import org.apache.poi.hssf.record.formula.eval.StringEval;
|
||||||
import org.apache.poi.hssf.record.formula.eval.ValueEval;
|
import org.apache.poi.hssf.record.formula.eval.ValueEval;
|
||||||
import org.apache.poi.hssf.record.formula.functions.FreeRefFunction;
|
import org.apache.poi.hssf.record.formula.functions.FreeRefFunction;
|
||||||
import org.apache.poi.ss.usermodel.DateUtil;
|
|
||||||
import org.apache.poi.ss.formula.EvaluationWorkbook;
|
import org.apache.poi.ss.formula.EvaluationWorkbook;
|
||||||
|
import org.apache.poi.ss.usermodel.DateUtil;
|
||||||
/**
|
/**
|
||||||
* Implementation of Excel 'Analysis ToolPak' function YEARFRAC()<br/>
|
* Implementation of Excel 'Analysis ToolPak' function YEARFRAC()<br/>
|
||||||
*
|
*
|
||||||
|
@ -17,13 +17,8 @@
|
|||||||
|
|
||||||
package org.apache.poi.hssf.usermodel;
|
package org.apache.poi.hssf.usermodel;
|
||||||
|
|
||||||
import org.apache.poi.ddf.EscherRecord;
|
|
||||||
import org.apache.poi.ddf.EscherClientAnchorRecord;
|
|
||||||
import org.apache.poi.ddf.EscherChildAnchorRecord;
|
|
||||||
|
|
||||||
public class HSSFChildAnchor
|
public final class HSSFChildAnchor extends HSSFAnchor {
|
||||||
extends HSSFAnchor
|
|
||||||
{
|
|
||||||
public HSSFChildAnchor()
|
public HSSFChildAnchor()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -50,5 +45,4 @@ public class HSSFChildAnchor
|
|||||||
{
|
{
|
||||||
return dy1 > dy2;
|
return dy1 > dy2;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -14,10 +14,10 @@
|
|||||||
See the License for the specific language governing permissions and
|
See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
==================================================================== */
|
==================================================================== */
|
||||||
|
|
||||||
package org.apache.poi.hssf.usermodel;
|
package org.apache.poi.hssf.usermodel;
|
||||||
|
|
||||||
import org.apache.poi.ss.usermodel.CreationHelper;
|
import org.apache.poi.ss.usermodel.CreationHelper;
|
||||||
import org.apache.poi.ss.usermodel.Sheet;
|
|
||||||
|
|
||||||
public class HSSFCreationHelper implements CreationHelper {
|
public class HSSFCreationHelper implements CreationHelper {
|
||||||
private HSSFWorkbook workbook;
|
private HSSFWorkbook workbook;
|
||||||
@ -30,9 +30,6 @@ public class HSSFCreationHelper implements CreationHelper {
|
|||||||
dataFormat = new HSSFDataFormat(workbook.getWorkbook());
|
dataFormat = new HSSFDataFormat(workbook.getWorkbook());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a new HSSFRichTextString for you.
|
|
||||||
*/
|
|
||||||
public HSSFRichTextString createRichTextString(String text) {
|
public HSSFRichTextString createRichTextString(String text) {
|
||||||
return new HSSFRichTextString(text);
|
return new HSSFRichTextString(text);
|
||||||
}
|
}
|
||||||
@ -63,5 +60,4 @@ public class HSSFCreationHelper implements CreationHelper {
|
|||||||
public HSSFClientAnchor createClientAnchor(){
|
public HSSFClientAnchor createClientAnchor(){
|
||||||
return new HSSFClientAnchor();
|
return new HSSFClientAnchor();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -17,21 +17,11 @@
|
|||||||
|
|
||||||
package org.apache.poi.hssf.usermodel;
|
package org.apache.poi.hssf.usermodel;
|
||||||
|
|
||||||
import org.apache.poi.ss.usermodel.DataFormatter;
|
|
||||||
|
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.text.FieldPosition;
|
|
||||||
import java.text.Format;
|
import java.text.Format;
|
||||||
import java.text.ParsePosition;
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Date;
|
import org.apache.poi.ss.usermodel.DataFormatter;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.regex.Matcher;
|
|
||||||
import java.util.regex.Pattern;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* HSSFDataFormatter contains methods for formatting the value stored in an
|
* HSSFDataFormatter contains methods for formatting the value stored in an
|
||||||
@ -73,7 +63,6 @@ import java.util.regex.Pattern;
|
|||||||
* cell's data format string.
|
* cell's data format string.
|
||||||
*
|
*
|
||||||
* @author James May (james dot may at fmr dot com)
|
* @author James May (james dot may at fmr dot com)
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public final class HSSFDataFormatter extends DataFormatter {
|
public final class HSSFDataFormatter extends DataFormatter {
|
||||||
|
|
||||||
|
@ -19,9 +19,6 @@ package org.apache.poi.hssf.usermodel;
|
|||||||
|
|
||||||
import org.apache.poi.ss.usermodel.RichTextString;
|
import org.apache.poi.ss.usermodel.RichTextString;
|
||||||
|
|
||||||
import org.apache.poi.util.BitField;
|
|
||||||
import org.apache.poi.util.BitFieldFactory;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A textbox is a shape that may hold a rich text string.
|
* A textbox is a shape that may hold a rich text string.
|
||||||
*
|
*
|
||||||
|
@ -21,9 +21,7 @@ import java.io.FileInputStream;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
import org.apache.poi.poifs.filesystem.DirectoryEntry;
|
|
||||||
import org.apache.poi.poifs.filesystem.DirectoryNode;
|
import org.apache.poi.poifs.filesystem.DirectoryNode;
|
||||||
import org.apache.poi.poifs.filesystem.DocumentEntry;
|
|
||||||
import org.apache.poi.poifs.filesystem.DocumentNode;
|
import org.apache.poi.poifs.filesystem.DocumentNode;
|
||||||
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
|
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
|
||||||
|
|
||||||
@ -39,16 +37,14 @@ public class POIFSLister {
|
|||||||
* @param args the names of the files to be displayed
|
* @param args the names of the files to be displayed
|
||||||
*/
|
*/
|
||||||
public static void main(final String args[]) throws IOException {
|
public static void main(final String args[]) throws IOException {
|
||||||
if (args.length == 0)
|
if (args.length == 0) {
|
||||||
{
|
|
||||||
System.err.println("Must specify at least one file to view");
|
System.err.println("Must specify at least one file to view");
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean withSizes = false;
|
boolean withSizes = false;
|
||||||
for (int j = 0; j < args.length; j++) {
|
for (int j = 0; j < args.length; j++) {
|
||||||
if(args[j].equalsIgnoreCase("-size") ||
|
if (args[j].equalsIgnoreCase("-size") || args[j].equalsIgnoreCase("-sizes")) {
|
||||||
args[j].equalsIgnoreCase("-sizes")) {
|
|
||||||
withSizes = true;
|
withSizes = true;
|
||||||
} else {
|
} else {
|
||||||
viewFile(args[j], withSizes);
|
viewFile(args[j], withSizes);
|
||||||
@ -56,11 +52,8 @@ public class POIFSLister {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void viewFile(final String filename, boolean withSizes) throws IOException
|
public static void viewFile(final String filename, boolean withSizes) throws IOException {
|
||||||
{
|
POIFSFileSystem fs = new POIFSFileSystem(new FileInputStream(filename));
|
||||||
POIFSFileSystem fs = new POIFSFileSystem(
|
|
||||||
new FileInputStream(filename)
|
|
||||||
);
|
|
||||||
displayDirectory(fs.getRoot(), "", withSizes);
|
displayDirectory(fs.getRoot(), "", withSizes);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -83,10 +76,8 @@ public class POIFSLister {
|
|||||||
name = name.substring(1) + " <" + altname + ">";
|
name = name.substring(1) + " <" + altname + ">";
|
||||||
}
|
}
|
||||||
if (withSizes) {
|
if (withSizes) {
|
||||||
size = " [" +
|
size = " [" + doc.getSize() + " / 0x" + Integer.toHexString(doc.getSize())
|
||||||
doc.getSize() + " / 0x" +
|
+ "]";
|
||||||
Integer.toHexString(doc.getSize()) +
|
|
||||||
"]";
|
|
||||||
}
|
}
|
||||||
System.out.println(newIndent + name + size);
|
System.out.println(newIndent + name + size);
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
/* ====================================================================
|
/* ====================================================================
|
||||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
contributor license agreements. See the NOTICE file distributed with
|
contributor license agreements. See the NOTICE file distributed with
|
||||||
@ -16,43 +15,34 @@
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
==================================================================== */
|
==================================================================== */
|
||||||
|
|
||||||
|
|
||||||
package org.apache.poi.poifs.property;
|
package org.apache.poi.poifs.property;
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.*;
|
||||||
import org.apache.poi.poifs.storage.SmallDocumentBlock;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Directory property
|
* Directory property
|
||||||
*
|
*
|
||||||
* @author Marc Johnson (mjohnson at apache dot org)
|
* @author Marc Johnson (mjohnson at apache dot org)
|
||||||
*/
|
*/
|
||||||
|
public class DirectoryProperty extends Property implements Parent { // TODO - fix instantiable superclass
|
||||||
|
|
||||||
public class DirectoryProperty
|
/** List of Property instances */
|
||||||
extends Property
|
private List<Property> _children;
|
||||||
implements Parent
|
|
||||||
{
|
|
||||||
|
|
||||||
// List of Property instances
|
/** set of children's names */
|
||||||
private List _children;
|
private Set<String> _children_names;
|
||||||
|
|
||||||
// set of children's names
|
|
||||||
private Set _children_names;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default constructor
|
* Default constructor
|
||||||
*
|
*
|
||||||
* @param name the name of the directory
|
* @param name the name of the directory
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public DirectoryProperty(String name)
|
public DirectoryProperty(String name)
|
||||||
{
|
{
|
||||||
super();
|
super();
|
||||||
_children = new ArrayList();
|
_children = new ArrayList<Property>();
|
||||||
_children_names = new HashSet();
|
_children_names = new HashSet<String>();
|
||||||
setName(name);
|
setName(name);
|
||||||
setSize(0);
|
setSize(0);
|
||||||
setPropertyType(PropertyConstants.DIRECTORY_TYPE);
|
setPropertyType(PropertyConstants.DIRECTORY_TYPE);
|
||||||
@ -67,13 +57,12 @@ public class DirectoryProperty
|
|||||||
* @param array byte data
|
* @param array byte data
|
||||||
* @param offset offset into byte data
|
* @param offset offset into byte data
|
||||||
*/
|
*/
|
||||||
|
|
||||||
protected DirectoryProperty(final int index, final byte [] array,
|
protected DirectoryProperty(final int index, final byte [] array,
|
||||||
final int offset)
|
final int offset)
|
||||||
{
|
{
|
||||||
super(index, array, offset);
|
super(index, array, offset);
|
||||||
_children = new ArrayList();
|
_children = new ArrayList<Property>();
|
||||||
_children_names = new HashSet();
|
_children_names = new HashSet<String>();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -84,8 +73,7 @@ public class DirectoryProperty
|
|||||||
*
|
*
|
||||||
* @return true if the name change could be made, else false
|
* @return true if the name change could be made, else false
|
||||||
*/
|
*/
|
||||||
|
public boolean changeName(Property property, String newName)
|
||||||
public boolean changeName(final Property property, final String newName)
|
|
||||||
{
|
{
|
||||||
boolean result;
|
boolean result;
|
||||||
String oldName = property.getName();
|
String oldName = property.getName();
|
||||||
@ -116,8 +104,7 @@ public class DirectoryProperty
|
|||||||
*
|
*
|
||||||
* @return true if the Property could be deleted, else false
|
* @return true if the Property could be deleted, else false
|
||||||
*/
|
*/
|
||||||
|
public boolean deleteChild(Property property)
|
||||||
public boolean deleteChild(final Property property)
|
|
||||||
{
|
{
|
||||||
boolean result = _children.remove(property);
|
boolean result = _children.remove(property);
|
||||||
|
|
||||||
@ -128,9 +115,7 @@ public class DirectoryProperty
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class PropertyComparator
|
public static class PropertyComparator implements Comparator<Property> {
|
||||||
implements Comparator
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Object equality, implemented as object identity
|
* Object equality, implemented as object identity
|
||||||
@ -139,7 +124,6 @@ public class DirectoryProperty
|
|||||||
*
|
*
|
||||||
* @return true if identical, else false
|
* @return true if identical, else false
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public boolean equals(Object o)
|
public boolean equals(Object o)
|
||||||
{
|
{
|
||||||
return this == o;
|
return this == o;
|
||||||
@ -160,12 +144,11 @@ public class DirectoryProperty
|
|||||||
* zero if o1 == o2,
|
* zero if o1 == o2,
|
||||||
* positive value if o1 > o2.
|
* positive value if o1 > o2.
|
||||||
*/
|
*/
|
||||||
|
public int compare(Property o1, Property o2)
|
||||||
public int compare(Object o1, Object o2)
|
|
||||||
{
|
{
|
||||||
String VBA_PROJECT = "_VBA_PROJECT";
|
String VBA_PROJECT = "_VBA_PROJECT";
|
||||||
String name1 = (( Property ) o1).getName();
|
String name1 = o1.getName();
|
||||||
String name2 = (( Property ) o2).getName();
|
String name2 = o2.getName();
|
||||||
int result = name1.length() - name2.length();
|
int result = name1.length() - name2.length();
|
||||||
|
|
||||||
if (result == 0)
|
if (result == 0)
|
||||||
@ -200,14 +183,11 @@ public class DirectoryProperty
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
} // end private class PropertyComparator
|
}
|
||||||
|
|
||||||
/* ********** START extension of Property ********** */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return true if a directory type Property
|
* @return true if a directory type Property
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public boolean isDirectory()
|
public boolean isDirectory()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
@ -217,13 +197,11 @@ public class DirectoryProperty
|
|||||||
* Perform whatever activities need to be performed prior to
|
* Perform whatever activities need to be performed prior to
|
||||||
* writing
|
* writing
|
||||||
*/
|
*/
|
||||||
|
|
||||||
protected void preWrite()
|
protected void preWrite()
|
||||||
{
|
{
|
||||||
if (_children.size() > 0)
|
if (_children.size() > 0)
|
||||||
{
|
{
|
||||||
Property[] children =
|
Property[] children = _children.toArray(new Property[ 0 ]);
|
||||||
( Property [] ) _children.toArray(new Property[ 0 ]);
|
|
||||||
|
|
||||||
Arrays.sort(children, new PropertyComparator());
|
Arrays.sort(children, new PropertyComparator());
|
||||||
int midpoint = children.length / 2;
|
int midpoint = children.length / 2;
|
||||||
@ -259,17 +237,13 @@ public class DirectoryProperty
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ********** END extension of Property ********** */
|
|
||||||
/* ********** START implementation of Parent ********** */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get an iterator over the children of this Parent; all elements
|
* Get an iterator over the children of this Parent; all elements
|
||||||
* are instances of Property.
|
* are instances of Property.
|
||||||
*
|
*
|
||||||
* @return Iterator of children; may refer to an empty collection
|
* @return Iterator of children; may refer to an empty collection
|
||||||
*/
|
*/
|
||||||
|
public Iterator<Property> getChildren()
|
||||||
public Iterator getChildren()
|
|
||||||
{
|
{
|
||||||
return _children.iterator();
|
return _children.iterator();
|
||||||
}
|
}
|
||||||
@ -282,7 +256,6 @@ public class DirectoryProperty
|
|||||||
* @exception IOException if we already have a child with the same
|
* @exception IOException if we already have a child with the same
|
||||||
* name
|
* name
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public void addChild(final Property property)
|
public void addChild(final Property property)
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
@ -295,7 +268,4 @@ public class DirectoryProperty
|
|||||||
_children_names.add(name);
|
_children_names.add(name);
|
||||||
_children.add(property);
|
_children.add(property);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/* ********** END implementation of Parent ********** */
|
|
||||||
} // end public class DirectoryProperty
|
|
||||||
|
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
/* ====================================================================
|
/* ====================================================================
|
||||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
contributor license agreements. See the NOTICE file distributed with
|
contributor license agreements. See the NOTICE file distributed with
|
||||||
@ -16,19 +15,18 @@
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
==================================================================== */
|
==================================================================== */
|
||||||
|
|
||||||
|
|
||||||
package org.apache.poi.poifs.property;
|
package org.apache.poi.poifs.property;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.*;
|
import java.util.List;
|
||||||
|
import java.util.Stack;
|
||||||
|
|
||||||
import org.apache.poi.poifs.common.POIFSConstants;
|
import org.apache.poi.poifs.common.POIFSConstants;
|
||||||
import org.apache.poi.poifs.filesystem.BATManaged;
|
import org.apache.poi.poifs.filesystem.BATManaged;
|
||||||
import org.apache.poi.poifs.storage.BlockWritable;
|
import org.apache.poi.poifs.storage.BlockWritable;
|
||||||
import org.apache.poi.poifs.storage.PropertyBlock;
|
import org.apache.poi.poifs.storage.PropertyBlock;
|
||||||
import org.apache.poi.poifs.storage.RawDataBlock;
|
|
||||||
import org.apache.poi.poifs.storage.RawDataBlockList;
|
import org.apache.poi.poifs.storage.RawDataBlockList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -38,22 +36,15 @@ import org.apache.poi.poifs.storage.RawDataBlockList;
|
|||||||
*
|
*
|
||||||
* @author Marc Johnson (mjohnson at apache dot org)
|
* @author Marc Johnson (mjohnson at apache dot org)
|
||||||
*/
|
*/
|
||||||
|
public final class PropertyTable implements BATManaged, BlockWritable {
|
||||||
public class PropertyTable
|
|
||||||
implements BATManaged, BlockWritable
|
|
||||||
{
|
|
||||||
private int _start_block;
|
private int _start_block;
|
||||||
private List _properties;
|
private List<Property> _properties;
|
||||||
private BlockWritable[] _blocks;
|
private BlockWritable[] _blocks;
|
||||||
|
|
||||||
/**
|
|
||||||
* Default constructor
|
|
||||||
*/
|
|
||||||
|
|
||||||
public PropertyTable()
|
public PropertyTable()
|
||||||
{
|
{
|
||||||
_start_block = POIFSConstants.END_OF_CHAIN;
|
_start_block = POIFSConstants.END_OF_CHAIN;
|
||||||
_properties = new ArrayList();
|
_properties = new ArrayList<Property>();
|
||||||
addProperty(new RootProperty());
|
addProperty(new RootProperty());
|
||||||
_blocks = null;
|
_blocks = null;
|
||||||
}
|
}
|
||||||
@ -69,7 +60,6 @@ public class PropertyTable
|
|||||||
* @exception IOException if anything goes wrong (which should be
|
* @exception IOException if anything goes wrong (which should be
|
||||||
* a result of the input being NFG)
|
* a result of the input being NFG)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public PropertyTable(final int startBlock,
|
public PropertyTable(final int startBlock,
|
||||||
final RawDataBlockList blockList)
|
final RawDataBlockList blockList)
|
||||||
throws IOException
|
throws IOException
|
||||||
@ -87,8 +77,7 @@ public class PropertyTable
|
|||||||
*
|
*
|
||||||
* @param property the new Property to manage
|
* @param property the new Property to manage
|
||||||
*/
|
*/
|
||||||
|
public void addProperty(Property property)
|
||||||
public void addProperty(final Property property)
|
|
||||||
{
|
{
|
||||||
_properties.add(property);
|
_properties.add(property);
|
||||||
}
|
}
|
||||||
@ -98,7 +87,6 @@ public class PropertyTable
|
|||||||
*
|
*
|
||||||
* @param property the Property to be removed
|
* @param property the Property to be removed
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public void removeProperty(final Property property)
|
public void removeProperty(final Property property)
|
||||||
{
|
{
|
||||||
_properties.remove(property);
|
_properties.remove(property);
|
||||||
@ -109,7 +97,6 @@ public class PropertyTable
|
|||||||
*
|
*
|
||||||
* @return the root property
|
* @return the root property
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public RootProperty getRoot()
|
public RootProperty getRoot()
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -120,11 +107,9 @@ public class PropertyTable
|
|||||||
/**
|
/**
|
||||||
* Prepare to be written
|
* Prepare to be written
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public void preWrite()
|
public void preWrite()
|
||||||
{
|
{
|
||||||
Property[] properties =
|
Property[] properties = _properties.toArray(new Property[ 0 ]);
|
||||||
( Property [] ) _properties.toArray(new Property[ 0 ]);
|
|
||||||
|
|
||||||
// give each property its index
|
// give each property its index
|
||||||
for (int k = 0; k < properties.length; k++)
|
for (int k = 0; k < properties.length; k++)
|
||||||
@ -147,7 +132,6 @@ public class PropertyTable
|
|||||||
*
|
*
|
||||||
* @return start block index
|
* @return start block index
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public int getStartBlock()
|
public int getStartBlock()
|
||||||
{
|
{
|
||||||
return _start_block;
|
return _start_block;
|
||||||
@ -164,12 +148,12 @@ public class PropertyTable
|
|||||||
// property has no children
|
// property has no children
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Stack children = new Stack();
|
Stack<Property> children = new Stack<Property>();
|
||||||
|
|
||||||
children.push(_properties.get(index));
|
children.push(_properties.get(index));
|
||||||
while (!children.empty())
|
while (!children.empty())
|
||||||
{
|
{
|
||||||
Property property = ( Property ) children.pop();
|
Property property = children.pop();
|
||||||
|
|
||||||
root.addChild(property);
|
root.addChild(property);
|
||||||
if (property.isDirectory())
|
if (property.isDirectory())
|
||||||
@ -189,14 +173,11 @@ public class PropertyTable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ********** START implementation of BATManaged ********** */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the number of BigBlock's this instance uses
|
* Return the number of BigBlock's this instance uses
|
||||||
*
|
*
|
||||||
* @return count of BigBlock instances
|
* @return count of BigBlock instances
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public int countBlocks()
|
public int countBlocks()
|
||||||
{
|
{
|
||||||
return (_blocks == null) ? 0
|
return (_blocks == null) ? 0
|
||||||
@ -209,15 +190,11 @@ public class PropertyTable
|
|||||||
* @param index index into the array of BigBlock instances making
|
* @param index index into the array of BigBlock instances making
|
||||||
* up the the filesystem
|
* up the the filesystem
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public void setStartBlock(final int index)
|
public void setStartBlock(final int index)
|
||||||
{
|
{
|
||||||
_start_block = index;
|
_start_block = index;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ********** END implementation of BATManaged ********** */
|
|
||||||
/* ********** START implementation of BlockWritable ********** */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write the storage to an OutputStream
|
* Write the storage to an OutputStream
|
||||||
*
|
*
|
||||||
@ -227,7 +204,6 @@ public class PropertyTable
|
|||||||
* @exception IOException on problems writing to the specified
|
* @exception IOException on problems writing to the specified
|
||||||
* stream
|
* stream
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public void writeBlocks(final OutputStream stream)
|
public void writeBlocks(final OutputStream stream)
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
@ -239,7 +215,4 @@ public class PropertyTable
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/* ********** END implementation of BlockWritable ********** */
|
|
||||||
} // end public class PropertyTable
|
|
||||||
|
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
/* ====================================================================
|
/* ====================================================================
|
||||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
contributor license agreements. See the NOTICE file distributed with
|
contributor license agreements. See the NOTICE file distributed with
|
||||||
@ -16,13 +15,8 @@
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
==================================================================== */
|
==================================================================== */
|
||||||
|
|
||||||
|
|
||||||
package org.apache.poi.poifs.property;
|
package org.apache.poi.poifs.property;
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import org.apache.poi.poifs.common.POIFSConstants;
|
import org.apache.poi.poifs.common.POIFSConstants;
|
||||||
import org.apache.poi.poifs.storage.SmallDocumentBlock;
|
import org.apache.poi.poifs.storage.SmallDocumentBlock;
|
||||||
|
|
||||||
@ -31,14 +25,7 @@ import org.apache.poi.poifs.storage.SmallDocumentBlock;
|
|||||||
*
|
*
|
||||||
* @author Marc Johnson (mjohnson at apache dot org)
|
* @author Marc Johnson (mjohnson at apache dot org)
|
||||||
*/
|
*/
|
||||||
|
public final class RootProperty extends DirectoryProperty {
|
||||||
public class RootProperty
|
|
||||||
extends DirectoryProperty
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Default constructor
|
|
||||||
*/
|
|
||||||
|
|
||||||
RootProperty()
|
RootProperty()
|
||||||
{
|
{
|
||||||
@ -57,7 +44,6 @@ public class RootProperty
|
|||||||
* @param array byte data
|
* @param array byte data
|
||||||
* @param offset offset into byte data
|
* @param offset offset into byte data
|
||||||
*/
|
*/
|
||||||
|
|
||||||
protected RootProperty(final int index, final byte [] array,
|
protected RootProperty(final int index, final byte [] array,
|
||||||
final int offset)
|
final int offset)
|
||||||
{
|
{
|
||||||
@ -69,10 +55,8 @@ public class RootProperty
|
|||||||
*
|
*
|
||||||
* @param size size in terms of small blocks
|
* @param size size in terms of small blocks
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public void setSize(int size)
|
public void setSize(int size)
|
||||||
{
|
{
|
||||||
super.setSize(SmallDocumentBlock.calcSize(size));
|
super.setSize(SmallDocumentBlock.calcSize(size));
|
||||||
}
|
}
|
||||||
} // end public class RootProperty
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
/* ====================================================================
|
/* ====================================================================
|
||||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
contributor license agreements. See the NOTICE file distributed with
|
contributor license agreements. See the NOTICE file distributed with
|
||||||
@ -16,7 +15,6 @@
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
==================================================================== */
|
==================================================================== */
|
||||||
|
|
||||||
|
|
||||||
package org.apache.poi.poifs.storage;
|
package org.apache.poi.poifs.storage;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -26,7 +24,6 @@ import java.util.Arrays;
|
|||||||
|
|
||||||
import org.apache.poi.poifs.common.POIFSConstants;
|
import org.apache.poi.poifs.common.POIFSConstants;
|
||||||
import org.apache.poi.util.IntegerField;
|
import org.apache.poi.util.IntegerField;
|
||||||
import org.apache.poi.util.LittleEndian;
|
|
||||||
import org.apache.poi.util.LittleEndianConsts;
|
import org.apache.poi.util.LittleEndianConsts;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -35,10 +32,7 @@ import org.apache.poi.util.LittleEndianConsts;
|
|||||||
*
|
*
|
||||||
* @author Marc Johnson (mjohnson at apache dot org)
|
* @author Marc Johnson (mjohnson at apache dot org)
|
||||||
*/
|
*/
|
||||||
|
public final class BATBlock extends BigBlock {
|
||||||
public class BATBlock
|
|
||||||
extends BigBlock
|
|
||||||
{
|
|
||||||
private static final int _entries_per_block =
|
private static final int _entries_per_block =
|
||||||
POIFSConstants.BIG_BLOCK_SIZE / LittleEndianConsts.INT_SIZE;
|
POIFSConstants.BIG_BLOCK_SIZE / LittleEndianConsts.INT_SIZE;
|
||||||
private static final int _entries_per_xbat_block = _entries_per_block
|
private static final int _entries_per_xbat_block = _entries_per_block
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
/* ====================================================================
|
/* ====================================================================
|
||||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
contributor license agreements. See the NOTICE file distributed with
|
contributor license agreements. See the NOTICE file distributed with
|
||||||
@ -16,7 +15,6 @@
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
==================================================================== */
|
==================================================================== */
|
||||||
|
|
||||||
|
|
||||||
package org.apache.poi.poifs.storage;
|
package org.apache.poi.poifs.storage;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -43,9 +41,7 @@ import org.apache.poi.util.LittleEndianConsts;
|
|||||||
*
|
*
|
||||||
* @author Marc Johnson (mjohnson at apache dot org)
|
* @author Marc Johnson (mjohnson at apache dot org)
|
||||||
*/
|
*/
|
||||||
|
public final class BlockAllocationTableReader {
|
||||||
public class BlockAllocationTableReader
|
|
||||||
{
|
|
||||||
private IntList _entries;
|
private IntList _entries;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -154,12 +150,6 @@ public class BlockAllocationTableReader
|
|||||||
setEntries(blocks, raw_block_list);
|
setEntries(blocks, raw_block_list);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor BlockAllocationTableReader
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
BlockAllocationTableReader()
|
BlockAllocationTableReader()
|
||||||
{
|
{
|
||||||
_entries = new IntList();
|
_entries = new IntList();
|
||||||
@ -177,13 +167,12 @@ public class BlockAllocationTableReader
|
|||||||
*
|
*
|
||||||
* @exception IOException if there is a problem acquiring the blocks
|
* @exception IOException if there is a problem acquiring the blocks
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ListManagedBlock [] fetchBlocks(final int startBlock,
|
ListManagedBlock [] fetchBlocks(final int startBlock,
|
||||||
final int headerPropertiesStartBlock,
|
final int headerPropertiesStartBlock,
|
||||||
final BlockList blockList)
|
final BlockList blockList)
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
List blocks = new ArrayList();
|
List<ListManagedBlock> blocks = new ArrayList<ListManagedBlock>();
|
||||||
int currentBlock = startBlock;
|
int currentBlock = startBlock;
|
||||||
boolean firstPass = true;
|
boolean firstPass = true;
|
||||||
ListManagedBlock dataBlock = null;
|
ListManagedBlock dataBlock = null;
|
||||||
@ -217,8 +206,7 @@ public class BlockAllocationTableReader
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return ( ListManagedBlock [] ) blocks
|
return blocks.toArray(new ListManagedBlock[blocks.size()]);
|
||||||
.toArray(new ListManagedBlock[ blocks.size() ]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// methods for debugging reader
|
// methods for debugging reader
|
||||||
@ -230,7 +218,6 @@ public class BlockAllocationTableReader
|
|||||||
*
|
*
|
||||||
* @return true if the specific block is used, else false
|
* @return true if the specific block is used, else false
|
||||||
*/
|
*/
|
||||||
|
|
||||||
boolean isUsed(final int index)
|
boolean isUsed(final int index)
|
||||||
{
|
{
|
||||||
boolean rval = false;
|
boolean rval = false;
|
||||||
@ -238,9 +225,8 @@ public class BlockAllocationTableReader
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
rval = _entries.get(index) != -1;
|
rval = _entries.get(index) != -1;
|
||||||
}
|
} catch (IndexOutOfBoundsException e) {
|
||||||
catch (IndexOutOfBoundsException ignored)
|
// ignored
|
||||||
{
|
|
||||||
}
|
}
|
||||||
return rval;
|
return rval;
|
||||||
}
|
}
|
||||||
@ -256,7 +242,6 @@ public class BlockAllocationTableReader
|
|||||||
*
|
*
|
||||||
* @exception IOException if the current block is unused
|
* @exception IOException if the current block is unused
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int getNextBlockIndex(final int index)
|
int getNextBlockIndex(final int index)
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
@ -264,11 +249,8 @@ public class BlockAllocationTableReader
|
|||||||
{
|
{
|
||||||
return _entries.get(index);
|
return _entries.get(index);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
throw new IOException("index " + index + " is unused");
|
throw new IOException("index " + index + " is unused");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert an array of blocks into a set of integer indices
|
* Convert an array of blocks into a set of integer indices
|
||||||
@ -276,10 +258,7 @@ public class BlockAllocationTableReader
|
|||||||
* @param blocks the array of blocks containing the indices
|
* @param blocks the array of blocks containing the indices
|
||||||
* @param raw_blocks the list of blocks being managed. Unused
|
* @param raw_blocks the list of blocks being managed. Unused
|
||||||
* blocks will be eliminated from the list
|
* blocks will be eliminated from the list
|
||||||
*
|
|
||||||
* @exception IOException
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private void setEntries(final ListManagedBlock [] blocks,
|
private void setEntries(final ListManagedBlock [] blocks,
|
||||||
final BlockList raw_blocks)
|
final BlockList raw_blocks)
|
||||||
throws IOException
|
throws IOException
|
||||||
@ -308,5 +287,4 @@ public class BlockAllocationTableReader
|
|||||||
}
|
}
|
||||||
raw_blocks.setBAT(this);
|
raw_blocks.setBAT(this);
|
||||||
}
|
}
|
||||||
} // end class BlockAllocationTableReader
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
/* ====================================================================
|
/* ====================================================================
|
||||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
contributor license agreements. See the NOTICE file distributed with
|
contributor license agreements. See the NOTICE file distributed with
|
||||||
@ -16,19 +15,14 @@
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
==================================================================== */
|
==================================================================== */
|
||||||
|
|
||||||
|
|
||||||
package org.apache.poi.poifs.storage;
|
package org.apache.poi.poifs.storage;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
import org.apache.poi.poifs.common.POIFSConstants;
|
import org.apache.poi.poifs.common.POIFSConstants;
|
||||||
import org.apache.poi.poifs.filesystem.BATManaged;
|
import org.apache.poi.poifs.filesystem.BATManaged;
|
||||||
import org.apache.poi.util.IntList;
|
import org.apache.poi.util.IntList;
|
||||||
import org.apache.poi.util.LittleEndian;
|
|
||||||
import org.apache.poi.util.LittleEndianConsts;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class manages and creates the Block Allocation Table, which is
|
* This class manages and creates the Block Allocation Table, which is
|
||||||
@ -45,10 +39,7 @@ import org.apache.poi.util.LittleEndianConsts;
|
|||||||
*
|
*
|
||||||
* @author Marc Johnson (mjohnson at apache dot org)
|
* @author Marc Johnson (mjohnson at apache dot org)
|
||||||
*/
|
*/
|
||||||
|
public final class BlockAllocationTableWriter implements BlockWritable, BATManaged {
|
||||||
public class BlockAllocationTableWriter
|
|
||||||
implements BlockWritable, BATManaged
|
|
||||||
{
|
|
||||||
private IntList _entries;
|
private IntList _entries;
|
||||||
private BATBlock[] _blocks;
|
private BATBlock[] _blocks;
|
||||||
private int _start_block;
|
private int _start_block;
|
||||||
@ -56,7 +47,6 @@ public class BlockAllocationTableWriter
|
|||||||
/**
|
/**
|
||||||
* create a BlockAllocationTableWriter
|
* create a BlockAllocationTableWriter
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public BlockAllocationTableWriter()
|
public BlockAllocationTableWriter()
|
||||||
{
|
{
|
||||||
_start_block = POIFSConstants.END_OF_CHAIN;
|
_start_block = POIFSConstants.END_OF_CHAIN;
|
||||||
@ -69,7 +59,6 @@ public class BlockAllocationTableWriter
|
|||||||
*
|
*
|
||||||
* @return start block index of BAT blocks
|
* @return start block index of BAT blocks
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public int createBlocks()
|
public int createBlocks()
|
||||||
{
|
{
|
||||||
int xbat_blocks = 0;
|
int xbat_blocks = 0;
|
||||||
@ -92,12 +81,9 @@ public class BlockAllocationTableWriter
|
|||||||
// stable ... we're OK
|
// stable ... we're OK
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
bat_blocks = calculated_bat_blocks;
|
bat_blocks = calculated_bat_blocks;
|
||||||
xbat_blocks = calculated_xbat_blocks;
|
xbat_blocks = calculated_xbat_blocks;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
int startBlock = allocateSpace(bat_blocks);
|
int startBlock = allocateSpace(bat_blocks);
|
||||||
|
|
||||||
allocateSpace(xbat_blocks);
|
allocateSpace(xbat_blocks);
|
||||||
@ -112,7 +98,6 @@ public class BlockAllocationTableWriter
|
|||||||
*
|
*
|
||||||
* @return the starting index of the blocks
|
* @return the starting index of the blocks
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public int allocateSpace(final int blockCount)
|
public int allocateSpace(final int blockCount)
|
||||||
{
|
{
|
||||||
int startBlock = _entries.size();
|
int startBlock = _entries.size();
|
||||||
@ -136,7 +121,6 @@ public class BlockAllocationTableWriter
|
|||||||
*
|
*
|
||||||
* @return the starting block index
|
* @return the starting block index
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public int getStartBlock()
|
public int getStartBlock()
|
||||||
{
|
{
|
||||||
return _start_block;
|
return _start_block;
|
||||||
@ -145,14 +129,11 @@ public class BlockAllocationTableWriter
|
|||||||
/**
|
/**
|
||||||
* create the BATBlocks
|
* create the BATBlocks
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void simpleCreateBlocks()
|
void simpleCreateBlocks()
|
||||||
{
|
{
|
||||||
_blocks = BATBlock.createBATBlocks(_entries.toArray());
|
_blocks = BATBlock.createBATBlocks(_entries.toArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ********** START implementation of BlockWritable ********** */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write the storage to an OutputStream
|
* Write the storage to an OutputStream
|
||||||
*
|
*
|
||||||
@ -162,7 +143,6 @@ public class BlockAllocationTableWriter
|
|||||||
* @exception IOException on problems writing to the specified
|
* @exception IOException on problems writing to the specified
|
||||||
* stream
|
* stream
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public void writeBlocks(final OutputStream stream)
|
public void writeBlocks(final OutputStream stream)
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
@ -172,15 +152,11 @@ public class BlockAllocationTableWriter
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ********** END implementation of BlockWritable ********** */
|
|
||||||
/* ********** START implementation of BATManaged ********** */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the number of BigBlock's this instance uses
|
* Return the number of BigBlock's this instance uses
|
||||||
*
|
*
|
||||||
* @return count of BigBlock instances
|
* @return count of BigBlock instances
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public int countBlocks()
|
public int countBlocks()
|
||||||
{
|
{
|
||||||
return _blocks.length;
|
return _blocks.length;
|
||||||
@ -188,15 +164,9 @@ public class BlockAllocationTableWriter
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the start block for this instance
|
* Set the start block for this instance
|
||||||
*
|
|
||||||
* @param start_block
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public void setStartBlock(int start_block)
|
public void setStartBlock(int start_block)
|
||||||
{
|
{
|
||||||
_start_block = start_block;
|
_start_block = start_block;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/* ********** END implementation of BATManaged ********** */
|
|
||||||
} // end class BlockAllocationTableWriter
|
|
||||||
|
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
/* ====================================================================
|
/* ====================================================================
|
||||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
contributor license agreements. See the NOTICE file distributed with
|
contributor license agreements. See the NOTICE file distributed with
|
||||||
@ -16,29 +15,19 @@
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
==================================================================== */
|
==================================================================== */
|
||||||
|
|
||||||
|
|
||||||
package org.apache.poi.poifs.storage;
|
package org.apache.poi.poifs.storage;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.IOException;
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A simple implementation of BlockList
|
* A simple implementation of BlockList
|
||||||
*
|
*
|
||||||
* @author Marc Johnson (mjohnson at apache dot org
|
* @author Marc Johnson (mjohnson at apache dot org
|
||||||
*/
|
*/
|
||||||
|
abstract class BlockListImpl implements BlockList {
|
||||||
class BlockListImpl
|
|
||||||
implements BlockList
|
|
||||||
{
|
|
||||||
private ListManagedBlock[] _blocks;
|
private ListManagedBlock[] _blocks;
|
||||||
private BlockAllocationTableReader _bat;
|
private BlockAllocationTableReader _bat;
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor BlockListImpl
|
|
||||||
*/
|
|
||||||
|
|
||||||
protected BlockListImpl()
|
protected BlockListImpl()
|
||||||
{
|
{
|
||||||
_blocks = new ListManagedBlock[ 0 ];
|
_blocks = new ListManagedBlock[ 0 ];
|
||||||
@ -50,21 +39,17 @@ class BlockListImpl
|
|||||||
*
|
*
|
||||||
* @param blocks blocks to be managed
|
* @param blocks blocks to be managed
|
||||||
*/
|
*/
|
||||||
|
|
||||||
protected void setBlocks(final ListManagedBlock [] blocks)
|
protected void setBlocks(final ListManagedBlock [] blocks)
|
||||||
{
|
{
|
||||||
_blocks = blocks;
|
_blocks = blocks;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ********** START implementation of BlockList ********** */
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* remove the specified block from the list
|
* remove the specified block from the list
|
||||||
*
|
*
|
||||||
* @param index the index of the specified block; if the index is
|
* @param index the index of the specified block; if the index is
|
||||||
* out of range, that's ok
|
* out of range, that's ok
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public void zap(final int index)
|
public void zap(final int index)
|
||||||
{
|
{
|
||||||
if ((index >= 0) && (index < _blocks.length))
|
if ((index >= 0) && (index < _blocks.length))
|
||||||
@ -77,7 +62,7 @@ class BlockListImpl
|
|||||||
* Unit testing method. Gets, without sanity checks or
|
* Unit testing method. Gets, without sanity checks or
|
||||||
* removing.
|
* removing.
|
||||||
*/
|
*/
|
||||||
protected ListManagedBlock get(final int index) throws IOException {
|
protected ListManagedBlock get(final int index) {
|
||||||
return _blocks[index];
|
return _blocks[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,7 +76,6 @@ class BlockListImpl
|
|||||||
* @exception IOException if the index is out of range or has
|
* @exception IOException if the index is out of range or has
|
||||||
* already been removed
|
* already been removed
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public ListManagedBlock remove(final int index)
|
public ListManagedBlock remove(final int index)
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
@ -128,7 +112,6 @@ class BlockListImpl
|
|||||||
*
|
*
|
||||||
* @exception IOException if blocks are missing
|
* @exception IOException if blocks are missing
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public ListManagedBlock [] fetchBlocks(final int startBlock, final int headerPropertiesStartBlock)
|
public ListManagedBlock [] fetchBlocks(final int startBlock, final int headerPropertiesStartBlock)
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
@ -144,10 +127,7 @@ class BlockListImpl
|
|||||||
* set the associated BlockAllocationTable
|
* set the associated BlockAllocationTable
|
||||||
*
|
*
|
||||||
* @param bat the associated BlockAllocationTable
|
* @param bat the associated BlockAllocationTable
|
||||||
*
|
|
||||||
* @exception IOException
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public void setBAT(final BlockAllocationTableReader bat)
|
public void setBAT(final BlockAllocationTableReader bat)
|
||||||
throws IOException
|
throws IOException
|
||||||
{
|
{
|
||||||
@ -158,7 +138,4 @@ class BlockListImpl
|
|||||||
}
|
}
|
||||||
_bat = bat;
|
_bat = bat;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
/* ********** END implementation of BlockList ********** */
|
|
||||||
} // end package-scope class BlockListImpl
|
|
||||||
|
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
/* ====================================================================
|
/* ====================================================================
|
||||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
contributor license agreements. See the NOTICE file distributed with
|
contributor license agreements. See the NOTICE file distributed with
|
||||||
@ -16,22 +15,16 @@
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
==================================================================== */
|
==================================================================== */
|
||||||
|
|
||||||
|
|
||||||
package org.apache.poi.poifs.storage;
|
package org.apache.poi.poifs.storage;
|
||||||
|
|
||||||
import org.apache.poi.poifs.common.POIFSConstants;
|
import org.apache.poi.poifs.common.POIFSConstants;
|
||||||
import org.apache.poi.util.IntegerField;
|
|
||||||
import org.apache.poi.util.LittleEndian;
|
|
||||||
import org.apache.poi.util.LittleEndianConsts;
|
import org.apache.poi.util.LittleEndianConsts;
|
||||||
import org.apache.poi.util.LongField;
|
|
||||||
import org.apache.poi.util.ShortField;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constants used in reading/writing the Header block
|
* Constants used in reading/writing the Header block
|
||||||
*
|
*
|
||||||
* @author Marc Johnson (mjohnson at apache dot org)
|
* @author Marc Johnson (mjohnson at apache dot org)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public interface HeaderBlockConstants
|
public interface HeaderBlockConstants
|
||||||
{
|
{
|
||||||
public static final long _signature = 0xE11AB1A1E011CFD0L;
|
public static final long _signature = 0xE11AB1A1E011CFD0L;
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
/* ====================================================================
|
/* ====================================================================
|
||||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
contributor license agreements. See the NOTICE file distributed with
|
contributor license agreements. See the NOTICE file distributed with
|
||||||
@ -16,28 +15,21 @@
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
==================================================================== */
|
==================================================================== */
|
||||||
|
|
||||||
|
|
||||||
package org.apache.poi.poifs.storage;
|
package org.apache.poi.poifs.storage;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.IOException;
|
||||||
|
import java.io.OutputStream;
|
||||||
import java.util.*;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.poi.poifs.common.POIFSConstants;
|
import org.apache.poi.poifs.common.POIFSConstants;
|
||||||
import org.apache.poi.poifs.property.Property;
|
import org.apache.poi.poifs.property.Property;
|
||||||
import org.apache.poi.util.IntegerField;
|
|
||||||
import org.apache.poi.util.LittleEndian;
|
|
||||||
import org.apache.poi.util.LittleEndianConsts;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A block of Property instances
|
* A block of Property instances
|
||||||
*
|
*
|
||||||
* @author Marc Johnson (mjohnson at apache dot org)
|
* @author Marc Johnson (mjohnson at apache dot org)
|
||||||
*/
|
*/
|
||||||
|
public final class PropertyBlock extends BigBlock {
|
||||||
public class PropertyBlock
|
|
||||||
extends BigBlock
|
|
||||||
{
|
|
||||||
private static final int _properties_per_block =
|
private static final int _properties_per_block =
|
||||||
POIFSConstants.BIG_BLOCK_SIZE / POIFSConstants.PROPERTY_SIZE;
|
POIFSConstants.BIG_BLOCK_SIZE / POIFSConstants.PROPERTY_SIZE;
|
||||||
private Property[] _properties;
|
private Property[] _properties;
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
/* ====================================================================
|
/* ====================================================================
|
||||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
contributor license agreements. See the NOTICE file distributed with
|
contributor license agreements. See the NOTICE file distributed with
|
||||||
@ -16,24 +15,19 @@
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
==================================================================== */
|
==================================================================== */
|
||||||
|
|
||||||
|
|
||||||
package org.apache.poi.poifs.storage;
|
package org.apache.poi.poifs.storage;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
import org.apache.poi.poifs.property.RootProperty;
|
import org.apache.poi.poifs.property.RootProperty;
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
import java.io.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class implements reading the small document block list from an
|
* This class implements reading the small document block list from an
|
||||||
* existing file
|
* existing file
|
||||||
*
|
*
|
||||||
* @author Marc Johnson (mjohnson at apache dot org)
|
* @author Marc Johnson (mjohnson at apache dot org)
|
||||||
*/
|
*/
|
||||||
|
public final class SmallBlockTableReader {
|
||||||
public class SmallBlockTableReader
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* fetch the small document block list from an existing file
|
* fetch the small document block list from an existing file
|
||||||
@ -48,7 +42,6 @@ public class SmallBlockTableReader
|
|||||||
*
|
*
|
||||||
* @exception IOException
|
* @exception IOException
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public static BlockList getSmallDocumentBlocks(
|
public static BlockList getSmallDocumentBlocks(
|
||||||
final RawDataBlockList blockList, final RootProperty root,
|
final RawDataBlockList blockList, final RootProperty root,
|
||||||
final int sbatStart)
|
final int sbatStart)
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
/* ====================================================================
|
/* ====================================================================
|
||||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
contributor license agreements. See the NOTICE file distributed with
|
contributor license agreements. See the NOTICE file distributed with
|
||||||
@ -16,11 +15,8 @@
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
==================================================================== */
|
==================================================================== */
|
||||||
|
|
||||||
|
|
||||||
package org.apache.poi.util;
|
package org.apache.poi.util;
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A List of int's; as full an implementation of the java.util.List
|
* A List of int's; as full an implementation of the java.util.List
|
||||||
* interface as possible, with an eye toward minimal creation of
|
* interface as possible, with an eye toward minimal creation of
|
||||||
@ -47,7 +43,6 @@ import java.util.*;
|
|||||||
*
|
*
|
||||||
* @author Marc Johnson
|
* @author Marc Johnson
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class IntList
|
public class IntList
|
||||||
{
|
{
|
||||||
private int[] _array;
|
private int[] _array;
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
/* ====================================================================
|
/* ====================================================================
|
||||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
contributor license agreements. See the NOTICE file distributed with
|
contributor license agreements. See the NOTICE file distributed with
|
||||||
@ -16,11 +15,8 @@
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
==================================================================== */
|
==================================================================== */
|
||||||
|
|
||||||
|
|
||||||
package org.apache.poi.util;
|
package org.apache.poi.util;
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A logger class that strives to make it as easy as possible for
|
* A logger class that strives to make it as easy as possible for
|
||||||
* developers to write log calls, while simultaneously making those
|
* developers to write log calls, while simultaneously making those
|
||||||
@ -31,7 +27,6 @@ import java.util.*;
|
|||||||
* @author Glen Stampoultzis (glens at apache.org)
|
* @author Glen Stampoultzis (glens at apache.org)
|
||||||
* @author Nicola Ken Barozzi (nicolaken at apache.org)
|
* @author Nicola Ken Barozzi (nicolaken at apache.org)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class NullLogger extends POILogger
|
public class NullLogger extends POILogger
|
||||||
{
|
{
|
||||||
public void initialize(final String cat)
|
public void initialize(final String cat)
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
/* ====================================================================
|
/* ====================================================================
|
||||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
contributor license agreements. See the NOTICE file distributed with
|
contributor license agreements. See the NOTICE file distributed with
|
||||||
@ -16,11 +15,8 @@
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
==================================================================== */
|
==================================================================== */
|
||||||
|
|
||||||
|
|
||||||
package org.apache.poi.util;
|
package org.apache.poi.util;
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A List of short's; as full an implementation of the java.util.List
|
* A List of short's; as full an implementation of the java.util.List
|
||||||
* interface as possible, with an eye toward minimal creation of
|
* interface as possible, with an eye toward minimal creation of
|
||||||
|
@ -22,7 +22,6 @@ import java.util.*;
|
|||||||
import org.apache.poi.poifs.common.POIFSConstants;
|
import org.apache.poi.poifs.common.POIFSConstants;
|
||||||
import org.apache.poi.util.IOUtils;
|
import org.apache.poi.util.IOUtils;
|
||||||
import org.apache.poi.util.PackageHelper;
|
import org.apache.poi.util.PackageHelper;
|
||||||
import org.apache.xmlbeans.XmlException;
|
|
||||||
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
||||||
import org.apache.poi.openxml4j.exceptions.OpenXML4JException;
|
import org.apache.poi.openxml4j.exceptions.OpenXML4JException;
|
||||||
import org.apache.poi.openxml4j.opc.*;
|
import org.apache.poi.openxml4j.opc.*;
|
||||||
|
@ -26,7 +26,6 @@ import java.util.Map.Entry;
|
|||||||
import org.apache.poi.ss.usermodel.FontFamily;
|
import org.apache.poi.ss.usermodel.FontFamily;
|
||||||
import org.apache.poi.ss.usermodel.FontScheme;
|
import org.apache.poi.ss.usermodel.FontScheme;
|
||||||
import org.apache.poi.ss.usermodel.BuiltinFormats;
|
import org.apache.poi.ss.usermodel.BuiltinFormats;
|
||||||
import org.apache.poi.ss.usermodel.Font;
|
|
||||||
import org.apache.poi.xssf.usermodel.XSSFCellStyle;
|
import org.apache.poi.xssf.usermodel.XSSFCellStyle;
|
||||||
import org.apache.poi.xssf.usermodel.XSSFFont;
|
import org.apache.poi.xssf.usermodel.XSSFFont;
|
||||||
import org.apache.poi.xssf.usermodel.extensions.XSSFCellBorder;
|
import org.apache.poi.xssf.usermodel.extensions.XSSFCellBorder;
|
||||||
@ -483,5 +482,4 @@ public class StylesTable extends POIXMLDocumentPart {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -17,12 +17,10 @@
|
|||||||
package org.apache.poi.xssf.usermodel;
|
package org.apache.poi.xssf.usermodel;
|
||||||
|
|
||||||
import org.apache.poi.ss.usermodel.CreationHelper;
|
import org.apache.poi.ss.usermodel.CreationHelper;
|
||||||
import org.apache.poi.ss.usermodel.DataFormat;
|
|
||||||
import org.apache.poi.ss.usermodel.Hyperlink;
|
|
||||||
import org.apache.poi.ss.usermodel.RichTextString;
|
|
||||||
|
|
||||||
public class XSSFCreationHelper implements CreationHelper {
|
public class XSSFCreationHelper implements CreationHelper {
|
||||||
private XSSFWorkbook workbook;
|
private XSSFWorkbook workbook;
|
||||||
|
|
||||||
XSSFCreationHelper(XSSFWorkbook wb) {
|
XSSFCreationHelper(XSSFWorkbook wb) {
|
||||||
workbook = wb;
|
workbook = wb;
|
||||||
}
|
}
|
||||||
@ -54,7 +52,8 @@ public class XSSFCreationHelper implements CreationHelper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a XSSFClientAnchor. Use this object to position drawing object in a sheet
|
* Creates a XSSFClientAnchor. Use this object to position drawing object in
|
||||||
|
* a sheet
|
||||||
*
|
*
|
||||||
* @return a XSSFClientAnchor instance
|
* @return a XSSFClientAnchor instance
|
||||||
* @see org.apache.poi.ss.usermodel.Drawing
|
* @see org.apache.poi.ss.usermodel.Drawing
|
||||||
|
@ -53,7 +53,6 @@ import org.apache.poi.xssf.model.CalculationChain;
|
|||||||
import org.apache.poi.xssf.model.SharedStringsTable;
|
import org.apache.poi.xssf.model.SharedStringsTable;
|
||||||
import org.apache.poi.xssf.model.StylesTable;
|
import org.apache.poi.xssf.model.StylesTable;
|
||||||
import org.apache.poi.xssf.model.MapInfo;
|
import org.apache.poi.xssf.model.MapInfo;
|
||||||
import org.apache.poi.xssf.extractor.XSSFExportToXml;
|
|
||||||
import org.apache.xmlbeans.XmlException;
|
import org.apache.xmlbeans.XmlException;
|
||||||
import org.apache.xmlbeans.XmlObject;
|
import org.apache.xmlbeans.XmlObject;
|
||||||
import org.apache.xmlbeans.XmlOptions;
|
import org.apache.xmlbeans.XmlOptions;
|
||||||
|
@ -18,71 +18,103 @@
|
|||||||
package org.apache.poi.xssf.usermodel.extensions;
|
package org.apache.poi.xssf.usermodel.extensions;
|
||||||
|
|
||||||
import org.apache.poi.ss.usermodel.HeaderFooter;
|
import org.apache.poi.ss.usermodel.HeaderFooter;
|
||||||
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
|
||||||
import org.apache.poi.xssf.usermodel.helpers.HeaderFooterHelper;
|
import org.apache.poi.xssf.usermodel.helpers.HeaderFooterHelper;
|
||||||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTHeaderFooter;
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTHeaderFooter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parent class of all XSSF headers and footers.
|
* Parent class of all XSSF headers and footers.
|
||||||
*
|
*
|
||||||
* For a list of all the different fields that can be
|
* For a list of all the different fields that can be placed into a header or
|
||||||
* placed into a header or footer, such as page number,
|
* footer, such as page number, bold, underline etc, see the follow formatting
|
||||||
* bold, underline etc, see the follow formatting syntax
|
* syntax
|
||||||
*
|
*
|
||||||
*<b> Header/Footer Formatting Syntax</b>
|
*<b> Header/Footer Formatting Syntax</b>
|
||||||
*<p>
|
*<p>
|
||||||
* There are a number of formatting codes that can be written inline with the actual header / footer text, which
|
* There are a number of formatting codes that can be written inline with the
|
||||||
* affect the formatting in the header or footer.
|
* actual header / footer text, which affect the formatting in the header or
|
||||||
|
* footer.
|
||||||
*</p>
|
*</p>
|
||||||
*
|
*
|
||||||
* This example shows the text "Center Bold Header" on the first line (center section), and the date on the second
|
* This example shows the text "Center Bold Header" on the first line (center
|
||||||
* line (center section).
|
* section), and the date on the second line (center section). &CCenter
|
||||||
* &CCenter &"-,Bold"Bold &"-,Regular"Header_x000A_&D
|
* &"-,Bold"Bold &"-,Regular"Header_x000A_&D
|
||||||
*
|
*
|
||||||
* <b>General Rules:</b>
|
* <b>General Rules:</b> There is no required order in which these codes must
|
||||||
* There is no required order in which these codes must appear.
|
* appear. The first occurrence of the following codes turns the formatting ON,
|
||||||
* The first occurrence of the following codes turns the formatting ON, the second occurrence turns it OFF again:
|
* the second occurrence turns it OFF again:
|
||||||
*
|
*
|
||||||
* <dl>
|
* <dl>
|
||||||
* <dt> &L </dt> <dd>code for "left section" (there are three header / footer locations, "left", "center", and "right"). When
|
* <dt>&L</dt>
|
||||||
* two or more occurrences of this section marker exist, the contents from all markers are concatenated, in the
|
* <dd>code for "left section" (there are three header / footer locations,
|
||||||
* order of appearance, and placed into the left section.</dd>
|
* "left", "center", and "right"). When two or more occurrences of this section
|
||||||
* <dt> &P </dt> <dd> code for "current page #"</dd>
|
* marker exist, the contents from all markers are concatenated, in the order of
|
||||||
* <dt> &N </dt> <dd> code for "total pages"</dd>
|
* appearance, and placed into the left section.</dd>
|
||||||
* <dt>&font size </dt> <dd> code for "text font size", where font size is a font size in points.</dd>
|
* <dt>&P</dt>
|
||||||
* <dt> &K </dt> <dd> code for "text font color"
|
* <dd>code for "current page #"</dd>
|
||||||
* RGB Color is specified as RRGGBB
|
* <dt>&N</dt>
|
||||||
* Theme Color is specifed as TTSNN where TT is the theme color Id, S is either "+" or "-" of the tint/shade
|
* <dd>code for "total pages"</dd>
|
||||||
* value, NN is the tint/shade value.</dd>
|
* <dt>&font size</dt>
|
||||||
* <dt> &S </dt> <dd> code for "text strikethrough" on / off</dd>
|
* <dd>code for "text font size", where font size is a font size in points.</dd>
|
||||||
* <dt> &X </dt> <dd> code for "text super script" on / off</dd>
|
* <dt>&K</dt>
|
||||||
* <dt> &Y </dt> <dd> code for "text subscript" on / off</dd>
|
* <dd>code for "text font color" RGB Color is specified as RRGGBB Theme Color
|
||||||
* <dt> &C </dt> <dd> code for "center section". When two or more occurrences of this section marker exist, the contents
|
* is specifed as TTSNN where TT is the theme color Id, S is either "+" or "-"
|
||||||
* from all markers are concatenated, in the order of appearance, and placed into the center section.
|
* of the tint/shade value, NN is the tint/shade value.</dd>
|
||||||
* SpreadsheetML Reference Material - Worksheets 1966</dd>
|
* <dt>&S</dt>
|
||||||
* <dt> &D </dt> <dd> code for "date"</dd>
|
* <dd>code for "text strikethrough" on / off</dd>
|
||||||
* <dt> &T </dt> <dd> code for "time"</dd>
|
* <dt>&X</dt>
|
||||||
* <dt> &G </dt> <dd> code for "picture as background"</dd>
|
* <dd>code for "text super script" on / off</dd>
|
||||||
* <dt> &U </dt> <dd> code for "text single underline"</dd>
|
* <dt>&Y</dt>
|
||||||
* <dt> &E </dt> <dd> code for "double underline"</dd>
|
* <dd>code for "text subscript" on / off</dd>
|
||||||
* <dt> &R </dt> <dd> code for "right section". When two or more occurrences of this section marker exist, the contents
|
* <dt>&C</dt>
|
||||||
* from all markers are concatenated, in the order of appearance, and placed into the right section.</dd>
|
* <dd>code for "center section". When two or more occurrences of this section
|
||||||
* <dt> &Z </dt> <dd> code for "this workbook's file path"</dd>
|
* marker exist, the contents from all markers are concatenated, in the order of
|
||||||
* <dt> &F </dt> <dd> code for "this workbook's file name"</dd>
|
* appearance, and placed into the center section. SpreadsheetML Reference
|
||||||
* <dt> &A </dt> <dd> code for "sheet tab name"</dd>
|
* Material - Worksheets 1966</dd>
|
||||||
* <dt> &+ </dt> <dd> code for add to page #.</dd>
|
* <dt>&D</dt>
|
||||||
* <dt> &- </dt> <dd> code for subtract from page #.</dd>
|
* <dd>code for "date"</dd>
|
||||||
* <dt> &"font name,font type" - code for "text font name" and "text font type", where font name and font type
|
* <dt>&T</dt>
|
||||||
* are strings specifying the name and type of the font, separated by a comma. When a hyphen appears in font
|
* <dd>code for "time"</dd>
|
||||||
* name, it means "none specified". Both of font name and font type can be localized values.</dd>
|
* <dt>&G</dt>
|
||||||
* <dt> &"-,Bold" </dt> <dd> code for "bold font style"</dd>
|
* <dd>code for "picture as background"</dd>
|
||||||
* <dt> &B </dt> <dd> also means "bold font style"</dd>
|
* <dt>&U</dt>
|
||||||
* <dt> &"-,Regular" </dt> <dd> code for "regular font style"</dd>
|
* <dd>code for "text single underline"</dd>
|
||||||
* <dt> &"-,Italic" </dt> <dd> code for "italic font style"</dd>
|
* <dt>&E</dt>
|
||||||
* <dt> &I </dt> <dd> also means "italic font style"</dd>
|
* <dd>code for "double underline"</dd>
|
||||||
* <dt> &"-,Bold Italic" </dt> <dd> code for "bold italic font style"</dd>
|
* <dt>&R</dt>
|
||||||
* <dt> &O </dt> <dd> code for "outline style"</dd>
|
* <dd>code for "right section". When two or more occurrences of this section
|
||||||
* <dt> &H </dt> <dd> code for "shadow style"</dd>
|
* marker exist, the contents from all markers are concatenated, in the order of
|
||||||
|
* appearance, and placed into the right section.</dd>
|
||||||
|
* <dt>&Z</dt>
|
||||||
|
* <dd>code for "this workbook's file path"</dd>
|
||||||
|
* <dt>&F</dt>
|
||||||
|
* <dd>code for "this workbook's file name"</dd>
|
||||||
|
* <dt>&A</dt>
|
||||||
|
* <dd>code for "sheet tab name"</dd>
|
||||||
|
* <dt>&+</dt>
|
||||||
|
* <dd>code for add to page #.</dd>
|
||||||
|
* <dt>&-</dt>
|
||||||
|
* <dd>code for subtract from page #.</dd>
|
||||||
|
* <dt>&"font name,font type" - code for "text font name" and "text font type",
|
||||||
|
* where font name and font type are strings specifying the name and type of the
|
||||||
|
* font, separated by a comma. When a hyphen appears in font name, it means
|
||||||
|
* "none specified". Both of font name and font type can be localized
|
||||||
|
* values.</dd>
|
||||||
|
* <dt>&"-,Bold"</dt>
|
||||||
|
* <dd>code for "bold font style"</dd>
|
||||||
|
* <dt>&B</dt>
|
||||||
|
* <dd>also means "bold font style"</dd>
|
||||||
|
* <dt>&"-,Regular"</dt>
|
||||||
|
* <dd>code for "regular font style"</dd>
|
||||||
|
* <dt>&"-,Italic"</dt>
|
||||||
|
* <dd>code for "italic font style"</dd>
|
||||||
|
* <dt>&I</dt>
|
||||||
|
* <dd>also means "italic font style"</dd>
|
||||||
|
* <dt>&"-,Bold Italic"</dt>
|
||||||
|
* <dd>code for "bold italic font style"</dd>
|
||||||
|
* <dt>&O</dt>
|
||||||
|
* <dd>code for "outline style"</dd>
|
||||||
|
* <dt>&H</dt>
|
||||||
|
* <dd>code for "shadow style"</dd>
|
||||||
* </dl>
|
* </dl>
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
@ -95,6 +127,7 @@ public abstract class XSSFHeaderFooter implements HeaderFooter {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an instance of XSSFHeaderFooter from the supplied XML bean
|
* Create an instance of XSSFHeaderFooter from the supplied XML bean
|
||||||
|
*
|
||||||
* @param headerFooter
|
* @param headerFooter
|
||||||
*/
|
*/
|
||||||
public XSSFHeaderFooter(CTHeaderFooter headerFooter) {
|
public XSSFHeaderFooter(CTHeaderFooter headerFooter) {
|
||||||
@ -118,19 +151,18 @@ public abstract class XSSFHeaderFooter implements HeaderFooter {
|
|||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Are fields currently being stripped from
|
* Are fields currently being stripped from the text that this
|
||||||
* the text that this {@link XSSFHeaderFooter} returns?
|
* {@link XSSFHeaderFooter} returns? Default is false, but can be changed
|
||||||
* Default is false, but can be changed
|
|
||||||
*/
|
*/
|
||||||
public boolean areFieldsStripped() {
|
public boolean areFieldsStripped() {
|
||||||
return stripFields;
|
return stripFields;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Should fields (eg macros) be stripped from
|
* Should fields (eg macros) be stripped from the text that this class
|
||||||
* the text that this class returns?
|
* returns? Default is not to strip.
|
||||||
* Default is not to strip.
|
*
|
||||||
* @param stripFields
|
* @param stripFields
|
||||||
*/
|
*/
|
||||||
public void setAreFieldsStripped(boolean stripFields) {
|
public void setAreFieldsStripped(boolean stripFields) {
|
||||||
@ -138,17 +170,14 @@ public abstract class XSSFHeaderFooter implements HeaderFooter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes any fields (eg macros, page markers etc)
|
* Removes any fields (eg macros, page markers etc) from the string.
|
||||||
* from the string.
|
* Normally used to make some text suitable for showing to humans, and the
|
||||||
* Normally used to make some text suitable for showing
|
* resultant text should not normally be saved back into the document!
|
||||||
* to humans, and the resultant text should not normally
|
|
||||||
* be saved back into the document!
|
|
||||||
*/
|
*/
|
||||||
public static String stripFields(String text) {
|
public static String stripFields(String text) {
|
||||||
return org.apache.poi.hssf.usermodel.HeaderFooter.stripFields(text);
|
return org.apache.poi.hssf.usermodel.HeaderFooter.stripFields(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public abstract String getText();
|
public abstract String getText();
|
||||||
|
|
||||||
protected abstract void setText(String text);
|
protected abstract void setText(String text);
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
|
|
||||||
package org.apache.poi.openxml4j.opc;
|
package org.apache.poi.openxml4j.opc;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
@ -37,8 +36,6 @@ import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
|
|||||||
import org.apache.poi.openxml4j.opc.internal.ContentTypeManager;
|
import org.apache.poi.openxml4j.opc.internal.ContentTypeManager;
|
||||||
import org.apache.poi.openxml4j.opc.internal.FileHelper;
|
import org.apache.poi.openxml4j.opc.internal.FileHelper;
|
||||||
import org.apache.poi.util.TempFile;
|
import org.apache.poi.util.TempFile;
|
||||||
import org.apache.poi.util.IOUtils;
|
|
||||||
import org.apache.poi.util.POILogger;
|
|
||||||
import org.dom4j.Document;
|
import org.dom4j.Document;
|
||||||
import org.dom4j.DocumentHelper;
|
import org.dom4j.DocumentHelper;
|
||||||
import org.dom4j.Element;
|
import org.dom4j.Element;
|
||||||
|
@ -24,7 +24,6 @@ import junit.framework.TestCase;
|
|||||||
|
|
||||||
import org.apache.poi.ss.usermodel.Cell;
|
import org.apache.poi.ss.usermodel.Cell;
|
||||||
import org.apache.poi.ss.usermodel.CellStyle;
|
import org.apache.poi.ss.usermodel.CellStyle;
|
||||||
import org.apache.poi.ss.usermodel.PictureData;
|
|
||||||
import org.apache.poi.ss.usermodel.Row;
|
import org.apache.poi.ss.usermodel.Row;
|
||||||
import org.apache.poi.ss.usermodel.Sheet;
|
import org.apache.poi.ss.usermodel.Sheet;
|
||||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||||
@ -35,8 +34,8 @@ public class TestLoadSaveXSSF extends TestCase {
|
|||||||
|
|
||||||
String filename;
|
String filename;
|
||||||
|
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() {
|
||||||
super.setUp();
|
|
||||||
System.setProperty("org.apache.poi.util.POILogger", org.apache.poi.util.CommonsLogger.class.getName());
|
System.setProperty("org.apache.poi.util.POILogger", org.apache.poi.util.CommonsLogger.class.getName());
|
||||||
filename = System.getProperty("XSSF.testdata.path");
|
filename = System.getProperty("XSSF.testdata.path");
|
||||||
if (filename == null) {
|
if (filename == null) {
|
||||||
@ -52,12 +51,12 @@ public class TestLoadSaveXSSF extends TestCase {
|
|||||||
Row row = sheet.getRow(0);
|
Row row = sheet.getRow(0);
|
||||||
Cell cell = row.getCell((short) 1);
|
Cell cell = row.getCell((short) 1);
|
||||||
assertNotNull(cell);
|
assertNotNull(cell);
|
||||||
assertEquals(111.0, cell.getNumericCellValue());
|
assertEquals(111.0, cell.getNumericCellValue(), 0.0);
|
||||||
cell = row.getCell((short) 0);
|
cell = row.getCell((short) 0);
|
||||||
assertEquals("Lorem", cell.getRichStringCellValue().getString());
|
assertEquals("Lorem", cell.getRichStringCellValue().getString());
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO filename string hard coded in XSSFWorkbook constructor in order to make ant test-ooxml target be successfull.
|
// TODO filename string hard coded in XSSFWorkbook constructor in order to make ant test-ooxml target be successful.
|
||||||
public void testLoadStyles() throws Exception {
|
public void testLoadStyles() throws Exception {
|
||||||
XSSFWorkbook workbook = new XSSFWorkbook(new File(filename, "styles.xlsx").getAbsolutePath());
|
XSSFWorkbook workbook = new XSSFWorkbook(new File(filename, "styles.xlsx").getAbsolutePath());
|
||||||
Sheet sheet = workbook.getSheetAt(0);
|
Sheet sheet = workbook.getSheetAt(0);
|
||||||
@ -67,11 +66,10 @@ public class TestLoadSaveXSSF extends TestCase {
|
|||||||
// assertNotNull(style);
|
// assertNotNull(style);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO filename string hard coded in XSSFWorkbook constructor in order to make ant test-ooxml target be successfull.
|
// TODO filename string hard coded in XSSFWorkbook constructor in order to make ant test-ooxml target be successful.
|
||||||
public void testLoadPictures() throws Exception {
|
public void testLoadPictures() throws Exception {
|
||||||
XSSFWorkbook workbook = new XSSFWorkbook(new File(filename, "picture.xlsx").getAbsolutePath());
|
XSSFWorkbook workbook = new XSSFWorkbook(new File(filename, "picture.xlsx").getAbsolutePath());
|
||||||
List<XSSFPictureData> pictures = workbook.getAllPictures();
|
List<XSSFPictureData> pictures = workbook.getAllPictures();
|
||||||
assertEquals(1, pictures.size());
|
assertEquals(1, pictures.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -17,21 +17,17 @@
|
|||||||
|
|
||||||
package org.apache.poi.xssf.usermodel;
|
package org.apache.poi.xssf.usermodel;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
import org.apache.poi.POIXMLDocumentPart;
|
||||||
|
|
||||||
import org.apache.poi.openxml4j.opc.OPCPackage;
|
|
||||||
import org.apache.poi.openxml4j.opc.OPCPackage;
|
import org.apache.poi.openxml4j.opc.OPCPackage;
|
||||||
import org.apache.poi.openxml4j.opc.PackagePart;
|
import org.apache.poi.openxml4j.opc.PackagePart;
|
||||||
import org.apache.poi.openxml4j.opc.PackagingURIHelper;
|
import org.apache.poi.openxml4j.opc.PackagingURIHelper;
|
||||||
import org.apache.poi.xssf.XSSFTestDataSamples;
|
|
||||||
import org.apache.poi.xssf.XSSFITestDataProvider;
|
|
||||||
import org.apache.poi.ss.usermodel.BaseTestBugzillaIssues;
|
import org.apache.poi.ss.usermodel.BaseTestBugzillaIssues;
|
||||||
import org.apache.poi.POIXMLDocumentPart;
|
import org.apache.poi.xssf.XSSFITestDataProvider;
|
||||||
|
import org.apache.poi.xssf.XSSFTestDataSamples;
|
||||||
|
|
||||||
public class TestXSSFBugs extends BaseTestBugzillaIssues {
|
public final class TestXSSFBugs extends BaseTestBugzillaIssues {
|
||||||
@Override
|
@Override
|
||||||
protected XSSFITestDataProvider getTestDataProvider(){
|
protected XSSFITestDataProvider getTestDataProvider(){
|
||||||
return XSSFITestDataProvider.getInstance();
|
return XSSFITestDataProvider.getInstance();
|
||||||
|
@ -17,22 +17,9 @@
|
|||||||
|
|
||||||
package org.apache.poi.xssf.usermodel;
|
package org.apache.poi.xssf.usermodel;
|
||||||
|
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
|
||||||
|
|
||||||
import org.apache.poi.hssf.usermodel.HSSFCell;
|
|
||||||
import org.apache.poi.hssf.usermodel.HSSFRichTextString;
|
|
||||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
||||||
import org.apache.poi.ss.usermodel.*;
|
|
||||||
import org.apache.poi.ss.ITestDataProvider;
|
import org.apache.poi.ss.ITestDataProvider;
|
||||||
import org.apache.poi.xssf.XSSFTestDataSamples;
|
import org.apache.poi.ss.usermodel.BaseTestDataFormat;
|
||||||
import org.apache.poi.xssf.XSSFITestDataProvider;
|
import org.apache.poi.xssf.XSSFITestDataProvider;
|
||||||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCell;
|
|
||||||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorksheet;
|
|
||||||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.STCellType;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests for {@link XSSFDataFormat}
|
* Tests for {@link XSSFDataFormat}
|
||||||
|
@ -17,12 +17,8 @@
|
|||||||
|
|
||||||
package org.apache.poi.xssf.usermodel;
|
package org.apache.poi.xssf.usermodel;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
|
||||||
|
|
||||||
import org.apache.poi.ss.usermodel.*;
|
import org.apache.poi.ss.usermodel.*;
|
||||||
import org.apache.poi.xssf.XSSFTestDataSamples;
|
|
||||||
import org.apache.poi.xssf.XSSFITestDataProvider;
|
import org.apache.poi.xssf.XSSFITestDataProvider;
|
||||||
import org.apache.poi.xssf.usermodel.XSSFColor;
|
|
||||||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBooleanProperty;
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTBooleanProperty;
|
||||||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTColor;
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTColor;
|
||||||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTFont;
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTFont;
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
|
|
||||||
package org.apache.poi.xssf.usermodel;
|
package org.apache.poi.xssf.usermodel;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
|
||||||
import org.apache.poi.xssf.XSSFTestDataSamples;
|
import org.apache.poi.xssf.XSSFTestDataSamples;
|
||||||
import org.apache.poi.xssf.XSSFITestDataProvider;
|
import org.apache.poi.xssf.XSSFITestDataProvider;
|
||||||
import org.apache.poi.ss.usermodel.BaseTestNamedRange;
|
import org.apache.poi.ss.usermodel.BaseTestNamedRange;
|
||||||
@ -37,7 +36,7 @@ public final class TestXSSFName extends BaseTestNamedRange {
|
|||||||
// First test that setting RR&C for same sheet more than once only creates a
|
// First test that setting RR&C for same sheet more than once only creates a
|
||||||
// single Print_Titles built-in record
|
// single Print_Titles built-in record
|
||||||
XSSFWorkbook wb = getTestDataProvider().createWorkbook();
|
XSSFWorkbook wb = getTestDataProvider().createWorkbook();
|
||||||
XSSFSheet sheet = wb.createSheet("First Sheet");
|
wb.createSheet("First Sheet");
|
||||||
|
|
||||||
wb.setRepeatingRowsAndColumns(0, -1, -1, -1, -1);
|
wb.setRepeatingRowsAndColumns(0, -1, -1, -1, -1);
|
||||||
|
|
||||||
@ -77,7 +76,7 @@ public final class TestXSSFName extends BaseTestNamedRange {
|
|||||||
|
|
||||||
// check that setting RR&C on a second sheet causes a new Print_Titles built-in
|
// check that setting RR&C on a second sheet causes a new Print_Titles built-in
|
||||||
// name to be created
|
// name to be created
|
||||||
sheet = nwb.createSheet("SecondSheet");
|
nwb.createSheet("SecondSheet");
|
||||||
nwb.setRepeatingRowsAndColumns(1, 1, 2, 0, 0);
|
nwb.setRepeatingRowsAndColumns(1, 1, 2, 0, 0);
|
||||||
|
|
||||||
assertEquals(2, nwb.getNumberOfNames());
|
assertEquals(2, nwb.getNumberOfNames());
|
||||||
@ -88,6 +87,4 @@ public final class TestXSSFName extends BaseTestNamedRange {
|
|||||||
|
|
||||||
nwb.setRepeatingRowsAndColumns(1, -1, -1, -1, -1);
|
nwb.setRepeatingRowsAndColumns(1, -1, -1, -1, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
|
|
||||||
package org.apache.poi.xssf.usermodel;
|
package org.apache.poi.xssf.usermodel;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
|
||||||
import org.apache.poi.ss.usermodel.ClientAnchor;
|
import org.apache.poi.ss.usermodel.ClientAnchor;
|
||||||
import org.apache.poi.ss.usermodel.BaseTestPicture;
|
import org.apache.poi.ss.usermodel.BaseTestPicture;
|
||||||
import org.apache.poi.xssf.XSSFITestDataProvider;
|
import org.apache.poi.xssf.XSSFITestDataProvider;
|
||||||
|
@ -17,14 +17,12 @@
|
|||||||
|
|
||||||
package org.apache.poi.xssf.usermodel;
|
package org.apache.poi.xssf.usermodel;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
|
||||||
import org.apache.poi.xssf.XSSFTestDataSamples;
|
|
||||||
import org.apache.poi.POIXMLDocumentPart;
|
|
||||||
import org.openxmlformats.schemas.drawingml.x2006.spreadsheetDrawing.CTDrawing;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.io.IOException;
|
import java.util.List;
|
||||||
|
|
||||||
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
|
import org.apache.poi.xssf.XSSFTestDataSamples;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Yegor Kozlov
|
* @author Yegor Kozlov
|
||||||
|
@ -187,13 +187,13 @@ public class TestXSSFPrintSetup extends TestCase {
|
|||||||
pMargins.setHeader(1.5);
|
pMargins.setHeader(1.5);
|
||||||
pMargins.setFooter(2);
|
pMargins.setFooter(2);
|
||||||
XSSFPrintSetup printSetup = new XSSFPrintSetup(worksheet);
|
XSSFPrintSetup printSetup = new XSSFPrintSetup(worksheet);
|
||||||
assertEquals(1.5, printSetup.getHeaderMargin());
|
assertEquals(1.5, printSetup.getHeaderMargin(), 0.0);
|
||||||
assertEquals(2.0, printSetup.getFooterMargin());
|
assertEquals(2.0, printSetup.getFooterMargin(), 0.0);
|
||||||
|
|
||||||
printSetup.setHeaderMargin(5);
|
printSetup.setHeaderMargin(5);
|
||||||
printSetup.setFooterMargin(3.5);
|
printSetup.setFooterMargin(3.5);
|
||||||
assertEquals(5.0, pMargins.getHeader());
|
assertEquals(5.0, pMargins.getHeader(), 0.0);
|
||||||
assertEquals(3.5, pMargins.getFooter());
|
assertEquals(3.5, pMargins.getFooter(), 0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testSetGetCopies() {
|
public void testSetGetCopies() {
|
||||||
|
@ -17,23 +17,9 @@
|
|||||||
|
|
||||||
package org.apache.poi.xssf.usermodel;
|
package org.apache.poi.xssf.usermodel;
|
||||||
|
|
||||||
import java.io.*;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
import org.apache.poi.ss.usermodel.Cell;
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTRst;
|
||||||
import org.apache.poi.ss.usermodel.CellStyle;
|
|
||||||
import org.apache.poi.ss.usermodel.Comment;
|
|
||||||
import org.apache.poi.ss.usermodel.CreationHelper;
|
|
||||||
import org.apache.poi.ss.usermodel.Row;
|
|
||||||
import org.apache.poi.ss.usermodel.Sheet;
|
|
||||||
import org.apache.poi.ss.usermodel.Workbook;
|
|
||||||
import org.apache.poi.xssf.model.CommentsTable;
|
|
||||||
import org.apache.xmlbeans.XmlOptions;
|
|
||||||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests functionality of the XSSFRichTextRun object
|
* Tests functionality of the XSSFRichTextRun object
|
||||||
@ -42,7 +28,7 @@ import org.openxmlformats.schemas.spreadsheetml.x2006.main.*;
|
|||||||
*/
|
*/
|
||||||
public final class TestXSSFRichTextString extends TestCase {
|
public final class TestXSSFRichTextString extends TestCase {
|
||||||
|
|
||||||
public void testCreate() throws Exception {
|
public void testCreate() {
|
||||||
|
|
||||||
XSSFRichTextString rt = new XSSFRichTextString("Apache POI");
|
XSSFRichTextString rt = new XSSFRichTextString("Apache POI");
|
||||||
assertEquals("Apache POI", rt.getString());
|
assertEquals("Apache POI", rt.getString());
|
||||||
@ -59,7 +45,7 @@ public final class TestXSSFRichTextString extends TestCase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void testApplyFont() throws Exception {
|
public void testApplyFont() {
|
||||||
|
|
||||||
XSSFRichTextString rt = new XSSFRichTextString();
|
XSSFRichTextString rt = new XSSFRichTextString();
|
||||||
rt.append("123");
|
rt.append("123");
|
||||||
@ -85,7 +71,7 @@ public final class TestXSSFRichTextString extends TestCase {
|
|||||||
assertEquals(1, rt.getLengthOfFormattingRun(3));
|
assertEquals(1, rt.getLengthOfFormattingRun(3));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testClearFormatting() throws Exception {
|
public void testClearFormatting() {
|
||||||
|
|
||||||
XSSFRichTextString rt = new XSSFRichTextString("Apache POI");
|
XSSFRichTextString rt = new XSSFRichTextString("Apache POI");
|
||||||
assertEquals("Apache POI", rt.getString());
|
assertEquals("Apache POI", rt.getString());
|
||||||
@ -105,10 +91,9 @@ public final class TestXSSFRichTextString extends TestCase {
|
|||||||
rt.clearFormatting();
|
rt.clearFormatting();
|
||||||
assertEquals("Apache POI", rt.getString());
|
assertEquals("Apache POI", rt.getString());
|
||||||
assertEquals(0, rt.numFormattingRuns());
|
assertEquals(0, rt.numFormattingRuns());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testGetFonts() throws Exception {
|
public void testGetFonts() {
|
||||||
|
|
||||||
XSSFRichTextString rt = new XSSFRichTextString();
|
XSSFRichTextString rt = new XSSFRichTextString();
|
||||||
|
|
||||||
@ -129,6 +114,5 @@ public final class TestXSSFRichTextString extends TestCase {
|
|||||||
XSSFFont font2$ = rt.getFontOfFormattingRun(1);
|
XSSFFont font2$ = rt.getFontOfFormattingRun(1);
|
||||||
assertEquals(font2.getBold(), font2$.getBold());
|
assertEquals(font2.getBold(), font2$.getBold());
|
||||||
assertEquals(font2.getFontName(), font2$.getFontName());
|
assertEquals(font2.getFontName(), font2$.getFontName());
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -17,21 +17,9 @@
|
|||||||
|
|
||||||
package org.apache.poi.xssf.usermodel;
|
package org.apache.poi.xssf.usermodel;
|
||||||
|
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.util.Iterator;
|
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
|
||||||
|
|
||||||
import org.apache.poi.ss.usermodel.*;
|
|
||||||
import org.apache.poi.ss.SpreadsheetVersion;
|
import org.apache.poi.ss.SpreadsheetVersion;
|
||||||
import org.apache.poi.xssf.model.SharedStringsTable;
|
import org.apache.poi.ss.usermodel.BaseTestRow;
|
||||||
import org.apache.poi.xssf.XSSFTestDataSamples;
|
|
||||||
import org.apache.poi.xssf.XSSFITestDataProvider;
|
import org.apache.poi.xssf.XSSFITestDataProvider;
|
||||||
import org.apache.poi.hssf.usermodel.HSSFSheet;
|
|
||||||
import org.apache.poi.hssf.usermodel.HSSFRow;
|
|
||||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
||||||
import org.apache.poi.hssf.usermodel.HSSFCell;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests for XSSFRow
|
* Tests for XSSFRow
|
||||||
|
@ -18,19 +18,23 @@
|
|||||||
package org.apache.poi.xssf.usermodel;
|
package org.apache.poi.xssf.usermodel;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Iterator;
|
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
import org.apache.poi.ss.usermodel.BaseTestSheet;
|
||||||
import org.apache.poi.ss.usermodel.*;
|
import org.apache.poi.ss.usermodel.Cell;
|
||||||
|
import org.apache.poi.ss.usermodel.Workbook;
|
||||||
import org.apache.poi.ss.util.CellRangeAddress;
|
import org.apache.poi.ss.util.CellRangeAddress;
|
||||||
|
import org.apache.poi.xssf.XSSFITestDataProvider;
|
||||||
|
import org.apache.poi.xssf.XSSFTestDataSamples;
|
||||||
import org.apache.poi.xssf.model.CommentsTable;
|
import org.apache.poi.xssf.model.CommentsTable;
|
||||||
import org.apache.poi.xssf.model.StylesTable;
|
import org.apache.poi.xssf.model.StylesTable;
|
||||||
import org.apache.poi.xssf.model.CalculationChain;
|
|
||||||
import org.apache.poi.xssf.usermodel.helpers.ColumnHelper;
|
import org.apache.poi.xssf.usermodel.helpers.ColumnHelper;
|
||||||
import org.apache.poi.xssf.XSSFTestDataSamples;
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCol;
|
||||||
import org.apache.poi.xssf.XSSFITestDataProvider;
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCols;
|
||||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTComments;
|
||||||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.*;
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTRow;
|
||||||
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorksheet;
|
||||||
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTXf;
|
||||||
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.STPane;
|
||||||
|
|
||||||
|
|
||||||
public class TestXSSFSheet extends BaseTestSheet {
|
public class TestXSSFSheet extends BaseTestSheet {
|
||||||
@ -205,14 +209,14 @@ public class TestXSSFSheet extends BaseTestSheet {
|
|||||||
CTWorksheet ctWorksheet = sheet.getCTWorksheet();
|
CTWorksheet ctWorksheet = sheet.getCTWorksheet();
|
||||||
|
|
||||||
sheet.createFreezePane(2, 4);
|
sheet.createFreezePane(2, 4);
|
||||||
assertEquals((double) 2, ctWorksheet.getSheetViews().getSheetViewArray(0).getPane().getXSplit());
|
assertEquals(2.0, ctWorksheet.getSheetViews().getSheetViewArray(0).getPane().getXSplit(), 0.0);
|
||||||
assertEquals(STPane.BOTTOM_RIGHT, ctWorksheet.getSheetViews().getSheetViewArray(0).getPane().getActivePane());
|
assertEquals(STPane.BOTTOM_RIGHT, ctWorksheet.getSheetViews().getSheetViewArray(0).getPane().getActivePane());
|
||||||
sheet.createFreezePane(3, 6, 10, 10);
|
sheet.createFreezePane(3, 6, 10, 10);
|
||||||
assertEquals((double) 3, ctWorksheet.getSheetViews().getSheetViewArray(0).getPane().getXSplit());
|
assertEquals(3.0, ctWorksheet.getSheetViews().getSheetViewArray(0).getPane().getXSplit(), 0.0);
|
||||||
// assertEquals(10, sheet.getTopRow());
|
// assertEquals(10, sheet.getTopRow());
|
||||||
// assertEquals(10, sheet.getLeftCol());
|
// assertEquals(10, sheet.getLeftCol());
|
||||||
sheet.createSplitPane(4, 8, 12, 12, 1);
|
sheet.createSplitPane(4, 8, 12, 12, 1);
|
||||||
assertEquals((double) 8, ctWorksheet.getSheetViews().getSheetViewArray(0).getPane().getYSplit());
|
assertEquals(8.0, ctWorksheet.getSheetViews().getSheetViewArray(0).getPane().getYSplit(), 0.0);
|
||||||
assertEquals(STPane.BOTTOM_RIGHT, ctWorksheet.getSheetViews().getSheetViewArray(0).getPane().getActivePane());
|
assertEquals(STPane.BOTTOM_RIGHT, ctWorksheet.getSheetViews().getSheetViewArray(0).getPane().getActivePane());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -698,7 +702,7 @@ public class TestXSSFSheet extends BaseTestSheet {
|
|||||||
// XML is 1 based, POI is 0 based
|
// XML is 1 based, POI is 0 based
|
||||||
assertEquals(2, col.getMin());
|
assertEquals(2, col.getMin());
|
||||||
assertEquals(2, col.getMax());
|
assertEquals(2, col.getMax());
|
||||||
assertEquals(22.0, col.getWidth());
|
assertEquals(22.0, col.getWidth(), 0.0);
|
||||||
|
|
||||||
// Now set another
|
// Now set another
|
||||||
sheet.setColumnWidth(3, 33 * 256);
|
sheet.setColumnWidth(3, 33 * 256);
|
||||||
@ -711,12 +715,11 @@ public class TestXSSFSheet extends BaseTestSheet {
|
|||||||
col = cols.getColArray(0);
|
col = cols.getColArray(0);
|
||||||
assertEquals(2, col.getMin()); // POI 1
|
assertEquals(2, col.getMin()); // POI 1
|
||||||
assertEquals(2, col.getMax());
|
assertEquals(2, col.getMax());
|
||||||
assertEquals(22.0, col.getWidth());
|
assertEquals(22.0, col.getWidth(), 0.0);
|
||||||
|
|
||||||
col = cols.getColArray(1);
|
col = cols.getColArray(1);
|
||||||
assertEquals(4, col.getMin()); // POI 3
|
assertEquals(4, col.getMin()); // POI 3
|
||||||
assertEquals(4, col.getMax());
|
assertEquals(4, col.getMax());
|
||||||
assertEquals(33.0, col.getWidth());
|
assertEquals(33.0, col.getWidth(), 0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -20,23 +20,18 @@ package org.apache.poi.xssf.usermodel;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.util.zip.CRC32;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.zip.CRC32;
|
||||||
|
|
||||||
import junit.framework.TestCase;
|
import org.apache.poi.POIXMLProperties;
|
||||||
|
|
||||||
import org.apache.poi.hssf.HSSFTestDataSamples;
|
import org.apache.poi.hssf.HSSFTestDataSamples;
|
||||||
import org.apache.poi.ss.usermodel.*;
|
|
||||||
import org.apache.poi.ss.util.CellRangeAddress;
|
|
||||||
import org.apache.poi.xssf.XSSFTestDataSamples;
|
|
||||||
import org.apache.poi.xssf.XSSFITestDataProvider;
|
|
||||||
import org.apache.poi.xssf.model.StylesTable;
|
|
||||||
import org.apache.poi.openxml4j.opc.*;
|
import org.apache.poi.openxml4j.opc.*;
|
||||||
import org.apache.poi.openxml4j.opc.internal.PackagePropertiesPart;
|
import org.apache.poi.openxml4j.opc.internal.PackagePropertiesPart;
|
||||||
|
import org.apache.poi.ss.usermodel.*;
|
||||||
import org.apache.poi.util.TempFile;
|
import org.apache.poi.util.TempFile;
|
||||||
import org.apache.poi.POIXMLProperties;
|
import org.apache.poi.xssf.XSSFITestDataProvider;
|
||||||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTSheet;
|
import org.apache.poi.xssf.XSSFTestDataSamples;
|
||||||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorkbook;
|
import org.apache.poi.xssf.model.StylesTable;
|
||||||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorkbookPr;
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTWorkbookPr;
|
||||||
|
|
||||||
public final class TestXSSFWorkbook extends BaseTestWorkbook {
|
public final class TestXSSFWorkbook extends BaseTestWorkbook {
|
||||||
@ -238,7 +233,7 @@ public final class TestXSSFWorkbook extends BaseTestWorkbook {
|
|||||||
assertEquals(1, st.getBorders().size());
|
assertEquals(1, st.getBorders().size());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void testIncrementSheetId() throws Exception {
|
public void testIncrementSheetId() {
|
||||||
XSSFWorkbook wb = getTestDataProvider().createWorkbook();
|
XSSFWorkbook wb = getTestDataProvider().createWorkbook();
|
||||||
int sheetId = (int)wb.createSheet().sheet.getSheetId();
|
int sheetId = (int)wb.createSheet().sheet.getSheetId();
|
||||||
assertEquals(1, sheetId);
|
assertEquals(1, sheetId);
|
||||||
@ -255,7 +250,7 @@ public final class TestXSSFWorkbook extends BaseTestWorkbook {
|
|||||||
/**
|
/**
|
||||||
* Test setting of core properties such as Title and Author
|
* Test setting of core properties such as Title and Author
|
||||||
*/
|
*/
|
||||||
public void testWorkbookProperties() throws Exception {
|
public void testWorkbookProperties() {
|
||||||
XSSFWorkbook workbook = new XSSFWorkbook();
|
XSSFWorkbook workbook = new XSSFWorkbook();
|
||||||
POIXMLProperties props = workbook.getProperties();
|
POIXMLProperties props = workbook.getProperties();
|
||||||
assertNotNull(props);
|
assertNotNull(props);
|
||||||
|
@ -22,10 +22,9 @@ import java.util.Arrays;
|
|||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCol;
|
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCol;
|
||||||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.CTCols;
|
|
||||||
|
|
||||||
|
|
||||||
public class TestCTColComparator extends TestCase {
|
public final class TestCTColComparator extends TestCase {
|
||||||
|
|
||||||
public void testCompare() {
|
public void testCompare() {
|
||||||
CTColComparator comparator = new CTColComparator();
|
CTColComparator comparator = new CTColComparator();
|
||||||
@ -73,5 +72,4 @@ public class TestCTColComparator extends TestCase {
|
|||||||
assertEquals(8, cols[1].getMax());
|
assertEquals(8, cols[1].getMax());
|
||||||
assertEquals(80, cols[2].getMax());
|
assertEquals(80, cols[2].getMax());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ import java.math.BigInteger;
|
|||||||
|
|
||||||
import junit.framework.TestCase;
|
import junit.framework.TestCase;
|
||||||
|
|
||||||
import org.openxmlformats.schemas.officeDocument.x2006.math.STSpacingRule;
|
import org.apache.poi.POIXMLDocument;
|
||||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTBorder;
|
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTBorder;
|
||||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTInd;
|
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTInd;
|
||||||
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTJc;
|
import org.openxmlformats.schemas.wordprocessingml.x2006.main.CTJc;
|
||||||
@ -40,29 +40,27 @@ import org.openxmlformats.schemas.wordprocessingml.x2006.main.STTextAlignment;
|
|||||||
/**
|
/**
|
||||||
* Tests for XWPF Paragraphs
|
* Tests for XWPF Paragraphs
|
||||||
*/
|
*/
|
||||||
public class TestXWPFParagraph extends TestCase {
|
public final class TestXWPFParagraph extends TestCase {
|
||||||
/**
|
/**
|
||||||
* A simple file
|
* A simple file
|
||||||
*/
|
*/
|
||||||
private XWPFDocument xml;
|
private XWPFDocument xml;
|
||||||
private File file;
|
|
||||||
/*
|
|
||||||
protected void setUp() throws Exception {
|
protected void setUp() throws Exception {
|
||||||
super.setUp();
|
super.setUp();
|
||||||
|
|
||||||
file = new File(
|
File file = new File(
|
||||||
System.getProperty("HWPF.testdata.path") +
|
System.getProperty("HWPF.testdata.path") +
|
||||||
File.separator + "ThreeColHead.docx"
|
File.separator + "ThreeColHead.docx"
|
||||||
);
|
);
|
||||||
assertTrue(file.exists());
|
assertTrue(file.exists());
|
||||||
xml = new XWPFDocument(POIXMLDocument.openPackage(file.toString()));
|
xml = new XWPFDocument(POIXMLDocument.openPackage(file.toString()));
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
/**
|
/**
|
||||||
* Check that we get the right paragraph from the header
|
* Check that we get the right paragraph from the header
|
||||||
*/
|
*/
|
||||||
/*
|
public void disabled_testHeaderParagraph() {
|
||||||
public void testHeaderParagraph() throws Exception {
|
|
||||||
XWPFHeader hdr = xml.getHeaderFooterPolicy().getDefaultHeader();
|
XWPFHeader hdr = xml.getHeaderFooterPolicy().getDefaultHeader();
|
||||||
assertNotNull(hdr);
|
assertNotNull(hdr);
|
||||||
|
|
||||||
@ -74,12 +72,11 @@ public class TestXWPFParagraph extends TestCase {
|
|||||||
assertEquals("First header column!\tMid header\tRight header!", p
|
assertEquals("First header column!\tMid header\tRight header!", p
|
||||||
.getText());
|
.getText());
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
/**
|
/**
|
||||||
* Check that we get the right paragraphs from the document
|
* Check that we get the right paragraphs from the document
|
||||||
*/
|
*/
|
||||||
/*
|
public void disabled_testDocumentParagraph() {
|
||||||
public void testDocumentParagraph() throws Exception {
|
|
||||||
XWPFParagraph[] ps = xml.getParagraphs();
|
XWPFParagraph[] ps = xml.getParagraphs();
|
||||||
assertEquals(10, ps.length);
|
assertEquals(10, ps.length);
|
||||||
|
|
||||||
@ -100,7 +97,7 @@ public class TestXWPFParagraph extends TestCase {
|
|||||||
assertFalse(ps[4].isEmpty());
|
assertFalse(ps[4].isEmpty());
|
||||||
assertEquals("More on page one", ps[4].getText());
|
assertEquals("More on page one", ps[4].getText());
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
public void testSetGetBorderTop() {
|
public void testSetGetBorderTop() {
|
||||||
//new clean instance of paragraph
|
//new clean instance of paragraph
|
||||||
XWPFDocument doc = new XWPFDocument();
|
XWPFDocument doc = new XWPFDocument();
|
||||||
@ -240,6 +237,4 @@ public class TestXWPFParagraph extends TestCase {
|
|||||||
p.setPageBreak(true);
|
p.setPageBreak(true);
|
||||||
assertEquals(STOnOff.TRUE, ppr.getPageBreakBefore().getVal());
|
assertEquals(STOnOff.TRUE, ppr.getPageBreakBefore().getVal());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -17,16 +17,12 @@
|
|||||||
|
|
||||||
package org.apache.poi.hdf.extractor;
|
package org.apache.poi.hdf.extractor;
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Comment me
|
* Comment me
|
||||||
*
|
*
|
||||||
* @author Ryan Ackley
|
* @author Ryan Ackley
|
||||||
*/
|
*/
|
||||||
|
public final class StyleSheet {
|
||||||
public final class StyleSheet
|
|
||||||
{
|
|
||||||
|
|
||||||
private static final int NIL_STYLE = 4095;
|
private static final int NIL_STYLE = 4095;
|
||||||
private static final int PAP_TYPE = 1;
|
private static final int PAP_TYPE = 1;
|
||||||
|
@ -17,37 +17,25 @@
|
|||||||
|
|
||||||
package org.apache.poi.hdf.model;
|
package org.apache.poi.hdf.model;
|
||||||
|
|
||||||
|
|
||||||
//import java.io;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.TreeSet;
|
|
||||||
|
|
||||||
|
|
||||||
import org.apache.poi.hdf.model.hdftypes.*;
|
|
||||||
import org.apache.poi.hdf.event.HDFLowLevelParsingListener;
|
import org.apache.poi.hdf.event.HDFLowLevelParsingListener;
|
||||||
import org.apache.poi.hdf.model.util.BTreeSet;
|
import org.apache.poi.hdf.model.hdftypes.*;
|
||||||
import org.apache.poi.hdf.model.util.ParsingState;
|
import org.apache.poi.hdf.model.util.ParsingState;
|
||||||
|
|
||||||
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
|
|
||||||
import org.apache.poi.poifs.filesystem.POIFSDocument;
|
|
||||||
import org.apache.poi.poifs.filesystem.DocumentEntry;
|
import org.apache.poi.poifs.filesystem.DocumentEntry;
|
||||||
|
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
|
||||||
import org.apache.poi.util.LittleEndian;
|
import org.apache.poi.util.LittleEndian;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The Object Factory takes in a stream and creates the low level objects
|
* The Object Factory takes in a stream and creates the low level objects
|
||||||
* that represent the data.
|
* that represent the data.
|
||||||
* @author andy
|
* @author andy
|
||||||
*/
|
*/
|
||||||
public final class HDFObjectFactory
|
public final class HDFObjectFactory {
|
||||||
{
|
|
||||||
|
|
||||||
/** OLE stuff*/
|
/** OLE stuff*/
|
||||||
private POIFSFileSystem _filesystem;
|
private POIFSFileSystem _filesystem;
|
||||||
@ -193,22 +181,16 @@ public final class HDFObjectFactory
|
|||||||
{
|
{
|
||||||
throw new IOException("The text piece table is corrupted");
|
throw new IOException("The text piece table is corrupted");
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
//parse out the text pieces
|
//parse out the text pieces
|
||||||
int pieceTableSize = LittleEndian.getInt(_tableBuffer, ++pos);
|
int pieceTableSize = LittleEndian.getInt(_tableBuffer, ++pos);
|
||||||
pos += 4;
|
pos += 4;
|
||||||
int pieces = (pieceTableSize - 4) / 12;
|
int pieces = (pieceTableSize - 4) / 12;
|
||||||
for (int x = 0; x < pieces; x++)
|
for (int x = 0; x < pieces; x++) {
|
||||||
{
|
|
||||||
int filePos = LittleEndian.getInt(_tableBuffer, pos + ((pieces + 1) * 4) + (x * 8) + 2);
|
int filePos = LittleEndian.getInt(_tableBuffer, pos + ((pieces + 1) * 4) + (x * 8) + 2);
|
||||||
boolean unicode = false;
|
boolean unicode = false;
|
||||||
if ((filePos & 0x40000000) == 0)
|
if ((filePos & 0x40000000) == 0) {
|
||||||
{
|
|
||||||
unicode = true;
|
unicode = true;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
unicode = false;
|
unicode = false;
|
||||||
filePos &= ~(0x40000000);//gives me FC in doc stream
|
filePos &= ~(0x40000000);//gives me FC in doc stream
|
||||||
filePos /= 2;
|
filePos /= 2;
|
||||||
@ -218,11 +200,7 @@ public final class HDFObjectFactory
|
|||||||
|
|
||||||
TextPiece piece = new TextPiece(filePos, totLength, unicode);
|
TextPiece piece = new TextPiece(filePos, totLength, unicode);
|
||||||
_listener.text(piece);
|
_listener.text(piece);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* initializes all of the formatting properties for a Word Document
|
* initializes all of the formatting properties for a Word Document
|
||||||
@ -532,11 +510,8 @@ public final class HDFObjectFactory
|
|||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
x++;
|
x++;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
//do the header sections
|
//do the header sections
|
||||||
for (; x < arraySize; x++)// && sectionEnd <= end; x++)
|
for (; x < arraySize; x++)// && sectionEnd <= end; x++)
|
||||||
{
|
{
|
||||||
|
@ -17,9 +17,6 @@
|
|||||||
|
|
||||||
package org.apache.poi.hdf.model.hdftypes;
|
package org.apache.poi.hdf.model.hdftypes;
|
||||||
|
|
||||||
import org.apache.poi.util.BitField;
|
|
||||||
import org.apache.poi.util.LittleEndian;
|
|
||||||
|
|
||||||
|
|
||||||
import org.apache.poi.hdf.model.hdftypes.definitions.FIBAbstractType;
|
import org.apache.poi.hdf.model.hdftypes.definitions.FIBAbstractType;
|
||||||
|
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
|
|
||||||
package org.apache.poi.hdf.model.hdftypes;
|
package org.apache.poi.hdf.model.hdftypes;
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
import org.apache.poi.util.LittleEndian;
|
import org.apache.poi.util.LittleEndian;
|
||||||
import org.apache.poi.hdf.model.hdftypes.definitions.TCAbstractType;
|
import org.apache.poi.hdf.model.hdftypes.definitions.TCAbstractType;
|
||||||
|
|
||||||
@ -29,9 +28,7 @@ import org.apache.poi.hdf.model.hdftypes.definitions.TCAbstractType;
|
|||||||
*
|
*
|
||||||
* @author Ryan Ackley
|
* @author Ryan Ackley
|
||||||
*/
|
*/
|
||||||
|
public final class StyleSheet implements HDFType {
|
||||||
public final class StyleSheet implements HDFType
|
|
||||||
{
|
|
||||||
|
|
||||||
private static final int NIL_STYLE = 4095;
|
private static final int NIL_STYLE = 4095;
|
||||||
private static final int PAP_TYPE = 1;
|
private static final int PAP_TYPE = 1;
|
||||||
|
@ -18,12 +18,8 @@
|
|||||||
package org.apache.poi.hdf.model.hdftypes.definitions;
|
package org.apache.poi.hdf.model.hdftypes.definitions;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import org.apache.poi.util.BitField;
|
import org.apache.poi.util.BitField;
|
||||||
import org.apache.poi.util.BitFieldFactory;
|
import org.apache.poi.util.BitFieldFactory;
|
||||||
import org.apache.poi.util.LittleEndian;
|
|
||||||
import org.apache.poi.util.StringUtil;
|
|
||||||
import org.apache.poi.util.HexDump;
|
|
||||||
import org.apache.poi.hdf.model.hdftypes.HDFType;
|
import org.apache.poi.hdf.model.hdftypes.HDFType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -22,7 +22,6 @@ package org.apache.poi.hdf.model.hdftypes.definitions;
|
|||||||
import org.apache.poi.util.BitField;
|
import org.apache.poi.util.BitField;
|
||||||
import org.apache.poi.util.BitFieldFactory;
|
import org.apache.poi.util.BitFieldFactory;
|
||||||
import org.apache.poi.util.LittleEndian;
|
import org.apache.poi.util.LittleEndian;
|
||||||
import org.apache.poi.util.StringUtil;
|
|
||||||
import org.apache.poi.util.HexDump;
|
import org.apache.poi.util.HexDump;
|
||||||
import org.apache.poi.hdf.model.hdftypes.HDFType;
|
import org.apache.poi.hdf.model.hdftypes.HDFType;
|
||||||
|
|
||||||
|
@ -18,11 +18,9 @@
|
|||||||
package org.apache.poi.hdf.model.hdftypes.definitions;
|
package org.apache.poi.hdf.model.hdftypes.definitions;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import org.apache.poi.util.BitField;
|
import org.apache.poi.util.BitField;
|
||||||
import org.apache.poi.util.BitFieldFactory;
|
import org.apache.poi.util.BitFieldFactory;
|
||||||
import org.apache.poi.util.LittleEndian;
|
import org.apache.poi.util.LittleEndian;
|
||||||
import org.apache.poi.util.StringUtil;
|
|
||||||
import org.apache.poi.util.HexDump;
|
import org.apache.poi.util.HexDump;
|
||||||
import org.apache.poi.hdf.model.hdftypes.HDFType;
|
import org.apache.poi.hdf.model.hdftypes.HDFType;
|
||||||
|
|
||||||
|
@ -18,12 +18,8 @@
|
|||||||
package org.apache.poi.hdf.model.hdftypes.definitions;
|
package org.apache.poi.hdf.model.hdftypes.definitions;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import org.apache.poi.util.BitField;
|
import org.apache.poi.util.BitField;
|
||||||
import org.apache.poi.util.BitFieldFactory;
|
import org.apache.poi.util.BitFieldFactory;
|
||||||
import org.apache.poi.util.LittleEndian;
|
|
||||||
import org.apache.poi.util.StringUtil;
|
|
||||||
import org.apache.poi.util.HexDump;
|
|
||||||
import org.apache.poi.hdf.model.hdftypes.HDFType;
|
import org.apache.poi.hdf.model.hdftypes.HDFType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -18,11 +18,6 @@
|
|||||||
package org.apache.poi.hdf.model.hdftypes.definitions;
|
package org.apache.poi.hdf.model.hdftypes.definitions;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import org.apache.poi.util.BitField;
|
|
||||||
import org.apache.poi.util.LittleEndian;
|
|
||||||
import org.apache.poi.util.StringUtil;
|
|
||||||
import org.apache.poi.util.HexDump;
|
|
||||||
import org.apache.poi.hdf.model.hdftypes.HDFType;
|
import org.apache.poi.hdf.model.hdftypes.HDFType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -17,12 +17,6 @@
|
|||||||
|
|
||||||
package org.apache.poi.hdf.model.hdftypes.definitions;
|
package org.apache.poi.hdf.model.hdftypes.definitions;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import org.apache.poi.util.BitField;
|
|
||||||
import org.apache.poi.util.LittleEndian;
|
|
||||||
import org.apache.poi.util.StringUtil;
|
|
||||||
import org.apache.poi.util.HexDump;
|
|
||||||
import org.apache.poi.hdf.model.hdftypes.HDFType;
|
import org.apache.poi.hdf.model.hdftypes.HDFType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -17,13 +17,8 @@
|
|||||||
|
|
||||||
package org.apache.poi.hdf.model.hdftypes.definitions;
|
package org.apache.poi.hdf.model.hdftypes.definitions;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
import org.apache.poi.util.BitField;
|
import org.apache.poi.util.BitField;
|
||||||
import org.apache.poi.util.BitFieldFactory;
|
import org.apache.poi.util.BitFieldFactory;
|
||||||
import org.apache.poi.util.LittleEndian;
|
|
||||||
import org.apache.poi.util.StringUtil;
|
|
||||||
import org.apache.poi.util.HexDump;
|
|
||||||
import org.apache.poi.hdf.model.hdftypes.HDFType;
|
import org.apache.poi.hdf.model.hdftypes.HDFType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -26,9 +26,6 @@ import org.apache.poi.hslf.record.PersistPtrHolder;
|
|||||||
import org.apache.poi.hslf.record.Record;
|
import org.apache.poi.hslf.record.Record;
|
||||||
import org.apache.poi.hslf.record.UserEditAtom;
|
import org.apache.poi.hslf.record.UserEditAtom;
|
||||||
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
|
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
|
||||||
import org.apache.poi.poifs.filesystem.DocumentEntry;
|
|
||||||
import org.apache.poi.poifs.filesystem.DocumentInputStream;
|
|
||||||
import org.apache.poi.util.LittleEndian;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class provides helper functions for determining if a
|
* This class provides helper functions for determining if a
|
||||||
@ -95,7 +92,9 @@ public final class EncryptedSlideShow
|
|||||||
hss.getUnderlyingBytes(),
|
hss.getUnderlyingBytes(),
|
||||||
(int)cua.getCurrentEditOffset()
|
(int)cua.getCurrentEditOffset()
|
||||||
);
|
);
|
||||||
} catch(ArrayIndexOutOfBoundsException e) {}
|
} catch (ArrayIndexOutOfBoundsException e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
if(r == null) { return null; }
|
if(r == null) { return null; }
|
||||||
if(! (r instanceof UserEditAtom)) { return null; }
|
if(! (r instanceof UserEditAtom)) { return null; }
|
||||||
UserEditAtom uea = (UserEditAtom)r;
|
UserEditAtom uea = (UserEditAtom)r;
|
||||||
|
@ -26,7 +26,6 @@ import java.io.InputStream;
|
|||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.zip.InflaterInputStream;
|
import java.util.zip.InflaterInputStream;
|
||||||
import java.util.zip.DeflaterOutputStream;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents EMF (Windows Enhanced Metafile) picture data.
|
* Represents EMF (Windows Enhanced Metafile) picture data.
|
||||||
|
@ -23,7 +23,6 @@ import org.apache.poi.hslf.usermodel.PictureData;
|
|||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.zip.DeflaterOutputStream;
|
import java.util.zip.DeflaterOutputStream;
|
||||||
import java.util.zip.InflaterInputStream;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a metafile picture which can be one of the following types: EMF, WMF, or PICT.
|
* Represents a metafile picture which can be one of the following types: EMF, WMF, or PICT.
|
||||||
|
@ -17,14 +17,14 @@
|
|||||||
|
|
||||||
package org.apache.poi.hslf.blip;
|
package org.apache.poi.hslf.blip;
|
||||||
|
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.zip.InflaterInputStream;
|
||||||
|
|
||||||
|
import org.apache.poi.hslf.exceptions.HSLFException;
|
||||||
import org.apache.poi.hslf.model.Picture;
|
import org.apache.poi.hslf.model.Picture;
|
||||||
import org.apache.poi.hslf.model.Shape;
|
import org.apache.poi.hslf.model.Shape;
|
||||||
import org.apache.poi.hslf.exceptions.HSLFException;
|
|
||||||
import org.apache.poi.util.LittleEndian;
|
|
||||||
|
|
||||||
import java.io.*;
|
|
||||||
import java.util.zip.InflaterInputStream;
|
|
||||||
import java.util.zip.DeflaterOutputStream;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents Macintosh PICT picture data.
|
* Represents Macintosh PICT picture data.
|
||||||
|
@ -25,7 +25,6 @@ import org.apache.poi.hslf.exceptions.HSLFException;
|
|||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.util.zip.InflaterInputStream;
|
import java.util.zip.InflaterInputStream;
|
||||||
import java.util.zip.DeflaterOutputStream;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a WMF (Windows Metafile) picture data.
|
* Represents a WMF (Windows Metafile) picture data.
|
||||||
|
@ -17,11 +17,9 @@
|
|||||||
|
|
||||||
package org.apache.poi.hslf.dev;
|
package org.apache.poi.hslf.dev;
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
|
||||||
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
|
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
|
||||||
import org.apache.poi.poifs.filesystem.POIFSDocument;
|
|
||||||
import org.apache.poi.poifs.filesystem.DocumentEntry;
|
import org.apache.poi.poifs.filesystem.DocumentEntry;
|
||||||
|
|
||||||
import org.apache.poi.ddf.*;
|
import org.apache.poi.ddf.*;
|
||||||
|
@ -33,7 +33,6 @@ import org.apache.poi.hslf.record.EscherTextboxWrapper;
|
|||||||
import org.apache.poi.hslf.record.TextCharsAtom;
|
import org.apache.poi.hslf.record.TextCharsAtom;
|
||||||
import org.apache.poi.hslf.record.TextBytesAtom;
|
import org.apache.poi.hslf.record.TextBytesAtom;
|
||||||
import org.apache.poi.hslf.record.StyleTextPropAtom;
|
import org.apache.poi.hslf.record.StyleTextPropAtom;
|
||||||
import org.apache.poi.hslf.record.Record;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class provides a way to view the contents of a powerpoint file.
|
* This class provides a way to view the contents of a powerpoint file.
|
||||||
|
@ -22,7 +22,6 @@ import org.apache.poi.hslf.model.textproperties.BitMaskTextProp;
|
|||||||
import org.apache.poi.hslf.model.textproperties.TextProp;
|
import org.apache.poi.hslf.model.textproperties.TextProp;
|
||||||
import org.apache.poi.hslf.model.textproperties.TextPropCollection;
|
import org.apache.poi.hslf.model.textproperties.TextPropCollection;
|
||||||
import org.apache.poi.hslf.record.*;
|
import org.apache.poi.hslf.record.*;
|
||||||
import org.apache.poi.hslf.record.StyleTextPropAtom.*;
|
|
||||||
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
|
||||||
|
@ -17,18 +17,13 @@
|
|||||||
|
|
||||||
package org.apache.poi.hslf.dev;
|
package org.apache.poi.hslf.dev;
|
||||||
|
|
||||||
import org.apache.poi.hslf.*;
|
import java.io.ByteArrayOutputStream;
|
||||||
import org.apache.poi.hslf.record.*;
|
|
||||||
|
|
||||||
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
|
|
||||||
import org.apache.poi.poifs.filesystem.POIFSDocument;
|
|
||||||
import org.apache.poi.poifs.filesystem.DocumentEntry;
|
|
||||||
import org.apache.poi.poifs.filesystem.DocumentInputStream;
|
|
||||||
import org.apache.poi.util.LittleEndian;
|
|
||||||
|
|
||||||
import java.io.*;
|
|
||||||
import java.util.Hashtable;
|
import java.util.Hashtable;
|
||||||
|
|
||||||
|
import org.apache.poi.hslf.HSLFSlideShow;
|
||||||
|
import org.apache.poi.hslf.record.*;
|
||||||
|
import org.apache.poi.util.LittleEndian;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Uses record level code to locate UserEditAtom records, and other
|
* Uses record level code to locate UserEditAtom records, and other
|
||||||
* persistence related atoms. Tries to match them together, to help
|
* persistence related atoms. Tries to match them together, to help
|
||||||
|
@ -21,9 +21,7 @@ import java.io.*;
|
|||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
|
||||||
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
|
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
|
||||||
import org.apache.poi.poifs.filesystem.POIFSDocument;
|
|
||||||
import org.apache.poi.poifs.filesystem.DocumentEntry;
|
import org.apache.poi.poifs.filesystem.DocumentEntry;
|
||||||
import org.apache.poi.poifs.filesystem.DocumentInputStream;
|
|
||||||
import org.apache.poi.util.LittleEndian;
|
import org.apache.poi.util.LittleEndian;
|
||||||
|
|
||||||
import org.apache.poi.hslf.record.CString;
|
import org.apache.poi.hslf.record.CString;
|
||||||
|
@ -20,7 +20,6 @@ package org.apache.poi.hslf.model;
|
|||||||
import org.apache.poi.ddf.*;
|
import org.apache.poi.ddf.*;
|
||||||
import org.apache.poi.util.LittleEndian;
|
import org.apache.poi.util.LittleEndian;
|
||||||
import org.apache.poi.util.POILogger;
|
import org.apache.poi.util.POILogger;
|
||||||
import org.apache.poi.util.HexDump;
|
|
||||||
|
|
||||||
import java.awt.geom.*;
|
import java.awt.geom.*;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -18,9 +18,6 @@
|
|||||||
package org.apache.poi.hslf.model;
|
package org.apache.poi.hslf.model;
|
||||||
|
|
||||||
import org.apache.poi.hslf.record.SheetContainer;
|
import org.apache.poi.hslf.record.SheetContainer;
|
||||||
import org.apache.poi.hslf.record.Record;
|
|
||||||
import org.apache.poi.hslf.record.RecordTypes;
|
|
||||||
import org.apache.poi.hslf.record.OEPlaceholderAtom;
|
|
||||||
import org.apache.poi.hslf.model.textproperties.TextProp;
|
import org.apache.poi.hslf.model.textproperties.TextProp;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -55,5 +52,4 @@ public abstract class MasterSheet extends Sheet {
|
|||||||
TextShape tx = (TextShape)shape;
|
TextShape tx = (TextShape)shape;
|
||||||
return tx.getPlaceholderAtom() != null;
|
return tx.getPlaceholderAtom() != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -28,13 +28,11 @@ import org.apache.poi.util.POILogger;
|
|||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.geom.Rectangle2D;
|
|
||||||
import java.awt.geom.AffineTransform;
|
import java.awt.geom.AffineTransform;
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Arrays;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -21,7 +21,6 @@ import org.apache.poi.ddf.*;
|
|||||||
import org.apache.poi.hslf.record.OEPlaceholderAtom;
|
import org.apache.poi.hslf.record.OEPlaceholderAtom;
|
||||||
import org.apache.poi.hslf.exceptions.HSLFException;
|
import org.apache.poi.hslf.exceptions.HSLFException;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -19,7 +19,6 @@ package org.apache.poi.hslf.model;
|
|||||||
|
|
||||||
import org.apache.poi.ddf.*;
|
import org.apache.poi.ddf.*;
|
||||||
import org.apache.poi.hslf.record.ColorSchemeAtom;
|
import org.apache.poi.hslf.record.ColorSchemeAtom;
|
||||||
import org.apache.poi.hslf.record.PPDrawing;
|
|
||||||
import org.apache.poi.util.POILogger;
|
import org.apache.poi.util.POILogger;
|
||||||
import org.apache.poi.util.POILogFactory;
|
import org.apache.poi.util.POILogFactory;
|
||||||
|
|
||||||
|
@ -20,7 +20,6 @@ package org.apache.poi.hslf.model;
|
|||||||
import org.apache.poi.ddf.*;
|
import org.apache.poi.ddf.*;
|
||||||
import org.apache.poi.hslf.record.*;
|
import org.apache.poi.hslf.record.*;
|
||||||
import org.apache.poi.hslf.usermodel.SlideShow;
|
import org.apache.poi.hslf.usermodel.SlideShow;
|
||||||
import org.apache.poi.util.POILogger;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
package org.apache.poi.hslf.model;
|
package org.apache.poi.hslf.model;
|
||||||
|
|
||||||
import org.apache.poi.ddf.*;
|
import org.apache.poi.ddf.*;
|
||||||
import org.apache.poi.hslf.record.TextHeaderAtom;
|
|
||||||
|
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
|
||||||
|
@ -17,22 +17,24 @@
|
|||||||
|
|
||||||
package org.apache.poi.hslf.model;
|
package org.apache.poi.hslf.model;
|
||||||
|
|
||||||
import org.apache.poi.hslf.usermodel.RichTextRun;
|
import java.awt.Color;
|
||||||
import org.apache.poi.hslf.record.TextRulerAtom;
|
import java.awt.Font;
|
||||||
import org.apache.poi.util.POILogger;
|
import java.awt.Graphics2D;
|
||||||
import org.apache.poi.util.POILogFactory;
|
|
||||||
|
|
||||||
import java.text.AttributedString;
|
|
||||||
import java.text.AttributedCharacterIterator;
|
|
||||||
import java.text.BreakIterator;
|
|
||||||
import java.awt.font.TextAttribute;
|
|
||||||
import java.awt.font.LineBreakMeasurer;
|
|
||||||
import java.awt.font.TextLayout;
|
|
||||||
import java.awt.font.FontRenderContext;
|
import java.awt.font.FontRenderContext;
|
||||||
import java.awt.*;
|
import java.awt.font.LineBreakMeasurer;
|
||||||
import java.awt.geom.Rectangle2D;
|
import java.awt.font.TextAttribute;
|
||||||
|
import java.awt.font.TextLayout;
|
||||||
import java.awt.geom.Point2D;
|
import java.awt.geom.Point2D;
|
||||||
|
import java.awt.geom.Rectangle2D;
|
||||||
|
import java.text.AttributedCharacterIterator;
|
||||||
|
import java.text.AttributedString;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.apache.poi.hslf.record.TextRulerAtom;
|
||||||
|
import org.apache.poi.hslf.usermodel.RichTextRun;
|
||||||
|
import org.apache.poi.util.POILogFactory;
|
||||||
|
import org.apache.poi.util.POILogger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Paint text into java.awt.Graphics2D
|
* Paint text into java.awt.Graphics2D
|
||||||
@ -162,7 +164,7 @@ public final class TextPainter {
|
|||||||
int paragraphStart = it.getBeginIndex();
|
int paragraphStart = it.getBeginIndex();
|
||||||
int paragraphEnd = it.getEndIndex();
|
int paragraphEnd = it.getEndIndex();
|
||||||
|
|
||||||
ArrayList lines = new ArrayList();
|
List<TextElement> lines = new ArrayList<TextElement>();
|
||||||
LineBreakMeasurer measurer = new LineBreakMeasurer(it, frc);
|
LineBreakMeasurer measurer = new LineBreakMeasurer(it, frc);
|
||||||
measurer.setPosition(paragraphStart);
|
measurer.setPosition(paragraphStart);
|
||||||
while (measurer.getPosition() < paragraphEnd) {
|
while (measurer.getPosition() < paragraphEnd) {
|
||||||
@ -296,7 +298,7 @@ public final class TextPainter {
|
|||||||
|
|
||||||
//finally draw the text fragments
|
//finally draw the text fragments
|
||||||
TextElement[] elems = new TextElement[lines.size()];
|
TextElement[] elems = new TextElement[lines.size()];
|
||||||
return (TextElement[])lines.toArray(elems);
|
return lines.toArray(elems);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class TextElement {
|
public static class TextElement {
|
||||||
|
@ -19,7 +19,6 @@ package org.apache.poi.hslf.model;
|
|||||||
|
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.poi.hslf.model.textproperties.TextPropCollection;
|
import org.apache.poi.hslf.model.textproperties.TextPropCollection;
|
||||||
import org.apache.poi.hslf.record.*;
|
import org.apache.poi.hslf.record.*;
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
/* ====================================================================
|
/* ====================================================================
|
||||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||||
contributor license agreements. See the NOTICE file distributed with
|
contributor license agreements. See the NOTICE file distributed with
|
||||||
@ -30,7 +29,6 @@ import java.awt.geom.AffineTransform;
|
|||||||
import java.awt.font.FontRenderContext;
|
import java.awt.font.FontRenderContext;
|
||||||
import java.awt.font.TextLayout;
|
import java.awt.font.TextLayout;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.Iterator;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A common superclass of all shapes that can hold text.
|
* A common superclass of all shapes that can hold text.
|
||||||
|
@ -19,9 +19,7 @@ package org.apache.poi.hslf.record;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
import org.apache.poi.hslf.util.SystemTimeUtils;
|
|
||||||
import org.apache.poi.util.LittleEndian;
|
import org.apache.poi.util.LittleEndian;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -29,8 +27,7 @@ import org.apache.poi.util.LittleEndian;
|
|||||||
*
|
*
|
||||||
* @author Yegor Kozlov
|
* @author Yegor Kozlov
|
||||||
*/
|
*/
|
||||||
public final class AnimationInfoAtom extends RecordAtom
|
public final class AnimationInfoAtom extends RecordAtom {
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* whether the animation plays in the reverse direction
|
* whether the animation plays in the reverse direction
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
|
|
||||||
package org.apache.poi.hslf.record;
|
package org.apache.poi.hslf.record;
|
||||||
|
|
||||||
import org.apache.poi.util.LittleEndian;
|
|
||||||
import org.apache.poi.util.StringUtil;
|
import org.apache.poi.util.StringUtil;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -29,9 +28,7 @@ import java.io.OutputStream;
|
|||||||
*
|
*
|
||||||
* @author Nick Burch
|
* @author Nick Burch
|
||||||
*/
|
*/
|
||||||
|
public final class DocumentEncryptionAtom extends RecordAtom {
|
||||||
public final class DocumentEncryptionAtom extends RecordAtom
|
|
||||||
{
|
|
||||||
private byte[] _header;
|
private byte[] _header;
|
||||||
private static long _type = 12052l;
|
private static long _type = 12052l;
|
||||||
|
|
||||||
|
@ -17,11 +17,6 @@
|
|||||||
|
|
||||||
package org.apache.poi.hslf.record;
|
package org.apache.poi.hslf.record;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.OutputStream;
|
|
||||||
|
|
||||||
import org.apache.poi.util.LittleEndian;
|
|
||||||
import org.apache.poi.util.POILogger;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A container record that specifies information about a movie stored externally.
|
* A container record that specifies information about a movie stored externally.
|
||||||
@ -50,5 +45,4 @@ public final class ExAviMovie extends ExMCIMovie {
|
|||||||
public long getRecordType() {
|
public long getRecordType() {
|
||||||
return RecordTypes.ExAviMovie.typeID;
|
return RecordTypes.ExAviMovie.typeID;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -17,11 +17,6 @@
|
|||||||
|
|
||||||
package org.apache.poi.hslf.record;
|
package org.apache.poi.hslf.record;
|
||||||
|
|
||||||
import java.io.OutputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
import org.apache.poi.util.LittleEndian;
|
|
||||||
import org.apache.poi.util.POILogger;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A container record that specifies information about an ActiveX control. It contains:
|
* A container record that specifies information about an ActiveX control. It contains:
|
||||||
|
@ -15,14 +15,11 @@
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
==================================================================== */
|
==================================================================== */
|
||||||
|
|
||||||
|
|
||||||
package org.apache.poi.hslf.record;
|
package org.apache.poi.hslf.record;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
import org.apache.poi.hslf.util.SystemTimeUtils;
|
|
||||||
import org.apache.poi.util.LittleEndian;
|
import org.apache.poi.util.LittleEndian;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -31,9 +28,7 @@ import org.apache.poi.util.LittleEndian;
|
|||||||
*
|
*
|
||||||
* @author Nick Burch
|
* @author Nick Burch
|
||||||
*/
|
*/
|
||||||
|
public final class ExHyperlinkAtom extends RecordAtom {
|
||||||
public class ExHyperlinkAtom extends RecordAtom
|
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* Record header.
|
* Record header.
|
||||||
*/
|
*/
|
||||||
|
@ -19,9 +19,7 @@ package org.apache.poi.hslf.record;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
import org.apache.poi.hslf.util.SystemTimeUtils;
|
|
||||||
import org.apache.poi.util.LittleEndian;
|
import org.apache.poi.util.LittleEndian;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -18,7 +18,6 @@
|
|||||||
package org.apache.poi.hslf.record;
|
package org.apache.poi.hslf.record;
|
||||||
|
|
||||||
import org.apache.poi.util.LittleEndian;
|
import org.apache.poi.util.LittleEndian;
|
||||||
import org.apache.poi.util.StringUtil;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
|
@ -15,14 +15,11 @@
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
==================================================================== */
|
==================================================================== */
|
||||||
|
|
||||||
|
|
||||||
package org.apache.poi.hslf.record;
|
package org.apache.poi.hslf.record;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
import org.apache.poi.hslf.util.SystemTimeUtils;
|
|
||||||
import org.apache.poi.util.LittleEndian;
|
import org.apache.poi.util.LittleEndian;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -32,9 +29,7 @@ import org.apache.poi.util.LittleEndian;
|
|||||||
* @author Nick Burch
|
* @author Nick Burch
|
||||||
* @author Yegor Kozlov
|
* @author Yegor Kozlov
|
||||||
*/
|
*/
|
||||||
|
public class InteractiveInfoAtom extends RecordAtom {
|
||||||
public class InteractiveInfoAtom extends RecordAtom
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Action Table
|
* Action Table
|
||||||
|
@ -21,16 +21,12 @@ import java.io.IOException;
|
|||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import org.apache.poi.util.LittleEndian;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Master slide
|
* Master slide
|
||||||
*
|
*
|
||||||
* @author Yegor Kozlov
|
* @author Yegor Kozlov
|
||||||
*/
|
*/
|
||||||
|
public final class MainMaster extends SheetContainer {
|
||||||
public final class MainMaster extends SheetContainer
|
|
||||||
{
|
|
||||||
private byte[] _header;
|
private byte[] _header;
|
||||||
private static long _type = 1016;
|
private static long _type = 1016;
|
||||||
|
|
||||||
@ -106,5 +102,4 @@ public final class MainMaster extends SheetContainer
|
|||||||
public ColorSchemeAtom getColorScheme(){
|
public ColorSchemeAtom getColorScheme(){
|
||||||
return _colorScheme;
|
return _colorScheme;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -19,9 +19,7 @@ package org.apache.poi.hslf.record;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
import org.apache.poi.hslf.util.SystemTimeUtils;
|
|
||||||
import org.apache.poi.util.LittleEndian;
|
import org.apache.poi.util.LittleEndian;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -22,7 +22,6 @@ import org.apache.poi.util.POILogger;
|
|||||||
|
|
||||||
import org.apache.poi.ddf.*;
|
import org.apache.poi.ddf.*;
|
||||||
import org.apache.poi.hslf.model.ShapeTypes;
|
import org.apache.poi.hslf.model.ShapeTypes;
|
||||||
import org.apache.poi.hslf.model.Shape;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
@ -44,8 +43,7 @@ import java.util.Iterator;
|
|||||||
|
|
||||||
// For now, pretending to be an atom. Might not always be, but that
|
// For now, pretending to be an atom. Might not always be, but that
|
||||||
// would require a wrapping class
|
// would require a wrapping class
|
||||||
public final class PPDrawing extends RecordAtom
|
public final class PPDrawing extends RecordAtom {
|
||||||
{
|
|
||||||
private byte[] _header;
|
private byte[] _header;
|
||||||
private long _type;
|
private long _type;
|
||||||
|
|
||||||
@ -110,7 +108,7 @@ public final class PPDrawing extends RecordAtom
|
|||||||
public PPDrawing(){
|
public PPDrawing(){
|
||||||
_header = new byte[8];
|
_header = new byte[8];
|
||||||
LittleEndian.putUShort(_header, 0, 15);
|
LittleEndian.putUShort(_header, 0, 15);
|
||||||
LittleEndian.putUShort(_header, 2, (int)RecordTypes.PPDrawing.typeID);
|
LittleEndian.putUShort(_header, 2, RecordTypes.PPDrawing.typeID);
|
||||||
LittleEndian.putInt(_header, 4, 0);
|
LittleEndian.putInt(_header, 4, 0);
|
||||||
|
|
||||||
textboxWrappers = new EscherTextboxWrapper[]{};
|
textboxWrappers = new EscherTextboxWrapper[]{};
|
||||||
@ -315,5 +313,4 @@ public final class PPDrawing extends RecordAtom
|
|||||||
}
|
}
|
||||||
return dg;
|
return dg;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,6 @@ import org.apache.poi.util.LittleEndian;
|
|||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -19,10 +19,6 @@ package org.apache.poi.hslf.record;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
import org.apache.poi.hslf.util.SystemTimeUtils;
|
|
||||||
import org.apache.poi.util.LittleEndian;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An atom record that specifies that a shape is a header or footer placeholder shape
|
* An atom record that specifies that a shape is a header or footer placeholder shape
|
||||||
@ -30,9 +26,7 @@ import org.apache.poi.util.LittleEndian;
|
|||||||
* @since PowerPoint 2007
|
* @since PowerPoint 2007
|
||||||
* @author Yegor Kozlov
|
* @author Yegor Kozlov
|
||||||
*/
|
*/
|
||||||
|
public final class RoundTripHFPlaceholder12 extends RecordAtom {
|
||||||
public final class RoundTripHFPlaceholder12 extends RecordAtom
|
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* Record header.
|
* Record header.
|
||||||
*/
|
*/
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
|
|
||||||
package org.apache.poi.hslf.record;
|
package org.apache.poi.hslf.record;
|
||||||
|
|
||||||
import org.apache.poi.util.ArrayUtil;
|
|
||||||
import org.apache.poi.util.LittleEndian;
|
import org.apache.poi.util.LittleEndian;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -46,8 +45,7 @@ import java.util.Vector;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
// For now, pretend to be an atom
|
// For now, pretend to be an atom
|
||||||
public final class SlideListWithText extends RecordContainer
|
public final class SlideListWithText extends RecordContainer {
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Instance filed of the record header indicates that this SlideListWithText stores
|
* Instance filed of the record header indicates that this SlideListWithText stores
|
||||||
|
@ -17,8 +17,6 @@
|
|||||||
|
|
||||||
package org.apache.poi.hslf.record;
|
package org.apache.poi.hslf.record;
|
||||||
|
|
||||||
import org.apache.poi.util.POILogger;
|
|
||||||
|
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
|
||||||
|
@ -17,11 +17,8 @@
|
|||||||
|
|
||||||
package org.apache.poi.hslf.record;
|
package org.apache.poi.hslf.record;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.util.zip.InflaterInputStream;
|
|
||||||
|
|
||||||
import org.apache.poi.util.LittleEndian;
|
import org.apache.poi.util.LittleEndian;
|
||||||
|
|
||||||
|
@ -17,11 +17,8 @@
|
|||||||
|
|
||||||
package org.apache.poi.hslf.record;
|
package org.apache.poi.hslf.record;
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.util.zip.InflaterInputStream;
|
|
||||||
|
|
||||||
import org.apache.poi.util.LittleEndian;
|
import org.apache.poi.util.LittleEndian;
|
||||||
import org.apache.poi.util.POILogger;
|
import org.apache.poi.util.POILogger;
|
||||||
|
@ -38,17 +38,14 @@ import org.apache.poi.hslf.model.Notes;
|
|||||||
import org.apache.poi.hslf.model.Slide;
|
import org.apache.poi.hslf.model.Slide;
|
||||||
import org.apache.poi.hslf.record.*;
|
import org.apache.poi.hslf.record.*;
|
||||||
import org.apache.poi.hslf.record.SlideListWithText.SlideAtomsSet;
|
import org.apache.poi.hslf.record.SlideListWithText.SlideAtomsSet;
|
||||||
import org.apache.poi.util.ArrayUtil;
|
|
||||||
import org.apache.poi.util.POILogFactory;
|
import org.apache.poi.util.POILogFactory;
|
||||||
import org.apache.poi.util.POILogger;
|
import org.apache.poi.util.POILogger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class is a friendly wrapper on top of the more scary HSLFSlideShow.
|
* This class is a friendly wrapper on top of the more scary HSLFSlideShow.
|
||||||
*
|
*
|
||||||
* TODO:
|
* TODO: - figure out how to match notes to their correct sheet (will involve
|
||||||
* - figure out how to match notes to their correct sheet
|
* understanding DocSlideList and DocNotesList) - handle Slide creation cleaner
|
||||||
* (will involve understanding DocSlideList and DocNotesList)
|
|
||||||
* - handle Slide creation cleaner
|
|
||||||
*
|
*
|
||||||
* @author Nick Burch
|
* @author Nick Burch
|
||||||
* @author Yegor kozlov
|
* @author Yegor kozlov
|
||||||
@ -125,8 +122,7 @@ public final class SlideShow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find the records that are parent-aware, and tell them
|
* Find the records that are parent-aware, and tell them who their parent is
|
||||||
* who their parent is
|
|
||||||
*/
|
*/
|
||||||
private void handleParentAwareRecords(Record baseRecord) {
|
private void handleParentAwareRecords(Record baseRecord) {
|
||||||
// Only need to do something if this is a container record
|
// Only need to do something if this is a container record
|
||||||
@ -149,13 +145,11 @@ public final class SlideShow {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use the PersistPtrHolder entries to figure out what is
|
* Use the PersistPtrHolder entries to figure out what is the "most recent"
|
||||||
* the "most recent" version of all the core records
|
* version of all the core records (Document, Notes, Slide etc), and save a
|
||||||
* (Document, Notes, Slide etc), and save a record of them.
|
* record of them. Do this by walking from the oldest PersistPtr to the
|
||||||
* Do this by walking from the oldest PersistPtr to the newest,
|
* newest, overwriting any references found along the way with newer ones
|
||||||
* overwriting any references found along the way with newer ones
|
|
||||||
*/
|
*/
|
||||||
private void findMostRecentCoreRecords() {
|
private void findMostRecentCoreRecords() {
|
||||||
// To start with, find the most recent in the byte offset domain
|
// To start with, find the most recent in the byte offset domain
|
||||||
@ -214,14 +208,12 @@ public final class SlideShow {
|
|||||||
|
|
||||||
if (thatRecordAt.equals(recordAt)) {
|
if (thatRecordAt.equals(recordAt)) {
|
||||||
// Bingo. Now, where do we store it?
|
// Bingo. Now, where do we store it?
|
||||||
Integer storeAtI =
|
Integer storeAtI = (Integer) _sheetIdToCoreRecordsLookup.get(thisID);
|
||||||
(Integer)_sheetIdToCoreRecordsLookup.get(thisID);
|
|
||||||
int storeAt = storeAtI.intValue();
|
int storeAt = storeAtI.intValue();
|
||||||
|
|
||||||
// Tell it its Sheet ID, if it cares
|
// Tell it its Sheet ID, if it cares
|
||||||
if (pdr instanceof PositionDependentRecordContainer) {
|
if (pdr instanceof PositionDependentRecordContainer) {
|
||||||
PositionDependentRecordContainer pdrc =
|
PositionDependentRecordContainer pdrc = (PositionDependentRecordContainer) _records[i];
|
||||||
(PositionDependentRecordContainer)_records[i];
|
|
||||||
pdrc.setSheetId(thisID.intValue());
|
pdrc.setSheetId(thisID.intValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -249,8 +241,8 @@ public final class SlideShow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* For a given SlideAtomsSet, return the core record, based on the refID from the
|
* For a given SlideAtomsSet, return the core record, based on the refID
|
||||||
* SlidePersistAtom
|
* from the SlidePersistAtom
|
||||||
*/
|
*/
|
||||||
private Record getCoreRecordForSAS(SlideAtomsSet sas) {
|
private Record getCoreRecordForSAS(SlideAtomsSet sas) {
|
||||||
SlidePersistAtom spa = sas.getSlidePersistAtom();
|
SlidePersistAtom spa = sas.getSlidePersistAtom();
|
||||||
@ -261,16 +253,19 @@ public final class SlideShow {
|
|||||||
/**
|
/**
|
||||||
* For a given refID (the internal, 0 based numbering scheme), return the
|
* For a given refID (the internal, 0 based numbering scheme), return the
|
||||||
* core record
|
* core record
|
||||||
* @param refID the refID
|
*
|
||||||
|
* @param refID
|
||||||
|
* the refID
|
||||||
*/
|
*/
|
||||||
private Record getCoreRecordForRefID(int refID) {
|
private Record getCoreRecordForRefID(int refID) {
|
||||||
Integer coreRecordId = (Integer)
|
Integer coreRecordId = (Integer) _sheetIdToCoreRecordsLookup.get(new Integer(refID));
|
||||||
_sheetIdToCoreRecordsLookup.get(new Integer(refID));
|
|
||||||
if (coreRecordId != null) {
|
if (coreRecordId != null) {
|
||||||
Record r = _mostRecentCoreRecords[coreRecordId.intValue()];
|
Record r = _mostRecentCoreRecords[coreRecordId.intValue()];
|
||||||
return r;
|
return r;
|
||||||
} else {
|
} else {
|
||||||
logger.log(POILogger.ERROR, "We tried to look up a reference to a core record, but there was no core ID for reference ID " + refID);
|
logger.log(POILogger.ERROR,
|
||||||
|
"We tried to look up a reference to a core record, but there was no core ID for reference ID "
|
||||||
|
+ refID);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -283,10 +278,10 @@ public final class SlideShow {
|
|||||||
// Ensure we really found a Document record earlier
|
// Ensure we really found a Document record earlier
|
||||||
// If we didn't, then the file is probably corrupt
|
// If we didn't, then the file is probably corrupt
|
||||||
if (_documentRecord == null) {
|
if (_documentRecord == null) {
|
||||||
throw new CorruptPowerPointFileException("The PowerPoint file didn't contain a Document Record in its PersistPtr blocks. It is probably corrupt.");
|
throw new CorruptPowerPointFileException(
|
||||||
|
"The PowerPoint file didn't contain a Document Record in its PersistPtr blocks. It is probably corrupt.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Fetch the SlideListWithTexts in the most up-to-date Document Record
|
// Fetch the SlideListWithTexts in the most up-to-date Document Record
|
||||||
//
|
//
|
||||||
// As far as we understand it:
|
// As far as we understand it:
|
||||||
@ -325,11 +320,13 @@ public final class SlideShow {
|
|||||||
SlideAtomsSet sas = masterSets[i];
|
SlideAtomsSet sas = masterSets[i];
|
||||||
int sheetNo = sas.getSlidePersistAtom().getSlideIdentifier();
|
int sheetNo = sas.getSlidePersistAtom().getSlideIdentifier();
|
||||||
if (r instanceof org.apache.poi.hslf.record.Slide) {
|
if (r instanceof org.apache.poi.hslf.record.Slide) {
|
||||||
TitleMaster master = new TitleMaster((org.apache.poi.hslf.record.Slide)r, sheetNo);
|
TitleMaster master = new TitleMaster((org.apache.poi.hslf.record.Slide) r,
|
||||||
|
sheetNo);
|
||||||
master.setSlideShow(this);
|
master.setSlideShow(this);
|
||||||
tmr.add(master);
|
tmr.add(master);
|
||||||
} else if (r instanceof org.apache.poi.hslf.record.MainMaster) {
|
} else if (r instanceof org.apache.poi.hslf.record.MainMaster) {
|
||||||
SlideMaster master = new SlideMaster((org.apache.poi.hslf.record.MainMaster)r, sheetNo);
|
SlideMaster master = new SlideMaster((org.apache.poi.hslf.record.MainMaster) r,
|
||||||
|
sheetNo);
|
||||||
master.setSlideShow(this);
|
master.setSlideShow(this);
|
||||||
mmr.add(master);
|
mmr.add(master);
|
||||||
}
|
}
|
||||||
@ -343,10 +340,8 @@ public final class SlideShow {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Having sorted out the masters, that leaves the notes and slides
|
// Having sorted out the masters, that leaves the notes and slides
|
||||||
|
|
||||||
|
|
||||||
// Start by finding the notes records to go with the entries in
|
// Start by finding the notes records to go with the entries in
|
||||||
// notesSLWT
|
// notesSLWT
|
||||||
org.apache.poi.hslf.record.Notes[] notesRecords;
|
org.apache.poi.hslf.record.Notes[] notesRecords;
|
||||||
@ -373,12 +368,14 @@ public final class SlideShow {
|
|||||||
Integer slideId = new Integer(spa.getSlideIdentifier());
|
Integer slideId = new Integer(spa.getSlideIdentifier());
|
||||||
slideIdToNotes.put(slideId, new Integer(i));
|
slideIdToNotes.put(slideId, new Integer(i));
|
||||||
} else {
|
} else {
|
||||||
logger.log(POILogger.ERROR, "A Notes SlideAtomSet at " + i + " said its record was at refID " + notesSets[i].getSlidePersistAtom().getRefID() + ", but that was actually a " + r);
|
logger.log(POILogger.ERROR, "A Notes SlideAtomSet at " + i
|
||||||
|
+ " said its record was at refID "
|
||||||
|
+ notesSets[i].getSlidePersistAtom().getRefID()
|
||||||
|
+ ", but that was actually a " + r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
notesRecords = new org.apache.poi.hslf.record.Notes[notesRecordsL.size()];
|
notesRecords = new org.apache.poi.hslf.record.Notes[notesRecordsL.size()];
|
||||||
notesRecords = (org.apache.poi.hslf.record.Notes[])
|
notesRecords = (org.apache.poi.hslf.record.Notes[]) notesRecordsL.toArray(notesRecords);
|
||||||
notesRecordsL.toArray(notesRecords);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now, do the same thing for our slides
|
// Now, do the same thing for our slides
|
||||||
@ -399,7 +396,10 @@ public final class SlideShow {
|
|||||||
if (r instanceof org.apache.poi.hslf.record.Slide) {
|
if (r instanceof org.apache.poi.hslf.record.Slide) {
|
||||||
slidesRecords[i] = (org.apache.poi.hslf.record.Slide) r;
|
slidesRecords[i] = (org.apache.poi.hslf.record.Slide) r;
|
||||||
} else {
|
} else {
|
||||||
logger.log(POILogger.ERROR, "A Slide SlideAtomSet at " + i + " said its record was at refID " + slidesSets[i].getSlidePersistAtom().getRefID() + ", but that was actually a " + r);
|
logger.log(POILogger.ERROR, "A Slide SlideAtomSet at " + i
|
||||||
|
+ " said its record was at refID "
|
||||||
|
+ slidesSets[i].getSlidePersistAtom().getRefID()
|
||||||
|
+ ", but that was actually a " + r);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -419,12 +419,15 @@ public final class SlideShow {
|
|||||||
|
|
||||||
// Do we have a notes for this?
|
// Do we have a notes for this?
|
||||||
Notes notes = null;
|
Notes notes = null;
|
||||||
//Slide.SlideAtom.notesId references the corresponding notes slide. 0 if slide has no notes.
|
// Slide.SlideAtom.notesId references the corresponding notes slide.
|
||||||
|
// 0 if slide has no notes.
|
||||||
int noteId = slidesRecords[i].getSlideAtom().getNotesID();
|
int noteId = slidesRecords[i].getSlideAtom().getNotesID();
|
||||||
if (noteId != 0) {
|
if (noteId != 0) {
|
||||||
Integer notesPos = (Integer) slideIdToNotes.get(new Integer(noteId));
|
Integer notesPos = (Integer) slideIdToNotes.get(new Integer(noteId));
|
||||||
if (notesPos != null) notes = _notes[notesPos.intValue()];
|
if (notesPos != null)
|
||||||
else logger.log(POILogger.ERROR, "Notes not found for noteId=" + noteId);
|
notes = _notes[notesPos.intValue()];
|
||||||
|
else
|
||||||
|
logger.log(POILogger.ERROR, "Notes not found for noteId=" + noteId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now, build our slide
|
// Now, build our slide
|
||||||
@ -434,48 +437,61 @@ public final class SlideShow {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Writes out the slideshow file the is represented by an instance of
|
* Writes out the slideshow file the is represented by an instance of this
|
||||||
* this class
|
* class
|
||||||
* @param out The OutputStream to write to.
|
*
|
||||||
* @throws IOException If there is an unexpected IOException from the passed
|
* @param out
|
||||||
* in OutputStream
|
* The OutputStream to write to.
|
||||||
|
* @throws IOException
|
||||||
|
* If there is an unexpected IOException from the passed in
|
||||||
|
* OutputStream
|
||||||
*/
|
*/
|
||||||
public void write(OutputStream out) throws IOException {
|
public void write(OutputStream out) throws IOException {
|
||||||
_hslfSlideShow.write(out);
|
_hslfSlideShow.write(out);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
/* ===============================================================
|
* ===============================================================
|
||||||
* Accessor Code
|
* Accessor Code
|
||||||
* ===============================================================
|
* ===============================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an array of the most recent version of all the interesting
|
* Returns an array of the most recent version of all the interesting
|
||||||
* records
|
* records
|
||||||
*/
|
*/
|
||||||
public Record[] getMostRecentCoreRecords() { return _mostRecentCoreRecords; }
|
public Record[] getMostRecentCoreRecords() {
|
||||||
|
return _mostRecentCoreRecords;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an array of all the normal Slides found in the slideshow
|
* Returns an array of all the normal Slides found in the slideshow
|
||||||
*/
|
*/
|
||||||
public Slide[] getSlides() { return _slides; }
|
public Slide[] getSlides() {
|
||||||
|
return _slides;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an array of all the normal Notes found in the slideshow
|
* Returns an array of all the normal Notes found in the slideshow
|
||||||
*/
|
*/
|
||||||
public Notes[] getNotes() { return _notes; }
|
public Notes[] getNotes() {
|
||||||
|
return _notes;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an array of all the normal Slide Masters found in the slideshow
|
* Returns an array of all the normal Slide Masters found in the slideshow
|
||||||
*/
|
*/
|
||||||
public SlideMaster[] getSlidesMasters() { return _masters; }
|
public SlideMaster[] getSlidesMasters() {
|
||||||
|
return _masters;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an array of all the normal Title Masters found in the slideshow
|
* Returns an array of all the normal Title Masters found in the slideshow
|
||||||
*/
|
*/
|
||||||
public TitleMaster[] getTitleMasters() { return _titleMasters; }
|
public TitleMaster[] getTitleMasters() {
|
||||||
|
return _titleMasters;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the data of all the pictures attached to the SlideShow
|
* Returns the data of all the pictures attached to the SlideShow
|
||||||
*/
|
*/
|
||||||
@ -510,7 +526,8 @@ public final class SlideShow {
|
|||||||
/**
|
/**
|
||||||
* Change the current page size
|
* Change the current page size
|
||||||
*
|
*
|
||||||
* @param pgsize page size (in points)
|
* @param pgsize
|
||||||
|
* page size (in points)
|
||||||
*/
|
*/
|
||||||
public void setPageSize(Dimension pgsize) {
|
public void setPageSize(Dimension pgsize) {
|
||||||
DocumentAtom docatom = _documentRecord.getDocumentAtom();
|
DocumentAtom docatom = _documentRecord.getDocumentAtom();
|
||||||
@ -521,23 +538,30 @@ public final class SlideShow {
|
|||||||
/**
|
/**
|
||||||
* Helper method for usermodel: Get the font collection
|
* Helper method for usermodel: Get the font collection
|
||||||
*/
|
*/
|
||||||
protected FontCollection getFontCollection() { return _fonts; }
|
protected FontCollection getFontCollection() {
|
||||||
|
return _fonts;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper method for usermodel and model: Get the document record
|
* Helper method for usermodel and model: Get the document record
|
||||||
*/
|
*/
|
||||||
public Document getDocumentRecord() { return _documentRecord; }
|
public Document getDocumentRecord() {
|
||||||
|
return _documentRecord;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
/* ===============================================================
|
* ===============================================================
|
||||||
* Re-ordering Code
|
* Re-ordering Code
|
||||||
* ===============================================================
|
* ===============================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Re-orders a slide, to a new position.
|
* Re-orders a slide, to a new position.
|
||||||
* @param oldSlideNumber The old slide number (1 based)
|
*
|
||||||
* @param newSlideNumber The new slide number (1 based)
|
* @param oldSlideNumber
|
||||||
|
* The old slide number (1 based)
|
||||||
|
* @param newSlideNumber
|
||||||
|
* The new slide number (1 based)
|
||||||
*/
|
*/
|
||||||
public void reorderSlide(int oldSlideNumber, int newSlideNumber) {
|
public void reorderSlide(int oldSlideNumber, int newSlideNumber) {
|
||||||
// Ensure these numbers are valid
|
// Ensure these numbers are valid
|
||||||
@ -545,10 +569,13 @@ public final class SlideShow {
|
|||||||
throw new IllegalArgumentException("Old and new slide numbers must be greater than 0");
|
throw new IllegalArgumentException("Old and new slide numbers must be greater than 0");
|
||||||
}
|
}
|
||||||
if (oldSlideNumber > _slides.length || newSlideNumber > _slides.length) {
|
if (oldSlideNumber > _slides.length || newSlideNumber > _slides.length) {
|
||||||
throw new IllegalArgumentException("Old and new slide numbers must not exceed the number of slides (" + _slides.length + ")");
|
throw new IllegalArgumentException(
|
||||||
|
"Old and new slide numbers must not exceed the number of slides ("
|
||||||
|
+ _slides.length + ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
// The order of slides is defined by the order of slide atom sets in the SlideListWithText container.
|
// The order of slides is defined by the order of slide atom sets in the
|
||||||
|
// SlideListWithText container.
|
||||||
SlideListWithText slwt = _documentRecord.getSlideSlideListWithText();
|
SlideListWithText slwt = _documentRecord.getSlideSlideListWithText();
|
||||||
SlideAtomsSet[] sas = slwt.getSlideAtomsSets();
|
SlideAtomsSet[] sas = slwt.getSlideAtomsSets();
|
||||||
|
|
||||||
@ -571,16 +598,20 @@ public final class SlideShow {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes the slide at the given index (0-based).
|
* Removes the slide at the given index (0-based).
|
||||||
* <p>Shifts any subsequent slides to the left (subtracts one from their slide numbers).</p>
|
* <p>
|
||||||
|
* Shifts any subsequent slides to the left (subtracts one from their slide
|
||||||
|
* numbers).
|
||||||
|
* </p>
|
||||||
*
|
*
|
||||||
* @param index the index of the slide to remove (0-based)
|
* @param index
|
||||||
|
* the index of the slide to remove (0-based)
|
||||||
* @return the slide that was removed from the slide show.
|
* @return the slide that was removed from the slide show.
|
||||||
*/
|
*/
|
||||||
public Slide removeSlide(int index) {
|
public Slide removeSlide(int index) {
|
||||||
int lastSlideIdx = _slides.length - 1;
|
int lastSlideIdx = _slides.length - 1;
|
||||||
if (index < 0 || index > lastSlideIdx) {
|
if (index < 0 || index > lastSlideIdx) {
|
||||||
throw new IllegalArgumentException("Slide index ("
|
throw new IllegalArgumentException("Slide index (" + index + ") is out of range (0.."
|
||||||
+ index +") is out of range (0.." + lastSlideIdx + ")");
|
+ lastSlideIdx + ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
SlideListWithText slwt = _documentRecord.getSlideSlideListWithText();
|
SlideListWithText slwt = _documentRecord.getSlideSlideListWithText();
|
||||||
@ -592,7 +623,8 @@ public final class SlideShow {
|
|||||||
ArrayList<Slide> sl = new ArrayList<Slide>();
|
ArrayList<Slide> sl = new ArrayList<Slide>();
|
||||||
|
|
||||||
ArrayList<Notes> nt = new ArrayList<Notes>();
|
ArrayList<Notes> nt = new ArrayList<Notes>();
|
||||||
for(Notes notes : getNotes()) nt.add(notes);
|
for (Notes notes : getNotes())
|
||||||
|
nt.add(notes);
|
||||||
|
|
||||||
for (int i = 0, num = 0; i < _slides.length; i++) {
|
for (int i = 0, num = 0; i < _slides.length; i++) {
|
||||||
if (i != index) {
|
if (i != index) {
|
||||||
@ -626,7 +658,8 @@ public final class SlideShow {
|
|||||||
if (ns.getSlidePersistAtom().getSlideIdentifier() != notesId) {
|
if (ns.getSlidePersistAtom().getSlideIdentifier() != notesId) {
|
||||||
na.add(ns);
|
na.add(ns);
|
||||||
records.add(ns.getSlidePersistAtom());
|
records.add(ns.getSlidePersistAtom());
|
||||||
if(ns.getSlideRecords() != null) records.addAll(Arrays.asList(ns.getSlideRecords()));
|
if (ns.getSlideRecords() != null)
|
||||||
|
records.addAll(Arrays.asList(ns.getSlideRecords()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (na.size() == 0) {
|
if (na.size() == 0) {
|
||||||
@ -643,12 +676,12 @@ public final class SlideShow {
|
|||||||
return removedSlide;
|
return removedSlide;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ===============================================================
|
/*
|
||||||
|
* ===============================================================
|
||||||
* Addition Code
|
* Addition Code
|
||||||
* ===============================================================
|
* ===============================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a blank <code>Slide</code>.
|
* Create a blank <code>Slide</code>.
|
||||||
*
|
*
|
||||||
@ -680,7 +713,9 @@ public final class SlideShow {
|
|||||||
// Odd, since we only deal with the Slide SLWT
|
// Odd, since we only deal with the Slide SLWT
|
||||||
} else {
|
} else {
|
||||||
// Must be for a real slide
|
// Must be for a real slide
|
||||||
if(prev == null) { prev = spa; }
|
if (prev == null) {
|
||||||
|
prev = spa;
|
||||||
|
}
|
||||||
if (prev.getSlideIdentifier() < spa.getSlideIdentifier()) {
|
if (prev.getSlideIdentifier() < spa.getSlideIdentifier()) {
|
||||||
prev = spa;
|
prev = spa;
|
||||||
}
|
}
|
||||||
@ -696,7 +731,6 @@ public final class SlideShow {
|
|||||||
// Add this new SlidePersistAtom to the SlideListWithText
|
// Add this new SlidePersistAtom to the SlideListWithText
|
||||||
slist.addSlidePersistAtom(sp);
|
slist.addSlidePersistAtom(sp);
|
||||||
|
|
||||||
|
|
||||||
// Create a new Slide
|
// Create a new Slide
|
||||||
Slide slide = new Slide(sp.getSlideIdentifier(), sp.getRefID(), _slides.length + 1);
|
Slide slide = new Slide(sp.getSlideIdentifier(), sp.getRefID(), _slides.length + 1);
|
||||||
slide.setSlideShow(this);
|
slide.setSlideShow(this);
|
||||||
@ -707,14 +741,14 @@ public final class SlideShow {
|
|||||||
System.arraycopy(_slides, 0, s, 0, _slides.length);
|
System.arraycopy(_slides, 0, s, 0, _slides.length);
|
||||||
s[_slides.length] = slide;
|
s[_slides.length] = slide;
|
||||||
_slides = s;
|
_slides = s;
|
||||||
logger.log(POILogger.INFO, "Added slide " + _slides.length + " with ref " + sp.getRefID() + " and identifier " + sp.getSlideIdentifier());
|
logger.log(POILogger.INFO, "Added slide " + _slides.length + " with ref " + sp.getRefID()
|
||||||
|
+ " and identifier " + sp.getSlideIdentifier());
|
||||||
|
|
||||||
// Add the core records for this new Slide to the record tree
|
// Add the core records for this new Slide to the record tree
|
||||||
org.apache.poi.hslf.record.Slide slideRecord = slide.getSlideRecord();
|
org.apache.poi.hslf.record.Slide slideRecord = slide.getSlideRecord();
|
||||||
int slideRecordPos = _hslfSlideShow.appendRootLevelRecord(slideRecord);
|
int slideRecordPos = _hslfSlideShow.appendRootLevelRecord(slideRecord);
|
||||||
_records = _hslfSlideShow.getRecords();
|
_records = _hslfSlideShow.getRecords();
|
||||||
|
|
||||||
|
|
||||||
// Add the new Slide into the PersistPtr stuff
|
// Add the new Slide into the PersistPtr stuff
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
int slideOffset = 0;
|
int slideOffset = 0;
|
||||||
@ -750,7 +784,8 @@ public final class SlideShow {
|
|||||||
|
|
||||||
// Last view is now of the slide
|
// Last view is now of the slide
|
||||||
usr.setLastViewType((short) UserEditAtom.LAST_VIEW_SLIDE_VIEW);
|
usr.setLastViewType((short) UserEditAtom.LAST_VIEW_SLIDE_VIEW);
|
||||||
usr.setMaxPersistWritten(psrId); //increment the number of persit objects
|
usr.setMaxPersistWritten(psrId); // increment the number of persit
|
||||||
|
// objects
|
||||||
|
|
||||||
// Add the new slide into the last PersistPtr
|
// Add the new slide into the last PersistPtr
|
||||||
// (Also need to tell it where it is)
|
// (Also need to tell it where it is)
|
||||||
@ -766,8 +801,11 @@ public final class SlideShow {
|
|||||||
/**
|
/**
|
||||||
* Adds a picture to this presentation and returns the associated index.
|
* Adds a picture to this presentation and returns the associated index.
|
||||||
*
|
*
|
||||||
* @param data picture data
|
* @param data
|
||||||
* @param format the format of the picture. One of constans defined in the <code>Picture</code> class.
|
* picture data
|
||||||
|
* @param format
|
||||||
|
* the format of the picture. One of constans defined in the
|
||||||
|
* <code>Picture</code> class.
|
||||||
* @return the index to this picture (1 based).
|
* @return the index to this picture (1 based).
|
||||||
*/
|
*/
|
||||||
public int addPicture(byte[] data, int format) throws IOException {
|
public int addPicture(byte[] data, int format) throws IOException {
|
||||||
@ -776,7 +814,8 @@ public final class SlideShow {
|
|||||||
EscherContainerRecord bstore;
|
EscherContainerRecord bstore;
|
||||||
|
|
||||||
EscherContainerRecord dggContainer = _documentRecord.getPPDrawingGroup().getDggContainer();
|
EscherContainerRecord dggContainer = _documentRecord.getPPDrawingGroup().getDggContainer();
|
||||||
bstore = (EscherContainerRecord)Shape.getEscherChild(dggContainer, EscherContainerRecord.BSTORE_CONTAINER);
|
bstore = (EscherContainerRecord) Shape.getEscherChild(dggContainer,
|
||||||
|
EscherContainerRecord.BSTORE_CONTAINER);
|
||||||
if (bstore == null) {
|
if (bstore == null) {
|
||||||
bstore = new EscherContainerRecord();
|
bstore = new EscherContainerRecord();
|
||||||
bstore.setRecordId(EscherContainerRecord.BSTORE_CONTAINER);
|
bstore.setRecordId(EscherContainerRecord.BSTORE_CONTAINER);
|
||||||
@ -806,9 +845,12 @@ public final class SlideShow {
|
|||||||
bse.setBlipTypeMacOS((byte) format);
|
bse.setBlipTypeMacOS((byte) format);
|
||||||
bse.setBlipTypeWin32((byte) format);
|
bse.setBlipTypeWin32((byte) format);
|
||||||
|
|
||||||
if (format == Picture.EMF) bse.setBlipTypeMacOS((byte)Picture.PICT);
|
if (format == Picture.EMF)
|
||||||
else if (format == Picture.WMF) bse.setBlipTypeMacOS((byte)Picture.PICT);
|
bse.setBlipTypeMacOS((byte) Picture.PICT);
|
||||||
else if (format == Picture.PICT) bse.setBlipTypeWin32((byte)Picture.WMF);
|
else if (format == Picture.WMF)
|
||||||
|
bse.setBlipTypeMacOS((byte) Picture.PICT);
|
||||||
|
else if (format == Picture.PICT)
|
||||||
|
bse.setBlipTypeWin32((byte) Picture.WMF);
|
||||||
|
|
||||||
bse.setRef(0);
|
bse.setRef(0);
|
||||||
bse.setOffset(offset);
|
bse.setOffset(offset);
|
||||||
@ -824,8 +866,11 @@ public final class SlideShow {
|
|||||||
/**
|
/**
|
||||||
* Adds a picture to this presentation and returns the associated index.
|
* Adds a picture to this presentation and returns the associated index.
|
||||||
*
|
*
|
||||||
* @param pict the file containing the image to add
|
* @param pict
|
||||||
* @param format the format of the picture. One of constans defined in the <code>Picture</code> class.
|
* the file containing the image to add
|
||||||
|
* @param format
|
||||||
|
* the format of the picture. One of constans defined in the
|
||||||
|
* <code>Picture</code> class.
|
||||||
* @return the index to this picture (1 based).
|
* @return the index to this picture (1 based).
|
||||||
*/
|
*/
|
||||||
public int addPicture(File pict, int format) throws IOException {
|
public int addPicture(File pict, int format) throws IOException {
|
||||||
@ -844,14 +889,16 @@ public final class SlideShow {
|
|||||||
/**
|
/**
|
||||||
* Add a font in this presentation
|
* Add a font in this presentation
|
||||||
*
|
*
|
||||||
* @param font the font to add
|
* @param font
|
||||||
|
* the font to add
|
||||||
* @return 0-based index of the font
|
* @return 0-based index of the font
|
||||||
*/
|
*/
|
||||||
public int addFont(PPFont font) {
|
public int addFont(PPFont font) {
|
||||||
FontCollection fonts = getDocumentRecord().getEnvironment().getFontCollection();
|
FontCollection fonts = getDocumentRecord().getEnvironment().getFontCollection();
|
||||||
int idx = fonts.getFontIndex(font.getFontName());
|
int idx = fonts.getFontIndex(font.getFontName());
|
||||||
if (idx == -1) {
|
if (idx == -1) {
|
||||||
idx = fonts.addFont(font.getFontName(), font.getCharSet(), font.getFontFlags(), font.getFontType(), font.getPitchAndFamily());
|
idx = fonts.addFont(font.getFontName(), font.getCharSet(), font.getFontFlags(), font
|
||||||
|
.getFontType(), font.getPitchAndFamily());
|
||||||
}
|
}
|
||||||
return idx;
|
return idx;
|
||||||
}
|
}
|
||||||
@ -859,8 +906,10 @@ public final class SlideShow {
|
|||||||
/**
|
/**
|
||||||
* Get a font by index
|
* Get a font by index
|
||||||
*
|
*
|
||||||
* @param idx 0-based index of the font
|
* @param idx
|
||||||
* @return of an instance of <code>PPFont</code> or <code>null</code> if not found
|
* 0-based index of the font
|
||||||
|
* @return of an instance of <code>PPFont</code> or <code>null</code> if not
|
||||||
|
* found
|
||||||
*/
|
*/
|
||||||
public PPFont getFont(int idx) {
|
public PPFont getFont(int idx) {
|
||||||
PPFont font = null;
|
PPFont font = null;
|
||||||
@ -900,8 +949,8 @@ public final class SlideShow {
|
|||||||
HeadersFootersContainer hdd = null;
|
HeadersFootersContainer hdd = null;
|
||||||
Record[] ch = _documentRecord.getChildRecords();
|
Record[] ch = _documentRecord.getChildRecords();
|
||||||
for (int i = 0; i < ch.length; i++) {
|
for (int i = 0; i < ch.length; i++) {
|
||||||
if(ch[i] instanceof HeadersFootersContainer &&
|
if (ch[i] instanceof HeadersFootersContainer
|
||||||
((HeadersFootersContainer)ch[i]).getOptions() == HeadersFootersContainer.SlideHeadersFootersContainer){
|
&& ((HeadersFootersContainer) ch[i]).getOptions() == HeadersFootersContainer.SlideHeadersFootersContainer) {
|
||||||
hdd = (HeadersFootersContainer) ch[i];
|
hdd = (HeadersFootersContainer) ch[i];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -927,8 +976,8 @@ public final class SlideShow {
|
|||||||
HeadersFootersContainer hdd = null;
|
HeadersFootersContainer hdd = null;
|
||||||
Record[] ch = _documentRecord.getChildRecords();
|
Record[] ch = _documentRecord.getChildRecords();
|
||||||
for (int i = 0; i < ch.length; i++) {
|
for (int i = 0; i < ch.length; i++) {
|
||||||
if(ch[i] instanceof HeadersFootersContainer &&
|
if (ch[i] instanceof HeadersFootersContainer
|
||||||
((HeadersFootersContainer)ch[i]).getOptions() == HeadersFootersContainer.NotesHeadersFootersContainer){
|
&& ((HeadersFootersContainer) ch[i]).getOptions() == HeadersFootersContainer.NotesHeadersFootersContainer) {
|
||||||
hdd = (HeadersFootersContainer) ch[i];
|
hdd = (HeadersFootersContainer) ch[i];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -948,7 +997,8 @@ public final class SlideShow {
|
|||||||
/**
|
/**
|
||||||
* Add a movie in this presentation
|
* Add a movie in this presentation
|
||||||
*
|
*
|
||||||
* @param path the path or url to the movie
|
* @param path
|
||||||
|
* the path or url to the movie
|
||||||
* @return 0-based index of the movie
|
* @return 0-based index of the movie
|
||||||
*/
|
*/
|
||||||
public int addMovie(String path, int type) {
|
public int addMovie(String path, int type) {
|
||||||
@ -985,8 +1035,11 @@ public final class SlideShow {
|
|||||||
/**
|
/**
|
||||||
* Add a control in this presentation
|
* Add a control in this presentation
|
||||||
*
|
*
|
||||||
* @param name name of the control, e.g. "Shockwave Flash Object"
|
* @param name
|
||||||
* @param progId OLE Programmatic Identifier, e.g. "ShockwaveFlash.ShockwaveFlash.9"
|
* name of the control, e.g. "Shockwave Flash Object"
|
||||||
|
* @param progId
|
||||||
|
* OLE Programmatic Identifier, e.g.
|
||||||
|
* "ShockwaveFlash.ShockwaveFlash.9"
|
||||||
* @return 0-based index of the control
|
* @return 0-based index of the control
|
||||||
*/
|
*/
|
||||||
public int addControl(String name, String progId) {
|
public int addControl(String name, String progId) {
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
|
|
||||||
package org.apache.poi.hwpf.model;
|
package org.apache.poi.hwpf.model;
|
||||||
|
|
||||||
import org.apache.poi.util.LittleEndian;
|
|
||||||
import org.apache.poi.hwpf.model.types.DOPAbstractType;
|
import org.apache.poi.hwpf.model.types.DOPAbstractType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -25,13 +24,10 @@ import org.apache.poi.hwpf.model.types.DOPAbstractType;
|
|||||||
*
|
*
|
||||||
* @author Ryan Ackley
|
* @author Ryan Ackley
|
||||||
*/
|
*/
|
||||||
|
public final class DocumentProperties extends DOPAbstractType {
|
||||||
public final class DocumentProperties extends DOPAbstractType
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
public DocumentProperties(byte[] tableStream, int offset)
|
public DocumentProperties(byte[] tableStream, int offset) {
|
||||||
{
|
|
||||||
super.fillFields(tableStream, offset);
|
super.fillFields(tableStream, offset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user