diff --git a/components/gridprinter/docs/xml/gridprnpreviewdlg.xml b/components/gridprinter/docs/xml/gridprnpreviewdlg.xml
new file mode 100644
index 000000000..be9baa0e1
--- /dev/null
+++ b/components/gridprinter/docs/xml/gridprnpreviewdlg.xml
@@ -0,0 +1,27 @@
+
+Class allowing to display a preview of the output of the TGridPrinter
+
+
+ Constructor of the TGridPrintPreviewDialog classCreates an instance of the TGridPrintPreviewFormParams class which determines size and position of the dialog window.
+
+ Destructor of the TGridPrintPreviewDialog class
+ Displays the preview form. Main method of the component.
+ Parameters which define size and position of the preview form.
+
+ Links to the TGridPrinter instance which actually performs the printing.
+ This property defines the options of the user to modify the preview.
ppoNavigationBtns - Enables/disables page navigation in the preview.
ppoNavigationEdit - Shows/hides the edit control in the preview toolbar with which the user can navigate to a specific page of the preview.
ppoZoomBtns - Enables/disables zooming in the preview.
ppoPageOrientationBtns - Enables/disables selection of page orientation.
ppoMarginsBtn - Enables/disables page margin selection in the preview
ppoHeaderFooterBtn - Enables/disables the possibility to set up the header and footer in a dialog.
ppoPrintOrderBtns - Enables/disables the possibility to define the order of pages when the entire print-out does not fit onto a single page of paper.
ppoCenterBtns - Shows/hides the buttons to center the grid on the printed page.
ppoScalePrinterBtn - Shows/hides the button to scale the printer output manually or to force a given count of pages onto a single sheet.
ppoPageSetupBtn - Shows/hides a toolbar button with a dropdown menu containing options to control the page layout (page orientation, margin selection, etc).
ppoPageNumberInfo - Shows/hides the display of page number and total page count in the preview form.
ppoZoomLevelInfo - Shows/hides the display of the preview zoom level (percentage) in the preview form.
+
+
+
+ Class administrating the options for the user to modify the preview form.
ppoNavigationBtns - Enables/disables page navigation in the preview.
ppoNavigationEdit - Shows/hides the edit control in the preview toolbar with which the user can navigate to a specific page of the preview.
ppoZoomBtns - Enables/disables zooming in the preview.
ppoPageOrientationBtns - Enables/disables selection of page orientation.
ppoMarginsBtn - Enables/disables page margin selection in the preview
ppoHeaderFooterBtn - Enables/disables the possibility to set up the header and footer in a dialog.
ppoPrintOrderBtns - Enables/disables the possibility to define the order of pages when the entire print-out does not fit onto a single page of paper.
ppoCenterBtns - Shows/hides the buttons to center the grid on the printed page.
ppoScalePrinterBtn - Shows/hides the button to scale the printer output manually or to force a given count of pages onto a single sheet.
ppoPageSetupBtn - Shows/hides a toolbar button with a dropdown menu containing options to control the page layout (page orientation, margin selection, etc).
ppoPageNumberInfo - Shows/hides the display of page number and total page count in the preview form.
ppoZoomLevelInfo - Shows/hides the display of the preview zoom level (percentage) in the preview form.
+
+
+
+ Scaling factor, in percent, applied when the preview bitmap is displayed in the preview form. Default: 100.
+ Determines how the preview bitmap is scaled by means of the Zoom scaling factor:
zmCustom - The current value of the Zoom factor is applied directly.
zmFitWidth - The Zoom factor is adjusted so that the page fits horizontally into the preview window.
zmFitHeight - The Zoom factor is adjusted such that the page fits vertically into the preview window.
+
+
+
+
+
+
diff --git a/components/gridprinter/docs/xml/gridprnpreviewform.xml b/components/gridprinter/docs/xml/gridprnpreviewform.xml
new file mode 100644
index 000000000..5b13be745
--- /dev/null
+++ b/components/gridprinter/docs/xml/gridprnpreviewform.xml
@@ -0,0 +1,23 @@
+
+Enumeration of options how the preview bitmap can be scaled by means of the Zoom factor.
zmCustom - The current value of the Zoom factor is applied directly.
zmFitWidth - The Zoom factor is adjusted so that the page fits horizontally into the preview window.
zmFitHeight - The Zoom factor is adjusted such that the page fits vertically into the preview window.
+
+
+
+ Enumeration of options for the user to enable/disable features in the preview form.
ppoNavigationBtns - Enables/disables page navigation in the preview.
ppoNavigationEdit - Shows/hides the edit control in the preview toolbar with which the user can navigate to a specific page of the preview.
ppoZoomBtns - Enables/disables zooming in the preview.
ppoPageOrientationBtns - Enables/disables selection of page orientation.
ppoMarginsBtn - Enables/disables page margin selection in the preview
ppoHeaderFooterBtn - Enables/disables the possibility to set up the header and footer in a dialog.
ppoPrintOrderBtns - Enables/disables the possibility to define the order of pages when the entire print-out does not fit onto a single page of paper.
ppoCenterBtns - Shows/hides the buttons to center the grid on the printed page.
ppoScalePrinterBtn - Shows/hides the button to scale the printer output manually or to force a given count of pages onto a single sheet.
ppoPageSetupBtn - Shows/hides a toolbar button with a dropdown menu containing options to control the page layout (page orientation, margin selection, etc).
ppoPageNumberInfo - Shows/hides the display of page number and total page count in the preview form.
ppoZoomLevelInfo - Shows/hides the display of the preview zoom level (percentage) in the preview form.
+
+
+ Set of options for the user to enable/disable features in the preview dialog
ppoNavigationBtns - Enables/disables page navigation in the preview.
ppoNavigationEdit - Shows/hides the edit control in the preview toolbar with which the user can navigate to a specific page of the preview.
ppoZoomBtns - Enables/disables zooming in the preview.
ppoPageOrientationBtns - Enables/disables selection of page orientation.
ppoMarginsBtn - Enables/disables page margin selection in the preview
ppoHeaderFooterBtn - Enables/disables the possibility to set up the header and footer in a dialog.
ppoPrintOrderBtns - Enables/disables the possibility to define the order of pages when the entire print-out does not fit onto a single page of paper.
ppoCenterBtns - Shows/hides the buttons to center the grid on the printed page.
ppoScalePrinterBtn - Shows/hides the button to scale the printer output manually or to force a given count of pages onto a single sheet.
ppoPageSetupBtn - Shows/hides a toolbar button with a dropdown menu containing options to control the page layout (page orientation, margin selection, etc).
ppoPageNumberInfo - Shows/hides the display of page number and total page count in the preview form.
ppoZoomLevelInfo - Shows/hides the display of the preview zoom level (percentage) in the preview form.
+
+
+ Form class created by the TGridPrintPreviewDialog to display the preview of the grid to be printed by the TGridPrinter.
+ Helper function which returns true when X1 is in the range between X2-Delta and X2+Delta
+ Helper function which returns
+
X if it is in the range between X1 and X2,
X1 if X is less than X1, or
X2 if X is greater than X2
+
+
+
+ Helper function which appends a checkmark to the given menu caption string if AEnable is true. Meant to better show the checked state of menu items having icons.
+
+
+
+
diff --git a/components/gridprinter/source/gridprnpreviewform.pas b/components/gridprinter/source/gridprnpreviewform.pas
index fb55710d7..57fa83910 100644
--- a/components/gridprinter/source/gridprnpreviewform.pas
+++ b/components/gridprinter/source/gridprnpreviewform.pas
@@ -206,6 +206,7 @@ const
SPACE_CHECKMARK = ' ' + CHECKMARK;
{ Returns true when X1 is in range between X2-Delta and X2+Delta. }
+
function InRange(X1, X2, Delta: Integer): Boolean; inline;
begin
Result := (X1 >= X2-Delta) and (X1 <= X2+Delta);
@@ -213,6 +214,7 @@ end;
{ Returns X if it is in the range between X1 and X2, otherwise either X1 or X2,
depending on wheter X is X2. }
+
function EnsureRange(X, X1, X2: Integer): Integer;
begin
if X < X1 then
@@ -226,6 +228,7 @@ end;
{ Appends a checkmark to the given caption string if AEnable is true.
Meant to better show the checked state of menu items having icons. }
+
function MarkAsChecked(ACaption: String; AEnable: Boolean): String;
begin
if AEnable then