KReport

KReportScriptHandler.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
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
32class QJSEngine;
33class KReportDocument;
34class OROPage;
36
37namespace Scripting
38{
39class Report;
40class 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 */
49class KREPORT_EXPORT KReportScriptHandler : public QObject
50{
51 Q_OBJECT
52public:
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
61public 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
70Q_SIGNALS:
71 void groupChanged(const QMap<QString, QVariant> &groupData);
72
73private:
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
Top level report document definition. A KReportDocment defines the design of a document,...
Helper for the scripting API to display user messages.
Helper giving access to drawing functions.
Abstraction of report script source.
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...
Report object user scripting API.
Field item script interface.
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 24 2025 11:54:26 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.