fpspreadsheet: Less hints and warnings.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6456 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2018-06-04 11:03:03 +00:00
parent 9ce59d21d5
commit 38001d24d7
9 changed files with 31 additions and 53 deletions

View File

@@ -1151,9 +1151,6 @@ function TsExpressionScanner.DoIdentifier: TsTokenType;
var
C: Char;
S: String;
row, row2: Cardinal;
col, col2: Cardinal;
flags: TsRelFlags;
begin
C := CurrentChar;
while (not IsWordDelim(C)) and (C <> cNULL) do
@@ -2055,8 +2052,8 @@ procedure TsExpressionParser.SetRPNFormula(const AFormula: TsRPNFormula);
right: TsExprNode = nil;
operand: TsExprNode = nil;
fek: TFEKind;
r,c, r2,c2: Cardinal;
idx, idx2: Integer;
r,c: Cardinal;
idx: Integer;
flags: TsRelFlags;
ID: TsExprIdentifierDef;
i, n: Integer;
@@ -2838,7 +2835,8 @@ end;
procedure TsBinaryOperationExprNode.IterateNodes(AProc: TsExprNodeProc;
AData1, AData2: Pointer; var MustRebuildFormulas: Boolean);
var
rebuildLeft, rebuildRight: Boolean;
rebuildLeft: Boolean = false;
rebuildRight: Boolean = false;
begin
FLeft.IterateNodes(AProc, AData1, AData2, rebuildLeft);
FRight.IterateNodes(AProc, AData1, AData2, rebuildRight);
@@ -4220,11 +4218,9 @@ end;
procedure TsCellRangeExprNode.GetNodeValue(out AResult: TsExpressionResult);
var
r, c, s: Array[TsCellRangeIndex] of Integer;
rr, cc, ss: Integer;
r, c, s: Array[TsCellRangeIndex] of Cardinal;
ss: Integer;
i: TsCellRangeIndex;
cell: PCell;
book: TsWorkbook;
sheet: TsWorksheet;
formula: PsFormula;
begin

View File

@@ -7595,7 +7595,6 @@ var
lStyle: String = '';
formula: PsFormula;
formulaStr: String;
parser: TsExpressionParser;
valuetype: String;
value: string;
valueStr: String;

View File

@@ -1207,7 +1207,6 @@ procedure TsWorksheet.CalcFormula(AFormula: PsFormula);
var
lCell, lCellRef: PCell;
parser: TsExpressionParser = nil;
has3DLink: Boolean;
res: TsExpressionResult;
p: Integer;
link, txt: String;
@@ -1223,7 +1222,6 @@ begin
parser := TsSpreadsheetParser.Create(self);
try
parser.Expression := AFormula^.Text;
has3DLink := parser.Contains3DRef;
AFormula^.Parser := parser;
except
on E:ECalcEngine do begin
@@ -5849,7 +5847,6 @@ end;
procedure TsWorksheet.WriteRPNFormula(ACell: PCell; ARPNFormula: TsRPNFormula);
var
formula: PsFormula;
parser: TsSpreadsheetParser;
begin
if ACell = nil then
exit;
@@ -5863,11 +5860,7 @@ begin
formula^.Text := formula^.Parser.Expression;
UseFormulaInCell(ACell, formula);
ACell^.ContentType := cctFormula;
(*
formuila.Parsed := TsSpreadsheetParser.
ACell^.ContentType := cctFormula;
ACell^.FormulaValue := ConvertRPNFormulaToStringFormula(AFormula);
*)
ChangedCell(ACell^.Row, ACell^.Col);
end;
@@ -7384,7 +7377,6 @@ var
row: PRow;
col: PCol;
i: Integer;
r: Cardinal;
formula: PsFormula;
sheet: TsWorksheet;
begin
@@ -7423,7 +7415,7 @@ begin
begin
for i:= FRows.Count-1 downto 0 do begin
row := PRow(FRows.Items[i]);
if row^.Row > AIndex then
if Integer(row^.Row) > AIndex then
dec(row^.Row)
else
break;
@@ -7436,7 +7428,7 @@ begin
// Update column index of col records
for i:=FCols.Count-1 downto 0 do begin
col := PCol(FCols.Items[i]);
if col^.Col > AIndex then
if Integer(col^.Col) > AIndex then
dec(col^.Col)
else
break;
@@ -7514,14 +7506,14 @@ begin
// Update row index of row records
for i:=0 to FRows.Count-1 do begin
row := PRow(FRows.Items[i]);
if row^.Row >= AIndex then inc(row^.Row);
if Integer(row^.Row) >= AIndex then inc(row^.Row);
end;
end else
begin
// Update column index of column records
for i:=0 to FCols.Count-1 do begin
col := PCol(FCols.Items[i]);
if col^.Col >= AIndex then inc(col^.Col);
if Integer(col^.Col) >= AIndex then inc(col^.Col);
end;
end;
@@ -7534,7 +7526,7 @@ begin
for rng in FMergedCells do
begin
// The new row is ABOVE the merged block --> Shift entire range down by 1 row
if (AIndex < rng^.Row1) then
if (AIndex < Integer(rng^.Row1)) then
begin
// The formerly first row is no longer merged --> un-tag its cells
for cell in Cells.GetRowEnumerator(rng^.Row1, rng^.Col1, rng^.Col2) do
@@ -7551,7 +7543,7 @@ begin
end else
// The new row goes through this cell block --> Shift only the bottom row
// of the range down by 1
if (AIndex >= rng^.Row1) and (AIndex <= rng^.Row2) then
if (AIndex >= Integer(rng^.Row1)) and (AIndex <= Integer(rng^.Row2)) then
MergeCells(rng^.Row1, rng^.Col1, rng^.Row2+1, rng^.Col2);
end;
@@ -7563,7 +7555,7 @@ begin
begin
// The new column is at the LEFT of the merged block
// --> Shift entire range to the right by 1 column
if (AIndex < rng^.Col1) then
if (AIndex < Integer(rng^.Col1)) then
begin
// The former first column is no longer merged --> un-tag its cells
for cell in Cells.GetColEnumerator(rng^.Col1, rng^.Row1, rng^.Row2) do
@@ -7580,7 +7572,7 @@ begin
end else
// The new column goes through this cell block --> Shift only the right
// column of the range to the right by 1
if (AIndex >= rng^.Col1) and (AIndex <= rng^.Col2) then
if (AIndex >= Integer(rng^.Col1)) and (AIndex <= Integer(rng^.Col2)) then
MergeCells(rng^.Row1, rng^.Col1, rng^.Row2, rng^.Col2+1);
end;
@@ -9674,6 +9666,8 @@ end;
function TsWorkbook.FixFormula(AFormula: PsFormula;
ACorrection: TsFormulaCorrection; AData: Pointer; AParam: PtrInt): Boolean;
begin
Unused(AParam); // Maybe later...
Result := false;
case ACorrection of
fcWorksheetRenamed:

View File

@@ -1251,7 +1251,7 @@ end;
function GetCellRangeString_ODS(ARange: TsCellRange;
AFlags: TsRelFlags = rfAllRel; Compact: Boolean = false): String;
begin
Result := GetCellRangeString_ODS(ARange, AFlags, true);
Result := GetCellRangeString_ODS(ARange, AFlags, Compact);
end;

View File

@@ -656,7 +656,6 @@ var
idx: Int16;
s: String;
sheetList: TsBIFFExternSheetList;
sheet: TsWorksheet;
extsheet: TsBIFFExternSheet;
begin
ADocumentURL := '';

View File

@@ -214,7 +214,7 @@ type
procedure WriteComments(AStream: TStream; AWorksheet: TsBasicWorksheet);
procedure WriteDefinedName(AStream: TStream; AWorksheet: TsBasicWorksheet;
const AName: String; AIndexToREF, ASheetIndex: Word;
AKind: TsBIFFExternKind);
AKind: TsBIFFExternKind); reintroduce;
procedure WriteDefinedNames(AStream: TStream);
procedure WriteDimensions(AStream: TStream; AWorksheet: TsBasicWorksheet);
procedure WriteEOF(AStream: TStream);
@@ -777,26 +777,16 @@ begin
end;
destructor TsSpreadBIFF8Reader.Destroy;
var
j: Integer;
begin
{ Destroy linked data }
SetLength(FBiff8ExternSheetArray, 0);
FBiff8ExternBooks.Free;
{ Destroy shared string table }
if Assigned(FSharedStringTable) then
{
begin
for j := FSharedStringTable.Count-1 downto 0 do
if FSharedStringTable.Objects[j] <> nil then
FSharedStringTable.Objects[j].Free;
}
FSharedStringTable.Free;
//end;
FSharedStringTable.Free;
if Assigned(FCommentList) then
FCommentList.Free;
{ Destroy comment list }
FCommentList.Free;
inherited;
end;
@@ -1693,8 +1683,6 @@ var
LString: String;
ContinueIndicator: WORD;
rtParams: TsRichTextParams;
p: Pointer;
n: Integer;
ms: TMemoryStream;
begin
//Reads the shared string table, only compatible with BIFF8
@@ -4266,7 +4254,7 @@ procedure TsSpreadBIFF8Writer.WriteSST(AStream: TStream);
var
sizePos: Int64;
bytesWritten, totalBytesWritten: Integer;
i, j, n: Integer;
i, j: Integer;
rtParams: TsRichTextParams;
bytesAvail: Integer;
isASCII: Boolean;

View File

@@ -2871,7 +2871,6 @@ function TsSpreadBIFFReader.ReadRPNTokenArray(AStream: TStream;
var
n: Word;
rpnFormula: TsRPNformula;
strFormula: String;
formula: PsFormula;
begin
n := ReadRPNTokenArraySize(AStream);
@@ -4017,7 +4016,7 @@ procedure TsSpreadBIFFWriter.WriteDefinedName(AStream: TStream;
AIndexToREF, ASheetIndex: Word; AKind: TsBIFFExternKind);
begin
Unused(AStream, AWorksheet);
Unused(Aname, AIndexToREF);
Unused(AName, AIndexToREF, ASheetIndex);
Unused(AKind);
// Override
end;
@@ -4992,6 +4991,8 @@ end;
function TsSpreadBIFFWriter.WriteRPNSheetIndex(AStream: TStream;
ADocumentURL: String; ASheet1, ASheet2: Integer): Word;
begin
Unused(AStream, ADocumentURL);
Unused(ASheet1, ASheet2);
Result := $FFFF; // --> not supported by default.
end;

View File

@@ -745,7 +745,6 @@ begin
else
// "Normal" formula
sheet.WriteFormula(cell, formulaStr);
// cell^.FormulaValue := formulaStr;
except
on E:EExprParser do begin
FWorkbook.AddErrorMsg(E.Message);

View File

@@ -1268,7 +1268,6 @@ end;
constructor TsCustomWorksheetGrid.Create(AOwner: TComponent);
begin
inc(FRowHeightLock);
// DoubleBuffered := true;
FInternalWorkbookSource := TsWorkbookSource.Create(self);
FInternalWorkbookSource.Name := 'internal';
@@ -3943,11 +3942,14 @@ begin
end;
function TsCustomWorksheetGrid.GetDefaultColumnTitle(Column: Integer): string;
var
s: String = '';
begin
if Assigned(FGetColHeaderText) then
FGetColHeaderText(Self, Column, Result)
FGetColHeaderText(Self, Column, s)
else
Result := GetColString(Column - FHeaderCount);
s := GetColString(Column - FHeaderCount);
Result := s;
end;