[Libreoffice-commits] mso-dumper.git: src/docrecord.py src/docstream.py
Miklos Vajna
vmiklos at kemper.freedesktop.org
Thu May 16 10:17:55 PDT 2013
src/docrecord.py | 11 ++++++-----
src/docstream.py | 6 ++++++
2 files changed, 12 insertions(+), 5 deletions(-)
New commits:
commit ddc6ca725bc05bdc82a00a30fe52bfea81dd97ad
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Thu May 16 19:17:36 2013 +0200
factor out duplicated code
diff --git a/src/docrecord.py b/src/docrecord.py
index fec80fe..dac6d83 100644
--- a/src/docrecord.py
+++ b/src/docrecord.py
@@ -1067,7 +1067,7 @@ class PlcfHdd(DOCDirStream, PLC):
def dump(self):
print '<plcfHdd type="PlcfHdd" offset="%d" size="%d bytes">' % (self.pos, self.size)
- offset = self.mainStream.ccpText + self.mainStream.ccpFtn
+ offset = self.mainStream.getHeaderOffset()
pos = self.pos
for i in range(self.getElements() - 1):
start = self.getuInt32(pos = pos)
@@ -1088,7 +1088,7 @@ class PlcfandTxt(DOCDirStream, PLC):
def dump(self):
print '<plcfandTxt type="PlcfandTxt" offset="%d" size="%d bytes">' % (self.pos, self.size)
- offset = self.mainStream.ccpText + self.mainStream.ccpFtn + self.mainStream.ccpHdd
+ offset = self.mainStream.getCommentOffset()
pos = self.pos
for i in range(self.getElements() - 1):
start = self.getuInt32(pos = pos)
@@ -2706,7 +2706,8 @@ class FTXBXS(DOCDirStream):
self.printAndSet("lid", self.readuInt32())
self.printAndSet("txidUndo", self.readuInt32())
print '</aFTXBXS>'
- assert self.posOrig + FTXBXS.size == self.pos
+ if not self.fReusable:
+ assert self.posOrig + FTXBXS.size == self.pos
class PlcftxbxTxt(DOCDirStream, PLC):
"""Specifies which ranges of text are contained in which textboxes."""
@@ -2718,7 +2719,7 @@ class PlcftxbxTxt(DOCDirStream, PLC):
def dump(self):
print '<plcftxbxTxt type="PlcftxbxTxt" offset="%d" size="%d bytes">' % (self.pos, self.size)
- offset = self.mainStream.ccpText + self.mainStream.ccpFtn
+ offset = self.mainStream.getHeaderOffset()
pos = self.pos
for i in range(self.getElements() - 1):
# aCp
@@ -2767,7 +2768,7 @@ class PlcftxbxBkd(DOCDirStream, PLC):
def dump(self):
print '<plcftxbxBkd type="PlcftxbxBkd" offset="%d" size="%d bytes">' % (self.pos, self.size)
- offset = self.mainStream.ccpText + self.mainStream.ccpFtn
+ offset = self.mainStream.getHeaderOffset()
pos = self.pos
for i in range(self.getElements()):
# aCp
diff --git a/src/docstream.py b/src/docstream.py
index 849dc19..e888299 100644
--- a/src/docstream.py
+++ b/src/docstream.py
@@ -893,4 +893,10 @@ class WordDocumentStream(DOCDirStream):
i += 1
return "".join(ret)
+ def getHeaderOffset(self):
+ return self.ccpText + self.ccpFtn
+
+ def getCommentOffset(self):
+ return self.getHeaderOffset() + self.ccpHdd
+
# vim:set filetype=python shiftwidth=4 softtabstop=4 expandtab:
More information about the Libreoffice-commits
mailing list