fpspreadsheet: Less hints

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4051 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2015-03-18 20:19:41 +00:00
parent e165ffb180
commit fea54220d3
2 changed files with 16 additions and 17 deletions

View File

@ -24,20 +24,20 @@ type
protected protected
FCurrentNode: TAVLTreeNode; FCurrentNode: TAVLTreeNode;
FTree: TsRowColAVLTree; FTree: TsRowColAVLTree;
FStartRow, FEndRow, FStartCol, FEndCol: Cardinal; FStartRow, FEndRow, FStartCol, FEndCol: LongInt;
FDone: Boolean; FDone: Boolean;
FReverse: Boolean; FReverse: Boolean;
function GetCurrent: PsRowCol; function GetCurrent: PsRowCol;
public public
constructor Create(ATree: TsRowColAVLTree; constructor Create(ATree: TsRowColAVLTree;
AStartRow, AStartCol, AEndRow, AEndCol: Cardinal; AReverse: Boolean); AStartRow, AStartCol, AEndRow, AEndCol: LongInt; AReverse: Boolean);
function GetEnumerator: TsRowColEnumerator; inline; function GetEnumerator: TsRowColEnumerator; inline;
function MoveNext: Boolean; function MoveNext: Boolean;
property Current: PsRowCol read GetCurrent; property Current: PsRowCol read GetCurrent;
property StartRow: Cardinal read FStartRow; property StartRow: LongInt read FStartRow;
property EndRow: Cardinal read FEndRow; property EndRow: LongInt read FEndRow;
property StartCol: Cardinal read FStartCol; property StartCol: LongInt read FStartCol;
property EndCol: Cardinal read FEndCol; property EndCol: LongInt read FEndCol;
end; end;
{ TsRowColAVLTree } { TsRowColAVLTree }
@ -197,7 +197,7 @@ end;
{******************************************************************************} {******************************************************************************}
constructor TsRowColEnumerator.Create(ATree: TsRowColAVLTree; constructor TsRowColEnumerator.Create(ATree: TsRowColAVLTree;
AStartRow, AStartCol, AEndRow, AEndCol: Cardinal; AReverse: Boolean); AStartRow, AStartCol, AEndRow, AEndCol: LongInt; AReverse: Boolean);
var var
node: TAVLTreeNode; node: TAVLTreeNode;
begin begin
@ -224,7 +224,8 @@ begin
if FEndRow = $7FFFFFFF then if FEndRow = $7FFFFFFF then
begin begin
node := FTree.FindHighest; node := FTree.FindHighest;
FEndRow := PsRowCol(node.Data)^.Row; if node <> nil then
FEndRow := PsRowCol(node.Data)^.Row;
end; end;
end; end;

View File

@ -1601,9 +1601,8 @@ end;
procedure TsWorksheet.WriteHyperlink(ACell: PCell; ATarget: String; procedure TsWorksheet.WriteHyperlink(ACell: PCell; ATarget: String;
ATooltip: String = ''); ATooltip: String = '');
var var
hyperlink: PsHyperlink;
fmt: TsCellFormat; fmt: TsCellFormat;
target, bm, fn, displayTxt: String; target, bm, displayTxt: String;
begin begin
if ACell = nil then if ACell = nil then
exit; exit;
@ -1613,20 +1612,19 @@ begin
exit; exit;
end; end;
hyperlink := FHyperlinks.AddHyperlink(ACell^.Row, ACell^.Col, ATarget, ATooltip); FHyperlinks.AddHyperlink(ACell^.Row, ACell^.Col, ATarget, ATooltip);
Include(ACell^.Flags, cfHyperlink); Include(ACell^.Flags, cfHyperlink);
if ACell^.ContentType = cctEmpty then if ACell^.ContentType = cctEmpty then
begin begin
SplitHyperlink(ATarget, target, bm); SplitHyperlink(ATarget, target, bm);
displayTxt := ATarget; if pos('file:', lowercase(ATarget))=1 then
if pos('file:', lowercase(displayTxt))=1 then
begin begin
URIToFilename(displayTxt, displayTxt); URIToFilename(target, displayTxt);
// Delete(displayTxt, 1, Length('file:///'));
ForcePathDelims(displayTxt); ForcePathDelims(displayTxt);
if bm <> '' then displayTxt := fn + '#' + bm; if bm <> '' then displayTxt := displayTxt + '#' + bm;
end; end else
displayTxt := ATarget;
ACell^.ContentType := cctUTF8String; ACell^.ContentType := cctUTF8String;
ACell^.UTF8StringValue := displayTxt; ACell^.UTF8StringValue := displayTxt;
end; end;