Warning, file /office/calligra/libs/pageapp/KoPADocumentStructureDocker.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 Jan Hambrecht <jaham@gmx.net>
0003  * Copyright (C) 2009 Jean-Nicolas Artaud <jeannicolasartaud@gmail.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 #ifndef KOPADOCUMENTSTRUCTUREDOCKER_H
0021 #define KOPADOCUMENTSTRUCTUREDOCKER_H
0022 
0023 #include <QDockWidget>
0024 #include <QHash>
0025 #include <KoDockFactoryBase.h>
0026 #include <KoCanvasObserverBase.h>
0027 #include <KoDocumentSectionView.h>
0028 #include <KoPageApp.h>
0029 
0030 class KoShape;
0031 class KoShapeLayer;
0032 class KoPADocument;
0033 class KoPADocumentModel;
0034 class KoPAPageBase;
0035 class KoViewItemContextBar;
0036 class QAction;
0037 class QButtonGroup;
0038 
0039 class KoPADocumentStructureDockerFactory : public KoDockFactoryBase
0040 {
0041 public:
0042     explicit KoPADocumentStructureDockerFactory(KoDocumentSectionView::DisplayMode mode, KoPageApp::PageType pageType = KoPageApp::Page);
0043 
0044     QString id() const override;
0045     QDockWidget* createDockWidget() override;
0046 
0047     DockPosition defaultDockPosition() const override
0048     {
0049         return DockRight;
0050     }
0051 
0052 private:
0053     KoDocumentSectionView::DisplayMode m_mode;
0054     KoPageApp::PageType m_pageType;
0055 };
0056 
0057 class KoPADocumentStructureDocker : public QDockWidget, public KoCanvasObserverBase
0058 {
0059 Q_OBJECT
0060 
0061 public:
0062     explicit KoPADocumentStructureDocker(KoDocumentSectionView::DisplayMode mode, KoPageApp::PageType pageType, QWidget* parent = 0);
0063     ~KoPADocumentStructureDocker() override;
0064 
0065     void setCanvas(KoCanvasBase* canvas) override;
0066     void unsetCanvas() override;
0067     void setActivePage(KoPAPageBase *page);
0068     void setMasterMode(bool master);
0069 
0070 protected:
0071     /// This is the context menu for the slide show in the KoPADocumentStructure docker
0072     void contextMenuEvent(QContextMenuEvent* event) override;
0073 
0074 Q_SIGNALS:
0075     void pageChanged(KoPAPageBase *page);
0076 
0077     /// This signal will be emitted after the model for this docker has been reset
0078     void dockerReset();
0079 
0080 public Q_SLOTS:
0081     void updateView();
0082 
0083     void selectPages(int start, int count);
0084 
0085 private Q_SLOTS:
0086     void slotButtonClicked(int buttonId);
0087     void addLayer();
0088     void addPage();
0089     void deleteItem();
0090     void raiseItem();
0091     void lowerItem();
0092     void itemClicked(const QModelIndex &index);
0093     void minimalView();
0094     void detailedView();
0095     void thumbnailView();
0096 
0097     void itemSelected(const QItemSelection& selected, const QItemSelection& deselected);
0098     void editCut();
0099     void editCopy();
0100     void editPaste();
0101 
0102 private:
0103     void extractSelectedLayersAndShapes(QList<KoPAPageBase*> &pages, QList<KoShapeLayer*> &layers, QList<KoShape*> &shapes);
0104     void setViewMode(KoDocumentSectionView::DisplayMode mode);
0105     QModelIndex getRootIndex(const QModelIndex &index) const;
0106 
0107     KoDocumentSectionView::DisplayMode viewModeFromString(const QString& mode);
0108     QString viewModeToString(KoDocumentSectionView::DisplayMode mode);
0109 
0110     KoPADocument * m_doc;
0111     KoDocumentSectionView *m_sectionView;
0112     KoPADocumentModel *m_model;
0113     QHash<KoDocumentSectionView::DisplayMode, QAction*> m_viewModeActions;
0114     QList<KoShape *> m_selectedShapes;
0115     QButtonGroup *m_buttonGroup;
0116     QAction* m_addLayerAction;
0117     KoViewItemContextBar *m_itemsContextBar;
0118 };
0119 
0120 #endif // KOPADOCUMENTSTRUCTUREDOCKER_H