16#ifndef QGSABSTRACTREPORTSECTION_H
17#define QGSABSTRACTREPORTSECTION_H
35class CORE_EXPORT QgsReportSectionContext
42 QgsVectorLayer *currentLayer =
nullptr;
45 QVariantMap fieldFilters;
59 if (
dynamic_cast< QgsReportSectionFieldGroup *
>( sipCpp ) )
60 sipType = sipType_QgsReportSectionFieldGroup;
61 else if (
dynamic_cast< QgsReportSectionLayout *
>( sipCpp ) )
62 sipType = sipType_QgsReportSectionLayout;
74 QgsAbstractReportSection( QgsAbstractReportSection *parentSection =
nullptr );
76 ~QgsAbstractReportSection()
override;
77 QgsAbstractReportSection(
const QgsAbstractReportSection &other ) =
delete;
78 QgsAbstractReportSection &operator=(
const QgsAbstractReportSection &other ) =
delete;
83 virtual QString type()
const = 0;
88 virtual QString description()
const = 0;
93 virtual QIcon icon()
const = 0;
102 virtual QgsAbstractReportSection *clone()
const = 0
SIP_FACTORY;
107 QgsAbstractReportSection *parentSection() {
return mParent; }
112 QgsProject *project();
115 int count()
const override {
return -1; }
117 QString filePath(
const QString &baseFilePath,
const QString &extension )
override;
118 QgsLayout *layout()
override;
119 bool beginRender()
override;
120 bool next()
override;
121 bool endRender()
override;
126 virtual void reset();
134 virtual bool prepareHeader();
142 virtual bool prepareFooter();
150 virtual QgsLayout *nextBody(
bool &ok
SIP_OUT )
162 bool headerEnabled()
const {
return mHeaderEnabled; }
170 void setHeaderEnabled(
bool enabled ) { mHeaderEnabled = enabled; }
179 QgsLayout *header() {
return mHeader.get(); }
197 bool footerEnabled()
const {
return mFooterEnabled; }
205 void setFooterEnabled(
bool enabled ) { mFooterEnabled = enabled; }
214 QgsLayout *footer() {
return mFooter.get(); }
231 int childCount()
const {
return mChildren.count(); }
247 QList< QgsAbstractReportSection * > childSections()
const {
return mChildren; }
253 QgsAbstractReportSection *childSection(
int index );
260 void appendChild( QgsAbstractReportSection *section
SIP_TRANSFER );
267 void insertChild(
int index, QgsAbstractReportSection *section
SIP_TRANSFER );
273 void removeChild( QgsAbstractReportSection *section );
279 void removeChildAt(
int index );
285 void setContext(
const QgsReportSectionContext &context );
291 const QgsReportSectionContext &context()
const {
return mContext; }
297 bool writeXml( QDomElement &parentElement, QDomDocument &document,
const QgsReadWriteContext &context )
const;
303 bool readXml(
const QDomElement §ionElement,
const QDomDocument &document,
const QgsReadWriteContext &context );
308 virtual void reloadSettings();
319 bool accept( QgsStyleEntityVisitorInterface *visitor )
const;
336 void copyCommonProperties( QgsAbstractReportSection *destination )
const;
341 virtual void setParentSection( QgsAbstractReportSection *parent ) { mParent = parent; }
348 virtual bool writePropertiesToElement( QDomElement &element, QDomDocument &document,
const QgsReadWriteContext &context )
const;
355 virtual bool readPropertiesFromElement(
const QDomElement &element,
const QDomDocument &document,
const QgsReadWriteContext &context );
358 QgsAbstractReportSection *mParent =
nullptr;
360 int mSectionNumber = 0;
361 SubSection mNextSection = Header;
363 QgsLayout *mCurrentLayout =
nullptr;
365 bool mHeaderEnabled =
false;
366 bool mFooterEnabled =
false;
367 std::unique_ptr< QgsLayout > mHeader;
368 std::unique_ptr< QgsLayout > mFooter;
370 QList< QgsAbstractReportSection * > mChildren;
372 QgsReportSectionContext mContext;
375 QgsAbstractReportSection(
const QgsAbstractReportSection &other );
An abstract base class for QgsLayout based classes which can be exported by QgsLayoutExporter.
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)