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()
const 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();
342 void copyCommonProperties( QgsAbstractReportSection *destination )
const;
347 virtual void setParentSection( QgsAbstractReportSection *parent ) { mParent = parent; }
354 virtual bool writePropertiesToElement( QDomElement &element, QDomDocument &document,
const QgsReadWriteContext &context )
const;
361 virtual bool readPropertiesFromElement(
const QDomElement &element,
const QDomDocument &document,
const QgsReadWriteContext &context );
365 QgsAbstractReportSection *mParent =
nullptr;
367 int mSectionNumber = 0;
368 SubSection mNextSection = Header;
372 bool mHeaderEnabled =
false;
373 bool mFooterEnabled =
false;
374 std::unique_ptr< QgsLayout > mHeader;
375 std::unique_ptr< QgsLayout > mFooter;
377 QList< QgsAbstractReportSection * > mChildren;
379 QgsReportSectionContext mContext;
382 QgsAbstractReportSection(
const QgsAbstractReportSection &other );
388 #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 interface for classes which can visit style entity (e.g.
An abstract base class for QgsLayout based classes which can be exported by QgsLayoutExporter.
virtual QgsLayout * layout()=0
Returns the layout associated with the iterator.
Encapsulates a QGIS project, including sets of map layers and their styles, layouts, annotations, canvases, etc.
Base class for layouts, which can contain items such as maps, labels, scalebars, etc.
virtual int count() const =0
Returns the number of features to iterate over.
#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...