Krita Source Code Documentation
Loading...
Searching...
No Matches
KoShapeFactoryBase.h
Go to the documentation of this file.
1/* This file is part of the KDE project
2 * SPDX-FileCopyrightText: 2006 Boudewijn Rempt (boud@valdyas.org)
3 * SPDX-FileCopyrightText: 2006-2007 Thomas Zander <zander@kde.org>
4 * SPDX-FileCopyrightText: 2008 Thorsten Zachmann <zachmann@kde.org>
5 *
6 * SPDX-License-Identifier: LGPL-2.0-or-later
7 */
8
9#ifndef KOSHAPEFACTORYBASE_H
10#define KOSHAPEFACTORYBASE_H
11
12#include <QObject>
13#include <QString>
14#include <QList>
15#include <QDomDocument>
16
17#include "kritaflake_export.h"
18#include <KisQStringListFwd.h>
19
20class KoShape;
21class KoProperties;
25
26
27#define SHAPETEMPLATE_MIMETYPE "application/x-flake-shapetemplate"
28#define SHAPEID_MIMETYPE "application/x-flake-shapeId"
29
35struct KRITAFLAKE_EXPORT KoShapeTemplate {
37 properties = 0;
38 }
39 QString id;
40 QString templateId;
41 QString name;
42 QString family;
43 QString toolTip;
44 QString iconName;
50};
51
74class KRITAFLAKE_EXPORT KoShapeFactoryBase : public QObject
75{
76 Q_OBJECT
77public:
78
84 KoShapeFactoryBase(const QString &id, const QString &name, const QString &deferredPluginName = QString());
85 ~KoShapeFactoryBase() override;
86
98
103 QString id() const;
113 QString toolTip() const;
118 QString iconName() const;
123 QString name() const;
128 QString family() const;
130 int loadingPriority() const;
131
135 QList<QPair<QString, QStringList> > odfElements() const;
136
139 virtual bool supports(const QDomElement &element, KoShapeLoadingContext &context) const = 0;
140
147 bool hidden() const;
148
168 virtual void newDocumentResourceManager(KoDocumentResourceManager *manager) const;
169
181 virtual KoShape *createDefaultShape(KoDocumentResourceManager *documentResources = 0) const;
182
195 virtual KoShape *createShape(const KoProperties *params, KoDocumentResourceManager *documentResources = 0) const;
196
197protected:
198
205 void addTemplate(const KoShapeTemplate &params);
206
211 void setToolTip(const QString &tooltip);
212
217 void setIconName(const char *iconName);
218
224 void setFamily(const QString &family);
225
231 void setLoadingPriority(int priority);
232
244 void setXmlElementNames(const QString &nameSpace, const QStringList &elementNames);
245
255 void setXmlElements(const QList<QPair<QString, QStringList> > &elementNamesList);
256
263 void setHidden(bool hidden);
264
265private:
266
267 void getDeferredPlugin();
268
269private Q_SLOTS:
270
272 void pruneDocumentResourceManager(QObject *);
273
274private:
275
276 class Private;
277 Private * const d;
278};
279
280#endif
QString name() const
int loadingPriority() const
lower prio means the shape is more generic and will be checked later
QString id() const
QString iconName() const
QString family() const
virtual bool supports(const QDomElement &element, KoShapeLoadingContext &context) const =0
QList< KoShapeTemplate > templates() const
bool hidden() const
virtual QList< KoShapeConfigWidgetBase * > createShapeOptionPanels()
QString iconName
Icon name.
QString family
The family of the shape (possible values are: "funny","arrow")
QString id
The id of the shape.
QString toolTip
The tooltip text for the template.
QString name
The name to be shown for this template.
const KoProperties * properties
QString templateId
The id of this particular template - only has to be unique with the shape.