[Libreoffice-commits] .: src/formula.py src/xlsrecord.py
Kohei Yoshida
kohei at kemper.freedesktop.org
Fri Apr 8 19:46:43 PDT 2011
src/formula.py | 9 +++++++++
src/xlsrecord.py | 19 ++++++++++++-------
2 files changed, 21 insertions(+), 7 deletions(-)
New commits:
commit ae7ffa4a9367607c7b8b4c33953dd37ba270715a
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Fri Apr 8 22:45:09 2011 -0400
Recognize formula cell containing array.
diff --git a/src/formula.py b/src/formula.py
index 01c760d..9d9e869 100644
--- a/src/formula.py
+++ b/src/formula.py
@@ -401,6 +401,14 @@ class PtgBase(object):
def getText (self):
return ''
+class PtgExp(PtgBase):
+ def parseBytes (self):
+ self.row = self.strm.readUnsignedInt(2)
+ self.col = self.strm.readUnsignedInt(2)
+
+ def getText (self):
+ return "(ptgexp: row=%d, col=%d)"%(self.row, self.col)
+
class _Int(PtgBase):
def parseBytes (self):
self.value = self.strm.readUnsignedInt(2)
@@ -829,6 +837,7 @@ class _FuncVar(PtgBase):
return _FuncVar.funcTab[self.funcType] + "()"
_tokenMap = {
+ 0x01: PtgExp,
0x1E: _Int,
0x3B: _Area3d,
0x5B: _Area3d,
diff --git a/src/xlsrecord.py b/src/xlsrecord.py
index 6d917ce..ffd04ce 100644
--- a/src/xlsrecord.py
+++ b/src/xlsrecord.py
@@ -930,10 +930,14 @@ class Formula(BaseRecordHandler):
self.xf = self.readUnsignedInt(2)
self.fval = self.readDouble()
- flags = self.readUnsignedInt(2)
- self.recalc = (flags & 0x0001) != 0
- self.calcOnOpen = (flags & 0x0002) != 0
- self.sharedFormula = (flags & 0x0008) != 0
+ flag = self.readUnsignedInt(2)
+ self.recalc = (flag & 0x0001) != 0 # A
+ reserved = (flag & 0x0002) != 0 # B
+ self.fillAlignment = (flag & 0x0004) != 0 # C
+ self.sharedFormula = (flag & 0x0008) != 0 # D
+ reserved = (flag & 0x0010) != 0 # E
+ self.clearErrors = (flag & 0x0020) != 0 # F
+
self.appCacheInfo = self.readUnsignedInt(4) # used only for app-specific optimization. Ignore it for now.
tokenSize = self.readUnsignedInt(2)
self.tokens = self.readBytes(tokenSize)
@@ -947,9 +951,10 @@ class Formula(BaseRecordHandler):
self.appendCellPosition(self.col, self.row)
self.appendLine("XF record ID: %d"%self.xf)
self.appendLine("formula result: %g"%self.fval)
- self.appendLine("recalculate always: %d"%self.recalc)
- self.appendLine("calculate on open: %d"%self.calcOnOpen)
- self.appendLine("shared formula: %d"%self.sharedFormula)
+ self.appendLineBoolean("recalculate always", self.recalc)
+ self.appendLineBoolean("fill or center across selection", self.fillAlignment)
+ self.appendLineBoolean("shared formula", self.sharedFormula)
+ self.appendLineBoolean("clear errors", self.clearErrors)
self.appendLine("formula bytes: %s"%globals.getRawBytes(self.tokens, True, False))
self.appendLine("formula string: "+ftext)
More information about the Libreoffice-commits
mailing list