ooo-build r14274 - in trunk: . scratch/sc-xlsutil/src



Author: kyoshida
Date: Thu Oct  9 23:37:21 2008
New Revision: 14274
URL: http://svn.gnome.org/viewvc/ooo-build?rev=14274&view=rev

Log:
2008-10-09  Kohei Yoshida  <kyoshida novell com>

	* scratch/sc-xlsutil/src/record.py:
	* scratch/sc-xlsutil/src/stream.py: more handlers for pivot table 
	related records.


Modified:
   trunk/ChangeLog
   trunk/scratch/sc-xlsutil/src/record.py
   trunk/scratch/sc-xlsutil/src/stream.py

Modified: trunk/scratch/sc-xlsutil/src/record.py
==============================================================================
--- trunk/scratch/sc-xlsutil/src/record.py	(original)
+++ trunk/scratch/sc-xlsutil/src/record.py	Thu Oct  9 23:37:21 2008
@@ -458,6 +458,150 @@
     def parseBytes (self):
         pass
 
+class SXStreamID(BaseRecordHandler):
+
+    def parseBytes (self):
+        if self.size != 2:
+            return
+
+        strmId = globals.getSignedInt(self.bytes)
+        self.appendLine("pivot cache stream ID in SX DB storage: %d"%strmId)
+
+class SXViewSource(BaseRecordHandler):
+
+    def parseBytes (self):
+        if self.size != 2:
+            return
+
+        src = globals.getSignedInt(self.bytes)
+        srcType = 'unknown'
+        if src == 0x01:
+            srcType = 'Excel list or database'
+        elif src == 0x02:
+            srcType = 'External data source (Microsoft Query)'
+        elif src == 0x04:
+            srcType = 'Multiple consolidation ranges'
+        elif src == 0x10:
+            srcType = 'Scenario Manager summary report'
+
+        self.appendLine("data source type: %s"%srcType)
+
+class SXViewFields(BaseRecordHandler):
+
+    def parseBytes (self):
+        axis          = globals.getSignedInt(self.readBytes(2))
+        subtotalCount = globals.getSignedInt(self.readBytes(2))
+        subtotalType  = globals.getSignedInt(self.readBytes(2))
+        itemCount     = globals.getSignedInt(self.readBytes(2))
+        nameLen       = globals.getSignedInt(self.readBytes(2))
+        
+        axisType = 'unknown'
+        if axis == 0:
+            axisType = 'no axis'
+        elif axis == 1:
+            axisType = 'row'
+        elif axis == 2:
+            axisType = 'column'
+        elif axis == 4:
+            axisType = 'page'
+        elif axis == 8:
+            axisType = 'data'
+
+        subtotalTypeName = 'unknown'
+        if subtotalType == 0x0000:
+            subtotalTypeName = 'None'
+        elif subtotalType == 0x0001:
+            subtotalTypeName = 'Default'
+        elif subtotalType == 0x0002:
+            subtotalTypeName = 'Sum'
+        elif subtotalType == 0x0004:
+            subtotalTypeName = 'CountA'
+        elif subtotalType == 0x0008:
+            subtotalTypeName = 'Average'
+        elif subtotalType == 0x0010:
+            subtotalTypeName = 'Max'
+        elif subtotalType == 0x0020:
+            subtotalTypeName = 'Min'
+        elif subtotalType == 0x0040:
+            subtotalTypeName = 'Product'
+        elif subtotalType == 0x0080:
+            subtotalTypeName = 'Count'
+        elif subtotalType == 0x0100:
+            subtotalTypeName = 'Stdev'
+        elif subtotalType == 0x0200:
+            subtotalTypeName = 'StdevP'
+        elif subtotalType == 0x0400:
+            subtotalTypeName = 'Var'
+        elif subtotalType == 0x0800:
+            subtotalTypeName = 'VarP'
+
+        self.appendLine("axis type: %s"%axisType)
+        self.appendLine("number of subtotals: %d"%subtotalCount)
+        self.appendLine("subtotal type: %s"%subtotalTypeName)
+        self.appendLine("number of items: %d"%itemCount)
+
+        if nameLen == -1:
+            self.appendLine("name length: null (use name in the cache)")
+        else:
+            self.appendLine("name length: %d"%nameLen)
+
+class SXViewItem(BaseRecordHandler):
+
+    itemTypes = {
+        0xFE: 'Page',
+        0xFF: 'Null',
+        0x00: 'Data',
+        0x01: 'Default',
+        0x02: 'SUM',
+        0x03: 'COUNTA',
+        0x04: 'COUNT',
+        0x05: 'AVERAGE',
+        0x06: 'MAX',
+        0x07: 'MIN',
+        0x08: 'PRODUCT',
+        0x09: 'STDEV',
+        0x0A: 'STDEVP',
+        0x0B: 'VAR',
+        0x0C: 'VARP',
+        0x0D: 'Grand total',
+        0x0E: 'blank'
+    }
+
+    def parseBytes (self):
+        itemType = globals.getSignedInt(self.readBytes(2))
+        grbit    = globals.getSignedInt(self.readBytes(2))
+        iCache   = globals.getSignedInt(self.readBytes(2))
+        nameLen  = globals.getSignedInt(self.readBytes(2))
+        
+        itemTypeName = 'unknown'
+        if SXViewItem.itemTypes.has_key(itemType):
+            itemTypeName = SXViewItem.itemTypes[itemType]
+
+        flags = ''
+        if (grbit & 0x0001):
+            flags += 'hidden, '
+        if (grbit & 0x0002):
+            flags += 'detail hidden, '
+        if (grbit & 0x0008):
+            flags += 'formula, '
+        if (grbit & 0x0010):
+            flags += 'missing, '
+
+        if len(flags) > 0:
+            # strip the trailing ', '
+            flags = flags[:-2]
+        else:
+            flags = '(none)'
+
+        self.appendLine("item type: %s"%itemTypeName)
+        self.appendLine("flags: %s"%flags)
+        self.appendLine("pivot cache index: %d"%iCache)
+        if nameLen == -1:
+            self.appendLine("name length: null (use name in the cache)")
+        else:
+            self.appendLine("name length: %d"%nameLen)
+
+
 class PivotQueryTableEx(BaseRecordHandler):
 
     def parseBytes (self):

Modified: trunk/scratch/sc-xlsutil/src/stream.py
==============================================================================
--- trunk/scratch/sc-xlsutil/src/stream.py	(original)
+++ trunk/scratch/sc-xlsutil/src/stream.py	Thu Oct  9 23:37:21 2008
@@ -91,8 +91,8 @@
     0x00AE: ["SCENMAN", "Scenario Output Data"],
     0x00AF: ["SCENARIO", "Scenario Data"],
     0x00B0: ["SXVIEW", "View Definition"],
-    0x00B1: ["SXVD", "View Fields"],
-    0x00B2: ["SXVI", "View Item"],
+    0x00B1: ["SXVD", "View Fields", record.SXViewFields],
+    0x00B2: ["SXVI", "View Item", record.SXViewItem],
     0x00B4: ["SXIVD", "Row/Column Field IDs"],
     0x00B5: ["SXLI", "Line Item Array"],
     0x00B6: ["SXPI", "Page Item"],
@@ -111,7 +111,7 @@
     0x00D1: ["SXTBRGIITM", "Page Item Name Count"],
     0x00D2: ["SXTBPG", "Page Item Indexes"],
     0x00D3: ["OBPROJ", "Visual Basic Project"],
-    0x00D5: ["SXIDSTM", "Stream ID"],
+    0x00D5: ["SXIDSTM", "Stream ID", record.SXStreamID],
     0x00D6: ["RSTRING", "Cell with Character Formatting"],
     0x00D7: ["DBCELL", "Stream Offsets"],
     0x00DA: ["BOOKBOOL", "Workbook Option Flag"],
@@ -123,7 +123,7 @@
     0x00E0: ["XF", "Extended Format"],
     0x00E1: ["INTERFACEHDR", "Beginning of User Interface Records"],
     0x00E2: ["INTERFACEEND", "End of User Interface Records"],
-    0x00E3: ["SXVS", "View Source"],
+    0x00E3: ["SXVS", "View Source", record.SXViewSource],
     0x00EA: ["TABIDCONF", "Sheet Tab ID of Conflict History"],
     0x00EB: ["MSODRAWINGGROUP", "Microsoft Office Drawing Group"],
     0x00EC: ["MSODRAWING", "Microsoft Office Drawing"],



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]