File indexing completed on 2024-05-26 16:11:34
0001 /* 0002 * Copyright (c) 2009 Cyrille Berger <cberger@cberger.net> 0003 * 0004 * This library is free software; you can redistribute it and/or 0005 * modify it under the terms of the GNU Lesser General Public 0006 * License as published by the Free Software Foundation; 0007 * either version 2, or (at your option) any later version of the License. 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 * Lesser General Public License for more details. 0013 * 0014 * You should have received a copy of the GNU Lesser General Public License 0015 * along with this library; see the file COPYING. 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 _SECTIONS_BOX_DOCKER_H_ 0021 #define _SECTIONS_BOX_DOCKER_H_ 0022 0023 #include "ui_wdgsectionsbox.h" 0024 0025 class RootSection; 0026 class DocumentModel; 0027 class Section; 0028 class TreeSortFilter; 0029 class View; 0030 0031 #include <QDockWidget> 0032 #include <KoDockFactoryBase.h> 0033 0034 class SectionsBoxDock : public QDockWidget 0035 { 0036 Q_OBJECT 0037 public: 0038 SectionsBoxDock(); 0039 virtual ~SectionsBoxDock(); 0040 void setup(RootSection* document, View* m_view); 0041 void updateGUI(); 0042 private Q_SLOTS: 0043 void slotSectionActivated(const QModelIndex &); 0044 void slotSectionActivated(Section*); 0045 0046 void slotMinimalView(); 0047 void slotDetailedView(); 0048 void slotThumbnailView(); 0049 0050 void slotRmClicked(); 0051 void slotRaiseClicked(); 0052 void slotLowerClicked(); 0053 void slotDuplicateClicked(); 0054 0055 void slotNewSectionAsChildOfCurrent(); 0056 void slotNewSectionAboveCurrent(); 0057 void slotNewSectionBellowCurrent(); 0058 0059 void removedSection(); 0060 void insertedSection(const QModelIndex& parent, int idx); 0061 private: 0062 void selectSection(Section*); 0063 private: 0064 Ui::WdgSectionsBox m_wdgSectionsBox; 0065 View* m_view; 0066 DocumentModel* m_model; 0067 TreeSortFilter* m_proxy; 0068 QAction* m_newSectionAsChild; 0069 }; 0070 0071 0072 class SectionsBoxDockFactory : public KoDockFactoryBase 0073 { 0074 0075 public: 0076 SectionsBoxDockFactory() { } 0077 0078 virtual QString id() const { 0079 return QString("SectionsBox"); 0080 } 0081 0082 virtual QDockWidget* createDockWidget() { 0083 SectionsBoxDock * dockWidget = new SectionsBoxDock(); 0084 0085 dockWidget->setObjectName(id()); 0086 0087 return dockWidget; 0088 } 0089 0090 DockPosition defaultDockPosition() const { 0091 return DockRight; 0092 } 0093 }; 0094 0095 #endif