1 //******************************************************************************
2 //  Copyright (c) 2005-2013 by Jan Van hijfte
3 //
4 //  See the included file COPYING.TXT for details about the copyright.
5 //
6 //  This program is distributed in the hope that it will be useful,
7 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
8 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9 //******************************************************************************
10 
11 
12 #include "qtextcursor_c.h"
13 
QTextCursor_Create()14 QTextCursorH QTextCursor_Create()
15 {
16 	return (QTextCursorH) new QTextCursor();
17 }
18 
QTextCursor_Destroy(QTextCursorH handle)19 void QTextCursor_Destroy(QTextCursorH handle)
20 {
21 	delete (QTextCursor *)handle;
22 }
23 
QTextCursor_Create2(QTextDocumentH document)24 QTextCursorH QTextCursor_Create2(QTextDocumentH document)
25 {
26 	return (QTextCursorH) new QTextCursor((QTextDocument*)document);
27 }
28 
QTextCursor_Create3(QTextFrameH frame)29 QTextCursorH QTextCursor_Create3(QTextFrameH frame)
30 {
31 	return (QTextCursorH) new QTextCursor((QTextFrame*)frame);
32 }
33 
QTextCursor_Create4(const QTextBlockH block)34 QTextCursorH QTextCursor_Create4(const QTextBlockH block)
35 {
36 	return (QTextCursorH) new QTextCursor(*(const QTextBlock*)block);
37 }
38 
QTextCursor_Create6(const QTextCursorH cursor)39 QTextCursorH QTextCursor_Create6(const QTextCursorH cursor)
40 {
41 	return (QTextCursorH) new QTextCursor(*(const QTextCursor*)cursor);
42 }
43 
QTextCursor_swap(QTextCursorH handle,QTextCursorH other)44 void QTextCursor_swap(QTextCursorH handle, QTextCursorH other)
45 {
46 	((QTextCursor *)handle)->swap(*(QTextCursor*)other);
47 }
48 
QTextCursor_isNull(QTextCursorH handle)49 bool QTextCursor_isNull(QTextCursorH handle)
50 {
51 	return (bool) ((QTextCursor *)handle)->isNull();
52 }
53 
QTextCursor_setPosition(QTextCursorH handle,int pos,QTextCursor::MoveMode mode)54 void QTextCursor_setPosition(QTextCursorH handle, int pos, QTextCursor::MoveMode mode)
55 {
56 	((QTextCursor *)handle)->setPosition(pos, mode);
57 }
58 
QTextCursor_position(QTextCursorH handle)59 int QTextCursor_position(QTextCursorH handle)
60 {
61 	return (int) ((QTextCursor *)handle)->position();
62 }
63 
QTextCursor_positionInBlock(QTextCursorH handle)64 int QTextCursor_positionInBlock(QTextCursorH handle)
65 {
66 	return (int) ((QTextCursor *)handle)->positionInBlock();
67 }
68 
QTextCursor_anchor(QTextCursorH handle)69 int QTextCursor_anchor(QTextCursorH handle)
70 {
71 	return (int) ((QTextCursor *)handle)->anchor();
72 }
73 
QTextCursor_insertText(QTextCursorH handle,PWideString text)74 void QTextCursor_insertText(QTextCursorH handle, PWideString text)
75 {
76 	QString t_text;
77 	copyPWideStringToQString(text, t_text);
78 	((QTextCursor *)handle)->insertText(t_text);
79 }
80 
QTextCursor_insertText2(QTextCursorH handle,PWideString text,const QTextCharFormatH format)81 void QTextCursor_insertText2(QTextCursorH handle, PWideString text, const QTextCharFormatH format)
82 {
83 	QString t_text;
84 	copyPWideStringToQString(text, t_text);
85 	((QTextCursor *)handle)->insertText(t_text, *(const QTextCharFormat*)format);
86 }
87 
QTextCursor_movePosition(QTextCursorH handle,QTextCursor::MoveOperation op,QTextCursor::MoveMode AnonParam2,int n)88 bool QTextCursor_movePosition(QTextCursorH handle, QTextCursor::MoveOperation op, QTextCursor::MoveMode AnonParam2, int n)
89 {
90 	return (bool) ((QTextCursor *)handle)->movePosition(op, AnonParam2, n);
91 }
92 
QTextCursor_visualNavigation(QTextCursorH handle)93 bool QTextCursor_visualNavigation(QTextCursorH handle)
94 {
95 	return (bool) ((QTextCursor *)handle)->visualNavigation();
96 }
97 
QTextCursor_setVisualNavigation(QTextCursorH handle,bool b)98 void QTextCursor_setVisualNavigation(QTextCursorH handle, bool b)
99 {
100 	((QTextCursor *)handle)->setVisualNavigation(b);
101 }
102 
QTextCursor_setVerticalMovementX(QTextCursorH handle,int x)103 void QTextCursor_setVerticalMovementX(QTextCursorH handle, int x)
104 {
105 	((QTextCursor *)handle)->setVerticalMovementX(x);
106 }
107 
QTextCursor_verticalMovementX(QTextCursorH handle)108 int QTextCursor_verticalMovementX(QTextCursorH handle)
109 {
110 	return (int) ((QTextCursor *)handle)->verticalMovementX();
111 }
112 
QTextCursor_setKeepPositionOnInsert(QTextCursorH handle,bool b)113 void QTextCursor_setKeepPositionOnInsert(QTextCursorH handle, bool b)
114 {
115 	((QTextCursor *)handle)->setKeepPositionOnInsert(b);
116 }
117 
QTextCursor_keepPositionOnInsert(QTextCursorH handle)118 bool QTextCursor_keepPositionOnInsert(QTextCursorH handle)
119 {
120 	return (bool) ((QTextCursor *)handle)->keepPositionOnInsert();
121 }
122 
QTextCursor_deleteChar(QTextCursorH handle)123 void QTextCursor_deleteChar(QTextCursorH handle)
124 {
125 	((QTextCursor *)handle)->deleteChar();
126 }
127 
QTextCursor_deletePreviousChar(QTextCursorH handle)128 void QTextCursor_deletePreviousChar(QTextCursorH handle)
129 {
130 	((QTextCursor *)handle)->deletePreviousChar();
131 }
132 
QTextCursor_select(QTextCursorH handle,QTextCursor::SelectionType selection)133 void QTextCursor_select(QTextCursorH handle, QTextCursor::SelectionType selection)
134 {
135 	((QTextCursor *)handle)->select(selection);
136 }
137 
QTextCursor_hasSelection(QTextCursorH handle)138 bool QTextCursor_hasSelection(QTextCursorH handle)
139 {
140 	return (bool) ((QTextCursor *)handle)->hasSelection();
141 }
142 
QTextCursor_hasComplexSelection(QTextCursorH handle)143 bool QTextCursor_hasComplexSelection(QTextCursorH handle)
144 {
145 	return (bool) ((QTextCursor *)handle)->hasComplexSelection();
146 }
147 
QTextCursor_removeSelectedText(QTextCursorH handle)148 void QTextCursor_removeSelectedText(QTextCursorH handle)
149 {
150 	((QTextCursor *)handle)->removeSelectedText();
151 }
152 
QTextCursor_clearSelection(QTextCursorH handle)153 void QTextCursor_clearSelection(QTextCursorH handle)
154 {
155 	((QTextCursor *)handle)->clearSelection();
156 }
157 
QTextCursor_selectionStart(QTextCursorH handle)158 int QTextCursor_selectionStart(QTextCursorH handle)
159 {
160 	return (int) ((QTextCursor *)handle)->selectionStart();
161 }
162 
QTextCursor_selectionEnd(QTextCursorH handle)163 int QTextCursor_selectionEnd(QTextCursorH handle)
164 {
165 	return (int) ((QTextCursor *)handle)->selectionEnd();
166 }
167 
QTextCursor_selectedText(QTextCursorH handle,PWideString retval)168 void QTextCursor_selectedText(QTextCursorH handle, PWideString retval)
169 {
170 	QString t_retval;
171 	t_retval = ((QTextCursor *)handle)->selectedText();
172 	copyQStringToPWideString(t_retval, retval);
173 }
174 
QTextCursor_selection(QTextCursorH handle,QTextDocumentFragmentH retval)175 void QTextCursor_selection(QTextCursorH handle, QTextDocumentFragmentH retval)
176 {
177 	*(QTextDocumentFragment *)retval = ((QTextCursor *)handle)->selection();
178 }
179 
QTextCursor_selectedTableCells(QTextCursorH handle,int * firstRow,int * numRows,int * firstColumn,int * numColumns)180 void QTextCursor_selectedTableCells(QTextCursorH handle, int* firstRow, int* numRows, int* firstColumn, int* numColumns)
181 {
182 	((QTextCursor *)handle)->selectedTableCells(firstRow, numRows, firstColumn, numColumns);
183 }
184 
QTextCursor_block(QTextCursorH handle,QTextBlockH retval)185 void QTextCursor_block(QTextCursorH handle, QTextBlockH retval)
186 {
187 	*(QTextBlock *)retval = ((QTextCursor *)handle)->block();
188 }
189 
QTextCursor_charFormat(QTextCursorH handle,QTextCharFormatH retval)190 void QTextCursor_charFormat(QTextCursorH handle, QTextCharFormatH retval)
191 {
192 	*(QTextCharFormat *)retval = ((QTextCursor *)handle)->charFormat();
193 }
194 
QTextCursor_setCharFormat(QTextCursorH handle,const QTextCharFormatH format)195 void QTextCursor_setCharFormat(QTextCursorH handle, const QTextCharFormatH format)
196 {
197 	((QTextCursor *)handle)->setCharFormat(*(const QTextCharFormat*)format);
198 }
199 
QTextCursor_mergeCharFormat(QTextCursorH handle,const QTextCharFormatH modifier)200 void QTextCursor_mergeCharFormat(QTextCursorH handle, const QTextCharFormatH modifier)
201 {
202 	((QTextCursor *)handle)->mergeCharFormat(*(const QTextCharFormat*)modifier);
203 }
204 
QTextCursor_blockFormat(QTextCursorH handle,QTextBlockFormatH retval)205 void QTextCursor_blockFormat(QTextCursorH handle, QTextBlockFormatH retval)
206 {
207 	*(QTextBlockFormat *)retval = ((QTextCursor *)handle)->blockFormat();
208 }
209 
QTextCursor_setBlockFormat(QTextCursorH handle,const QTextBlockFormatH format)210 void QTextCursor_setBlockFormat(QTextCursorH handle, const QTextBlockFormatH format)
211 {
212 	((QTextCursor *)handle)->setBlockFormat(*(const QTextBlockFormat*)format);
213 }
214 
QTextCursor_mergeBlockFormat(QTextCursorH handle,const QTextBlockFormatH modifier)215 void QTextCursor_mergeBlockFormat(QTextCursorH handle, const QTextBlockFormatH modifier)
216 {
217 	((QTextCursor *)handle)->mergeBlockFormat(*(const QTextBlockFormat*)modifier);
218 }
219 
QTextCursor_blockCharFormat(QTextCursorH handle,QTextCharFormatH retval)220 void QTextCursor_blockCharFormat(QTextCursorH handle, QTextCharFormatH retval)
221 {
222 	*(QTextCharFormat *)retval = ((QTextCursor *)handle)->blockCharFormat();
223 }
224 
QTextCursor_setBlockCharFormat(QTextCursorH handle,const QTextCharFormatH format)225 void QTextCursor_setBlockCharFormat(QTextCursorH handle, const QTextCharFormatH format)
226 {
227 	((QTextCursor *)handle)->setBlockCharFormat(*(const QTextCharFormat*)format);
228 }
229 
QTextCursor_mergeBlockCharFormat(QTextCursorH handle,const QTextCharFormatH modifier)230 void QTextCursor_mergeBlockCharFormat(QTextCursorH handle, const QTextCharFormatH modifier)
231 {
232 	((QTextCursor *)handle)->mergeBlockCharFormat(*(const QTextCharFormat*)modifier);
233 }
234 
QTextCursor_atBlockStart(QTextCursorH handle)235 bool QTextCursor_atBlockStart(QTextCursorH handle)
236 {
237 	return (bool) ((QTextCursor *)handle)->atBlockStart();
238 }
239 
QTextCursor_atBlockEnd(QTextCursorH handle)240 bool QTextCursor_atBlockEnd(QTextCursorH handle)
241 {
242 	return (bool) ((QTextCursor *)handle)->atBlockEnd();
243 }
244 
QTextCursor_atStart(QTextCursorH handle)245 bool QTextCursor_atStart(QTextCursorH handle)
246 {
247 	return (bool) ((QTextCursor *)handle)->atStart();
248 }
249 
QTextCursor_atEnd(QTextCursorH handle)250 bool QTextCursor_atEnd(QTextCursorH handle)
251 {
252 	return (bool) ((QTextCursor *)handle)->atEnd();
253 }
254 
QTextCursor_insertBlock(QTextCursorH handle)255 void QTextCursor_insertBlock(QTextCursorH handle)
256 {
257 	((QTextCursor *)handle)->insertBlock();
258 }
259 
QTextCursor_insertBlock2(QTextCursorH handle,const QTextBlockFormatH format)260 void QTextCursor_insertBlock2(QTextCursorH handle, const QTextBlockFormatH format)
261 {
262 	((QTextCursor *)handle)->insertBlock(*(const QTextBlockFormat*)format);
263 }
264 
QTextCursor_insertBlock3(QTextCursorH handle,const QTextBlockFormatH format,const QTextCharFormatH charFormat)265 void QTextCursor_insertBlock3(QTextCursorH handle, const QTextBlockFormatH format, const QTextCharFormatH charFormat)
266 {
267 	((QTextCursor *)handle)->insertBlock(*(const QTextBlockFormat*)format, *(const QTextCharFormat*)charFormat);
268 }
269 
QTextCursor_insertList(QTextCursorH handle,const QTextListFormatH format)270 QTextListH QTextCursor_insertList(QTextCursorH handle, const QTextListFormatH format)
271 {
272 	return (QTextListH) ((QTextCursor *)handle)->insertList(*(const QTextListFormat*)format);
273 }
274 
QTextCursor_insertList2(QTextCursorH handle,QTextListFormat::Style style)275 QTextListH QTextCursor_insertList2(QTextCursorH handle, QTextListFormat::Style style)
276 {
277 	return (QTextListH) ((QTextCursor *)handle)->insertList(style);
278 }
279 
QTextCursor_createList(QTextCursorH handle,const QTextListFormatH format)280 QTextListH QTextCursor_createList(QTextCursorH handle, const QTextListFormatH format)
281 {
282 	return (QTextListH) ((QTextCursor *)handle)->createList(*(const QTextListFormat*)format);
283 }
284 
QTextCursor_createList2(QTextCursorH handle,QTextListFormat::Style style)285 QTextListH QTextCursor_createList2(QTextCursorH handle, QTextListFormat::Style style)
286 {
287 	return (QTextListH) ((QTextCursor *)handle)->createList(style);
288 }
289 
QTextCursor_currentList(QTextCursorH handle)290 QTextListH QTextCursor_currentList(QTextCursorH handle)
291 {
292 	return (QTextListH) ((QTextCursor *)handle)->currentList();
293 }
294 
QTextCursor_insertTable(QTextCursorH handle,int rows,int cols,const QTextTableFormatH format)295 QTextTableH QTextCursor_insertTable(QTextCursorH handle, int rows, int cols, const QTextTableFormatH format)
296 {
297 	return (QTextTableH) ((QTextCursor *)handle)->insertTable(rows, cols, *(const QTextTableFormat*)format);
298 }
299 
QTextCursor_insertTable2(QTextCursorH handle,int rows,int cols)300 QTextTableH QTextCursor_insertTable2(QTextCursorH handle, int rows, int cols)
301 {
302 	return (QTextTableH) ((QTextCursor *)handle)->insertTable(rows, cols);
303 }
304 
QTextCursor_currentTable(QTextCursorH handle)305 QTextTableH QTextCursor_currentTable(QTextCursorH handle)
306 {
307 	return (QTextTableH) ((QTextCursor *)handle)->currentTable();
308 }
309 
QTextCursor_insertFrame(QTextCursorH handle,const QTextFrameFormatH format)310 QTextFrameH QTextCursor_insertFrame(QTextCursorH handle, const QTextFrameFormatH format)
311 {
312 	return (QTextFrameH) ((QTextCursor *)handle)->insertFrame(*(const QTextFrameFormat*)format);
313 }
314 
QTextCursor_currentFrame(QTextCursorH handle)315 QTextFrameH QTextCursor_currentFrame(QTextCursorH handle)
316 {
317 	return (QTextFrameH) ((QTextCursor *)handle)->currentFrame();
318 }
319 
QTextCursor_insertFragment(QTextCursorH handle,const QTextDocumentFragmentH fragment)320 void QTextCursor_insertFragment(QTextCursorH handle, const QTextDocumentFragmentH fragment)
321 {
322 	((QTextCursor *)handle)->insertFragment(*(const QTextDocumentFragment*)fragment);
323 }
324 
QTextCursor_insertHtml(QTextCursorH handle,PWideString html)325 void QTextCursor_insertHtml(QTextCursorH handle, PWideString html)
326 {
327 	QString t_html;
328 	copyPWideStringToQString(html, t_html);
329 	((QTextCursor *)handle)->insertHtml(t_html);
330 }
331 
QTextCursor_insertImage(QTextCursorH handle,const QTextImageFormatH format,QTextFrameFormat::Position alignment)332 void QTextCursor_insertImage(QTextCursorH handle, const QTextImageFormatH format, QTextFrameFormat::Position alignment)
333 {
334 	((QTextCursor *)handle)->insertImage(*(const QTextImageFormat*)format, alignment);
335 }
336 
QTextCursor_insertImage2(QTextCursorH handle,const QTextImageFormatH format)337 void QTextCursor_insertImage2(QTextCursorH handle, const QTextImageFormatH format)
338 {
339 	((QTextCursor *)handle)->insertImage(*(const QTextImageFormat*)format);
340 }
341 
QTextCursor_insertImage3(QTextCursorH handle,PWideString name)342 void QTextCursor_insertImage3(QTextCursorH handle, PWideString name)
343 {
344 	QString t_name;
345 	copyPWideStringToQString(name, t_name);
346 	((QTextCursor *)handle)->insertImage(t_name);
347 }
348 
QTextCursor_insertImage4(QTextCursorH handle,const QImageH image,PWideString name)349 void QTextCursor_insertImage4(QTextCursorH handle, const QImageH image, PWideString name)
350 {
351 	QString t_name;
352 	copyPWideStringToQString(name, t_name);
353 	((QTextCursor *)handle)->insertImage(*(const QImage*)image, t_name);
354 }
355 
QTextCursor_beginEditBlock(QTextCursorH handle)356 void QTextCursor_beginEditBlock(QTextCursorH handle)
357 {
358 	((QTextCursor *)handle)->beginEditBlock();
359 }
360 
QTextCursor_joinPreviousEditBlock(QTextCursorH handle)361 void QTextCursor_joinPreviousEditBlock(QTextCursorH handle)
362 {
363 	((QTextCursor *)handle)->joinPreviousEditBlock();
364 }
365 
QTextCursor_endEditBlock(QTextCursorH handle)366 void QTextCursor_endEditBlock(QTextCursorH handle)
367 {
368 	((QTextCursor *)handle)->endEditBlock();
369 }
370 
QTextCursor_isCopyOf(QTextCursorH handle,const QTextCursorH other)371 bool QTextCursor_isCopyOf(QTextCursorH handle, const QTextCursorH other)
372 {
373 	return (bool) ((QTextCursor *)handle)->isCopyOf(*(const QTextCursor*)other);
374 }
375 
QTextCursor_blockNumber(QTextCursorH handle)376 int QTextCursor_blockNumber(QTextCursorH handle)
377 {
378 	return (int) ((QTextCursor *)handle)->blockNumber();
379 }
380 
QTextCursor_columnNumber(QTextCursorH handle)381 int QTextCursor_columnNumber(QTextCursorH handle)
382 {
383 	return (int) ((QTextCursor *)handle)->columnNumber();
384 }
385 
QTextCursor_document(QTextCursorH handle)386 QTextDocumentH QTextCursor_document(QTextCursorH handle)
387 {
388 	return (QTextDocumentH) ((QTextCursor *)handle)->document();
389 }
390 
391