Warning, file /office/calligra/libs/flake/KoShapeConfigWidgetBase.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 KOSHAPECONFIGWIDGETBASE_H 0021 #define KOSHAPECONFIGWIDGETBASE_H 0022 0023 #include "KoCanvasResourceManager.h" 0024 0025 #include <QWidget> 0026 0027 #include "flake_export.h" 0028 0029 class KoShape; 0030 class KUndo2Command; 0031 class KoUnit; 0032 0033 /** 0034 * Base widget for shape-configuration panels. 0035 * This is an interface type class used by classes that intend to provide 0036 * a GUI for configuring newly created shapes as created by a KoShapeFactoryBase. 0037 * 0038 * Every time after a shape is created the KoShapeFactoryBase for that shape-type 0039 * will be queried for all the config widgets; both factory specific as well as 0040 * those set by the hosting application. 0041 * A dialog will be shown with all those panels, each extending this class. 0042 * The framework will then call open() to populate the widget with data from 0043 * the param shape. After the user ok-ed the dialog the save() will be called 0044 * to allow the widget to apply all settings from the widget to the shape. 0045 */ 0046 class FLAKE_EXPORT KoShapeConfigWidgetBase : public QWidget 0047 { 0048 Q_OBJECT 0049 public: 0050 /** 0051 * Default constructor 0052 */ 0053 KoShapeConfigWidgetBase(); 0054 ~KoShapeConfigWidgetBase() override; 0055 0056 /** 0057 * Open the argument shape by interpreting the data and setting that data on this 0058 * widget. 0059 * @param shape the shape that is to be queried for the data this widget can edit. 0060 */ 0061 virtual void open(KoShape *shape) = 0; 0062 /** 0063 * Save the data of this widget to the shape passed to open earlier to 0064 * apply any user changed options. 0065 * Called by the tool that created the shape. 0066 */ 0067 virtual void save() = 0; 0068 0069 /** 0070 * Overwrite this method to set the application unit type and update all unit-widgets 0071 * in this panel. 0072 * Called by the tool that created the shape using KoCavasBase::unit() 0073 * @param unit the new unit to show data in. 0074 */ 0075 virtual void setUnit(const KoUnit &unit); 0076 0077 /// called to set the canvas resource manager of the canvas the user used to insert the new shape. 0078 void setResourceManager(KoCanvasResourceManager *rm); 0079 0080 /// Return true if the shape config panel should be shown after the shape is created 0081 virtual bool showOnShapeCreate(); 0082 0083 /// Return true if the shape config panel should be shown when the shape is selected 0084 virtual bool showOnShapeSelect(); 0085 0086 /// Creates a command which applies all changes to the opened shape 0087 virtual KUndo2Command * createCommand(); 0088 0089 Q_SIGNALS: 0090 /// is emitted after one of the config options has changed 0091 void propertyChanged(); 0092 0093 /// is emitted when the dialog should be accepted ie a file double clicked in a filebrowser 0094 void accept(); 0095 0096 protected: 0097 KoCanvasResourceManager *m_resourceManager; ///< the resource provider with data for this canvas 0098 }; 0099 0100 #endif