Warning, file /office/calligra/libs/flake/KoShapeBasedDocumentBase.cpp 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 0003 Copyright (C) 2006, 2010 Thomas Zander <zander@kde.org> 0004 Copyright (C) 2011 Jan Hambrecht <jaham@gmx.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 0022 #include "KoShapeBasedDocumentBase.h" 0023 #include "KoDocumentResourceManager.h" 0024 #include "KoShapeRegistry.h" 0025 0026 #include <kconfig.h> 0027 #include <kconfiggroup.h> 0028 #include <ksharedconfig.h> 0029 0030 class KoShapeBasedDocumentBasePrivate 0031 { 0032 public: 0033 KoShapeBasedDocumentBasePrivate() 0034 : resourceManager(new KoDocumentResourceManager()) 0035 { 0036 KoShapeRegistry *registry = KoShapeRegistry::instance(); 0037 foreach (const QString &id, registry->keys()) { 0038 KoShapeFactoryBase *shapeFactory = registry->value(id); 0039 shapeFactory->newDocumentResourceManager(resourceManager); 0040 } 0041 // read persistent application wide resources 0042 KSharedConfigPtr config = KSharedConfig::openConfig(); 0043 if (config->hasGroup("Misc")) { 0044 KConfigGroup miscGroup = config->group("Misc"); 0045 const qreal pasteOffset = miscGroup.readEntry("CopyOffset", 10.0); 0046 resourceManager->setPasteOffset(pasteOffset); 0047 const bool pasteAtCursor = miscGroup.readEntry("PasteAtCursor", true); 0048 resourceManager->enablePasteAtCursor(pasteAtCursor); 0049 const uint grabSensitivity = miscGroup.readEntry("GrabSensitivity", 3); 0050 resourceManager->setGrabSensitivity(grabSensitivity); 0051 const uint handleRadius = miscGroup.readEntry("HandleRadius", 3); 0052 resourceManager->setHandleRadius(handleRadius); 0053 } 0054 } 0055 0056 ~KoShapeBasedDocumentBasePrivate() 0057 { 0058 delete resourceManager; 0059 } 0060 0061 KoDocumentResourceManager *resourceManager; 0062 }; 0063 0064 KoShapeBasedDocumentBase::KoShapeBasedDocumentBase() 0065 : d(new KoShapeBasedDocumentBasePrivate()) 0066 { 0067 } 0068 0069 KoShapeBasedDocumentBase::~KoShapeBasedDocumentBase() 0070 { 0071 delete d; 0072 } 0073 0074 void KoShapeBasedDocumentBase::shapesRemoved(const QList<KoShape*> & /*shapes*/, KUndo2Command * /*command*/) 0075 { 0076 } 0077 0078 KoDocumentResourceManager *KoShapeBasedDocumentBase::resourceManager() const 0079 { 0080 return d->resourceManager; 0081 }