[Libreoffice-commits] .: 2 commits - src/formula.py
Kohei Yoshida
kohei at kemper.freedesktop.org
Fri Mar 18 15:59:24 PDT 2011
src/formula.py | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
New commits:
commit b7467950a1423589674da589f6c9c0aa71c8a9c6
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Fri Mar 18 18:56:40 2011 -0400
Renamed _TokenBase to PtgBase.
The MS-XLS spec uses Ptg to refer to formula tokens.
diff --git a/src/formula.py b/src/formula.py
index 9f57ad7..01c760d 100644
--- a/src/formula.py
+++ b/src/formula.py
@@ -383,7 +383,7 @@ class TokenType:
Area3d = 0
Unknown = 9999
-class _TokenBase(object):
+class PtgBase(object):
def __init__ (self, strm, opcode1, opcode2=None):
self.opcode1 = opcode1
self.opcode2 = opcode2
@@ -401,14 +401,14 @@ class _TokenBase(object):
def getText (self):
return ''
-class _Int(_TokenBase):
+class _Int(PtgBase):
def parseBytes (self):
self.value = self.strm.readUnsignedInt(2)
def getText (self):
return "%d"%self.value
-class _Area3d(_TokenBase):
+class _Area3d(PtgBase):
def parseBytes (self):
self.xti = self.strm.readUnsignedInt(2)
self.cellRange = parseCellRangeAddress(self.strm.readBytes(8))
@@ -417,7 +417,7 @@ class _Area3d(_TokenBase):
def getText (self):
return "(xti=%d,"%self.xti + self.cellRange.getName() + ")"
-class PtgRef3d(_TokenBase):
+class PtgRef3d(PtgBase):
def parseBytes (self):
self.ixti = self.strm.readUnsignedInt(2)
# TODO: parse differently for named range formulas.
@@ -428,7 +428,7 @@ class PtgRef3d(_TokenBase):
def getText (self):
return "(xti=%d,%s)"%(self.ixti, self.cell.getName())
-class _FuncVar(_TokenBase):
+class _FuncVar(PtgBase):
funcTab = {
0x0000: 'COUNT',
commit dcfa9f16727de21eeb73b185a6a14fffefc55212
Author: Kohei Yoshida <kyoshida at novell.com>
Date: Fri Mar 18 18:53:33 2011 -0400
Parse single cell addresses in the chart source records.
diff --git a/src/formula.py b/src/formula.py
index 85bb6bf..9f57ad7 100644
--- a/src/formula.py
+++ b/src/formula.py
@@ -417,6 +417,17 @@ class _Area3d(_TokenBase):
def getText (self):
return "(xti=%d,"%self.xti + self.cellRange.getName() + ")"
+class PtgRef3d(_TokenBase):
+ def parseBytes (self):
+ self.ixti = self.strm.readUnsignedInt(2)
+ # TODO: parse differently for named range formulas.
+ self.cell = parseCellAddress(self.strm.readBytes(4))
+ self.cell.isColRelative = False
+ self.cell.isRowRelative = False
+
+ def getText (self):
+ return "(xti=%d,%s)"%(self.ixti, self.cell.getName())
+
class _FuncVar(_TokenBase):
funcTab = {
@@ -823,6 +834,7 @@ _tokenMap = {
0x5B: _Area3d,
0x7B: _Area3d,
+ 0x3A: PtgRef3d,
0x42: _FuncVar
}
More information about the Libreoffice-commits
mailing list