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

Kohei Yoshida kohei at kemper.freedesktop.org
Wed Nov 23 13:58:27 PST 2011


 src/xlsrecord.py |   38 ++++++++++++++++++++++++++++++++++++++
 src/xlsstream.py |    4 ++--
 2 files changed, 40 insertions(+), 2 deletions(-)

New commits:
commit 9d825cc43815bd9accabe792abca76f3cc1fb18f
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Wed Nov 23 16:57:05 2011 -0500

    Handlers for WINDOW2 and PANE records.
    
    Handler for WINDOW2 is still incomplete.

diff --git a/src/xlsrecord.py b/src/xlsrecord.py
index 6927836..11c2fce 100644
--- a/src/xlsrecord.py
+++ b/src/xlsrecord.py
@@ -2347,6 +2347,44 @@ class Font(BaseRecordHandler):
         self.appendLine("font family: %s"%Font.getFontFamily(fontFamily))
         self.appendLine("font name: %s (%d)"%(fontName, nameLen))
 
+class Window2(BaseRecordHandler):
+    def __parseBytes (self):
+        flag = self.readUnsignedInt(2)
+        self.displayFormula =  (flag & 0x0001) != 0
+        self.displayGrid =     (flag & 0x0002) != 0
+        self.displayHeadings = (flag & 0x0004) != 0
+        self.frozen =          (flag & 0x0008) != 0
+
+    def parseBytes (self):
+        self.__parseBytes()
+        self.appendLineBoolean("display formula", self.displayFormula)
+        self.appendLineBoolean("display grid", self.displayGrid)
+        self.appendLineBoolean("display headings", self.displayHeadings)
+        self.appendLineBoolean("frozen window", self.frozen)
+
+class Pane(BaseRecordHandler):
+
+    activePanes = [
+        "bottom-right",
+        "top-right",
+        "bottom-left",
+        "top-left"
+    ]
+
+    def __parseBytes (self):
+        self.x = self.readUnsignedInt(2)
+        self.y = self.readUnsignedInt(2)
+        self.bottomRow = self.readUnsignedInt(2)
+        self.rightCol  = self.readUnsignedInt(2)
+        self.activePane = self.readUnsignedInt(1)
+
+    def parseBytes (self):
+        self.__parseBytes()
+        self.appendLine("split position: (x=%d,y=%d)"%(self.x,self.y))
+        self.appendLine("top-left position of SE pane: (row=%d,col=%d)"%
+            (self.bottomRow,self.rightCol))
+        self.appendLine("active pane: %s"%
+            globals.getValueOrUnknown(Pane.activePanes, self.activePane))
 
 class XF(BaseRecordHandler):
 
diff --git a/src/xlsstream.py b/src/xlsstream.py
index d000840..bb9f6ae 100644
--- a/src/xlsstream.py
+++ b/src/xlsstream.py
@@ -71,7 +71,7 @@ recData = {
     0x003C: ["CONTINUE", "Continues Long Records"],
     0x003D: ["WINDOW1", "Window Information"],
     0x0040: ["BACKUP", "Save Backup Version of the File"],
-    0x0041: ["PANE", "Number of Panes and Their Position"],
+    0x0041: ["PANE", "Number of Panes and Their Position", xlsrecord.Pane],
     0x0042: ["CODEPAGE/CODENAME", "Default Code Page/VBE Object Name"],
     0x004D: ["PLS", "Environment-Specific Print Record", xlsrecord.Pls],
     0x0050: ["DCON", "Data Consolidation Information"],
@@ -216,7 +216,7 @@ recData = {
     0x0225: ["DEFAULTROWHEIGHT", "Default Row Height", xlsrecord.DefRowHeight],
     0x0231: ["FONT", "Font Description", xlsrecord.Font],
     0x0236: ["TABLE", "Data Table"],
-    0x023E: ["WINDOW2", "Sheet Window Information"],
+    0x023E: ["WINDOW2", "Sheet Window Information", xlsrecord.Window2],
     0x027E: ["RK", "Cell with Encoded Integer or Floating-Point", xlsrecord.RK],
     0x0293: ["STYLE", "Style Information", xlsrecord.Style],
     0x041E: ["FORMAT", "Number Format", xlsrecord.Format],


More information about the Libreoffice-commits mailing list