Warning, file /office/calligra/libs/flake/KoDeferredShapeFactoryBase.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /* This file is part of the KDE project
0002  * Copyright (c) 2010 Boudewijn Rempt (boud@valdyas.org)
0003  *
0004  * This library is free software; you can redistribute it and/or
0005  * modify it under the terms of the GNU Library General Public
0006  * License as published by the Free Software Foundation; either
0007  * version 2 of the License, or (at your option) any later version.
0008  *
0009  * This library is distributed in the hope that it will be useful,
0010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
0011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0012  * Library General Public License for more details.
0013  *
0014  * You should have received a copy of the GNU Library General Public License
0015  * along with this library; see the file COPYING.LIB.  If not, write to
0016  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0017  * Boston, MA 02110-1301, USA.
0018  */
0019 
0020 #ifndef KODEFERREDSHAPEFACTORYBASE_H
0021 #define KODEFERREDSHAPEFACTORYBASE_H
0022 
0023 #include "flake_export.h"
0024 
0025 #include <QObject>
0026 
0027 class KoShape;
0028 class KoDocumentResourceManager;
0029 class KoProperties;
0030 
0031 class QString;
0032 
0033 /**
0034  * A factory for KoShape objects. This factory differs from the public KoShapeFactorBase
0035  * class that this class really creates the shape; it's the plugin entry point for the
0036  * actually shape plugins.
0037  */
0038 class FLAKE_EXPORT KoDeferredShapeFactoryBase : public QObject
0039 {
0040     Q_OBJECT
0041 public:
0042 
0043     explicit KoDeferredShapeFactoryBase(QObject *parent);
0044 
0045     ~KoDeferredShapeFactoryBase() override;
0046 
0047     virtual QString deferredPluginName() = 0;
0048 
0049     /**
0050      * This method should be implemented by factories to create a shape that the user
0051      * gets when doing a base insert. For example from a script.  The created shape
0052      * should have its values set to good defaults that the user can then adjust further if
0053      * needed.  Including the KoShape:setShapeId(), with the Id from this factory
0054      * The default shape position is not relevant, it will be moved by the caller.
0055      * @param documentResources the resources manager that has all the document wide
0056      *      resources which can be used to create the object.
0057      * @return a new shape
0058      * @see createShape() newDocumentResourceManager()
0059      */
0060     virtual KoShape *createDefaultShape(KoDocumentResourceManager *documentResources = 0) const = 0;
0061 
0062     /**
0063      * This method should be implemented by factories to create a shape based on a set of
0064      * properties that are specifically made for this shape-type.
0065      * This method should also set this factories shapeId on the shape using KoShape::setShapeId()
0066      * The default implementation just ignores 'params' and calls createDefaultShape()
0067      * @return a new shape
0068      * @param params the properties object is the same as added in the addTemplate() call
0069      * @param documentResources the resources manager that has all the document wide
0070      *      resources which can be used to create the object.
0071      * @see createDefaultShape() newDocumentResourceManager()
0072      * @see KoShapeTemplate::properties
0073      */
0074     virtual KoShape *createShape(const KoProperties *params, KoDocumentResourceManager *documentResources = 0) const;
0075 
0076 };
0077 
0078 #endif