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

Kohei Yoshida kohei at kemper.freedesktop.org
Tue Oct 25 14:05:58 PDT 2011


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

New commits:
commit 06a8b3842f52d73f656c6e9f6c3bc61c78e2ecd2
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Tue Oct 25 17:05:20 2011 -0400

    Added handler for STYLE record.

diff --git a/src/xlsrecord.py b/src/xlsrecord.py
index 21f0beb..f8c4a3b 100644
--- a/src/xlsrecord.py
+++ b/src/xlsrecord.py
@@ -1482,6 +1482,41 @@ class String(BaseRecordHandler):
             cell.cachedResult = self.name
 
 
+class Style(BaseRecordHandler):
+
+    BuiltInStyleNames = [
+        "Normal",
+        "RowLevel_#",
+        "ColLevel_#",
+        "Comma",
+        "Currency",
+        "Percent",
+        "Comma[0]",
+        "Currency[0]",
+        "Hyperlink",
+        "Followed Hyperlink",
+        "Note",
+        "Warning Text"
+    ]
+
+    def __parseBytes (self):
+        flags = self.readUnsignedInt(2)
+        self.Xf = (flags & 0x0FFF)
+        self.builtIn = (flags & 0x8000) != 0
+        self.builtInType = self.readUnsignedInt(1)
+        self.builtInLevel = self.readUnsignedInt(1)
+
+    def parseBytes (self):
+        self.__parseBytes()
+        self.appendLine("XF record ID: %d"%self.Xf)
+        self.appendLineBoolean("built-in", self.builtIn)
+        if self.builtIn:
+            self.appendLine("built-in type: %d (%s)"%(
+                self.builtInType, globals.getValueOrUnknown(Style.BuiltInStyleNames, self.builtInType)))
+            if self.builtInType == 1 or self.builtInType == 2:
+                self.appendLine("built-in level: %d"%self.builtInLevel)
+
+
 class SST(BaseRecordHandler):
 
     def __parseBytes (self):
diff --git a/src/xlsstream.py b/src/xlsstream.py
index ceb6eeb..7f85e20 100644
--- a/src/xlsstream.py
+++ b/src/xlsstream.py
@@ -218,7 +218,7 @@ recData = {
     0x0236: ["TABLE", "Data Table"],
     0x023E: ["WINDOW2", "Sheet Window Information"],
     0x027E: ["RK", "Cell with Encoded Integer or Floating-Point", xlsrecord.RK],
-    0x0293: ["STYLE", "Style Information"],
+    0x0293: ["STYLE", "Style Information", xlsrecord.Style],
     0x041E: ["FORMAT", "Number Format", xlsrecord.Format],
     0x0802: ["QSISXTAG", "Pivot Table and Query Table Extensions", xlsrecord.PivotQueryTableEx],
     0x0809: ["BOF", "Beginning of File", xlsrecord.BOF],


More information about the Libreoffice-commits mailing list