KReport

KReportScriptReport.h
1/* This file is part of the KDE project
2 * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk)
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#ifndef SCRIPTINGKRSCRIPTREPORT_H
18#define SCRIPTINGKRSCRIPTREPORT_H
19
20#include <QObject>
21#include <QtQml/QJSValue>
22#include <QMap>
23
24class KReportDocument;
25
26namespace Scripting
27{
28
29
30/**
31 @brief Report object user scripting API.
32
33 Contains methods for a report object which can be called by user scripts. \n
34
35 Example: \n
36 \code
37 function report()
38 {
39 this.OnOpen = function()
40 {
41 debug.print("Report opened!");
42 }
43 }
44 reportname.initialize(new report())
45 \endcode
46*/
47class Report : public QObject
48{
50public:
51 explicit Report(KReportDocument*);
52
53 ~Report() override;
54
55public Q_SLOTS:
56 //! @return the title of the report as a string
57 QString title() const;
58
59 //! @return the name of the report as a string
60 QString name() const;
61
62 //! @return the record source (data source, table, query etc) as a string
63 QString recordSource() const;
64
65 //! @return an object in the report given its name, or NULL
67
68 //! @return a section in the report given its name, or NULL
70
71
72 //! Assigns a user object to this report
73 void initialize(const QJSValue &val);
74
75 //! Executed when the report is opened. If a handler exists for this in the user object it is called.
76 void eventOnOpen();
77
78 //! Executed when the report is complete. If a handler exists for this in the user object it is called.
79 void eventOnComplete();
80
81 //! Executed when a new page is created. If a handler exists for this in the user object it is called.
82 void eventOnNewPage();
83
84private:
85 KReportDocument *m_reportData;
86 QJSValue m_scriptObject;
87 QMap<QString, QObject*> m_scriptObjMap;
88};
89
90}
91
92#endif
Top level report document definition. A KReportDocment defines the design of a document,...
Report object user scripting API.
void initialize(const QJSValue &val)
Assigns a user object to this report.
void eventOnNewPage()
Executed when a new page is created. If a handler exists for this in the user object it is called.
QString recordSource() const
void eventOnOpen()
Executed when the report is opened. If a handler exists for this in the user object it is called.
void eventOnComplete()
Executed when the report is complete. If a handler exists for this in the user object it is called.
QObject * objectByName(const QString &)
QObject * sectionByName(const QString &)
Field item script interface.
Q_OBJECTQ_OBJECT
Q_SLOTSQ_SLOTS
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:06:04 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.