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

Kohei Yoshida kohei at kemper.freedesktop.org
Mon Aug 8 12:17:00 PDT 2011


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

New commits:
commit 986fcc9a1f490e4cbb0d072ad4ad15a841f75e51
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Mon Aug 8 15:17:22 2011 -0400

    Handler for PROTECT record.
    
    Whether or not the workbook is protected.

diff --git a/src/xlsrecord.py b/src/xlsrecord.py
index 0567cc3..29a238f 100644
--- a/src/xlsrecord.py
+++ b/src/xlsrecord.py
@@ -1286,6 +1286,16 @@ class PrintSize(BaseRecordHandler):
         self.__parseBytes()
         self.appendLine(globals.getValueOrUnknown(PrintSize.Types, self.typeID))
 
+class Protect(BaseRecordHandler):
+
+    def __parseBytes (self):
+        self.locked = self.readUnsignedInt(2) != 0
+
+    def parseBytes (self):
+        self.__parseBytes()
+        self.appendLineBoolean("workbook locked", self.locked)
+
+
 class RK(BaseRecordHandler):
     """Cell with encoded integer or floating-point value"""
 
diff --git a/src/xlsstream.py b/src/xlsstream.py
index c1cc275..ff24d15 100644
--- a/src/xlsstream.py
+++ b/src/xlsstream.py
@@ -42,7 +42,7 @@ recData = {
     0x000F: ["REFMODE", "Reference Mode"],
     0x0010: ["DELTA", "Iteration Increment"],
     0x0011: ["ITERATION", "Iteration Mode"],
-    0x0012: ["PROTECT", "Protection Flag"],
+    0x0012: ["PROTECT", "Protection Flag", xlsrecord.Protect],
     0x0013: ["PASSWORD", "Protection Password"],
     0x0014: ["HEADER", "Print Header on Each Page"],
     0x0015: ["FOOTER", "Print Footer on Each Page"],
commit c9855c088883b6bd818051c275ae1ed30080cd6a
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Mon Aug 8 15:12:02 2011 -0400

    Handler for FBI record.
    
    Font size for chart objects.

diff --git a/src/xlsrecord.py b/src/xlsrecord.py
index 770b814..0567cc3 100644
--- a/src/xlsrecord.py
+++ b/src/xlsrecord.py
@@ -882,6 +882,26 @@ class DVal(BaseRecordHandler):
     def fillModel (self, model):
         self.__parseBytes()
 
+class Fbi(BaseRecordHandler):
+    def __parseBytes (self):
+        self.fontWidth = self.readUnsignedInt(2)
+        self.fontHeight = self.readUnsignedInt(2)
+        self.defaultHeight = self.readUnsignedInt(2)
+        self.scaleType = self.readUnsignedInt(2)
+        self.fontID = self.readUnsignedInt(2)
+
+    def parseBytes (self):
+        self.__parseBytes()
+        self.appendLine("font width (twips): %d"%self.fontWidth)
+        self.appendLine("font height (twips): %d"%self.fontHeight)
+        self.appendLine("default font height (twips): %d"%self.defaultHeight)
+        if self.scaleType == 0:
+            s = "chart area"
+        else:
+            s = "plot area"
+        self.appendLine("scale by: %s"%s)
+        self.appendLine("font ID: %d"%self.fontID)
+
 
 class FilePass(BaseRecordHandler):
 
diff --git a/src/xlsstream.py b/src/xlsstream.py
index a155d8a..c1cc275 100644
--- a/src/xlsstream.py
+++ b/src/xlsstream.py
@@ -287,6 +287,7 @@ recData = {
     0x105B: ["CHSERERRORBAR", "?"],
     0x105D: ["CHSERIESFORMAT", "?"],
     0x105F: ["CH3DDATAFORMAT", "?"],
+    0x1060: ["FBI", "Font Information for Chart", xlsrecord.Fbi],
     0x1061: ["CHPIEEXT", "?"],
     0x1062: ["CHLABELRANGE2", "?"],
     0x1065: ["CHSIINDEX*", "?"],
commit abfb3717d78f001a6f7a0769a6d42472adef30a3
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Mon Aug 8 14:59:14 2011 -0400

    Handler for PRINTSIZE.
    
    This record stores print size options for chart objects.

diff --git a/src/xlsrecord.py b/src/xlsrecord.py
index d55da21..770b814 100644
--- a/src/xlsrecord.py
+++ b/src/xlsrecord.py
@@ -1250,6 +1250,21 @@ class Obj(BaseRecordHandler):
         self.appendLineBoolean("  automatic fill style", autoFill)
         self.appendLineBoolean("  automatic line style", autoLine)
 
+class PrintSize(BaseRecordHandler):
+
+    Types = [
+        "unchanged from the defaults in the workbook",
+        "resized non-proportionally to fill the entire page",
+        "resized proportionally to fill the entire page",
+        "size defined in the chart record"
+    ]
+
+    def __parseBytes (self):
+        self.typeID = self.readUnsignedInt(2)
+
+    def parseBytes (self):
+        self.__parseBytes()
+        self.appendLine(globals.getValueOrUnknown(PrintSize.Types, self.typeID))
 
 class RK(BaseRecordHandler):
     """Cell with encoded integer or floating-point value"""
diff --git a/src/xlsstream.py b/src/xlsstream.py
index 88ccd80..a155d8a 100644
--- a/src/xlsstream.py
+++ b/src/xlsstream.py
@@ -65,6 +65,7 @@ recData = {
     0x002B: ["PRINTGRIDLINES", "Print Gridlines Flag"],
     0x002F: ["FILEPASS", "File Is Password-Protected", xlsrecord.FilePass],
     0x0031: ["FONT", "Font and Character Formatting", xlsrecord.Font],
+    0x0033: ["PRINTSIZE", "Printed Size of the Chart", xlsrecord.PrintSize],
     0x003C: ["CONTINUE", "Continues Long Records"],
     0x003D: ["WINDOW1", "Window Information"],
     0x0040: ["BACKUP", "Save Backup Version of the File"],
commit 31f363bcdd2f3cb836cb3e3dfeec52057c71f757
Author: Kohei Yoshida <kohei.yoshida at suse.com>
Date:   Mon Aug 8 14:47:35 2011 -0400

    Better to wrap the line.

diff --git a/src/xlsrecord.py b/src/xlsrecord.py
index 538eb5e..d55da21 100644
--- a/src/xlsrecord.py
+++ b/src/xlsrecord.py
@@ -1108,7 +1108,7 @@ class MulBlank(BaseRecordHandler):
         s = "XF Record IDs:"
         for xfCell in self.xfCells:
             s += " %d"%xfCell
-        self.appendLine(s)
+        self.appendMultiLine(s)
 
 
 class Number(BaseRecordHandler):


More information about the Libreoffice-commits mailing list