File indexing completed on 2024-05-12 15:56:49
0001 /* This file is part of the KDE project 0002 * SPDX-FileCopyrightText: 2006 Boudewijn Rempt (boud@valdyas.org) 0003 * SPDX-FileCopyrightText: 2006, 2010 Thomas Zander <zander@kde.org> 0004 * 0005 * SPDX-License-Identifier: LGPL-2.0-or-later 0006 */ 0007 0008 #ifndef KOSHAPEREGISTRY_H 0009 #define KOSHAPEREGISTRY_H 0010 0011 #include <KoGenericRegistry.h> 0012 #include <KoShapeFactoryBase.h> 0013 #include <QDomDocument> 0014 0015 #include "kritaflake_export.h" 0016 0017 class KoShape; 0018 class KoShapeLoadingContext; 0019 0020 0021 /** 0022 * This singleton class keeps a register of all available flake shapes, 0023 * or rather, of the factories that applications can use to create flake 0024 * shape objects. 0025 */ 0026 class KRITAFLAKE_EXPORT KoShapeRegistry : public KoGenericRegistry<KoShapeFactoryBase*> 0027 { 0028 public: 0029 KoShapeRegistry(); 0030 ~KoShapeRegistry() override; 0031 0032 /** 0033 * Return an instance of the KoShapeRegistry 0034 * Creates an instance if that has never happened before and returns the singleton instance. 0035 */ 0036 static KoShapeRegistry *instance(); 0037 0038 /** 0039 * Add shape factory for a shape that is not a plugin 0040 * This can be used also if you want to have a shape only in one application 0041 * 0042 * @param factory The factory of the shape 0043 */ 0044 void addFactory(KoShapeFactoryBase *factory); 0045 0046 /** 0047 * Returns a list of shape factories supporting the specified xml element. 0048 * @param nameSpace the namespace of the xml element, see KoXmlNS for valid namespaces 0049 * @param elementName the tag name of the element 0050 * @return the list of shape factories supporting the specified xml element 0051 */ 0052 QList<KoShapeFactoryBase*> factoriesForElement(const QString &nameSpace, const QString &elementName); 0053 0054 private: 0055 KoShapeRegistry(const KoShapeRegistry&); 0056 KoShapeRegistry operator=(const KoShapeRegistry&); 0057 0058 class Private; 0059 Private * const d; 0060 }; 0061 0062 #endif