[Libreoffice-commits] .: src/docrecord.py src/docstream.py test/doc
Miklos Vajna
vmiklos at kemper.freedesktop.org
Wed Nov 28 13:24:49 PST 2012
src/docrecord.py | 6 ++++--
src/docstream.py | 4 ++--
test/doc/test.py | 6 ++----
3 files changed, 8 insertions(+), 8 deletions(-)
New commits:
commit e2b8fcc9380b83e36742d66093f0aa9c888e012b
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Wed Nov 28 22:24:40 2012 +0100
PlcfBkl: dump the text of the commented text range, not just the start/end positions
diff --git a/src/docrecord.py b/src/docrecord.py
index adf0de5..30e169f 100644
--- a/src/docrecord.py
+++ b/src/docrecord.py
@@ -130,6 +130,7 @@ class PlcfBkf(DOCDirStream, PLC):
PLC.__init__(self, size, 4) # 4 is defined by 2.8.10
self.pos = offset
self.size = size
+ self.aCP = []
def dump(self):
print '<plcfBkf type="PlcfBkf" offset="%d" size="%d bytes">' % (self.pos, self.size)
@@ -138,8 +139,8 @@ class PlcfBkf(DOCDirStream, PLC):
for i in range(self.getElements()):
# aCp
start = offset + self.getuInt32(pos = pos)
+ self.aCP.append(start)
print '<aCP index="%d" bookmarkStart="%d">' % (i, start)
- print '<transformed value="%s"/>' % FcCompressed.getFCTransformedValue(self.mainStream.bytes, start, start + 1)
pos += 4
# aFBKF
@@ -164,7 +165,8 @@ class PlcfBkl(DOCDirStream, PLC):
# aCp
end = offset + self.getuInt32(pos = pos)
print '<aCP index="%d" bookmarkEnd="%d">' % (i, end)
- print '<transformed value="%s"/>' % FcCompressed.getFCTransformedValue(self.mainStream.bytes, end, end + 1)
+ start = self.mainStream.plcfAtnBkf.aCP[i]
+ print '<transformed value="%s"/>' % FcCompressed.getFCTransformedValue(self.mainStream.bytes, start, end)
pos += 4
print '</aCP>'
print '</plcfBkl>'
diff --git a/src/docstream.py b/src/docstream.py
index dfc2d28..93b2a2a 100644
--- a/src/docstream.py
+++ b/src/docstream.py
@@ -457,8 +457,8 @@ class WordDocumentStream(DOCDirStream):
def handleLcbPlcfAtnBkf(self):
offset = self.fcPlcfAtnBkf
size = self.lcbPlcfAtnBkf
- plcfBkf = docrecord.PlcfBkf(self, offset, size)
- plcfBkf.dump()
+ self.plcfAtnBkf = docrecord.PlcfBkf(self, offset, size)
+ self.plcfAtnBkf.dump()
def handleLcbPlcfAtnBkl(self):
offset = self.fcPlcfAtnBkl
diff --git a/test/doc/test.py b/test/doc/test.py
index a0356d0..546c141 100755
--- a/test/doc/test.py
+++ b/test/doc/test.py
@@ -109,10 +109,8 @@ class Test(unittest.TestCase):
commentEnds = self.root.findall('stream[@name="WordDocument"]/fib/fibRgFcLcbBlob/lcbPlcfAtnBkl/plcfBkl/aCP')
# The first comment covers Hello\x05, the second covers This\x05.
- self.assertEqual('H', commentStarts[0].findall('transformed')[0].attrib['value'])
- self.assertEqual('\\x05', commentEnds[0].findall('transformed')[0].attrib['value'])
- self.assertEqual('T', commentStarts[1].findall('transformed')[0].attrib['value'])
- self.assertEqual('\\x05', commentEnds[1].findall('transformed')[0].attrib['value'])
+ self.assertEqual('Hello', commentEnds[0].findall('transformed')[0].attrib['value'])
+ self.assertEqual('This', commentEnds[1].findall('transformed')[0].attrib['value'])
if __name__ == '__main__':
unittest.main()
More information about the Libreoffice-commits
mailing list