[Libreoffice-commits] .: scratch/mso-dumper
Kohei Yoshida
kohei at kemper.freedesktop.org
Thu Jan 20 12:58:33 PST 2011
scratch/mso-dumper/src/formula.py | 6 ++++++
scratch/mso-dumper/src/xlsrecord.py | 32 ++++++++++++++++++++++++++++++++
scratch/mso-dumper/src/xlsstream.py | 2 +-
3 files changed, 39 insertions(+), 1 deletion(-)
New commits:
commit 2febb35b270c0458f2816767353ed7d14fed0c5a
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Thu Jan 20 15:58:05 2011 -0500
[xls-dump] Parse DCONREF record.
This record stores the source data range for pivot table.
diff --git a/scratch/mso-dumper/src/formula.py b/scratch/mso-dumper/src/formula.py
index eecb857..85bb6bf 100644
--- a/scratch/mso-dumper/src/formula.py
+++ b/scratch/mso-dumper/src/formula.py
@@ -53,6 +53,9 @@ class CellAddress(object):
self.isColRelative = colRel
self.isRowRelative = rowRel
+ def toString (self):
+ return self.getName()
+
def getName (self):
colName = toAbsName(toColName(self.col), self.isColRelative)
rowName = toAbsName("%d"%(self.row+1), self.isRowRelative)
@@ -69,6 +72,9 @@ class CellRange(object):
self.isFirstColRelative = False
self.isLastColRelative = False
+ def toString (self):
+ return self.getName()
+
def getName (self):
col1 = toColName(self.firstCol)
col2 = toColName(self.lastCol)
diff --git a/scratch/mso-dumper/src/xlsrecord.py b/scratch/mso-dumper/src/xlsrecord.py
index 32c692a..a7b7781 100644
--- a/scratch/mso-dumper/src/xlsrecord.py
+++ b/scratch/mso-dumper/src/xlsrecord.py
@@ -35,6 +35,23 @@ class RecordError(Exception): pass
# -------------------------------------------------------------------
# record handler classes
+class RefU(object):
+
+ def __init__ (self, strm):
+ self.row1 = strm.readUnsignedInt(2)
+ self.row2 = strm.readUnsignedInt(2)
+ self.col1 = strm.readUnsignedInt(1)
+ self.col2 = strm.readUnsignedInt(1)
+
+ def toString (self):
+ rge = formula.CellRange()
+ rge.firstRow = self.row1
+ rge.firstCol = self.col1
+ rge.lastRow = self.row2
+ rge.lastCol = self.col2
+ return rge.toString()
+
+
class Ref8U(object):
def __init__ (self, strm):
@@ -43,6 +60,7 @@ class Ref8U(object):
self.col1 = strm.readUnsignedInt(2)
self.col2 = strm.readUnsignedInt(2)
+
class RKAuxData(object):
"""Store auxiliary data for RK value"""
def __init__ (self):
@@ -2218,6 +2236,20 @@ class DConName(BaseRecordHandler):
# this yet.
pass
+class DConRef(BaseRecordHandler):
+
+ def __parseBytes (self):
+ self.ref = RefU(self)
+ textLen = self.readUnsignedInt(2)
+ bytes = self.bytes[self.pos:]
+ text, byteLen = globals.getRichText(bytes, textLen)
+ self.sheetName = globals.encodeName(text)
+
+ def parseBytes (self):
+ self.__parseBytes()
+ self.appendLine("range: %s"%self.ref.toString())
+ self.appendLine("sheet name: %s"%self.sheetName)
+
class SXViewEx9(BaseRecordHandler):
diff --git a/scratch/mso-dumper/src/xlsstream.py b/scratch/mso-dumper/src/xlsstream.py
index 61d7d35..181865a 100644
--- a/scratch/mso-dumper/src/xlsstream.py
+++ b/scratch/mso-dumper/src/xlsstream.py
@@ -72,7 +72,7 @@ recData = {
0x0042: ["CODEPAGE/CODENAME", "Default Code Page/VBE Object Name"],
0x004D: ["PLS", "Environment-Specific Print Record"],
0x0050: ["DCON", "Data Consolidation Information"],
- 0x0051: ["DCONREF", "Data Consolidation References"],
+ 0x0051: ["DCONREF", "Data Consolidation References", xlsrecord.DConRef],
0x0052: ["DCONNAME", "Data Consolidation Named References", xlsrecord.DConName],
0x0055: ["DEFCOLWIDTH", "Default Width for Columns", xlsrecord.DefColWidth],
0x0059: ["XCT", "CRN Record Count", xlsrecord.Xct],
More information about the Libreoffice-commits
mailing list