[Libreoffice-commits] .: 2 commits - src/docdraw.py

Miklos Vajna vmiklos at kemper.freedesktop.org
Mon Dec 3 07:59:34 PST 2012


 src/docdraw.py |   47 +++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 45 insertions(+), 2 deletions(-)

New commits:
commit 0d9269a0bd855c593604ebb1e54162890dad34b9
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Mon Dec 3 16:59:28 2012 +0100

    dump OfficeArtSpgrContainer

diff --git a/src/docdraw.py b/src/docdraw.py
index 39cf631..c88fad0 100644
--- a/src/docdraw.py
+++ b/src/docdraw.py
@@ -170,6 +170,34 @@ class OfficeArtFDG(DOCDirStream):
         self.printAndSet("spidCur", self.readuInt32())
         print '</drawingData>'
 
+class OfficeArtSpgrContainer(DOCDirStream):
+    """The OfficeArtSpgrContainer record specifies a container for groups of shapes."""
+    def __init__(self, officeArtDgContainer, pos):
+        DOCDirStream.__init__(self, officeArtDgContainer.bytes)
+        self.pos = pos
+        self.officeArtDgContainer = officeArtDgContainer
+
+    def dump(self):
+        print '<groupShape type="OfficeArtSpgrContainer" offset="%d">' % self.pos
+        self.rh = OfficeArtRecordHeader(self, "rh")
+        self.rh.dump()
+        pos = self.pos
+        recMap = {
+                }
+        while (self.rh.recLen - (pos - self.pos)) > 0:
+            rh = OfficeArtRecordHeader(self, pos = pos)
+            rh.parse()
+            if rh.recType in recMap:
+                child = recMap[rh.recType](self, pos)
+                child.dump()
+                assert child.pos == pos + OfficeArtRecordHeader.size + rh.recLen
+            else:
+                print '<todo what="OfficeArtSpgrContainer: recType = %s unhandled (size: %d bytes)"/>' % (hex(rh.recType), rh.recLen)
+            pos += OfficeArtRecordHeader.size + rh.recLen
+        print '</groupShape>'
+        assert pos == self.pos + self.rh.recLen
+        self.pos = pos
+
 class OfficeArtDgContainer(DOCDirStream):
     """The OfficeArtDgContainer record specifies the container for all the file records for the objects in a drawing."""
     def __init__(self, officeArtContent, name):
@@ -184,6 +212,7 @@ class OfficeArtDgContainer(DOCDirStream):
         self.rh.dump()
         pos = self.pos
         recMap = {
+                0xf003: OfficeArtSpgrContainer,
                 0xf008: OfficeArtFDG,
                 }
         while (self.rh.recLen - (pos - self.pos)) > 0:
commit 752b56a00c74368f6c3fd4430f0b8414d288c84f
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Mon Dec 3 16:40:10 2012 +0100

    dump OfficeArtFDG

diff --git a/src/docdraw.py b/src/docdraw.py
index 707aae6..39cf631 100644
--- a/src/docdraw.py
+++ b/src/docdraw.py
@@ -52,7 +52,7 @@ class OfficeArtFDGG(DOCDirStream):
 
     def dump(self):
         print '<%s type="OfficeArtFDGG" offset="%d" size="%d bytes">' % (self.name, self.pos, OfficeArtFDGG.size)
-        self.printAndSet("spidMax", self.readuInt32()) # TODO dump MSOSPID
+        self.printAndSet("spidMax", self.readuInt32())
         self.printAndSet("cidcl", self.readuInt32())
         self.printAndSet("cspSaved", self.readuInt32())
         self.printAndSet("cdgSaved", self.readuInt32())
@@ -69,7 +69,7 @@ class OfficeArtIDCL(DOCDirStream):
 
     def dump(self):
         print '<officeArtIDCL type="OfficeArtIDCL" pos="%d">' % self.pos
-        self.printAndSet("dgid", self.readuInt32()) # TODO dump MSODGID
+        self.printAndSet("dgid", self.readuInt32())
         self.printAndSet("cspidCur", self.readuInt32())
         print '</officeArtIDCL>'
         self.officeArtFDGGBlock.pos = self.pos
@@ -157,6 +157,19 @@ class OfficeArtDggContainer(DOCDirStream):
         assert pos == self.pos + self.rh.recLen
         self.officeArtContent.pos = pos
 
+class OfficeArtFDG(DOCDirStream):
+    """The OfficeArtFDG record specifies the number of shapes, the drawing identifier, and the shape identifier of the last shape in a drawing."""
+    def __init__(self, officeArtDgContainer, pos):
+        DOCDirStream.__init__(self, officeArtDgContainer.bytes)
+        self.pos = pos
+
+    def dump(self):
+        print '<drawingData type="OfficeArtFDG" offset="%d">' % self.pos
+        OfficeArtRecordHeader(self, "rh").dump()
+        self.printAndSet("csp", self.readuInt32())
+        self.printAndSet("spidCur", self.readuInt32())
+        print '</drawingData>'
+
 class OfficeArtDgContainer(DOCDirStream):
     """The OfficeArtDgContainer record specifies the container for all the file records for the objects in a drawing."""
     def __init__(self, officeArtContent, name):
@@ -171,6 +184,7 @@ class OfficeArtDgContainer(DOCDirStream):
         self.rh.dump()
         pos = self.pos
         recMap = {
+                0xf008: OfficeArtFDG,
                 }
         while (self.rh.recLen - (pos - self.pos)) > 0:
             rh = OfficeArtRecordHeader(self, pos = pos)


More information about the Libreoffice-commits mailing list