diff options
author | Hossein <hossein@libreoffice.org> | 2021-09-11 21:49:37 +0200 |
---|---|---|
committer | Hossein <hossein@libreoffice.org> | 2021-09-11 21:56:24 +0200 |
commit | b641e7b062b86e4c9b5f19c1819cf2ebceee4ab8 (patch) | |
tree | 5fe47fa82e6e5a8593eee0a1fe62d02f53a888d6 /msodumper/wmfrecord.py | |
parent | 9d706a8f4a0d35a2b11ff1f67b401af05926241a (diff) |
Added classes with empty dump for all wmf records
Added classes for all the wmf records according to the function names
in GDI. Checked all the names to be compliant with Wine and MS
documents.
The dump() functions for ~70 classes will be completed later.
Change-Id: I9893cc1db933b090000916d0fa5d73bad39526b2
Reviewed-on: https://gerrit.libreoffice.org/c/mso-dumper/+/121965
Tested-by: Hossein <hossein@libreoffice.org>
Reviewed-by: Hossein <hossein@libreoffice.org>
Diffstat (limited to 'msodumper/wmfrecord.py')
-rw-r--r-- | msodumper/wmfrecord.py | 827 |
1 files changed, 750 insertions, 77 deletions
diff --git a/msodumper/wmfrecord.py b/msodumper/wmfrecord.py index 96cdca1..feb9d24 100644 --- a/msodumper/wmfrecord.py +++ b/msodumper/wmfrecord.py @@ -6,6 +6,7 @@ # from .binarystream import BinaryStream +import base64 PlaceableKey = { 0x9ac6cdd7: "META_PLACEABLE", @@ -629,7 +630,6 @@ class Rect(WMFRecord): class RectL(WMFRecord): """The RectL Object defines a rectangle.""" - def __init__(self, parent, name=None): WMFRecord.__init__(self, parent) if name: @@ -649,7 +649,6 @@ class RectL(WMFRecord): class SizeL(WMFRecord): """The SizeL Object defines a rectangle.""" - def __init__(self, parent, name=None): WMFRecord.__init__(self, parent) if name: @@ -667,7 +666,6 @@ class SizeL(WMFRecord): class PointL(WMFRecord): """The PointL Object defines the coordinates of a point.""" - def __init__(self, parent, name=None): WMFRecord.__init__(self, parent) if name: @@ -685,7 +683,6 @@ class PointL(WMFRecord): class PointS(WMFRecord): """The PointS Object defines the x- and y-coordinates of a point.""" - def __init__(self, parent, name): WMFRecord.__init__(self, parent) self.name = name @@ -700,7 +697,6 @@ class PointS(WMFRecord): class ColorRef(WMFRecord): """The ColorRef Object defines the RGB color.""" - def __init__(self, parent, name): WMFRecord.__init__(self, parent) self.name = name @@ -715,7 +711,7 @@ class ColorRef(WMFRecord): self.parent.pos = self.pos -class WMFLineto(WMFRecord): +class Lineto(WMFRecord): """Draws a line from the current position up to, but not including, the specified point.""" def __init__(self, parent): @@ -794,7 +790,7 @@ class PlaceableHeader(WMFRecord): return False -class WmfSetviewportorgex(WMFRecord): +class Setviewportorgex(WMFRecord): """Defines the viewport origin.""" def __init__(self, parent): @@ -808,78 +804,755 @@ class WmfSetviewportorgex(WMFRecord): assert self.pos - posOrig == self.Size -"""The RecordType enumeration defines values that uniquely identify EMF records.""" +class RealizePalette(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class SetPaletteEntries(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class SetBkMode(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class SetMapMode(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class SetROP2(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class SetRelAbs(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class SetPolyFillMode(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class SetStretchBltMode(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class SetTextCharacterExtra(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class RestoreDC: + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class ResizePalette(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class CreateDIBPatternBrush(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class SetLayout(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class SetTextColor(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class SetBkColor(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class SetTextColor(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class MoveTo(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class OffsetClipRgn(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class FillRgn(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class SetMapperFlags(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class SelectPalette(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class Polygon(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class Polyline(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class SetTextJustification(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class SetWindowOrg(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class SetWindowExt: + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class SetViewportOrg(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class SetViewportExt(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class OffsetWindowOrg(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class ScaleWindowExt(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class ScaleViewportExt(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class ExcludeClipRect(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class IntersectClipRect(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class Ellipse(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class FrameRgn(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class AnimatePalette(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class TextOut(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class PolyPolygon(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class ExtFloodFill(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class Rectangle(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class SetPixel(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class RoundRect(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class SetPixel(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class SetPixel(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class SetPixel(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class RoundRect(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class SetPixel(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class PatBlt(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class RoundRect(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class SaveDC(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class SaveDC(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class Pie(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class StretchBlt(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class Escape(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class InvertRgn(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class PaintRgn(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class SelectClipRgn(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class SelectClipRgn(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class SelectObject(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class SetTextAlign(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class Arc(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class Chord(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class BitBlt(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class ExtTextOut(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class SetDIBitsToDevice(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class StretchDIBits(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class StretchDIBits(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class StretchDIBits(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class DeleteObject(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class CreatePalette(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class CreatePatternBrush(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class CreatePenIndirect(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class CreateFontIndirect(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class CreateBrushIndirect(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +class CreateRectRgn(WMFRecord): + def __init__(self, parent): + WMFRecord.__init__(self, parent) + + def dump(self): + print("<todo/>") + pass + + +# GDI Functions: https://docs.microsoft.com/en-us/windows/win32/api/_gdi/ +# Wine API / GDI: https://source.winehq.org/WineAPI/gdi.html +"""The RecordType enumeration defines values that uniquely identify WMF records.""" RecordType = { 0x0000: ['META_EOF'], - 0x0035: ['META_REALIZEPALETTE'], - 0x0037: ['META_SETPALENTRIES'], - 0x0102: ['META_SETBKMODE'], - 0x0103: ['META_SETMAPMODE'], - 0x0104: ['META_SETROP2'], - 0x0105: ['META_SETRELABS'], - 0x0106: ['META_SETPOLYFILLMODE'], - 0x0107: ['META_SETSTRETCHBLTMODE'], - 0x0108: ['META_SETTEXTCHAREXTRA'], - 0x0127: ['META_RESTOREDC'], - 0x0139: ['META_RESIZEPALETTE'], - 0x0142: ['META_DIBCREATEPATTERNBRUSH'], - 0x0149: ['META_SETLAYOUT'], - 0x0201: ['META_SETBKCOLOR'], - 0x0209: ['META_SETTEXTCOLOR'], - 0x0211: ['META_OFFSETVIEWPORTORG'], - 0x0213: ['META_LINETO', WMFLineto], - 0x0214: ['META_MOVETO'], - 0x0220: ['META_OFFSETCLIPRGN'], - 0x0228: ['META_FILLREGION'], - 0x0231: ['META_SETMAPPERFLAGS'], - 0x0234: ['META_SELECTPALETTE'], - 0x0324: ['META_POLYGON'], - 0x0325: ['META_POLYLINE'], - 0x020A: ['META_SETTEXTJUSTIFICATION'], - 0x020B: ['META_SETWINDOWORG'], - 0x020C: ['META_SETWINDOWEXT'], - 0x020D: ['META_SETVIEWPORTORG'], - 0x020E: ['META_SETVIEWPORTEXT'], - 0x020F: ['META_OFFSETWINDOWORG'], - 0x0410: ['META_SCALEWINDOWEXT'], - 0x0412: ['META_SCALEVIEWPORTEXT'], - 0x0415: ['META_EXCLUDECLIPRECT'], - 0x0416: ['META_INTERSECTCLIPRECT'], - 0x0418: ['META_ELLIPSE'], - 0x0419: ['META_FLOODFILL'], - 0x0429: ['META_FRAMEREGION'], - 0x0436: ['META_ANIMATEPALETTE'], - 0x0521: ['META_TEXTOUT'], - 0x0538: ['META_POLYPOLYGON'], - 0x0548: ['META_EXTFLOODFILL'], - 0x041B: ['META_RECTANGLE'], - 0x041F: ['META_SETPIXEL'], - 0x061C: ['META_ROUNDRECT'], - 0x061D: ['META_PATBLT'], - 0x001E: ['META_SAVEDC'], - 0x081A: ['META_PIE'], - 0x0B23: ['META_STRETCHBLT'], - 0x0626: ['META_ESCAPE'], - 0x012A: ['META_INVERTREGION'], - 0x012B: ['META_PAINTREGION'], - 0x012C: ['META_SELECTCLIPREGION'], - 0x012D: ['META_SELECTOBJECT'], - 0x012E: ['META_SETTEXTALIGN'], - 0x0817: ['META_ARC'], - 0x0830: ['META_CHORD'], - 0x0922: ['META_BITBLT'], - 0x0a32: ['META_EXTTEXTOUT'], - 0x0d33: ['META_SETDIBTODEV'], - 0x0940: ['META_DIBBITBLT'], - 0x0b41: ['META_DIBSTRETCHBLT'], - 0x0f43: ['META_STRETCHDIB'], - 0x01f0: ['META_DELETEOBJECT'], - 0x00f7: ['META_CREATEPALETTE'], - 0x01F9: ['META_CREATEPATTERNBRUSH'], - 0x02FA: ['META_CREATEPENINDIRECT'], - 0x02FB: ['META_CREATEFONTINDIRECT'], - 0x02FC: ['META_CREATEBRUSHINDIRECT'], - 0x06FF: ['META_CREATEREGION'], + 0x0035: ['META_REALIZEPALETTE', RealizePalette], + 0x0037: ['META_SETPALENTRIES', SetPaletteEntries], + 0x0102: ['META_SETBKMODE', SetBkMode], + 0x0103: ['META_SETMAPMODE', SetMapMode], + 0x0104: ['META_SETROP2', SetROP2], + 0x0105: ['META_SETRELABS', SetRelAbs], + 0x0106: ['META_SETPOLYFILLMODE', SetPolyFillMode], + 0x0107: ['META_SETSTRETCHBLTMODE', SetStretchBltMode], + 0x0108: ['META_SETTEXTCHAREXTRA', SetTextCharacterExtra], + 0x0127: ['META_RESTOREDC', RestoreDC], + 0x0139: ['META_RESIZEPALETTE', ResizePalette], + 0x0142: ['META_DIBCREATEPATTERNBRUSH', CreateDIBPatternBrush], + 0x0149: ['META_SETLAYOUT', SetLayout], + 0x0201: ['META_SETBKCOLOR', SetBkColor], + 0x0209: ['META_SETTEXTCOLOR', SetTextColor], + 0x0211: ['META_OFFSETVIEWPORTORG', Setviewportorgex], + 0x0213: ['META_LINETO', Lineto], + 0x0214: ['META_MOVETO', MoveTo], + 0x0220: ['META_OFFSETCLIPRGN', OffsetClipRgn], + 0x0228: ['META_FILLREGION', FillRgn], + 0x0231: ['META_SETMAPPERFLAGS', SetMapperFlags], + 0x0234: ['META_SELECTPALETTE', SelectPalette], + 0x0324: ['META_POLYGON', Polygon], + 0x0325: ['META_POLYLINE', Polyline], + 0x020A: ['META_SETTEXTJUSTIFICATION', SetTextJustification], + 0x020B: ['META_SETWINDOWORG', SetWindowOrg], + 0x020C: ['META_SETWINDOWEXT', SetWindowExt], + 0x020D: ['META_SETVIEWPORTORG', SetViewportOrg], + 0x020E: ['META_SETVIEWPORTEXT', SetViewportExt], + 0x020F: ['META_OFFSETWINDOWORG', OffsetWindowOrg], + 0x0410: ['META_SCALEWINDOWEXT', ScaleWindowExt], + 0x0412: ['META_SCALEVIEWPORTEXT', ScaleViewportExt], + 0x0415: ['META_EXCLUDECLIPRECT', ExcludeClipRect], + 0x0416: ['META_INTERSECTCLIPRECT', IntersectClipRect], + 0x0418: ['META_ELLIPSE', Ellipse], + 0x0419: ['META_FLOODFILL', FloodFill], + 0x0429: ['META_FRAMEREGION', FrameRgn], + 0x0436: ['META_ANIMATEPALETTE', AnimatePalette], + 0x0521: ['META_TEXTOUT', TextOut], + 0x0538: ['META_POLYPOLYGON', PolyPolygon], + 0x0548: ['META_EXTFLOODFILL', ExtFloodFill], + 0x041B: ['META_RECTANGLE', Rectangle], + 0x041F: ['META_SETPIXEL', SetPixel], + 0x061C: ['META_ROUNDRECT', RoundRect], + 0x061D: ['META_PATBLT', PatBlt], + 0x001E: ['META_SAVEDC', SaveDC], + 0x081A: ['META_PIE', Pie], + 0x0B23: ['META_STRETCHBLT', StretchBlt], + 0x0626: ['META_ESCAPE', Escape], + 0x012A: ['META_INVERTREGION', InvertRgn], + 0x012B: ['META_PAINTREGION', PaintRgn], + 0x012C: ['META_SELECTCLIPREGION', SelectClipRgn], + 0x012D: ['META_SELECTOBJECT', SelectObject], + 0x012E: ['META_SETTEXTALIGN', SetTextAlign], + 0x0817: ['META_ARC', Arc], + 0x0830: ['META_CHORD', Chord], + 0x0922: ['META_BITBLT', BitBlt], + 0x0a32: ['META_EXTTEXTOUT', ExtTextOut], + 0x0d33: ['META_SETDIBTODEV', SetDIBitsToDevice], + 0x0940: ['META_DIBBITBLT', BitBlt], + 0x0b41: ['META_DIBSTRETCHBLT', StretchBlt], + 0x0f43: ['META_STRETCHDIB', StretchDIBits], + 0x01f0: ['META_DELETEOBJECT', DeleteObject], + 0x00f7: ['META_CREATEPALETTE', CreatePalette], + 0x01F9: ['META_CREATEPATTERNBRUSH', CreatePatternBrush], + 0x02FA: ['META_CREATEPENINDIRECT', CreatePenIndirect], + 0x02FB: ['META_CREATEFONTINDIRECT', CreateFontIndirect], + 0x02FC: ['META_CREATEBRUSHINDIRECT', CreateBrushIndirect], + 0x06FF: ['META_CREATEREGION', CreateRectRgn], } # vim:set filetype=python shiftwidth=4 softtabstop=4 expandtab: |