[Libreoffice-commits] .: src/docrecord.py src/docstream.py

Miklos Vajna vmiklos at kemper.freedesktop.org
Wed Nov 21 03:22:46 PST 2012


 src/docrecord.py |   43 +++++++++++++++++++++++++++++++++++++++++++
 src/docstream.py |    8 +++++++-
 2 files changed, 50 insertions(+), 1 deletion(-)

New commits:
commit 15d81595c684075c18915029b1ca613b6266e2d3
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Wed Nov 21 12:22:37 2012 +0100

    dump SttbfAtnBkmk

diff --git a/src/docrecord.py b/src/docrecord.py
index e9e0f3a..7378068 100755
--- a/src/docrecord.py
+++ b/src/docrecord.py
@@ -595,6 +595,49 @@ class SttbfFfn(DOCDirStream):
             print '</cchData>'
         print '</sttbfFfn>'
 
+class ATNBE(DOCDirStream):
+    """The ATNBE structure contains information about an annotation bookmark in the document."""
+    size = 10 # in bytes, see 2.9.4
+    def __init__(self, sttbfAtnBkmk):
+        DOCDirStream.__init__(self, sttbfAtnBkmk.bytes)
+        self.pos = sttbfAtnBkmk.pos
+
+    def dump(self):
+        print '<atnbe type="ATNBE">'
+        self.printAndSet("bmc", self.getuInt16())
+        self.pos += 2
+        self.printAndSet("ITag", self.getuInt32())
+        self.pos += 4
+        self.printAndSet("ITagOld", self.getuInt32())
+        self.pos += 4
+        print '</atnbe>'
+
+class SttbfAtnBkmk(DOCDirStream):
+    """The SttbfAtnBkmk structure is an STTB whose strings are all of zero length."""
+    def __init__(self, mainStream, offset, size):
+        DOCDirStream.__init__(self, mainStream.doc.getDirectoryStreamByName("1Table").bytes)
+        self.pos = offset
+        self.size = size
+
+    def dump(self):
+        print '<sttbfAtnBkmk type="SttbfAtnBkmk" offset="%d" size="%d bytes">' % (self.pos, self.size)
+        self.printAndSet("fExtended", self.getuInt16())
+        self.pos += 2
+        self.printAndSet("cData", self.getuInt16())
+        self.pos += 2
+        self.printAndSet("cbExtra", self.getuInt16())
+        self.pos += 2
+        for i in range(self.cData):
+            cchData = self.getuInt16()
+            print '<cchData index="%d" offset="%d", size="%d bytes"/>' % (i, self.pos, cchData)
+            self.pos += 2
+            print '<extraData index="%d" offset="%d", size="%d bytes">' % (i, self.pos, ATNBE.size)
+            atnbe = ATNBE(self)
+            atnbe.dump()
+            self.pos += ATNBE.size
+            print '</extraData>'
+        print '</sttbfAtnBkmk>'
+
 class Stshif(DOCDirStream):
     """The Stshif structure specifies general stylesheet information."""
     def __init__(self, bytes, mainStream, offset):
diff --git a/src/docstream.py b/src/docstream.py
index 928bb29..91644dd 100755
--- a/src/docstream.py
+++ b/src/docstream.py
@@ -263,7 +263,7 @@ class WordDocumentStream(DOCDirStream):
             ["fcGrpXstAtnOwners"],
             ["lcbGrpXstAtnOwners"],
             ["fcSttbfAtnBkmk"],
-            ["lcbSttbfAtnBkmk"],
+            ["lcbSttbfAtnBkmk", self.handleLcbSttbfAtnBkmk],
             ["fcUnused2"],
             ["lcbUnused2"],
             ["fcUnused3"],
@@ -424,6 +424,12 @@ class WordDocumentStream(DOCDirStream):
         plcfandRef = docrecord.PlcfandRef(self, offset, size)
         plcfandRef.dump()
 
+    def handleLcbSttbfAtnBkmk(self):
+        offset = self.fcSttbfAtnBkmk
+        size = self.lcbSttbfAtnBkmk
+        sttbfAtnBkmk = docrecord.SttbfAtnBkmk(self, offset, size)
+        sttbfAtnBkmk.dump()
+
     def dumpFibRgFcLcb97(self, name):
         print '<%s type="FibRgFcLcb97" size="744 bytes">' % name
         self.__dumpFibRgFcLcb97()


More information about the Libreoffice-commits mailing list