You've already forked lazarus-ccr
fpspreadsheet: Complete calculation of shared rpn formulas.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3497 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -1737,8 +1737,19 @@ begin
|
|||||||
exit;
|
exit;
|
||||||
|
|
||||||
// Cell contains an RPN formula --> calculate the formula
|
// Cell contains an RPN formula --> calculate the formula
|
||||||
if Length(cell^.RPNFormulaValue) > 0 then
|
if (Length(cell^.RPNFormulaValue) > 0) or
|
||||||
|
((cell^.SharedFormulaBase <> nil) and (Length(cell^.SharedFormulaBase^.RPNFormulaValue) > 0))
|
||||||
|
then
|
||||||
CalcRPNFormula(cell);
|
CalcRPNFormula(cell);
|
||||||
|
|
||||||
|
// Here should be other case of string formula:
|
||||||
|
{
|
||||||
|
else
|
||||||
|
if (Length(cell^.FormulaValue.FormulaStr) > 0) or
|
||||||
|
((cell^.SharedFormulaBase <> nil) and (Length(cell^.SharedFormulaBase^.FomrulaValue.FormulaStr) > 0))
|
||||||
|
then
|
||||||
|
CalcStringFormula(cell);
|
||||||
|
}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{@@
|
{@@
|
||||||
@ -1805,11 +1816,15 @@ var
|
|||||||
r,c: Cardinal;
|
r,c: Cardinal;
|
||||||
formula: TsRPNFormula;
|
formula: TsRPNFormula;
|
||||||
begin
|
begin
|
||||||
if (Length(ACell^.RPNFormulaValue) = 0) or
|
if (ACell^.ContentType = cctError) then
|
||||||
(ACell^.ContentType = cctError)
|
|
||||||
then
|
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
|
if (ACell^.SharedFormulaBase = nil) and (Length(ACell^.RPNFormulaValue) = 0) then
|
||||||
|
exit;
|
||||||
|
|
||||||
|
if (ACell^.SharedFormulaBase <> nil) and (Length(ACell^.SharedFormulaBase^.RPNFormulaValue) = 0)
|
||||||
|
then exit;
|
||||||
|
|
||||||
ACell^.CalcState := csCalculating;
|
ACell^.CalcState := csCalculating;
|
||||||
|
|
||||||
args := TsArgumentStack.Create;
|
args := TsArgumentStack.Create;
|
||||||
@ -1848,13 +1863,27 @@ begin
|
|||||||
end;
|
end;
|
||||||
fekCellOffset:
|
fekCellOffset:
|
||||||
begin
|
begin
|
||||||
cell := FindCell(aCell^.Row + SmallInt(fe.Row), ACell^.Col + SmallInt(fe.Col));
|
if ACell^.SharedFormulaBase = nil then begin
|
||||||
if cell <> nil then
|
WriteErrorValue(ACell, errIllegalRef);
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
|
if (rfRelRow in fe.RelFlags)
|
||||||
|
then r := ACell^.Row + SmallInt(fe.Row)
|
||||||
|
else r := ACell^.SharedFormulaBase^.Row;
|
||||||
|
if (rfRelCol in fe.RelFlags)
|
||||||
|
then c := ACell^.Col + SmallInt(fe.Col)
|
||||||
|
else c := ACell^.SharedFormulaBase^.Col;
|
||||||
|
cell := FindCell(r, c);
|
||||||
|
if cell <> nil then begin
|
||||||
case cell^.CalcState of
|
case cell^.CalcState of
|
||||||
csNotCalculated: CalcRPNFormula(cell);
|
csNotCalculated: CalcRPNFormula(cell);
|
||||||
csCalculating : raise Exception.Create(lpCircularReference);
|
csCalculating : raise Exception.Create(lpCircularReference);
|
||||||
end;
|
end;
|
||||||
args.PushCell(cell, self);
|
args.PushCell(cell, self);
|
||||||
|
end else begin
|
||||||
|
WriteErrorValue(ACell, errIllegalRef);
|
||||||
|
exit;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
fekNum:
|
fekNum:
|
||||||
args.PushNumber(fe.DoubleValue, self);
|
args.PushNumber(fe.DoubleValue, self);
|
||||||
|
@ -8,9 +8,9 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
// Not using lazarus package as the user may be working with multiple versions
|
// Not using lazarus package as the user may be working with multiple versions
|
||||||
// Instead, add .. to unit search path
|
// Instead, add ".." to unit search path
|
||||||
Classes, SysUtils, fpcunit, testutils, testregistry,
|
Classes, SysUtils, fpcunit, testregistry,
|
||||||
fpsallformats, fpspreadsheet {and a project requirement for lclbase for utf8 handling},
|
fpspreadsheet {and a project requirement for lclbase for utf8 handling},
|
||||||
fpsutils, testsutility;
|
fpsutils, testsutility;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
@ -1656,12 +1656,12 @@ var
|
|||||||
c: Word;
|
c: Word;
|
||||||
begin
|
begin
|
||||||
// 2 bytes for row offset
|
// 2 bytes for row offset
|
||||||
dr := WordLEToN(AStream.ReadWord);
|
dr := ShortInt(WordLEToN(AStream.ReadWord));
|
||||||
ARowOffset := dr;
|
ARowOffset := dr;
|
||||||
|
|
||||||
// 2 bytes for column offset
|
// 2 bytes for column offset
|
||||||
c := WordLEToN(AStream.ReadWord);
|
c := WordLEToN(AStream.ReadWord);
|
||||||
dc := Lo(c);
|
dc := ShortInt(Lo(c));
|
||||||
AColOffset := dc;
|
AColOffset := dc;
|
||||||
|
|
||||||
// Extract info on absolute/relative addresses.
|
// Extract info on absolute/relative addresses.
|
||||||
|
Reference in New Issue
Block a user