[ooo-build-commit] scratch/mso-dumper
Kohei Yoshida
kohei at kemper.freedesktop.org
Thu Dec 31 14:38:09 PST 2009
scratch/mso-dumper/src/xlsmodel.py | 39 ++++++++++++++++++++++++++++++++++--
scratch/mso-dumper/src/xlsrecord.py | 17 ++++++++++++---
2 files changed, 51 insertions(+), 5 deletions(-)
New commits:
commit 89f67237e3cdc5ca18fb5bc8c5d2237de8e2a06e
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Thu Dec 31 17:36:42 2009 -0500
[xls-dump] Populate the model with supbook instances.
* scratch/mso-dumper/src/xlsmodel.py:
* scratch/mso-dumper/src/xlsrecord.py:
diff --git a/scratch/mso-dumper/src/xlsmodel.py b/scratch/mso-dumper/src/xlsmodel.py
index feb7f70..2e2a2a2 100644
--- a/scratch/mso-dumper/src/xlsmodel.py
+++ b/scratch/mso-dumper/src/xlsmodel.py
@@ -73,6 +73,33 @@ class SheetBase(object):
return nd
+class Supbook(object):
+ class Type:
+ Self = 0
+ AddIn = 1
+ External = 2
+ DDE = 3
+ OLE = 4
+ Unused = 5
+
+ def __init__ (self, sbType=None):
+ self.sbType = sbType
+
+ def getType (self):
+ return self.sbType
+
+
+class SupbookSelf(Supbook):
+ def __init__ (self, sheetCount):
+ Supbook.__init__(self, Supbook.Type.Self)
+ self.sheetCount = sheetCount
+
+
+class SupbookExternal(Supbook):
+ def __init__ (self):
+ Supbook.__init__(self, Supbook.Type.External)
+
+
class WorkbookGlobal(SheetBase):
class SheetData:
def __init__ (self):
@@ -93,6 +120,9 @@ class WorkbookGlobal(SheetBase):
def appendSheetData (self, data):
self.__sheetData.append(data)
+ def getSheetData (self, i):
+ return self.__sheetData[i]
+
def appendSharedString (self, sst):
self.__sharedStrings.append(sst)
@@ -101,8 +131,13 @@ class WorkbookGlobal(SheetBase):
return None
return self.__sharedStrings[strID]
- def getSheetData (self, i):
- return self.__sheetData[i]
+ def appendSupbook (self, sb):
+ self.__supbooks.append(sb)
+
+ def getSupbook (self, sbID):
+ if len(self.__supbooks) <= sbID:
+ return None
+ return self.__supbooks[sbID]
class Worksheet(SheetBase):
diff --git a/scratch/mso-dumper/src/xlsrecord.py b/scratch/mso-dumper/src/xlsrecord.py
index 4e6bf33..d6d65f5 100644
--- a/scratch/mso-dumper/src/xlsrecord.py
+++ b/scratch/mso-dumper/src/xlsrecord.py
@@ -1070,7 +1070,7 @@ class Name(BaseRecordHandler):
class SupBook(BaseRecordHandler):
"""Supporting workbook"""
- class SBType:
+ class Type:
Self = 0x0401
AddIn = 0x3A01
@@ -1094,13 +1094,13 @@ class SupBook(BaseRecordHandler):
def parseBytes (self):
self.__parseBytes()
- if self.sbType == SupBook.SBType.Self:
+ if self.sbType == SupBook.Type.Self:
# self-referencing supbook
self.appendLine("type: self-referencing")
self.appendLine("sheet name count: %d"%self.ctab)
return
- if self.sbType == SupBook.SBType.AddIn:
+ if self.sbType == SupBook.Type.AddIn:
self.appendLine("type: add-in referencing")
self.appendMultiLine("Add-in function name stored in the following EXTERNNAME record.")
return
@@ -1114,6 +1114,17 @@ class SupBook(BaseRecordHandler):
name = globals.encodeName(name)
self.appendLine("sheet name: %s"%name)
+ def fillModel (self, model):
+ self.__parseBytes()
+ wbg = model.getWorkbookGlobal()
+ if self.sbType == SupBook.Type.Self:
+ sb = xlsmodel.SupbookSelf(self.ctab)
+ wbg.appendSupbook(sb)
+ else:
+ # generic supbook instance just to keep the indices in sync.
+ wbg.appendSupbook(xlsmodel.Supbook())
+
+
class ExternSheet(BaseRecordHandler):
More information about the ooo-build-commit
mailing list