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

Kohei Yoshida kohei at kemper.freedesktop.org
Thu Oct 8 14:59:20 PDT 2009


 scratch/mso-dumper/src/xlsrecord.py |   51 ++++++++++++++++++++++++++++++++++++
 scratch/mso-dumper/src/xlsstream.py |    2 -
 2 files changed, 52 insertions(+), 1 deletion(-)

New commits:
commit 77167b27d0d39e1d65d9d6eb8c2668a623c5c087
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Thu Oct 8 17:29:49 2009 -0400

    [xls-dump] Added handler for PHONETIC record.
    
    However, this record does not seem to be used; even when I change
    the settings of phonetic display, the record content remains the
    same.
    
    * scratch/mso-dumper/src/xlsrecord.py:
    * scratch/mso-dumper/src/xlsstream.py:

diff --git a/scratch/mso-dumper/src/xlsrecord.py b/scratch/mso-dumper/src/xlsrecord.py
index 7bc856b..5125204 100644
--- a/scratch/mso-dumper/src/xlsrecord.py
+++ b/scratch/mso-dumper/src/xlsrecord.py
@@ -745,6 +745,57 @@ class Hyperlink(BaseRecordHandler):
         self.appendMultiLine(msg)
 
 
+class PhoneticInfo(BaseRecordHandler):
+
+    phoneticType = [
+        'narrow Katakana', # 0x00
+        'wide Katakana',   # 0x01
+        'Hiragana',        # 0x02
+        'any type'         # 0x03
+    ]
+
+    @staticmethod
+    def getPhoneticType (flag):
+        if flag < len(PhoneticInfo.phoneticType):
+            return PhoneticInfo.phoneticType[flag]
+        return '(unknown)'
+
+    alignType = [
+        'general alignment',    # 0x00
+        'left aligned',         # 0x01
+        'center aligned',       # 0x02
+        'distributed alignment' # 0x03
+    ]
+
+    @staticmethod
+    def getAlignType (flag):
+        if flag < len(PhoneticInfo.alignType):
+            return PhoneticInfo.alignType[flag]
+        return '(unknown)'
+
+    def parseBytes (self):
+        fontIdx = self.readUnsignedInt(2)
+        self.appendLine("font ID: %d"%fontIdx)
+        flags = self.readUnsignedInt(1)
+
+        # flags: 0 0 0 0 0 0 0 0
+        #       | A | B | unused|
+
+        flags /= 16 # shift 4 bits to the right
+        # flags: 0 0 0 0 0 0 0 0
+        #       |unused | A | B |
+        phType = (flags/4) & 0x03
+        alignType = flags  & 0x03
+
+        self.appendLine("phonetic type: %s"%PhoneticInfo.getPhoneticType(phType))
+        self.appendLine("alignment: %s"%PhoneticInfo.getAlignType(alignType))
+
+        self.readUnsignedInt(1) # unused byte
+        
+        # TODO: read cell ranges.
+
+        return
+
 # -------------------------------------------------------------------
 # SX - Pivot Table
 
diff --git a/scratch/mso-dumper/src/xlsstream.py b/scratch/mso-dumper/src/xlsstream.py
index 11e4b65..0d263d3 100644
--- a/scratch/mso-dumper/src/xlsstream.py
+++ b/scratch/mso-dumper/src/xlsstream.py
@@ -137,7 +137,7 @@ recData = {
     0x00EB: ["MSODRAWINGGROUP", "Microsoft Office Drawing Group"],
     0x00EC: ["MSODRAWING", "Microsoft Office Drawing"],
     0x00ED: ["MSODRAWINGSELECTION", "Microsoft Office Drawing Selection"],
-    0x00EF: ["PHONETIC", "Asian Phonetic Settings"],
+    0x00EF: ["PHONETIC", "Asian Phonetic Settings", xlsrecord.PhoneticInfo],
     0x00F0: ["SXRULE", "PivotTable Rule Data"],
     0x00F1: ["SXEX", "PivotTable View Extended Information"],
     0x00F2: ["SXFILT", "PivotTable Rule Filter"],


More information about the ooo-build-commit mailing list