From a70231ab750986e7cc16b4b60016a3e8eb2d4c90 Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Sun, 11 Mar 2018 21:06:49 +0000 Subject: [PATCH] fpspreadsheet: Make sure that the local variable commentcell_rct in TxCustomWorksheetGrid.InternalDrawRow is initialized (issue #33413, patch by Lagunov Aleksey). git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6234 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- components/fpspreadsheet/source/common/fpstypes.pas | 3 +++ .../source/visual/fpspreadsheetgrid.pas | 12 +++--------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/components/fpspreadsheet/source/common/fpstypes.pas b/components/fpspreadsheet/source/common/fpstypes.pas index bfb9d3380..b9446ce4e 100644 --- a/components/fpspreadsheet/source/common/fpstypes.pas +++ b/components/fpspreadsheet/source/common/fpstypes.pas @@ -531,6 +531,9 @@ const (LineStyle: lsThin; Color: scBlack) ); + {@@ Border style to be used for "no border"} + NO_CELL_BORDER: TsCellBorderStyle = (LineStyle: lsThin; Color: scNotDefined); + type {@@ Style of fill pattern for cell backgrounds } TsFillStyle = (fsNoFill, fsSolidFill, diff --git a/components/fpspreadsheet/source/visual/fpspreadsheetgrid.pas b/components/fpspreadsheet/source/visual/fpspreadsheetgrid.pas index 6ee4cae36..fb5ade7c3 100644 --- a/components/fpspreadsheet/source/visual/fpspreadsheetgrid.pas +++ b/components/fpspreadsheet/source/visual/fpspreadsheetgrid.pas @@ -800,9 +800,6 @@ type property OnContextPopup; end; -const - NO_CELL_BORDER: TsCellBorderStyle = (LineStyle: lsThin; Color: scNotDefined); - var {@@ Default number of columns prepared for a new empty worksheet } DEFAULT_COL_COUNT: Integer = 26; @@ -4424,6 +4421,7 @@ begin while (gc <= gcLast) do begin gr := ARow; rct := AClipRect; + commentcell_rct := Rect(0, 0, 0, 0); // FDrawingCell is the cell which is currently being painted. We store // it to avoid excessive calls to "FindCell". FDrawingCell := nil; @@ -4436,9 +4434,7 @@ begin // single cell FDrawingCell := cell; if Worksheet.HasComment(cell) then - commentcell_rct := CellRect(gc, gr) - else - commentcell_rct := Rect(0,0,0,0); + commentcell_rct := CellRect(gc, gr); // Special treatment of overflowing cells if FTextOverflow then begin @@ -4495,9 +4491,7 @@ begin begin gr := GetGridRow(sr1); if Worksheet.HasComment(FDrawingCell) then - commentcell_rct := CellRect(GetGridCol(sc2), gr) - else - commentcell_rct := Rect(0,0,0,0); + commentcell_rct := CellRect(GetGridCol(sc2), gr); ColRowToOffSet(False, True, gr, rct.Top, tmp); ColRowToOffSet(False, True, gr + integer(sr2) - integer(sr1), tmp, rct.Bottom); gc := GetGridCol(sc1);