fpspreadsheet: Some clean-up, less hints
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3466 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
parent
c76d1bdbff
commit
68aed47788
@ -274,9 +274,7 @@ end;
|
|||||||
function CompareArgs(Arg1, Arg2: TsArgument; AExact: Boolean): integer;
|
function CompareArgs(Arg1, Arg2: TsArgument; AExact: Boolean): integer;
|
||||||
var
|
var
|
||||||
val1, val2: Double;
|
val1, val2: Double;
|
||||||
b1, b2: Boolean;
|
|
||||||
cell1, cell2: PCell;
|
cell1, cell2: PCell;
|
||||||
s: String;
|
|
||||||
begin
|
begin
|
||||||
Result := MaxInt;
|
Result := MaxInt;
|
||||||
|
|
||||||
@ -846,7 +844,7 @@ var
|
|||||||
arg: TsArgument;
|
arg: TsArgument;
|
||||||
err: TsErrorValue;
|
err: TsErrorValue;
|
||||||
counter, j: Integer;
|
counter, j: Integer;
|
||||||
b: Boolean;
|
b: Boolean = false;
|
||||||
begin
|
begin
|
||||||
SetLength(AValues, NumArgs);
|
SetLength(AValues, NumArgs);
|
||||||
j := 0;
|
j := 0;
|
||||||
@ -954,6 +952,7 @@ function fpsAdd(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
|||||||
var
|
var
|
||||||
data: TsArgNumberArray;
|
data: TsArgNumberArray;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
if Args.PopNumberValues(2, false, data, Result) then
|
if Args.PopNumberValues(2, false, data, Result) then
|
||||||
Result := CreateNumberArg(data[0] + data[1]);
|
Result := CreateNumberArg(data[0] + data[1]);
|
||||||
end;
|
end;
|
||||||
@ -962,6 +961,7 @@ function fpsSub(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
|||||||
var
|
var
|
||||||
data: TsArgNumberArray;
|
data: TsArgNumberArray;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
if Args.PopNumberValues(2, false, data, Result) then
|
if Args.PopNumberValues(2, false, data, Result) then
|
||||||
Result := CreateNumberArg(data[0] - data[1]);
|
Result := CreateNumberArg(data[0] - data[1]);
|
||||||
end;
|
end;
|
||||||
@ -970,6 +970,7 @@ function fpsMul(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
|||||||
var
|
var
|
||||||
data: TsArgNumberArray;
|
data: TsArgNumberArray;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
if Args.PopNumberValues(2, false, data, Result) then
|
if Args.PopNumberValues(2, false, data, Result) then
|
||||||
Result := CreateNumberArg(data[0] * data[1]);
|
Result := CreateNumberArg(data[0] * data[1]);
|
||||||
end;
|
end;
|
||||||
@ -978,6 +979,7 @@ function fpsDiv(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
|||||||
var
|
var
|
||||||
data: TsArgNumberArray;
|
data: TsArgNumberArray;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
if Args.PopNumberValues(2, false, data, Result) then begin
|
if Args.PopNumberValues(2, false, data, Result) then begin
|
||||||
if data[1] = 0 then
|
if data[1] = 0 then
|
||||||
Result := CreateErrorArg(errDivideByZero)
|
Result := CreateErrorArg(errDivideByZero)
|
||||||
@ -990,6 +992,7 @@ function fpsPercent(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
|||||||
var
|
var
|
||||||
data: TsArgNumberArray;
|
data: TsArgNumberArray;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
if Args.PopNumberValues(1, false, data, Result) then
|
if Args.PopNumberValues(1, false, data, Result) then
|
||||||
Result := CreateNumberArg(data[0] * 0.01);
|
Result := CreateNumberArg(data[0] * 0.01);
|
||||||
end;
|
end;
|
||||||
@ -998,6 +1001,7 @@ function fpsPower(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
|||||||
var
|
var
|
||||||
data: TsArgNumberArray;
|
data: TsArgNumberArray;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
if Args.PopNumberValues(2, false, data, Result) then
|
if Args.PopNumberValues(2, false, data, Result) then
|
||||||
try
|
try
|
||||||
Result := CreateNumberArg(power(data[0], data[1]));
|
Result := CreateNumberArg(power(data[0], data[1]));
|
||||||
@ -1011,6 +1015,7 @@ function fpsUMinus(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
|||||||
var
|
var
|
||||||
data: TsArgNumberArray;
|
data: TsArgNumberArray;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
if Args.PopNumberValues(1, false, data, Result) then
|
if Args.PopNumberValues(1, false, data, Result) then
|
||||||
Result := CreateNumberArg(-data[0]);
|
Result := CreateNumberArg(-data[0]);
|
||||||
end;
|
end;
|
||||||
@ -1019,6 +1024,7 @@ function fpsUPlus(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
|||||||
var
|
var
|
||||||
data: TsArgNumberArray;
|
data: TsArgNumberArray;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
if Args.PopNumberValues(1, false, data, Result) then
|
if Args.PopNumberValues(1, false, data, Result) then
|
||||||
Result := CreateNumberArg(data[0]);
|
Result := CreateNumberArg(data[0]);
|
||||||
end;
|
end;
|
||||||
@ -1027,6 +1033,7 @@ function fpsConcat(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
|||||||
var
|
var
|
||||||
data: TsArgStringArray;
|
data: TsArgStringArray;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
if Args.PopStringValues(2, false, data, Result) then
|
if Args.PopStringValues(2, false, data, Result) then
|
||||||
Result := CreateStringArg(data[0] + data[1]);
|
Result := CreateStringArg(data[0] + data[1]);
|
||||||
end;
|
end;
|
||||||
@ -1036,6 +1043,7 @@ var
|
|||||||
arg1, arg2: TsArgument;
|
arg1, arg2: TsArgument;
|
||||||
res: Integer;
|
res: Integer;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
arg2 := NoCellRangeArg(Args.Pop);
|
arg2 := NoCellRangeArg(Args.Pop);
|
||||||
arg1 := NoCellRangeArg(Args.Pop);
|
arg1 := NoCellRangeArg(Args.Pop);
|
||||||
res := CompareArgs(arg1, arg2, (arg1.ArgumentType <> atCell) and (arg2.ArgumentType <> atCell));
|
res := CompareArgs(arg1, arg2, (arg1.ArgumentType <> atCell) and (arg2.ArgumentType <> atCell));
|
||||||
@ -1047,6 +1055,7 @@ var
|
|||||||
arg1, arg2: TsArgument;
|
arg1, arg2: TsArgument;
|
||||||
res: Integer;
|
res: Integer;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
arg2 := NoCellRangeArg(Args.Pop);
|
arg2 := NoCellRangeArg(Args.Pop);
|
||||||
arg1 := NoCellRangeArg(Args.Pop);
|
arg1 := NoCellRangeArg(Args.Pop);
|
||||||
res := CompareArgs(arg1, arg2, (arg1.ArgumentType <> atCell) and (arg2.ArgumentType <> atCell));
|
res := CompareArgs(arg1, arg2, (arg1.ArgumentType <> atCell) and (arg2.ArgumentType <> atCell));
|
||||||
@ -1058,6 +1067,7 @@ var
|
|||||||
arg1, arg2: TsArgument;
|
arg1, arg2: TsArgument;
|
||||||
res: Integer;
|
res: Integer;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
arg2 := NoCellRangeArg(Args.Pop);
|
arg2 := NoCellRangeArg(Args.Pop);
|
||||||
arg1 := NoCellRangeArg(Args.Pop);
|
arg1 := NoCellRangeArg(Args.Pop);
|
||||||
res := CompareArgs(arg1, arg2, (arg1.ArgumentType <> atCell) and (arg2.ArgumentType <> atCell));
|
res := CompareArgs(arg1, arg2, (arg1.ArgumentType <> atCell) and (arg2.ArgumentType <> atCell));
|
||||||
@ -1069,6 +1079,7 @@ var
|
|||||||
arg1, arg2: TsArgument;
|
arg1, arg2: TsArgument;
|
||||||
res: Integer;
|
res: Integer;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
arg2 := NoCellRangeArg(Args.Pop);
|
arg2 := NoCellRangeArg(Args.Pop);
|
||||||
arg1 := NoCellRangeArg(Args.Pop);
|
arg1 := NoCellRangeArg(Args.Pop);
|
||||||
res := CompareArgs(arg1, arg2, (arg1.ArgumentType <> atCell) and (arg2.ArgumentType <> atCell));
|
res := CompareArgs(arg1, arg2, (arg1.ArgumentType <> atCell) and (arg2.ArgumentType <> atCell));
|
||||||
@ -1080,6 +1091,7 @@ var
|
|||||||
arg1, arg2: TsArgument;
|
arg1, arg2: TsArgument;
|
||||||
res: Integer;
|
res: Integer;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
arg2 := NoCellRangeArg(Args.Pop);
|
arg2 := NoCellRangeArg(Args.Pop);
|
||||||
arg1 := NoCellRangeArg(Args.Pop);
|
arg1 := NoCellRangeArg(Args.Pop);
|
||||||
res := CompareArgs(arg1, arg2, (arg1.ArgumentType <> atCell) and (arg2.ArgumentType <> atCell));
|
res := CompareArgs(arg1, arg2, (arg1.ArgumentType <> atCell) and (arg2.ArgumentType <> atCell));
|
||||||
@ -1091,6 +1103,7 @@ var
|
|||||||
arg1, arg2: TsArgument;
|
arg1, arg2: TsArgument;
|
||||||
res: Integer;
|
res: Integer;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
arg2 := NoCellRangeArg(Args.Pop);
|
arg2 := NoCellRangeArg(Args.Pop);
|
||||||
arg1 := NoCellRangeArg(Args.Pop);
|
arg1 := NoCellRangeArg(Args.Pop);
|
||||||
res := CompareArgs(arg1, arg2, (arg1.ArgumentType <> atCell) and (arg2.ArgumentType <> atCell));
|
res := CompareArgs(arg1, arg2, (arg1.ArgumentType <> atCell) and (arg2.ArgumentType <> atCell));
|
||||||
@ -1104,6 +1117,7 @@ function fpsABS(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
|||||||
var
|
var
|
||||||
data: TsArgNumberArray;
|
data: TsArgNumberArray;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
if Args.PopNumberValues(1, false, data, Result) then
|
if Args.PopNumberValues(1, false, data, Result) then
|
||||||
Result := CreateNumberArg(abs(data[0]));
|
Result := CreateNumberArg(abs(data[0]));
|
||||||
end;
|
end;
|
||||||
@ -1112,6 +1126,7 @@ function fpsACOS(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
|||||||
var
|
var
|
||||||
data: TsArgNumberArray;
|
data: TsArgNumberArray;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
if Args.PopNumberValues(1, false, data, Result) then begin
|
if Args.PopNumberValues(1, false, data, Result) then begin
|
||||||
if InRange(data[0], -1, +1) then
|
if InRange(data[0], -1, +1) then
|
||||||
Result := CreateNumberArg(arccos(data[0]))
|
Result := CreateNumberArg(arccos(data[0]))
|
||||||
@ -1124,6 +1139,7 @@ function fpsACOSH(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
|||||||
var
|
var
|
||||||
data: TsArgNumberArray;
|
data: TsArgNumberArray;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
if Args.PopNumberValues(1, false, data, Result) then begin
|
if Args.PopNumberValues(1, false, data, Result) then begin
|
||||||
if data[0] >= 1 then
|
if data[0] >= 1 then
|
||||||
Result := CreateNumberArg(arccosh(data[0]))
|
Result := CreateNumberArg(arccosh(data[0]))
|
||||||
@ -1136,6 +1152,7 @@ function fpsASIN(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
|||||||
var
|
var
|
||||||
data: TsArgNumberArray;
|
data: TsArgNumberArray;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
if Args.PopNumberValues(1, false, data, Result) then begin
|
if Args.PopNumberValues(1, false, data, Result) then begin
|
||||||
if InRange(data[0], -1, +1) then
|
if InRange(data[0], -1, +1) then
|
||||||
Result := CreateNumberArg(arcsin(data[0]))
|
Result := CreateNumberArg(arcsin(data[0]))
|
||||||
@ -1148,6 +1165,7 @@ function fpsASINH(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
|||||||
var
|
var
|
||||||
data: TsArgNumberArray;
|
data: TsArgNumberArray;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
if Args.PopNumberValues(1, false, data, Result) then
|
if Args.PopNumberValues(1, false, data, Result) then
|
||||||
Result := CreateNumberArg(arcsinh(data[0]));
|
Result := CreateNumberArg(arcsinh(data[0]));
|
||||||
end;
|
end;
|
||||||
@ -1156,6 +1174,7 @@ function fpsATAN(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
|||||||
var
|
var
|
||||||
data: TsArgNumberArray;
|
data: TsArgNumberArray;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
if Args.PopNumberValues(1, false, data, Result) then
|
if Args.PopNumberValues(1, false, data, Result) then
|
||||||
Result := CreateNumberArg(arctan(data[0]));
|
Result := CreateNumberArg(arctan(data[0]));
|
||||||
end;
|
end;
|
||||||
@ -1164,6 +1183,7 @@ function fpsATANH(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
|||||||
var
|
var
|
||||||
data: TsArgNumberArray;
|
data: TsArgNumberArray;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
if Args.PopNumberValues(1, false, data, Result) then begin
|
if Args.PopNumberValues(1, false, data, Result) then begin
|
||||||
if (data[0] > -1) and (data[0] < +1) then
|
if (data[0] > -1) and (data[0] < +1) then
|
||||||
Result := CreateNumberArg(arctanh(data[0]))
|
Result := CreateNumberArg(arctanh(data[0]))
|
||||||
@ -1176,6 +1196,7 @@ function fpsCOS(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
|||||||
var
|
var
|
||||||
data: TsArgNumberArray;
|
data: TsArgNumberArray;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
if Args.PopNumberValues(1, false, data, Result) then
|
if Args.PopNumberValues(1, false, data, Result) then
|
||||||
Result := CreateNumberArg(cos(data[0]));
|
Result := CreateNumberArg(cos(data[0]));
|
||||||
end;
|
end;
|
||||||
@ -1184,6 +1205,7 @@ function fpsCOSH(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
|||||||
var
|
var
|
||||||
data: TsArgNumberArray;
|
data: TsArgNumberArray;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
if Args.PopNumberValues(1, false, data, Result) then
|
if Args.PopNumberValues(1, false, data, Result) then
|
||||||
Result := CreateNumberArg(cosh(data[0]));
|
Result := CreateNumberArg(cosh(data[0]));
|
||||||
end;
|
end;
|
||||||
@ -1192,6 +1214,7 @@ function fpsDEGREES(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
|||||||
var
|
var
|
||||||
data: TsArgNumberArray;
|
data: TsArgNumberArray;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
if Args.PopNumberValues(1, false, data, Result) then
|
if Args.PopNumberValues(1, false, data, Result) then
|
||||||
Result := CreateNumberArg(RadToDeg(data[0]));
|
Result := CreateNumberArg(RadToDeg(data[0]));
|
||||||
end;
|
end;
|
||||||
@ -1200,6 +1223,7 @@ function fpsEXP(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
|||||||
var
|
var
|
||||||
data: TsArgNumberArray;
|
data: TsArgNumberArray;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
if Args.PopNumberValues(1, false, data, Result) then
|
if Args.PopNumberValues(1, false, data, Result) then
|
||||||
Result := CreateNumberArg(exp(data[0]));
|
Result := CreateNumberArg(exp(data[0]));
|
||||||
end;
|
end;
|
||||||
@ -1208,6 +1232,7 @@ function fpsINT(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
|||||||
var
|
var
|
||||||
data: TsArgNumberArray;
|
data: TsArgNumberArray;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
if Args.PopNumberValues(1, false, data, Result) then
|
if Args.PopNumberValues(1, false, data, Result) then
|
||||||
Result := CreateNumberArg(floor(data[0]));
|
Result := CreateNumberArg(floor(data[0]));
|
||||||
end;
|
end;
|
||||||
@ -1216,6 +1241,7 @@ function fpsLN(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
|||||||
var
|
var
|
||||||
data: TsArgNumberArray;
|
data: TsArgNumberArray;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
if Args.PopNumberValues(1, false, data, Result) then begin
|
if Args.PopNumberValues(1, false, data, Result) then begin
|
||||||
if (data[0] > 0) then
|
if (data[0] > 0) then
|
||||||
Result := CreateNumberArg(ln(data[0]))
|
Result := CreateNumberArg(ln(data[0]))
|
||||||
@ -1256,6 +1282,7 @@ function fpsLOG10(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
|||||||
var
|
var
|
||||||
data: TsArgNumberArray;
|
data: TsArgNumberArray;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
if Args.PopNumberValues(1, false, data, Result) then begin
|
if Args.PopNumberValues(1, false, data, Result) then begin
|
||||||
if (data[0] > 0) then
|
if (data[0] > 0) then
|
||||||
Result := CreateNumberArg(log10(data[0]))
|
Result := CreateNumberArg(log10(data[0]))
|
||||||
@ -1266,6 +1293,7 @@ end;
|
|||||||
|
|
||||||
function fpsPI(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
function fpsPI(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
Result := CreateNumberArg(pi);
|
Result := CreateNumberArg(pi);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1273,12 +1301,14 @@ function fpsRADIANS(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
|||||||
var
|
var
|
||||||
data: TsArgNumberArray;
|
data: TsArgNumberArray;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
if Args.PopNumberValues(1, false, data, Result) then
|
if Args.PopNumberValues(1, false, data, Result) then
|
||||||
Result := CreateNumberArg(degtorad(data[0]))
|
Result := CreateNumberArg(degtorad(data[0]))
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function fpsRAND(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
function fpsRAND(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
Result := CreateNumberArg(random);
|
Result := CreateNumberArg(random);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1286,6 +1316,7 @@ function fpsROUND(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
|||||||
var
|
var
|
||||||
data: TsArgNumberArray;
|
data: TsArgNumberArray;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
if Args.PopNumberValues(2, false, data, Result) then
|
if Args.PopNumberValues(2, false, data, Result) then
|
||||||
Result := CreateNumberArg(RoundTo(data[0], round(data[1])))
|
Result := CreateNumberArg(RoundTo(data[0], round(data[1])))
|
||||||
end;
|
end;
|
||||||
@ -1294,6 +1325,7 @@ function fpsSIGN(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
|||||||
var
|
var
|
||||||
data: TsArgNumberArray;
|
data: TsArgNumberArray;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
if Args.PopNumberValues(1, false, data, Result) then
|
if Args.PopNumberValues(1, false, data, Result) then
|
||||||
Result := CreateNumberArg(sign(data[0]))
|
Result := CreateNumberArg(sign(data[0]))
|
||||||
end;
|
end;
|
||||||
@ -1302,6 +1334,7 @@ function fpsSIN(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
|||||||
var
|
var
|
||||||
data: TsArgNumberArray;
|
data: TsArgNumberArray;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
if Args.PopNumberValues(1, false, data, Result) then
|
if Args.PopNumberValues(1, false, data, Result) then
|
||||||
Result := CreateNumberArg(sin(data[0]))
|
Result := CreateNumberArg(sin(data[0]))
|
||||||
end;
|
end;
|
||||||
@ -1310,6 +1343,7 @@ function fpsSINH(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
|||||||
var
|
var
|
||||||
data: TsArgNumberArray;
|
data: TsArgNumberArray;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
if Args.PopNumberValues(1, false, data, Result) then
|
if Args.PopNumberValues(1, false, data, Result) then
|
||||||
Result := CreateNumberArg(sinh(data[0]))
|
Result := CreateNumberArg(sinh(data[0]))
|
||||||
end;
|
end;
|
||||||
@ -1318,6 +1352,7 @@ function fpsSQRT(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
|||||||
var
|
var
|
||||||
data: TsArgNumberArray;
|
data: TsArgNumberArray;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
if Args.PopNumberValues(1, false, data, Result) then begin
|
if Args.PopNumberValues(1, false, data, Result) then begin
|
||||||
if data[0] >= 0.0 then
|
if data[0] >= 0.0 then
|
||||||
Result := CreateNumberArg(sqrt(data[0]))
|
Result := CreateNumberArg(sqrt(data[0]))
|
||||||
@ -1330,6 +1365,7 @@ function fpsTAN(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
|||||||
var
|
var
|
||||||
data: TsArgNumberArray;
|
data: TsArgNumberArray;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
if Args.PopNumberValues(1, false, data, Result) then begin
|
if Args.PopNumberValues(1, false, data, Result) then begin
|
||||||
if frac(data[0] / (pi*0.5)) = 0 then
|
if frac(data[0] / (pi*0.5)) = 0 then
|
||||||
Result := CreateErrorArg(errOverflow)
|
Result := CreateErrorArg(errOverflow)
|
||||||
@ -1342,6 +1378,7 @@ function fpsTANH(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
|||||||
var
|
var
|
||||||
data: TsArgNumberArray;
|
data: TsArgNumberArray;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
if Args.PopNumberValues(1, false, data, Result) then
|
if Args.PopNumberValues(1, false, data, Result) then
|
||||||
Result := CreateNumberArg(tanh(data[0]))
|
Result := CreateNumberArg(tanh(data[0]))
|
||||||
end;
|
end;
|
||||||
@ -1355,6 +1392,7 @@ var
|
|||||||
data: TsArgNumberArray;
|
data: TsArgNumberArray;
|
||||||
d: TDate;
|
d: TDate;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
if Args.PopNumberValues(3, false, data, Result) then begin
|
if Args.PopNumberValues(3, false, data, Result) then begin
|
||||||
d := EncodeDate(round(data[0]), round(data[1]), round(data[2]));
|
d := EncodeDate(round(data[0]), round(data[1]), round(data[2]));
|
||||||
Result := CreateNumberArg(d);
|
Result := CreateNumberArg(d);
|
||||||
@ -1375,6 +1413,7 @@ var
|
|||||||
start_date, end_date: TDate;
|
start_date, end_date: TDate;
|
||||||
res1, res2, res3: TsArgument;
|
res1, res2, res3: TsArgument;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
Args.PopString(interval, res1);
|
Args.PopString(interval, res1);
|
||||||
PopDateValue(Args, end_date, res2);;
|
PopDateValue(Args, end_date, res2);;
|
||||||
PopDateValue(Args, start_date, res3);
|
PopDateValue(Args, start_date, res3);
|
||||||
@ -1410,6 +1449,7 @@ function fpsDATEVALUE(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
|||||||
var
|
var
|
||||||
d: TDate;
|
d: TDate;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
if PopDateValue(Args, d, Result) then
|
if PopDateValue(Args, d, Result) then
|
||||||
Result := CreateNumberArg(d);
|
Result := CreateNumberArg(d);
|
||||||
end;
|
end;
|
||||||
@ -1418,6 +1458,7 @@ function fpsDAY(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
|||||||
var
|
var
|
||||||
d: TDate;
|
d: TDate;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
if PopDateValue(Args, d, Result) then
|
if PopDateValue(Args, d, Result) then
|
||||||
Result := CreateNumberArg(DayOf(d));
|
Result := CreateNumberArg(DayOf(d));
|
||||||
end;
|
end;
|
||||||
@ -1426,6 +1467,7 @@ function fpsHOUR(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
|||||||
var
|
var
|
||||||
t: TTime;
|
t: TTime;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
if PopTimeValue(Args, t, Result) then
|
if PopTimeValue(Args, t, Result) then
|
||||||
Result := CreateNumberArg(HourOf(t));
|
Result := CreateNumberArg(HourOf(t));
|
||||||
end;
|
end;
|
||||||
@ -1434,6 +1476,7 @@ function fpsMINUTE(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
|||||||
var
|
var
|
||||||
t: TTime;
|
t: TTime;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
if PopTimeValue(Args, t, Result) then
|
if PopTimeValue(Args, t, Result) then
|
||||||
Result := CreateNumberArg(MinuteOf(t));
|
Result := CreateNumberArg(MinuteOf(t));
|
||||||
end;
|
end;
|
||||||
@ -1442,6 +1485,7 @@ function fpsMONTH(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
|||||||
var
|
var
|
||||||
d: TDate;
|
d: TDate;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
if PopDateValue(Args, d, Result) then
|
if PopDateValue(Args, d, Result) then
|
||||||
Result := CreateNumberArg(MonthOf(d));
|
Result := CreateNumberArg(MonthOf(d));
|
||||||
end;
|
end;
|
||||||
@ -1449,6 +1493,7 @@ end;
|
|||||||
function fpsNOW(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
function fpsNOW(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
||||||
// NOW()
|
// NOW()
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
Result := CreateNumberArg(now);
|
Result := CreateNumberArg(now);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1456,6 +1501,7 @@ function fpsSECOND(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
|||||||
var
|
var
|
||||||
t: TTime;
|
t: TTime;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
if PopTimeValue(Args, t, Result) then
|
if PopTimeValue(Args, t, Result) then
|
||||||
Result := CreateNumberArg(SecondOf(t));
|
Result := CreateNumberArg(SecondOf(t));
|
||||||
end;
|
end;
|
||||||
@ -1466,6 +1512,7 @@ var
|
|||||||
data: TsArgNumberArray;
|
data: TsArgNumberArray;
|
||||||
t: TTime;
|
t: TTime;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
if Args.PopNumberValues(3, false, data, Result) then begin
|
if Args.PopNumberValues(3, false, data, Result) then begin
|
||||||
t := EncodeTime(round(data[0]), round(data[1]), round(data[2]), 0);
|
t := EncodeTime(round(data[0]), round(data[1]), round(data[2]), 0);
|
||||||
Result := CreateNumberArg(t);
|
Result := CreateNumberArg(t);
|
||||||
@ -1477,6 +1524,7 @@ function fpsTIMEVALUE(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
|||||||
var
|
var
|
||||||
t: TTime;
|
t: TTime;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
if PopTimeValue(Args, t, Result) then
|
if PopTimeValue(Args, t, Result) then
|
||||||
Result := CreateNumberArg(t);
|
Result := CreateNumberArg(t);
|
||||||
end;
|
end;
|
||||||
@ -1484,6 +1532,7 @@ end;
|
|||||||
function fpsToday(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
function fpsToday(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
||||||
// TODAY()
|
// TODAY()
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
Result := CreateNumberArg(Date());
|
Result := CreateNumberArg(Date());
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1515,6 +1564,7 @@ function fpsYEAR(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
|||||||
var
|
var
|
||||||
d: TDate;
|
d: TDate;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
if PopDateValue(Args, d, Result) then
|
if PopDateValue(Args, d, Result) then
|
||||||
Result := CreateNumberArg(YearOf(d));
|
Result := CreateNumberArg(YearOf(d));
|
||||||
end;
|
end;
|
||||||
@ -1599,6 +1649,7 @@ var
|
|||||||
arg: TsArgument;
|
arg: TsArgument;
|
||||||
r, c, n: Cardinal;
|
r, c, n: Cardinal;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
arg := Args.Pop;
|
arg := Args.Pop;
|
||||||
case arg.ArgumentType of
|
case arg.ArgumentType of
|
||||||
atCell:
|
atCell:
|
||||||
@ -1633,6 +1684,7 @@ var
|
|||||||
res: Integer;
|
res: Integer;
|
||||||
cell: PCell;
|
cell: PCell;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
criteria := Args.Pop;
|
criteria := Args.Pop;
|
||||||
arg := Args.Pop;
|
arg := Args.Pop;
|
||||||
compare := coEqual;
|
compare := coEqual;
|
||||||
@ -1847,6 +1899,7 @@ end;
|
|||||||
function fpsFALSE(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
function fpsFALSE(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
||||||
// FALSE( )
|
// FALSE( )
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
Result := CreateBoolArg(false);
|
Result := CreateBoolArg(false);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1901,6 +1954,7 @@ end;
|
|||||||
function fpsTRUE(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
function fpsTRUE(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
||||||
// TRUE ( )
|
// TRUE ( )
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
Result := CreateBoolArg(true);
|
Result := CreateBoolArg(true);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1912,6 +1966,7 @@ function fpsCHAR(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
|||||||
var
|
var
|
||||||
data: TsArgNumberArray;
|
data: TsArgNumberArray;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
if Args.PopNumberValues(1, false, data, Result) then begin
|
if Args.PopNumberValues(1, false, data, Result) then begin
|
||||||
if (data[0] >= 0) and (data[0] <= 255) then
|
if (data[0] >= 0) and (data[0] <= 255) then
|
||||||
Result := CreateStringArg(AnsiToUTF8(Char(Round(data[0]))));
|
Result := CreateStringArg(AnsiToUTF8(Char(Round(data[0]))));
|
||||||
@ -1924,6 +1979,7 @@ var
|
|||||||
s: String;
|
s: String;
|
||||||
ch: Char;
|
ch: Char;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
if Args.PopString(s, Result) then begin
|
if Args.PopString(s, Result) then begin
|
||||||
if s <> '' then begin
|
if s <> '' then begin
|
||||||
ch := UTF8ToAnsi(s)[1];
|
ch := UTF8ToAnsi(s)[1];
|
||||||
@ -1965,6 +2021,7 @@ function fpsLOWER(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
|||||||
var
|
var
|
||||||
s: String;
|
s: String;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
if Args.PopString(s, Result) then
|
if Args.PopString(s, Result) then
|
||||||
Result := CreateStringArg(UTF8LowerCase(s));
|
Result := CreateStringArg(UTF8LowerCase(s));
|
||||||
end;
|
end;
|
||||||
@ -1976,6 +2033,7 @@ var
|
|||||||
s: String;
|
s: String;
|
||||||
res1, res2: TsArgument;
|
res1, res2: TsArgument;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
Args.PopNumberValues(2, false, data, res1);
|
Args.PopNumberValues(2, false, data, res1);
|
||||||
Args.PopString(s, res2);
|
Args.PopString(s, res2);
|
||||||
if res1.ErrorValue <> errOK then begin
|
if res1.ErrorValue <> errOK then begin
|
||||||
@ -1996,6 +2054,7 @@ var
|
|||||||
s, s1, s2, snew: String;
|
s, s1, s2, snew: String;
|
||||||
p, count: Integer;
|
p, count: Integer;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
arg_new := Args.Pop;
|
arg_new := Args.Pop;
|
||||||
if arg_new.ArgumentType <> atString then begin
|
if arg_new.ArgumentType <> atString then begin
|
||||||
Result := CreateErrorArg(errWrongType);
|
Result := CreateErrorArg(errWrongType);
|
||||||
@ -2092,6 +2151,7 @@ function fpsTRIM(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
|||||||
var
|
var
|
||||||
s: String;
|
s: String;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
if Args.PopString(s, Result) then
|
if Args.PopString(s, Result) then
|
||||||
Result := CreateStringArg(UTF8Trim(s));
|
Result := CreateStringArg(UTF8Trim(s));
|
||||||
end;
|
end;
|
||||||
@ -2101,6 +2161,7 @@ function fpsUPPER(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
|||||||
var
|
var
|
||||||
s: String;
|
s: String;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
if Args.PopString(s, Result) then
|
if Args.PopString(s, Result) then
|
||||||
Result := CreateStringArg(UTF8UpperCase(s));
|
Result := CreateStringArg(UTF8UpperCase(s));
|
||||||
end;
|
end;
|
||||||
@ -2135,6 +2196,7 @@ function fpsCOLUMNS(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
|||||||
var
|
var
|
||||||
arg: TsArgument;
|
arg: TsArgument;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
arg := Args.Pop;
|
arg := Args.Pop;
|
||||||
case arg.ArgumentType of
|
case arg.ArgumentType of
|
||||||
atCell : Result := CreateNumberArg(1);
|
atCell : Result := CreateNumberArg(1);
|
||||||
@ -2171,6 +2233,7 @@ function fpsROWS(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
|||||||
var
|
var
|
||||||
arg: TsArgument;
|
arg: TsArgument;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
arg := Args.Pop;
|
arg := Args.Pop;
|
||||||
case arg.ArgumentType of
|
case arg.ArgumentType of
|
||||||
atCell : Result := CreateNumberArg(1);
|
atCell : Result := CreateNumberArg(1);
|
||||||
@ -2364,6 +2427,7 @@ var
|
|||||||
workbook: TsWorkbook;
|
workbook: TsWorkbook;
|
||||||
s: String;
|
s: String;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
arg := Args.Pop;
|
arg := Args.Pop;
|
||||||
if arg.ArgumentType <> atString then
|
if arg.ArgumentType <> atString then
|
||||||
Result := CreateErrorArg(errWrongType)
|
Result := CreateErrorArg(errWrongType)
|
||||||
@ -2386,6 +2450,7 @@ function fpsISBLANK(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
|||||||
var
|
var
|
||||||
arg: TsArgument;
|
arg: TsArgument;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
arg := Args.Pop;
|
arg := Args.Pop;
|
||||||
Result := CreateBoolArg(
|
Result := CreateBoolArg(
|
||||||
(arg.ArgumentType = atCell) and
|
(arg.ArgumentType = atCell) and
|
||||||
@ -2400,6 +2465,7 @@ function fpsISERR(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
|||||||
var
|
var
|
||||||
arg: TsArgument;
|
arg: TsArgument;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
arg := Args.Pop;
|
arg := Args.Pop;
|
||||||
Result := CreateBoolArg((arg.ArgumentType = atError) and (arg.ErrorValue <> errArgError));
|
Result := CreateBoolArg((arg.ArgumentType = atError) and (arg.ErrorValue <> errArgError));
|
||||||
end;
|
end;
|
||||||
@ -2411,6 +2477,7 @@ function fpsISERROR(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
|||||||
var
|
var
|
||||||
arg: TsArgument;
|
arg: TsArgument;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
arg := Args.Pop;
|
arg := Args.Pop;
|
||||||
Result := CreateBoolArg((arg.ArgumentType = atError));
|
Result := CreateBoolArg((arg.ArgumentType = atError));
|
||||||
end;
|
end;
|
||||||
@ -2420,6 +2487,7 @@ function fpsISLOGICAL(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
|||||||
var
|
var
|
||||||
arg: TsArgument;
|
arg: TsArgument;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
arg := Args.Pop;
|
arg := Args.Pop;
|
||||||
Result := CreateBoolArg(arg.ArgumentType = atBool);
|
Result := CreateBoolArg(arg.ArgumentType = atBool);
|
||||||
end;
|
end;
|
||||||
@ -2431,6 +2499,7 @@ function fpsISNA(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
|||||||
var
|
var
|
||||||
arg: TsArgument;
|
arg: TsArgument;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
arg := Args.Pop;
|
arg := Args.Pop;
|
||||||
Result := CreateBoolArg((arg.ArgumentType = atError) and (arg.ErrorValue = errArgError));
|
Result := CreateBoolArg((arg.ArgumentType = atError) and (arg.ErrorValue = errArgError));
|
||||||
end;
|
end;
|
||||||
@ -2440,6 +2509,7 @@ function fpsISNONTEXT(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
|||||||
var
|
var
|
||||||
arg: TsArgument;
|
arg: TsArgument;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
arg := Args.Pop;
|
arg := Args.Pop;
|
||||||
Result := CreateBoolArg(arg.ArgumentType <> atString);
|
Result := CreateBoolArg(arg.ArgumentType <> atString);
|
||||||
end;
|
end;
|
||||||
@ -2449,6 +2519,7 @@ function fpsISNUMBER(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
|||||||
var
|
var
|
||||||
arg: TsArgument;
|
arg: TsArgument;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
arg := Args.Pop;
|
arg := Args.Pop;
|
||||||
Result := CreateBoolArg(arg.ArgumentType = atNumber);
|
Result := CreateBoolArg(arg.ArgumentType = atNumber);
|
||||||
end;
|
end;
|
||||||
@ -2458,6 +2529,7 @@ function fpsISREF(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
|||||||
var
|
var
|
||||||
arg: TsArgument;
|
arg: TsArgument;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
arg := Args.Pop;
|
arg := Args.Pop;
|
||||||
Result := CreateBoolArg(arg.ArgumentType in [atCell, atCellRange]);
|
Result := CreateBoolArg(arg.ArgumentType in [atCell, atCellRange]);
|
||||||
end;
|
end;
|
||||||
@ -2467,6 +2539,7 @@ function fpsISTEXT(Args: TsArgumentStack; NumArgs: Integer): TsArgument;
|
|||||||
var
|
var
|
||||||
arg: TsArgument;
|
arg: TsArgument;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
arg := Args.Pop;
|
arg := Args.Pop;
|
||||||
Result := CreateBoolArg(arg.ArgumentType = atString);
|
Result := CreateBoolArg(arg.ArgumentType = atString);
|
||||||
end;
|
end;
|
||||||
@ -2479,6 +2552,7 @@ var
|
|||||||
s: String;
|
s: String;
|
||||||
x: Double;
|
x: Double;
|
||||||
begin
|
begin
|
||||||
|
Unused(NumArgs);
|
||||||
if Args.PopString(s, Result) then
|
if Args.PopString(s, Result) then
|
||||||
if TryStrToFloat(s, x) then
|
if TryStrToFloat(s, x) then
|
||||||
Result := CreateNumberArg(x)
|
Result := CreateNumberArg(x)
|
||||||
|
@ -2018,7 +2018,6 @@ var
|
|||||||
styleChildNode: TDOMNode;
|
styleChildNode: TDOMNode;
|
||||||
family: String;
|
family: String;
|
||||||
styleName: String;
|
styleName: String;
|
||||||
styleIndex: Integer;
|
|
||||||
numFmtName: String;
|
numFmtName: String;
|
||||||
numFmtIndex: Integer;
|
numFmtIndex: Integer;
|
||||||
numFmtIndexDefault: Integer;
|
numFmtIndexDefault: Integer;
|
||||||
@ -2237,7 +2236,7 @@ begin
|
|||||||
style.BackgroundColor := IfThen(bkClr = TsColorValue(-1), scNotDefined,
|
style.BackgroundColor := IfThen(bkClr = TsColorValue(-1), scNotDefined,
|
||||||
Workbook.AddColorToPalette(bkClr));
|
Workbook.AddColorToPalette(bkClr));
|
||||||
|
|
||||||
styleIndex := FCellStyleList.Add(style);
|
FCellStyleList.Add(style);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
styleNode := styleNode.NextSibling;
|
styleNode := styleNode.NextSibling;
|
||||||
@ -2577,10 +2576,6 @@ end;
|
|||||||
procedure TsSpreadOpenDocWriter.WriteContent;
|
procedure TsSpreadOpenDocWriter.WriteContent;
|
||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
lCellStylesCode: string;
|
|
||||||
lColStylesCode: String;
|
|
||||||
lRowStylesCode: String;
|
|
||||||
lNumFmtCode: String;
|
|
||||||
begin
|
begin
|
||||||
AppendToStream(FSContent,
|
AppendToStream(FSContent,
|
||||||
XML_HEADER);
|
XML_HEADER);
|
||||||
@ -3067,7 +3062,6 @@ procedure TsSpreadOpenDocWriter.WriteRowStyles(AStream: TStream);
|
|||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
rowstyle: TRowStyleData;
|
rowstyle: TRowStyleData;
|
||||||
useOptRowH: String;
|
|
||||||
begin
|
begin
|
||||||
if FRowStyleList.Count = 0 then begin
|
if FRowStyleList.Count = 0 then begin
|
||||||
AppendToStream(AStream,
|
AppendToStream(AStream,
|
||||||
@ -3222,7 +3216,6 @@ end;
|
|||||||
procedure TsSpreadOpenDocWriter.WriteBlank(AStream: TStream;
|
procedure TsSpreadOpenDocWriter.WriteBlank(AStream: TStream;
|
||||||
const ARow, ACol: Cardinal; ACell: PCell);
|
const ARow, ACol: Cardinal; ACell: PCell);
|
||||||
var
|
var
|
||||||
lStyle: String = '';
|
|
||||||
lIndex: Integer;
|
lIndex: Integer;
|
||||||
begin
|
begin
|
||||||
Unused(AStream, ACell);
|
Unused(AStream, ACell);
|
||||||
@ -3400,7 +3393,6 @@ var
|
|||||||
hsm: Integer; // HorizontalSplitMode
|
hsm: Integer; // HorizontalSplitMode
|
||||||
vsm: Integer; // VerticalSplitMode
|
vsm: Integer; // VerticalSplitMode
|
||||||
asr: Integer; // ActiveSplitRange
|
asr: Integer; // ActiveSplitRange
|
||||||
showGrid: Boolean;
|
|
||||||
begin
|
begin
|
||||||
for i:=0 to Workbook.GetWorksheetCount-1 do begin
|
for i:=0 to Workbook.GetWorksheetCount-1 do begin
|
||||||
sheet := Workbook.GetWorksheetByIndex(i);
|
sheet := Workbook.GetWorksheetByIndex(i);
|
||||||
@ -3419,7 +3411,7 @@ begin
|
|||||||
hsm := 0; vsm := 2; asr := 2;
|
hsm := 0; vsm := 2; asr := 2;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
showGrid := (soShowGridLines in sheet.Options);
|
{showGrid := (soShowGridLines in sheet.Options);}
|
||||||
|
|
||||||
AppendToStream(AStream,
|
AppendToStream(AStream,
|
||||||
'<config:config-item config:name="CursorPositionX" config:type="int">'+IntToStr(sheet.LeftPaneWidth)+'</config:config-item>');
|
'<config:config-item config:name="CursorPositionX" config:type="int">'+IntToStr(sheet.LeftPaneWidth)+'</config:config-item>');
|
||||||
@ -3736,7 +3728,6 @@ var
|
|||||||
displayStr: String;
|
displayStr: String;
|
||||||
lIndex: Integer;
|
lIndex: Integer;
|
||||||
isTimeOnly: Boolean;
|
isTimeOnly: Boolean;
|
||||||
lcfmt: String;
|
|
||||||
begin
|
begin
|
||||||
Unused(AStream, ACell);
|
Unused(AStream, ACell);
|
||||||
Unused(ARow, ACol);
|
Unused(ARow, ACol);
|
||||||
@ -3751,7 +3742,7 @@ begin
|
|||||||
|
|
||||||
// nfTimeInterval is a special case - let's handle it first:
|
// nfTimeInterval is a special case - let's handle it first:
|
||||||
if (ACell^.NumberFormat = nfTimeInterval) then begin
|
if (ACell^.NumberFormat = nfTimeInterval) then begin
|
||||||
lcfmt := Lowercase(Copy(ACell^.NumberFormatStr, 1, 2));
|
//lcfmt := Lowercase(Copy(ACell^.NumberFormatStr, 1, 2));
|
||||||
strValue := FormatDateTime(ISO8601FormatHoursOverflow, AValue, [fdoInterval]);
|
strValue := FormatDateTime(ISO8601FormatHoursOverflow, AValue, [fdoInterval]);
|
||||||
displayStr := FormatDateTime(ACell^.NumberFormatStr, AValue, [fdoInterval]);
|
displayStr := FormatDateTime(ACell^.NumberFormatStr, AValue, [fdoInterval]);
|
||||||
AppendToStream(AStream, Format(
|
AppendToStream(AStream, Format(
|
||||||
|
@ -262,7 +262,6 @@ function TBufStream.Seek(const Offset: Int64; Origin: TSeekOrigin): Int64;
|
|||||||
var
|
var
|
||||||
oldPos: Int64;
|
oldPos: Int64;
|
||||||
newPos: Int64;
|
newPos: Int64;
|
||||||
n: Int64;
|
|
||||||
begin
|
begin
|
||||||
oldPos := GetPosition;
|
oldPos := GetPosition;
|
||||||
case Origin of
|
case Origin of
|
||||||
@ -272,8 +271,10 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// case #1: New position is within buffer, no file stream yet
|
// case #1: New position is within buffer, no file stream yet
|
||||||
if (FFileStream = nil) and (newPos < FMemoryStream.Size) then begin
|
if (FFileStream = nil) and (newPos < FMemoryStream.Size) then
|
||||||
|
begin
|
||||||
FMemoryStream.Position := newPos;
|
FMemoryStream.Position := newPos;
|
||||||
|
Result := FMemoryStream.Position;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -283,6 +284,7 @@ begin
|
|||||||
if (newPos >= FFileStream.Position) and (newPos < FFileStream.Position + FMemoryStream.Size)
|
if (newPos >= FFileStream.Position) and (newPos < FFileStream.Position + FMemoryStream.Size)
|
||||||
then begin
|
then begin
|
||||||
FMemoryStream.Position := newPos - FFileStream.Position;
|
FMemoryStream.Position := newPos - FFileStream.Position;
|
||||||
|
Result := FMemoryStream.Position;
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -291,16 +293,8 @@ begin
|
|||||||
FlushBuffer;
|
FlushBuffer;
|
||||||
FFileStream.Position := newPos;
|
FFileStream.Position := newPos;
|
||||||
FMemoryStream.Position := 0;
|
FMemoryStream.Position := 0;
|
||||||
if not IsWritingMode then begin
|
if not IsWritingMode then
|
||||||
FillBuffer;
|
FillBuffer;
|
||||||
{
|
|
||||||
FMemoryStream.Position := 0;
|
|
||||||
n := Min(FBufSize, FFileStream.Size - newPos);
|
|
||||||
FMemoryStream.CopyFrom(FFileStream, n);
|
|
||||||
FFileStream.Position := newPos;
|
|
||||||
FMemoryStream.Position := 0;
|
|
||||||
}
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TBufStream.Write(const ABuffer; ACount: LongInt): LongInt;
|
function TBufStream.Write(const ABuffer; ACount: LongInt): LongInt;
|
||||||
|
@ -2003,7 +2003,6 @@ const
|
|||||||
HUE_120 = 85;
|
HUE_120 = 85;
|
||||||
HUE_180 = 128;
|
HUE_180 = 128;
|
||||||
HUE_240 = 170;
|
HUE_240 = 170;
|
||||||
HUE_300 = 213;
|
|
||||||
|
|
||||||
procedure RGBtoHLS(const R, G, B: Byte; out H, L, S: Byte);
|
procedure RGBtoHLS(const R, G, B: Byte; out H, L, S: Byte);
|
||||||
var
|
var
|
||||||
|
@ -1753,7 +1753,6 @@ var
|
|||||||
XF: WORD;
|
XF: WORD;
|
||||||
cell: PCell;
|
cell: PCell;
|
||||||
AValue: ansistring;
|
AValue: ansistring;
|
||||||
AStrValue: ansistring;
|
|
||||||
begin
|
begin
|
||||||
{ Read entire record, starting at Row, except for string data }
|
{ Read entire record, starting at Row, except for string data }
|
||||||
AStream.ReadBuffer(rec.Row, SizeOf(TBIFF5LabelRecord) - 2*SizeOf(Word));
|
AStream.ReadBuffer(rec.Row, SizeOf(TBIFF5LabelRecord) - 2*SizeOf(Word));
|
||||||
|
@ -996,8 +996,7 @@ const
|
|||||||
//37267-8-1=32758
|
//37267-8-1=32758
|
||||||
MAXBYTES = 32758;
|
MAXBYTES = 32758;
|
||||||
var
|
var
|
||||||
L, RecLen: Word;
|
L: Word;
|
||||||
TextTooLong: boolean=false;
|
|
||||||
WideValue: WideString;
|
WideValue: WideString;
|
||||||
rec: TBIFF8LabelRecord;
|
rec: TBIFF8LabelRecord;
|
||||||
buf: array of byte;
|
buf: array of byte;
|
||||||
@ -1018,8 +1017,7 @@ begin
|
|||||||
if Length(WideValue) > MAXBYTES then begin
|
if Length(WideValue) > MAXBYTES then begin
|
||||||
// Rather than lose data when reading it, let the application programmer deal
|
// Rather than lose data when reading it, let the application programmer deal
|
||||||
// with the problem or purposefully ignore it.
|
// with the problem or purposefully ignore it.
|
||||||
TextTooLong := true;
|
SetLength(WideValue, MAXBYTES); //may corrupt the string (e.g. in surrogate pairs), but... too bad.
|
||||||
SetLength(WideValue, MaxBytes); //may corrupt the string (e.g. in surrogate pairs), but... too bad.
|
|
||||||
Workbook.AddErrorMsg(
|
Workbook.AddErrorMsg(
|
||||||
'Text value exceeds %d character limit in cell %s. ' +
|
'Text value exceeds %d character limit in cell %s. ' +
|
||||||
'Text has been truncated.', [
|
'Text has been truncated.', [
|
||||||
|
@ -166,7 +166,7 @@ type
|
|||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
variants, fileutil, StrUtils, math, fpsStreams, fpsNumFormatParser;
|
variants, fileutil, strutils, math, fpsStreams, fpsNumFormatParser;
|
||||||
|
|
||||||
const
|
const
|
||||||
{ OOXML general XML constants }
|
{ OOXML general XML constants }
|
||||||
@ -796,7 +796,6 @@ type
|
|||||||
var
|
var
|
||||||
s: String;
|
s: String;
|
||||||
rgb: TsColorValue;
|
rgb: TsColorValue;
|
||||||
rgba: TRGBA absolute(rgb); // just for debugging
|
|
||||||
idx: Integer;
|
idx: Integer;
|
||||||
tint: Double;
|
tint: Double;
|
||||||
n: Integer;
|
n: Integer;
|
||||||
@ -813,7 +812,7 @@ begin
|
|||||||
if s <> '' then begin
|
if s <> '' then begin
|
||||||
Result := StrToInt(s);
|
Result := StrToInt(s);
|
||||||
n := FWorkbook.GetPaletteSize;
|
n := FWorkbook.GetPaletteSize;
|
||||||
if (Result <= LAST_PALETTE_COLOR) and (Result < FWorkbook.GetPaletteSize) then
|
if (Result <= LAST_PALETTE_COLOR) and (Result < n) then
|
||||||
exit;
|
exit;
|
||||||
// System colors
|
// System colors
|
||||||
// taken from OpenOffice docs
|
// taken from OpenOffice docs
|
||||||
@ -879,7 +878,7 @@ begin
|
|||||||
if s <> '' then begin
|
if s <> '' then begin
|
||||||
w := StrToFloat(s, FPointSeparatorSettings);
|
w := StrToFloat(s, FPointSeparatorSettings);
|
||||||
for col := col1 to col2 do
|
for col := col1 to col2 do
|
||||||
FWorksheet.WriteColWidth(col, w);
|
AWorksheet.WriteColWidth(col, w);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
colNode := colNode.NextSibling;
|
colNode := colNode.NextSibling;
|
||||||
@ -906,11 +905,9 @@ var
|
|||||||
fillNode, patternNode, colorNode: TDOMNode;
|
fillNode, patternNode, colorNode: TDOMNode;
|
||||||
nodeName: String;
|
nodeName: String;
|
||||||
filldata: TFillListData;
|
filldata: TFillListData;
|
||||||
s: String;
|
|
||||||
patt: String;
|
patt: String;
|
||||||
fgclr: TsColor;
|
fgclr: TsColor;
|
||||||
bgclr: TsColor;
|
bgclr: TsColor;
|
||||||
ci: TsColor;
|
|
||||||
begin
|
begin
|
||||||
if ANode = nil then
|
if ANode = nil then
|
||||||
exit;
|
exit;
|
||||||
@ -978,7 +975,6 @@ var
|
|||||||
fntName: String;
|
fntName: String;
|
||||||
fntSize: Single;
|
fntSize: Single;
|
||||||
fntStyles: TsFontStyles;
|
fntStyles: TsFontStyles;
|
||||||
rgb: TsColorValue;
|
|
||||||
fntColor: TsColor;
|
fntColor: TsColor;
|
||||||
nodename: String;
|
nodename: String;
|
||||||
s: String;
|
s: String;
|
||||||
@ -1141,7 +1137,7 @@ begin
|
|||||||
r := StrToInt(s) - 1;
|
r := StrToInt(s) - 1;
|
||||||
s := GetAttrValue(ANode, 'ht');
|
s := GetAttrValue(ANode, 'ht');
|
||||||
ht := StrToFloat(s, FPointSeparatorSettings); // seems to be in "Points"
|
ht := StrToFloat(s, FPointSeparatorSettings); // seems to be in "Points"
|
||||||
row := FWorksheet.GetRow(r);
|
row := AWorksheet.GetRow(r);
|
||||||
row^.Height := ht / FWorkbook.GetDefaultFontSize;
|
row^.Height := ht / FWorkbook.GetDefaultFontSize;
|
||||||
if row^.Height > ROW_HEIGHT_CORRECTION then
|
if row^.Height > ROW_HEIGHT_CORRECTION then
|
||||||
row^.Height := row^.Height - ROW_HEIGHT_CORRECTION
|
row^.Height := row^.Height - ROW_HEIGHT_CORRECTION
|
||||||
@ -1326,10 +1322,6 @@ var
|
|||||||
SheetList: TStringList;
|
SheetList: TStringList;
|
||||||
i: Integer;
|
i: Integer;
|
||||||
fn: String;
|
fn: String;
|
||||||
|
|
||||||
s: String;
|
|
||||||
node: TDOMNode;
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
//unzip content.xml into AFileName path
|
//unzip content.xml into AFileName path
|
||||||
FilePath := GetTempDir(false);
|
FilePath := GetTempDir(false);
|
||||||
@ -1761,7 +1753,6 @@ var
|
|||||||
i: Integer;
|
i: Integer;
|
||||||
font: TsFont;
|
font: TsFont;
|
||||||
s: String;
|
s: String;
|
||||||
rgb: TsColorValue;
|
|
||||||
begin
|
begin
|
||||||
AppendToStream(FSStyles, Format(
|
AppendToStream(FSStyles, Format(
|
||||||
'<fonts count="%d">', [Workbook.GetFontCount]));
|
'<fonts count="%d">', [Workbook.GetFontCount]));
|
||||||
@ -1828,7 +1819,6 @@ end;
|
|||||||
{ Writes the workbook's color palette to the file }
|
{ Writes the workbook's color palette to the file }
|
||||||
procedure TsSpreadOOXMLWriter.WritePalette(AStream: TStream);
|
procedure TsSpreadOOXMLWriter.WritePalette(AStream: TStream);
|
||||||
var
|
var
|
||||||
c: TsColor;
|
|
||||||
rgb: TsColorValue;
|
rgb: TsColorValue;
|
||||||
i: Integer;
|
i: Integer;
|
||||||
begin
|
begin
|
||||||
@ -1953,10 +1943,10 @@ var
|
|||||||
bottomRightCell: String;
|
bottomRightCell: String;
|
||||||
begin
|
begin
|
||||||
// Show gridlines ?
|
// Show gridlines ?
|
||||||
showGridLines := IfThen(soShowGridLines in AWorksheet.Options, ' ', 'showGridLines="0" ');
|
showGridLines := StrUtils.IfThen(soShowGridLines in AWorksheet.Options, ' ', 'showGridLines="0" ');
|
||||||
|
|
||||||
// Show headers?
|
// Show headers?
|
||||||
showHeaders := IfThen(soShowHeaders in AWorksheet.Options, ' ', 'showRowColHeaders="0" ');
|
showHeaders := StrUtils.IfThen(soShowHeaders in AWorksheet.Options, ' ', 'showRowColHeaders="0" ');
|
||||||
|
|
||||||
// No frozen panes
|
// No frozen panes
|
||||||
if not (soHasFrozenPanes in AWorksheet.Options) or
|
if not (soHasFrozenPanes in AWorksheet.Options) or
|
||||||
@ -2529,7 +2519,6 @@ const
|
|||||||
var
|
var
|
||||||
CellPosText: string;
|
CellPosText: string;
|
||||||
lStyleIndex: Cardinal;
|
lStyleIndex: Cardinal;
|
||||||
TextTooLong: boolean=false;
|
|
||||||
ResultingValue: string;
|
ResultingValue: string;
|
||||||
//S: string;
|
//S: string;
|
||||||
begin
|
begin
|
||||||
@ -2537,9 +2526,14 @@ begin
|
|||||||
Unused(ARow, ACol, ACell);
|
Unused(ARow, ACol, ACell);
|
||||||
|
|
||||||
// Office 2007-2010 (at least) support no more characters in a cell;
|
// Office 2007-2010 (at least) support no more characters in a cell;
|
||||||
if Length(AValue) > MAXBYTES then begin
|
if Length(AValue) > MAXBYTES then
|
||||||
TextTooLong := true;
|
begin
|
||||||
ResultingValue := Copy(AValue, 1, MAXBYTES); //may chop off multicodepoint UTF8 characters but well...
|
ResultingValue := Copy(AValue, 1, MAXBYTES); //may chop off multicodepoint UTF8 characters but well...
|
||||||
|
Workbook.AddErrorMsg(
|
||||||
|
'Text value exceeds %d character limit in cell %s. ' +
|
||||||
|
'Text has been truncated.', [
|
||||||
|
MAXBYTES, GetCellString(ARow, ACol)
|
||||||
|
]);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
ResultingValue:=AValue;
|
ResultingValue:=AValue;
|
||||||
|
Loading…
Reference in New Issue
Block a user