[Libreoffice-commits] .: src/docrecord.py src/docstream.py
Miklos Vajna
vmiklos at kemper.freedesktop.org
Thu Jan 10 04:01:22 PST 2013
src/docrecord.py | 27 +++++++++++++++++++++++++++
src/docstream.py | 5 ++++-
2 files changed, 31 insertions(+), 1 deletion(-)
New commits:
commit 81b1156dba0f77787ad0171be85e4f5c59b751de
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Thu Jan 10 12:32:25 2013 +0100
dump PlcfGram
diff --git a/src/docrecord.py b/src/docrecord.py
index 6dccd2d..d5742f7 100644
--- a/src/docrecord.py
+++ b/src/docrecord.py
@@ -2358,4 +2358,31 @@ class PlcfSpl(DOCDirStream, PLC):
print '</aCP>'
print '</plcfSpl>'
+class PlcfGram(DOCDirStream, PLC):
+ """The PlcfGram structure is a Plc structure whose data elements are GrammarSpls structures."""
+ def __init__(self, mainStream):
+ DOCDirStream.__init__(self, mainStream.doc.getDirectoryStreamByName("1Table").bytes, mainStream = mainStream)
+ PLC.__init__(self, mainStream.lcbPlcfGram, 2) # 2 is defined by 2.8.21
+ self.pos = mainStream.fcPlcfGram
+ self.size = mainStream.lcbPlcfGram
+
+ def dump(self):
+ print '<plcfGram type="PlcfGram" offset="%d" size="%d bytes">' % (self.pos, self.size)
+ offset = self.mainStream.fcMin
+ pos = self.pos
+ for i in range(self.getElements()):
+ # 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
+
+ # aGrammarSpls
+ aGrammarSpls = SPLS("GrammarSpls", self, self.getOffset(self.pos, i))
+ aGrammarSpls.dump()
+
+ print '<transformed value="%s"/>' % self.quoteAttr(self.mainStream.retrieveText(offset + start, offset + end, logicalLength = True))
+ print '</aCP>'
+ print '</plcfGram>'
+
# vim:set filetype=python shiftwidth=4 softtabstop=4 expandtab:
diff --git a/src/docstream.py b/src/docstream.py
index a690b8d..c5c9fcc 100644
--- a/src/docstream.py
+++ b/src/docstream.py
@@ -384,7 +384,7 @@ class WordDocumentStream(DOCDirStream):
["fcPlcfAsumy"],
["lcbPlcfAsumy"],
["fcPlcfGram"],
- ["lcbPlcfGram"],
+ ["lcbPlcfGram", self.handleLcbPlcfGram],
["fcSttbListNames"],
["lcbSttbListNames"],
["fcSttbfUssr"],
@@ -515,6 +515,9 @@ class WordDocumentStream(DOCDirStream):
def handleLcbPlcfSpl(self):
docrecord.PlcfSpl(self).dump()
+ def handleLcbPlcfGram(self):
+ docrecord.PlcfGram(self).dump()
+
def dumpFibRgFcLcb97(self, name):
print '<%s type="FibRgFcLcb97" size="744 bytes">' % name
self.__dumpFibRgFcLcb97()
More information about the Libreoffice-commits
mailing list