LeechCraft Monocle  0.6.70-18450-gabe19ee3b0
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 QDateTime;
17 class QPolygonF;
18 
19 namespace LC
20 {
21 namespace Monocle
22 {
25  enum class AnnotationType
26  {
31  Text,
32 
37  Highlight,
38 
43  Link,
44 
49  Caret,
50 
53  Other
54  };
55 
65  {
66  public:
67  virtual ~IAnnotation () {}
68 
73  virtual QString GetAuthor () const = 0;
74 
82  virtual QDateTime GetDate () const = 0;
83 
88  virtual PageRelativeRectBase GetBoundary () const = 0;
89 
94  virtual AnnotationType GetAnnotationType () const = 0;
95 
101  virtual QString GetText () const = 0;
102  };
103 
107  {
108  public:
109  virtual ~ITextAnnotation () {}
110 
118  virtual bool IsInline () const = 0;
119  };
120 
124  {
125  public:
126  virtual ~IHighlightAnnotation () {}
127 
145  virtual QList<QPolygonF> GetPolygons () const = 0;
146  };
147 
159  {
160  public:
161  virtual ~ILinkAnnotation () {}
162 
167  virtual ILink_ptr GetLink () const = 0;
168  };
169 
173  {
174  public:
175  virtual ~ICaretAnnotation () {}
176  };
177 
178  typedef std::shared_ptr<IAnnotation> IAnnotation_ptr;
179  typedef std::shared_ptr<ITextAnnotation> ITextAnnotation_ptr;
180  typedef std::shared_ptr<IHighlightAnnotation> IHighlightAnnotation_ptr;
181  typedef std::shared_ptr<ILinkAnnotation> ILinkAnnotation_ptr;
182  typedef std::shared_ptr<ICaretAnnotation> ICaretAnnotation_ptr;
183 }
184 }
185 
186 Q_DECLARE_METATYPE (LC::Monocle::IAnnotation_ptr)
A highlighted block in the text.
The interface for AnnotationType::Text annotations.
Definition: iannotation.h:106
virtual AnnotationType GetAnnotationType() const =0
Returns the type of the annotation.
std::shared_ptr< ICaretAnnotation > ICaretAnnotation_ptr
Definition: iannotation.h:182
std::shared_ptr< ILink > ILink_ptr
Definition: ilink.h:146
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:178
std::shared_ptr< IHighlightAnnotation > IHighlightAnnotation_ptr
Definition: iannotation.h:180
A caret pointing to some text inserted.
Base interface for annotations.
Definition: iannotation.h:64
The interface for AnnotationType::Highlight annotations.
Definition: iannotation.h:123
A simple text annotation.
std::shared_ptr< ILinkAnnotation > ILinkAnnotation_ptr
Definition: iannotation.h:181
std::shared_ptr< ITextAnnotation > ITextAnnotation_ptr
Definition: iannotation.h:179
virtual PageRelativeRectBase GetBoundary() const =0
Returns the bounding rectangle of the annotation.
Another type of annotation.
An annotation with a link.
AnnotationType
Defines an annotation type.
Definition: iannotation.h:25
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:172
virtual QString GetText() const =0
Returns the text contained in the annotation.