[Libreoffice-commits] mso-dumper.git: msodumper/pptrecord.py

Noel Grandin noel.grandin at collabora.co.uk
Wed Nov 1 06:16:41 UTC 2017


 msodumper/pptrecord.py |   28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

New commits:
commit c99d5a22f9dfebd595308d9dc5f20112674a3b8c
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Mon Oct 23 16:34:09 2017 +0200

    improve parsing of PPT records
    
    I didn't know what to do with the ColorPropertyHandler constructor
    call, but it definitely should be reading 4 bytes, not 2 bytes and
    4 bytes.
    
    Without this change, I get clearly corrupt DFF_PST_StyleTextPropAtom
    data when dumping some PPT files produced by LO.
    
    Change-Id: I98fc6cd3398fee2687c98fe9f9d7bd330b1ab4e5
    Reviewed-on: https://gerrit.libreoffice.org/43738
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
    Tested-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/msodumper/pptrecord.py b/msodumper/pptrecord.py
index f9283d4..48cc5a2 100644
--- a/msodumper/pptrecord.py
+++ b/msodumper/pptrecord.py
@@ -841,7 +841,7 @@ class TextStyles(BaseRecordHandler):
             self.appendParaProp("bullet size %d"%bulletSize)
 
         if styleMask & 0x0020:
-            bulletColorAtom = ColorPropertyHandler(self.readUnsignedInt(2), self.readUnsignedInt(4), False, False, [], self.appendParaProp)
+            bulletColorAtom = ColorPropertyHandler(0, self.readUnsignedInt(4), False, False, [], self.appendParaProp)
             bulletColorAtom.output()
             self.appendParaProp("bullet color atom")
 
@@ -849,18 +849,6 @@ class TextStyles(BaseRecordHandler):
             paraAlignment = self.readSignedInt(2)
             self.appendParaProp("para alignment %4.4Xh"%paraAlignment)
 
-        if styleMask & 0x0400:
-            paraIndent = self.readSignedInt(2)
-            self.appendParaProp("para indent %d"%paraIndent)
-
-        if styleMask & 0x0200:
-            unused = self.readSignedInt(2)
-            self.appendParaProp("unused para property %4.4Xh"%unused)
-
-        if styleMask & 0x0100:
-            paraLeftMargin = self.readSignedInt(2)
-            self.appendParaProp("para left margin %d"%paraLeftMargin)
-
         if styleMask & 0x1000:
             paraLineSpacing = self.readSignedInt(2)
             self.appendParaProp("para linespacing %d"%paraLineSpacing)
@@ -873,6 +861,18 @@ class TextStyles(BaseRecordHandler):
             paraSpaceAfter = self.readSignedInt(2)
             self.appendParaProp("para space after %d"%paraSpaceAfter)
 
+        if styleMask & 0x0100:
+            paraLeftMargin = self.readSignedInt(2)
+            self.appendParaProp("para left margin %d"%paraLeftMargin)
+
+        if styleMask & 0x0400:
+            paraIndent = self.readSignedInt(2)
+            self.appendParaProp("para indent %d"%paraIndent)
+
+        if styleMask & 0x0200:
+            unused = self.readSignedInt(2)
+            self.appendParaProp("unused para property %4.4Xh"%unused)
+
         if styleMask & 0x8000:
             paraDefaultTabSize = self.readSignedInt(2)
             self.appendParaProp("para default tab size %d"%paraDefaultTabSize)
@@ -926,7 +926,7 @@ class TextStyles(BaseRecordHandler):
             self.appendCharProp("char font size %d"%fontSize)
 
         if styleMask & 0x40000:
-            charColorAtom = ColorPropertyHandler(self.readUnsignedInt(2), self.readUnsignedInt(4), False, False, [], self.appendCharProp)
+            charColorAtom = ColorPropertyHandler(0, self.readUnsignedInt(4), False, False, [], self.appendCharProp)
             charColorAtom.output()
             self.appendCharProp("char color atom")
 


More information about the Libreoffice-commits mailing list