16 #ifndef QGSABSTRACTREPORTSECTION_H 17 #define QGSABSTRACTREPORTSECTION_H 19 #include "qgis_core.h" 37 class CORE_EXPORT QgsReportSectionContext
48 QVariantMap fieldFilters;
64 if ( dynamic_cast< QgsReportSectionFieldGroup * >( sipCpp ) )
65 sipType = sipType_QgsReportSectionFieldGroup;
66 else if ( dynamic_cast< QgsReportSectionLayout * >( sipCpp ) )
67 sipType = sipType_QgsReportSectionLayout;
79 QgsAbstractReportSection( QgsAbstractReportSection *parentSection =
nullptr );
81 ~QgsAbstractReportSection()
override;
84 QgsAbstractReportSection(
const QgsAbstractReportSection &other ) =
delete;
87 QgsAbstractReportSection &operator=(
const QgsAbstractReportSection &other ) =
delete;
92 virtual QString type()
const = 0;
97 virtual QString description()
const = 0;
102 virtual QIcon icon()
const = 0;
111 virtual QgsAbstractReportSection *clone()
const = 0
SIP_FACTORY;
116 QgsAbstractReportSection *parentSection() {
return mParent; }
124 int count()
override {
return -1; }
126 QString
filePath(
const QString &baseFilePath,
const QString &extension )
override;
129 bool next()
override;
135 virtual void reset();
143 virtual bool prepareHeader();
151 virtual bool prepareFooter();
159 virtual QgsLayout *nextBody(
bool &ok
SIP_OUT ) { ok =
false;
return nullptr; }
167 bool headerEnabled()
const {
return mHeaderEnabled; }
175 void setHeaderEnabled(
bool enabled ) { mHeaderEnabled = enabled; }
184 QgsLayout *header() {
return mHeader.get(); }
202 bool footerEnabled()
const {
return mFooterEnabled; }
210 void setFooterEnabled(
bool enabled ) { mFooterEnabled = enabled; }
219 QgsLayout *footer() {
return mFooter.get(); }
236 int childCount()
const {
return mChildren.count(); }
252 QList< QgsAbstractReportSection * > childSections()
const {
return mChildren; }
258 QgsAbstractReportSection *childSection(
int index );
265 void appendChild( QgsAbstractReportSection *section
SIP_TRANSFER );
272 void insertChild(
int index, QgsAbstractReportSection *section
SIP_TRANSFER );
278 void removeChild( QgsAbstractReportSection *section );
284 void removeChildAt(
int index );
290 void setContext(
const QgsReportSectionContext &context );
296 const QgsReportSectionContext &context()
const {
return mContext; }
302 bool writeXml( QDomElement &parentElement, QDomDocument &document,
const QgsReadWriteContext &context )
const;
308 bool readXml(
const QDomElement §ionElement,
const QDomDocument &document,
const QgsReadWriteContext &context );
313 virtual void reloadSettings();
331 void copyCommonProperties( QgsAbstractReportSection *destination )
const;
336 virtual void setParentSection( QgsAbstractReportSection *parent ) { mParent = parent; }
343 virtual bool writePropertiesToElement( QDomElement &element, QDomDocument &document,
const QgsReadWriteContext &context )
const;
350 virtual bool readPropertiesFromElement(
const QDomElement &element,
const QDomDocument &document,
const QgsReadWriteContext &context );
354 QgsAbstractReportSection *mParent =
nullptr;
356 int mSectionNumber = 0;
357 SubSection mNextSection = Header;
361 bool mHeaderEnabled =
false;
362 bool mFooterEnabled =
false;
363 std::unique_ptr< QgsLayout > mHeader;
364 std::unique_ptr< QgsLayout > mFooter;
366 QList< QgsAbstractReportSection * > mChildren;
368 QgsReportSectionContext mContext;
371 QgsAbstractReportSection(
const QgsAbstractReportSection &other );
377 #endif //QGSABSTRACTREPORTSECTION_H The class is used as a container of context for various read/write operations on other objects...
virtual bool endRender()=0
Ends the render, performing any required cleanup tasks.
virtual bool next()=0
Iterates to next feature, returning false if no more features exist to iterate over.
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
An abstract base class for QgsLayout based classes which can be exported by QgsLayoutExporter.
virtual int count()=0
Returns the number of features to iterate over.
virtual QgsLayout * layout()=0
Returns the layout associated with the iterator.
Reads and writes project states.
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Represents a vector layer which manages a vector based data sets.
virtual bool beginRender()=0
Called when rendering begins, before iteration commences.
virtual QString filePath(const QString &baseFilePath, const QString &extension)=0
Returns the file path for the current feature, based on a specified base file path and extension...