fpspreadsheet: Fix hyperlinks unit test case

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4100 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2015-04-27 09:59:59 +00:00
parent de39db4c01
commit dc8ad5acde
2 changed files with 24 additions and 6 deletions

View File

@ -51,6 +51,7 @@ function IsDateFormat(ANumFormat: TsNumFormatParams): Boolean;
function IsTimeFormat(AFormat: TsNumberFormat): Boolean; overload;
function IsTimeFormat(AFormatStr: String): Boolean; overload;
function IsTimeFormat(ANumFormat: TsNumFormatParams): Boolean; overload;
function IsLongTimeFormat(AFormatStr: String; ATimeSeparator: char): Boolean; overload;
function IsTimeIntervalFormat(ANumFormat: TsNumFormatParams): Boolean;
@ -186,6 +187,20 @@ begin
(ANumFormat.Sections[0].Kind * [nfkTime] <> []);
end;
{@@ ----------------------------------------------------------------------------
Returns TRUE if the specified format string represents a long time format, i.e.
it contains two TimeSeparators.
-------------------------------------------------------------------------------}
function IsLongTimeFormat(AFormatStr: String; ATimeSeparator: Char): Boolean;
var
i, n: Integer;
begin
n := 0;
for i:=1 to Length(AFormatStr) do
if AFormatStr[i] = ATimeSeparator then inc(n);
Result := (n=2);
end;
{@@ ----------------------------------------------------------------------------
Checks whether the specified number format parameters is a time interval
format.

View File

@ -4017,15 +4017,18 @@ begin
if TryStrToDateTime(AValue, number, FWorkbook.FormatSettings) then
begin
if number < 1.0 then begin // this is a time alone
if not IsTimeFormat(numFmtParams) then begin
if SecondOf(number) = 0 then
WriteDateTime(ACell, number, nfShortTime)
if number < 1.0 then // this is a time alone
begin
if not IsTimeFormat(numFmtParams) then
begin
if IsLongTimeFormat(AValue, FWorkbook.FormatSettings.TimeSeparator) then
WriteDateTime(ACell, number, nfLongTime)
else
WriteDateTime(ACell, number, nfLongTime);
WriteDateTime(ACell, number, nfShortTime);
end;
end else
if frac(number) = 0.0 then begin // this is a date alone
if frac(number) = 0.0 then // this is a date alone
begin
if not IsDateFormat(numFmtParams) then
WriteDateTime(ACell, number, nfShortDate);
end else