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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
|
/*
* e-html-editor-selection.h
*
* Copyright (C) 2012 Dan Vrátil <dvratil@redhat.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) version 3.
*
* This program 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with the program; if not, see <http://www.gnu.org/licenses/>
*
*/
#if !defined (__E_UTIL_H_INSIDE__) && !defined (LIBEUTIL_COMPILATION)
#error "Only <e-util/e-util.h> should be included directly."
#endif
#ifndef E_HTML_EDITOR_SELECTION_H
#define E_HTML_EDITOR_SELECTION_H
#include <gtk/gtk.h>
#include <e-util/e-util-enums.h>
#include <webkit/webkit.h>
/* Standard GObject macros */
#define E_TYPE_HTML_EDITOR_SELECTION \
(e_html_editor_selection_get_type ())
#define E_HTML_EDITOR_SELECTION(obj) \
(G_TYPE_CHECK_INSTANCE_CAST \
((obj), E_TYPE_HTML_EDITOR_SELECTION, EHTMLEditorSelection))
#define E_HTML_EDITOR_SELECTION_CLASS(cls) \
(G_TYPE_CHECK_CLASS_CAST \
((cls), E_TYPE_HTML_EDITOR_SELECTION, EHTMLEditorSelectionClass))
#define E_IS_HTML_EDITOR_SELECTION(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE \
((obj), E_TYPE_HTML_EDITOR_SELECTION))
#define E_IS_HTML_EDITOR_SELECTION_CLASS(cls) \
(G_TYPE_CHECK_CLASS_TYPE \
((cls), E_TYPE_HTML_EDITOR_SELECTION))
#define E_HTML_EDITOR_SELECTION_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS \
((obj), E_TYPE_HTML_EDITOR_SELECTION, EHTMLEditorSelectionClass))
G_BEGIN_DECLS
struct _EHTMLEditorView;
typedef struct _EHTMLEditorSelection EHTMLEditorSelection;
typedef struct _EHTMLEditorSelectionClass EHTMLEditorSelectionClass;
typedef struct _EHTMLEditorSelectionPrivate EHTMLEditorSelectionPrivate;
struct _EHTMLEditorSelection {
GObject parent;
EHTMLEditorSelectionPrivate *priv;
};
struct _EHTMLEditorSelectionClass {
GObjectClass parent_class;
};
GType e_html_editor_selection_get_type
(void) G_GNUC_CONST;
struct _EHTMLEditorView *
e_html_editor_selection_ref_html_editor_view
(EHTMLEditorSelection *selection);
void e_html_editor_selection_block_selection_changed
(EHTMLEditorSelection *selection);
void e_html_editor_selection_unblock_selection_changed
(EHTMLEditorSelection *selection);
gint e_html_editor_selection_get_word_wrap_length
(EHTMLEditorSelection *selection);
gboolean e_html_editor_selection_has_text
(EHTMLEditorSelection *selection);
gchar * e_html_editor_selection_get_caret_word
(EHTMLEditorSelection *selection);
void e_html_editor_selection_replace_caret_word
(EHTMLEditorSelection *selection,
const gchar *replacement);
EHTMLEditorSelectionAlignment
e_html_editor_selection_get_alignment
(EHTMLEditorSelection *selection);
void e_html_editor_selection_set_alignment
(EHTMLEditorSelection *selection,
EHTMLEditorSelectionAlignment alignment);
const gchar * e_html_editor_selection_get_background_color
(EHTMLEditorSelection *selection);
void e_html_editor_selection_set_background_color
(EHTMLEditorSelection *selection,
const gchar *color);
void e_html_editor_selection_get_font_color
(EHTMLEditorSelection *selection,
GdkRGBA *rgba);
void e_html_editor_selection_set_font_color
(EHTMLEditorSelection *selection,
const GdkRGBA *rgba);
const gchar * e_html_editor_selection_get_font_name
(EHTMLEditorSelection *selection);
void e_html_editor_selection_set_font_name
(EHTMLEditorSelection *selection,
const gchar *font_name);
guint e_html_editor_selection_get_font_size
(EHTMLEditorSelection *selection);
void e_html_editor_selection_set_font_size
(EHTMLEditorSelection *selection,
guint font_size);
EHTMLEditorSelectionBlockFormat
e_html_editor_selection_get_block_format
(EHTMLEditorSelection *selection);
void e_html_editor_selection_set_block_format
(EHTMLEditorSelection *selection,
EHTMLEditorSelectionBlockFormat format);
gboolean e_html_editor_selection_is_citation
(EHTMLEditorSelection *selection);
gboolean e_html_editor_selection_is_indented
(EHTMLEditorSelection *selection);
void e_html_editor_selection_indent (EHTMLEditorSelection *selection);
void e_html_editor_selection_unindent
(EHTMLEditorSelection *selection);
gboolean e_html_editor_selection_is_bold (EHTMLEditorSelection *selection);
void e_html_editor_selection_set_bold
(EHTMLEditorSelection *selection,
gboolean bold);
gboolean e_html_editor_selection_is_italic
(EHTMLEditorSelection *selection);
void e_html_editor_selection_set_italic
(EHTMLEditorSelection *selection,
gboolean italic);
gboolean e_html_editor_selection_is_monospaced
(EHTMLEditorSelection *selection);
void e_html_editor_selection_set_monospaced
(EHTMLEditorSelection *selection,
gboolean monospaced);
gboolean e_html_editor_selection_is_strikethrough
(EHTMLEditorSelection *selection);
void e_html_editor_selection_set_strikethrough
(EHTMLEditorSelection *selection,
gboolean strikethrough);
gboolean e_html_editor_selection_is_superscript
(EHTMLEditorSelection *selection);
void e_html_editor_selection_set_superscript
(EHTMLEditorSelection *selection,
gboolean superscript);
gboolean e_html_editor_selection_is_subscript
(EHTMLEditorSelection *selection);
void e_html_editor_selection_set_subscript
(EHTMLEditorSelection *selection,
gboolean subscript);
gboolean e_html_editor_selection_is_underline
(EHTMLEditorSelection *selection);
void e_html_editor_selection_set_underline
(EHTMLEditorSelection *selection,
gboolean underline);
void e_html_editor_selection_unlink (EHTMLEditorSelection *selection);
void e_html_editor_selection_create_link
(EHTMLEditorSelection *selection,
const gchar *uri);
gboolean e_html_editor_selection_is_collapsed
(EHTMLEditorSelection *selection);
const gchar * e_html_editor_selection_get_string
(EHTMLEditorSelection *selection);
void e_html_editor_selection_replace (EHTMLEditorSelection *selection,
const gchar *new_string);
void e_html_editor_selection_insert_text
(EHTMLEditorSelection *selection,
const gchar *plain_text);
void e_html_editor_selection_insert_html
(EHTMLEditorSelection *selection,
const gchar *html_text);
void e_html_editor_selection_insert_as_text
(EHTMLEditorSelection *selection,
const gchar *html_text);
void e_html_editor_selection_replace_image_src
(EHTMLEditorSelection *selection,
WebKitDOMElement *element,
const gchar *image_uri);
void e_html_editor_selection_insert_image
(EHTMLEditorSelection *selection,
const gchar *image_uri);
void e_html_editor_selection_move_caret_into_element
(WebKitDOMDocument *document,
WebKitDOMElement *element);
void e_html_editor_selection_clear_caret_position_marker
(EHTMLEditorSelection *selection);
WebKitDOMNode *
e_html_editor_selection_get_caret_position_node
(WebKitDOMDocument *document);
WebKitDOMElement *
e_html_editor_selection_save_caret_position
(EHTMLEditorSelection *selection);
void e_html_editor_selection_restore_caret_position
(EHTMLEditorSelection *selection);
void e_html_editor_selection_set_indented_style
(EHTMLEditorSelection *selection,
WebKitDOMElement *element,
gint width);
WebKitDOMElement *
e_html_editor_selection_get_indented_element
(EHTMLEditorSelection *selection,
WebKitDOMDocument *document,
gint width);
void e_html_editor_selection_set_paragraph_style
(EHTMLEditorSelection *selection,
WebKitDOMElement *element,
gint width,
gint offset,
const gchar *style_to_add);
WebKitDOMElement *
e_html_editor_selection_get_paragraph_element
(EHTMLEditorSelection *selection,
WebKitDOMDocument *document,
gint width,
gint offset);
WebKitDOMElement *
e_html_editor_selection_put_node_into_paragraph
(EHTMLEditorSelection *selection,
WebKitDOMDocument *document,
WebKitDOMNode *node,
WebKitDOMNode *caret_position);
void e_html_editor_selection_wrap_lines
(EHTMLEditorSelection *selection);
WebKitDOMElement *
e_html_editor_selection_wrap_paragraph_length
(EHTMLEditorSelection *selection,
WebKitDOMElement *paragraph,
gint length);
void e_html_editor_selection_wrap_paragraphs_in_document
(EHTMLEditorSelection *selection,
WebKitDOMDocument *document);
WebKitDOMElement *
e_html_editor_selection_wrap_paragraph
(EHTMLEditorSelection *selection,
WebKitDOMElement *paragraph);
void e_html_editor_selection_save (EHTMLEditorSelection *selection);
void e_html_editor_selection_restore (EHTMLEditorSelection *selection);
void e_html_editor_selection_move (EHTMLEditorSelection *selection,
gboolean forward,
EHTMLEditorSelectionGranularity granularity);
void e_html_editor_selection_extend (EHTMLEditorSelection *selection,
gboolean forward,
EHTMLEditorSelectionGranularity granularity);
void e_html_editor_selection_scroll_to_caret
(EHTMLEditorSelection *selection);
EHTMLEditorSelectionBlockFormat
e_html_editor_selection_get_list_format_from_node
(WebKitDOMNode *node);
EHTMLEditorSelectionAlignment
e_html_editor_selection_get_list_alignment_from_node
(WebKitDOMNode *node);
void remove_wrapping_from_element (WebKitDOMElement *element);
void remove_quoting_from_element (WebKitDOMElement *element);
G_END_DECLS
#endif /* E_HTML_EDITOR_SELECTION_H */
|