fpspreadsheet: Rename TsWorksheet.IsHyperlink to .HasHyperlink to be consistent with .HasComment

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3973 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2015-03-01 11:40:04 +00:00
parent 0b7b50f476
commit aca6971fe2
3 changed files with 30 additions and 32 deletions

View File

@ -769,26 +769,24 @@ var
begin
Result := false;
if FWorksheet.IsHyperlink(ACell) then
FWorksheet.WriteFont(ACell, HYPERLINK_FONTINDEX)
else
if FWorksheet.HasHyperlink(ACell) then
FWorksheet.WriteFont(ACell, HYPERLINK_FONTINDEX);
// Is there a style attached to the cell?
styleIndex := -1;
if AStyleName <> '' then
styleIndex := FCellFormatList.FindIndexOfName(AStyleName);
if (styleIndex = -1) then
begin
// Is there a style attached to the cell?
styleIndex := -1;
if AStyleName <> '' then
styleIndex := FCellFormatList.FindIndexOfName(AStyleName);
if (styleIndex = -1) then
begin
// No - look for the style attached to the column of the cell and
// find the cell style by the DefaultCellStyleIndex stored in the column list.
i := FindColumnByCol(ACell^.Col);
if i = -1 then
exit;
styleIndex := TColumnData(FColumnList[i]).DefaultCellStyleIndex;
end;
fmt := FCellFormatList.Items[styleIndex];
ACell^.FormatIndex := FWorkbook.AddCellFormat(fmt^);
// No - look for the style attached to the column of the cell and
// find the cell style by the DefaultCellStyleIndex stored in the column list.
i := FindColumnByCol(ACell^.Col);
if i = -1 then
exit;
styleIndex := TColumnData(FColumnList[i]).DefaultCellStyleIndex;
end;
fmt := FCellFormatList.Items[styleIndex];
ACell^.FormatIndex := FWorkbook.AddCellFormat(fmt^);
Result := true;
end;
@ -3470,7 +3468,7 @@ begin
Unused(ARow, ACol);
// Hyperlink
if FWorksheet.IsHyperlink(ACell) then
if FWorksheet.HasHyperlink(ACell) then
FWorkbook.AddErrorMsg(rsODSHyperlinksOfTextCellsOnly, [GetCellString(ARow, ACol)]);
// Comment
@ -3550,7 +3548,7 @@ begin
end;
// Hyperlink
if FWorksheet.IsHyperlink(ACell) then
if FWorksheet.HasHyperlink(ACell) then
FWorkbook.AddErrorMsg(rsODSHyperlinksOfTextCellsOnly, [GetCellString(ARow, ACol)]);
AppendToStream(AStream, Format(
@ -4051,7 +4049,7 @@ begin
spannedStr := '';
// Hyperlink
if FWorksheet.IsHyperlink(ACell) then
if FWorksheet.HasHyperlink(ACell) then
FWorkbook.AddErrorMsg(rsODSHyperlinksOfTextCellsOnly, [GetCellString(ARow, ACol)]);
// Convert string formula to the format needed by ods: semicolon list separators!
@ -4186,7 +4184,7 @@ begin
GetCellString(ARow, ACol)
]);
if FWorksheet.IsHyperlink(ACell) then
if FWorksheet.HasHyperlink(ACell) then
begin
hyperlink := FWorksheet.FindHyperlink(ACell);
target := hyperlink^.Target;
@ -4269,7 +4267,7 @@ begin
end;
// Hyperlink
if FWorksheet.IsHyperlink(ACell) then
if FWorksheet.HasHyperlink(ACell) then
FWorkbook.AddErrorMsg(rsODSHyperlinksOfTextCellsOnly, [GetCellString(ARow, ACol)]);
AppendToStream(AStream, Format(
@ -4325,7 +4323,7 @@ begin
comment := WriteCommentXMLAsString(FWorksheet.ReadComment(ACell));
// Hyperlink
if FWorksheet.IsHyperlink(ACell) then
if FWorksheet.HasHyperlink(ACell) then
FWorkbook.AddErrorMsg(rsODSHyperlinksOfTextCellsOnly, [GetCellString(ARow, ACol)]);
// nfTimeInterval is a special case - let's handle it first:

View File

@ -484,7 +484,7 @@ type
// Hyperlinks
function FindHyperlink(ARow, ACol: Cardinal): PsHyperlink; overload;
function FindHyperlink(ACell: PCell): PsHyperlink; overload;
function IsHyperlink(ACell: PCell): Boolean;
function HasHyperlink(ACell: PCell): Boolean;
function ReadHyperlink(ARow, ACol: Cardinal): TsHyperlink; overload;
function ReadHyperlink(ACell: PCell): TsHyperlink;
procedure RemoveHyperlink(ACell: PCell);
@ -1613,7 +1613,7 @@ var
AVLNode: TAVLTreeNode;
begin
Result := nil;
if not IsHyperlink(ACell) or (FHyperlinks.Count = 0) then
if not HasHyperlink(ACell) or (FHyperlinks.Count = 0) then
exit;
hyperlink.Row := ACell^.Row;
@ -1626,7 +1626,7 @@ end;
{@@ ----------------------------------------------------------------------------
Checks whether the specified cell contains a hyperlink
-------------------------------------------------------------------------------}
function TsWorksheet.IsHyperlink(ACell: PCell): Boolean;
function TsWorksheet.HasHyperlink(ACell: PCell): Boolean;
begin
Result := (ACell <> nil) and (cfHyperlink in ACell^.Flags);
end;
@ -1677,7 +1677,7 @@ var
hyperlink: TsHyperlink;
AVLNode: TAvlTreeNode;
begin
if not IsHyperlink(ACell) then
if not HasHyperlink(ACell) then
exit;
hyperlink.Row := ACell^.Row;
@ -2850,7 +2850,7 @@ begin
end;
else
Result := '';
if IsHyperlink(ACell) then
if HasHyperlink(ACell) then
begin
hyperlink := FindHyperlink(ACell);
if hyperlink <> nil then Result := hyperlink^.Target;

View File

@ -1410,7 +1410,7 @@ begin
end;
// Font
if Worksheet.IsHyperlink(lCell) then
if Worksheet.HasHyperlink(lCell) then
fnt := Workbook.GetHyperlinkFont
else
fnt := Workbook.GetDefaultFont;
@ -2653,7 +2653,7 @@ begin
// Read comment
comment := Worksheet.ReadComment(cell);
// Read hyperlink info
if Worksheet.IsHyperlink(cell) then begin
if Worksheet.HasHyperlink(cell) then begin
hyperlink := Worksheet.FindHyperlink(cell);
if hyperlink <> nil then
begin
@ -3459,7 +3459,7 @@ begin
cell := Worksheet.FindCell(r, c);
if Worksheet.IsMerged(cell) then
cell := Worksheet.FindMergeBase(cell);
if Worksheet.IsHyperlink(cell) then
if Worksheet.HasHyperlink(cell) then
begin
FHyperlinkCell := cell;
FHyperlinkTimer.Enabled := true;