SVN_SILENT made messages (.desktop file)
[kdegraphics.git] / okular / ui / pageviewannotator.h
blobb9bc1f8c60c4c0a99966bd956929beeb803838ce
1 /***************************************************************************
2 * Copyright (C) 2005 by Enrico Ros <eros.kde@email.it> *
3 * *
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 *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
8 ***************************************************************************/
10 #ifndef _OKULAR_PAGEVIEWANNOTATOR_H_
11 #define _OKULAR_PAGEVIEWANNOTATOR_H_
13 #include <qobject.h>
14 #include <qdom.h>
15 #include <qlinkedlist.h>
17 #include "pageviewutils.h"
19 class QKeyEvent;
20 class QMouseEvent;
21 class QPainter;
23 namespace Okular
25 class Document;
28 // engines are defined and implemented in the cpp
29 class AnnotatorEngine;
30 class PageView;
32 /**
33 * @short PageView object devoted to annotation creation/handling.
35 * PageViewAnnotator is the okular class used for visually creating annotations.
36 * It uses internal 'engines' for interacting with user events and attaches
37 * the newly created annotation to the document when the creation is complete.
38 * In the meanwhile all PageView events (actually mouse/paint ones) are routed
39 * to this class that performs a rough visual representation of what the
40 * annotation will become when finished.
42 * "data/tools.xml" is the file that contains Annotations/Engine association
43 * for the items placed in the toolbar. The XML is parsed (1) when populating
44 * the toolbar and (2)after selecting a toolbar item, in which case an Ann is
45 * initialized with the values in the XML and an engine is created to handle
46 * that annotation.
48 class PageViewAnnotator : public QObject
50 Q_OBJECT
51 public:
52 PageViewAnnotator( PageView * parent, Okular::Document * storage );
53 ~PageViewAnnotator();
55 // called to show/hide the editing toolbar
56 void setEnabled( bool enabled );
58 // called to toggle the usage of text annotating tools
59 void setTextToolsEnabled( bool enabled );
61 void setToolsEnabled( bool enabled );
63 // methods used when creating the annotation
64 bool routeEvents() const;
65 QRect routeEvent( QMouseEvent * event, PageViewItem * item );
66 bool routeKeyEvent( QKeyEvent * event );
67 bool routePaints( const QRect & wantedRect ) const;
68 void routePaint( QPainter * painter, const QRect & paintRect );
70 private slots:
71 void slotToolSelected( int toolID );
72 void slotSaveToolbarOrientation( int side );
74 private:
75 // global class pointers
76 Okular::Document * m_document;
77 PageView * m_pageView;
78 PageViewToolBar * m_toolBar;
79 AnnotatorEngine * m_engine;
80 QDomElement m_toolsDefinition;
81 QLinkedList<AnnotationToolItem> m_items;
82 bool m_textToolsEnabled;
83 bool m_toolsEnabled;
85 // creation related variables
86 int m_lastToolID;
87 QRect m_lastDrawnRect;
88 PageViewItem * m_lockedItem;
89 //selected annotation name
90 //QString m_selectedAnnotationName;
93 #endif