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

Miklos Vajna vmiklos at kemper.freedesktop.org
Tue May 7 03:02:53 PDT 2013


 src/docrecord.py |   56 +++++++++++++++++++++++++++++++++++++++++++++++++++++--
 src/docstream.py |    5 +++-
 2 files changed, 58 insertions(+), 3 deletions(-)

New commits:
commit 4ef2c5f8d4dfd131c72b1f0fac1dce211daa569b
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Tue May 7 12:02:34 2013 +0200

    dump PlcfSpa

diff --git a/src/docrecord.py b/src/docrecord.py
index 64abc0b..447518f 100644
--- a/src/docrecord.py
+++ b/src/docrecord.py
@@ -2429,6 +2429,22 @@ class PlcfSpl(DOCDirStream, PLC):
             print '</aCP>'
         print '</plcfSpl>'
 
+class PlcfSpa(DOCDirStream, PLC):
+    """The PlcfSpa structure is a PLC structure in which the data elements are
+    SPA structures."""
+    def __init__(self, mainStream, pos, size):
+        DOCDirStream.__init__(self, mainStream.doc.getDirectoryStreamByName("1Table").bytes, mainStream = mainStream)
+        PLC.__init__(self, size, 26) # 2.8.37
+        self.pos = pos
+        self.size = size
+
+    def dump(self):
+        print '<plcfSpa type="PlcfSpa" offset="%d" size="%d bytes">' % (self.pos, self.size)
+        pos = self.pos
+        if self.getElements() - 1 != 0:
+            print '<todo what="PlcfSpa: self.getElements() - 1 != 0"/>'
+        print '</plcfSpa>'
+
 class PlcfGram(DOCDirStream, PLC):
     """The PlcfGram structure is a Plc structure whose data elements are GrammarSpls structures."""
     def __init__(self, mainStream):
diff --git a/src/docstream.py b/src/docstream.py
index 396a8bb..cbacfd8 100644
--- a/src/docstream.py
+++ b/src/docstream.py
@@ -293,7 +293,7 @@ class WordDocumentStream(DOCDirStream):
             ["fcPlcSpaMom"],
             ["lcbPlcSpaMom"],
             ["fcPlcSpaHdr"],
-            ["lcbPlcSpaHdr"],
+            ["lcbPlcSpaHdr", self.handleLcbPlcfSpaHdr],
             ["fcPlcfAtnBkf"],
             ["lcbPlcfAtnBkf", self.handleLcbPlcfAtnBkf],
             ["fcPlcfAtnBkl"],
@@ -536,6 +536,9 @@ class WordDocumentStream(DOCDirStream):
     def handleLcbPlcfSpl(self):
         docrecord.PlcfSpl(self).dump()
 
+    def handleLcbPlcfSpaHdr(self):
+        docrecord.PlcfSpa(self, self.fcPlcSpaHdr, self.lcbPlcSpaHdr).dump()
+
     def handleLcbPlcfGram(self):
         docrecord.PlcfGram(self).dump()
 
commit 2336976919d1fcfbe4a4237adcc3e145cb9bfbaf
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Tue May 7 11:14:34 2013 +0200

    dump PChgTabsDelClose and PChgTabsOperand

diff --git a/src/docrecord.py b/src/docrecord.py
index 7cdd245..64abc0b 100644
--- a/src/docrecord.py
+++ b/src/docrecord.py
@@ -413,6 +413,7 @@ class PChgTabsDel(DOCDirStream):
     """The PChgTabsDel structure specifies the locations at which custom tab stops are ignored."""
     def __init__(self, parent):
         DOCDirStream.__init__(self, parent.bytes)
+        self.parent = parent
         self.pos = parent.pos
 
     def dump(self):
@@ -421,19 +422,37 @@ class PChgTabsDel(DOCDirStream):
         if self.cTabs != 0:
             print '<todo what="PChgTabsDel::dump() cTabs is non-zero"/>'
         print '</pchgTabsDel>'
+        self.parent.pos = self.pos
+
+class PChgTabsDelClose(DOCDirStream):
+    """The PChgTabsDelClose structure specifies the locations at which custom tab stops are ignored."""
+    def __init__(self, parent):
+        DOCDirStream.__init__(self, parent.bytes)
+        self.parent = parent
+        self.pos = parent.pos
+
+    def dump(self):
+        print '<pchgTabsDelClose type="PChgTabsDelClose" offset="%d">' % self.pos
+        self.printAndSet("cTabs", self.readuInt8())
+        if self.cTabs != 0:
+            print '<todo what="PChgTabsDelClose::dump() cTabs is non-zero"/>'
+        print '</pchgTabsDelClose>'
+        self.parent.pos = self.pos
 
 class PChgTabsAdd(DOCDirStream):
     """The PChgTabsAdd structure specifies the locations and properties of custom tab stops."""
     def __init__(self, parent):
         DOCDirStream.__init__(self, parent.bytes)
+        self.parent = parent
         self.pos = parent.pos
 
     def dump(self):
         print '<pchgTabsAdd type="PChgTabsAdd" offset="%d">' % self.pos
         self.printAndSet("cTabs", self.readuInt8())
-        if self.cTabs != 0:
-            print '<todo what="PChgTabsAdd::dump() cTabs is non-zero"/>'
+        for i in range(self.cTabs):
+            print '<rgdxaDel index="%d" value="%d"/>' % (i, self.readuInt16())
         print '</pchgTabsAdd>'
+        self.parent.pos = self.pos
 
 class PChgTabsPapxOperand(DOCDirStream):
     """The PChgTabsPapxOperand structure is used by sprmPChgTabsPapx to specify custom tab stops to be added or ignored."""
@@ -448,6 +467,21 @@ class PChgTabsPapxOperand(DOCDirStream):
         PChgTabsAdd(self).dump()
         print '</pchgTabsPapxOperand>'
 
+class PChgTabsOperand(DOCDirStream):
+    """The PChgTabsOperand structure is used by sprmPChgTabs to specify a list
+    of custom tab stops to add and another list of custom tab stops to
+    ignore."""
+    def __init__(self, parent):
+        DOCDirStream.__init__(self, parent.bytes)
+        self.pos = parent.pos
+
+    def dump(self):
+        print '<pchgTabsOperand type="PChgTabsOperand" offset="%d">' % self.pos
+        self.printAndSet("cb", self.readuInt8())
+        PChgTabsDelClose(self).dump()
+        PChgTabsAdd(self).dump()
+        print '</pchgTabsOperand>'
+
 class BrcOperand(DOCDirStream):
     """The BrcOperand structure is the operand to several SPRMs that control borders."""
     def __init__(self, parent):
@@ -501,6 +535,8 @@ class Sprm(DOCDirStream):
                 self.ct = BrcOperand(self)
             elif self.sprm == 0xc60d:
                 self.ct = PChgTabsPapxOperand(self)
+            elif self.sprm == 0xc615:
+                self.ct = PChgTabsOperand(self)
             else:
                 print '<todo what="Sprm::__init__() unhandled sprm of size 9"/>'
 


More information about the Libreoffice-commits mailing list