LeechCraft Monocle  0.6.70-13729-g7046a9d2a7
Modular document viewer for LeechCraft
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 LC
42 {
43 namespace Monocle
44 {
47  enum class AnnotationType
48  {
53  Text,
54 
59  Highlight,
60 
65  Link,
66 
71  Caret,
72 
75  Other
76  };
77 
87  {
88  public:
89  virtual ~IAnnotation () {}
90 
95  virtual QString GetAuthor () const = 0;
96 
104  virtual QDateTime GetDate () const = 0;
105 
114  virtual QRectF GetBoundary () const = 0;
115 
120  virtual AnnotationType GetAnnotationType () const = 0;
121 
127  virtual QString GetText () const = 0;
128  };
129 
133  {
134  public:
135  virtual ~ITextAnnotation () {}
136 
144  virtual bool IsInline () const = 0;
145  };
146 
150  {
151  public:
152  virtual ~IHighlightAnnotation () {}
153 
171  virtual QList<QPolygonF> GetPolygons () const = 0;
172  };
173 
185  {
186  public:
187  virtual ~ILinkAnnotation () {}
188 
193  virtual ILink_ptr GetLink () const = 0;
194  };
195 
199  {
200  public:
201  virtual ~ICaretAnnotation () {}
202  };
203 
204  typedef std::shared_ptr<IAnnotation> IAnnotation_ptr;
205  typedef std::shared_ptr<ITextAnnotation> ITextAnnotation_ptr;
206  typedef std::shared_ptr<IHighlightAnnotation> IHighlightAnnotation_ptr;
207  typedef std::shared_ptr<ILinkAnnotation> ILinkAnnotation_ptr;
208  typedef std::shared_ptr<ICaretAnnotation> ICaretAnnotation_ptr;
209 }
210 }
211 
212 Q_DECLARE_INTERFACE (LC::Monocle::IAnnotation,
213  "org.LeechCraft.Monocle.IAnnotation/1.0")
214 Q_DECLARE_INTERFACE (LC::Monocle::ITextAnnotation,
215  "org.LeechCraft.Monocle.ITextAnnotation/1.0")
216 Q_DECLARE_INTERFACE (LC::Monocle::IHighlightAnnotation,
217  "org.LeechCraft.Monocle.IHighlightAnnotation/1.0")
218 Q_DECLARE_INTERFACE (LC::Monocle::ILinkAnnotation,
219  "org.LeechCraft.Monocle.ILinkAnnotation/1.0")
220 Q_DECLARE_INTERFACE (LC::Monocle::ICaretAnnotation,
221  "org.LeechCraft.Monocle.ICaretAnnotation/1.0")
222 
223 Q_DECLARE_METATYPE (LC::Monocle::IAnnotation_ptr)
A highlighted block in the text.
The interface for AnnotationType::Text annotations.
Definition: iannotation.h:132
virtual AnnotationType GetAnnotationType() const =0
Returns the type of the annotation.
std::shared_ptr< ICaretAnnotation > ICaretAnnotation_ptr
Definition: iannotation.h:208
std::shared_ptr< ILink > ILink_ptr
Definition: ilink.h:110
virtual QRectF GetBoundary() const =0
Returns the bounding rectangle of the annotation.
virtual QList< QPolygonF > GetPolygons() const =0
Returns the shape of the highlight.
virtual QString GetAuthor() const =0
Returns the author of the annotation.
std::shared_ptr< IAnnotation > IAnnotation_ptr
Definition: iannotation.h:204
std::shared_ptr< IHighlightAnnotation > IHighlightAnnotation_ptr
Definition: iannotation.h:206
A caret pointing to some text inserted.
Base interface for annotations.
Definition: iannotation.h:86
The interface for AnnotationType::Highlight annotations.
Definition: iannotation.h:149
A simple text annotation.
std::shared_ptr< ILinkAnnotation > ILinkAnnotation_ptr
Definition: iannotation.h:207
std::shared_ptr< ITextAnnotation > ITextAnnotation_ptr
Definition: iannotation.h:205
Another type of annotation.
An annotation with a link.
AnnotationType
Defines an annotation type.
Definition: iannotation.h:47
virtual bool IsInline() const =0
Returns whether this is an inline annotation.
virtual QDateTime GetDate() const =0
Returns the date the annotation was created.
The interface for AnnotationType::Caret annotations.
Definition: iannotation.h:198
Definition: iannotation.h:41
virtual QString GetText() const =0
Returns the text contained in the annotation.