src/docrecord.py | 149 ++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 143 insertions(+), 6 deletions(-)
New commits: commit d574b3276ffe56294a20bacc4611fcc66de24e49 Author: Miklos Vajna <[email protected]> Date: Mon Nov 12 17:28:38 2012 +0100 dump StkParaLpUpxGrLpUpxRM diff --git a/src/docrecord.py b/src/docrecord.py index 24f6df6..abaed0e 100755 --- a/src/docrecord.py +++ b/src/docrecord.py @@ -799,6 +799,19 @@ class LPUpxChpx(DOCDirStream): self.pos = uPXPadding.pos print '</lPUpxChpx>' +class StkParaLpUpxGrLpUpxRM(DOCDirStream): + """The StkParaLPUpxGrLPUpxRM structure specifies revision-marking information and formatting for paragraph styles.""" + def __init__(self, stkParaGRLPUPX): + DOCDirStream.__init__(self, stkParaGRLPUPX.bytes) + self.pos = stkParaGRLPUPX.pos + + def dump(self): + print '<stkParaLpUpxGrLpUpxRM type="StkParaLpUpxGrLpUpxRM" offset="%d">' % self.pos + self.printAndSet("cbStkParaUpxGrLpUpxRM", self.getuInt16()) + if self.cbStkParaUpxGrLpUpxRM != 0: + print '<todo what="StkParaLpUpxGrLpUpxRM: cbStkParaUpxGrLpUpxRM != 0 not implemented"/>' + print '</stkParaLpUpxGrLpUpxRM>' + class StkParaGRLPUPX(DOCDirStream): """The StkParaGRLPUPX structure that specifies the formatting properties for a paragraph style.""" def __init__(self, grLPUpxSw): @@ -814,6 +827,9 @@ class StkParaGRLPUPX(DOCDirStream): lpUpxChpx = LPUpxChpx(self) lpUpxChpx.dump() self.pos = lpUpxChpx.pos + stkParaLpUpxGrLpUpxRM = StkParaLpUpxGrLpUpxRM(self) + stkParaLpUpxGrLpUpxRM.dump() + self.pos = stkParaLpUpxGrLpUpxRM.pos print '</stkParaGRLPUPX>' class GrLPUpxSw(DOCDirStream): commit 9d0cedce38dc97bb5dbd2c408f0a20babdea9401 Author: Miklos Vajna <[email protected]> Date: Mon Nov 12 16:56:51 2012 +0100 dump LPUpxChpx diff --git a/src/docrecord.py b/src/docrecord.py index 771ecc0..24f6df6 100755 --- a/src/docrecord.py +++ b/src/docrecord.py @@ -713,6 +713,92 @@ class Xstz(DOCDirStream): self.pos += 2 print '</xstz>' +class UpxPapx(DOCDirStream): + """The UpxPapx structure specifies the paragraph formatting properties that differ from the parent""" + def __init__(self, lPUpxPapx): + DOCDirStream.__init__(self, lPUpxPapx.bytes) + self.lPUpxPapx = lPUpxPapx + self.pos = lPUpxPapx.pos + + def dump(self): + print '<upxPapx type="UpxPapx" offset="%d">' % self.pos + self.printAndSet("istd", self.getuInt16()) + self.pos += 2 + size = self.lPUpxPapx.cbUpx - 2 + pos = 0 + print '<grpprlPapx offset="%d" size="%d bytes">' % (self.pos, size) + while size - pos > 0: + prl = Prl(self.bytes, self.pos + pos) + prl.dump() + pos += prl.getSize() + print '</grpprlPapx>' + print '</upxPapx>' + +class UpxChpx(DOCDirStream): + """The UpxChpx structure specifies the character formatting properties that differ from the parent""" + def __init__(self, lPUpxChpx): + DOCDirStream.__init__(self, lPUpxChpx.bytes) + self.lPUpxChpx = lPUpxChpx + self.pos = lPUpxChpx.pos + + def dump(self): + print '<upxChpx type="UpxChpx" offset="%d">' % self.pos + size = self.lPUpxChpx.cbUpx + pos = 0 + print '<grpprlChpx offset="%d" size="%d bytes">' % (self.pos, size) + while size - pos > 0: + prl = Prl(self.bytes, self.pos + pos) + prl.dump() + pos += prl.getSize() + print '</grpprlChpx>' + print '</upxChpx>' + +class UPXPadding: + """The UPXPadding structure specifies the padding that is used to pad the UpxPapx/Chpx/Tapx structures if any of them are an odd number of bytes in length.""" + def __init__(self, parent): + self.parent = parent + self.pos = parent.pos + + def pad(self): + if self.parent.cbUpx % 2 == 1: + self.pos += 1 + +class LPUpxPapx(DOCDirStream): + """The LPUpxPapx structure specifies paragraph formatting properties.""" + def __init__(self, stkParaGRLPUPX): + DOCDirStream.__init__(self, stkParaGRLPUPX.bytes) + self.pos = stkParaGRLPUPX.pos + + def dump(self): + print '<lPUpxPapx type="LPUpxPapx" offset="%d">' % self.pos + self.printAndSet("cbUpx", self.getuInt16()) + self.pos += 2 + upxPapx = UpxPapx(self) + upxPapx.dump() + self.pos += self.cbUpx + uPXPadding = UPXPadding(self) + uPXPadding.pad() + self.pos = uPXPadding.pos + print '</lPUpxPapx>' + +class LPUpxChpx(DOCDirStream): + """The LPUpxChpx structure specifies character formatting properties.""" + def __init__(self, stkParaGRLPUPX): + DOCDirStream.__init__(self, stkParaGRLPUPX.bytes) + self.pos = stkParaGRLPUPX.pos + + def dump(self): + print '<lPUpxChpx type="LPUpxChpx" offset="%d">' % self.pos + self.printAndSet("cbUpx", self.getuInt16()) + self.pos += 2 + upxChpx = UpxChpx(self) + upxChpx.dump() + self.pos += self.cbUpx + uPXPadding = UPXPadding(self) + uPXPadding.pad() + self.pos = uPXPadding.pos + print '</lPUpxChpx>' + class StkParaGRLPUPX(DOCDirStream): """The StkParaGRLPUPX structure that specifies the formatting properties for a paragraph style.""" def __init__(self, grLPUpxSw): @@ -722,7 +808,12 @@ class StkParaGRLPUPX(DOCDirStream): def dump(self): print '<stkParaGRLPUPX type="StkParaGRLPUPX" offset="%d">' % self.pos - elements = self.grLPUpxSw.std.stdf.stdfBase.cupx + lPUpxPapx = LPUpxPapx(self) + lPUpxPapx.dump() + self.pos = lPUpxPapx.pos + lpUpxChpx = LPUpxChpx(self) + lpUpxChpx.dump() + self.pos = lpUpxChpx.pos print '</stkParaGRLPUPX>' class GrLPUpxSw(DOCDirStream): commit 03c83207186dd0133c737d9fe732edaae0553ecd Author: Miklos Vajna <[email protected]> Date: Mon Nov 12 16:42:35 2012 +0100 dump GrLPUpxSw diff --git a/src/docrecord.py b/src/docrecord.py index f4bb2fa..771ecc0 100755 --- a/src/docrecord.py +++ b/src/docrecord.py @@ -671,9 +671,9 @@ class Stdf(DOCDirStream): def dump(self): print '<stdf type="Stdf" offset="%d">' % self.pos - stdfBase = StdfBase(self.bytes, self.mainStream, self.pos) - stdfBase.dump() - self.pos += stdfBase.size + self.stdfBase = StdfBase(self.bytes, self.mainStream, self.pos) + self.stdfBase.dump() + self.pos += self.stdfBase.size stsh = self.std.lpstd.stsh # root of the stylesheet table cbSTDBaseInFile = stsh.lpstshi.stshi.stshif.cbSTDBaseInFile print '<stdfPost2000OrNone cbSTDBaseInFile="%s">' % hex(cbSTDBaseInFile) @@ -713,6 +713,33 @@ class Xstz(DOCDirStream): self.pos += 2 print '</xstz>' +class StkParaGRLPUPX(DOCDirStream): + """The StkParaGRLPUPX structure that specifies the formatting properties for a paragraph style.""" + def __init__(self, grLPUpxSw): + DOCDirStream.__init__(self, grLPUpxSw.bytes) + self.grLPUpxSw = grLPUpxSw + self.pos = grLPUpxSw.pos + + def dump(self): + print '<stkParaGRLPUPX type="StkParaGRLPUPX" offset="%d">' % self.pos + elements = self.grLPUpxSw.std.stdf.stdfBase.cupx + print '</stkParaGRLPUPX>' + +class GrLPUpxSw(DOCDirStream): + """The GrLPUpxSw structure is an array of variable-size structures that specify the formatting of the style.""" + def __init__(self, std): + DOCDirStream.__init__(self, std.bytes) + self.std = std + self.pos = std.pos + + def dump(self): + stkMap = { + 1: StkParaGRLPUPX + } + child = stkMap[self.std.stdf.stdfBase.stk](self) + child.dump() + self.pos = child.pos + class STD(DOCDirStream): """The STD structure specifies a style definition.""" def __init__(self, lpstd): @@ -723,12 +750,15 @@ class STD(DOCDirStream): def dump(self): print '<std type="STD" offset="%d" size="%d bytes">' % (self.pos, self.size) - stdf = Stdf(self) - stdf.dump() - self.pos = stdf.pos + self.stdf = Stdf(self) + self.stdf.dump() + self.pos = self.stdf.pos xstzName = Xstz(self) xstzName.dump() self.pos = xstzName.pos + grLPUpxSw = GrLPUpxSw(self) + grLPUpxSw.dump() + self.pos = grLPUpxSw.pos print '</std>' class LPStd(DOCDirStream): _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
