Warning, file /office/calligra/libs/flake/KoResourceManager_p.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /* 0002 Copyright (c) 2006, 2011 Boudewijn Rempt (boud@valdyas.org) 0003 Copyright (C) 2007, 2009, 2010 Thomas Zander <zander@kde.org> 0004 Copyright (c) 2008 Carlos Licea <carlos.licea@kdemail.net> 0005 0006 This library is free software; you can redistribute it and/or 0007 modify it under the terms of the GNU Library General Public 0008 License as published by the Free Software Foundation; either 0009 version 2 of the License, or (at your option) any later version. 0010 0011 This library is distributed in the hope that it will be useful, 0012 but WITHOUT ANY WARRANTY; without even the implied warranty of 0013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0014 Library General Public License for more details. 0015 0016 You should have received a copy of the GNU Library General Public License 0017 along with this library; see the file COPYING.LIB. If not, write to 0018 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0019 Boston, MA 02110-1301, USA. 0020 */ 0021 #ifndef KO_RESOURCEMANAGER_P_H 0022 #define KO_RESOURCEMANAGER_P_H 0023 0024 #include <QList> 0025 #include <QVariant> 0026 #include <QSizeF> 0027 #include <QHash> 0028 0029 #include <KoColor.h> 0030 #include <KoUnit.h> 0031 0032 class KoShape; 0033 0034 class KoResourceManager 0035 { 0036 public: 0037 0038 KoResourceManager() {} 0039 0040 /** 0041 * Set a resource of any type. 0042 * @param key the integer key 0043 * @param value the new value for the key. 0044 * @see KoCanvasResourceManager::CanvasResource KoDocumentResourceManager::DocumentResource 0045 */ 0046 void setResource(int key, const QVariant &value); 0047 0048 /** 0049 * Set a resource of type KoColor. 0050 * @param key the integer key 0051 * @param color the new value for the key. 0052 * @see KoCanvasResourceManager::CanvasResource KoDocumentResourceManager::DocumentResource 0053 */ 0054 void setResource(int key, const KoColor &color); 0055 0056 /** 0057 * Set a resource of type KoShape*. 0058 * @param key the integer key 0059 * @param shape the new value for the key. 0060 * @see KoCanvasResourceManager::CanvasResource KoDocumentResourceManager::DocumentResource 0061 */ 0062 void setResource(int key, KoShape *shape); 0063 0064 /** 0065 * Set a resource of type KoUnit 0066 * @param key the integer key 0067 * @param unit the new value for the key. 0068 * @see KoCanvasResourceManager::CanvasResource KoDocumentResourceManager::DocumentResource 0069 */ 0070 void setResource(int key, const KoUnit &unit); 0071 0072 /** 0073 * Returns a qvariant containing the specified resource or a standard one if the 0074 * specified resource does not exist. 0075 * @param key the key 0076 * @see KoCanvasResourceManager::CanvasResource KoDocumentResourceManager::DocumentResource 0077 */ 0078 QVariant resource(int key) const; 0079 0080 /** 0081 * Return the resource determined by param key as a boolean. 0082 * @param key the indentifying key for the resource 0083 * @see KoCanvasResourceManager::CanvasResource KoDocumentResourceManager::DocumentResource 0084 */ 0085 bool boolResource(int key) const; 0086 0087 /** 0088 * Return the resource determined by param key as an integer. 0089 * @param key the indentifying key for the resource 0090 * @see KoCanvasResourceManager::CanvasResource KoDocumentResourceManager::DocumentResource 0091 */ 0092 int intResource(int key) const; 0093 0094 /** 0095 * Return the resource determined by param key as a KoColor. 0096 * @param key the indentifying key for the resource 0097 * @see KoCanvasResourceManager::CanvasResource KoDocumentResourceManager::DocumentResource 0098 */ 0099 KoColor koColorResource(int key) const; 0100 0101 /** 0102 * Return the resource determined by param key as a pointer to a KoShape. 0103 * @param key the indentifying key for the resource 0104 * @see KoCanvasResourceManager::CanvasResource KoDocumentResourceManager::DocumentResource 0105 */ 0106 KoShape *koShapeResource(int key) const; 0107 0108 /** 0109 * Return the resource determined by param key as a QString . 0110 * @param key the indentifying key for the resource 0111 * @see KoCanvasResourceManager::CanvasResource KoDocumentResourceManager::DocumentResource 0112 */ 0113 QString stringResource(int key) const; 0114 0115 /** 0116 * Return the resource determined by param key as a QSizeF. 0117 * @param key the indentifying key for the resource 0118 * @see KoCanvasResourceManager::CanvasResource KoDocumentResourceManager::DocumentResource 0119 */ 0120 QSizeF sizeResource(int key) const; 0121 0122 /** 0123 * Return the resource determined by param key as a KoUnit. 0124 * @param key the indentifying key for the resource 0125 * @see KoCanvasResourceManager::CanvasResource KoDocumentResourceManager::DocumentResource 0126 */ 0127 KoUnit unitResource(int key) const; 0128 0129 /** 0130 * Returns true if there is a resource set with the requested key. 0131 * @param key the indentifying key for the resource 0132 * @see KoCanvasResourceManager::CanvasResource KoDocumentResourceManager::DocumentResource 0133 */ 0134 bool hasResource(int key) const; 0135 0136 /** 0137 * Remove the resource with @p key from the provider. 0138 * @param key the key that will be used to remove the resource 0139 * @see KoCanvasResourceManager::CanvasResource KoDocumentResourceManager::DocumentResource 0140 */ 0141 void clearResource(int key); 0142 0143 private: 0144 KoResourceManager(const KoResourceManager&); 0145 KoResourceManager& operator=(const KoResourceManager&); 0146 0147 QHash<int, QVariant> m_resources; 0148 }; 0149 0150 #endif 0151