[Libreoffice-commits] mso-dumper.git: 2 commits - src/docrecord.py src/docstream.py
Miklos Vajna
vmiklos at kemper.freedesktop.org
Wed May 15 08:55:32 PDT 2013
src/docrecord.py | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
src/docstream.py | 10 ++++++--
2 files changed, 74 insertions(+), 2 deletions(-)
New commits:
commit 37a197cc7eda9bb8a6a985327b986f7ceaadc3ba
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Wed May 15 17:55:05 2013 +0200
dump PlcftxbxTxt
diff --git a/src/docrecord.py b/src/docrecord.py
index f79779f..04bf1d0 100644
--- a/src/docrecord.py
+++ b/src/docrecord.py
@@ -2669,6 +2669,72 @@ class PlcfSpl(DOCDirStream, PLC):
print '</aCP>'
print '</plcfSpl>'
+class FTXBXNonReusable(DOCDirStream):
+ """The FTXBXNonReusable structure is used within the FTXBXS structure when that structure
+ describes a real textbox. A real textbox is any shape object into which text is added, and that is the
+ first or only shape in a linked chain."""
+ def __init__(self, parent):
+ DOCDirStream.__init__(self, parent.bytes)
+ self.parent = parent
+ self.pos = parent.pos
+
+ def dump(self):
+ print '<ftxbxsunion type="FTXBXNonReusable" offset="%d" size="8 bytes">' % (self.pos)
+ self.printAndSet("cTxbx", self.readuInt32())
+ self.printAndSet("cTxbxEdit", 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."""
+ size = 22 # 2.8.32
+ def __init__(self, parent, offset):
+ DOCDirStream.__init__(self, parent.bytes)
+ self.parent = parent
+ self.pos = self.posOrig = offset
+
+ def dump(self):
+ 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"/>'
+ else:
+ FTXBXNonReusable(self).dump()
+ self.printAndSet("fReusable", self.readuInt16())
+ self.printAndSet("itxbxsDest", self.readuInt32())
+ self.printAndSet("lid", self.readuInt32())
+ self.printAndSet("txidUndo", self.readuInt32())
+ print '</aFTXBXS>'
+ assert self.posOrig + FTXBXS.size == self.pos
+
+class PlcftxbxTxt(DOCDirStream, PLC):
+ """Specifies which ranges of text are contained in which textboxes."""
+ def __init__(self, mainStream):
+ DOCDirStream.__init__(self, mainStream.doc.getDirectoryStreamByName("1Table").bytes, mainStream = mainStream)
+ PLC.__init__(self, mainStream.lcbPlcftxbxTxt, FTXBXS.size)
+ self.pos = mainStream.fcPlcftxbxTxt
+ self.size = mainStream.lcbPlcftxbxTxt
+
+ def dump(self):
+ print '<plcftxbxTxt type="PlcftxbxTxt" offset="%d" size="%d bytes">' % (self.pos, self.size)
+ offset = self.mainStream.ccpText + self.mainStream.ccpFtn
+ pos = self.pos
+ for i in range(self.getElements() - 1):
+ # aCp
+ start = self.getuInt32(pos = pos)
+ end = self.getuInt32(pos = pos + 4)
+ print '<aCP index="%d" start="%d" end="%d">' % (i, start, end)
+ pos += 4
+
+ # aFTXBXS
+ aFTXBXS = FTXBXS(self, self.getOffset(self.pos, i))
+ aFTXBXS.dump();
+
+ print '<transformed value="%s"/>' % self.quoteAttr(self.mainStream.retrieveCPs(offset + start, offset + end))
+ print '</aCP>'
+ print '</plcftxbxTxt>'
+
class PlcfSpa(DOCDirStream, PLC):
"""The PlcfSpa structure is a PLC structure in which the data elements are
SPA structures."""
diff --git a/src/docstream.py b/src/docstream.py
index b95bebf..158748e 100644
--- a/src/docstream.py
+++ b/src/docstream.py
@@ -361,7 +361,7 @@ class WordDocumentStream(DOCDirStream):
["fcPlcfSpl"],
["lcbPlcfSpl", self.handleLcbPlcfSpl],
["fcPlcftxbxTxt"],
- ["lcbPlcftxbxTxt"],
+ ["lcbPlcftxbxTxt", self.handleLcbPlcftxbxTxt],
["fcPlcfFldTxbx"],
["lcbPlcfFldTxbx"],
["fcPlcfHdrtxbxTxt"],
@@ -574,6 +574,9 @@ class WordDocumentStream(DOCDirStream):
def handleLcbPlcfSpl(self):
docrecord.PlcfSpl(self).dump()
+ def handleLcbPlcftxbxTxt(self):
+ docrecord.PlcftxbxTxt(self).dump()
+
def handleLcbPlcSpaMom(self):
docrecord.PlcfSpa(self, self.fcPlcSpaMom, self.lcbPlcSpaMom).dump()
commit 5015c4bee4dc017728c2ed38bbe887b5d2dcb190
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Wed May 15 17:05:03 2013 +0200
dump PlcSpaMom
diff --git a/src/docstream.py b/src/docstream.py
index 6747084..b95bebf 100644
--- a/src/docstream.py
+++ b/src/docstream.py
@@ -329,7 +329,7 @@ class WordDocumentStream(DOCDirStream):
["fcUnused3"],
["lcbUnused3"],
["fcPlcSpaMom"],
- ["lcbPlcSpaMom"],
+ ["lcbPlcSpaMom", self.handleLcbPlcSpaMom],
["fcPlcSpaHdr"],
["lcbPlcSpaHdr", self.handleLcbPlcfSpaHdr],
["fcPlcfAtnBkf"],
@@ -574,6 +574,9 @@ class WordDocumentStream(DOCDirStream):
def handleLcbPlcfSpl(self):
docrecord.PlcfSpl(self).dump()
+ def handleLcbPlcSpaMom(self):
+ docrecord.PlcfSpa(self, self.fcPlcSpaMom, self.lcbPlcSpaMom).dump()
+
def handleLcbPlcfSpaHdr(self):
docrecord.PlcfSpa(self, self.fcPlcSpaHdr, self.lcbPlcSpaHdr).dump()
More information about the Libreoffice-commits
mailing list