Scribus
Open source desktop publishing at your fingertips
cmdtext.h
1 /*
2 For general Scribus (>=1.3.2) copyright and licensing information please refer
3 to the COPYING file provided with the program. Following this notice may exist
4 a copyright and/or license notice that predates the release of Scribus 1.3.2
5 for which a new license (GPL+exception) is in place.
6 */
7 #ifndef CMDTEXT_H
8 #define CMDTEXT_H
9 
10 // Pulls in <Python.h> first
11 #include "cmdvar.h"
12 
16 PyDoc_STRVAR(scribus_getfontsize__doc__,
17 QT_TR_NOOP("getFontSize([\"name\"]) -> float\n\
18 \n\
19 Returns the font size in points for the text frame \"name\". If this text\n\
20 frame has some text selected the value assigned to the first character of\n\
21 the selection is returned.\n\
22 If \"name\" is not given the currently selected item is used.\n\
23 "));
25 PyObject *scribus_getfontsize(PyObject * /*self*/, PyObject* args);
26 
28 PyDoc_STRVAR(scribus_getfont__doc__,
29 QT_TR_NOOP("getFont([\"name\"]) -> string\n\
30 \n\
31 Returns the font name for the text frame \"name\". If this text frame\n\
32 has some text selected the value assigned to the first character\n\
33 of the selection is returned. If \"name\" is not given the currently\n\
34 selected item is used.\n\
35 "));
37 PyObject *scribus_getfont(PyObject * /*self*/, PyObject* args);
38 
40 PyDoc_STRVAR(scribus_gettextsize__doc__,
41 QT_TR_NOOP("getTextLength([\"name\"]) -> integer\n\
42 \n\
43 Returns the length of the text in the text frame \"name\".\n\
44 If \"name\" is not given the currently selected item is used.\n\
45 "));
47 PyObject *scribus_gettextsize(PyObject * /*self*/, PyObject* args);
48 
50 PyDoc_STRVAR(scribus_gettextlines__doc__,
51 QT_TR_NOOP("getTextLines([\"name\"]) -> integer\n\
52 \n\
53 Returns the number of lines of the text in the text frame \"name\".\n\
54 If \"name\" is not given the currently selected item is used.\n\
55 "));
57 PyObject *scribus_gettextlines(PyObject * /*self*/, PyObject* args);
58 
60 PyDoc_STRVAR(scribus_getframetext__doc__,
61 QT_TR_NOOP("getText([\"name\"]) -> string\n\
62 \n\
63 Returns the text of the text frame \"name\". If this text frame has some text\n\
64 selected, the selected text is returned. All text in the frame, not just\n\
65 currently visible text, is returned. If \"name\" is not given the currently\n\
66 selected item is used.\n\
67 "));
69 PyObject *scribus_getframetext(PyObject * /*self*/, PyObject* args);
70 
72 PyDoc_STRVAR(scribus_gettext__doc__,
73 QT_TR_NOOP("getAllText([\"name\"]) -> string\n\
74 \n\
75 Returns the text of the text frame \"name\" and of all text frames which are\n\
76 linked with this frame. If this textframe has some text selected, the selected\n\
77 text is returned. If \"name\" is not given the currently selected item is\n\
78 used.\n\
79 "));
81 PyObject *scribus_gettext(PyObject * /*self*/, PyObject* args);
82 
84 PyDoc_STRVAR(scribus_getlinespace__doc__,
85 QT_TR_NOOP("getLineSpacing([\"name\"]) -> float\n\
86 \n\
87 Returns the line spacing (\"leading\") of the text frame \"name\" expressed in\n\
88 points. If \"name\" is not given the currently selected item is used.\n\
89 "));
91 PyObject *scribus_getlinespace(PyObject * /*self*/, PyObject* args);
92 
94 PyDoc_STRVAR(scribus_gettextdistances__doc__,
95 QT_TR_NOOP("getTextDistances([\"name\"]) -> tuple\n\
96 \n\
97 Returns the text distances of the text frame \"name\" expressed in points. The\n\
98 distances are returned as a tuple like (left, right, top, bottom). If \"name\"\n\
99 is not given the currently selected item is used.\n\
100 "));
102 PyObject *scribus_gettextdistances(PyObject */*self*/, PyObject* args);
103 
105 PyDoc_STRVAR(scribus_getcolumngap__doc__,
106 QT_TR_NOOP("getColumnGap([\"name\"]) -> float\n\
107 \n\
108 Returns the column gap size of the text frame \"name\" expressed in points. If\n\
109 \"name\" is not given the currently selected item is used.\n\
110 "));
112 PyObject *scribus_getcolumngap(PyObject * /*self*/, PyObject* args);
113 
115 PyDoc_STRVAR(scribus_getcolumns__doc__,
116 QT_TR_NOOP("getColumns([\"name\"]) -> integer\n\
117 \n\
118 Gets the number of columns of the text frame \"name\". If \"name\" is not\n\
119 given the currently selected item is used.\n\
120 "));
122 PyObject *scribus_getcolumns(PyObject * /*self*/, PyObject* args);
123 
125 PyDoc_STRVAR(scribus_setboxtext__doc__,
126 QT_TR_NOOP("setText(\"text\", [\"name\"])\n\
127 \n\
128 Sets the text of the text frame \"name\" to the text of the string \"text\".\n\
129 Text must be UTF8 encoded - use e.g. unicode(text, 'iso-8859-2'). See the FAQ\n\
130 for more details. If \"name\" is not given the currently selected item is\n\
131 used.\n\
132 "));
134 PyObject *scribus_setboxtext(PyObject * /*self*/, PyObject* args);
135 
137 PyDoc_STRVAR(scribus_inserttext__doc__,
138 QT_TR_NOOP("insertText(\"text\", pos, [\"name\"])\n\
139 \n\
140 Inserts the text \"text\" at the position \"pos\" into the text frame \"name\".\n\
141 Text must be UTF encoded (see setText() as reference) The first character has an\n\
142 index of 0. Inserting text at position -1 appends it to the frame. If \"name\" is\n\
143 not given the currently selected Item is used.\n\
144 \n\
145 May throw IndexError for an insertion out of bounds.\n\
146 "));
148 PyObject *scribus_inserttext(PyObject * /*self*/, PyObject* args);
149 
151 PyDoc_STRVAR(scribus_inserthtmltext__doc__,
152 QT_TR_NOOP("insertHTMLText(\"file\", [\"name\"])\n\
153 \n\
154 Inserts the text from \"file\" into the text frame \"name\".\n\
155 Text must be UTF encoded (see setText() as reference). If \"name\" is\n\
156 not given the currently selected Item is used.\n\
157 "));
159 PyObject *scribus_inserthtmltext(PyObject * /*self*/, PyObject* args);
160 
162 PyDoc_STRVAR(scribus_setfont__doc__,
163 QT_TR_NOOP("setFont(\"font\", [\"name\"])\n\
164 \n\
165 Sets the font of the text frame \"name\" to \"font\". If there is some text\n\
166 selected only the selected text is changed. If \"name\" is not given the\n\
167 currently selected item is used.\n\
168 \n\
169 May throw ValueError if the font cannot be found.\n\
170 "));
172 PyObject *scribus_setfont(PyObject * /*self*/, PyObject* args);
173 
175 PyDoc_STRVAR(scribus_setfontsize__doc__,
176 QT_TR_NOOP("setFontSize(size, [\"name\"])\n\
177 \n\
178 Sets the font size of the text frame \"name\" to \"size\". \"size\" is treated\n\
179 as a value in points. If there is some text selected only the selected text is\n\
180 changed. \"size\" must be in the range 1 to 512. If \"name\" is not given the\n\
181 currently selected item is used.\n\
182 \n\
183 May throw ValueError for a font size that's out of bounds.\n\
184 "));
186 PyObject *scribus_setfontsize(PyObject * /*self*/, PyObject* args);
187 
189 PyDoc_STRVAR(scribus_setlinespace__doc__,
190 QT_TR_NOOP("setLineSpacing(size, [\"name\"])\n\
191 \n\
192 Sets the line spacing (\"leading\") of the text frame \"name\" to \"size\".\n\
193 \"size\" is a value in points. If \"name\" is not given the currently selected\n\
194 item is used.\n\
195 \n\
196 May throw ValueError if the line spacing is out of bounds.\n\
197 "));
199 PyObject *scribus_setlinespace(PyObject * /*self*/, PyObject* args);
200 
202 PyDoc_STRVAR(scribus_setlinespacemode__doc__,
203 QT_TR_NOOP("setLineSpacingMode(mode, [\"name\"])\n\
204 \n\
205 Sets the line spacing mode of the text frame \"name\" to \"mode\".\n\
206 If \"name\" is not given the currently selected\n\
207 item is used.\n\
208 Mode values are the same as in createParagraphStyle.\n\
209 \n\
210 May throw ValueError if the mode is out of bounds.\n\
211 "));
213 PyObject *scribus_setlinespacemode(PyObject * /*self*/, PyObject* args);
214 
216 PyDoc_STRVAR(scribus_settextdistances__doc__,
217 QT_TR_NOOP("setTextDistances(left, right, top, bottom, [\"name\"])\n\
218 \n\
219 Sets the text distances of the text frame \"name\" to the values \"left\"\n\
220 \"right\", \"top\" and \"bottom\". If \"name\" is not given the currently\n\
221 selected item is used.\n\
222 \n\
223 May throw ValueError if any of the distances are out of bounds (must be positive).\n\
224 "));
226 PyObject *scribus_settextdistances(PyObject */*self*/, PyObject* args);
227 
229 PyDoc_STRVAR(scribus_setcolumngap__doc__,
230 QT_TR_NOOP("setColumnGap(size, [\"name\"])\n\
231 \n\
232 Sets the column gap of the text frame \"name\" to the value \"size\". If\n\
233 \"name\" is not given the currently selected item is used.\n\
234 \n\
235 May throw ValueError if the column gap is out of bounds (must be positive).\n\
236 "));
238 PyObject *scribus_setcolumngap(PyObject * /*self*/, PyObject* args);
239 
241 PyDoc_STRVAR(scribus_setcolumns__doc__,
242 QT_TR_NOOP("setColumns(nr, [\"name\"])\n\
243 \n\
244 Sets the number of columns of the text frame \"name\" to the integer \"nr\".\n\
245 If \"name\" is not given the currently selected item is used.\n\
246 \n\
247 May throw ValueError if number of columns is not at least one.\n\
248 "));
250 PyObject *scribus_setcolumns(PyObject * /*self*/, PyObject* args);
251 
253 PyDoc_STRVAR(scribus_setalign__doc__,
254 QT_TR_NOOP("setTextAlignment(align, [\"name\"])\n\
255 \n\
256 Sets the text alignment of the text frame \"name\" to the specified alignment.\n\
257 If \"name\" is not given the currently selected item is used. \"align\" should\n\
258 be one of the ALIGN_ constants defined in this module - see dir(scribus).\n\
259 \n\
260 May throw ValueError for an invalid alignment constant.\n\
261 "));
263 PyObject *scribus_setalign(PyObject * /*self*/, PyObject* args);
264 
266 PyDoc_STRVAR(scribus_selecttext__doc__,
267 QT_TR_NOOP("selectText(start, count, [\"name\"])\n\
268 \n\
269 Selects \"count\" characters of text in the text frame \"name\" starting from the\n\
270 character \"start\". Character counting starts at 0. If \"count\" is zero, any\n\
271 text selection will be cleared. If \"name\" is not given the currently\n\
272 selected item is used.\n\
273 \n\
274 May throw IndexError if the selection is outside the bounds of the text.\n\
275 "));
277 PyObject *scribus_selecttext(PyObject * /*self*/, PyObject* args);
278 
280 PyDoc_STRVAR(scribus_deletetext__doc__,
281 QT_TR_NOOP("deleteText([\"name\"])\n\
282 \n\
283 Deletes any text in the text frame \"name\". If there is some text selected,\n\
284 only the selected text will be deleted. If \"name\" is not given the currently\n\
285 selected item is used.\n\
286 "));
288 PyObject *scribus_deletetext(PyObject * /*self*/, PyObject* args);
289 
291 PyDoc_STRVAR(scribus_settextfill__doc__,
292 QT_TR_NOOP("setTextColor(\"color\", [\"name\"])\n\
293 \n\
294 Sets the text color of the text frame \"name\" to the color \"color\". If there\n\
295 is some text selected only the selected text is changed. If \"name\" is not\n\
296 given the currently selected item is used.\n\
297 "));
299 PyObject *scribus_settextfill(PyObject * /*self*/, PyObject* args);
300 
302 PyDoc_STRVAR(scribus_settextstroke__doc__,
303 QT_TR_NOOP("setTextStroke(\"color\", [\"name\"])\n\
304 \n\
305 Set \"color\" of the text stroke. If \"name\" is not given the currently\n\
306 selected item is used.\n\
307 "));
309 PyObject *scribus_settextstroke(PyObject * /*self*/, PyObject* args);
310 
312 PyDoc_STRVAR(scribus_settextscalingv__doc__,
313 QT_TR_NOOP("setTextScalingV(scale, [\"name\"])\n\
314 \n\
315 Sets the vertical character scaling of the object \"name\" to \"scale\" in percent.\n\
316 If \"name\" is not given the currently selected item is used.\n\
317 "));
319 PyObject *scribus_settextscalingv(PyObject * /*self*/, PyObject* args);
320 
322 PyDoc_STRVAR(scribus_settextscalingh__doc__,
323 QT_TR_NOOP("setTextScalingH(scale, [\"name\"])\n\
324 \n\
325 Sets the horizontal character scaling of the object \"name\" to \"scale\" in percent.\n\
326 If \"name\" is not given the currently selected item is used.\n\
327 "));
329 PyObject *scribus_settextscalingh(PyObject * /*self*/, PyObject* args);
330 
332 PyDoc_STRVAR(scribus_settextshade__doc__,
333 QT_TR_NOOP("setTextShade(shade, [\"name\"])\n\
334 \n\
335 Sets the shading of the text color of the object \"name\" to \"shade\". If\n\
336 there is some text selected only the selected text is changed. \"shade\" must\n\
337 be an integer value in the range from 0 (lightest) to 100 (full color\n\
338 intensity). If \"name\" is not given the currently selected item is\n\
339 used.\n\
340 "));
342 PyObject *scribus_settextshade(PyObject * /*self*/, PyObject* args);
343 
345 PyDoc_STRVAR(scribus_linktextframes__doc__,
346 QT_TR_NOOP("linkTextFrames(\"fromname\", \"toname\")\n\
347 \n\
348 Link two text frames. The frame named \"fromname\" is linked to the\n\
349 frame named \"toname\". The target frame must be an empty text frame\n\
350 and must not link to or be linked from any other frames already.\n\
351 \n\
352 May throw ScribusException if linking rules are violated.\n\
353 "));
359 PyObject *scribus_linktextframes(PyObject * /*self*/, PyObject* args);
360 
362 PyDoc_STRVAR(scribus_unlinktextframes__doc__,
363 QT_TR_NOOP("unlinkTextFrames(\"name\")\n\
364 \n\
365 Remove the specified (named) object from the text frame flow/linkage. If the\n\
366 frame was in the middle of a chain, the previous and next frames will be\n\
367 connected, eg 'a->b->c' becomes 'a->c' when you unlinkTextFrames(b)'\n\
368 \n\
369 May throw ScribusException if linking rules are violated.\n\
370 "));
376 PyObject *scribus_unlinktextframes(PyObject * self, PyObject* args);
377 
379 PyDoc_STRVAR(scribus_tracetext__doc__,
380 QT_TR_NOOP("traceText([\"name\"])\n\
381 \n\
382 Convert the text frame \"name\" to outlines. If \"name\" is not given the\n\
383 currently selected item is used."));
388 PyObject *scribus_tracetext(PyObject * self, PyObject* args);
389 
390 PyDoc_STRVAR(scribus_istextoverflowing__doc__,
391 QT_TR_NOOP("textOverflows([\"name\", nolinks]) -> integer\n\
392 \n\
393 Returns 1 if there are overflowing characters in text frame \"name\", 0 if not.\n\
394 If is nolinks set to non zero value it takes only one frame - it doesn't\n\
395 use text frame linking. Without this parameter it search all linking chain.\n\
396 \n\
397 May raise WrongFrameTypeError if the target frame is not an text frame\n"));
401 PyObject *scribus_istextoverflowing(PyObject * self, PyObject* args, PyObject* kw);
402 
403 PyDoc_STRVAR(scribus_hyphenatetext__doc__,
404 QT_TR_NOOP("hyphenateText([\"name\"]) -> bool\n\
405 \n\
406 Does hyphenation on text frame \"name\".\n\
407 If \"name\" is not given the currently selected item is used.\n\
408 \n\
409 May raise WrongFrameTypeError if the target frame is not a text frame\n\
410 "));
411 /*
412  Does hyphenation on the given text frame
413  08.12.2007: Joachim Neu
414 */
415 PyObject *scribus_hyphenatetext(PyObject *, PyObject* args);
416 
417 PyDoc_STRVAR(scribus_dehyphenatetext__doc__,
418 QT_TR_NOOP("dehyphenateText([\"name\"]) -> bool\n\
419 \n\
420 Does dehyphenation on text frame \"name\".\n\
421 If \"name\" is not given the currently selected item is used.\n\
422 \n\
423 May raise WrongFrameTypeError if the target frame is not a text frame\n\
424 "));
425 /*
426  Does dehyphenation on the given text frame
427  13.12.2007: Joachim Neu
428 */
429 PyObject *scribus_dehyphenatetext(PyObject *, PyObject* args);
430 
432 PyDoc_STRVAR(scribus_setpdfbookmark__doc__,
433 QT_TR_NOOP("setPDFBookmark(\"toggle\", [\"name\"])\n\
434 \n\
435 Sets whether (toggle = 1) the text frame \"name\" is a bookmark nor not.\n\
436 If \"name\" is not given the currently selected item is used.\n\
437 \n\
438 May raise WrongFrameTypeError if the target frame is not a text frame\n\
439 "));
441 PyObject *scribus_setpdfbookmark(PyObject * /*self*/, PyObject* args);
442 
444 PyDoc_STRVAR(scribus_ispdfbookmark__doc__,
445  QT_TR_NOOP("isPDFBookmark([\"name\"]) -> bool\n\
446 \n\
447 Returns true if the text frame \"name\" is a PDF bookmark.\n\
448 If \"name\" is not given the currently selected item is used.\n\
449 \n\
450 May raise WrongFrameTypeError if the target frame is not a text frame\n\
451 "));
453 PyObject *scribus_ispdfbookmark(PyObject * /*self*/, PyObject* args);
454 
455 #endif