QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
qgsmasterlayoutinterface.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgslayoutinterface.h
3  --------------------
4  begin : December 2017
5  copyright : (C) 2017 by Nyall Dawson
6  email : nyall dot dawson at gmail dot com
7  ***************************************************************************/
8 /***************************************************************************
9  * *
10  * This program is free software; you can redistribute it and/or modify *
11  * it under the terms of the GNU General Public License as published by *
12  * the Free Software Foundation; either version 2 of the License, or *
13  * (at your option) any later version. *
14  * *
15  ***************************************************************************/
16 #ifndef QGSLAYOUTINTERFACE_H
17 #define QGSLAYOUTINTERFACE_H
18 
19 #include "qgis_core.h"
20 #include "qgis_sip.h"
21 #include <QString>
22 #include <QIcon>
23 #include <QDomElement>
24 
25 class QgsProject;
28 
29 #ifdef SIP_RUN
30 % ModuleHeaderCode
31 #include "qgsprintlayout.h"
32 #include "qgsreport.h"
33 % End
34 #endif
35 
42 class CORE_EXPORT QgsMasterLayoutInterface
43 {
44 
45 #ifdef SIP_RUN
47  switch ( sipCpp->layoutType() )
48  {
50  sipType = sipType_QgsPrintLayout;
51  *sipCppRet = static_cast<QgsPrintLayout *>( sipCpp );
52  break;
54  *sipCppRet = static_cast<QgsReport *>( sipCpp );
55  sipType = sipType_QgsReport;
56  break;
57  default:
58  sipType = NULL;
59  }
60  SIP_END
61 #endif
62 
63  public:
64 
66  enum Type
67  {
68  PrintLayout = 0,
69  Report = 1,
70  };
71 
72  virtual ~QgsMasterLayoutInterface() = default;
73 
79 
84 
89  virtual QString name() const = 0;
90 
94  virtual QIcon icon() const = 0;
95 
100  virtual void setName( const QString &name ) = 0;
101 
106  virtual QgsProject *layoutProject() const = 0;
107 
112  virtual QDomElement writeLayoutXml( QDomDocument &document, const QgsReadWriteContext &context ) const = 0;
113 
118  virtual bool readLayoutXml( const QDomElement &layoutElement, const QDomDocument &document, const QgsReadWriteContext &context ) = 0;
119 
123  virtual void updateSettings() = 0;
124 
134  virtual bool layoutAccept( QgsStyleEntityVisitorInterface *visitor ) const { Q_UNUSED( visitor ); return true; }
135 
136 };
137 
138 #endif //QGSLAYOUTINTERFACE_H
139 
140 
141 
QgsMasterLayoutInterface::icon
virtual QIcon icon() const =0
Returns an icon for the layout.
QgsReadWriteContext
The class is used as a container of context for various read/write operations on other objects.
Definition: qgsreadwritecontext.h:35
QgsStyleEntityVisitorInterface
An interface for classes which can visit style entity (e.g.
Definition: qgsstyleentityvisitor.h:34
QgsMasterLayoutInterface::writeLayoutXml
virtual QDomElement writeLayoutXml(QDomDocument &document, const QgsReadWriteContext &context) const =0
Returns the layout's state encapsulated in a DOM element.
QgsMasterLayoutInterface::readLayoutXml
virtual bool readLayoutXml(const QDomElement &layoutElement, const QDomDocument &document, const QgsReadWriteContext &context)=0
Sets the layout's state from a DOM element.
QgsMasterLayoutInterface::PrintLayout
@ PrintLayout
Individual print layout (QgsPrintLayout)
Definition: qgsmasterlayoutinterface.h:68
QgsMasterLayoutInterface::clone
virtual QgsMasterLayoutInterface * clone() const =0
Creates a clone of the layout.
QgsProject
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
Definition: qgsproject.h:95
SIP_FACTORY
#define SIP_FACTORY
Definition: qgis_sip.h:76
QgsMasterLayoutInterface::layoutType
virtual QgsMasterLayoutInterface::Type layoutType() const =0
Returns the master layout type.
SIP_CONVERT_TO_SUBCLASS_CODE
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Definition: qgis_sip.h:177
QgsMasterLayoutInterface::setName
virtual void setName(const QString &name)=0
Sets the layout's name.
QgsPrintLayout
Print layout, a QgsLayout subclass for static or atlas-based layouts.
Definition: qgsprintlayout.h:31
qgsreport.h
QgsMasterLayoutInterface::layoutAccept
virtual bool layoutAccept(QgsStyleEntityVisitorInterface *visitor) const
Accepts the specified style entity visitor, causing it to visit all style entities associated with th...
Definition: qgsmasterlayoutinterface.h:134
qgis_sip.h
QgsMasterLayoutInterface::Type
Type
Master layout type.
Definition: qgsmasterlayoutinterface.h:67
QgsMasterLayoutInterface::name
virtual QString name() const =0
Returns the layout's name.
qgsprintlayout.h
QgsMasterLayoutInterface::Report
@ Report
Report (QgsReport)
Definition: qgsmasterlayoutinterface.h:69
QgsMasterLayoutInterface::~QgsMasterLayoutInterface
virtual ~QgsMasterLayoutInterface()=default
QgsMasterLayoutInterface
Interface for master layout type objects, such as print layouts and reports.
Definition: qgsmasterlayoutinterface.h:43
QgsMasterLayoutInterface::updateSettings
virtual void updateSettings()=0
Refreshes the layout when global layout related options change.
SIP_END
#define SIP_END
Definition: qgis_sip.h:194
QgsMasterLayoutInterface::layoutProject
virtual QgsProject * layoutProject() const =0
The project associated with the layout.