LeechCraft Monocle  0.6.70-16373-g319c272718
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  * Distributed under the Boost Software License, Version 1.0.
6  * (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7  **********************************************************************/
8 
9 #pragma once
10 
11 #include <memory>
12 #include <QtPlugin>
13 #include <QMetaType>
14 #include "ilink.h"
15 
16 class QRectF;
17 class QDateTime;
18 class QPolygonF;
19 
20 namespace LC
21 {
22 namespace Monocle
23 {
26  enum class AnnotationType
27  {
32  Text,
33 
38  Highlight,
39 
44  Link,
45 
50  Caret,
51 
54  Other
55  };
56 
66  {
67  public:
68  virtual ~IAnnotation () {}
69 
74  virtual QString GetAuthor () const = 0;
75 
83  virtual QDateTime GetDate () const = 0;
84 
93  virtual QRectF GetBoundary () const = 0;
94 
99  virtual AnnotationType GetAnnotationType () const = 0;
100 
106  virtual QString GetText () const = 0;
107  };
108 
112  {
113  public:
114  virtual ~ITextAnnotation () {}
115 
123  virtual bool IsInline () const = 0;
124  };
125 
129  {
130  public:
131  virtual ~IHighlightAnnotation () {}
132 
150  virtual QList<QPolygonF> GetPolygons () const = 0;
151  };
152 
164  {
165  public:
166  virtual ~ILinkAnnotation () {}
167 
172  virtual ILink_ptr GetLink () const = 0;
173  };
174 
178  {
179  public:
180  virtual ~ICaretAnnotation () {}
181  };
182 
183  typedef std::shared_ptr<IAnnotation> IAnnotation_ptr;
184  typedef std::shared_ptr<ITextAnnotation> ITextAnnotation_ptr;
185  typedef std::shared_ptr<IHighlightAnnotation> IHighlightAnnotation_ptr;
186  typedef std::shared_ptr<ILinkAnnotation> ILinkAnnotation_ptr;
187  typedef std::shared_ptr<ICaretAnnotation> ICaretAnnotation_ptr;
188 }
189 }
190 
191 Q_DECLARE_INTERFACE (LC::Monocle::IAnnotation,
192  "org.LeechCraft.Monocle.IAnnotation/1.0")
193 Q_DECLARE_INTERFACE (LC::Monocle::ITextAnnotation,
194  "org.LeechCraft.Monocle.ITextAnnotation/1.0")
195 Q_DECLARE_INTERFACE (LC::Monocle::IHighlightAnnotation,
196  "org.LeechCraft.Monocle.IHighlightAnnotation/1.0")
197 Q_DECLARE_INTERFACE (LC::Monocle::ILinkAnnotation,
198  "org.LeechCraft.Monocle.ILinkAnnotation/1.0")
199 Q_DECLARE_INTERFACE (LC::Monocle::ICaretAnnotation,
200  "org.LeechCraft.Monocle.ICaretAnnotation/1.0")
201 
202 Q_DECLARE_METATYPE (LC::Monocle::IAnnotation_ptr)
A highlighted block in the text.
The interface for AnnotationType::Text annotations.
Definition: iannotation.h:111
virtual AnnotationType GetAnnotationType() const =0
Returns the type of the annotation.
std::shared_ptr< ICaretAnnotation > ICaretAnnotation_ptr
Definition: iannotation.h:187
std::shared_ptr< ILink > ILink_ptr
Definition: ilink.h:152
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:183
std::shared_ptr< IHighlightAnnotation > IHighlightAnnotation_ptr
Definition: iannotation.h:185
A caret pointing to some text inserted.
Base interface for annotations.
Definition: iannotation.h:65
The interface for AnnotationType::Highlight annotations.
Definition: iannotation.h:128
A simple text annotation.
std::shared_ptr< ILinkAnnotation > ILinkAnnotation_ptr
Definition: iannotation.h:186
std::shared_ptr< ITextAnnotation > ITextAnnotation_ptr
Definition: iannotation.h:184
Another type of annotation.
An annotation with a link.
AnnotationType
Defines an annotation type.
Definition: iannotation.h:26
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:177
Definition: iannotation.h:20
virtual QString GetText() const =0
Returns the text contained in the annotation.