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

Kohei Yoshida kohei at kemper.freedesktop.org
Thu Apr 15 14:23:46 PDT 2010


 scratch/mso-dumper/src/globals.py   |    8 +++
 scratch/mso-dumper/src/xlsrecord.py |   82 +++++++++++++++++++++++++++++++++++-
 2 files changed, 88 insertions(+), 2 deletions(-)

New commits:
commit 04526e3a1c80a17b2dd63d39355bf4a44ef5598b
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Thu Apr 15 17:23:27 2010 -0400

    [xls-dump] Finish parsing DV record.
    
    * scratch/mso-dumper/src/globals.py:
    * scratch/mso-dumper/src/xlsrecord.py:

diff --git a/scratch/mso-dumper/src/globals.py b/scratch/mso-dumper/src/globals.py
index ccacfd4..de4f199 100644
--- a/scratch/mso-dumper/src/globals.py
+++ b/scratch/mso-dumper/src/globals.py
@@ -112,6 +112,14 @@ class ByteStream(object):
         bytes = self.readBytes(8)
         return getDouble(bytes)
 
+    def readUnicodeString (self):
+        # First 2-bytes contains the text length, followed by a 1-byte flag.
+        textLen = self.readUnsignedInt(2)
+        bytes = self.bytes[self.pos:]
+        text, byteLen = getRichText(bytes, textLen)
+        self.moveForward (byteLen)
+        return text
+
     def moveBack (self, byteCount):
         self.pos -= byteCount
         if self.pos < 0:
diff --git a/scratch/mso-dumper/src/xlsrecord.py b/scratch/mso-dumper/src/xlsrecord.py
index f61478a..72f2cce 100644
--- a/scratch/mso-dumper/src/xlsrecord.py
+++ b/scratch/mso-dumper/src/xlsrecord.py
@@ -702,18 +702,6 @@ class Dimensions(BaseRecordHandler):
 
 class Dv(BaseRecordHandler):
 
-    def __parseBytes (self):
-        bits = self.readUnsignedInt(4)
-        self.valType      = (bits & 0x0000000F)
-        self.errStyle     = (bits & 0x00000070) / (2**4)
-        self.strLookup    = (bits & 0x00000080) != 0
-        self.allowBlank   = (bits & 0x00000100) != 0
-        self.noDropDown   = (bits & 0x00000200) != 0
-        self.imeMode      = (bits & 0x0003FC00) / (2**10)    # take 8 bits and shift by 10 bits
-        self.showInputMsg = (bits & 0x00040000) != 0
-        self.showErrorMsg = (bits & 0x00080000) != 0
-        self.operator     = (bits & 0x00F00000) / (2**20)
-
     valueTypes = [
         'any type of value',               # 0x0 
         'whole number',                    # 0x1 
@@ -755,6 +743,30 @@ class Dv(BaseRecordHandler):
         'Less Than or Equal To'     # 0x7
     ]
 
+    def __parseBytes (self):
+        bits = self.readUnsignedInt(4)
+        self.valType      = (bits & 0x0000000F)
+        self.errStyle     = (bits & 0x00000070) / (2**4)
+        self.strLookup    = (bits & 0x00000080) != 0
+        self.allowBlank   = (bits & 0x00000100) != 0
+        self.noDropDown   = (bits & 0x00000200) != 0
+        self.imeMode      = (bits & 0x0003FC00) / (2**10)    # take 8 bits and shift by 10 bits
+        self.showInputMsg = (bits & 0x00040000) != 0
+        self.showErrorMsg = (bits & 0x00080000) != 0
+        self.operator     = (bits & 0x00F00000) / (2**20)
+
+        self.promptTitle = self.readUnicodeString()
+        self.errorTitle = self.readUnicodeString()
+        self.prompt = self.readUnicodeString()
+        self.error = self.readUnicodeString()
+
+        formulaLen = self.readUnsignedInt(2)
+        self.readUnsignedInt(2) # ignore 2 bytes.
+        self.formula1 = self.readBytes(formulaLen)
+        formulaLen = self.readUnsignedInt(2)
+        self.readUnsignedInt(2) # ignore 2 bytes.
+        self.formula2 = self.readBytes(formulaLen)
+
     def parseBytes (self):
         self.__parseBytes()
         s = globals.getValueOrUnknown(Dv.valueTypes, self.valType)
@@ -770,6 +782,22 @@ class Dv(BaseRecordHandler):
         self.appendLineBoolean("show error message", self.showErrorMsg)
         s = globals.getValueOrUnknown(Dv.operatorTypes, self.operator)
         self.appendLine("operator type: %s (0x%1.1X)"%(s, self.operator))
+        self.appendLine("prompt title: %s"%self.promptTitle)
+        self.appendLine("error title: %s"%self.errorTitle)
+        self.appendLine("prompt: %s"%self.prompt)
+        self.appendLine("error: %s"%self.error)
+        self.appendLine("formula 1 (bytes): %s"%globals.getRawBytes(self.formula1, True, False))
+
+        parser = formula.FormulaParser2(self.header, self.formula1)
+        parser.parse()
+        s = parser.getText()
+        self.appendLine("formula 1 (displayed): %s"%s)
+
+        self.appendLine("formula 2 (bytes): %s"%globals.getRawBytes(self.formula2, True, False))
+        parser = formula.FormulaParser2(self.header, self.formula2)
+        parser.parse()
+        s = parser.getText()
+        self.appendLine("formula 2 (displayed): %s"%s)
 
     def fillModel (self, model):
         self.__parseBytes()
commit 8d82d9a677a658daf11b6ded6a53b152c583f99e
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Thu Apr 15 16:54:21 2010 -0400

    [xls-dump] Display flags in DV record.
    
    * scratch/mso-dumper/src/xlsrecord.py:

diff --git a/scratch/mso-dumper/src/xlsrecord.py b/scratch/mso-dumper/src/xlsrecord.py
index fe661ea..f61478a 100644
--- a/scratch/mso-dumper/src/xlsrecord.py
+++ b/scratch/mso-dumper/src/xlsrecord.py
@@ -714,12 +714,62 @@ class Dv(BaseRecordHandler):
         self.showErrorMsg = (bits & 0x00080000) != 0
         self.operator     = (bits & 0x00F00000) / (2**20)
 
+    valueTypes = [
+        'any type of value',               # 0x0 
+        'whole number',                    # 0x1 
+        'decimal value',                   # 0x2 
+        'matches one in a list of values', # 0x3 
+        'date value',                      # 0x4 
+        'time value',                      # 0x5 
+        'text value',                      # 0x6 
+        'custom formula'                   # 0x7 
+    ]
+
+    errorStyles = [
+        'stop icon',       # 0x00
+        'warning icon',    # 0x01
+        'information icon' # 0x02
+    ]
+
+    imeModes = [
+        'No Control',              # 0x00 
+        'On',                      # 0x01 
+        'Off (English)',           # 0x02 
+        'Hiragana',                # 0x04 
+        'wide katakana',           # 0x05 
+        'narrow katakana',         # 0x06 
+        'Full-width alphanumeric', # 0x07 
+        'Half-width alphanumeric', # 0x08 
+        'Full-width hangul',       # 0x09 
+        'Half-width hangul'        # 0x0A 
+    ]
+
+    operatorTypes = [
+        'Between',                  # 0x0
+        'Not Between',              # 0x1
+        'Equals',                   # 0x2
+        'Not Equals',               # 0x3
+        'Greater Than',             # 0x4
+        'Less Than',                # 0x5
+        'Greater Than or Equal To', # 0x6
+        'Less Than or Equal To'     # 0x7
+    ]
+
     def parseBytes (self):
         self.__parseBytes()
-        self.appendLine("type: 0x%1.1X"%self.valType)
-        self.appendLine("error style: 0x%1.1X"%self.errStyle)
+        s = globals.getValueOrUnknown(Dv.valueTypes, self.valType)
+        self.appendLine("type: %s (0x%1.1X)"%(s, self.valType))
+        s = globals.getValueOrUnknown(Dv.errorStyles, self.errStyle)
+        self.appendLine("error style: %s (0x%1.1X)"%(s, self.errStyle))
         self.appendLineBoolean("list of valid inputs", self.strLookup)
         self.appendLineBoolean("allow blank", self.allowBlank)
+        self.appendLineBoolean("suppress down-down in cell", self.noDropDown)
+        s = globals.getValueOrUnknown(Dv.imeModes, self.imeMode)
+        self.appendLine("IME mode: %s (0x%1.1X)"%(s, self.imeMode))
+        self.appendLineBoolean("show input message", self.showInputMsg)
+        self.appendLineBoolean("show error message", self.showErrorMsg)
+        s = globals.getValueOrUnknown(Dv.operatorTypes, self.operator)
+        self.appendLine("operator type: %s (0x%1.1X)"%(s, self.operator))
 
     def fillModel (self, model):
         self.__parseBytes()


More information about the ooo-build-commit mailing list