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

Miklos Vajna vmiklos at kemper.freedesktop.org
Tue Jan 8 08:13:49 PST 2013


 src/docrecord.py |   17 +++++++++++++++++
 src/docstream.py |    7 ++++++-
 test/doc/test.py |    4 ++++
 3 files changed, 27 insertions(+), 1 deletion(-)

New commits:
commit 7d1c795d84df8c1ef443222b62118bb6c958ae3a
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Tue Jan 8 17:10:14 2013 +0100

    dump GrpXstAtnOwners

diff --git a/src/docrecord.py b/src/docrecord.py
index e5f29fe..5638a5e 100644
--- a/src/docrecord.py
+++ b/src/docrecord.py
@@ -1596,6 +1596,23 @@ class SttbfFfn(DOCDirStream):
             print '</cchData>'
         print '</sttbfFfn>'
 
+class GrpXstAtnOwners(DOCDirStream):
+    """This array contains the names of authors of comments in the document."""
+    def __init__(self, mainStream):
+        DOCDirStream.__init__(self, mainStream.doc.getDirectoryStreamByName("1Table").bytes)
+        self.pos = mainStream.fcGrpXstAtnOwners
+        self.size = mainStream.lcbGrpXstAtnOwners
+        self.mainStream = mainStream
+
+    def dump(self):
+        posOrig = self.pos
+        print '<grpXstAtnOwners type="GrpXstAtnOwners" offset="%d" size="%d bytes">' % (self.pos, self.size)
+        while self.pos < posOrig + self.size:
+            xst = Xst(self)
+            xst.dump()
+            self.pos = xst.pos
+        print '</grpXstAtnOwners>'
+
 class SttbfAssoc(DOCDirStream):
     """The SttbfAssoc structure is an STTB that contains strings which are associated with this document."""
     def __init__(self, mainStream):
diff --git a/src/docstream.py b/src/docstream.py
index f07116a..167fb9c 100644
--- a/src/docstream.py
+++ b/src/docstream.py
@@ -276,7 +276,7 @@ class WordDocumentStream(DOCDirStream):
             ["fcAutosaveSource"],
             ["lcbAutosaveSource"],
             ["fcGrpXstAtnOwners"],
-            ["lcbGrpXstAtnOwners"],
+            ["lcbGrpXstAtnOwners", self.handleLcbGrpXstAtnOwners],
             ["fcSttbfAtnBkmk"],
             ["lcbSttbfAtnBkmk", self.handleLcbSttbfAtnBkmk],
             ["fcUnused2"],
@@ -464,6 +464,9 @@ class WordDocumentStream(DOCDirStream):
         plcfandRef = docrecord.PlcfandRef(self, offset, size)
         plcfandRef.dump()
 
+    def handleLcbGrpXstAtnOwners(self):
+        docrecord.GrpXstAtnOwners(self).dump()
+
     def handleLcbSttbfAtnBkmk(self):
         offset = self.fcSttbfAtnBkmk
         size = self.lcbSttbfAtnBkmk
diff --git a/test/doc/test.py b/test/doc/test.py
index 5fe743c..a97d0f5 100755
--- a/test/doc/test.py
+++ b/test/doc/test.py
@@ -114,6 +114,10 @@ class Test(unittest.TestCase):
         self.assertEqual('Hello', commentEnds[0].findall('transformed')[0].attrib['value'])
         self.assertEqual('This', commentEnds[1].findall('transformed')[0].attrib['value'])
 
+        authors = self.root.findall('stream[@name="WordDocument"]/fib/fibRgFcLcbBlob/lcbGrpXstAtnOwners/grpXstAtnOwners/xst/rgtchar')
+        self.assertEqual(1, len(authors))
+        self.assertEqual('vmiklos', authors[0].attrib['value'])
+
     def test_zoom(self):
         self.dump('zoom')
         dopBase = self.root.findall('stream[@name="WordDocument"]/fib/fibRgFcLcbBlob/lcbDop/dop/dop2007/dop2003/dop2002/dop2000/dop97/dop95/dopBase')[0]
commit c8c0c1a2c1f1bb0468a934830ca1ae9f36f3b8ab
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Tue Jan 8 16:59:05 2013 +0100

    read FibRgLw97.ccpHdd

diff --git a/src/docstream.py b/src/docstream.py
index a29b9c6..f07116a 100644
--- a/src/docstream.py
+++ b/src/docstream.py
@@ -407,6 +407,8 @@ class WordDocumentStream(DOCDirStream):
             hasHandler = len(i) > 1
             # the spec says these must be ignored
             needsIgnoring = ["lcbStshfOrig"]
+            if self.ccpHdd == 0:
+                needsIgnoring.append("lcbPlcfHdd")
             # a member needs handling if it defines the size of a struct and it's non-zero
             needsHandling = i[0].startswith("lcb") and value != 0 and (not i[0] in needsIgnoring)
             self.printAndSet(i[0], value, end = ((not hasHandler) and (not needsHandling)), offset = True)


More information about the Libreoffice-commits mailing list