1 /***************************************************************************
2 * Copyright (C) 2005 by Enrico Ros <eros.kde@email.it> *
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_ANNOTATIONTOOLS_H_
11 #define _OKULAR_ANNOTATIONTOOLS_H_
14 #include <qlinkedlist.h>
17 #include "core/area.h"
27 * @short Engine: filter events to distill Annotation's.
32 AnnotatorEngine( const QDomElement
& engineElement
);
33 virtual ~AnnotatorEngine();
36 enum EventType
{ Press
, Move
, Release
};
37 enum Button
{ None
, Left
, Right
};
40 virtual QRect
event( EventType type
, Button button
, double nX
, double nY
, double xScale
, double yScale
, const Okular::Page
* page
) = 0;
41 virtual void paint( QPainter
* painter
, double xScale
, double yScale
, const QRect
& clipRect
) = 0;
42 virtual QList
< Okular::Annotation
* > end() = 0;
44 // query creation state
45 //PageViewItem * editingItem() const { return m_lockedItem; }
46 bool creationCompleted() const { return m_creationCompleted
; }
48 void setItem( PageViewItem
* item
) { m_item
= item
; }
51 PageViewItem
* item() { return m_item
; }
53 // common engine attributes (the element includes annotation desc)
54 QDomElement m_engineElement
;
55 QDomElement m_annotElement
;
57 // other vars (remove this!)
58 bool m_creationCompleted
;
61 PageViewItem
* m_item
;
64 /** @short SmoothPathEngine */
65 class SmoothPathEngine
66 : public AnnotatorEngine
69 SmoothPathEngine( const QDomElement
& engineElement
);
71 QRect
event( EventType type
, Button button
, double nX
, double nY
, double xScale
, double yScale
, const Okular::Page
* /*page*/ );
73 void paint( QPainter
* painter
, double xScale
, double yScale
, const QRect
& /*clipRect*/ );
75 QList
< Okular::Annotation
* > end();
79 QLinkedList
<Okular::NormalizedPoint
> points
;
80 Okular::NormalizedRect totalRect
;
81 Okular::NormalizedPoint lastPoint
;