22#include <KPluginFactory>
23#include <QPluginLoader>
24#include <QMutexLocker>
34 Private(
const QString &_id,
const QString &_name,
const QString &_deferredPluginName)
36 deferredPluginName(_deferredPluginName),
67 : d(new
Private(id, name, deferredPluginName))
98 return d->loadingPriority;
103 return d->xmlElements;
110 d->templates.append(tmplate);
140 d->loadingPriority = priority;
145 d->xmlElements.clear();
146 d->xmlElements.append(QPair<QString, QStringList>(nameSpace, names));
151 d->xmlElements = elementNamesList;
166 d->resourceManagers.append(manager);
172 if (!
d->deferredPluginName.isEmpty()) {
174 Q_ASSERT(
d->deferredFactory);
175 if (
d->deferredFactory) {
176 return d->deferredFactory->createDefaultShape(documentResources);
185 if (!
d->deferredPluginName.isEmpty()) {
187 Q_ASSERT(
d->deferredFactory);
188 if (
d->deferredFactory) {
189 return d->deferredFactory->createShape(properties, documentResources);
197 QMutexLocker(&
d->pluginLoadingMutex);
198 if (
d->deferredFactory)
return;
202 Q_ASSERT(offers.size() > 0);
205 KPluginFactory *factory = qobject_cast<KPluginFactory *>(pluginLoader.
instance());
209 d->deferredFactory = plugin;
222 d->resourceManagers = rms;
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
virtual QString deferredPluginName()=0
static KoJsonTrader * instance()
QList< Plugin > query(const QString &servicetype, const QString &mimetype)
QList< QPointer< KoDocumentResourceManager > > resourceManagers
~KoShapeFactoryBase() override
void addTemplate(const KoShapeTemplate ¶ms)
void pruneDocumentResourceManager(QObject *)
called whenever a document KoDocumentResourceManager is deleted
void setFamily(const QString &family)
Private(const QString &_id, const QString &_name, const QString &_deferredPluginName)
void setHidden(bool hidden)
QList< QPair< QString, QStringList > > xmlElements
void setToolTip(const QString &tooltip)
QList< KoShapeTemplate > templates
QMutex pluginLoadingMutex
virtual void newDocumentResourceManager(KoDocumentResourceManager *manager) const
virtual KoShape * createDefaultShape(KoDocumentResourceManager *documentResources=0) const
QString deferredPluginName
void setLoadingPriority(int priority)
void setIconName(const char *iconName)
void setXmlElements(const QList< QPair< QString, QStringList > > &elementNamesList)
void setXmlElementNames(const QString &nameSpace, const QStringList &elementNames)
QList< QPair< QString, QStringList > > odfElements() const
KoDeferredShapeFactoryBase * deferredFactory
virtual KoShape * createShape(const KoProperties *params, KoDocumentResourceManager *documentResources=0) const
KoShapeFactoryBase(const QString &id, const QString &name, const QString &deferredPluginName=QString())
QObject * instance() const
QString id
The id of the shape.
const KoProperties * properties