From 10a21f6ba9cedd1ce25adca21406760429eb8cd5 Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Sat, 27 Jul 2019 20:42:54 +0000 Subject: [PATCH] fpspreadsheet: Add WorksheetGrid methods Show|HideRow|Col. git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7080 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- .../source/visual/fpspreadsheetgrid.pas | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) diff --git a/components/fpspreadsheet/source/visual/fpspreadsheetgrid.pas b/components/fpspreadsheet/source/visual/fpspreadsheetgrid.pas index 9837564fb..82a7e118b 100644 --- a/components/fpspreadsheet/source/visual/fpspreadsheetgrid.pas +++ b/components/fpspreadsheet/source/visual/fpspreadsheetgrid.pas @@ -448,6 +448,11 @@ type const ALeftOuterStyle, ATopOuterStyle, ARightOuterStyle, ABottomOuterStyle, AHorInnerStyle, AVertInnerStyle: TsCellBorderStyle); + procedure ShowCol(ACol: Integer); + procedure HideCol(ACol: Integer); + procedure ShowRow(ARow: Integer); + procedure HideRow(ARow: Integer); + procedure Sort(AColSorting: Boolean; AIndex, AIndxFrom, AIndxTo:Integer); override; { Row height / col width calculation } @@ -5608,6 +5613,66 @@ begin ProcessBorder(r, c, cbEast, AVertInnerStyle); end; +{@@ ---------------------------------------------------------------------------- + Shows the column with the specified index previously hidden. +-------------------------------------------------------------------------------} +procedure TsCustomWorksheetGrid.ShowCol(ACol: Integer); +var + c: Cardinal; +begin + c := GetWorksheetCol(ACol); + if Worksheet.ColHidden(c) then begin + Worksheet.ShowCol(c); + UpdateColWidth(ACol); + InvalidateGrid; + end; +end; + +{@@ ---------------------------------------------------------------------------- + Hides the column with the specifed index +-------------------------------------------------------------------------------} +procedure TsCustomWorksheetGrid.HideCol(ACol: Integer); +var + c: Cardinal; +begin + c := GetWorksheetCol(ACol); + if not Worksheet.ColHidden(c) then begin + Worksheet.HideCol(c); + UpdateColWidth(ACol); + InvalidateGrid; + end; +end; + +{@@----------------------------------------------------------------------------- + Shows the row with the specified index previously hidden +-------------------------------------------------------------------------------} +procedure TsCustomWorksheetGrid.ShowRow(ARow: Integer); +var + r: Cardinal; +begin + r := GetWorksheetRow(ARow); + if Worksheet.RowHidden(r) then begin + Worksheet.ShowRow(r); + UpdateRowHeight(ARow); + InvalidateGrid; + end; +end; + +{@@ ---------------------------------------------------------------------------- + Hides the row with the specifed index +-------------------------------------------------------------------------------} +procedure TsCustomWorksheetGrid.HideRow(ARow: Integer); +var + r: Cardinal; +begin + r := GetWorksheetRow(ARow); + if not Worksheet.RowHidden(r) then begin + Worksheet.HideRow(r); + UpdateRowHeight(ARow); + InvalidateGrid; + end; +end; + {@@ ---------------------------------------------------------------------------- Sorts the grid by calling the corresponding method of the worksheet. Sorting extends across the entire worksheet.