File indexing completed on 2024-04-28 07:29:29

0001 /*
0002     KmPlot - a math. function plotter for the KDE-Desktop
0003 
0004     SPDX-FileCopyrightText: 1998, 1999, 2000, 2002 Klaus-Dieter Möller <kd.moeller@t-online.de>
0005 
0006     This file is part of the KDE Project.
0007     KmPlot is part of the KDE-EDU Project.
0008 
0009     SPDX-License-Identifier: GPL-2.0-or-later
0010 
0011 */
0012 /** @file kprinterdlg.h
0013  * @brief Contains the KPrinterDlg class. */
0014 
0015 #ifndef KMPLOT_KPRINTERDLG_H
0016 #define KMPLOT_KPRINTERDLG_H
0017 
0018 #include <QWidget>
0019 
0020 class QCheckBox;
0021 class QComboBox;
0022 class EquationEdit;
0023 
0024 /** @short A dialog page for the print dialog.
0025  *
0026  * It manages the option to print or not to print the header table with addition plot information.
0027  * It is linked to the app-kmplot-printtable entry in the kmplotrc.
0028  */
0029 class KPrinterDlg : public QWidget
0030 {
0031     Q_OBJECT
0032 public:
0033     /// Getting the common arguments.
0034     explicit KPrinterDlg(QWidget *parent = nullptr);
0035 
0036     bool printHeaderTable();
0037     void setPrintHeaderTable(bool status);
0038 
0039     bool printBackground();
0040     void setPrintBackground(bool status);
0041 
0042     double printWidth();
0043     void setPrintWidth(double width);
0044 
0045     double printHeight();
0046     void setPrintHeight(double height);
0047 
0048     /// Reimplemented.
0049     bool isValid(QString &msg);
0050 
0051 protected:
0052     enum LengthScaling {
0053         Pixels,
0054         Inches,
0055         Centimeters,
0056         Millimeters,
0057     };
0058     /**
0059      * \return the scaling (for converting the width or height to meters via
0060      * multiplication).
0061      */
0062     double lengthScaling() const;
0063     /**
0064      * Converts the scaling unit to an absolute one in meters.
0065      */
0066     static double scalingToMeter(LengthScaling scaling);
0067     /**
0068      * Checkbox for whether to print the header table containing plot
0069      * information.
0070      */
0071     QCheckBox *m_printHeaderTable;
0072     /**
0073      * Checkbox for whether to print the background.
0074      */
0075     QCheckBox *m_transparentBackground;
0076     /**
0077      * For the width of the plot.
0078      */
0079     EquationEdit *m_widthEdit;
0080     /**
0081      * For the height of the plot.
0082      */
0083     EquationEdit *m_heightEdit;
0084     /**
0085      * The units to use for lengths (such as the width and height).
0086      */
0087     QComboBox *m_lengthScalingCombo;
0088 };
0089 
0090 #endif // KMPLOT_KPRINTERDLG_H