src/docrecord.py | 24 ++++++++++++++++++++++-- src/docstream.py | 4 ++-- 2 files changed, 24 insertions(+), 4 deletions(-)
New commits: commit ac3bf1325ffe6685c93d2782c7c990b56628cc71 Author: Miklos Vajna <vmik...@suse.cz> Date: Tue May 21 17:29:23 2013 +0200 doc: fix retrieveCP in case Clx has multiple elements diff --git a/src/docstream.py b/src/docstream.py index 5c024fe..ee196ce 100644 --- a/src/docstream.py +++ b/src/docstream.py @@ -941,9 +941,9 @@ class WordDocumentStream(DOCDirStream): aPcd = plcPcd.aPcd[index] fcCompressed = aPcd.fc if fcCompressed.fCompressed == 1: - return globals.encodeName(self.bytes[(fcCompressed.fc/2) + (cp - plcPcd.aCp[i])]) + return globals.encodeName(self.bytes[(fcCompressed.fc/2) + (cp - plcPcd.aCp[index])]) else: - pos = fcCompressed.fc + 2 * (cp - plcPcd.aCp[i]) + pos = fcCompressed.fc + 2 * (cp - plcPcd.aCp[index]) return globals.encodeName(self.bytes[pos:pos+2].decode('utf-16'), lowOnly = True) def retrieveCPs(self, start, end): commit 46d904d97744568a1c0e7ccd7ca8497aaad09a58 Author: Miklos Vajna <vmik...@suse.cz> Date: Tue May 21 15:57:34 2013 +0200 SttbfAssoc: handle if we contain some unexpected additional elements diff --git a/src/docrecord.py b/src/docrecord.py index 17538b4..570269d 100644 --- a/src/docrecord.py +++ b/src/docrecord.py @@ -2055,7 +2055,11 @@ class SttbfAssoc(DOCDirStream): self.printAndSet("cbExtra", self.readuInt16()) for i in range(self.cData): cchData = self.readuInt16() - print '<cchData index="%s" meaning="%s" offset="%d" size="%d bytes">' % (hex(i), indexMap[i], self.pos, cchData) + if i in indexMap.keys(): + meaning = indexMap[i] + else: + meaning = "unknown" + print '<cchData index="%s" meaning="%s" offset="%d" size="%d bytes">' % (hex(i), meaning, self.pos, cchData) print '<string value="%s"/>' % globals.encodeName(self.bytes[self.pos:self.pos+2*cchData].decode('utf-16'), lowOnly = True) self.pos += 2*cchData print '</cchData>' commit b0a534699fe70f8f4b62564887f3264374b86622 Author: Miklos Vajna <vmik...@suse.cz> Date: Tue May 21 15:50:40 2013 +0200 dump FTXBXSReusable diff --git a/src/docrecord.py b/src/docrecord.py index dac6d83..17538b4 100644 --- a/src/docrecord.py +++ b/src/docrecord.py @@ -2685,6 +2685,22 @@ class FTXBXNonReusable(DOCDirStream): print '</ftxbxsunion>' self.parent.pos = self.pos +class FTXBXSReusable(DOCDirStream): + """The FTXBXSReusable structure is used within the FTXBXS structure when it describes a spare + structure that can be reused by the application and converted into an actual textbox.""" + def __init__(self, parent): + DOCDirStream.__init__(self, parent.bytes) + self.parent = parent + self.pos = parent.pos + + def dump(self): + print '<ftxbxsunion type="FTXBXReusable" offset="%d" size="8 bytes">' % (self.pos) + self.printAndSet("iNextReuse", self.readuInt32()) + self.printAndSet("cReusable", self.readuInt32()) + print '</ftxbxsunion>' + self.parent.pos = self.pos + + class FTXBXS(DOCDirStream): """Associates ranges of text from the Textboxes Document and the Header Textboxes Document, with shape objects.""" @@ -2698,7 +2714,7 @@ class FTXBXS(DOCDirStream): print '<aFTXBXS type="FTXBXS" offset="%d" size="%d bytes">' % (self.pos, FTXBXS.size) self.fReusable = self.getuInt16(pos = self.pos + 8) if self.fReusable: - print '<todo what="FTXBXS: handle fReusable == 1"/>' + FTXBXSReusable(self).dump() else: FTXBXNonReusable(self).dump() self.printAndSet("fReusable", self.readuInt16()) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits