[Libreoffice-commits] .: 2 commits - src/docrecord.py src/docstream.py

Miklos Vajna vmiklos at kemper.freedesktop.org
Sat Jan 5 13:58:55 PST 2013


 src/docrecord.py |   12 ++++++------
 src/docstream.py |    4 ++--
 2 files changed, 8 insertions(+), 8 deletions(-)

New commits:
commit f390198dd8bac31f3e91193396ee80478d02f2e5
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Sat Jan 5 22:58:53 2013 +0100

    PapxFkp: properly transform non-compressed strings

diff --git a/src/docrecord.py b/src/docrecord.py
index 127d420..ade2ade 100644
--- a/src/docrecord.py
+++ b/src/docrecord.py
@@ -528,7 +528,7 @@ class ChpxFkp(DOCDirStream):
 class PapxFkp(DOCDirStream):
     """The PapxFkp structure maps paragraphs, table rows, and table cells to their properties."""
     def __init__(self, bytes, mainStream, offset, size):
-        DOCDirStream.__init__(self, mainStream.bytes)
+        DOCDirStream.__init__(self, mainStream.bytes, mainStream = mainStream)
         self.pos = offset
         self.size = size
 
@@ -541,7 +541,7 @@ class PapxFkp(DOCDirStream):
             start = self.getuInt32(pos = pos)
             end = self.getuInt32(pos = pos + 4)
             print '<rgfc index="%d" start="%d" end="%d">' % (i, start, end)
-            print '<transformed value="%s"/>' % FcCompressed.getFCTransformedValue(self.bytes, start, end)
+            print '<transformed value="%s"/>' % self.mainStream.retrieveText(start, end)
             pos += 4
 
             # rgbx
commit 447ab07ba158296b99fd57fdab2dbe7b520e7fbf
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Sat Jan 5 22:55:36 2013 +0100

    PlcfSed: properly transform non-compressed strings

diff --git a/src/docrecord.py b/src/docrecord.py
index 52dcfd4..127d420 100644
--- a/src/docrecord.py
+++ b/src/docrecord.py
@@ -30,10 +30,10 @@ class FcCompressed(DOCDirStream):
         self.printAndSet("r1", self.r1)
         print '</fcCompressed>'
 
-    def getTransformedValue(self, start, end, full = True):
+    def getTransformedValue(self, start, end, logical = True):
         if self.fCompressed:
             offset = self.fc/2
-            if full:
+            if logical:
                 fro = offset
                 to = offset+end-start
             else:
@@ -41,7 +41,7 @@ class FcCompressed(DOCDirStream):
                 to = end
             return globals.encodeName(self.mainStream.bytes[fro:to])
         else:
-            if full:
+            if logical:
                 offset = self.fc
                 fro = offset
                 to = offset + (end - start) * 2
@@ -258,7 +258,7 @@ class PlcfSed(DOCDirStream, PLC):
             aSed = Sed(self, self.getOffset(self.pos, i))
             aSed.dump()
 
-            print '<transformed value="%s"/>' % FcCompressed.getFCTransformedValue(self.mainStream.bytes, offset + start, offset + end)
+            print '<transformed value="%s"/>' % self.mainStream.retrieveText(start, end, logical = True)
             print '</aCP>'
         print '</plcSed>'
 
diff --git a/src/docstream.py b/src/docstream.py
index 5197c40..0eee1d2 100644
--- a/src/docstream.py
+++ b/src/docstream.py
@@ -621,9 +621,9 @@ class WordDocumentStream(DOCDirStream):
                 index = i
         return index
 
-    def retrieveText(self, start, end):
+    def retrieveText(self, start, end, logical = False):
         plcPcd = self.clx.pcdt.plcPcd
         idx = self.__findText(plcPcd, start)
-        return plcPcd.aPcd[idx].fc.getTransformedValue(start, end, full = False)
+        return plcPcd.aPcd[idx].fc.getTransformedValue(start, end, logical = logical)
 
 # vim:set filetype=python shiftwidth=4 softtabstop=4 expandtab:


More information about the Libreoffice-commits mailing list