File indexing completed on 2024-05-12 15:56:39
0001 /* This file is part of the KDE project 0002 * SPDX-FileCopyrightText: 2010 Boudewijn Rempt (boud@valdyas.org) 0003 * 0004 * SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 #ifndef KODEFERREDSHAPEFACTORYBASE_H 0008 #define KODEFERREDSHAPEFACTORYBASE_H 0009 0010 #include "kritaflake_export.h" 0011 0012 #include <QObject> 0013 0014 class KoShape; 0015 class KoDocumentResourceManager; 0016 class KoProperties; 0017 0018 class QString; 0019 0020 /** 0021 * A factory for KoShape objects. This factory differs from the public KoShapeFactorBase 0022 * class that this class really creates the shape; it's the plugin entry point for the 0023 * actually shape plugins. 0024 */ 0025 class KRITAFLAKE_EXPORT KoDeferredShapeFactoryBase : public QObject 0026 { 0027 Q_OBJECT 0028 public: 0029 0030 explicit KoDeferredShapeFactoryBase(QObject *parent); 0031 0032 ~KoDeferredShapeFactoryBase() override; 0033 0034 virtual QString deferredPluginName() = 0; 0035 0036 /** 0037 * This method should be implemented by factories to create a shape that the user 0038 * gets when doing a base insert. For example from a script. The created shape 0039 * should have its values set to good defaults that the user can then adjust further if 0040 * needed. Including the KoShape:setShapeId(), with the Id from this factory 0041 * The default shape position is not relevant, it will be moved by the caller. 0042 * @param documentResources the resources manager that has all the document wide 0043 * resources which can be used to create the object. 0044 * @return a new shape 0045 * @see createShape() newDocumentResourceManager() 0046 */ 0047 virtual KoShape *createDefaultShape(KoDocumentResourceManager *documentResources = 0) const = 0; 0048 0049 /** 0050 * This method should be implemented by factories to create a shape based on a set of 0051 * properties that are specifically made for this shape-type. 0052 * This method should also set this factories shapeId on the shape using KoShape::setShapeId() 0053 * The default implementation just ignores 'params' and calls createDefaultShape() 0054 * @return a new shape 0055 * @param params the properties object is the same as added in the addTemplate() call 0056 * @param documentResources the resources manager that has all the document wide 0057 * resources which can be used to create the object. 0058 * @see createDefaultShape() newDocumentResourceManager() 0059 * @see KoShapeTemplate::properties 0060 */ 0061 virtual KoShape *createShape(const KoProperties *params, KoDocumentResourceManager *documentResources = 0) const; 0062 0063 }; 0064 0065 #endif