fpspreadsheet: Fix incorrect detection of cell ranges in ods files.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4374 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2015-10-09 14:47:37 +00:00
parent 48c33e0c1c
commit b873069b54

View File

@ -700,6 +700,7 @@ type
procedure SetExpression(const AValue: String); procedure SetExpression(const AValue: String);
procedure SetLocalizedExpression(const AFormatSettings: TFormatSettings; procedure SetLocalizedExpression(const AFormatSettings: TFormatSettings;
const AValue: String); virtual; const AValue: String); virtual;
procedure CheckResultType(const Res: TsExpressionResult; procedure CheckResultType(const Res: TsExpressionResult;
AType: TsResultType); inline; AType: TsResultType); inline;
function CurrentToken: String; function CurrentToken: String;
@ -1070,34 +1071,38 @@ end;
function TsExpressionScanner.DoSquareBracket: TsTokenType; function TsExpressionScanner.DoSquareBracket: TsTokenType;
var var
C: Char; C: Char;
p: Integer;
r1,c1,r2,c2: Cardinal; r1,c1,r2,c2: Cardinal;
flags: TsRelFlags; flags: TsRelFlags;
isRange: Boolean;
begin begin
isRange := false;
FToken := ''; FToken := '';
C := NextPos; C := NextPos;
while (C <> ']') do while (C <> ']') do
begin begin
if C = cNull then case C of
ScanError(SErrUnexpectedEndOfExpression); cNull: ScanError(SErrUnexpectedEndOfExpression);
FToken := FToken + C; '.' : ; // ignore
':' : begin isRange := true; FToken := FToken + C; end;
else FToken := FToken + C;
end;
C := NextPos; C := NextPos;
end; end;
C := NextPos; C := NextPos;
p := system.pos('.', FToken); // Delete up tp "." (--> to be considered later!) if isRange then
if p <> 0 then Delete(FToken, 1, p);
if system.pos(':', FToken) > 0 then
begin begin
if ParseCellRangeString(FToken, r1, c1, r2, c2, flags) then if ParseCellRangeString(FToken, r1, c1, r2, c2, flags) then
Result := ttCellRange Result := ttCellRange
else else
ScanError(Format(SErrInvalidCellRange, [FToken])); ScanError(Format(SErrInvalidCellRange, [FToken]));
end else end else
begin
if ParseCellString(FToken, r1, c1, flags) then if ParseCellString(FToken, r1, c1, flags) then
Result := ttCell Result := ttCell
else else
ScanError(Format(SErrInvalidCell, [FToken])); ScanError(Format(SErrInvalidCell, [FToken]));
end; end;
end;
function TsExpressionScanner.DoString: TsTokenType; function TsExpressionScanner.DoString: TsTokenType;