fpspreadsheet: Initial implementation of html font reader (so far, uses only "style" attribute of "td" node)

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4254 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2015-08-05 18:51:32 +00:00
parent 2241febbd4
commit 8ad3ef69c7
3 changed files with 135 additions and 296 deletions

View File

@@ -131,6 +131,8 @@ function TintedColor(AColor: TsColor; tint: Double): TsColor;
function AnalyzeCompareStr(AString: String; out ACompareOp: TsCompareOperation): String;
function UnquoteStr(AString: String): String;
function InitSortParams(ASortByCols: Boolean = true; ANumSortKeys: Integer = 1;
ASortPriority: TsSortPriority = spNumAlpha): TsSortParams;
@@ -1467,6 +1469,8 @@ end;
compatible with the TColor data type of the graphics unit.
-------------------------------------------------------------------------------}
function HTMLColorStrToColor(AValue: String): TsColor;
var
c: Integer;
begin
if AValue = '' then
Result := scNotDefined
@@ -1474,10 +1478,6 @@ begin
if AValue[1] = '#' then begin
AValue[1] := '$';
Result := LongRGBToExcelPhysical(DWord(StrToInt(AValue)));
end else
if AValue[1] in ['0'..'9','A'..'F', 'a'..'f'] then begin
AValue := '$' + AValue;
Result := LongRGBToExcelPhysical(DWord(StrToInt(AValue)));
end else begin
AValue := lowercase(AValue);
if AValue = 'red' then
@@ -1505,7 +1505,11 @@ begin
else if AValue = 'green' then
Result := $008000
else if AValue = 'olive' then
Result := $008080;
Result := $008080
else if TryStrToInt('$' + AValue, c) then
Result := LongRGBToExcelPhysical(DWord(StrToInt('$' + AValue)))
else
Result := scNotDefined
end;
end;
@@ -1661,6 +1665,21 @@ begin
RemoveChars(0, coEqual);
end;
{@@ ----------------------------------------------------------------------------
Removes quotation characters which enclose a string
-------------------------------------------------------------------------------}
function UnquoteStr(AString: String): String;
begin
Result := AString;
if Result = '' then exit;
if ((Result[1] = '''') and (Result[Length(Result)] = '''')) or
(Result[1] = '"') and (Result[Length(Result)] = '"') then
begin
Delete(Result, 1, 1);
Delete(Result, Length(Result), 1);
end;
end;
{@@ ----------------------------------------------------------------------------
Initializes a Sortparams record. This record sets paramaters used when cells
are sorted.