[Libreoffice-commits] .: 2 commits - src/docrecord.py
Miklos Vajna
vmiklos at kemper.freedesktop.org
Wed Nov 28 06:23:07 PST 2012
src/docrecord.py | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 59 insertions(+), 3 deletions(-)
New commits:
commit 6a30f1ed52127af0fa0fb1b56474ac11d74743bf
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Wed Nov 28 15:19:42 2012 +0100
dump Dogrid
diff --git a/src/docrecord.py b/src/docrecord.py
index e272b09..45691fc 100755
--- a/src/docrecord.py
+++ b/src/docrecord.py
@@ -862,6 +862,28 @@ class DopTypography(DOCDirStream):
self.pos += 102
print '</dopTypography>'
+class Dogrid(DOCDirStream):
+ """The Dogrid structure specifies parameters for the drawn object properties of the document."""
+ def __init__(self, dop):
+ DOCDirStream.__init__(self, dop.bytes)
+ self.pos = dop.pos
+
+ def dump(self):
+ print '<dogrid type="Dogrid" offset="%d" size="10 bytes">' % self.pos
+ self.printAndSet("xaGrid", self.readuInt16())
+ self.printAndSet("yaGrid", self.readuInt16())
+ self.printAndSet("dxaGrid", self.readuInt16())
+ self.printAndSet("dyaGrid", self.readuInt16())
+
+ buf = self.readuInt8()
+ self.printAndSet("dyGridDisplay", (buf & 0x7f)) # 1..7th bits
+ self.printAndSet("unused", self.getBit(buf, 7))
+
+ buf = self.readuInt8()
+ self.printAndSet("dxGridDisplay", (buf & 0x7f)) # 1..7th bits
+ self.printAndSet("fFollowMargins", self.getBit(buf, 7))
+ print '</dogrid>'
+
class Dop97(DOCDirStream):
"""The Dop97 structure contains document and compatibility settings."""
def __init__(self, dop):
@@ -881,7 +903,9 @@ class Dop97(DOCDirStream):
dopTypography.dump()
assert dopTypography.pos == self.pos + 310
self.pos += 310
- # TODO dogrid
+ dogrid = Dogrid(self)
+ dogrid.dump()
+ assert dogrid.pos == self.pos + 10
self.pos += 10
buf = self.readuInt8()
commit e29d29d4cf02d02104216a7780a7cce0428f7298
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Wed Nov 28 15:10:24 2012 +0100
dump DopTypography
diff --git a/src/docrecord.py b/src/docrecord.py
index 435f2f1..e272b09 100755
--- a/src/docrecord.py
+++ b/src/docrecord.py
@@ -832,6 +832,36 @@ class Dop95(DOCDirStream):
self.pos += 4
print '</dop95>'
+class DopTypography(DOCDirStream):
+ """The DopTypography structure contains East Asian language typography settings."""
+ def __init__(self, dop):
+ DOCDirStream.__init__(self, dop.bytes)
+ self.pos = dop.pos
+
+ def dump(self):
+ print '<dopTypography type="DopTypography" offset="%d" size="310 bytes">' % self.pos
+ buf = self.readuInt16()
+ self.printAndSet("fKerningPunct", self.getBit(buf, 0))
+ self.printAndSet("iJustification", (buf & 0x0006) >> 1) # 2..3rd bits
+ self.printAndSet("iLevelOfKinsoku", (buf & 0x0018) >> 1) # 4..5th bits
+ self.printAndSet("f2on1", self.getBit(buf, 5))
+ self.printAndSet("unused", self.getBit(buf, 6))
+ self.printAndSet("iCustomKsu", (buf & 0x0380) >> 7) # 8..10th bits
+ self.printAndSet("fJapaneseUseLevel2", self.getBit(buf, 10))
+ self.printAndSet("reserved", (buf & 0xf800) >> 11) # 12..16th bits
+
+ self.printAndSet("cchFollowingPunct", self.readInt16())
+ self.printAndSet("cchLeadingPunct", self.readInt16())
+ if self.cchFollowingPunct != 0:
+ print '<todo what="DopTypography::dump(): cchFollowingPunct != 0 not handled"/>'
+ else:
+ self.pos += 202
+ if self.cchLeadingPunct != 0:
+ print '<todo what="DopTypography::dump(): cchLeadingPunct != 0 not handled"/>'
+ else:
+ self.pos += 102
+ print '</dopTypography>'
+
class Dop97(DOCDirStream):
"""The Dop97 structure contains document and compatibility settings."""
def __init__(self, dop):
@@ -847,7 +877,9 @@ class Dop97(DOCDirStream):
self.pos += 88
self.printAndSet("adt", self.readuInt16())
- # TODO doptypography
+ dopTypography = DopTypography(self)
+ dopTypography.dump()
+ assert dopTypography.pos == self.pos + 310
self.pos += 310
# TODO dogrid
self.pos += 10
@@ -1116,7 +1148,7 @@ class Dop(DOCDirStream):
def dump(self):
print '<dop type="Dop" offset="%s" size="%d bytes">' % (self.pos, self.size)
if self.fib.nFibNew == 0x0112:
- dop2007 = Dop2007(self)
+ Dop2007(self).dump()
else:
print """<todo what="Dop.dump() doesn't know how to handle nFibNew = %s">""" % hex(self.nFibNew)
print '</dop>'
More information about the Libreoffice-commits
mailing list