libquentier 0.8.0
The library for rich desktop clients of Evernote service
Loading...
Searching...
No Matches
INoteEditorBackend.h
1/*
2 * Copyright 2016-2024 Dmitry Ivanov
3 *
4 * This file is part of libquentier
5 *
6 * libquentier is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as published by
8 * the Free Software Foundation, version 3 of the License.
9 *
10 * libquentier is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public License
16 * along with libquentier. If not, see <http://www.gnu.org/licenses/>.
17 */
18
19#pragma once
20
21#include <quentier/local_storage/Fwd.h>
22#include <quentier/utility/Linkage.h>
23#include <quentier/utility/Printable.h>
24
25#include <QPalette>
26#include <QPrinter>
27#include <QStringList>
28#include <QThread>
29#include <QWidget>
30
31class QUndoStack;
32
33namespace quentier {
34
35class Account;
36class ErrorString;
37class NoteEditor;
38class SpellChecker;
39
41{
42public:
43 virtual ~INoteEditorBackend() noexcept;
44
45 virtual void initialize(
46 local_storage::ILocalStoragePtr localStorage,
49
50 [[nodiscard]] virtual QObject * object() = 0; // provide QObject interface
51 [[nodiscard]] virtual QWidget * widget() = 0; // provide QWidget interface
52
53 virtual void setAccount(const Account & account) = 0;
54 virtual void setUndoStack(QUndoStack * pUndoStack) = 0;
55
56 virtual void setInitialPageHtml(const QString & html) = 0;
57 virtual void setNoteNotFoundPageHtml(const QString & html) = 0;
58 virtual void setNoteDeletedPageHtml(const QString & html) = 0;
59 virtual void setNoteLoadingPageHtml(const QString & html) = 0;
60
61 [[nodiscard]] virtual bool isNoteLoaded() const = 0;
62 [[nodiscard]] virtual qint64 idleTime() const = 0;
63
64 virtual void convertToNote() = 0;
65 virtual void saveNoteToLocalStorage() = 0;
66 virtual void setNoteTitle(const QString & noteTitle) = 0;
67
68 virtual void setTagIds(
69 const QStringList & tagLocalUids, const QStringList & tagGuids) = 0;
70
71 virtual void undo() = 0;
72 virtual void redo() = 0;
73 virtual void cut() = 0;
74 virtual void copy() = 0;
75 virtual void paste() = 0;
76 virtual void pasteUnformatted() = 0;
77 virtual void selectAll() = 0;
78
79 virtual void formatSelectionAsSourceCode() = 0;
80
81 virtual void fontMenu() = 0;
82 virtual void textBold() = 0;
83 virtual void textItalic() = 0;
84 virtual void textUnderline() = 0;
85 virtual void textStrikethrough() = 0;
86 virtual void textHighlight() = 0;
87
88 virtual void alignLeft() = 0;
89 virtual void alignCenter() = 0;
90 virtual void alignRight() = 0;
91 virtual void alignFull() = 0;
92
93 [[nodiscard]] virtual QString selectedText() const = 0;
94 [[nodiscard]] virtual bool hasSelection() const = 0;
95
96 virtual void findNext(const QString & text, bool matchCase) const = 0;
97
98 virtual void findPrevious(const QString & text, bool matchCase) const = 0;
99
100 virtual void replace(
102 bool matchCase) = 0;
103
104 virtual void replaceAll(
106 bool matchCase) = 0;
107
108 virtual void insertToDoCheckbox() = 0;
109
110 virtual void insertInAppNoteLink(
111 const QString & userId, const QString & shardId,
112 const QString & noteGuid, const QString & linkText) = 0;
113
114 virtual void setSpellcheck(bool enabled) = 0;
115 [[nodiscard]] virtual bool spellCheckEnabled() const = 0;
116
117 virtual void setFont(const QFont & font) = 0;
118 virtual void setFontHeight(int height) = 0;
119 virtual void setFontColor(const QColor & color) = 0;
120 virtual void setBackgroundColor(const QColor & color) = 0;
121
122 [[nodiscard]] virtual QPalette defaultPalette() const = 0;
123 virtual void setDefaultPalette(const QPalette & pal) = 0;
124
125 [[nodiscard]] virtual const QFont * defaultFont() const = 0;
126 virtual void setDefaultFont(const QFont & font) = 0;
127
128 virtual void insertHorizontalLine() = 0;
129
130 virtual void increaseFontSize() = 0;
131 virtual void decreaseFontSize() = 0;
132
133 virtual void increaseIndentation() = 0;
134 virtual void decreaseIndentation() = 0;
135
136 virtual void insertBulletedList() = 0;
137 virtual void insertNumberedList() = 0;
138
139 virtual void insertTableDialog() = 0;
140
141 virtual void insertFixedWidthTable(
142 int rows, int columns, int widthInPixels) = 0;
143
144 virtual void insertRelativeWidthTable(
145 int rows, int columns, double relativeWidth) = 0;
146
147 virtual void insertTableRow() = 0;
148 virtual void insertTableColumn() = 0;
149 virtual void removeTableRow() = 0;
150 virtual void removeTableColumn() = 0;
151
152 virtual void addAttachmentDialog() = 0;
153 virtual void saveAttachmentDialog(const QByteArray & resourceHash) = 0;
154 virtual void saveAttachmentUnderCursor() = 0;
155 virtual void openAttachment(const QByteArray & resourceHash) = 0;
156 virtual void openAttachmentUnderCursor() = 0;
157 virtual void copyAttachment(const QByteArray & resourceHash) = 0;
158 virtual void copyAttachmentUnderCursor() = 0;
159 virtual void removeAttachment(const QByteArray & resourceHash) = 0;
160 virtual void removeAttachmentUnderCursor() = 0;
161 virtual void renameAttachment(const QByteArray & resourceHash) = 0;
162 virtual void renameAttachmentUnderCursor() = 0;
163
164 enum class Rotation
165 {
166 Clockwise,
167 Counterclockwise
168 };
169
171 QTextStream & strm, Rotation rotation);
172
173 friend QUENTIER_EXPORT QDebug & operator<<(QDebug & dbg, Rotation rotation);
174
175 virtual void rotateImageAttachment(
176 const QByteArray & resourceHash, Rotation rotationDirection) = 0;
177
178 virtual void rotateImageAttachmentUnderCursor(
179 Rotation rotationDirection) = 0;
180
181 virtual void encryptSelectedText() = 0;
182
183 virtual void decryptEncryptedTextUnderCursor() = 0;
184
185 virtual void decryptEncryptedText(
188
189 virtual void hideDecryptedTextUnderCursor() = 0;
190
191 virtual void hideDecryptedText(
192 QString encryptedText, QString decryptedText, QString cipher,
194
195 virtual void editHyperlinkDialog() = 0;
196 virtual void copyHyperlink() = 0;
197 virtual void removeHyperlink() = 0;
198
199 virtual void onNoteLoadCancelled() = 0;
200
201 [[nodiscard]] virtual bool print(
202 QPrinter & printer, ErrorString & errorDescription) = 0;
203
204 [[nodiscard]] virtual bool exportToPdf(
205 const QString & absoluteFilePath, ErrorString & errorDescription) = 0;
206
207 [[nodiscard]] virtual bool exportToEnex(
208 const QStringList & tagNames, QString & enex,
209 ErrorString & errorDescription) = 0;
210
211 [[nodiscard]] virtual QString currentNoteLocalId() const = 0;
212 virtual void setCurrentNoteLocalId(const QString & noteLocalUid) = 0;
213
214 virtual void clear() = 0;
215
216 [[nodiscard]] virtual bool isModified() const = 0;
217 [[nodiscard]] virtual bool isEditorPageModified() const = 0;
218
219 virtual void setFocusToEditor() = 0;
220
221protected:
223 NoteEditor * m_pNoteEditor;
224};
225
226} // namespace quentier
The Account class encapsulates some details about the account: its name, whether it is local or synch...
Definition Account.h:38
The ErrorString class encapsulates two (or more) strings which are meant to contain translatable (bas...
Definition ErrorString.h:43
Definition INoteEditorBackend.h:41
The NoteEditor class is a widget encapsulating all the functionality necessary for showing and editin...
Definition NoteEditor.h:46
The Result template class represents the bare bones result monad implementation which either contains...
Definition Result.h:38
Definition SpellChecker.h:35