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

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Tue Sep 28 07:29:27 UTC 2021


 msodumper/wmfrecord.py |   21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

New commits:
commit 7bcbe575ce88e4daa6f6335d0b78acc58917cb3e
Author:     Hossein <hossein at libreoffice.org>
AuthorDate: Tue Sep 28 09:27:19 2021 +0200
Commit:     Hossein <hossein at libreoffice.org>
CommitDate: Tue Sep 28 09:29:10 2021 +0200

    Added dump() for META_POLYLINE record in wmf-dump
    
    Added dump() for the META_POLYLINE (PolyLine) record in wmf-dump.py
    
    Change-Id: Ie15f208ee46664cfcc915520d6416b1f3beb8421
    Reviewed-on: https://gerrit.libreoffice.org/c/mso-dumper/+/122731
    Tested-by: Hossein <hossein at libreoffice.org>
    Reviewed-by: Hossein <hossein at libreoffice.org>

diff --git a/msodumper/wmfrecord.py b/msodumper/wmfrecord.py
index 272ba79..dc1ecdb 100644
--- a/msodumper/wmfrecord.py
+++ b/msodumper/wmfrecord.py
@@ -1103,13 +1103,24 @@ class Polygon(WMFRecord):
         assert self.pos == dataPos + self.RecordSize * 2
 
 
-class Polyline(WMFRecord):
-    def __init__(self, parent):
+class PolyLine(WMFRecord):
+    def __init__(self, parent, name=None):
         WMFRecord.__init__(self, parent)
+        if name:
+            self.name = name
+        else:
+            self.name = "polyline"
 
     def dump(self):
-        print("<todo/>")
-        pass
+        dataPos = self.pos
+        print('<%s type="PolyLine">' % self.name)
+        self.printAndSet("RecordSize", self.readuInt32(), hexdump=False)
+        self.printAndSet("RecordFunction", self.readuInt16(), hexdump=True)
+        self.printAndSet("NumberOfPoints", self.readInt16(), hexdump=False)
+        for i in range(self.NumberOfPoints):
+            PointS(self, "aPoint%d" % i).dump()
+        print('</%s>' % self.name)
+        assert self.pos == dataPos + self.RecordSize * 2
 
 
 class SetTextJustification(WMFRecord):
@@ -1824,7 +1835,7 @@ RecordType = {
     0x0231: ['META_SETMAPPERFLAGS', SetMapperFlags],
     0x0234: ['META_SELECTPALETTE', SelectPalette],
     0x0324: ['META_POLYGON', Polygon],
-    0x0325: ['META_POLYLINE', Polyline],
+    0x0325: ['META_POLYLINE', PolyLine],
     0x020A: ['META_SETTEXTJUSTIFICATION', SetTextJustification],
     0x020B: ['META_SETWINDOWORG', SetWindowOrg],
     0x020C: ['META_SETWINDOWEXT', SetWindowExt],


More information about the Libreoffice-commits mailing list