[Libreoffice-commits] mso-dumper.git: 2 commits - src/docrecord.py
Miklos Vajna
vmiklos at kemper.freedesktop.org
Wed Aug 7 05:36:27 PDT 2013
src/docrecord.py | 227 +++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 221 insertions(+), 6 deletions(-)
New commits:
commit 2a621595e979bf1daacc010faa7b6f32d67f89fa
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Wed Aug 7 14:31:50 2013 +0200
dump BrcType
diff --git a/src/docrecord.py b/src/docrecord.py
index fb89308..ac8b8f5 100644
--- a/src/docrecord.py
+++ b/src/docrecord.py
@@ -392,7 +392,7 @@ class BRC(DOCDirStream):
self.posOrig = self.pos
self.cv = self.readuInt32() # TODO parse COLORREF
self.dptLineWidth = self.readuInt8()
- self.brcType = self.readuInt8() # TODO parse BrcType
+ self.brcType = self.readuInt8()
buf = self.readuInt16()
self.dptSpace = buf & 0x1f # 1..5th bits
self.fShadow = self.getBit(buf, 5)
@@ -403,7 +403,7 @@ class BRC(DOCDirStream):
print '<brc type="BRC" offset="%d">' % self.posOrig
self.printAndSet("cv", self.cv)
self.printAndSet("dptLineWidth", self.dptLineWidth)
- self.printAndSet("brcType", self.brcType)
+ self.printAndSet("brcType", self.brcType, dict = BrcType)
self.printAndSet("dptSpace", self.dptSpace)
self.printAndSet("fShadow", self.fShadow)
self.printAndSet("fFrame", self.fFrame)
@@ -688,6 +688,200 @@ class PICF_Shape(DOCDirStream):
self.parent.pos = self.pos
print '</%s>' % self.name
+# BrcType is an unsigned integer that specifies the type of border.
+BrcType = {
+ 0x00: "none",
+ 0x01: "single",
+ 0x03: "double",
+ 0x05: "A thin single solid line.",
+ 0x06: "dotted",
+ 0x07: "dashed",
+ 0x08: "dotDash",
+ 0x09: "dotDotDash",
+ 0x0A: "triple",
+ 0x0B: "thinThickSmallGap",
+ 0x0C: "thickThinSmallGap",
+ 0x0D: "thinThickThinSmallGap",
+ 0x0E: "thinThickMediumGap",
+ 0x0F: "thickThinMediumGap",
+ 0x10: "thinThickThinMediumGap",
+ 0x11: "thinThickLargeGap",
+ 0x12: "thickThinLargeGap",
+ 0x13: "thinThickThinLargeGap",
+ 0x14: "wave",
+ 0x15: "doubleWave",
+ 0x16: "dashSmallGap",
+ 0x17: "dashDotStroked",
+ 0x18: "threeDEmboss",
+ 0x19: "threeDEngrave",
+ 0x1A: "outset",
+ 0x1B: "inset",
+ 0x40: "apples",
+ 0x41: "archedScallops",
+ 0x42: "babyPacifier",
+ 0x43: "babyRattle",
+ 0x44: "balloons3Colors",
+ 0x45: "balloonsHotAir",
+ 0x46: "basicBlackDashes",
+ 0x47: "basicBlackDots",
+ 0x48: "basicBlackSquares",
+ 0x49: "basicThinLines",
+ 0x4A: "basicWhiteDashes",
+ 0x4B: "basicWhiteDots",
+ 0x4C: "basicWhiteSquares",
+ 0x4D: "basicWideInline",
+ 0x4E: "basicWideMidline",
+ 0x4F: "basicWideOutline",
+ 0x50: "bats",
+ 0x51: "birds",
+ 0x52: "birdsFlight",
+ 0x53: "cabins",
+ 0x54: "cakeSlice",
+ 0x55: "candyCorn",
+ 0x56: "celticKnotwork",
+ 0x57: "certificateBanner",
+ 0x58: "chainLink",
+ 0x59: "champagneBottle",
+ 0x5A: "checkedBarBlack",
+ 0x5B: "checkedBarColor",
+ 0x5C: "checkered",
+ 0x5D: "christmasTree",
+ 0x5E: "circlesLines",
+ 0x5F: "circlesRectangles",
+ 0x60: "classicalWave",
+ 0x61: "clocks",
+ 0x62: "compass",
+ 0x63: "confetti",
+ 0x64: "confettiGrays",
+ 0x65: "confettiOutline",
+ 0x66: "confettiStreamers",
+ 0x67: "confettiWhite",
+ 0x68: "cornerTriangles",
+ 0x69: "couponCutoutDashes",
+ 0x6A: "couponCutoutDots",
+ 0x6B: "crazyMaze",
+ 0x6C: "creaturesButterfly",
+ 0x6D: "creaturesFish",
+ 0x6E: "creaturesInsects",
+ 0x6F: "creaturesLadyBug",
+ 0x70: "crossStitch",
+ 0x71: "cup",
+ 0x72: "decoArch",
+ 0x73: "decoArchColor",
+ 0x74: "decoBlocks",
+ 0x75: "diamondsGray",
+ 0x76: "doubleD",
+ 0x77: "doubleDiamonds",
+ 0x78: "earth1",
+ 0x79: "earth2",
+ 0x7A: "eclipsingSquares1",
+ 0x7B: "eclipsingSquares2",
+ 0x7C: "eggsBlack",
+ 0x7D: "fans",
+ 0x7E: "film",
+ 0x7F: "firecrackers",
+ 0x80: "flowersBlockPrint",
+ 0x81: "flowersDaisies",
+ 0x82: "flowersModern1",
+ 0x83: "flowersModern2",
+ 0x84: "flowersPansy",
+ 0x85: "flowersRedRose",
+ 0x86: "flowersRoses",
+ 0x87: "flowersTeacup",
+ 0x88: "flowersTiny",
+ 0x89: "gems",
+ 0x8A: "gingerbreadMan",
+ 0x8B: "gradient",
+ 0x8C: "handmade1",
+ 0x8D: "handmade2",
+ 0x8E: "heartBalloon",
+ 0x8F: "heartGray",
+ 0x90: "hearts",
+ 0x91: "heebieJeebies",
+ 0x92: "holly",
+ 0x93: "houseFunky",
+ 0x94: "hypnotic",
+ 0x95: "iceCreamCones",
+ 0x96: "lightBulb",
+ 0x97: "lightning1",
+ 0x98: "lightning2",
+ 0x99: "mapPins",
+ 0x9A: "mapleLeaf",
+ 0x9B: "mapleMuffins",
+ 0x9C: "marquee",
+ 0x9D: "marqueeToothed",
+ 0x9E: "moons",
+ 0x9F: "mosaic",
+ 0xA0: "musicNotes",
+ 0xA1: "northwest",
+ 0xA2: "ovals",
+ 0xA3: "packages",
+ 0xA4: "palmsBlack",
+ 0xA5: "palmsColor",
+ 0xA6: "paperClips",
+ 0xA7: "papyrus",
+ 0xA8: "partyFavor",
+ 0xA9: "partyGlass",
+ 0xAA: "pencils",
+ 0xAB: "people",
+ 0xAC: "peopleWaving",
+ 0xAD: "peopleHats",
+ 0xAE: "poinsettias",
+ 0xAF: "postageStamp",
+ 0xB0: "pumpkin1",
+ 0xB1: "pushPinNote2",
+ 0xB2: "pushPinNote1",
+ 0xB3: "pyramids",
+ 0xB4: "pyramidsAbove",
+ 0xB5: "quadrants",
+ 0xB6: "rings",
+ 0xB7: "safari",
+ 0xB8: "sawtooth",
+ 0xB9: "sawtoothGray",
+ 0xBA: "scaredCat",
+ 0xBB: "seattle",
+ 0xBC: "shadowedSquares",
+ 0xBD: "sharksTeeth",
+ 0xBE: "shorebirdTracks",
+ 0xBF: "skyrocket",
+ 0xC0: "snowflakeFancy",
+ 0xC1: "snowflakes",
+ 0xC2: "sombrero",
+ 0xC3: "southwest",
+ 0xC4: "stars",
+ 0xC5: "starsTop",
+ 0xC6: "stars3d",
+ 0xC7: "starsBlack",
+ 0xC8: "starsShadowed",
+ 0xC9: "sun",
+ 0xCA: "swirligig",
+ 0xCB: "tornPaper",
+ 0xCC: "tornPaperBlack",
+ 0xCD: "trees",
+ 0xCE: "triangleParty",
+ 0xCF: "triangles",
+ 0xD0: "tribal1",
+ 0xD1: "tribal2",
+ 0xD2: "tribal3",
+ 0xD3: "tribal4",
+ 0xD4: "tribal5",
+ 0xD5: "tribal6",
+ 0xD6: "twistedLines1",
+ 0xD7: "twistedLines2",
+ 0xD8: "vine",
+ 0xD9: "waveline",
+ 0xDA: "weavingAngles",
+ 0xDB: "weavingBraid",
+ 0xDC: "weavingRibbon",
+ 0xDD: "weavingStrips",
+ 0xDE: "whiteFlowers",
+ 0xDF: "woodwork",
+ 0xE0: "xIllusions",
+ 0xE1: "zanyTriangles",
+ 0xE2: "zigZag",
+ 0xE3: "zigZagStitch"
+ }
+
class Brc80(DOCDirStream):
"""The Brc80 structure describes a border."""
def __init__(self, parent, name):
@@ -700,7 +894,7 @@ class Brc80(DOCDirStream):
buf = self.readuInt32()
print '<%s type="Brc80" offset="%d">' % (self.name, self.pos)
self.printAndSet("dptLineWidth", buf & 0x000000ff) # 1..8th bits
- self.printAndSet("brcType", (buf & 0x0000ff00) >> 8) # 9..16th bits, TODO parse BrcType
+ self.printAndSet("brcType", (buf & 0x0000ff00) >> 8, dict = BrcType) # 9..16th bits
self.printAndSet("ico", (buf & 0x00ff0000) >> 16, dict = Ico) # 17..24th bits
self.printAndSet("dptSpace", (buf & 0x1f000000) >> 24) # 25..29th bits
self.printAndSet("fShadow", self.getBit(buf, 29))
commit a0020a6cc7431b1fb8b7b46697f0ece34c56232e
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Wed Aug 7 14:13:51 2013 +0200
dump Brc80
diff --git a/src/docrecord.py b/src/docrecord.py
index b73fba4..fb89308 100644
--- a/src/docrecord.py
+++ b/src/docrecord.py
@@ -688,6 +688,27 @@ class PICF_Shape(DOCDirStream):
self.parent.pos = self.pos
print '</%s>' % self.name
+class Brc80(DOCDirStream):
+ """The Brc80 structure describes a border."""
+ def __init__(self, parent, name):
+ DOCDirStream.__init__(self, parent.bytes)
+ self.pos = parent.pos
+ self.parent = parent
+ self.name = name
+
+ def dump(self):
+ buf = self.readuInt32()
+ print '<%s type="Brc80" offset="%d">' % (self.name, self.pos)
+ self.printAndSet("dptLineWidth", buf & 0x000000ff) # 1..8th bits
+ self.printAndSet("brcType", (buf & 0x0000ff00) >> 8) # 9..16th bits, TODO parse BrcType
+ self.printAndSet("ico", (buf & 0x00ff0000) >> 16, dict = Ico) # 17..24th bits
+ self.printAndSet("dptSpace", (buf & 0x1f000000) >> 24) # 25..29th bits
+ self.printAndSet("fShadow", self.getBit(buf, 29))
+ self.printAndSet("fFrame", self.getBit(buf, 30))
+ self.printAndSet("reserved", self.getBit(buf, 31))
+ print '</%s>' % self.name
+ self.parent.pos = self.pos
+
class PICMID(DOCDirStream):
"""The PICMID structure specifies the size and border information for a picture."""
def __init__(self, parent):
@@ -707,10 +728,10 @@ class PICMID(DOCDirStream):
self.printAndSet("dyaReserved2", self.readuInt16())
self.printAndSet("fReserved", self.readuInt8())
self.printAndSet("bpp", self.readuInt8())
- self.printAndSet("brcTop80", self.readuInt32()) # TODO dump Brc80
- self.printAndSet("brcLeft80", self.readuInt32())
- self.printAndSet("brcBottom80", self.readuInt32())
- self.printAndSet("brcRight80", self.readuInt32())
+ Brc80(self, "brcTop80").dump()
+ Brc80(self, "brcLeft80").dump()
+ Brc80(self, "brcBottom80").dump()
+ Brc80(self, "brcRight80").dump()
self.printAndSet("dxaReserved3", self.readuInt16())
self.printAndSet("dyaReserved3", self.readuInt16())
self.parent.pos = self.pos
More information about the Libreoffice-commits
mailing list