You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by ba...@apache.org on 2006/12/22 21:56:06 UTC
svn commit: r489760 [1/8] - in /jakarta/poi/trunk/src:
java/org/apache/poi/hssf/record/ java/org/apache/poi/hssf/record/formula/
java/org/apache/poi/hssf/util/ scratchpad/src/org/apache/poi/hslf/blip/
scratchpad/src/org/apache/poi/hslf/extractor/ scrat...
Author: bayard
Date: Fri Dec 22 12:56:04 2006
New Revision: 489760
URL: http://svn.apache.org/viewvc?view=rev&rev=489760
Log:
Applying dos2unix on some of the Java files. The copy2license script isn't picking up the dos line endings. Hopefully not a problem for anyone
Modified:
jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/FilePassRecord.java
jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/WriteProtectRecord.java
jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/AreaErrPtg.java
jakarta/poi/trunk/src/java/org/apache/poi/hssf/util/PaneInformation.java
jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/Bitmap.java
jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/DIB.java
jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/EMF.java
jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/JPEG.java
jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/Metafile.java
jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/PICT.java
jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/PNG.java
jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/WMF.java
jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/extractor/ImageExtractor.java
jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/AutoShape.java
jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/Background.java
jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/Fill.java
jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/Line.java
jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/PPGraphics2D.java
jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/Picture.java
jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/Placeholder.java
jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/Shape.java
jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/ShapeFactory.java
jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/ShapeGroup.java
jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/ShapeTypes.java
jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/SimpleShape.java
jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/model/TextBox.java
jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/OEPlaceholderAtom.java
jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/OutlineTextRefAtom.java
jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/record/PPDrawingGroup.java
jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/usermodel/PictureData.java
jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hssf/record/formula/functions/If.java
jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hssf/record/formula/functions/LogicalFunction.java
jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/SavedByEntry.java
jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hwpf/model/SavedByTable.java
jakarta/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestBackground.java
jakarta/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestPPGraphics2D.java
jakarta/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSetBoldItalic.java
jakarta/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestShapes.java
jakarta/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/model/TestSlides.java
jakarta/poi/trunk/src/scratchpad/testcases/org/apache/poi/hslf/usermodel/TestPictures.java
jakarta/poi/trunk/src/scratchpad/testcases/org/apache/poi/hwpf/model/TestSavedByTable.java
jakarta/poi/trunk/src/testcases/org/apache/poi/hpsf/basic/TestMetaDataIPI.java
jakarta/poi/trunk/src/testcases/org/apache/poi/hssf/record/formula/AbstractPtgTestCase.java
jakarta/poi/trunk/src/testcases/org/apache/poi/hssf/usermodel/TestUnicodeWorkbook.java
jakarta/poi/trunk/src/testcases/org/apache/poi/poifs/filesystem/TestPropertySorter.java
Modified: jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/FilePassRecord.java
URL: http://svn.apache.org/viewvc/jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/FilePassRecord.java?view=diff&rev=489760&r1=489759&r2=489760
==============================================================================
--- jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/FilePassRecord.java (original)
+++ jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/FilePassRecord.java Fri Dec 22 12:56:04 2006
@@ -1,106 +1,106 @@
-
-/* ====================================================================
- Copyright 2002-2004 Apache Software Foundation
-
- Licensed 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.record;
-
-import org.apache.poi.util.LittleEndian;
-
-/**
- * Title: File Pass Record<P>
- * Description: Indicates that the record after this record are encrypted. HSSF does not support encrypted excel workbooks
- * and the presence of this record will cause processing to be aborted.<p>
- * REFERENCE: PG 420 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
- * @author Jason Height (jheight at chariot dot net dot au)
- * @version 3.0-pre
- */
-
-public class FilePassRecord
- extends Record
-{
- public final static short sid = 0x2F;
- private int field_1_encryptedpassword;
-
- public FilePassRecord()
- {
- }
-
- /**
- * Constructs a FILEPASS record and sets its fields appropriately.
- *
- * @param id id must be 0x84 or an exception will be throw upon validation
- * @param size the size of the data area of the record
- * @param data data of the record (should not contain sid/len)
- */
-
- public FilePassRecord(RecordInputStream in)
- {
- super(in);
- }
-
- protected void validateSid(short id)
- {
- if (id != sid)
- {
- throw new RecordFormatException("NOT A FILEPASS RECORD");
- }
- }
-
- protected void fillFields(RecordInputStream in)
- {
- field_1_encryptedpassword = in.readInt();
-
- //Whilst i have read in the password, HSSF currently has no plans to support/decrypt the remainder
- //of this workbook
- throw new RecordFormatException("HSSF does not currently support encrypted workbooks");
- }
-
- public String toString()
- {
- StringBuffer buffer = new StringBuffer();
-
- buffer.append("[FILEPASS]\n");
- buffer.append(" .password = ").append(field_1_encryptedpassword)
- .append("\n");
- buffer.append("[/FILEPASS]\n");
- return buffer.toString();
- }
-
- public int serialize(int offset, byte [] data)
- {
- LittleEndian.putShort(data, 0 + offset, sid);
- LittleEndian.putShort(data, 2 + offset, ( short ) 0x4);
- LittleEndian.putInt(data, 4 + offset, ( short ) field_1_encryptedpassword);
- return getRecordSize();
- }
-
- public int getRecordSize()
- {
- return 8;
- }
-
- public short getSid()
- {
- return sid;
- }
-
- public Object clone() {
- FilePassRecord rec = new FilePassRecord();
- rec.field_1_encryptedpassword = field_1_encryptedpassword;
- return rec;
- }
-}
+
+/* ====================================================================
+ Copyright 2002-2004 Apache Software Foundation
+
+ Licensed 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.record;
+
+import org.apache.poi.util.LittleEndian;
+
+/**
+ * Title: File Pass Record<P>
+ * Description: Indicates that the record after this record are encrypted. HSSF does not support encrypted excel workbooks
+ * and the presence of this record will cause processing to be aborted.<p>
+ * REFERENCE: PG 420 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
+ * @author Jason Height (jheight at chariot dot net dot au)
+ * @version 3.0-pre
+ */
+
+public class FilePassRecord
+ extends Record
+{
+ public final static short sid = 0x2F;
+ private int field_1_encryptedpassword;
+
+ public FilePassRecord()
+ {
+ }
+
+ /**
+ * Constructs a FILEPASS record and sets its fields appropriately.
+ *
+ * @param id id must be 0x84 or an exception will be throw upon validation
+ * @param size the size of the data area of the record
+ * @param data data of the record (should not contain sid/len)
+ */
+
+ public FilePassRecord(RecordInputStream in)
+ {
+ super(in);
+ }
+
+ protected void validateSid(short id)
+ {
+ if (id != sid)
+ {
+ throw new RecordFormatException("NOT A FILEPASS RECORD");
+ }
+ }
+
+ protected void fillFields(RecordInputStream in)
+ {
+ field_1_encryptedpassword = in.readInt();
+
+ //Whilst i have read in the password, HSSF currently has no plans to support/decrypt the remainder
+ //of this workbook
+ throw new RecordFormatException("HSSF does not currently support encrypted workbooks");
+ }
+
+ public String toString()
+ {
+ StringBuffer buffer = new StringBuffer();
+
+ buffer.append("[FILEPASS]\n");
+ buffer.append(" .password = ").append(field_1_encryptedpassword)
+ .append("\n");
+ buffer.append("[/FILEPASS]\n");
+ return buffer.toString();
+ }
+
+ public int serialize(int offset, byte [] data)
+ {
+ LittleEndian.putShort(data, 0 + offset, sid);
+ LittleEndian.putShort(data, 2 + offset, ( short ) 0x4);
+ LittleEndian.putInt(data, 4 + offset, ( short ) field_1_encryptedpassword);
+ return getRecordSize();
+ }
+
+ public int getRecordSize()
+ {
+ return 8;
+ }
+
+ public short getSid()
+ {
+ return sid;
+ }
+
+ public Object clone() {
+ FilePassRecord rec = new FilePassRecord();
+ rec.field_1_encryptedpassword = field_1_encryptedpassword;
+ return rec;
+ }
+}
Modified: jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/WriteProtectRecord.java
URL: http://svn.apache.org/viewvc/jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/WriteProtectRecord.java?view=diff&rev=489760&r1=489759&r2=489760
==============================================================================
--- jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/WriteProtectRecord.java (original)
+++ jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/WriteProtectRecord.java Fri Dec 22 12:56:04 2006
@@ -1,91 +1,91 @@
-
-/* ====================================================================
- Copyright 2002-2004 Apache Software Foundation
-
- Licensed 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.record;
-
-import org.apache.poi.util.LittleEndian;
-import org.apache.poi.util.StringUtil;
-
-/**
- * Title: Write Protect Record<P>
- * Description: Indicated that the sheet/workbook is write protected.
- * REFERENCE: PG 425 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
- * @version 3.0-pre
- */
-
-public class WriteProtectRecord
- extends Record
-{
- public final static short sid = 0x86;
-
- public WriteProtectRecord()
- {
- }
-
- /**
- * Constructs a WriteAccess record and sets its fields appropriately.
- *
- * @param id id must be 0x5c or an exception will be throw upon validation
- * @param size the size of the data area of the record
- * @param data data of the record (should not contain sid/len)
- */
-
- public WriteProtectRecord(RecordInputStream in)
- {
- super(in);
- }
-
- protected void validateSid(short id)
- {
- if (id != sid)
- {
- throw new RecordFormatException("NOT A WRITEPROTECT RECORD");
- }
- }
-
- protected void fillFields(RecordInputStream in)
- {
- }
-
- public String toString()
- {
- StringBuffer buffer = new StringBuffer();
-
- buffer.append("[WRITEPROTECT]\n");
- buffer.append("[/WRITEPROTECT]\n");
- return buffer.toString();
- }
-
- public int serialize(int offset, byte [] data)
- {
- LittleEndian.putShort(data, 0 + offset, sid);
- LittleEndian.putShort(data, 2 + offset, (short)0);
-
- return getRecordSize();
- }
-
- public int getRecordSize()
- {
- return 4;
- }
-
- public short getSid()
- {
- return sid;
- }
-}
+
+/* ====================================================================
+ Copyright 2002-2004 Apache Software Foundation
+
+ Licensed 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.record;
+
+import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.StringUtil;
+
+/**
+ * Title: Write Protect Record<P>
+ * Description: Indicated that the sheet/workbook is write protected.
+ * REFERENCE: PG 425 Microsoft Excel 97 Developer's Kit (ISBN: 1-57231-498-2)<P>
+ * @version 3.0-pre
+ */
+
+public class WriteProtectRecord
+ extends Record
+{
+ public final static short sid = 0x86;
+
+ public WriteProtectRecord()
+ {
+ }
+
+ /**
+ * Constructs a WriteAccess record and sets its fields appropriately.
+ *
+ * @param id id must be 0x5c or an exception will be throw upon validation
+ * @param size the size of the data area of the record
+ * @param data data of the record (should not contain sid/len)
+ */
+
+ public WriteProtectRecord(RecordInputStream in)
+ {
+ super(in);
+ }
+
+ protected void validateSid(short id)
+ {
+ if (id != sid)
+ {
+ throw new RecordFormatException("NOT A WRITEPROTECT RECORD");
+ }
+ }
+
+ protected void fillFields(RecordInputStream in)
+ {
+ }
+
+ public String toString()
+ {
+ StringBuffer buffer = new StringBuffer();
+
+ buffer.append("[WRITEPROTECT]\n");
+ buffer.append("[/WRITEPROTECT]\n");
+ return buffer.toString();
+ }
+
+ public int serialize(int offset, byte [] data)
+ {
+ LittleEndian.putShort(data, 0 + offset, sid);
+ LittleEndian.putShort(data, 2 + offset, (short)0);
+
+ return getRecordSize();
+ }
+
+ public int getRecordSize()
+ {
+ return 4;
+ }
+
+ public short getSid()
+ {
+ return sid;
+ }
+}
Modified: jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/AreaErrPtg.java
URL: http://svn.apache.org/viewvc/jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/AreaErrPtg.java?view=diff&rev=489760&r1=489759&r2=489760
==============================================================================
--- jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/AreaErrPtg.java (original)
+++ jakarta/poi/trunk/src/java/org/apache/poi/hssf/record/formula/AreaErrPtg.java Fri Dec 22 12:56:04 2006
@@ -1,88 +1,88 @@
-/* ====================================================================
- Copyright 2003-2004 Apache Software Foundation
-
- Licensed 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.record.formula;
-
-import org.apache.poi.util.LittleEndian;
-import org.apache.poi.util.BitField;
-
-import org.apache.poi.hssf.model.Workbook;
-import org.apache.poi.hssf.record.RecordInputStream;
-
-/**
- * AreaErr - handles deleted cell area references.
- *
- * @author Daniel Noll (daniel at nuix dot com dot au)
- */
-public class AreaErrPtg extends AreaPtg
-{
- public final static byte sid = 0x2b;
-
- private AreaErrPtg()
- {
- //Required for clone methods
- super();
- }
-
- public AreaErrPtg(RecordInputStream in)
- {
- super(in);
- }
-
- public String toString()
- {
- StringBuffer buffer = new StringBuffer();
-
- buffer.append("AreaErrPtg\n");
- buffer.append("firstRow = " + getFirstRow()).append("\n");
- buffer.append("lastRow = " + getLastRow()).append("\n");
- buffer.append("firstCol = " + getFirstColumn()).append("\n");
- buffer.append("lastCol = " + getLastColumn()).append("\n");
- buffer.append("firstColRowRel= "
- + isFirstRowRelative()).append("\n");
- buffer.append("lastColRowRel = "
- + isLastRowRelative()).append("\n");
- buffer.append("firstColRel = " + isFirstColRelative()).append("\n");
- buffer.append("lastColRel = " + isLastColRelative()).append("\n");
- return buffer.toString();
- }
-
- public void writeBytes(byte [] array, int offset) {
- super.writeBytes(array, offset);
- array[offset] = (byte) (sid + ptgClass);
- }
-
- public String toFormulaString(Workbook book)
- {
- return "#REF!";
- }
-
- public Object clone()
- {
- AreaErrPtg ptg = new AreaErrPtg();
- ptg.setFirstRow(getFirstRow());
- ptg.setFirstColumn(getFirstColumn());
- ptg.setLastRow(getLastRow());
- ptg.setLastColumn(getLastColumn());
- ptg.setFirstColRelative(isFirstColRelative());
- ptg.setLastColRelative(isLastColRelative());
- ptg.setFirstRowRelative(isFirstRowRelative());
- ptg.setLastRowRelative(isLastRowRelative());
- ptg.setClass(ptgClass);
- return ptg;
- }
-}
-
+/* ====================================================================
+ Copyright 2003-2004 Apache Software Foundation
+
+ Licensed 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.record.formula;
+
+import org.apache.poi.util.LittleEndian;
+import org.apache.poi.util.BitField;
+
+import org.apache.poi.hssf.model.Workbook;
+import org.apache.poi.hssf.record.RecordInputStream;
+
+/**
+ * AreaErr - handles deleted cell area references.
+ *
+ * @author Daniel Noll (daniel at nuix dot com dot au)
+ */
+public class AreaErrPtg extends AreaPtg
+{
+ public final static byte sid = 0x2b;
+
+ private AreaErrPtg()
+ {
+ //Required for clone methods
+ super();
+ }
+
+ public AreaErrPtg(RecordInputStream in)
+ {
+ super(in);
+ }
+
+ public String toString()
+ {
+ StringBuffer buffer = new StringBuffer();
+
+ buffer.append("AreaErrPtg\n");
+ buffer.append("firstRow = " + getFirstRow()).append("\n");
+ buffer.append("lastRow = " + getLastRow()).append("\n");
+ buffer.append("firstCol = " + getFirstColumn()).append("\n");
+ buffer.append("lastCol = " + getLastColumn()).append("\n");
+ buffer.append("firstColRowRel= "
+ + isFirstRowRelative()).append("\n");
+ buffer.append("lastColRowRel = "
+ + isLastRowRelative()).append("\n");
+ buffer.append("firstColRel = " + isFirstColRelative()).append("\n");
+ buffer.append("lastColRel = " + isLastColRelative()).append("\n");
+ return buffer.toString();
+ }
+
+ public void writeBytes(byte [] array, int offset) {
+ super.writeBytes(array, offset);
+ array[offset] = (byte) (sid + ptgClass);
+ }
+
+ public String toFormulaString(Workbook book)
+ {
+ return "#REF!";
+ }
+
+ public Object clone()
+ {
+ AreaErrPtg ptg = new AreaErrPtg();
+ ptg.setFirstRow(getFirstRow());
+ ptg.setFirstColumn(getFirstColumn());
+ ptg.setLastRow(getLastRow());
+ ptg.setLastColumn(getLastColumn());
+ ptg.setFirstColRelative(isFirstColRelative());
+ ptg.setLastColRelative(isLastColRelative());
+ ptg.setFirstRowRelative(isFirstRowRelative());
+ ptg.setLastRowRelative(isLastRowRelative());
+ ptg.setClass(ptgClass);
+ return ptg;
+ }
+}
+
Modified: jakarta/poi/trunk/src/java/org/apache/poi/hssf/util/PaneInformation.java
URL: http://svn.apache.org/viewvc/jakarta/poi/trunk/src/java/org/apache/poi/hssf/util/PaneInformation.java?view=diff&rev=489760&r1=489759&r2=489760
==============================================================================
--- jakarta/poi/trunk/src/java/org/apache/poi/hssf/util/PaneInformation.java (original)
+++ jakarta/poi/trunk/src/java/org/apache/poi/hssf/util/PaneInformation.java Fri Dec 22 12:56:04 2006
@@ -1,104 +1,104 @@
-/* ====================================================================
- Copyright 2002-2004 Apache Software Foundation
-
- Licensed 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.util;
-
-/**
- * Holds information regarding a split plane or freeze plane for a sheet.
- *
- */
-public class PaneInformation
-{
- /** Constant for active pane being the lower right*/
- public static final byte PANE_LOWER_RIGHT = (byte)0;
- /** Constant for active pane being the upper right*/
- public static final byte PANE_UPPER_RIGHT = (byte)1;
- /** Constant for active pane being the lower left*/
- public static final byte PANE_LOWER_LEFT = (byte)2;
- /** Constant for active pane being the upper left*/
- public static final byte PANE_UPPER_LEFT = (byte)3;
-
- private short x;
- private short y;
- private short topRow;
- private short leftColumn;
- private byte activePane;
- private boolean frozen = false;
-
- public PaneInformation(short x, short y, short top, short left, byte active, boolean frozen) {
- this.x = x;
- this.y = y;
- this.topRow = top;
- this.leftColumn = left;
- this.activePane = active;
- this.frozen = frozen;
- }
-
-
- /**
- * Returns the vertical position of the split.
- * @return 0 if there is no vertical spilt,
- * or for a freeze pane the number of columns in the TOP pane,
- * or for a split plane the position of the split in 1/20th of a point.
- */
- public short getVerticalSplitPosition() {
- return x;
- }
-
- /**
- * Returns the horizontal position of the split.
- * @return 0 if there is no horizontal spilt,
- * or for a freeze pane the number of rows in the LEFT pane,
- * or for a split plane the position of the split in 1/20th of a point.
- */
- public short getHorizontalSplitPosition() {
- return y;
- }
-
- /**
- * For a horizontal split returns the top row in the BOTTOM pane.
- * @return 0 if there is no horizontal split, or the top row of the bottom pane.
- */
- public short getHorizontalSplitTopRow() {
- return topRow;
- }
-
- /**
- * For a vertical split returns the left column in the RIGHT pane.
- * @return 0 if there is no vertical split, or the left column in the RIGHT pane.
- */
- public short getVerticalSplitLeftColumn() {
- return leftColumn;
- }
-
- /**
- * Returns the active pane
- * @see PANE_LOWER_RIGHT
- * @see PANE_UPPER_RIGHT
- * @see PANE_LOWER_LEFT
- * @see PANE_UPPER_LEFT
- * @return the active pane.
- */
- public byte getActivePane() {
- return activePane;
- }
-
- /** Returns true if this is a Freeze pane, false if it is a split pane.
- */
- public boolean isFreezePane() {
- return frozen;
- }
-}
+/* ====================================================================
+ Copyright 2002-2004 Apache Software Foundation
+
+ Licensed 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.util;
+
+/**
+ * Holds information regarding a split plane or freeze plane for a sheet.
+ *
+ */
+public class PaneInformation
+{
+ /** Constant for active pane being the lower right*/
+ public static final byte PANE_LOWER_RIGHT = (byte)0;
+ /** Constant for active pane being the upper right*/
+ public static final byte PANE_UPPER_RIGHT = (byte)1;
+ /** Constant for active pane being the lower left*/
+ public static final byte PANE_LOWER_LEFT = (byte)2;
+ /** Constant for active pane being the upper left*/
+ public static final byte PANE_UPPER_LEFT = (byte)3;
+
+ private short x;
+ private short y;
+ private short topRow;
+ private short leftColumn;
+ private byte activePane;
+ private boolean frozen = false;
+
+ public PaneInformation(short x, short y, short top, short left, byte active, boolean frozen) {
+ this.x = x;
+ this.y = y;
+ this.topRow = top;
+ this.leftColumn = left;
+ this.activePane = active;
+ this.frozen = frozen;
+ }
+
+
+ /**
+ * Returns the vertical position of the split.
+ * @return 0 if there is no vertical spilt,
+ * or for a freeze pane the number of columns in the TOP pane,
+ * or for a split plane the position of the split in 1/20th of a point.
+ */
+ public short getVerticalSplitPosition() {
+ return x;
+ }
+
+ /**
+ * Returns the horizontal position of the split.
+ * @return 0 if there is no horizontal spilt,
+ * or for a freeze pane the number of rows in the LEFT pane,
+ * or for a split plane the position of the split in 1/20th of a point.
+ */
+ public short getHorizontalSplitPosition() {
+ return y;
+ }
+
+ /**
+ * For a horizontal split returns the top row in the BOTTOM pane.
+ * @return 0 if there is no horizontal split, or the top row of the bottom pane.
+ */
+ public short getHorizontalSplitTopRow() {
+ return topRow;
+ }
+
+ /**
+ * For a vertical split returns the left column in the RIGHT pane.
+ * @return 0 if there is no vertical split, or the left column in the RIGHT pane.
+ */
+ public short getVerticalSplitLeftColumn() {
+ return leftColumn;
+ }
+
+ /**
+ * Returns the active pane
+ * @see PANE_LOWER_RIGHT
+ * @see PANE_UPPER_RIGHT
+ * @see PANE_LOWER_LEFT
+ * @see PANE_UPPER_LEFT
+ * @return the active pane.
+ */
+ public byte getActivePane() {
+ return activePane;
+ }
+
+ /** Returns true if this is a Freeze pane, false if it is a split pane.
+ */
+ public boolean isFreezePane() {
+ return frozen;
+ }
+}
Modified: jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/Bitmap.java
URL: http://svn.apache.org/viewvc/jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/Bitmap.java?view=diff&rev=489760&r1=489759&r2=489760
==============================================================================
--- jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/Bitmap.java (original)
+++ jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/Bitmap.java Fri Dec 22 12:56:04 2006
@@ -1,47 +1,47 @@
-/* ====================================================================
- Copyright 2002-2004 Apache Software Foundation
-
- Licensed 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.hslf.blip;
-
-import org.apache.poi.hslf.usermodel.PictureData;
-
-import java.io.IOException;
-import java.io.ByteArrayOutputStream;
-
-/**
- * Represents a bitmap picture data: JPEG or PNG.
- * The data is not compressed and the exact file content is written in the stream.
- *
- * @author Yegor Kozlov
- */
-public abstract class Bitmap extends PictureData {
-
- public byte[] getData(){
- byte[] rawdata = getRawData();
- byte[] imgdata = new byte[rawdata.length-17];
- System.arraycopy(rawdata, 17, imgdata, 0, imgdata.length);
- return imgdata;
- }
-
- public void setData(byte[] data) throws IOException {
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- byte[] checksum = getChecksum(data);
- out.write(checksum);
- out.write(0);
- out.write(data);
-
- setRawData(out.toByteArray());
- }
-}
+/* ====================================================================
+ Copyright 2002-2004 Apache Software Foundation
+
+ Licensed 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.hslf.blip;
+
+import org.apache.poi.hslf.usermodel.PictureData;
+
+import java.io.IOException;
+import java.io.ByteArrayOutputStream;
+
+/**
+ * Represents a bitmap picture data: JPEG or PNG.
+ * The data is not compressed and the exact file content is written in the stream.
+ *
+ * @author Yegor Kozlov
+ */
+public abstract class Bitmap extends PictureData {
+
+ public byte[] getData(){
+ byte[] rawdata = getRawData();
+ byte[] imgdata = new byte[rawdata.length-17];
+ System.arraycopy(rawdata, 17, imgdata, 0, imgdata.length);
+ return imgdata;
+ }
+
+ public void setData(byte[] data) throws IOException {
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ byte[] checksum = getChecksum(data);
+ out.write(checksum);
+ out.write(0);
+ out.write(data);
+
+ setRawData(out.toByteArray());
+ }
+}
Modified: jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/DIB.java
URL: http://svn.apache.org/viewvc/jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/DIB.java?view=diff&rev=489760&r1=489759&r2=489760
==============================================================================
--- jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/DIB.java (original)
+++ jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/DIB.java Fri Dec 22 12:56:04 2006
@@ -1,81 +1,81 @@
-/* ====================================================================
- Copyright 2002-2004 Apache Software Foundation
-
- Licensed 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.hslf.blip;
-
-import org.apache.poi.hslf.model.Picture;
-import org.apache.poi.util.LittleEndian;
-
-import java.io.IOException;
-
-/**
- * Represents a DIB picture data in a PPT file
- *
- * @author Yegor Kozlov
- */
-public class DIB extends Bitmap {
- /**
- * Size of the BITMAPFILEHEADER structure preceding the actual DIB bytes
- */
- public static final int HEADER_SIZE = 14;
-
- /**
- * @return type of this picture
- * @see org.apache.poi.hslf.model.Picture#DIB
- */
- public int getType(){
- return Picture.DIB;
- }
-
- /**
- * DIB signature is <code>0x7A80</code>
- *
- * @return DIB signature (<code>0x7A80</code>)
- */
- public int getSignature(){
- return 0x7A80;
- }
-
- public byte[] getData(){
- byte[] data = super.getData();
-
- // bitmap file-header, corresponds to a
- // Windows BITMAPFILEHEADER structure
- // (For more information, consult the Windows API Programmer's reference )
- byte[] header = new byte[HEADER_SIZE];
- //Specifies the file type. It must be set to the signature word BM (0x4D42) to indicate bitmap.
- LittleEndian.putInt(header, 0, 0x4D42);
- //Specifies the size, in bytes, of the bitmap file.
- LittleEndian.putInt(header, 2, data.length); //DIB length including the header
- //Reserved; set to zero
- LittleEndian.putInt(header, 6, 0);
- //the offset, in bytes, from the header to the bitmap bits (looks like it is always 2)
- LittleEndian.putInt(header, 10, 2);
-
- //DIB data is the header + dib bytes
- byte[] dib = new byte[header.length + data.length];
- System.arraycopy(header, 0, dib, 0, header.length);
- System.arraycopy(data, 0, dib, header.length, data.length);
-
- return dib;
- }
-
- public void setData(byte[] data) throws IOException {
- //cut off the bitmap file-header
- byte[] dib = new byte[data.length-HEADER_SIZE];
- System.arraycopy(data, HEADER_SIZE, dib, 0, dib.length);
- super.setData(dib);
- }
-}
+/* ====================================================================
+ Copyright 2002-2004 Apache Software Foundation
+
+ Licensed 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.hslf.blip;
+
+import org.apache.poi.hslf.model.Picture;
+import org.apache.poi.util.LittleEndian;
+
+import java.io.IOException;
+
+/**
+ * Represents a DIB picture data in a PPT file
+ *
+ * @author Yegor Kozlov
+ */
+public class DIB extends Bitmap {
+ /**
+ * Size of the BITMAPFILEHEADER structure preceding the actual DIB bytes
+ */
+ public static final int HEADER_SIZE = 14;
+
+ /**
+ * @return type of this picture
+ * @see org.apache.poi.hslf.model.Picture#DIB
+ */
+ public int getType(){
+ return Picture.DIB;
+ }
+
+ /**
+ * DIB signature is <code>0x7A80</code>
+ *
+ * @return DIB signature (<code>0x7A80</code>)
+ */
+ public int getSignature(){
+ return 0x7A80;
+ }
+
+ public byte[] getData(){
+ byte[] data = super.getData();
+
+ // bitmap file-header, corresponds to a
+ // Windows BITMAPFILEHEADER structure
+ // (For more information, consult the Windows API Programmer's reference )
+ byte[] header = new byte[HEADER_SIZE];
+ //Specifies the file type. It must be set to the signature word BM (0x4D42) to indicate bitmap.
+ LittleEndian.putInt(header, 0, 0x4D42);
+ //Specifies the size, in bytes, of the bitmap file.
+ LittleEndian.putInt(header, 2, data.length); //DIB length including the header
+ //Reserved; set to zero
+ LittleEndian.putInt(header, 6, 0);
+ //the offset, in bytes, from the header to the bitmap bits (looks like it is always 2)
+ LittleEndian.putInt(header, 10, 2);
+
+ //DIB data is the header + dib bytes
+ byte[] dib = new byte[header.length + data.length];
+ System.arraycopy(header, 0, dib, 0, header.length);
+ System.arraycopy(data, 0, dib, header.length, data.length);
+
+ return dib;
+ }
+
+ public void setData(byte[] data) throws IOException {
+ //cut off the bitmap file-header
+ byte[] dib = new byte[data.length-HEADER_SIZE];
+ System.arraycopy(data, HEADER_SIZE, dib, 0, dib.length);
+ super.setData(dib);
+ }
+}
Modified: jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/EMF.java
URL: http://svn.apache.org/viewvc/jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/EMF.java?view=diff&rev=489760&r1=489759&r2=489760
==============================================================================
--- jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/EMF.java (original)
+++ jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/EMF.java Fri Dec 22 12:56:04 2006
@@ -1,92 +1,92 @@
-/* ====================================================================
- Copyright 2002-2004 Apache Software Foundation
-
- Licensed 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.hslf.blip;
-
-import org.apache.poi.hslf.model.Picture;
-import org.apache.poi.hslf.model.Shape;
-
-import java.io.ByteArrayOutputStream;
-import java.io.InputStream;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.util.zip.InflaterInputStream;
-import java.util.zip.DeflaterOutputStream;
-
-/**
- * Represents EMF (Windows Enhanced Metafile) picture data.
- *
- * @author Yegor Kozlov
- */
-public class EMF extends Metafile {
-
- /**
- * Extract compressed EMF data from a ppt
- */
- public byte[] getData(){
- try {
- byte[] rawdata = getRawData();
-
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- InputStream is = new ByteArrayInputStream( rawdata );
- Header header = new Header();
- header.read(rawdata, CHECKSUM_SIZE);
- is.skip(header.getSize() + CHECKSUM_SIZE);
-
- InflaterInputStream inflater = new InflaterInputStream( is );
- byte[] chunk = new byte[4096];
- int count;
- while ((count = inflater.read(chunk)) >=0 ) {
- out.write(chunk,0,count);
- }
- inflater.close();
- return out.toByteArray();
- } catch (IOException e){
- throw new RuntimeException(e);
- }
- }
-
- public void setData(byte[] data) throws IOException {
- byte[] compressed = compress(data, 0, data.length);
-
- Header header = new Header();
- header.wmfsize = data.length;
- //we don't have a EMF reader in java, have to set default image size 200x200
- header.bounds = new java.awt.Rectangle(0, 0, 200, 200);
- header.size = new java.awt.Dimension(header.bounds.width*Shape.EMU_PER_POINT, header.bounds.height*Shape.EMU_PER_POINT);
- header.zipsize = compressed.length;
-
- byte[] checksum = getChecksum(data);
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- out.write(checksum);
- header.write(out);
- out.write(compressed);
-
- setRawData(out.toByteArray());
- }
-
- public int getType(){
- return Picture.EMF;
- }
-
- /**
- * EMF signature is <code>0x3D40</code>
- *
- * @return EMF signature (<code>0x3D40</code>)
- */
- public int getSignature(){
- return 0x3D40;
- }
-}
+/* ====================================================================
+ Copyright 2002-2004 Apache Software Foundation
+
+ Licensed 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.hslf.blip;
+
+import org.apache.poi.hslf.model.Picture;
+import org.apache.poi.hslf.model.Shape;
+
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.util.zip.InflaterInputStream;
+import java.util.zip.DeflaterOutputStream;
+
+/**
+ * Represents EMF (Windows Enhanced Metafile) picture data.
+ *
+ * @author Yegor Kozlov
+ */
+public class EMF extends Metafile {
+
+ /**
+ * Extract compressed EMF data from a ppt
+ */
+ public byte[] getData(){
+ try {
+ byte[] rawdata = getRawData();
+
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ InputStream is = new ByteArrayInputStream( rawdata );
+ Header header = new Header();
+ header.read(rawdata, CHECKSUM_SIZE);
+ is.skip(header.getSize() + CHECKSUM_SIZE);
+
+ InflaterInputStream inflater = new InflaterInputStream( is );
+ byte[] chunk = new byte[4096];
+ int count;
+ while ((count = inflater.read(chunk)) >=0 ) {
+ out.write(chunk,0,count);
+ }
+ inflater.close();
+ return out.toByteArray();
+ } catch (IOException e){
+ throw new RuntimeException(e);
+ }
+ }
+
+ public void setData(byte[] data) throws IOException {
+ byte[] compressed = compress(data, 0, data.length);
+
+ Header header = new Header();
+ header.wmfsize = data.length;
+ //we don't have a EMF reader in java, have to set default image size 200x200
+ header.bounds = new java.awt.Rectangle(0, 0, 200, 200);
+ header.size = new java.awt.Dimension(header.bounds.width*Shape.EMU_PER_POINT, header.bounds.height*Shape.EMU_PER_POINT);
+ header.zipsize = compressed.length;
+
+ byte[] checksum = getChecksum(data);
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ out.write(checksum);
+ header.write(out);
+ out.write(compressed);
+
+ setRawData(out.toByteArray());
+ }
+
+ public int getType(){
+ return Picture.EMF;
+ }
+
+ /**
+ * EMF signature is <code>0x3D40</code>
+ *
+ * @return EMF signature (<code>0x3D40</code>)
+ */
+ public int getSignature(){
+ return 0x3D40;
+ }
+}
Modified: jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/JPEG.java
URL: http://svn.apache.org/viewvc/jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/JPEG.java?view=diff&rev=489760&r1=489759&r2=489760
==============================================================================
--- jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/JPEG.java (original)
+++ jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/JPEG.java Fri Dec 22 12:56:04 2006
@@ -1,43 +1,43 @@
-/* ====================================================================
- Copyright 2002-2004 Apache Software Foundation
-
- Licensed 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.hslf.blip;
-
-import org.apache.poi.hslf.model.Picture;
-
-/**
- * Represents a JPEG picture data in a PPT file
- *
- * @author Yegor Kozlov
- */
-public class JPEG extends Bitmap {
-
- /**
- * @return type of this picture
- * @see org.apache.poi.hslf.model.Picture#JPEG
- */
- public int getType(){
- return Picture.JPEG;
- }
-
- /**
- * JPEG signature is <code>0x46A0</code>
- *
- * @return JPEG signature (<code>0x46A0</code>)
- */
- public int getSignature(){
- return 0x46A0;
- }
-}
+/* ====================================================================
+ Copyright 2002-2004 Apache Software Foundation
+
+ Licensed 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.hslf.blip;
+
+import org.apache.poi.hslf.model.Picture;
+
+/**
+ * Represents a JPEG picture data in a PPT file
+ *
+ * @author Yegor Kozlov
+ */
+public class JPEG extends Bitmap {
+
+ /**
+ * @return type of this picture
+ * @see org.apache.poi.hslf.model.Picture#JPEG
+ */
+ public int getType(){
+ return Picture.JPEG;
+ }
+
+ /**
+ * JPEG signature is <code>0x46A0</code>
+ *
+ * @return JPEG signature (<code>0x46A0</code>)
+ */
+ public int getSignature(){
+ return 0x46A0;
+ }
+}
Modified: jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/Metafile.java
URL: http://svn.apache.org/viewvc/jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/Metafile.java?view=diff&rev=489760&r1=489759&r2=489760
==============================================================================
--- jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/Metafile.java (original)
+++ jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/Metafile.java Fri Dec 22 12:56:04 2006
@@ -1,123 +1,123 @@
-/* ====================================================================
- Copyright 2002-2004 Apache Software Foundation
-
- Licensed 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.hslf.blip;
-
-import org.apache.poi.util.LittleEndian;
-import org.apache.poi.hslf.usermodel.PictureData;
-
-import java.awt.*;
-import java.io.*;
-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.
- * A metafile is stored compressed using the ZIP deflate/inflate algorithm.
- *
- * @author Yegor Kozlov
- */
-public abstract class Metafile extends PictureData {
-
- /**
- * A structure which represents a 34-byte header preceeding the compressed metafile data
- *
- * @author Yegor Kozlov
- */
- public static class Header{
-
- /**
- * size of the original file
- */
- public int wmfsize;
-
- /**
- * Boundary of the metafile drawing commands
- */
- public Rectangle bounds;
-
- /**
- * Size of the metafile in EMUs
- */
- public Dimension size;
-
- /**
- * size of the compressed metafile data
- */
- public int zipsize;
-
- /**
- * Reserved. Always 0.
- */
- public int compression;
-
- /**
- * Reserved. Always 254.
- */
- public int filter = 254;
-
- public void read(byte[] data, int offset){
- int pos = offset;
- wmfsize = LittleEndian.getInt(data, pos); pos += LittleEndian.INT_SIZE;
-
- int left = LittleEndian.getInt(data, pos); pos += LittleEndian.INT_SIZE;
- int top = LittleEndian.getInt(data, pos); pos += LittleEndian.INT_SIZE;
- int right = LittleEndian.getInt(data, pos); pos += LittleEndian.INT_SIZE;
- int bottom = LittleEndian.getInt(data, pos); pos += LittleEndian.INT_SIZE;
-
- bounds = new Rectangle(left, top, right-left, bottom-top);
- int width = LittleEndian.getInt(data, pos); pos += LittleEndian.INT_SIZE;
- int height = LittleEndian.getInt(data, pos); pos += LittleEndian.INT_SIZE;
-
- size = new Dimension(width, height);
-
- zipsize = LittleEndian.getInt(data, pos); pos += LittleEndian.INT_SIZE;
-
- compression = LittleEndian.getUnsignedByte(data, pos); pos++;
- filter = LittleEndian.getUnsignedByte(data, pos); pos++;
- }
-
- public void write(OutputStream out) throws IOException {
- byte[] header = new byte[34];
- int pos = 0;
- LittleEndian.putInt(header, pos, wmfsize); pos += LittleEndian.INT_SIZE; //hmf
-
- LittleEndian.putInt(header, pos, bounds.x); pos += LittleEndian.INT_SIZE; //left
- LittleEndian.putInt(header, pos, bounds.y); pos += LittleEndian.INT_SIZE; //top
- LittleEndian.putInt(header, pos, bounds.x + bounds.width); pos += LittleEndian.INT_SIZE; //right
- LittleEndian.putInt(header, pos, bounds.y + bounds.height); pos += LittleEndian.INT_SIZE; //bottom
- LittleEndian.putInt(header, pos, size.width); pos += LittleEndian.INT_SIZE; //inch
- LittleEndian.putInt(header, pos, size.height); pos += LittleEndian.INT_SIZE; //inch
- LittleEndian.putInt(header, pos, zipsize); pos += LittleEndian.INT_SIZE; //inch
-
- header[pos] = 0; pos ++;
- header[pos] = (byte)filter; pos ++;
-
- out.write(header);
- }
-
- public int getSize(){
- return 34;
- }
- }
-
- protected byte[] compress(byte[] bytes, int offset, int length) throws IOException {
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- DeflaterOutputStream deflater = new DeflaterOutputStream( out );
- deflater.write(bytes, offset, length);
- deflater.close();
- return out.toByteArray();
- }
-}
+/* ====================================================================
+ Copyright 2002-2004 Apache Software Foundation
+
+ Licensed 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.hslf.blip;
+
+import org.apache.poi.util.LittleEndian;
+import org.apache.poi.hslf.usermodel.PictureData;
+
+import java.awt.*;
+import java.io.*;
+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.
+ * A metafile is stored compressed using the ZIP deflate/inflate algorithm.
+ *
+ * @author Yegor Kozlov
+ */
+public abstract class Metafile extends PictureData {
+
+ /**
+ * A structure which represents a 34-byte header preceeding the compressed metafile data
+ *
+ * @author Yegor Kozlov
+ */
+ public static class Header{
+
+ /**
+ * size of the original file
+ */
+ public int wmfsize;
+
+ /**
+ * Boundary of the metafile drawing commands
+ */
+ public Rectangle bounds;
+
+ /**
+ * Size of the metafile in EMUs
+ */
+ public Dimension size;
+
+ /**
+ * size of the compressed metafile data
+ */
+ public int zipsize;
+
+ /**
+ * Reserved. Always 0.
+ */
+ public int compression;
+
+ /**
+ * Reserved. Always 254.
+ */
+ public int filter = 254;
+
+ public void read(byte[] data, int offset){
+ int pos = offset;
+ wmfsize = LittleEndian.getInt(data, pos); pos += LittleEndian.INT_SIZE;
+
+ int left = LittleEndian.getInt(data, pos); pos += LittleEndian.INT_SIZE;
+ int top = LittleEndian.getInt(data, pos); pos += LittleEndian.INT_SIZE;
+ int right = LittleEndian.getInt(data, pos); pos += LittleEndian.INT_SIZE;
+ int bottom = LittleEndian.getInt(data, pos); pos += LittleEndian.INT_SIZE;
+
+ bounds = new Rectangle(left, top, right-left, bottom-top);
+ int width = LittleEndian.getInt(data, pos); pos += LittleEndian.INT_SIZE;
+ int height = LittleEndian.getInt(data, pos); pos += LittleEndian.INT_SIZE;
+
+ size = new Dimension(width, height);
+
+ zipsize = LittleEndian.getInt(data, pos); pos += LittleEndian.INT_SIZE;
+
+ compression = LittleEndian.getUnsignedByte(data, pos); pos++;
+ filter = LittleEndian.getUnsignedByte(data, pos); pos++;
+ }
+
+ public void write(OutputStream out) throws IOException {
+ byte[] header = new byte[34];
+ int pos = 0;
+ LittleEndian.putInt(header, pos, wmfsize); pos += LittleEndian.INT_SIZE; //hmf
+
+ LittleEndian.putInt(header, pos, bounds.x); pos += LittleEndian.INT_SIZE; //left
+ LittleEndian.putInt(header, pos, bounds.y); pos += LittleEndian.INT_SIZE; //top
+ LittleEndian.putInt(header, pos, bounds.x + bounds.width); pos += LittleEndian.INT_SIZE; //right
+ LittleEndian.putInt(header, pos, bounds.y + bounds.height); pos += LittleEndian.INT_SIZE; //bottom
+ LittleEndian.putInt(header, pos, size.width); pos += LittleEndian.INT_SIZE; //inch
+ LittleEndian.putInt(header, pos, size.height); pos += LittleEndian.INT_SIZE; //inch
+ LittleEndian.putInt(header, pos, zipsize); pos += LittleEndian.INT_SIZE; //inch
+
+ header[pos] = 0; pos ++;
+ header[pos] = (byte)filter; pos ++;
+
+ out.write(header);
+ }
+
+ public int getSize(){
+ return 34;
+ }
+ }
+
+ protected byte[] compress(byte[] bytes, int offset, int length) throws IOException {
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ DeflaterOutputStream deflater = new DeflaterOutputStream( out );
+ deflater.write(bytes, offset, length);
+ deflater.close();
+ return out.toByteArray();
+ }
+}
Modified: jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/PICT.java
URL: http://svn.apache.org/viewvc/jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/PICT.java?view=diff&rev=489760&r1=489759&r2=489760
==============================================================================
--- jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/PICT.java (original)
+++ jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/PICT.java Fri Dec 22 12:56:04 2006
@@ -1,117 +1,117 @@
-/* ====================================================================
- Copyright 2002-2004 Apache Software Foundation
-
- Licensed 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.hslf.blip;
-
-import org.apache.poi.hslf.model.Picture;
-import org.apache.poi.hslf.model.Shape;
-import org.apache.poi.util.LittleEndian;
-
-import java.io.*;
-import java.util.zip.InflaterInputStream;
-import java.util.zip.DeflaterOutputStream;
-
-/**
- * Represents Macintosh PICT picture data.
- *
- * @author Yegor Kozlov
- */
-public class PICT extends Metafile {
-
- public PICT(){
- super();
- }
-
- /**
- * Extract compressed PICT data from a ppt
- */
- public byte[] getData(){
- byte[] rawdata = getRawData();
- try {
- byte[] macheader = new byte[512];
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- out.write(macheader);
- int pos = CHECKSUM_SIZE;
- byte[] pict;
- try {
- pict = read(rawdata, pos);
- } catch (IOException e){
- //weird MAC behaviour.
- //if failed to read right after the checksum - skip 16 bytes and try again
- pict = read(rawdata, pos + 16);
- }
- out.write(pict);
- return out.toByteArray();
- } catch (IOException e){
- throw new RuntimeException(e);
- }
- }
-
- private byte[] read(byte[] data, int pos) throws IOException {
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- ByteArrayInputStream bis = new ByteArrayInputStream(data);
- Header header = new Header();
- header.read(data, pos);
- bis.skip(pos + header.getSize());
- InflaterInputStream inflater = new InflaterInputStream( bis );
- byte[] chunk = new byte[4096];
- int count;
- while ((count = inflater.read(chunk)) >=0 ) {
- out.write(chunk,0,count);
- }
- inflater.close();
- return out.toByteArray();
- }
-
- public void setData(byte[] data) throws IOException {
- int pos = 512; //skip the first 512 bytes - they are MAC specific crap
- byte[] compressed = compress(data, pos, data.length-pos);
-
- Header header = new Header();
- header.wmfsize = data.length - 512;
- //we don't have a PICT reader in java, have to set default image size 200x200
- header.bounds = new java.awt.Rectangle(0, 0, 200, 200);
- header.size = new java.awt.Dimension(header.bounds.width*Shape.EMU_PER_POINT,
- header.bounds.height*Shape.EMU_PER_POINT);
- header.zipsize = compressed.length;
-
- byte[] checksum = getChecksum(data);
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- out.write(checksum);
-
- out.write(new byte[16]); //16-byte prefix which is safe to ignore
- header.write(out);
- out.write(compressed);
-
- setRawData(out.toByteArray());
- }
-
- /**
- * @see org.apache.poi.hslf.model.Picture#PICT
- */
- public int getType(){
- return Picture.PICT;
- }
-
- /**
- * PICT signature is <code>0x5430</code>
- *
- * @return PICT signature (<code>0x5430</code>)
- */
- public int getSignature(){
- return 0x5430;
- }
-
-}
+/* ====================================================================
+ Copyright 2002-2004 Apache Software Foundation
+
+ Licensed 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.hslf.blip;
+
+import org.apache.poi.hslf.model.Picture;
+import org.apache.poi.hslf.model.Shape;
+import org.apache.poi.util.LittleEndian;
+
+import java.io.*;
+import java.util.zip.InflaterInputStream;
+import java.util.zip.DeflaterOutputStream;
+
+/**
+ * Represents Macintosh PICT picture data.
+ *
+ * @author Yegor Kozlov
+ */
+public class PICT extends Metafile {
+
+ public PICT(){
+ super();
+ }
+
+ /**
+ * Extract compressed PICT data from a ppt
+ */
+ public byte[] getData(){
+ byte[] rawdata = getRawData();
+ try {
+ byte[] macheader = new byte[512];
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ out.write(macheader);
+ int pos = CHECKSUM_SIZE;
+ byte[] pict;
+ try {
+ pict = read(rawdata, pos);
+ } catch (IOException e){
+ //weird MAC behaviour.
+ //if failed to read right after the checksum - skip 16 bytes and try again
+ pict = read(rawdata, pos + 16);
+ }
+ out.write(pict);
+ return out.toByteArray();
+ } catch (IOException e){
+ throw new RuntimeException(e);
+ }
+ }
+
+ private byte[] read(byte[] data, int pos) throws IOException {
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ ByteArrayInputStream bis = new ByteArrayInputStream(data);
+ Header header = new Header();
+ header.read(data, pos);
+ bis.skip(pos + header.getSize());
+ InflaterInputStream inflater = new InflaterInputStream( bis );
+ byte[] chunk = new byte[4096];
+ int count;
+ while ((count = inflater.read(chunk)) >=0 ) {
+ out.write(chunk,0,count);
+ }
+ inflater.close();
+ return out.toByteArray();
+ }
+
+ public void setData(byte[] data) throws IOException {
+ int pos = 512; //skip the first 512 bytes - they are MAC specific crap
+ byte[] compressed = compress(data, pos, data.length-pos);
+
+ Header header = new Header();
+ header.wmfsize = data.length - 512;
+ //we don't have a PICT reader in java, have to set default image size 200x200
+ header.bounds = new java.awt.Rectangle(0, 0, 200, 200);
+ header.size = new java.awt.Dimension(header.bounds.width*Shape.EMU_PER_POINT,
+ header.bounds.height*Shape.EMU_PER_POINT);
+ header.zipsize = compressed.length;
+
+ byte[] checksum = getChecksum(data);
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ out.write(checksum);
+
+ out.write(new byte[16]); //16-byte prefix which is safe to ignore
+ header.write(out);
+ out.write(compressed);
+
+ setRawData(out.toByteArray());
+ }
+
+ /**
+ * @see org.apache.poi.hslf.model.Picture#PICT
+ */
+ public int getType(){
+ return Picture.PICT;
+ }
+
+ /**
+ * PICT signature is <code>0x5430</code>
+ *
+ * @return PICT signature (<code>0x5430</code>)
+ */
+ public int getSignature(){
+ return 0x5430;
+ }
+
+}
Modified: jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/PNG.java
URL: http://svn.apache.org/viewvc/jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/PNG.java?view=diff&rev=489760&r1=489759&r2=489760
==============================================================================
--- jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/PNG.java (original)
+++ jakarta/poi/trunk/src/scratchpad/src/org/apache/poi/hslf/blip/PNG.java Fri Dec 22 12:56:04 2006
@@ -1,68 +1,68 @@
-/* ====================================================================
- Copyright 2002-2004 Apache Software Foundation
-
- Licensed 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.hslf.blip;
-
-import org.apache.poi.hslf.model.Picture;
-
-import javax.imageio.ImageIO;
-import java.awt.image.BufferedImage;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-
-/**
- * Represents a PNG picture data in a PPT file
- *
- * @author Yegor Kozlov
- */
-public class PNG extends Bitmap {
-
- /**
- * @return PNG data
- */
- public byte[] getData(){
- byte[] data = super.getData();
- try {
- //PNG created on MAC may have a 16-byte prefix which prevents successful reading.
- //Just cut it off!.
- BufferedImage bi = ImageIO.read(new ByteArrayInputStream(data));
- if (bi == null){
- byte[] png = new byte[data.length-16];
- System.arraycopy(data, 16, png, 0, png.length);
- data = png;
- }
- } catch (IOException e){
- throw new RuntimeException(e);
- }
- return data;
- }
-
- /**
- * @return type of this picture
- * @see org.apache.poi.hslf.model.Picture#PNG
- */
- public int getType(){
- return Picture.PNG;
- }
-
- /**
- * PNG signature is <code>0x6E00</code>
- *
- * @return PNG signature (<code>0x6E00</code>)
- */
- public int getSignature(){
- return 0x6E00;
- }
-}
+/* ====================================================================
+ Copyright 2002-2004 Apache Software Foundation
+
+ Licensed 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.hslf.blip;
+
+import org.apache.poi.hslf.model.Picture;
+
+import javax.imageio.ImageIO;
+import java.awt.image.BufferedImage;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+
+/**
+ * Represents a PNG picture data in a PPT file
+ *
+ * @author Yegor Kozlov
+ */
+public class PNG extends Bitmap {
+
+ /**
+ * @return PNG data
+ */
+ public byte[] getData(){
+ byte[] data = super.getData();
+ try {
+ //PNG created on MAC may have a 16-byte prefix which prevents successful reading.
+ //Just cut it off!.
+ BufferedImage bi = ImageIO.read(new ByteArrayInputStream(data));
+ if (bi == null){
+ byte[] png = new byte[data.length-16];
+ System.arraycopy(data, 16, png, 0, png.length);
+ data = png;
+ }
+ } catch (IOException e){
+ throw new RuntimeException(e);
+ }
+ return data;
+ }
+
+ /**
+ * @return type of this picture
+ * @see org.apache.poi.hslf.model.Picture#PNG
+ */
+ public int getType(){
+ return Picture.PNG;
+ }
+
+ /**
+ * PNG signature is <code>0x6E00</code>
+ *
+ * @return PNG signature (<code>0x6E00</code>)
+ */
+ public int getSignature(){
+ return 0x6E00;
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
Mailing List: http://jakarta.apache.org/site/mail2.html#poi
The Apache Jakarta POI Project: http://jakarta.apache.org/poi/