fpspreadsheet: Add missing cell record helper for "BorderStyles"

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3902 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2015-01-25 23:30:15 +00:00
parent 48db5117f5
commit e3a0d4a858
2 changed files with 34 additions and 0 deletions

View File

@ -14,6 +14,7 @@ type
function GetBackgroundColor: TsColor; function GetBackgroundColor: TsColor;
function GetBorder: TsCellBorders; function GetBorder: TsCellBorders;
function GetBorderStyle(const ABorder: TsCellBorder): TsCellBorderStyle; function GetBorderStyle(const ABorder: TsCellBorder): TsCellBorderStyle;
function GetBorderStyles: TsCellBorderStyles;
function GetCellFormat: TsCellFormat; function GetCellFormat: TsCellFormat;
function GetFont: TsFont; function GetFont: TsFont;
function GetFontIndex: integer; function GetFontIndex: integer;
@ -27,6 +28,7 @@ type
procedure SetBackgroundColor(const AValue: TsColor); procedure SetBackgroundColor(const AValue: TsColor);
procedure SetBorder(const AValue: TsCellBorders); procedure SetBorder(const AValue: TsCellBorders);
procedure SetBorderStyle(const ABorder: TsCellBorder; const AValue: TsCellBorderStyle); procedure SetBorderStyle(const ABorder: TsCellBorder; const AValue: TsCellBorderStyle);
procedure SetBorderStyles(const AValue: TsCellBorderStyles);
procedure SetCellFormat(const AValue: TsCellFormat); procedure SetCellFormat(const AValue: TsCellFormat);
procedure SetFontIndex(const AValue: Integer); procedure SetFontIndex(const AValue: Integer);
procedure SetHorAlignment(const AValue: TsHorAlignment); procedure SetHorAlignment(const AValue: TsHorAlignment);
@ -44,6 +46,10 @@ type
read GetBackgroundColor write SetBackgroundColor; read GetBackgroundColor write SetBackgroundColor;
property Border: TsCellBorders property Border: TsCellBorders
read GetBorder write SetBorder; read GetBorder write SetBorder;
property BorderStyle[ABorder: TsCellBorder]: TsCellBorderStyle
read GetBorderStyle write SetBorderStyle;
property BorderStyles: TsCellBorderStyles
read GetBorderStyles write SetBorderStyles;
property CellFormat: TsCellFormat property CellFormat: TsCellFormat
read GetCellFormat write SetCellFormat; read GetCellFormat write SetCellFormat;
property Font: TsFont read GetFont; property Font: TsFont read GetFont;
@ -83,6 +89,11 @@ begin
Result := Worksheet.ReadCellBorderStyle(@self, ABorder); Result := Worksheet.ReadCellBorderStyle(@self, ABorder);
end; end;
function TCellHelper.GetBorderStyles: TsCellBorderStyles;
begin
Result := Worksheet.ReadCellBorderStyles(@self);
end;
function TCellHelper.GetCellFormat: TsCellFormat; function TCellHelper.GetCellFormat: TsCellFormat;
begin begin
Result := Workbook.GetCellFormat(FormatIndex); Result := Workbook.GetCellFormat(FormatIndex);
@ -163,6 +174,11 @@ begin
Worksheet.WriteBorderStyle(@self, ABorder, AValue); Worksheet.WriteBorderStyle(@self, ABorder, AValue);
end; end;
procedure TCellHelper.SetBorderStyles(const AValue: TsCellBorderStyles);
begin
Worksheet.WriteBorderStyles(@self, AValue);
end;
procedure TCellHelper.SetCellFormat(const AValue: TsCellFormat); procedure TCellHelper.SetCellFormat(const AValue: TsCellFormat);
begin begin
Worksheet.WriteCellFormat(@self, AValue); Worksheet.WriteCellFormat(@self, AValue);

View File

@ -215,6 +215,7 @@ type
function ReadBackgroundColor(ACell: PCell): TsColor; function ReadBackgroundColor(ACell: PCell): TsColor;
function ReadCellBorders(ACell: PCell): TsCellBorders; function ReadCellBorders(ACell: PCell): TsCellBorders;
function ReadCellBorderStyle(ACell: PCell; ABorder: TsCellBorder): TsCellBorderStyle; function ReadCellBorderStyle(ACell: PCell; ABorder: TsCellBorder): TsCellBorderStyle;
function ReadCellBorderStyles(ACell: PCell): TsCellBorderStyles;
function ReadCellFont(ACell: PCell): TsFont; function ReadCellFont(ACell: PCell): TsFont;
function ReadCellFormat(ACell: PCell): TsCellFormat; function ReadCellFormat(ACell: PCell): TsCellFormat;
function ReadHorAlignment(ACell: PCell): TsHorAlignment; function ReadHorAlignment(ACell: PCell): TsHorAlignment;
@ -2842,6 +2843,23 @@ begin
end; end;
end; end;
{@@ ----------------------------------------------------------------------------
Determines which all border styles of a given cell
-------------------------------------------------------------------------------}
function TsWorksheet.ReadCellBorderStyles(ACell: PCell): TsCellBorderStyles;
var
fmt: PsCellFormat;
b: TsCellBorder;
begin
Result := DEFAULT_BORDERSTYLES;
if ACell <> nil then
begin
fmt := Workbook.GetPointerToCellFormat(ACell^.FormatIndex);
for b in fmt.Border do
Result[b] := fmt^.BorderStyles[b];
end;
end;
{@@ ---------------------------------------------------------------------------- {@@ ----------------------------------------------------------------------------
Determines the font used by a specified cell. Returns the workbook's default Determines the font used by a specified cell. Returns the workbook's default
font if the cell does not exist. Considers the uffBold and uffFont formatting font if the cell does not exist. Considers the uffBold and uffFont formatting