LeechCraft Monocle  0.6.70-6645-gcd10d7e
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 LeechCraft
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 
213  "org.LeechCraft.Monocle.IAnnotation/1.0");
215  "org.LeechCraft.Monocle.ITextAnnotation/1.0");
217  "org.LeechCraft.Monocle.IHighlightAnnotation/1.0");
219  "org.LeechCraft.Monocle.ILinkAnnotation/1.0");
221  "org.LeechCraft.Monocle.ICaretAnnotation/1.0");
222 
223 Q_DECLARE_METATYPE (LeechCraft::Monocle::IAnnotation_ptr)
std::shared_ptr< ILink > ILink_ptr
Definition: ilink.h:110
The interface for AnnotationType::Caret annotations.
Definition: iannotation.h:198
A highlighted block in the text.
AnnotationType
Defines an annotation type.
Definition: iannotation.h:47
The interface for AnnotationType::Text annotations.
Definition: iannotation.h:132
std::shared_ptr< ILinkAnnotation > ILinkAnnotation_ptr
Definition: iannotation.h:207
A caret pointing to some text inserted.
Base interface for annotations.
Definition: iannotation.h:86
Q_DECLARE_INTERFACE(LeechCraft::Monocle::IAnnotation,"org.LeechCraft.Monocle.IAnnotation/1.0")
std::shared_ptr< IAnnotation > IAnnotation_ptr
Definition: iannotation.h:204
The interface for AnnotationType::Highlight annotations.
Definition: iannotation.h:149
std::shared_ptr< ITextAnnotation > ITextAnnotation_ptr
Definition: iannotation.h:205
std::shared_ptr< ICaretAnnotation > ICaretAnnotation_ptr
Definition: iannotation.h:208
Another type of annotation.
std::shared_ptr< IHighlightAnnotation > IHighlightAnnotation_ptr
Definition: iannotation.h:206