[ooo-build-commit] .: scratch/mso-dumper

Kohei Yoshida kohei at kemper.freedesktop.org
Wed Apr 14 11:59:21 PDT 2010


 scratch/mso-dumper/src/formula.py   |    8 ++++++++
 scratch/mso-dumper/src/xlsrecord.py |   14 +++++++++++---
 2 files changed, 19 insertions(+), 3 deletions(-)

New commits:
commit 369a06f8c4508eb38a51c5e26a5436962294c2e3
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Wed Apr 14 14:57:37 2010 -0400

    [xls-dump] Interpret integer value in formula bytes.
    
    * scratch/mso-dumper/src/formula.py:
    * scratch/mso-dumper/src/xlsrecord.py:

diff --git a/scratch/mso-dumper/src/formula.py b/scratch/mso-dumper/src/formula.py
index 8a92cba..eecb857 100644
--- a/scratch/mso-dumper/src/formula.py
+++ b/scratch/mso-dumper/src/formula.py
@@ -395,6 +395,13 @@ class _TokenBase(object):
     def getText (self):
         return ''
 
+class _Int(_TokenBase):
+    def parseBytes (self):
+        self.value = self.strm.readUnsignedInt(2)
+
+    def getText (self):
+        return "%d"%self.value
+
 class _Area3d(_TokenBase):
     def parseBytes (self):
         self.xti = self.strm.readUnsignedInt(2)
@@ -805,6 +812,7 @@ class _FuncVar(_TokenBase):
         return _FuncVar.funcTab[self.funcType] + "()"
 
 _tokenMap = {
+    0x1E: _Int,
     0x3B: _Area3d,
     0x5B: _Area3d,
     0x7B: _Area3d,
diff --git a/scratch/mso-dumper/src/xlsrecord.py b/scratch/mso-dumper/src/xlsrecord.py
index dc888c1..4e5d35e 100644
--- a/scratch/mso-dumper/src/xlsrecord.py
+++ b/scratch/mso-dumper/src/xlsrecord.py
@@ -626,10 +626,18 @@ class CF(BaseRecordHandler):
                 self.appendLine("number format to use: %d (ID)"%self.numFmtID)
 
         # formulas
-        self.appendLine("formula 1 bytes: %s"%globals.getRawBytes(self.formula1, True, False))
-        self.appendLine("formula 2 bytes: %s"%globals.getRawBytes(self.formula2, True, False))
 
-        
+        if len(self.formula1) > 0:
+            self.appendLine("formula 1 (bytes): %s"%globals.getRawBytes(self.formula1, True, False))
+            parser = formula.FormulaParser2(self.header, self.formula1)
+            parser.parse()
+            self.appendLine("formula 1 (displayed): " + parser.getText())
+
+        if len(self.formula2) > 0:
+            self.appendLine("formula 2 (bytes): %s"%globals.getRawBytes(self.formula2, True, False))
+            parser = formula.FormulaParser2(self.header, self.formula2)
+            parser.parse()
+            self.appendLine("formula 2 (displayed): " + parser.getText())       
 
 
 class CondFmt(BaseRecordHandler):


More information about the ooo-build-commit mailing list