[Libreoffice-commits] .: src/xlsrecord.py src/xlsstream.py

Kohei Yoshida kohei at kemper.freedesktop.org
Fri Dec 14 13:08:04 PST 2012


 src/xlsrecord.py |   68 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 src/xlsstream.py |    2 -
 2 files changed, 69 insertions(+), 1 deletion(-)

New commits:
commit 8969e07368b5401b34e30cc4c59c40f0efed4f4a
Author: Kohei Yoshida <kohei.yoshida at gmail.com>
Date:   Fri Dec 14 16:08:43 2012 -0500

    Record handler for SXEx - pivot table extended view properties.

diff --git a/src/xlsrecord.py b/src/xlsrecord.py
index 88a92cc..6f953a3 100644
--- a/src/xlsrecord.py
+++ b/src/xlsrecord.py
@@ -2966,6 +2966,74 @@ class SXDbEx(BaseRecordHandler):
         self.appendLine("last changed: %g"%lastChanged)
         self.appendLine("count of SXFORMULA records for this cache: %d"%sxFmlaRecs)
 
+class SXEx(BaseRecordHandler):
+
+    def __parseBytes (self):
+        self.csxformat = self.readUnsignedInt(2)
+        self.cchErrorString = self.readUnsignedInt(2)
+        self.cchNullString = self.readUnsignedInt(2)
+        self.cchTag = self.readUnsignedInt(2)
+        self.csxselect = self.readUnsignedInt(2)
+        self.crwPage = self.readUnsignedInt(2)
+        self.ccolPage = self.readUnsignedInt(2)
+        flag = self.readUnsignedInt(2)
+
+        # Page field layout
+        # 0 = top to bottom then left to right
+        # 1 = left to right then top to bottom
+        self.fAcrossPageLay = (flag & 0x0001)
+
+        # Rows in each page field column
+        self.cWrapPage = (flag & 0x01FE) / 2
+
+        flag = self.readUnsignedInt(2)
+        self.fEnableWizard            = (flag & 0x0001) != 0 # D
+        self.fEnableDrilldown         = (flag & 0x0001) != 0 # E
+        self.fEnableFieldDialog       = (flag & 0x0001) != 0 # F
+        self.fPreserveFormatting      = (flag & 0x0001) != 0 # G
+        self.fMergeLabels             = (flag & 0x0001) != 0 # H
+        self.fDisplayErrorString      = (flag & 0x0001) != 0 # I
+        self.fDisplayNullString       = (flag & 0x0001) != 0 # J
+        self.fSubtotalHiddenPageItems = (flag & 0x0001) != 0 # K
+
+        self.cchPageFieldStyle = self.readUnsignedInt(2)
+        self.cchTableStyle = self.readUnsignedInt(2)
+        self.cchVacateStyle = self.readUnsignedInt(2)
+
+        self.stError = ""
+        if self.cchErrorString != 0xFFFF:
+            self.stError = self.readXLUnicodeStringNoCch(self.cchErrorString)
+
+        self.stDisplayNull = ""
+        if self.cchNullString != 0xFFFF:
+            self.stDisplayNull = self.readXLUnicodeStringNoCch(self.cchNullString)
+
+        self.stTag = ""
+        if self.cchTag != 0xFFFF:
+            self.stTag = self.readXLUnicodeStringNoCch(self.cchTag)
+
+        self.stPageFieldStyle = ""
+        if self.cchPageFieldStyle != 0xFFFF and self.cchPageFieldStyle > 0:
+            self.stPageFieldStyle = self.readXLUnicodeStringNoCch(self.cchPageFieldStyle)
+
+        self.stTableStyle = ""
+        if self.cchTableStyle != 0xFFFF and self.cchTableStyle > 0:
+            self.stTableStyle = self.readXLUnicodeStringNoCch(self.cchTableStyle)
+
+        self.stVacateStyle = ""
+        if self.cchVacateStyle != 0xFFFF and self.cchVacateStyle > 0:
+            self.stVacateStyle = self.readXLUnicodeStringNoCch(self.cchVacateStyle)
+
+    def parseBytes (self):
+        self.__parseBytes()
+        self.appendLineInt("number of SxFormat records", self.csxformat)
+        self.appendLineString("error string", self.stError)
+        self.appendLineString("null string", self.stDisplayNull)
+        self.appendLineString("custom string", self.stTag)
+        self.appendLineString("style used in page area", self.stPageFieldStyle)
+        self.appendLineString("style used in table body", self.stTableStyle)
+        self.appendLineString("style used in empty cells", self.stVacateStyle)
+
 
 class SXDtr(BaseRecordHandler):
 
diff --git a/src/xlsstream.py b/src/xlsstream.py
index 6234779..0f1a013 100644
--- a/src/xlsstream.py
+++ b/src/xlsstream.py
@@ -169,7 +169,7 @@ recData = {
     0x00ED: ["MSODRAWINGSELECTION", "Microsoft Office Drawing Selection", xlsrecord.MSODrawingSelection],
     0x00EF: ["PHONETIC", "Asian Phonetic Settings", xlsrecord.PhoneticInfo],
     0x00F0: ["SXRULE", "PivotTable Rule Data"],
-    0x00F1: ["SXEX", "PivotTable View Extended Information"],
+    0x00F1: ["SXEX", "PivotTable View Extended Information", xlsrecord.SXEx],
     0x00F2: ["SXFILT", "PivotTable Rule Filter"],
     0x00F6: ["SXNAME", "PivotTable Name"],
     0x00F7: ["SXSELECT", "PivotTable Selection Information"],


More information about the Libreoffice-commits mailing list