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

Miklos Vajna vmiklos at kemper.freedesktop.org
Sun Jan 6 01:59:45 PST 2013


 src/docrecord.py |   10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

New commits:
commit c37c38e79a0ff14cccc2e78111c3ffd4febf1c29
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Sun Jan 6 10:54:47 2013 +0100

    Get rid of FcCompressed::getFCTransformedValue
    
    The problem with this static method was that it always assumed
    fCompressed to be True, and being static, there was no way to fix this.
    Now that Clx is parsed before other FibRgFcLcb97 structures, its usage
    can be avoided.

diff --git a/src/docrecord.py b/src/docrecord.py
index ade2ade..4f5c11a 100644
--- a/src/docrecord.py
+++ b/src/docrecord.py
@@ -50,10 +50,6 @@ class FcCompressed(DOCDirStream):
                 to = end
             return globals.encodeName(self.mainStream.bytes[fro:to].decode('utf-16'), lowOnly = True)
 
-    @staticmethod
-    def getFCTransformedValue(bytes, start, end):
-        return globals.encodeName(bytes[start:end])
-
 class Pcd(DOCDirStream):
     """The Pcd structure specifies the location of text in the WordDocument Stream and additional properties for this text."""
     def __init__(self, bytes, mainStream, offset, size):
@@ -163,7 +159,7 @@ class PlcfBkl(DOCDirStream, PLC):
             end = offset + self.getuInt32(pos = pos)
             print '<aCP index="%d" bookmarkEnd="%d">' % (i, end)
             start = self.mainStream.plcfAtnBkf.aCP[i]
-            print '<transformed value="%s"/>' % FcCompressed.getFCTransformedValue(self.mainStream.bytes, start, end)
+            print '<transformed value="%s"/>' % self.mainStream.retrieveText(start, end)
             pos += 4
             print '</aCP>'
         print '</plcfBkl>'
@@ -656,7 +652,7 @@ class PlcfandTxt(DOCDirStream, PLC):
             start = self.getuInt32(pos = pos)
             end = self.getuInt32(pos = pos + 4)
             print '<aCP index="%d" start="%d" end="%d">' % (i, start, end)
-            print '<transformed value="%s"/>' % FcCompressed.getFCTransformedValue(self.mainStream.bytes, offset+start, offset+end)
+            print '<transformed value="%s"/>' % self.mainStream.retrieveText(offset + start, offset + end)
             pos += 4
             print '</aCP>'
         print '</plcfandTxt>'
@@ -676,7 +672,7 @@ class PlcfandRef(DOCDirStream, PLC):
         for i in range(self.getElements()):
             start = offset + self.getuInt32(pos = pos)
             print '<aCP index="%d" commentEndOffset="%d">' % (i, start)
-            print '<transformed value="%s"/>' % FcCompressed.getFCTransformedValue(self.mainStream.bytes, start, start + 1)
+            print '<transformed value="%s"/>' % self.mainStream.retrieveText(start, start + 1)
             pos += 4
 
             # aATRDPre10


More information about the Libreoffice-commits mailing list