Changeset View
Changeset View
Standalone View
Standalone View
ui/pageviewannotator.h
1 | /*************************************************************************** | 1 | /*************************************************************************** | ||
---|---|---|---|---|---|
2 | * Copyright (C) 2005 by Enrico Ros <eros.kde@email.it> * | 2 | * Copyright (C) 2005 by Enrico Ros <eros.kde@email.it> * | ||
3 | * * | 3 | * * | ||
4 | * This program is free software; you can redistribute it and/or modify * | 4 | * This program is free software; you can redistribute it and/or modify * | ||
5 | * it under the terms of the GNU General Public License as published by * | 5 | * it under the terms of the GNU General Public License as published by * | ||
6 | * the Free Software Foundation; either version 2 of the License, or * | 6 | * the Free Software Foundation; either version 2 of the License, or * | ||
7 | * (at your option) any later version. * | 7 | * (at your option) any later version. * | ||
8 | ***************************************************************************/ | 8 | ***************************************************************************/ | ||
9 | 9 | | |||
10 | #ifndef _OKULAR_PAGEVIEWANNOTATOR_H_ | 10 | #ifndef _OKULAR_PAGEVIEWANNOTATOR_H_ | ||
11 | #define _OKULAR_PAGEVIEWANNOTATOR_H_ | 11 | #define _OKULAR_PAGEVIEWANNOTATOR_H_ | ||
12 | 12 | | |||
13 | #include <qaction.h> | ||||
13 | #include <qobject.h> | 14 | #include <qobject.h> | ||
14 | #include <qdom.h> | 15 | #include <qdom.h> | ||
15 | #include <qlinkedlist.h> | 16 | #include <qlinkedlist.h> | ||
16 | 17 | | |||
18 | #include <kactioncollection.h> | ||||
19 | | ||||
17 | #include "pageviewutils.h" | 20 | #include "pageviewutils.h" | ||
18 | #include "annotationtools.h" | 21 | #include "annotationtools.h" | ||
19 | 22 | | |||
20 | class QKeyEvent; | 23 | class QKeyEvent; | ||
21 | class QMouseEvent; | 24 | class QMouseEvent; | ||
22 | class QPainter; | 25 | class QPainter; | ||
26 | class AnnotationActionHandler; | ||||
23 | 27 | | |||
24 | namespace Okular | 28 | namespace Okular | ||
25 | { | 29 | { | ||
26 | class Document; | 30 | class Document; | ||
27 | } | 31 | } | ||
28 | 32 | | |||
29 | // engines are defined and implemented in the cpp | 33 | // engines are defined and implemented in the cpp | ||
30 | class AnnotatorEngine; | 34 | class AnnotatorEngine; | ||
Show All 18 Lines | |||||
49 | */ | 53 | */ | ||
50 | class PageViewAnnotator : public QObject | 54 | class PageViewAnnotator : public QObject | ||
51 | { | 55 | { | ||
52 | Q_OBJECT | 56 | Q_OBJECT | ||
53 | public: | 57 | public: | ||
54 | PageViewAnnotator( PageView * parent, Okular::Document * storage ); | 58 | PageViewAnnotator( PageView * parent, Okular::Document * storage ); | ||
55 | ~PageViewAnnotator(); | 59 | ~PageViewAnnotator(); | ||
56 | 60 | | |||
61 | void setupActions( KActionCollection *ac ); | ||||
62 | | ||||
57 | // called to show/hide the editing toolbar | 63 | // called to show/hide the editing toolbar | ||
58 | void setEnabled( bool enabled ); | 64 | void setEnabled( bool enabled ); | ||
59 | 65 | | |||
60 | // called to toggle the usage of text annotating tools | 66 | // called to toggle the usage of text annotating tools | ||
61 | void setTextToolsEnabled( bool enabled ); | 67 | void setTextToolsEnabled( bool enabled ); | ||
62 | 68 | | |||
63 | void setToolsEnabled( bool enabled ); | 69 | void setToolsEnabled( bool enabled ); | ||
64 | 70 | | |||
65 | void setHidingForced( bool forced ); | | |||
66 | bool hidingWasForced() const; | | |||
67 | | ||||
68 | // methods used when creating the annotation | 71 | // methods used when creating the annotation | ||
69 | // @return Is a tool currently selected? | 72 | // @return Is a tool currently selected? | ||
70 | bool active() const; | 73 | bool active() const; | ||
71 | // @return Are we currently annotating (using the selected tool)? | 74 | // @return Are we currently annotating (using the selected tool)? | ||
72 | bool annotating() const; | 75 | bool annotating() const; | ||
73 | 76 | | |||
74 | // returns the preferred cursor for the current tool. call this only | 77 | // returns the preferred cursor for the current tool. call this only | ||
75 | // if active() == true | 78 | // if active() == true | ||
76 | QCursor cursor() const; | 79 | QCursor cursor() const; | ||
77 | 80 | | |||
78 | QRect routeMouseEvent( QMouseEvent * event, PageViewItem * item ); | 81 | QRect routeMouseEvent( QMouseEvent * event, PageViewItem * item ); | ||
79 | QRect routeTabletEvent( QTabletEvent * event, PageViewItem * item, const QPoint & localOriginInGlobal ); | 82 | QRect routeTabletEvent( QTabletEvent * event, PageViewItem * item, const QPoint & localOriginInGlobal ); | ||
80 | QRect performRouteMouseOrTabletEvent( const AnnotatorEngine::EventType & eventType, const AnnotatorEngine::Button & button, | 83 | QRect performRouteMouseOrTabletEvent( const AnnotatorEngine::EventType & eventType, const AnnotatorEngine::Button & button, | ||
81 | const QPointF & pos, PageViewItem * item ); | 84 | const QPointF & pos, PageViewItem * item ); | ||
82 | bool routeKeyEvent( QKeyEvent * event ); | 85 | bool routeKeyEvent( QKeyEvent * event ); | ||
83 | bool routePaints( const QRect & wantedRect ) const; | 86 | bool routePaints( const QRect & wantedRect ) const; | ||
84 | void routePaint( QPainter * painter, const QRect & paintRect ); | 87 | void routePaint( QPainter * painter, const QRect & paintRect ); | ||
85 | 88 | | |||
86 | void reparseConfig(); | 89 | void reparseConfig(); | ||
87 | 90 | | |||
88 | static QString defaultToolName( const QDomElement &toolElement ); | 91 | static QString defaultToolName( const QDomElement &toolElement ); | ||
89 | static QPixmap makeToolPixmap( const QDomElement &toolElement ); | 92 | static QPixmap makeToolPixmap( const QDomElement &toolElement ); | ||
90 | 93 | | |||
91 | private Q_SLOTS: | 94 | void saveAnnotationTools(); | ||
92 | void slotToolSelected( int toolID ); | 95 | | ||
93 | void slotSaveToolbarOrientation( int side ); | 96 | void selectTool( int toolID ); | ||
94 | void slotToolDoubleClicked( int toolID ); | 97 | void setAnnotationColor( QColor color ); | ||
98 | void setAnnotationInnerColor( QColor color ); | ||||
99 | void setAnnotationOpacity( double opacity ); | ||||
100 | void setAnnotationFont( QFont font ); | ||||
101 | void setAnnotationWidth( double width ); | ||||
102 | | ||||
103 | QDomElement getToolElement( int toolID ); | ||||
104 | QDomElement currentEngineElement(); | ||||
105 | QDomElement currentAnnotationElement(); | ||||
95 | 106 | | |||
96 | private: | | |||
97 | void detachAnnotation(); | 107 | void detachAnnotation(); | ||
98 | 108 | | |||
109 | public Q_SLOTS: | ||||
110 | void setContinuousMode( bool enabled ); | ||||
111 | void slotAdvancedSettings(); | ||||
112 | | ||||
113 | Q_SIGNALS: | ||||
114 | void toolSelected(); | ||||
115 | | ||||
116 | private: | ||||
117 | | ||||
99 | // global class pointers | 118 | // global class pointers | ||
100 | Okular::Document * m_document; | 119 | Okular::Document * m_document; | ||
101 | PageView * m_pageView; | 120 | PageView * m_pageView; | ||
102 | PageViewToolBar * m_toolBar; | 121 | AnnotationActionHandler * m_actionHandler; | ||
103 | AnnotatorEngine * m_engine; | 122 | AnnotatorEngine * m_engine; | ||
104 | QDomElement m_toolsDefinition; | 123 | QDomDocument m_toolsDefinition; | ||
105 | QLinkedList<AnnotationToolItem> m_items; | 124 | QLinkedList<AnnotationToolItem> m_items; | ||
106 | bool m_textToolsEnabled; | 125 | bool m_textToolsEnabled; | ||
107 | bool m_toolsEnabled; | 126 | bool m_toolsEnabled; | ||
108 | bool m_continuousMode; | 127 | bool m_continuousMode; | ||
109 | bool m_hidingWasForced; | | |||
110 | 128 | | |||
111 | // creation related variables | 129 | // creation related variables | ||
112 | int m_lastToolID; | 130 | int m_lastToolID; | ||
113 | QRect m_lastDrawnRect; | 131 | QRect m_lastDrawnRect; | ||
114 | PageViewItem * m_lockedItem; | 132 | PageViewItem * m_lockedItem; | ||
115 | //selected annotation name | 133 | //selected annotation name | ||
116 | //QString m_selectedAnnotationName; | 134 | //QString m_selectedAnnotationName; | ||
117 | }; | 135 | }; | ||
118 | 136 | | |||
119 | #endif | 137 | #endif | ||
120 | 138 | | |||
121 | /* kate: replace-tabs on; indent-width 4; */ | 139 | /* kate: replace-tabs on; indent-width 4; */ |