[ooo-build-commit] scratch/mso-dumper
Kohei Yoshida
kohei at kemper.freedesktop.org
Tue Nov 24 08:13:48 PST 2009
scratch/mso-dumper/src/xlsrecord.py | 66 ++++++++++++++++++++++++++++++++++++
scratch/mso-dumper/src/xlsstream.py | 2 -
2 files changed, 67 insertions(+), 1 deletion(-)
New commits:
commit d6a808bf4fe258bbe4aef891d59522fb5d02dec0
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Tue Nov 24 11:12:46 2009 -0500
[xls-dump] Added record handler for FEATHDR.
The FEATHDR (shared feature header) record stores flags for
enhanced protection and smart tag. The enhanced protection
flag contains sheet protection options.
* 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 b38640c..61521e5 100644
--- a/scratch/mso-dumper/src/xlsrecord.py
+++ b/scratch/mso-dumper/src/xlsrecord.py
@@ -78,6 +78,12 @@ append a line to be displayed.
else:
return 'false'
+ def getEnabledDisabled (self, boolVal):
+ if boolVal:
+ return 'enabled'
+ else:
+ return 'disabled'
+
class BOF(BaseRecordHandler):
@@ -908,6 +914,66 @@ class XF(BaseRecordHandler):
self.appendLine("number format ID: %d"%numId)
+class FeatureHeader(BaseRecordHandler):
+
+ def parseBytes (self):
+ recordType = self.readUnsignedInt(2)
+ frtFlag = self.readUnsignedInt(2) # currently 0
+ self.readBytes(8) # reserved (currently all 0)
+ featureTypeId = self.readUnsignedInt(2)
+ featureTypeText = 'unknown'
+ if featureTypeId == 2:
+ featureTypeText = 'enhanced protection'
+ elif featureTypeId == 4:
+ featureTypeText = 'smart tag'
+ featureHdr = self.readUnsignedInt(1) # must be 1
+ sizeHdrData = self.readSignedInt(4)
+ sizeHdrDataText = 'byte size'
+ if sizeHdrData == -1:
+ sizeHdrDataText = 'size depends on feature type'
+
+ self.appendLine("record type: 0x%4.4X (must match the header)"%recordType)
+ self.appendLine("feature type: %d (%s)"%(featureTypeId, featureTypeText))
+ self.appendLine("size of header data: %d (%s)"%(sizeHdrData, sizeHdrDataText))
+
+ if featureTypeId == 2 and sizeHdrData == -1:
+ # enhanced protection optionsss
+ flags = self.readUnsignedInt(4)
+ self.appendLine("enhanced protection flag: 0x%8.8X"%flags)
+
+ optEditObj = (flags & 0x00000001)
+ optEditScenario = (flags & 0x00000002)
+ optFormatCells = (flags & 0x00000004)
+ optFormatColumns = (flags & 0x00000008)
+ optFormatRows = (flags & 0x00000010)
+ optInsertColumns = (flags & 0x00000020)
+ optInsertRows = (flags & 0x00000040)
+ optInsertLinks = (flags & 0x00000080)
+ optDeleteColumns = (flags & 0x00000100)
+ optDeleteRows = (flags & 0x00000200)
+ optSelectLockedCells = (flags & 0x00000400)
+ optSort = (flags & 0x00000800)
+ optUseAutofilter = (flags & 0x00001000)
+ optUsePivotReports = (flags & 0x00002000)
+ optSelectUnlockedCells = (flags & 0x00004000)
+ self.appendLine(" edit object: %s"%self.getEnabledDisabled(optEditObj))
+ self.appendLine(" edit scenario: %s"%self.getEnabledDisabled(optEditScenario))
+ self.appendLine(" format cells: %s"%self.getEnabledDisabled(optFormatCells))
+ self.appendLine(" format columns: %s"%self.getEnabledDisabled(optFormatColumns))
+ self.appendLine(" format rows: %s"%self.getEnabledDisabled(optFormatRows))
+ self.appendLine(" insert columns: %s"%self.getEnabledDisabled(optInsertColumns))
+ self.appendLine(" insert rows: %s"%self.getEnabledDisabled(optInsertRows))
+ self.appendLine(" insert hyperlinks: %s"%self.getEnabledDisabled(optInsertLinks))
+ self.appendLine(" delete columns: %s"%self.getEnabledDisabled(optDeleteColumns))
+ self.appendLine(" delete rows: %s"%self.getEnabledDisabled(optDeleteRows))
+ self.appendLine(" select locked cells: %s"%self.getEnabledDisabled(optSelectLockedCells))
+ self.appendLine(" sort: %s"%self.getEnabledDisabled(optSort))
+ self.appendLine(" use autofilter: %s"%self.getEnabledDisabled(optUseAutofilter))
+ self.appendLine(" use pivot table reports: %s"%self.getEnabledDisabled(optUsePivotReports))
+ self.appendLine(" select unlocked cells: %s"%self.getEnabledDisabled(optSelectUnlockedCells))
+
+ return
+
# -------------------------------------------------------------------
# SX - Pivot Table
diff --git a/scratch/mso-dumper/src/xlsstream.py b/scratch/mso-dumper/src/xlsstream.py
index e13386b..2d67663 100644
--- a/scratch/mso-dumper/src/xlsstream.py
+++ b/scratch/mso-dumper/src/xlsstream.py
@@ -198,7 +198,7 @@ recData = {
0x0862: ["SHEETLAYOUT", "Tab Color below Sheet Name"],
0x0863: ["BOOKEXT", "Extra Book Info"],
0x0864: ["SXADDL", "Pivot Table Additional Info", xlsrecord.SXAddlInfo],
- 0x0867: ["SHEETPROTECTION", "Sheet Protection Options"],
+ 0x0867: ["FEATHEADR", "Shared Feature Header", xlsrecord.FeatureHeader],
0x0868: ["RANGEPROTECTION", "Protected Range on Protected Sheet"],
0x087D: ["XFEXT", "XF Extension"],
0x088C: ["COMPAT12", "Compatibility Checker 12"],
More information about the ooo-build-commit
mailing list