File indexing completed on 2024-05-12 04:43:22

0001 /* This file is part of the KDE project
0002  * Copyright (C) 2001-2007 by OpenMFG, LLC (info@openmfg.com)
0003  * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
0004  *
0005  * This library is free software; you can redistribute it and/or
0006  * modify it under the terms of the GNU Lesser General Public
0007  * License as published by the Free Software Foundation; either
0008  * version 2.1 of the License, or (at your option) any later version.
0009  *
0010  * This library is distributed in the hope that it will be useful,
0011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
0013  * Lesser General Public License for more details.
0014  *
0015  * You should have received a copy of the GNU Lesser General Public
0016  * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
0017  */
0018 
0019 #ifndef KRSCRIPTCONSTANTS_H
0020 #define KRSCRIPTCONSTANTS_H
0021 
0022 #include <QObject>
0023 
0024 /**
0025  @brief Helper giving access to various scripting constants
0026 
0027  Contains methods for retreiving the current page number, page total
0028  and access to the PenStyle enums from user scripts
0029  */
0030 class KReportScriptConstants : public QObject
0031 {
0032     Q_OBJECT
0033 public:
0034     explicit KReportScriptConstants(QObject *parent = nullptr);
0035 
0036     ~KReportScriptConstants() override;
0037     Q_ENUMS(PenStyle)
0038 
0039     //!Enum values for pen styles that can be accessed from user scripts using
0040     //! \code
0041     //! constants.QtSolidLine
0042     //! \endcode
0043     //! for example
0044     enum PenStyle {QtNoPen, QtSolidLine, QtDashLine, QtDotLine, QtDashDotLine, QtDashDotDotLine};
0045 
0046     void setPageNumber(int p) {
0047         m_currentPage = p;
0048     }
0049     void setPageTotal(int t) {
0050         m_totalPages = t;
0051     };
0052 public Q_SLOTS:
0053 
0054     //! @return the current page number
0055     int PageNumber() {
0056         return m_currentPage;
0057     };
0058 
0059     //! @return the total number of pages
0060     int PageTotal() {
0061         return m_totalPages;
0062     };
0063 
0064 private:
0065     int m_currentPage;
0066     int m_totalPages;
0067 
0068 
0069 };
0070 
0071 #endif