]> source.dussan.org Git - poi.git/commitdiff
expose access to OEPlaceholderAtom so that users can determine whether a shape repre...
authorYegor Kozlov <yegor@apache.org>
Sun, 8 Jun 2008 12:37:39 +0000 (12:37 +0000)
committerYegor Kozlov <yegor@apache.org>
Sun, 8 Jun 2008 12:37:39 +0000 (12:37 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@664493 13f79535-47bb-0310-9956-ffa450edef68

src/documentation/content/xdocs/changes.xml
src/documentation/content/xdocs/status.xml
src/scratchpad/src/org/apache/poi/hslf/model/MasterSheet.java
src/scratchpad/src/org/apache/poi/hslf/model/SimpleShape.java
src/scratchpad/src/org/apache/poi/hslf/model/Slide.java
src/scratchpad/src/org/apache/poi/hslf/model/TextRun.java
src/scratchpad/src/org/apache/poi/hslf/record/StyleTextPropAtom.java

index 247f991aa23908300720dfeaeb2f02d18e3f5146..51d5b217b022fb6ce45cdd96300ff3793e75b548 100644 (file)
@@ -37,6 +37,9 @@
 
                <!-- Don't forget to update status.xml too! -->
         <release version="3.1-final" date="2008-06-??">
+           <action dev="POI-DEVELOPERS" type="add">Support custom image renderers in HSLF</action>
+           <action dev="POI-DEVELOPERS" type="fix">Correctly increment the reference count of a blip when a picture is inserted</action>
+           <action dev="POI-DEVELOPERS" type="fix">45110 - Fixed TextShape.resizeToFitText() to properly resize TextShape</action>
            <action dev="POI-DEVELOPERS" type="fix">45091 - Fixed serialization of RefN~ tokens.  Simplified Ptg class hierarchy</action>
            <action dev="POI-DEVELOPERS" type="fix">45133 - Fixed OBJ Record (5Dh) to pad the sub-record data to a 4-byte boundary</action>
            <action dev="POI-DEVELOPERS" type="fix">45145 - Fixed Sheet to always enforce RowRecordsAggregate before ValueRecordsAggregate</action>
index ce687164d0c61d2e74aece748634246a890db101..cd059cbdbd436b1fe17873f809745a4bf864ae47 100644 (file)
@@ -34,6 +34,9 @@
        <!-- Don't forget to update changes.xml too! -->
     <changes>
         <release version="3.1-final" date="2008-06-??">
+           <action dev="POI-DEVELOPERS" type="add">Support custom image renderers in HSLF</action>
+           <action dev="POI-DEVELOPERS" type="fix">Correctly increment the reference count of a blip when a picture is inserted</action>
+           <action dev="POI-DEVELOPERS" type="fix">45110 - Fixed TextShape.resizeToFitText() to properly resize TextShape</action>
            <action dev="POI-DEVELOPERS" type="fix">45091 - Fixed serialization of RefN~ tokens.  Simplified Ptg class hierarchy</action>
            <action dev="POI-DEVELOPERS" type="fix">45133 - Fixed OBJ Record (5Dh) to pad the sub-record data to a 4-byte boundary</action>
            <action dev="POI-DEVELOPERS" type="fix">45145 - Fixed Sheet to always enforce RowRecordsAggregate before ValueRecordsAggregate</action>
index d01136d87ee90ee876453ea6239ed168b035a7ab..17c1d1c23f49e6f622c8bdaecfd92870a364e7fc 100644 (file)
@@ -51,21 +51,7 @@ public abstract class MasterSheet extends Sheet {
         if(!(shape instanceof TextShape)) return false;
 
         TextShape tx = (TextShape)shape;
-        TextRun run = tx.getTextRun();
-        if(run == null) return false;
-
-        Record[] records = run._records;
-        for (int i = 0; i < records.length; i++) {
-            int type = (int)records[i].getRecordType();
-            if (type == RecordTypes.BaseTextPropAtom.typeID ||
-                type == RecordTypes.DateTimeMCAtom.typeID ||
-                type == RecordTypes.GenericDateMCAtom.typeID ||
-                type == RecordTypes.FooterMCAtom.typeID ||
-                type == RecordTypes.SlideNumberMCAtom.typeID
-                    ) return true;
-
-        }
-        return false;
+        return tx.getPlaceholderAtom() != null;
     }
 
     /**
index e15454d651c90148bc077f88136efde5da8f66c8..d336cb3f3ffbef268dd210a2f75419dc395d5d58 100644 (file)
@@ -20,10 +20,12 @@ package org.apache.poi.hslf.model;
 import org.apache.poi.ddf.*;
 import org.apache.poi.util.LittleEndian;
 import org.apache.poi.hslf.record.ColorSchemeAtom;
+import org.apache.poi.hslf.record.Record;
 
 import java.awt.*;
 import java.awt.geom.AffineTransform;
 import java.awt.geom.Rectangle2D;
+import java.util.Iterator;
 
 /**
  *  An abstract simple (non-group) shape.
@@ -284,4 +286,28 @@ public class SimpleShape extends Shape {
         ShapePainter.paint(this, graphics);
         graphics.setTransform(at);
     }
+
+    /**
+     *  Find a record in the underlying EscherClientDataRecord
+     *
+     * @param recordType type of the record to search
+     */
+    protected Record getClientDataRecord(int recordType) {
+        Record oep = null;
+        EscherContainerRecord spContainer = getSpContainer();
+        for (Iterator it = spContainer.getChildRecords().iterator(); it.hasNext();) {
+            EscherRecord obj = (EscherRecord) it.next();
+            if (obj.getRecordId() == EscherClientDataRecord.RECORD_ID) {
+                byte[] data = obj.serialize();
+                Record[] records = Record.findChildRecords(data, 8, data.length - 8);
+                for (int j = 0; j < records.length; j++) {
+                    if (records[j].getRecordType() == recordType) {
+                        return records[j];
+                    }
+                }
+            }
+        }
+        return oep;
+    }
+
 }
index bb99c1bcadecabfdbbe612949742275507a5a7c8..ee32868eb6353020659d5c889f7013ffcbdf41a2 100644 (file)
@@ -147,6 +147,7 @@ public class Slide extends Sheet
         int dgId = dgg.getMaxDrawingGroupId() + 1;
         dg.setOptions((short)(dgId << 4));
         dgg.setDrawingsSaved(dgg.getDrawingsSaved() + 1);
+        dgg.setMaxDrawingGroupId(dgId);
 
         for (Iterator it = dgContainer.getChildContainers().iterator(); it.hasNext(); ) {
             EscherContainerRecord c = (EscherContainerRecord)it.next();
index 4030ddc0c281a571bd3f54c5c379e970fde10166..27dbe1b2d573f0c50bf5fb7bd3f5bf2d8deeb1be 100644 (file)
@@ -683,4 +683,13 @@ public class TextRun
         String ns = s.replaceAll("\\r?\\n", "\r");
         return ns;
     }
+
+    /**
+     * Returns records that make up this text run
+     *
+     * @return text run records
+     */
+    public Record[] getRecords(){
+        return _records;
+    }
 }
index 2f3b898a7d1ac7c65ad96526cb412950c2dda11a..969e9036afffda7aa03f11be0c8b77617e9b9bd8 100644 (file)
@@ -138,7 +138,7 @@ public class StyleTextPropAtom extends RecordAtom
                                new TextProp(2, 0x4000, "spaceafter"),
                                new TextProp(2, 0x8000, "para_unknown_4"),
                                new TextProp(2, 0x10000, "para_unknown_5"),
-                               new TextProp(2, 0xE0000, "para_unknown_6"),
+                               new TextProp(2, 0xA0000, "para_unknown_6"),
                                new TextProp(2, 0x200000, "para_unknown_7")
        };
        /** All the different kinds of character properties we might handle */
@@ -167,7 +167,7 @@ public class StyleTextPropAtom extends RecordAtom
        /** 
         * For the Text Style Properties (StyleTextProp) Atom
         */
-       protected StyleTextPropAtom(byte[] source, int start, int len) {
+       public StyleTextPropAtom(byte[] source, int start, int len) {
                // Sanity Checking - we're always at least 8+10 bytes long
                if(len < 18) {
                        len = 18;