]> source.dussan.org Git - poi.git/commitdiff
TextSpecInfoAtom is present in PPT 2003+. When the text is changed we must update...
authorYegor Kozlov <yegor@apache.org>
Tue, 15 Apr 2008 15:11:13 +0000 (15:11 +0000)
committerYegor Kozlov <yegor@apache.org>
Tue, 15 Apr 2008 15:11:13 +0000 (15:11 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@648274 13f79535-47bb-0310-9956-ffa450edef68

src/scratchpad/src/org/apache/poi/hslf/record/RecordTypes.java
src/scratchpad/src/org/apache/poi/hslf/record/TextSpecInfoAtom.java [new file with mode: 0755]

index 69173bf5bb700708fd2bf57dff65466b17f193f0..a1bc499453b096748d9a7a7156c7f1c4c293e51d 100644 (file)
@@ -92,7 +92,7 @@ public class RecordTypes {
     public static final Type TextBookmarkAtom = new Type(4007,null);
     public static final Type TextBytesAtom = new Type(4008,TextBytesAtom.class);
     public static final Type TxSIStyleAtom = new Type(4009,null);
-    public static final Type TextSpecInfoAtom = new Type(4010,null);
+    public static final Type TextSpecInfoAtom = new Type(4010, TextSpecInfoAtom.class);
     public static final Type DefaultRulerAtom = new Type(4011,null);
     public static final Type FontEntityAtom = new Type(4023,FontEntityAtom.class);
     public static final Type FontEmbeddedData = new Type(4024,null);
diff --git a/src/scratchpad/src/org/apache/poi/hslf/record/TextSpecInfoAtom.java b/src/scratchpad/src/org/apache/poi/hslf/record/TextSpecInfoAtom.java
new file mode 100755 (executable)
index 0000000..a8915f0
--- /dev/null
@@ -0,0 +1,85 @@
+/* ====================================================================\r
+   Licensed to the Apache Software Foundation (ASF) under one or more\r
+   contributor license agreements.  See the NOTICE file distributed with\r
+   this work for additional information regarding copyright ownership.\r
+   The ASF licenses this file to You under the Apache License, Version 2.0\r
+   (the "License"); you may not use this file except in compliance with\r
+   the License.  You may obtain a copy of the License at\r
+\r
+       http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+   Unless required by applicable law or agreed to in writing, software\r
+   distributed under the License is distributed on an "AS IS" BASIS,\r
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+   See the License for the specific language governing permissions and\r
+   limitations under the License.\r
+==================================================================== */\r
+package org.apache.poi.hslf.record;\r
+\r
+import org.apache.poi.util.LittleEndian;\r
+\r
+import java.io.OutputStream;\r
+import java.io.IOException;\r
+\r
+/**\r
+ * The special info runs contained in this text.\r
+ * Special info runs consist of character properties which don?t follow styles.\r
+ * \r
+ * @author Yegor Kozlov\r
+ */\r
+public class TextSpecInfoAtom extends RecordAtom {\r
+    /**\r
+     * Record header.\r
+     */\r
+    private byte[] _header;\r
+\r
+    /**\r
+     * Record data.\r
+     */\r
+    private byte[] _data;\r
+\r
+    /**\r
+     * Constructs the link related atom record from its\r
+     *  source data.\r
+     *\r
+     * @param source the source data as a byte array.\r
+     * @param start the start offset into the byte array.\r
+     * @param len the length of the slice in the byte array.\r
+     */\r
+    protected TextSpecInfoAtom(byte[] source, int start, int len) {\r
+        // Get the header.\r
+        _header = new byte[8];\r
+        System.arraycopy(source,start,_header,0,8);\r
+\r
+        // Get the record data.\r
+        _data = new byte[len-8];\r
+        System.arraycopy(source,start+8,_data,0,len-8);\r
+\r
+    }\r
+    /**\r
+     * Gets the record type.\r
+     * @return the record type.\r
+     */\r
+    public long getRecordType() { return RecordTypes.TextSpecInfoAtom.typeID; }\r
+\r
+    /**\r
+     * Write the contents of the record back, so it can be written\r
+     * to disk\r
+     *\r
+     * @param out the output stream to write to.\r
+     * @throws java.io.IOException if an error occurs.\r
+     */\r
+    public void writeOut(OutputStream out) throws IOException {\r
+        out.write(_header);\r
+        out.write(_data);\r
+    }\r
+\r
+    /**\r
+     * Update the text length\r
+     *\r
+     * @param size the text length\r
+     */\r
+    public void setTextSize(int size){\r
+        LittleEndian.putInt(_data, 0, size);\r
+    }\r
+}\r