fpspreadsheet: Add zooming support to WorksheetGrid (use SHIFT+CTRL+MouseWheel in fpctrls demo).
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@5218 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
parent
aed1feecaa
commit
0a99b97c4b
@ -48,9 +48,9 @@ object MainForm: TMainForm
|
|||||||
TitleFont.Color = clBlack
|
TitleFont.Color = clBlack
|
||||||
TitleFont.Height = -13
|
TitleFont.Height = -13
|
||||||
TitleFont.Name = 'Arial'
|
TitleFont.Name = 'Arial'
|
||||||
TitleStyle = tsNative
|
|
||||||
UseXORFeatures = True
|
UseXORFeatures = True
|
||||||
OnClickHyperlink = WorksheetGridClickHyperlink
|
OnClickHyperlink = WorksheetGridClickHyperlink
|
||||||
|
OnMouseWheel = WorksheetGridMouseWheel
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
object InspectorTabControl: TTabControl
|
object InspectorTabControl: TTabControl
|
||||||
|
@ -8,7 +8,7 @@ uses
|
|||||||
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
|
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
|
||||||
ComCtrls, ActnList, Menus, StdActns, Buttons,
|
ComCtrls, ActnList, Menus, StdActns, Buttons,
|
||||||
fpstypes, fpspreadsheet, fpspreadsheetctrls, fpspreadsheetgrid, fpsActions,
|
fpstypes, fpspreadsheet, fpspreadsheetctrls, fpspreadsheetgrid, fpsActions,
|
||||||
fpsRegFileFormats, fpsSYLK, xlsxml, Grids;
|
fpsRegFileFormats, fpsSYLK, xlsxml, Grids, Types;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
@ -383,6 +383,8 @@ type
|
|||||||
procedure InspectorTabControlChange(Sender: TObject);
|
procedure InspectorTabControlChange(Sender: TObject);
|
||||||
procedure WorksheetGridClickHyperlink(Sender: TObject;
|
procedure WorksheetGridClickHyperlink(Sender: TObject;
|
||||||
const AHyperlink: TsHyperlink);
|
const AHyperlink: TsHyperlink);
|
||||||
|
procedure WorksheetGridMouseWheel(Sender: TObject; Shift: TShiftState;
|
||||||
|
WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
|
||||||
private
|
private
|
||||||
{ private declarations }
|
{ private declarations }
|
||||||
FOpenFormats: TsSpreadFormatIDArray;
|
FOpenFormats: TsSpreadFormatIDArray;
|
||||||
@ -845,5 +847,20 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TMainForm.WorksheetGridMouseWheel(Sender: TObject;
|
||||||
|
Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint;
|
||||||
|
var Handled: Boolean);
|
||||||
|
const
|
||||||
|
GROWTH_FACTOR = 1.05;
|
||||||
|
begin
|
||||||
|
if ([ssCtrl, ssShift] * Shift = [ssCtrl, ssShift]) then begin
|
||||||
|
if WheelDelta > 0 then
|
||||||
|
WorksheetGrid.ZoomFactor := GROWTH_FACTOR* WorksheetGrid.ZoomFactor
|
||||||
|
else
|
||||||
|
WorksheetGrid.ZoomFactor := WorksheetGrid.ZoomFactor / GROWTH_FACTOR;
|
||||||
|
Handled := true;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
@ -137,6 +137,7 @@ type
|
|||||||
FPageLayout: TsPageLayout;
|
FPageLayout: TsPageLayout;
|
||||||
FVirtualColCount: Cardinal;
|
FVirtualColCount: Cardinal;
|
||||||
FVirtualRowCount: Cardinal;
|
FVirtualRowCount: Cardinal;
|
||||||
|
FZoomFactor: Double;
|
||||||
FOnChangeCell: TsCellEvent;
|
FOnChangeCell: TsCellEvent;
|
||||||
FOnChangeFont: TsCellEvent;
|
FOnChangeFont: TsCellEvent;
|
||||||
FOnCompareCells: TsCellCompareEvent;
|
FOnCompareCells: TsCellCompareEvent;
|
||||||
@ -590,6 +591,8 @@ type
|
|||||||
property LeftPaneWidth: Integer read FLeftPaneWidth write FLeftPaneWidth;
|
property LeftPaneWidth: Integer read FLeftPaneWidth write FLeftPaneWidth;
|
||||||
{@@ Number of frozen rows which do not scroll }
|
{@@ Number of frozen rows which do not scroll }
|
||||||
property TopPaneHeight: Integer read FTopPaneHeight write FTopPaneHeight;
|
property TopPaneHeight: Integer read FTopPaneHeight write FTopPaneHeight;
|
||||||
|
{@@ Zoom factor }
|
||||||
|
property ZoomFactor: Double read FZoomFactor write FZoomFactor;
|
||||||
{@@ Event fired when cell contents or formatting changes }
|
{@@ Event fired when cell contents or formatting changes }
|
||||||
property OnChangeCell: TsCellEvent read FOnChangeCell write FOnChangeCell;
|
property OnChangeCell: TsCellEvent read FOnChangeCell write FOnChangeCell;
|
||||||
{@@ Event fired when the font size in a cell changes }
|
{@@ Event fired when the font size in a cell changes }
|
||||||
@ -1051,6 +1054,7 @@ begin
|
|||||||
|
|
||||||
FDefaultColWidth := ptsToMM(72); // Excel: about 72 pts
|
FDefaultColWidth := ptsToMM(72); // Excel: about 72 pts
|
||||||
FDefaultRowHeight := ptsToMM(15); // Excel: 15pts
|
FDefaultRowHeight := ptsToMM(15); // Excel: 15pts
|
||||||
|
FZoomFactor := 1.0;
|
||||||
|
|
||||||
FFirstRowIndex := UNASSIGNED_ROW_COL_INDEX;
|
FFirstRowIndex := UNASSIGNED_ROW_COL_INDEX;
|
||||||
FFirstColIndex := UNASSIGNED_ROW_COL_INDEX;
|
FFirstColIndex := UNASSIGNED_ROW_COL_INDEX;
|
||||||
|
@ -76,6 +76,9 @@ type
|
|||||||
FSelPen: TsSelPen;
|
FSelPen: TsSelPen;
|
||||||
FHyperlinkTimer: TTimer;
|
FHyperlinkTimer: TTimer;
|
||||||
FHyperlinkCell: PCell; // Selected cell if it stores a hyperlink
|
FHyperlinkCell: PCell; // Selected cell if it stores a hyperlink
|
||||||
|
FDefRowHeight100: Integer; // Default row height for 100% zoom factor, in pixels
|
||||||
|
FDefColWidth100: Integer; // Default col width for 100% zoom factor, in pixels
|
||||||
|
FZoomLock: Integer;
|
||||||
// FSetupDelayed: Boolean;
|
// FSetupDelayed: Boolean;
|
||||||
FOnClickHyperlink: TsHyperlinkClickEvent;
|
FOnClickHyperlink: TsHyperlinkClickEvent;
|
||||||
function CalcAutoRowHeight(ARow: Integer): Integer;
|
function CalcAutoRowHeight(ARow: Integer): Integer;
|
||||||
@ -128,6 +131,7 @@ type
|
|||||||
function GetWorksheet: TsWorksheet;
|
function GetWorksheet: TsWorksheet;
|
||||||
function GetWordwrap(ACol, ARow: Integer): Boolean;
|
function GetWordwrap(ACol, ARow: Integer): Boolean;
|
||||||
function GetWordwraps(ALeft, ATop, ARight, ABottom: Integer): Boolean;
|
function GetWordwraps(ALeft, ATop, ARight, ABottom: Integer): Boolean;
|
||||||
|
function GetZoomFactor: Double;
|
||||||
procedure SetAutoCalc(AValue: Boolean);
|
procedure SetAutoCalc(AValue: Boolean);
|
||||||
procedure SetBackgroundColor(ACol, ARow: Integer; AValue: TsColor);
|
procedure SetBackgroundColor(ACol, ARow: Integer; AValue: TsColor);
|
||||||
procedure SetBackgroundColors(ALeft, ATop, ARight, ABottom: Integer; AValue: TsColor);
|
procedure SetBackgroundColors(ALeft, ATop, ARight, ABottom: Integer; AValue: TsColor);
|
||||||
@ -176,6 +180,7 @@ type
|
|||||||
procedure SetWorkbookSource(AValue: TsWorkbookSource);
|
procedure SetWorkbookSource(AValue: TsWorkbookSource);
|
||||||
procedure SetWordwrap(ACol, ARow: Integer; AValue: boolean);
|
procedure SetWordwrap(ACol, ARow: Integer; AValue: boolean);
|
||||||
procedure SetWordwraps(ALeft, ATop, ARight, ABottom: Integer; AValue: boolean);
|
procedure SetWordwraps(ALeft, ATop, ARight, ABottom: Integer; AValue: boolean);
|
||||||
|
procedure SetZoomFactor(AValue: Double);
|
||||||
|
|
||||||
procedure HyperlinkTimerElapsed(Sender: TObject);
|
procedure HyperlinkTimerElapsed(Sender: TObject);
|
||||||
|
|
||||||
@ -230,7 +235,7 @@ type
|
|||||||
procedure MouseUp(Button: TMouseButton; Shift:TShiftState; X,Y:Integer); override;
|
procedure MouseUp(Button: TMouseButton; Shift:TShiftState; X,Y:Integer); override;
|
||||||
procedure MoveSelection; override;
|
procedure MoveSelection; override;
|
||||||
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
|
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
|
||||||
// procedure SelectEditor; override;
|
procedure PrepareCanvasFont;
|
||||||
procedure SelPenChangeHandler(Sender: TObject);
|
procedure SelPenChangeHandler(Sender: TObject);
|
||||||
procedure SetEditText(ACol, ARow: Longint; const AValue: string); override;
|
procedure SetEditText(ACol, ARow: Longint; const AValue: string); override;
|
||||||
procedure Setup;
|
procedure Setup;
|
||||||
@ -449,6 +454,9 @@ type
|
|||||||
by the rectangle is activated. }
|
by the rectangle is activated. }
|
||||||
property Wordwraps[ALeft, ATop, ARight, ABottom: Integer]: Boolean
|
property Wordwraps[ALeft, ATop, ARight, ABottom: Integer]: Boolean
|
||||||
read GetWordwraps write SetWordwraps;
|
read GetWordwraps write SetWordwraps;
|
||||||
|
{@@ Zoomfactor of the grid }
|
||||||
|
property ZoomFactor: Double
|
||||||
|
read GetZoomFactor write SetZoomFactor;
|
||||||
|
|
||||||
// inherited, but modified
|
// inherited, but modified
|
||||||
|
|
||||||
@ -1050,7 +1058,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
w := RichTextWidth(Canvas, Workbook, Rect(0, 0, MaxInt, MaxInt),
|
w := RichTextWidth(Canvas, Workbook, Rect(0, 0, MaxInt, MaxInt),
|
||||||
txt, cell^.RichTextParams, Worksheet.ReadCellFontIndex(cell),
|
txt, cell^.RichTextParams, Worksheet.ReadCellFontIndex(cell),
|
||||||
Worksheet.ReadTextRotation(cell), false, RTL);
|
Worksheet.ReadTextRotation(cell), false, RTL, ZoomFactor);
|
||||||
if w > maxw then maxw := w;
|
if w > maxw then maxw := w;
|
||||||
end;
|
end;
|
||||||
if maxw > -1 then
|
if maxw > -1 then
|
||||||
@ -1067,11 +1075,13 @@ end;
|
|||||||
-------------------------------------------------------------------------------}
|
-------------------------------------------------------------------------------}
|
||||||
procedure TsCustomWorksheetGrid.AutoAdjustRow(ARow: Integer);
|
procedure TsCustomWorksheetGrid.AutoAdjustRow(ARow: Integer);
|
||||||
begin
|
begin
|
||||||
|
inc(FZoomLock);
|
||||||
if Worksheet <> nil then
|
if Worksheet <> nil then
|
||||||
RowHeights[ARow] := CalcAutoRowHeight(ARow)
|
RowHeights[ARow] := CalcAutoRowHeight(ARow)
|
||||||
else
|
else
|
||||||
RowHeights[ARow] := DefaultRowHeight;
|
RowHeights[ARow] := DefaultRowHeight;
|
||||||
HeaderSized(false, ARow);
|
HeaderSized(false, ARow);
|
||||||
|
dec(FZoomLock);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{@@ ----------------------------------------------------------------------------
|
{@@ ----------------------------------------------------------------------------
|
||||||
@ -1144,9 +1154,9 @@ var
|
|||||||
begin
|
begin
|
||||||
h := 0;
|
h := 0;
|
||||||
for c := FHeaderCount to ColCount-1 do
|
for c := FHeaderCount to ColCount-1 do
|
||||||
h := Max(h, GetCellHeight(c, ARow));
|
h := Max(h, GetCellHeight(c, ARow)); // Zoom factor is applied to font size
|
||||||
if h = 0 then
|
if h = 0 then
|
||||||
Result := DefaultRowHeight
|
Result := DefaultRowHeight // Zoom factor applied by getter function
|
||||||
else
|
else
|
||||||
Result := h;
|
Result := h;
|
||||||
end;
|
end;
|
||||||
@ -1182,7 +1192,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
// The grid's column width is in "pixels", the worksheet's column width
|
// The grid's column width is in "pixels", the worksheet's column width
|
||||||
// has the units defined by the workbook.
|
// has the units defined by the workbook.
|
||||||
w_pts := PxToPts(AValue, Screen.PixelsPerInch);
|
w_pts := PxToPts(AValue/ZoomFactor, Screen.PixelsPerInch);
|
||||||
Result := Workbook.ConvertUnits(w_pts, suPoints, Workbook.Units);
|
Result := Workbook.ConvertUnits(w_pts, suPoints, Workbook.Units);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -1203,7 +1213,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
// The grid's row heights are in "pixels", the worksheet's row height
|
// The grid's row heights are in "pixels", the worksheet's row height
|
||||||
// has the units defined by the workbook.
|
// has the units defined by the workbook.
|
||||||
h_pts := PxToPts(AValue, Screen.PixelsPerInch);
|
h_pts := PxToPts(AValue/ZoomFactor, Screen.PixelsPerInch);
|
||||||
Result := Workbook.ConvertUnits(h_pts, suPoints, Workbook.Units);
|
Result := Workbook.ConvertUnits(h_pts, suPoints, Workbook.Units);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -1587,6 +1597,7 @@ begin
|
|||||||
InflateRect(Rct, -delta, -delta);
|
InflateRect(Rct, -delta, -delta);
|
||||||
inc(Rct.Top);
|
inc(Rct.Top);
|
||||||
if not odd(FSelPen.Width) then dec(Rct.Left);
|
if not odd(FSelPen.Width) then dec(Rct.Left);
|
||||||
|
Editor.Font.Height := Round(Font.Height * ZoomFactor);
|
||||||
Editor.SetBounds(Rct.Left, Rct.Top, Rct.Right-Rct.Left-1, Rct.Bottom-Rct.Top-1);
|
Editor.SetBounds(Rct.Left, Rct.Top, Rct.Right-Rct.Left-1, Rct.Bottom-Rct.Top-1);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -1622,6 +1633,7 @@ var
|
|||||||
begin
|
begin
|
||||||
GetSelectedState(AState, isSelected);
|
GetSelectedState(AState, isSelected);
|
||||||
Canvas.Font.Assign(Font);
|
Canvas.Font.Assign(Font);
|
||||||
|
Canvas.Font.Height := Round(ZoomFactor * Canvas.Font.Height);
|
||||||
Canvas.Brush.Bitmap := nil;
|
Canvas.Brush.Bitmap := nil;
|
||||||
Canvas.Brush.Color := Color;
|
Canvas.Brush.Color := Color;
|
||||||
ts := Canvas.TextStyle;
|
ts := Canvas.TextStyle;
|
||||||
@ -1698,37 +1710,8 @@ begin
|
|||||||
if (uffFont in fmt^.UsedFormattingFields) then
|
if (uffFont in fmt^.UsedFormattingFields) then
|
||||||
fnt := Workbook.GetFont(fmt^.FontIndex);
|
fnt := Workbook.GetFont(fmt^.FontIndex);
|
||||||
|
|
||||||
if fnt <> nil then
|
Convert_sFont_to_Font(fnt, Canvas.Font);
|
||||||
begin
|
Canvas.Font.Height := Round(ZoomFactor * Canvas.Font.Height);
|
||||||
Canvas.Font.Name := fnt.FontName;
|
|
||||||
Canvas.Font.Size := round(fnt.Size);
|
|
||||||
Canvas.Font.Color := fnt.Color and $00FFFFFF;
|
|
||||||
style := [];
|
|
||||||
if fssBold in fnt.Style then Include(style, fsBold);
|
|
||||||
if fssItalic in fnt.Style then Include(style, fsItalic);
|
|
||||||
if fssUnderline in fnt.Style then Include(style, fsUnderline);
|
|
||||||
if fssStrikeout in fnt.Style then Include(style, fsStrikeout);
|
|
||||||
Canvas.Font.Style := style;
|
|
||||||
end;
|
|
||||||
|
|
||||||
// Text color is handled by "InternalDrawRichText"
|
|
||||||
{
|
|
||||||
// Read text color from number format if available
|
|
||||||
if not IsNaN(lCell^.NumberValue) and (numFmt <> nil) then
|
|
||||||
begin
|
|
||||||
sidx := 0;
|
|
||||||
if (Length(numFmt.Sections) > 1) and (lCell^.NumberValue < 0) then
|
|
||||||
sidx := 1
|
|
||||||
else
|
|
||||||
if (Length(numFmt.Sections) > 2) and (lCell^.NumberValue = 0) then
|
|
||||||
sidx := 2;
|
|
||||||
if (nfkHasColor in numFmt.Sections[sidx].Kind) then
|
|
||||||
begin
|
|
||||||
clr := numFmt.Sections[sidx].Color;
|
|
||||||
Canvas.Font.Color := clr and $00FFFFFF;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Wordwrap, text alignment and text rotation are handled by "DrawTextInCell".
|
// Wordwrap, text alignment and text rotation are handled by "DrawTextInCell".
|
||||||
end;
|
end;
|
||||||
@ -2456,7 +2439,15 @@ begin
|
|||||||
ts.Layout := tlCenter;
|
ts.Layout := tlCenter;
|
||||||
ts.Opaque := false;
|
ts.Opaque := false;
|
||||||
Canvas.TextStyle := ts;
|
Canvas.TextStyle := ts;
|
||||||
|
{
|
||||||
|
writeLn('HEADER');
|
||||||
|
writeln(Format('1 - col=%d, row=%d, font size=%d', [acol, arow, canvas.font.size]));
|
||||||
|
}
|
||||||
inherited DrawCellText(aCol, aRow, aRect, aState, GetCellText(ACol,ARow));
|
inherited DrawCellText(aCol, aRow, aRect, aState, GetCellText(ACol,ARow));
|
||||||
|
{
|
||||||
|
writeln(GetCellText(ACol, ARow));
|
||||||
|
writeln(Format('2 - col=%d, row=%d, font size=%d', [acol, arow, canvas.font.size]));
|
||||||
|
}
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -3030,6 +3021,7 @@ end;
|
|||||||
@param ACol Grid column index of the cell
|
@param ACol Grid column index of the cell
|
||||||
@param ARow Grid row index of the cell
|
@param ARow Grid row index of the cell
|
||||||
@result Height of the cell in pixels. Wrapped text is handled correctly.
|
@result Height of the cell in pixels. Wrapped text is handled correctly.
|
||||||
|
Value contains the zoom factor.
|
||||||
-------------------------------------------------------------------------------}
|
-------------------------------------------------------------------------------}
|
||||||
function TsCustomWorksheetGrid.GetCellHeight(ACol, ARow: Integer): Integer;
|
function TsCustomWorksheetGrid.GetCellHeight(ACol, ARow: Integer): Integer;
|
||||||
var
|
var
|
||||||
@ -3096,7 +3088,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
Result := RichTextHeight(Canvas, Workbook, cellR, s, lCell^.RichTextParams,
|
Result := RichTextHeight(Canvas, Workbook, cellR, s, lCell^.RichTextParams,
|
||||||
fntIndex, txtRot, wrapped, RTL)
|
fntIndex, txtRot, wrapped, RTL, ZoomFactor)
|
||||||
+ 2 * constCellPadding;
|
+ 2 * constCellPadding;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -3511,20 +3503,26 @@ end;
|
|||||||
@param Index Index of the changed column or row
|
@param Index Index of the changed column or row
|
||||||
-------------------------------------------------------------------------------}
|
-------------------------------------------------------------------------------}
|
||||||
procedure TsCustomWorksheetGrid.HeaderSized(IsColumn: Boolean; AIndex: Integer);
|
procedure TsCustomWorksheetGrid.HeaderSized(IsColumn: Boolean; AIndex: Integer);
|
||||||
|
const
|
||||||
|
EPS = 0.1;
|
||||||
var
|
var
|
||||||
w, h: Single;
|
w, h, wdef, hdef: Single;
|
||||||
begin
|
begin
|
||||||
if Worksheet = nil then
|
if (Worksheet = nil) or (FZoomLock <> 0) then
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
if IsColumn then
|
if IsColumn then
|
||||||
begin
|
begin
|
||||||
w := CalcWorksheetColWidth(ColWidths[AIndex]);
|
w := CalcWorksheetColWidth(ColWidths[AIndex]); // w and wdef are at 100% zoom
|
||||||
Worksheet.WriteColWidth(GetWorksheetCol(AIndex), w, Workbook.Units);
|
wdef := Worksheet.ReadDefaultColWidth(Workbook.Units);
|
||||||
|
if not SameValue(w, wdef, EPS) then
|
||||||
|
Worksheet.WriteColWidth(GetWorksheetCol(AIndex), w, Workbook.Units);
|
||||||
end else
|
end else
|
||||||
begin
|
begin
|
||||||
h := CalcWorksheetRowHeight(RowHeights[AIndex]);
|
h := CalcWorksheetRowHeight(RowHeights[AIndex]);
|
||||||
Worksheet.WriteRowHeight(GetWorksheetRow(AIndex), h, Workbook.Units);
|
hdef := Worksheet.ReadDefaultRowHeight(Workbook.Units);
|
||||||
|
if not SameValue(h, hdef, EPS) then
|
||||||
|
Worksheet.WriteRowHeight(GetWorksheetRow(AIndex), h, Workbook.Units);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -3628,7 +3626,7 @@ begin
|
|||||||
// Work horse for text drawing, both standard text and rich-text
|
// Work horse for text drawing, both standard text and rich-text
|
||||||
DrawRichText(Canvas, Workbook, ARect, AText, ARichTextParams, AFontIndex,
|
DrawRichText(Canvas, Workbook, ARect, AText, ARichTextParams, AFontIndex,
|
||||||
ATextWrap, ACellHorAlign, ACellVertAlign, ATextRot, AOverrideTextColor,
|
ATextWrap, ACellHorAlign, ACellVertAlign, ATextRot, AOverrideTextColor,
|
||||||
AIsRightToLeft
|
AIsRightToLeft, ZoomFactor
|
||||||
);
|
);
|
||||||
end;
|
end;
|
||||||
(*
|
(*
|
||||||
@ -4237,6 +4235,21 @@ begin
|
|||||||
SetWorkbookSource(nil);
|
SetWorkbookSource(nil);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{@@ Prepares the Canvas default font for methods determining text size }
|
||||||
|
procedure TsCustomWorksheetGrid.PrepareCanvasFont;
|
||||||
|
var
|
||||||
|
fnt: TsFont;
|
||||||
|
begin
|
||||||
|
if Worksheet = nil then
|
||||||
|
Canvas.Font.Assign(Font)
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
fnt := Workbook.GetDefaultFont;
|
||||||
|
Convert_sFont_to_Font(fnt, Canvas.Font);
|
||||||
|
end;
|
||||||
|
Canvas.Font.Height := Round(ZoomFactor * Canvas.Font.Height);
|
||||||
|
end;
|
||||||
|
|
||||||
{@@ ----------------------------------------------------------------------------
|
{@@ ----------------------------------------------------------------------------
|
||||||
Removes the link of the WorksheetGrid to the WorkbookSource.
|
Removes the link of the WorksheetGrid to the WorkbookSource.
|
||||||
Required before destruction.
|
Required before destruction.
|
||||||
@ -4359,13 +4372,12 @@ begin
|
|||||||
FixedCols := FFrozenCols + FHeaderCount;
|
FixedCols := FFrozenCols + FHeaderCount;
|
||||||
FixedRows := FFrozenRows + FHeaderCount;
|
FixedRows := FFrozenRows + FHeaderCount;
|
||||||
if ShowHeaders then begin
|
if ShowHeaders then begin
|
||||||
|
PrepareCanvasFont; // Applies the zoom factor
|
||||||
ColWidths[0] := GetDefaultHeaderColWidth;
|
ColWidths[0] := GetDefaultHeaderColWidth;
|
||||||
RowHeights[0] := GetDefaultRowHeight;
|
RowHeights[0] := GetDefaultRowHeight;
|
||||||
end;
|
end;
|
||||||
end else
|
end else
|
||||||
if Worksheet <> nil then begin
|
if Worksheet <> nil then begin
|
||||||
Convert_sFont_to_Font(Workbook.GetDefaultFont, Font);
|
|
||||||
Canvas.Font.Assign(Font);
|
|
||||||
if FHeaderCount = 0 then
|
if FHeaderCount = 0 then
|
||||||
begin
|
begin
|
||||||
ColCount := Max(GetGridCol(Worksheet.GetLastColIndex), ColCount-1);
|
ColCount := Max(GetGridCol(Worksheet.GetLastColIndex), ColCount-1);
|
||||||
@ -4378,6 +4390,7 @@ begin
|
|||||||
FixedCols := FFrozenCols + FHeaderCount;
|
FixedCols := FFrozenCols + FHeaderCount;
|
||||||
FixedRows := FFrozenRows + FHeaderCount;
|
FixedRows := FFrozenRows + FHeaderCount;
|
||||||
if ShowHeaders then begin
|
if ShowHeaders then begin
|
||||||
|
PrepareCanvasFont;
|
||||||
ColWidths[0] := GetDefaultHeaderColWidth;
|
ColWidths[0] := GetDefaultHeaderColWidth;
|
||||||
RowHeights[0] := GetDefaultRowHeight;
|
RowHeights[0] := GetDefaultRowHeight;
|
||||||
end;
|
end;
|
||||||
@ -4682,19 +4695,22 @@ procedure TsCustomWorksheetGrid.UpdateColWidths(AStartIndex: Integer = 0);
|
|||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
lCol: PCol;
|
lCol: PCol;
|
||||||
w: Integer;
|
w: Integer; // Col width at current zoom level
|
||||||
|
w100: Integer; // Col width at 100% zoom level
|
||||||
begin
|
begin
|
||||||
if AStartIndex = 0 then AStartIndex := FHeaderCount;
|
if AStartIndex = 0 then
|
||||||
|
AStartIndex := FHeaderCount;
|
||||||
for i := AStartIndex to ColCount-1 do begin
|
for i := AStartIndex to ColCount-1 do begin
|
||||||
w := DefaultColWidth;
|
|
||||||
if Worksheet <> nil then
|
if Worksheet <> nil then
|
||||||
begin
|
begin
|
||||||
lCol := Worksheet.FindCol(i - FHeaderCount);
|
lCol := Worksheet.FindCol(i - FHeaderCount);
|
||||||
if lCol <> nil then
|
if lCol <> nil then
|
||||||
w := CalcColWidthFromSheet(lCol^.Width)
|
w100 := CalcColWidthFromSheet(lCol^.Width)
|
||||||
else
|
else
|
||||||
w := CalcColWidthFromSheet(Worksheet.ReadDefaultColWidth(Workbook.Units));
|
w100 := CalcColWidthFromSheet(Worksheet.ReadDefaultColWidth(Workbook.Units));
|
||||||
end;
|
w := round(w100 * ZoomFactor);
|
||||||
|
end else
|
||||||
|
w := DefaultColWidth; // Zoom factor is already applied by getter
|
||||||
ColWidths[i] := w;
|
ColWidths[i] := w;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -4736,11 +4752,11 @@ begin
|
|||||||
begin
|
begin
|
||||||
lRow := Worksheet.FindRow(r - FHeaderCount);
|
lRow := Worksheet.FindRow(r - FHeaderCount);
|
||||||
if (lRow <> nil) then
|
if (lRow <> nil) then
|
||||||
h := CalcRowHeightFromSheet(lRow^.Height)
|
h := round(CalcRowHeightFromSheet(lRow^.Height) * ZoomFactor)
|
||||||
else
|
else
|
||||||
h := CalcAutoRowHeight(r);
|
h := CalcAutoRowHeight(r); // ZoomFactor has already been applied to font heights
|
||||||
end else
|
end else
|
||||||
h := DefaultRowHeight;
|
h := DefaultRowHeight; // Zoom factor is applied by getter function
|
||||||
RowHeights[r] := h;
|
RowHeights[r] := h;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -4907,12 +4923,12 @@ end;
|
|||||||
|
|
||||||
function TsCustomWorksheetGrid.GetDefColWidth: Integer;
|
function TsCustomWorksheetGrid.GetDefColWidth: Integer;
|
||||||
begin
|
begin
|
||||||
Result := inherited DefaultColWidth;
|
Result := round(FDefColWidth100 * ZoomFactor);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TsCustomWorksheetGrid.GetDefRowHeight: Integer;
|
function TsCustomWorksheetGrid.GetDefRowHeight: Integer;
|
||||||
begin
|
begin
|
||||||
Result := inherited DefaultRowHeight;
|
Result := round(FDefRowHeight100 * Zoomfactor);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TsCustomWorksheetGrid.GetHorAlignment(ACol, ARow: Integer): TsHorAlignment;
|
function TsCustomWorksheetGrid.GetHorAlignment(ACol, ARow: Integer): TsHorAlignment;
|
||||||
@ -5118,6 +5134,14 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TsCustomWorksheetGrid.GetZoomFactor: Double;
|
||||||
|
begin
|
||||||
|
if Worksheet <> nil then
|
||||||
|
Result := Worksheet.Zoomfactor
|
||||||
|
else
|
||||||
|
Result := 1.0;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TsCustomWorksheetGrid.SetAutoCalc(AValue: Boolean);
|
procedure TsCustomWorksheetGrid.SetAutoCalc(AValue: Boolean);
|
||||||
var
|
var
|
||||||
optns: TsWorkbookOptions;
|
optns: TsWorkbookOptions;
|
||||||
@ -5509,22 +5533,30 @@ procedure TsCustomWorksheetGrid.SetDefColWidth(AValue: Integer);
|
|||||||
begin
|
begin
|
||||||
if AValue = GetDefColWidth then
|
if AValue = GetDefColWidth then
|
||||||
exit;
|
exit;
|
||||||
|
// AValue contains the zoom factor
|
||||||
|
// FDefColWidth1000 is the col width at zoom factor 1.0
|
||||||
|
FDefColWidth100 := round(AValue / ZoomFactor);
|
||||||
inherited DefaultColWidth := AValue;
|
inherited DefaultColWidth := AValue;
|
||||||
if FHeaderCount > 0 then
|
if FHeaderCount > 0 then begin
|
||||||
|
PrepareCanvasFont;
|
||||||
ColWidths[0] := GetDefaultHeaderColWidth;
|
ColWidths[0] := GetDefaultHeaderColWidth;
|
||||||
if Worksheet <> nil then
|
end;
|
||||||
Worksheet.WriteDefaultColWidth(CalcWorksheetColWidth(AValue), Workbook.Units);
|
if (FZoomLock = 0) and (Worksheet <> nil) then
|
||||||
|
Worksheet.WriteDefaultColWidth(CalcWorksheetColWidth(GetDefColWidth), Workbook.Units);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TsCustomWorksheetGrid.SetDefRowHeight(AValue: Integer);
|
procedure TsCustomWorksheetGrid.SetDefRowHeight(AValue: Integer);
|
||||||
begin
|
begin
|
||||||
if AValue = GetDefRowHeight then
|
if AValue = GetDefRowHeight then
|
||||||
exit;
|
exit;
|
||||||
|
// AValue contains the zoom factor
|
||||||
|
// FDefRowHeight100 is the row height with zoom factor 1.0
|
||||||
|
FDefRowHeight100 := round(AValue / ZoomFactor);
|
||||||
inherited DefaultRowHeight := AValue;
|
inherited DefaultRowHeight := AValue;
|
||||||
if FHeaderCount > 0 then
|
if FHeaderCount > 0 then
|
||||||
RowHeights[0] := GetDefaultRowHeight;
|
RowHeights[0] := GetDefaultRowHeight;
|
||||||
if Worksheet <> nil then
|
if (FZoomLock = 0) and (Worksheet <> nil) then
|
||||||
Worksheet.WriteDefaultRowHeight(CalcWorksheetRowHeight(AValue), Workbook.Units);
|
Worksheet.WriteDefaultRowHeight(CalcWorksheetRowHeight(GetDefaultRowHeight), Workbook.Units);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TsCustomWorksheetGrid.SetFrozenCols(AValue: Integer);
|
procedure TsCustomWorksheetGrid.SetFrozenCols(AValue: Integer);
|
||||||
@ -5794,6 +5826,19 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TsCustomWorksheetGrid.SetZoomFactor(AValue: Double);
|
||||||
|
begin
|
||||||
|
if (AValue <> GetZoomFactor) and Assigned(Worksheet) then begin
|
||||||
|
inc(FZoomLock);
|
||||||
|
Worksheet.ZoomFactor := abs(AValue);
|
||||||
|
DefaultRowHeight := round(GetZoomfactor * FDefRowHeight100);
|
||||||
|
DefaultColWidth := round(GetZoomFactor * FDefColWidth100);
|
||||||
|
UpdateColWidths;
|
||||||
|
UpdateRowHeights;
|
||||||
|
dec(FZoomLock);
|
||||||
|
Invalidate;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
{@@ ----------------------------------------------------------------------------
|
{@@ ----------------------------------------------------------------------------
|
||||||
Registers the worksheet grid in the Lazarus component palette,
|
Registers the worksheet grid in the Lazarus component palette,
|
||||||
|
@ -140,7 +140,8 @@ function PtsToIn(AValue: Double): Double; inline;
|
|||||||
function PtsToTwips(AValue: Single): Integer; inline;
|
function PtsToTwips(AValue: Single): Integer; inline;
|
||||||
function PtsToMM(AValue: Double): Double; inline;
|
function PtsToMM(AValue: Double): Double; inline;
|
||||||
function PtsToPx(AValue: Double; AScreenPixelsPerInch: Integer): Integer; inline;
|
function PtsToPx(AValue: Double; AScreenPixelsPerInch: Integer): Integer; inline;
|
||||||
function pxToPts(AValue, AScreenPixelsPerInch: Integer): Double; inline;
|
function pxToPts(AValue, AScreenPixelsPerInch: Integer): Double; inline; overload;
|
||||||
|
function pxToPts(AValue: Double; AScreenPixelsPerInch: Integer): Double; inline; overload;
|
||||||
function TwipsToPts(AValue: Integer): Single; inline;
|
function TwipsToPts(AValue: Integer): Single; inline;
|
||||||
function HTMLLengthStrToPts(AValue: String; DefaultUnits: String = 'pt'): Double;
|
function HTMLLengthStrToPts(AValue: String; DefaultUnits: String = 'pt'): Double;
|
||||||
|
|
||||||
@ -1701,6 +1702,11 @@ begin
|
|||||||
Result := (AValue / AScreenPixelsPerInch) * 72;
|
Result := (AValue / AScreenPixelsPerInch) * 72;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function pxToPts(AValue: Double; AScreenPixelsPerInch: Integer): Double;
|
||||||
|
begin
|
||||||
|
Result := AValue / AScreenPixelsPerInch * 72.0;
|
||||||
|
end;
|
||||||
|
|
||||||
{@@ ----------------------------------------------------------------------------
|
{@@ ----------------------------------------------------------------------------
|
||||||
Converts points to pixels
|
Converts points to pixels
|
||||||
@param AValue Length value given in points
|
@param AValue Length value given in points
|
||||||
|
@ -19,15 +19,18 @@ function WrapText(ACanvas: TCanvas; const AText: string; AMaxWidth: integer): st
|
|||||||
procedure DrawRichText(ACanvas: TCanvas; AWorkbook: TsWorkbook; const ARect: TRect;
|
procedure DrawRichText(ACanvas: TCanvas; AWorkbook: TsWorkbook; const ARect: TRect;
|
||||||
const AText: String; ARichTextParams: TsRichTextParams; AFontIndex: Integer;
|
const AText: String; ARichTextParams: TsRichTextParams; AFontIndex: Integer;
|
||||||
AWordwrap: Boolean; AHorAlignment: TsHorAlignment; AVertAlignment: TsVertAlignment;
|
AWordwrap: Boolean; AHorAlignment: TsHorAlignment; AVertAlignment: TsVertAlignment;
|
||||||
ARotation: TsTextRotation; AOverrideTextColor: TColor; ARightToLeft: Boolean);
|
ARotation: TsTextRotation; AOverrideTextColor: TColor; ARightToLeft: Boolean;
|
||||||
|
AZoomFactor: Double);
|
||||||
|
|
||||||
function RichTextWidth(ACanvas: TCanvas; AWorkbook: TsWorkbook; ARect: TRect;
|
function RichTextWidth(ACanvas: TCanvas; AWorkbook: TsWorkbook; ARect: TRect;
|
||||||
const AText: String; ARichTextParams: TsRichTextParams; AFontIndex: Integer;
|
const AText: String; ARichTextParams: TsRichTextParams; AFontIndex: Integer;
|
||||||
ATextRotation: TsTextRotation; AWordWrap, ARightToLeft: Boolean): Integer;
|
ATextRotation: TsTextRotation; AWordWrap, ARightToLeft: Boolean;
|
||||||
|
AZoomFactor: Double): Integer;
|
||||||
|
|
||||||
function RichTextHeight(ACanvas: TCanvas; AWorkbook: TsWorkbook; ARect: TRect;
|
function RichTextHeight(ACanvas: TCanvas; AWorkbook: TsWorkbook; ARect: TRect;
|
||||||
const AText: String; ARichTextParams: TsRichTextParams; AFontIndex: Integer;
|
const AText: String; ARichTextParams: TsRichTextParams; AFontIndex: Integer;
|
||||||
ATextRotation: TsTextRotation; AWordWrap, ARightToLeft: Boolean): Integer;
|
ATextRotation: TsTextRotation; AWordWrap, ARightToLeft: Boolean;
|
||||||
|
AZoomFactor: Double): Integer;
|
||||||
|
|
||||||
type
|
type
|
||||||
TsLineInfo = class
|
TsLineInfo = class
|
||||||
@ -65,6 +68,7 @@ type
|
|||||||
FCharIndexOfNextFont: Integer;
|
FCharIndexOfNextFont: Integer;
|
||||||
FFontHeight: Integer;
|
FFontHeight: Integer;
|
||||||
FFontPos: TsFontPosition;
|
FFontPos: TsFontPosition;
|
||||||
|
FZoomFactor: Double;
|
||||||
|
|
||||||
private
|
private
|
||||||
function GetHeight: Integer;
|
function GetHeight: Integer;
|
||||||
@ -91,7 +95,8 @@ type
|
|||||||
constructor Create(ACanvas: TCanvas; AWorkbook: TsWorkbook; ARect: TRect;
|
constructor Create(ACanvas: TCanvas; AWorkbook: TsWorkbook; ARect: TRect;
|
||||||
AText: String; ARichTextParams: TsRichTextParams; AFontIndex: Integer;
|
AText: String; ARichTextParams: TsRichTextParams; AFontIndex: Integer;
|
||||||
ATextRotation: TsTextRotation; AHorAlignment: TsHorAlignment;
|
ATextRotation: TsTextRotation; AHorAlignment: TsHorAlignment;
|
||||||
AVertAlignment: TsVertAlignment; AWordWrap, ARightToLeft: Boolean);
|
AVertAlignment: TsVertAlignment; AWordWrap, ARightToLeft: Boolean;
|
||||||
|
AZoomFactor: Double);
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
procedure Draw(AOverrideTextColor: TColor);
|
procedure Draw(AOverrideTextColor: TColor);
|
||||||
property Height: Integer read GetHeight;
|
property Height: Integer read GetHeight;
|
||||||
@ -244,7 +249,8 @@ end;
|
|||||||
procedure DrawRichText(ACanvas: TCanvas; AWorkbook: TsWorkbook; const ARect: TRect;
|
procedure DrawRichText(ACanvas: TCanvas; AWorkbook: TsWorkbook; const ARect: TRect;
|
||||||
const AText: String; ARichTextParams: TsRichTextParams; AFontIndex: Integer;
|
const AText: String; ARichTextParams: TsRichTextParams; AFontIndex: Integer;
|
||||||
AWordwrap: Boolean; AHorAlignment: TsHorAlignment; AVertAlignment: TsVertAlignment;
|
AWordwrap: Boolean; AHorAlignment: TsHorAlignment; AVertAlignment: TsVertAlignment;
|
||||||
ARotation: TsTextRotation; AOverrideTextColor: TColor; ARightToLeft: Boolean);
|
ARotation: TsTextRotation; AOverrideTextColor: TColor; ARightToLeft: Boolean;
|
||||||
|
AZoomFactor: Double);
|
||||||
var
|
var
|
||||||
painter: TsTextPainter;
|
painter: TsTextPainter;
|
||||||
begin
|
begin
|
||||||
@ -252,7 +258,8 @@ begin
|
|||||||
exit;
|
exit;
|
||||||
|
|
||||||
painter := TsTextPainter.Create(ACanvas, AWorkbook, ARect, AText, ARichTextParams,
|
painter := TsTextPainter.Create(ACanvas, AWorkbook, ARect, AText, ARichTextParams,
|
||||||
AFontIndex, ARotation, AHorAlignment, AVertAlignment, AWordWrap, ARightToLeft);
|
AFontIndex, ARotation, AHorAlignment, AVertAlignment, AWordWrap, ARightToLeft,
|
||||||
|
AZoomFactor);
|
||||||
try
|
try
|
||||||
painter.Draw(AOverrideTextColor);
|
painter.Draw(AOverrideTextColor);
|
||||||
finally
|
finally
|
||||||
@ -262,7 +269,8 @@ end;
|
|||||||
|
|
||||||
function RichTextWidth(ACanvas: TCanvas; AWorkbook: TsWorkbook; ARect: TRect;
|
function RichTextWidth(ACanvas: TCanvas; AWorkbook: TsWorkbook; ARect: TRect;
|
||||||
const AText: String; ARichTextParams: TsRichTextParams; AFontIndex: Integer;
|
const AText: String; ARichTextParams: TsRichTextParams; AFontIndex: Integer;
|
||||||
ATextRotation: TsTextRotation; AWordWrap, ARightToLeft: Boolean): Integer;
|
ATextRotation: TsTextRotation; AWordWrap, ARightToLeft: Boolean;
|
||||||
|
AZoomFactor: Double): Integer;
|
||||||
var
|
var
|
||||||
painter: TsTextPainter;
|
painter: TsTextPainter;
|
||||||
begin
|
begin
|
||||||
@ -270,7 +278,7 @@ begin
|
|||||||
exit(0);
|
exit(0);
|
||||||
|
|
||||||
painter := TsTextPainter.Create(ACanvas, AWorkbook, ARect, AText, ARichTextParams,
|
painter := TsTextPainter.Create(ACanvas, AWorkbook, ARect, AText, ARichTextParams,
|
||||||
AFontIndex, ATextRotation, haLeft, vaTop, AWordWrap, ARightToLeft);
|
AFontIndex, ATextRotation, haLeft, vaTop, AWordWrap, ARightToLeft, AZoomFactor);
|
||||||
try
|
try
|
||||||
Result := painter.Width;
|
Result := painter.Width;
|
||||||
finally
|
finally
|
||||||
@ -280,7 +288,8 @@ end;
|
|||||||
|
|
||||||
function RichTextHeight(ACanvas: TCanvas; AWorkbook: TsWorkbook; ARect: TRect;
|
function RichTextHeight(ACanvas: TCanvas; AWorkbook: TsWorkbook; ARect: TRect;
|
||||||
const AText: String; ARichTextParams: TsRichTextParams; AFontIndex: Integer;
|
const AText: String; ARichTextParams: TsRichTextParams; AFontIndex: Integer;
|
||||||
ATextRotation: TsTextRotation; AWordWrap, ARightToLeft: Boolean): Integer;
|
ATextRotation: TsTextRotation; AWordWrap, ARightToLeft: Boolean;
|
||||||
|
AZoomFactor: Double): Integer;
|
||||||
var
|
var
|
||||||
painter: TsTextPainter;
|
painter: TsTextPainter;
|
||||||
begin
|
begin
|
||||||
@ -288,7 +297,7 @@ begin
|
|||||||
exit(0);
|
exit(0);
|
||||||
|
|
||||||
painter := TsTextPainter.Create(ACanvas, AWorkbook, ARect, AText, ARichTextParams,
|
painter := TsTextPainter.Create(ACanvas, AWorkbook, ARect, AText, ARichTextParams,
|
||||||
AFontIndex, ATextRotation, haLeft, vaTop, AWordWrap, ARightToLeft);
|
AFontIndex, ATextRotation, haLeft, vaTop, AWordWrap, ARightToLeft, AZoomFactor);
|
||||||
try
|
try
|
||||||
Result := painter.Height;
|
Result := painter.Height;
|
||||||
finally
|
finally
|
||||||
@ -325,7 +334,8 @@ end;
|
|||||||
constructor TsTextPainter.Create(ACanvas: TCanvas; AWorkbook: TsWorkbook;
|
constructor TsTextPainter.Create(ACanvas: TCanvas; AWorkbook: TsWorkbook;
|
||||||
ARect: TRect; AText: String; ARichTextParams: TsRichTextParams;
|
ARect: TRect; AText: String; ARichTextParams: TsRichTextParams;
|
||||||
AFontIndex: Integer; ATextRotation: TsTextRotation; AHorAlignment: TsHorAlignment;
|
AFontIndex: Integer; ATextRotation: TsTextRotation; AHorAlignment: TsHorAlignment;
|
||||||
AVertAlignment: TsVertAlignment; AWordWrap, ARightToLeft: Boolean);
|
AVertAlignment: TsVertAlignment; AWordWrap, ARightToLeft: Boolean;
|
||||||
|
AZoomFactor: Double);
|
||||||
begin
|
begin
|
||||||
FLines := TFPList.Create;
|
FLines := TFPList.Create;
|
||||||
FCanvas := ACanvas;
|
FCanvas := ACanvas;
|
||||||
@ -339,6 +349,7 @@ begin
|
|||||||
FVertAlignment := AVertAlignment;
|
FVertAlignment := AVertAlignment;
|
||||||
FWordwrap := AWordwrap;
|
FWordwrap := AWordwrap;
|
||||||
FRightToLeft := ARightToLeft;
|
FRightToLeft := ARightToLeft;
|
||||||
|
FZoomfactor := AZoomFactor;
|
||||||
Prepare;
|
Prepare;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -705,9 +716,10 @@ begin
|
|||||||
ACharIndexOfNextFont := FRtParams[0].FirstIndex;
|
ACharIndexOfNextFont := FRtParams[0].FirstIndex;
|
||||||
end;
|
end;
|
||||||
Convert_sFont_to_Font(fnt, FCanvas.Font);
|
Convert_sFont_to_Font(fnt, FCanvas.Font);
|
||||||
|
FCanvas.Font.Height := round(FZoomFactor * FCanvas.Font.Height);
|
||||||
ACurrFontHeight := FCanvas.TextHeight('Tg');
|
ACurrFontHeight := FCanvas.TextHeight('Tg');
|
||||||
if (fnt <> nil) and (fnt.Position <> fpNormal) then
|
if (fnt <> nil) and (fnt.Position <> fpNormal) then
|
||||||
FCanvas.Font.Size := round(fnt.Size * SUBSCRIPT_SUPERSCRIPT_FACTOR);
|
FCanvas.Font.Size := round(fnt.Size * SUBSCRIPT_SUPERSCRIPT_FACTOR * FZoomFactor);
|
||||||
ACurrFontPos := fnt.Position;
|
ACurrFontPos := fnt.Position;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
unit laz_fpspreadsheet_visual;
|
unit laz_fpspreadsheet_visual;
|
||||||
|
|
||||||
{$warn 5023 off : no warning about unused units}
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
|
Loading…
Reference in New Issue
Block a user