16#ifndef QGSABSTRACTREPORTSECTION_H
17#define QGSABSTRACTREPORTSECTION_H
35class CORE_EXPORT QgsReportSectionContext
43 QgsVectorLayer *currentLayer =
nullptr;
46 QVariantMap fieldFilters;
61 if (
dynamic_cast< QgsReportSectionFieldGroup *
>( sipCpp ) )
62 sipType = sipType_QgsReportSectionFieldGroup;
63 else if (
dynamic_cast< QgsReportSectionLayout *
>( sipCpp ) )
64 sipType = sipType_QgsReportSectionLayout;
76 QgsAbstractReportSection( QgsAbstractReportSection *parentSection =
nullptr );
78 ~QgsAbstractReportSection()
override;
79 QgsAbstractReportSection(
const QgsAbstractReportSection &other ) =
delete;
80 QgsAbstractReportSection &operator=(
const QgsAbstractReportSection &other ) =
delete;
85 virtual QString type()
const = 0;
90 virtual QString description()
const = 0;
95 virtual QIcon icon()
const = 0;
104 virtual QgsAbstractReportSection *clone()
const = 0
SIP_FACTORY;
109 QgsAbstractReportSection *parentSection() {
return mParent; }
114 QgsProject *project();
117 int count()
const override {
return -1; }
119 QString filePath(
const QString &baseFilePath,
const QString &extension )
override;
120 QgsLayout *layout()
override;
121 bool beginRender()
override;
122 bool next()
override;
123 bool endRender()
override;
128 virtual void reset();
136 virtual bool prepareHeader();
144 virtual bool prepareFooter();
152 virtual QgsLayout *nextBody(
bool &ok
SIP_OUT ) { ok =
false;
return nullptr; }
160 bool headerEnabled()
const {
return mHeaderEnabled; }
168 void setHeaderEnabled(
bool enabled ) { mHeaderEnabled = enabled; }
177 QgsLayout *header() {
return mHeader.get(); }
195 bool footerEnabled()
const {
return mFooterEnabled; }
203 void setFooterEnabled(
bool enabled ) { mFooterEnabled = enabled; }
212 QgsLayout *footer() {
return mFooter.get(); }
229 int childCount()
const {
return mChildren.count(); }
245 QList< QgsAbstractReportSection * > childSections()
const {
return mChildren; }
251 QgsAbstractReportSection *childSection(
int index );
258 void appendChild( QgsAbstractReportSection *section
SIP_TRANSFER );
265 void insertChild(
int index, QgsAbstractReportSection *section
SIP_TRANSFER );
271 void removeChild( QgsAbstractReportSection *section );
277 void removeChildAt(
int index );
283 void setContext(
const QgsReportSectionContext &context );
289 const QgsReportSectionContext &context()
const {
return mContext; }
295 bool writeXml( QDomElement &parentElement, QDomDocument &document,
const QgsReadWriteContext &context )
const;
301 bool readXml(
const QDomElement §ionElement,
const QDomDocument &document,
const QgsReadWriteContext &context );
306 virtual void reloadSettings();
317 bool accept( QgsStyleEntityVisitorInterface *visitor )
const;
335 void copyCommonProperties( QgsAbstractReportSection *destination )
const;
340 virtual void setParentSection( QgsAbstractReportSection *parent ) { mParent = parent; }
347 virtual bool writePropertiesToElement( QDomElement &element, QDomDocument &document,
const QgsReadWriteContext &context )
const;
354 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)