Warning, file /office/calligra/libs/flake/KoToolBase_p.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-2010 Thomas Zander <zander@kde.org> 0003 * Copyright (C) 2010 KO GmbH <boud@kogmbh.com> 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 KOTOOLBASE_P_H 0022 #define KOTOOLBASE_P_H 0023 0024 #include "KoDocumentResourceManager.h" 0025 #include "KoCanvasResourceManager.h" 0026 #include "KoCanvasBase.h" 0027 #include "KoShapeController.h" 0028 #include <QMap> 0029 #include <QHash> 0030 #include <QWidget> 0031 #include <QString> 0032 #include <QSet> 0033 #include <QPointer> 0034 #include <string.h> // for the qt version check 0035 0036 class QWidget; 0037 class QAction; 0038 class KoToolBase; 0039 class KoCanvasBase; 0040 0041 class KoToolBasePrivate 0042 { 0043 public: 0044 KoToolBasePrivate(KoToolBase *qq, KoCanvasBase *canvas_) 0045 : currentCursor(Qt::ArrowCursor), 0046 q(qq), 0047 canvas(canvas_), 0048 isInTextMode(false) 0049 { 0050 } 0051 0052 ~KoToolBasePrivate() 0053 { 0054 foreach(QPointer<QWidget> optionWidget, optionWidgets) { 0055 if (optionWidget) { 0056 optionWidget->setParent(0); 0057 delete optionWidget; 0058 } 0059 } 0060 optionWidgets.clear(); 0061 } 0062 0063 void connectSignals() 0064 { 0065 if (canvas) { // in the case of KoToolManagers dummytool it can be zero :( 0066 KoCanvasResourceManager * crp = canvas->resourceManager(); 0067 Q_ASSERT_X(crp, "KoToolBase::KoToolBase", "No Canvas KoResourceManager"); 0068 if (crp) 0069 q->connect(crp, SIGNAL(canvasResourceChanged(int,QVariant)), 0070 SLOT(canvasResourceChanged(int,QVariant))); 0071 0072 // can be 0 in the case of Calligra Sheets 0073 KoDocumentResourceManager *scrm = canvas->shapeController()->resourceManager(); 0074 if (scrm) { 0075 q->connect(scrm, SIGNAL(resourceChanged(int,QVariant)), 0076 SLOT(documentResourceChanged(int,QVariant))); 0077 } 0078 } 0079 } 0080 0081 QList<QPointer<QWidget> > optionWidgets; ///< the optionwidgets associated with this tool 0082 QCursor currentCursor; 0083 QHash<QString, QAction *> actionCollection; 0084 QString toolId; 0085 QList<QAction*> popupActionList; 0086 QSet<QAction *> readOnlyActions; 0087 KoToolBase *q; 0088 KoCanvasBase *canvas; ///< the canvas interface this tool will work for. 0089 bool isInTextMode; 0090 }; 0091 0092 #endif