KReport

KReportScriptHandler.h
1 /* This file is part of the KDE project
2  * Copyright (C) 2007-2008 by Adam Pigg ([email protected])
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef KRSCRIPTHANDLER_H
19 #define KRSCRIPTHANDLER_H
20 
21 #include "kreport_export.h"
22 #include "config-kreport.h"
23 
24 #ifdef KREPORT_SCRIPTING
25 #include "KReportScriptConstants.h"
26 #include "KReportDataSource.h"
27 #include <QtQml/QJSValue>
28 
29 class KReportScriptDebug;
30 class KReportScriptDraw;
31 class KReportSectionData;
32 class QJSEngine;
33 class KReportDocument;
34 class OROPage;
36 
37 namespace Scripting
38 {
39 class Report;
40 class Section;
41 }
42 
43 /*!
44  * @brief Handles scripting during report rendering.
45  *
46  * The script handler loads scriptable objects, and executes
47  * appropriate script code during report rendering
48  */
49 class KREPORT_EXPORT KReportScriptHandler : public QObject
50 {
51  Q_OBJECT
52 public:
53  KReportScriptHandler(const KReportDataSource *reportDataSource, KReportScriptSource *scriptSource, KReportDocument* reportDocument);
54  ~KReportScriptHandler() override;
55 
56  QVariant evaluate(const QString&);
57  void displayErrors();
58  QJSValue registerScriptObject(QObject*, const QString&);
59  bool trigger();
60 
61 public Q_SLOTS:
62 
63  void slotEnteredSection(KReportSectionData*, OROPage*, QPointF);
64  void slotEnteredGroup(const QString&, const QVariant&);
65  void slotExitedGroup(const QString&, const QVariant&);
66  void setPageNumber(int p);
67  void setPageTotal(int t);
68  void newPage();
69 
70 Q_SIGNALS:
71  void groupChanged(const QMap<QString, QVariant> &groupData);
72 
73 private:
74  //! @todo KEXI3 QString where();
75  Q_DISABLE_COPY(KReportScriptHandler)
76  class Private;
77  Private * const d;
78 };
79 
80 #else // !KREPORT_SCRIPTING
81 #define KReportScriptHandler void
82 #endif
83 
84 #endif
Q_SLOTSQ_SLOTS
Helper for the scripting API to display user messages.
KReportSectionData is used to store the information about a specific report section.
Represents a single page in a document and may contain zero or more OROPrimitive objects all of which...
Abstraction of report data source.
Q_SIGNALSQ_SIGNALS
Helper giving access to drawing functions.
Abstraction of report script source.
Field item script interface.
Top level report document definition. A KReportDocment defines the design of a document,...
Q_DISABLE_COPY(Class)
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Tue Feb 7 2023 04:17:37 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.