Warning, file /office/calligra/libs/text/KoInlineObjectRegistry.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-2007 Thomas Zander <zander@kde.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 KOINLINEOBJECTREGISTRY_H 0021 #define KOINLINEOBJECTREGISTRY_H 0022 0023 #include <KoGenericRegistry.h> 0024 #include <KoInlineObjectFactoryBase.h> 0025 #include <KoXmlReaderForward.h> 0026 #include "kotext_export.h" 0027 #include <QList> 0028 0029 class KoCanvasBase; 0030 class QAction; 0031 class KoShapeLoadingContext; 0032 0033 /** 0034 * This singleton class keeps a register of all available InlineObject factories. 0035 * @see KoInlineObjectFactoryBase 0036 * @see KoInlineTextObjectManager 0037 * @see KoInlineObject 0038 * @see KoVariable 0039 */ 0040 class KOTEXT_EXPORT KoInlineObjectRegistry : public KoGenericRegistry<KoInlineObjectFactoryBase*> 0041 { 0042 public: 0043 KoInlineObjectRegistry(); 0044 ~KoInlineObjectRegistry() override; 0045 0046 /** 0047 * Return an instance of the KoInlineObjectRegistry 0048 * Creates an instance if that has never happened before and returns the singleton instance. 0049 */ 0050 static KoInlineObjectRegistry *instance(); 0051 0052 /** 0053 * Create a list of actions that can be used to plug into a menu, for example. 0054 * This method will find all the InlineObjectFactories that are installed in the system and 0055 * find out which object they provide. If a factory provides a variable, then all its 0056 * templates will be added to the response. 0057 * Each of these actions, when executed, will insert the relevant variable in the current text-position. 0058 * The actions assume that the text tool is selected, if that's not the case then they will silently fail. 0059 * @param host the canvas for which these actions are created. Note that the actions will get these 0060 * actions as a parent (for memory management purposes) as well. 0061 * @see KoInlineTextObjectManager::createInsertVariableActions() 0062 */ 0063 QList<QAction*> createInsertVariableActions(KoCanvasBase *host) const; 0064 0065 /** 0066 * Use the element to find out which variable plugin can load it, and returns the loaded 0067 * variable. The element expected is one of 'text:subject', 'text:date' / etc. 0068 * 0069 * @returns the variable or 0 if no variable could be created 0070 */ 0071 KoInlineObject *createFromOdf(const KoXmlElement &element, KoShapeLoadingContext &context) const; 0072 0073 private: 0074 KoInlineObjectRegistry(const KoInlineObjectRegistry&); 0075 KoInlineObjectRegistry operator=(const KoInlineObjectRegistry&); 0076 0077 class Private; 0078 Private * const d; 0079 }; 0080 0081 #endif