LeechCraft Monocle  %{LEECHCRAFT_VERSION}
Modular document viewer for LeechCraft
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator
iannotation.h
Go to the documentation of this file.
1 /**********************************************************************
2  * LeechCraft - modular cross-platform feature rich internet client.
3  * Copyright (C) 2006-2014 Georg Rudoy
4  *
5  * Boost Software License - Version 1.0 - August 17th, 2003
6  *
7  * Permission is hereby granted, free of charge, to any person or organization
8  * obtaining a copy of the software and accompanying documentation covered by
9  * this license (the "Software") to use, reproduce, display, distribute,
10  * execute, and transmit the Software, and to prepare derivative works of the
11  * Software, and to permit third-parties to whom the Software is furnished to
12  * do so, all subject to the following:
13  *
14  * The copyright notices in the Software and this entire statement, including
15  * the above license grant, this restriction and the following disclaimer,
16  * must be included in all copies of the Software, in whole or in part, and
17  * all derivative works of the Software, unless such copies or derivative
18  * works are solely in the form of machine-executable object code generated by
19  * a source language processor.
20  *
21  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23  * FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
24  * SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
25  * FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
26  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27  * DEALINGS IN THE SOFTWARE.
28  **********************************************************************/
29 
30 #pragma once
31 
32 #include <memory>
33 #include <QtPlugin>
34 #include <QMetaType>
35 #include "ilink.h"
36 
37 class QRectF;
38 class QDateTime;
39 class QPolygonF;
40 
41 namespace LeechCraft
42 {
43 namespace Monocle
44 {
47  enum class AnnotationType
48  {
53  Text,
54 
59  Highlight,
60 
65  Link,
66 
69  Other
70  };
71 
81  {
82  public:
83  virtual ~IAnnotation () {}
84 
89  virtual QString GetAuthor () const = 0;
90 
98  virtual QDateTime GetDate () const = 0;
99 
108  virtual QRectF GetBoundary () const = 0;
109 
114  virtual AnnotationType GetAnnotationType () const = 0;
115 
121  virtual QString GetText () const = 0;
122  };
123 
127  {
128  public:
129  virtual ~ITextAnnotation () {}
130 
138  virtual bool IsInline () const = 0;
139  };
140 
144  {
145  public:
146  virtual ~IHighlightAnnotation () {}
147 
165  virtual QList<QPolygonF> GetPolygons () const = 0;
166  };
167 
179  {
180  public:
181  virtual ~ILinkAnnotation () {}
182 
187  virtual ILink_ptr GetLink () const = 0;
188  };
189 
190  typedef std::shared_ptr<IAnnotation> IAnnotation_ptr;
191  typedef std::shared_ptr<ITextAnnotation> ITextAnnotation_ptr;
192  typedef std::shared_ptr<IHighlightAnnotation> IHighlightAnnotation_ptr;
193  typedef std::shared_ptr<ILinkAnnotation> ILinkAnnotation_ptr;
194 }
195 }
196 
198  "org.LeechCraft.Monocle.IAnnotation/1.0");
200  "org.LeechCraft.Monocle.ITextAnnotation/1.0");
202  "org.LeechCraft.Monocle.IHighlightAnnotation/1.0");
204  "org.LeechCraft.Monocle.ILinkAnnotation/1.0");
205 
206 Q_DECLARE_METATYPE (LeechCraft::Monocle::IAnnotation_ptr)
std::shared_ptr< ILink > ILink_ptr
Definition: ilink.h:110
virtual QRectF GetBoundary() const =0
Returns the bounding rectangle of the annotation.
A highlighted block in the text.
AnnotationType
Defines an annotation type.
Definition: iannotation.h:47
The interface for AnnotationType::Text annotations.
Definition: iannotation.h:126
virtual QList< QPolygonF > GetPolygons() const =0
Returns the shape of the highlight.
virtual QString GetText() const =0
Returns the text contained in the annotation.
std::shared_ptr< ILinkAnnotation > ILinkAnnotation_ptr
Definition: iannotation.h:193
Base interface for annotations.
Definition: iannotation.h:80
virtual QString GetAuthor() const =0
Returns the author of the annotation.
virtual AnnotationType GetAnnotationType() const =0
Returns the type of the annotation.
Q_DECLARE_INTERFACE(LeechCraft::Monocle::IAnnotation,"org.LeechCraft.Monocle.IAnnotation/1.0")
std::shared_ptr< IAnnotation > IAnnotation_ptr
Definition: iannotation.h:190
virtual QDateTime GetDate() const =0
Returns the date the annotation was created.
virtual bool IsInline() const =0
Returns whether this is an inline annotation.
The interface for AnnotationType::Highlight annotations.
Definition: iannotation.h:143
std::shared_ptr< ITextAnnotation > ITextAnnotation_ptr
Definition: iannotation.h:191
Another type of annotation.
std::shared_ptr< IHighlightAnnotation > IHighlightAnnotation_ptr
Definition: iannotation.h:192