[Libreoffice-commits] mso-dumper.git: 2 commits - src/msodraw.py test/doc

Miklos Vajna vmiklos at kemper.freedesktop.org
Tue Aug 27 03:35:33 PDT 2013


 src/msodraw.py              |   34 ++++++++++++++++++++++++++++++++--
 test/doc/pass/abi5027-1.doc |binary
 2 files changed, 32 insertions(+), 2 deletions(-)

New commits:
commit 748b246a0bfd5159372cff62a2ccbdb0eddeaed1
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Tue Aug 27 12:35:17 2013 +0200

    msodraw: dump pibFlags

diff --git a/src/msodraw.py b/src/msodraw.py
index 0ec4378..7af5809 100644
--- a/src/msodraw.py
+++ b/src/msodraw.py
@@ -688,6 +688,19 @@ class FOPT:
             for i in FOPT.ShapeBooleanProperties.memberNames:
                 recHdl.appendLine('<%s value="%s"/>' % (i, getattr(self, i)))
 
+    class PibFlags:
+        """An MSOBLIPFLAGS enumeration value, that specifies how to interpret
+        the pibName property."""
+        def __parseBytes(self, prop):
+            self.pibFlags = globals.getValueOrUnknown(MSOBLIPFLAGS, prop.value, "todo")
+
+        def appendLines (self, recHdl, prop, level):
+            recHdl.appendLine(indent(level)+"pibFlags: %s"%prop.value)
+
+        def dumpXml(self, recHdl, prop):
+            self.__parseBytes(prop)
+            recHdl.appendLine('<pibFlags name="%s" value="%s"/>' % (self.pibFlags, hex(prop.value)))
+
     propTable = {
         0x00BF: ['Text Boolean Properties', TextBoolean],
         0x00C0: ['gtextUNICODE', GtextUNICODE],
@@ -747,6 +760,8 @@ class FOPT:
         0x01D7: ['lineEndCapStyle'],
         0x0104: ['pib'],
         0x018C: ['fillFocus'],
+        0x007F: ['Protection Boolean Properties'],
+        0x0106: ['pibFlags', PibFlags],
     }
 
     class E:
@@ -1056,6 +1071,14 @@ MSOBLIPTYPE = {
         0x12: 'msoblipCMYKJPEG',
         }
 
+MSOBLIPFLAGS = {
+        0x00000000: 'msoblipflagComment',
+        0x00000001: 'msoblipflagFile',
+        0x00000002: 'msoblipflagURL',
+        0x00000004: 'msoblipflagDoNotSave',
+        0x00000008: 'msoblipflagLinkToFile',
+        }
+
 class FBSE:
     """2.2.32 The OfficeArtFBSE record specifies a File BLIP Store Entry (FBSE)
     that contains information about the BLIP."""
commit 31ef6de85475d68f17a181dd56e778c6f15730a8
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Tue Aug 27 12:17:25 2013 +0200

    msodraw: handle invalid utf-16 in pibName

diff --git a/src/msodraw.py b/src/msodraw.py
index 8384c48..0ec4378 100644
--- a/src/msodraw.py
+++ b/src/msodraw.py
@@ -491,10 +491,15 @@ class FOPT:
 
         def __init__(self, name):
             self.name = name
+            self.todo = None
 
         def __parseBytes(self, prop):
             # A null-terminated Unicode string.
-            self.string = prop.extra[0:-2].decode('utf-16')
+            try:
+                self.string = prop.extra[0:-2].decode('utf-16')
+            except UnicodeDecodeError, reason:
+                self.todo = reason
+                self.string = prop.extra[0:-2].decode('utf-16', errors="replace")
 
         def appendLines(self, recHdl, prop, level):
             self.__parseBytes(prop)
@@ -502,7 +507,9 @@ class FOPT:
 
         def dumpXml(self, recHdl, prop):
             self.__parseBytes(prop)
-            recHdl.appendLine('<%s value="%s"/>' % (self.name, self.string))
+            if self.todo:
+                print '<todo what="UnicodeComplex::dumpXml(): %s"/>' % self.todo
+            recHdl.appendLine('<%s value="%s"/>' % (self.name, globals.encodeName(self.string)))
 
     class GtextUNICODE(UnicodeComplex):
 
diff --git a/test/doc/pass/abi5027-1.doc b/test/doc/pass/abi5027-1.doc
new file mode 100644
index 0000000..629cb33
Binary files /dev/null and b/test/doc/pass/abi5027-1.doc differ


More information about the Libreoffice-commits mailing list