Warning, file /office/calligra/libs/flake/KoShapeRegistry.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) 2006 Boudewijn Rempt (boud@valdyas.org) 0003 * Copyright (C) 2006, 2010 Thomas Zander <zander@kde.org> 0004 * 0005 * This library is free software; you can redistribute it and/or 0006 * modify it under the terms of the GNU Library General Public 0007 * License as published by the Free Software Foundation; either 0008 * version 2 of the License, or (at your option) any later version. 0009 * 0010 * This library is distributed in the hope that it will be useful, 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0013 * Library General Public License for more details. 0014 * 0015 * You should have received a copy of the GNU Library General Public License 0016 * along with this library; see the file COPYING.LIB. If not, write to 0017 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0018 * Boston, MA 02110-1301, USA. 0019 */ 0020 0021 #ifndef KOSHAPEREGISTRY_H 0022 #define KOSHAPEREGISTRY_H 0023 0024 #include <KoGenericRegistry.h> 0025 #include <KoShapeFactoryBase.h> 0026 0027 #include "flake_export.h" 0028 0029 class KoShape; 0030 class KoShapeLoadingContext; 0031 0032 0033 /** 0034 * This singleton class keeps a register of all available flake shapes, 0035 * or rather, of the factories that applications can use to create flake 0036 * shape objects. 0037 */ 0038 class FLAKE_EXPORT KoShapeRegistry : public KoGenericRegistry<KoShapeFactoryBase*> 0039 { 0040 public: 0041 KoShapeRegistry(); 0042 ~KoShapeRegistry() override; 0043 0044 /** 0045 * Return an instance of the KoShapeRegistry 0046 * Creates an instance if that has never happened before and returns the singleton instance. 0047 */ 0048 static KoShapeRegistry *instance(); 0049 0050 /** 0051 * Add shape factory for a shape that is not a plugin 0052 * This can be used also if you want to have a shape only in one application 0053 * 0054 * @param factory The factory of the shape 0055 */ 0056 void addFactory(KoShapeFactoryBase *factory); 0057 0058 /** 0059 * Use the element to find out which flake plugin can load it, and 0060 * returns the loaded shape. The element expected is one of 0061 * 'draw:line', 'draw:frame' / etc. 0062 * 0063 * @returns the shape or 0 if no shape could be created. The shape may have as its parent 0064 * set a layer which was previously created and stored in the context. 0065 * @see KoShapeLoadingContext::layer() 0066 */ 0067 KoShape *createShapeFromOdf(const KoXmlElement &element, KoShapeLoadingContext &context) const; 0068 0069 /** 0070 * Returns a list of shape factories supporting the specified xml element. 0071 * @param nameSpace the namespace of the xml element, see KoXmlNS for valid namespaces 0072 * @param elementName the tag name of the element 0073 * @return the list of shape factories supporting the specified xml element 0074 */ 0075 QList<KoShapeFactoryBase*> factoriesForElement(const QString &nameSpace, const QString &elementName); 0076 0077 private: 0078 KoShapeRegistry(const KoShapeRegistry&); 0079 KoShapeRegistry operator=(const KoShapeRegistry&); 0080 0081 class Private; 0082 Private * const d; 0083 }; 0084 0085 #endif