You've already forked lazarus-ccr
fpspreadsheet: Make TsWorksheetGrid respect visibility of rows/columns by setting their width/height to zero.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@6637 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@@ -5722,11 +5722,15 @@ begin
|
|||||||
if Worksheet <> nil then
|
if Worksheet <> nil then
|
||||||
begin
|
begin
|
||||||
lCol := Worksheet.FindCol(ACol - FHeaderCount);
|
lCol := Worksheet.FindCol(ACol - FHeaderCount);
|
||||||
if (lCol <> nil) and (lCol^.ColWidthType = cwtCustom) then
|
if (lCol <> nil) and lCol^.Hidden then
|
||||||
w100 := CalcColWidthFromSheet(lCol^.Width)
|
w := 0
|
||||||
else
|
else begin
|
||||||
w100 := CalcColWidthFromSheet(Worksheet.ReadDefaultColWidth(Workbook.Units));
|
if (lCol <> nil) and (lCol^.ColWidthType = cwtCustom) then
|
||||||
w := round(w100 * ZoomFactor);
|
w100 := CalcColWidthFromSheet(lCol^.Width)
|
||||||
|
else
|
||||||
|
w100 := CalcColWidthFromSheet(Worksheet.ReadDefaultColWidth(Workbook.Units));
|
||||||
|
w := round(w100 * ZoomFactor);
|
||||||
|
end;
|
||||||
end else
|
end else
|
||||||
w := DefaultColWidth; // Zoom factor has already been applied by getter
|
w := DefaultColWidth; // Zoom factor has already been applied by getter
|
||||||
ColWidths[ACol] := w;
|
ColWidths[ACol] := w;
|
||||||
@@ -5769,48 +5773,54 @@ begin
|
|||||||
if ARow < FHeaderCount then
|
if ARow < FHeaderCount then
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
h := 0;
|
h := DefaultRowHeight;
|
||||||
if Worksheet <> nil then
|
if Worksheet <> nil then
|
||||||
begin
|
begin
|
||||||
sr := ARow - FHeaderCount; // worksheet row index
|
sr := ARow - FHeaderCount; // worksheet row index
|
||||||
lRow := Worksheet.FindRow(sr);
|
lRow := Worksheet.FindRow(sr);
|
||||||
if (lRow <> nil) then begin
|
if (lRow <> nil) then begin
|
||||||
case lRow^.RowHeightType of
|
if lRow^.Hidden then
|
||||||
rhtCustom:
|
h := 0
|
||||||
begin
|
else begin
|
||||||
h := round(CalcRowHeightFromSheet(lRow^.Height) * ZoomFactor);
|
case lRow^.RowHeightType of
|
||||||
if AEnforceCalcRowHeight then begin
|
rhtCustom:
|
||||||
h := CalcAutoRowHeight(ARow);
|
begin
|
||||||
if h = 0 then begin
|
h := round(CalcRowHeightFromSheet(lRow^.Height) * ZoomFactor);
|
||||||
h := DefaultRowHeight;
|
if AEnforceCalcRowHeight then begin
|
||||||
lRow^.RowHeightType := rhtDefault;
|
h := CalcAutoRowHeight(ARow);
|
||||||
end else
|
if h = 0 then begin
|
||||||
lRow^.RowHeightType := rhtAuto;
|
h := DefaultRowHeight;
|
||||||
lRow^.Height := CalcRowHeightToSheet(round(h / ZoomFactor));
|
lRow^.RowHeightType := rhtDefault;
|
||||||
end;
|
end else
|
||||||
end;
|
lRow^.RowHeightType := rhtAuto;
|
||||||
rhtAuto, rhtDefault:
|
lRow^.Height := CalcRowHeightToSheet(round(h / ZoomFactor));
|
||||||
begin
|
|
||||||
doCalcRowHeight := AEnforceCalcRowHeight or (lRow^.Height = 0);
|
|
||||||
if doCalcRowHeight then begin
|
|
||||||
// Calculate current grid row height in pixels by iterating over all cells in row
|
|
||||||
h := CalcAutoRowHeight(ARow); // ZoomFactor already applied to font heights
|
|
||||||
if h = 0 then begin
|
|
||||||
h := DefaultRowHeight; // Zoom factor applied by getter function
|
|
||||||
lRow^.RowHeightType := rhtDefault;
|
|
||||||
end else
|
|
||||||
lRow^.RowHeightType := rhtAuto;
|
|
||||||
// Calculate the unzoomed row height in workbook units and store
|
|
||||||
// in row record
|
|
||||||
lRow^.Height := CalcRowHeightToSheet(round(h / ZoomFactor));
|
|
||||||
end else
|
|
||||||
// If autocalc mode is off we just take the row height from the row record
|
|
||||||
case lRow^.RowHeightType of
|
|
||||||
rhtDefault : h := DefaultRowHeight;
|
|
||||||
rhtAuto : h := round(CalcRowHeightFromSheet(lRow^.Height) * ZoomFactor);
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end; // case
|
rhtAuto, rhtDefault:
|
||||||
|
begin
|
||||||
|
doCalcRowHeight := AEnforceCalcRowHeight or (lRow^.Height = 0);
|
||||||
|
if doCalcRowHeight then begin
|
||||||
|
// Calculate current grid row height in pixels by iterating over all cells in row
|
||||||
|
h := CalcAutoRowHeight(ARow); // ZoomFactor already applied to font heights
|
||||||
|
if h = 0 then begin
|
||||||
|
h := DefaultRowHeight; // Zoom factor applied by getter function
|
||||||
|
lRow^.RowHeightType := rhtDefault;
|
||||||
|
end else
|
||||||
|
lRow^.RowHeightType := rhtAuto;
|
||||||
|
// Calculate the unzoomed row height in workbook units and store
|
||||||
|
// in row record
|
||||||
|
lRow^.Height := CalcRowHeightToSheet(round(h / ZoomFactor));
|
||||||
|
end else
|
||||||
|
// If autocalc mode is off we just take the row height from the row record
|
||||||
|
case lRow^.RowHeightType of
|
||||||
|
rhtDefault : h := DefaultRowHeight;
|
||||||
|
rhtAuto : h := round(CalcRowHeightFromSheet(lRow^.Height) * ZoomFactor);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end; // case
|
||||||
|
if h = 0 then
|
||||||
|
h := DefaultRowHeight; // Zoom factor is applied by getter function
|
||||||
|
end;
|
||||||
end else
|
end else
|
||||||
// No row record so far.
|
// No row record so far.
|
||||||
if Worksheet.GetCellCountInRow(sr) > 0 then
|
if Worksheet.GetCellCountInRow(sr) > 0 then
|
||||||
@@ -5818,21 +5828,21 @@ begin
|
|||||||
// Case 1: This row does contain cells
|
// Case 1: This row does contain cells
|
||||||
lRow := Worksheet.AddRow(sr);
|
lRow := Worksheet.AddRow(sr);
|
||||||
if AEnforceCalcRowHeight then
|
if AEnforceCalcRowHeight then
|
||||||
h := CalcAutoRowHeight(ARow) else
|
h := CalcAutoRowHeight(ARow)
|
||||||
|
else
|
||||||
h := DefaultRowHeight;
|
h := DefaultRowHeight;
|
||||||
lRow^.Height := CalcRowHeightToSheet(round(h / ZoomFactor));
|
lRow^.Height := CalcRowHeightToSheet(round(h / ZoomFactor));
|
||||||
if h <> DefaultRowHeight then
|
if h <> DefaultRowHeight then
|
||||||
lRow^.RowHeightType := rhtAuto
|
lRow^.RowHeightType := rhtAuto
|
||||||
else
|
else
|
||||||
lRow^.RowHeightType := rhtDefault;
|
lRow^.RowHeightType := rhtDefault;
|
||||||
|
if h = 0 then
|
||||||
|
h := DefaultRowHeight; // Zoom factor is applied by getter function
|
||||||
end else
|
end else
|
||||||
// Case 2: No cells in row
|
// Case 2: No cells in row
|
||||||
h := DefaultRowHeight; // Zoom factor is applied by getter function
|
h := DefaultRowHeight; // Zoom factor is applied by getter function
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if h = 0 then
|
|
||||||
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.
|
||||||
RowHeights[ARow] := h;
|
RowHeights[ARow] := h;
|
||||||
dec(FZoomLock);
|
dec(FZoomLock);
|
||||||
|
Reference in New Issue
Block a user