Warning, file /office/calligra/braindump/src/View.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

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 VIEW_H
0021 #define VIEW_H
0022 
0023 #include <QWidget>
0024 #include <QAction>
0025 
0026 #include <kxmlguiclient.h>
0027 
0028 #include <KoZoomHandler.h>
0029 
0030 class KoCanvasControllerWidget;
0031 class Canvas;
0032 class MainWindow;
0033 class KoZoomAction;
0034 class KoZoomController;
0035 class RootSection;
0036 class Section;
0037 class SectionsBoxDock;
0038 class SectionPropertiesDock;
0039 class KoCutController;
0040 class KoCopyController;
0041 
0042 class View : public QWidget, public KXMLGUIClient
0043 {
0044     Q_OBJECT
0045 public:
0046 
0047     /**
0048      * Constructor
0049      * @param document the document of this view
0050      * @param parent the parent widget
0051      */
0052     explicit View(RootSection* document, MainWindow* parent);
0053     virtual ~View();
0054 
0055     KoZoomHandler* zoomHandler() {
0056         return &m_zoomHandler;
0057     }
0058 
0059     KoZoomController *zoomController() {
0060         return m_zoomController;
0061     }
0062 
0063     Canvas* canvas() {
0064         return m_canvas;
0065     }
0066     Canvas* canvas() const {
0067         return m_canvas;
0068     }
0069 
0070     RootSection* rootSection() {
0071         return m_doc;
0072     }
0073     /// @return Page that is shown in the canvas
0074     Section* activeSection() const;
0075 
0076     /// Set page shown in the canvas to @p page
0077     void setActiveSection(Section * page);
0078 
0079 private:
0080     /// creates the widgets (called from the constructor)
0081     void initGUI();
0082     /// creates the actions (called from the constructor)
0083     void initActions();
0084     void loadExtensions();
0085 protected Q_SLOTS:
0086     void slotZoomChanged(KoZoomMode::Mode mode, qreal zoom);
0087 
0088     void editPaste();
0089     void editDeleteSelection();
0090     void editSelectAll();
0091     void editDeselectAll();
0092 
0093     /// Called when the mouse position changes on the canvas
0094     virtual void updateMousePosition(const QPoint& position);
0095 
0096     /// Called when the clipboard changed
0097     virtual void clipboardDataChanged();
0098 
0099 private Q_SLOTS:
0100     void canvasReceivedFocus();
0101     void documentRectChanged(const QRectF& rect);
0102     void selectionDuplicate();
0103     void groupSelection();
0104     void ungroupSelection();
0105 protected:
0106     virtual void focusInEvent(QFocusEvent * event);
0107 private:
0108     void createCanvas(Section* _currentSection);
0109 private:
0110     RootSection* m_doc;
0111     Canvas* m_canvas;
0112     Section* m_activeSection;
0113     MainWindow* m_mainWindow;
0114 
0115 
0116     SectionsBoxDock* m_sectionsBoxDock;
0117     SectionPropertiesDock* m_sectionPropertiesDock;
0118 
0119     KoCanvasControllerWidget * m_canvasController;
0120     KoZoomController * m_zoomController;
0121     KoZoomHandler m_zoomHandler;
0122 
0123     KoCutController* m_cutController;
0124     KoCopyController* m_copyController;
0125     QAction* m_editCopy;
0126     QAction* m_editCut;
0127 
0128     QAction *m_editPaste;
0129     QAction *m_deleteSelectionAction;
0130     QAction* m_groupShapes;
0131     QAction* m_ungroupShapes;
0132     KoZoomAction *m_zoomAction;
0133 };
0134 
0135 #endif /* KOPAVIEW_H */