fpspreadsheet: Undo incidental change of fpsworksheetgrid in prev commit.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6633 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2018-09-06 07:19:26 +00:00
parent 02787a6947
commit 4ca04aed77

View File

@ -1444,15 +1444,12 @@ end;
has occured at the border of a row header. Sets optimum row height. has occured at the border of a row header. Sets optimum row height.
-------------------------------------------------------------------------------} -------------------------------------------------------------------------------}
procedure TsCustomWorksheetGrid.AutoAdjustRow(ARow: Integer); procedure TsCustomWorksheetGrid.AutoAdjustRow(ARow: Integer);
var
h: Integer;
begin begin
inc(FZoomLock); inc(FZoomLock);
if Worksheet <> nil then if Worksheet <> nil then
h := CalcAutoRowHeight(ARow) RowHeights[ARow] := CalcAutoRowHeight(ARow)
else else
h := -1; RowHeights[ARow] := DefaultRowHeight;
RowHeights[ARow] := IfThen(h > -1, h, DefaultRowHeight);
HeaderSized(false, ARow); HeaderSized(false, ARow);
dec(FZoomLock); dec(FZoomLock);
end; end;
@ -1524,10 +1521,15 @@ end;
function TsCustomWorksheetGrid.CalcAutoRowHeight(ARow: Integer): Integer; function TsCustomWorksheetGrid.CalcAutoRowHeight(ARow: Integer): Integer;
var var
c: Integer; c: Integer;
h: Integer;
begin begin
Result := -1; h := 0;
for c := FHeaderCount to ColCount-1 do for c := FHeaderCount to ColCount-1 do
Result := Max(Result, GetCellHeight(c, ARow)); // Zoom factor is applied to font size h := Max(h, GetCellHeight(c, ARow)); // Zoom factor is applied to font size
if h = 0 then
Result := DefaultRowHeight // Zoom factor applied by getter function
else
Result := h;
end; end;
{@@ ---------------------------------------------------------------------------- {@@ ----------------------------------------------------------------------------
@ -1813,7 +1815,6 @@ procedure TsCustomWorksheetGrid.ChangedFontHandler(ASender: TObject;
var var
lRow: PRow; lRow: PRow;
gr: Integer; // row index in grid units gr: Integer; // row index in grid units
h: Integer;
begin begin
Unused(ASender, ACol); Unused(ASender, ACol);
if (Worksheet <> nil) then begin if (Worksheet <> nil) then begin
@ -1822,8 +1823,7 @@ begin
// There is no row record --> row height changes according to font height // There is no row record --> row height changes according to font height
// Otherwise the row height would be fixed according to the value in the row record. // Otherwise the row height would be fixed according to the value in the row record.
gr := GetGridRow(ARow); // convert row index to grid units gr := GetGridRow(ARow); // convert row index to grid units
h := CalcAutoRowHeight(gr); RowHeights[gr] := CalcAutoRowHeight(gr);
RowHeights[gr] := IfThen(h > -1, h, DefaultRowHeight);
end; end;
Invalidate; Invalidate;
end; end;
@ -3745,7 +3745,7 @@ var
txtRot: TsTextRotation; txtRot: TsTextRotation;
RTL: Boolean; RTL: Boolean;
begin begin
Result := -1; Result := 0;
if (ACol < FHeaderCount) or (ARow < FHeaderCount) then if (ACol < FHeaderCount) or (ARow < FHeaderCount) then
exit; exit;
if Worksheet = nil then if Worksheet = nil then
@ -5777,11 +5777,11 @@ begin
if (lRow <> nil) then begin if (lRow <> nil) then begin
case lRow^.RowHeightType of case lRow^.RowHeightType of
rhtCustom: rhtCustom:
if lRow^.Height > 0 then begin begin
h := round(CalcRowHeightFromSheet(lRow^.Height) * ZoomFactor); h := round(CalcRowHeightFromSheet(lRow^.Height) * ZoomFactor);
if AEnforceCalcRowHeight then begin if AEnforceCalcRowHeight then begin
h := CalcAutoRowHeight(ARow); h := CalcAutoRowHeight(ARow);
if h = -1 then begin if h = 0 then begin
h := DefaultRowHeight; h := DefaultRowHeight;
lRow^.RowHeightType := rhtDefault; lRow^.RowHeightType := rhtDefault;
end else end else
@ -5795,7 +5795,7 @@ begin
if doCalcRowHeight then begin if doCalcRowHeight then begin
// Calculate current grid row height in pixels by iterating over all cells in row // Calculate current grid row height in pixels by iterating over all cells in row
h := CalcAutoRowHeight(ARow); // ZoomFactor already applied to font heights h := CalcAutoRowHeight(ARow); // ZoomFactor already applied to font heights
if h = -1 then begin if h = 0 then begin
h := DefaultRowHeight; // Zoom factor applied by getter function h := DefaultRowHeight; // Zoom factor applied by getter function
lRow^.RowHeightType := rhtDefault; lRow^.RowHeightType := rhtDefault;
end else end else
@ -5817,10 +5817,8 @@ begin
begin begin
// Case 1: This row does contain cells // Case 1: This row does contain cells
lRow := Worksheet.AddRow(sr); lRow := Worksheet.AddRow(sr);
h := -1;
if AEnforceCalcRowHeight then if AEnforceCalcRowHeight then
h := CalcAutoRowHeight(ARow); h := CalcAutoRowHeight(ARow) else
if h = -1 then
h := DefaultRowHeight; h := DefaultRowHeight;
lRow^.Height := CalcRowHeightToSheet(round(h / ZoomFactor)); lRow^.Height := CalcRowHeightToSheet(round(h / ZoomFactor));
if h <> DefaultRowHeight then if h <> DefaultRowHeight then
@ -5832,7 +5830,7 @@ begin
h := DefaultRowHeight; // Zoom factor is applied by getter function h := DefaultRowHeight; // Zoom factor is applied by getter function
end; end;
if h = -1 then if h = 0 then
h := DefaultRowHeight; // Zoom factor is applied by getter function h := DefaultRowHeight; // Zoom factor is applied by getter function
inc(FZoomLock); // We don't want to modify the sheet row heights here. inc(FZoomLock); // We don't want to modify the sheet row heights here.