File: KoPADocumentStructureDocker.h

package info (click to toggle)
calligra 1%3A3.2.1%2Bdfsg-6
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 261,632 kB
  • sloc: cpp: 650,836; xml: 27,662; python: 6,044; perl: 2,724; yacc: 1,817; ansic: 1,325; sh: 1,277; lex: 1,107; ruby: 1,010; javascript: 495; makefile: 17
file content (120 lines) | stat: -rw-r--r-- 3,921 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
/* This file is part of the KDE project
 * Copyright (C) 2006-2007 Jan Hambrecht <jaham@gmx.net>
 * Copyright (C) 2009 Jean-Nicolas Artaud <jeannicolasartaud@gmail.com>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public License
 * along with this library; see the file COPYING.LIB.  If not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 */
#ifndef KOPADOCUMENTSTRUCTUREDOCKER_H
#define KOPADOCUMENTSTRUCTUREDOCKER_H

#include <QDockWidget>
#include <QHash>
#include <KoDockFactoryBase.h>
#include <KoCanvasObserverBase.h>
#include <KoDocumentSectionView.h>
#include <KoPageApp.h>

class KoShape;
class KoShapeLayer;
class KoPADocument;
class KoPADocumentModel;
class KoPAPageBase;
class KoViewItemContextBar;
class QAction;
class QButtonGroup;

class KoPADocumentStructureDockerFactory : public KoDockFactoryBase
{
public:
    explicit KoPADocumentStructureDockerFactory(KoDocumentSectionView::DisplayMode mode, KoPageApp::PageType pageType = KoPageApp::Page);

    QString id() const override;
    QDockWidget* createDockWidget() override;

    DockPosition defaultDockPosition() const override
    {
        return DockRight;
    }

private:
    KoDocumentSectionView::DisplayMode m_mode;
    KoPageApp::PageType m_pageType;
};

class KoPADocumentStructureDocker : public QDockWidget, public KoCanvasObserverBase
{
Q_OBJECT

public:
    explicit KoPADocumentStructureDocker(KoDocumentSectionView::DisplayMode mode, KoPageApp::PageType pageType, QWidget* parent = 0);
    ~KoPADocumentStructureDocker() override;

    void setCanvas(KoCanvasBase* canvas) override;
    void unsetCanvas() override;
    void setActivePage(KoPAPageBase *page);
    void setMasterMode(bool master);

protected:
    /// This is the context menu for the slide show in the KoPADocumentStructure docker
    void contextMenuEvent(QContextMenuEvent* event) override;

Q_SIGNALS:
    void pageChanged(KoPAPageBase *page);

    /// This signal will be emitted after the model for this docker has been reset
    void dockerReset();

public Q_SLOTS:
    void updateView();

    void selectPages(int start, int count);

private Q_SLOTS:
    void slotButtonClicked(int buttonId);
    void addLayer();
    void addPage();
    void deleteItem();
    void raiseItem();
    void lowerItem();
    void itemClicked(const QModelIndex &index);
    void minimalView();
    void detailedView();
    void thumbnailView();

    void itemSelected(const QItemSelection& selected, const QItemSelection& deselected);
    void editCut();
    void editCopy();
    void editPaste();

private:
    void extractSelectedLayersAndShapes(QList<KoPAPageBase*> &pages, QList<KoShapeLayer*> &layers, QList<KoShape*> &shapes);
    void setViewMode(KoDocumentSectionView::DisplayMode mode);
    QModelIndex getRootIndex(const QModelIndex &index) const;

    KoDocumentSectionView::DisplayMode viewModeFromString(const QString& mode);
    QString viewModeToString(KoDocumentSectionView::DisplayMode mode);

    KoPADocument * m_doc;
    KoDocumentSectionView *m_sectionView;
    KoPADocumentModel *m_model;
    QHash<KoDocumentSectionView::DisplayMode, QAction*> m_viewModeActions;
    QList<KoShape *> m_selectedShapes;
    QButtonGroup *m_buttonGroup;
    QAction* m_addLayerAction;
    KoViewItemContextBar *m_itemsContextBar;
};

#endif // KOPADOCUMENTSTRUCTUREDOCKER_H