-
Notifications
You must be signed in to change notification settings - Fork 28
/
Viewer.h
98 lines (82 loc) · 2.63 KB
/
Viewer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
/************************************************************************
**
** Copyright (C) 2019 Kevin B. Hendricks, Stratford, Ontario, Canada
**
** This file is part of PageEdit.
**
** PageEdit is free software: you can redistribute it and/or modify
** it under the terms of the GNU General Public License as published by
** the Free Software Foundation, either version 3 of the License, or
** (at your option) any later version.
**
** PageEdit is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with PageEdit. If not, see <http://www.gnu.org/licenses/>.
**
*************************************************************************/
#pragma once
#ifndef VIEWER_H
#define VIEWER_H
#include <QList>
#include <QString>
#include "Zoomable.h"
#include "ElementIndex.h"
class QUrl;
/**
* Interface for Preview Viewer.
* It would be lovely if we could make this a QObject
* subclass, but multiple inheritance with multiple
* QObject subclasses is apparently a bad idea.
*/
class Viewer : public Zoomable
{
public:
/**
* Destructor.
*/
virtual ~Viewer() {}
/**
* Returns the state of the loading procedure.
*
* @return \c true if loading is finished.
*/
virtual bool IsLoadingFinished() = 0;
/**
* Returns an "encoded" location of the caret element.
* The returned list of elements represents a "chain"
* or "walk" through the XHTML document with which one
* can identify a single element in the document.
* This list identifies the element in which the
* keyboard caret is currently located.
*
* @return The element selecting list.
*/
virtual QList<ElementIndex> GetCaretLocation() {
return QList<ElementIndex>();
}
/**
* Accepts a list returned by a view's GetCaretLocation()
* and creates and stores an update that sends the caret
* in this view to the specified element.
*
* @param hierarchy The element selecting list.
*/
virtual void StoreCaretLocationUpdate(const QList<ElementIndex> &hierarchy) {}
virtual QString GetCaretLocationUpdate() {
return QString();
}
/**
* Perform the relocating of the caret on screen to
* the location state that has been persisted.
*
* @return \c true if the update was performed.
*/
virtual bool ExecuteCaretUpdate() {
return false;
}
};
#endif // VIEWER_H