File indexing completed on 2024-04-28 04:42:10

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  * Copyright (C) 2014 Jarosław Staniek <staniek@kde.org>
0005  *
0006  * This library is free software; you can redistribute it and/or
0007  * modify it under the terms of the GNU Lesser General Public
0008  * License as published by the Free Software Foundation; either
0009  * version 2.1 of the License, or (at your option) any later version.
0010  *
0011  * This library is distributed in the hope that it will be useful,
0012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
0014  * Lesser General Public License for more details.
0015  *
0016  * You should have received a copy of the GNU Lesser General Public
0017  * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
0018  */
0019 
0020 #ifndef __REPORTSECTION_H__
0021 #define __REPORTSECTION_H__
0022 
0023 #include <QWidget>
0024 
0025 #include "kreport_export.h"
0026 
0027 // forward declarations
0028 class QDomNode;
0029 class QDomDocument;
0030 class QDomElement;
0031 class QGraphicsItem;
0032 typedef QList<QGraphicsItem*> QGraphicsItemList;
0033 
0034 class KPropertySet;
0035 class KProperty;
0036 
0037 class KReportDesigner;
0038 class KReportZoomHandler;
0039 
0040 /*!
0041  * @brief This class is the base to all Report Section's visual representation.
0042  *
0043  * Contains the basic data and interface that all the sections need to work.
0044  */
0045 class KREPORT_EXPORT KReportDesignerSection : public QWidget
0046 {
0047     Q_OBJECT
0048 public:
0049     ~KReportDesignerSection() override;
0050 
0051     void setTitle(const QString & s);
0052     void buildXML(QDomDocument *doc, QDomElement *section);
0053     //! @todo 4.0: Use QDomElement
0054     void initFromXML(const QDomNode & section);
0055     QSize sizeHint() const override;
0056 
0057     /**
0058      * @brief Return the items in the section
0059      * Only return top-level items ... ie, items with no parent item
0060      * because child items are not full report-items, they are implementation
0061      * details of a report item and do not need to be counted individually
0062      *
0063      * @return QGraphicsItemList
0064      */
0065     QGraphicsItemList items() const;
0066 
0067     void setSectionCursor(const QCursor&);
0068     void unsetSectionCursor();
0069 
0070 protected Q_SLOTS:
0071     void slotResizeBarDragged(int delta, bool changeSet = true);
0072 
0073 protected:
0074     explicit KReportDesignerSection(KReportDesigner * rptdes,
0075                                     const KReportZoomHandler &zoomHandler);
0076 
0077 private Q_SLOTS:
0078     void slotPageOptionsChanged(KPropertySet &);
0079     void slotSceneClicked();
0080     void slotPropertyChanged(KPropertySet &, KProperty &);
0081 
0082 private:
0083     Q_DISABLE_COPY(KReportDesignerSection)
0084     class Private;
0085     Private * const d;
0086     friend class KReportDesigner;
0087     friend class KReportDesignerSectionTitle;
0088 };
0089 
0090 #endif
0091