Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 23686 → Rev 23687

/trunk/Scribus/doc/de/scripterapi-manobj.html
21,9 → 21,15
<dd><code>duplicateObject(["name"]) -&gt; string</code>
<p>Creates a Duplicate of the selected Object (or Selection Group).</p></dd>
 
<dt><a name="-getCharacterStyle"><strong>getCharacterStyle</strong></a>(...)</dt>
<dd><code>getCharacterStyle(["name"])</code>
<p>Return name of character style applied to object named "name". If "name" is not given, the currently selected object is used.<p>
<p>If current object has a text selection, the name of style applied to start of selection is returned. Otherwise the name of the item default character style is returned.</p>
<p>May raise WrongFrameTypeError.</p></dd>
 
<dt><a name="-getParagraphStyle"><strong>getParagraphStyle</strong></a>(...)</dt>
<dd><code>getParagraphStyle(["name"])</code>
<p>Return name of style applied to object named "name". If "name" is not given, the currently selected object is used.<p>
<p>Return name of paragraph style applied to object named "name". If "name" is not given, the currently selected object is used.<p>
<p>If current object has a text selection, the name of style applied to start of selection is returned. Otherwise the name of the item default style is returned.</p>
<p>May raise WrongFrameTypeError.</p></dd>
 
/trunk/Scribus/doc/en/scripterapi-manobj.html
21,9 → 21,15
<dd><code>duplicateObject(["name"]) -&gt; string</code>
<p>Creates a Duplicate of the selected Object (or Selection Group).</p></dd>
 
<dt><a name="-getCharacterStyle"><strong>getCharacterStyle</strong></a>(...)</dt>
<dd><code>getCharacterStyle(["name"])</code>
<p>Return name of character style applied to object named "name". If "name" is not given, the currently selected object is used.<p>
<p>If current object has a text selection, the name of style applied to start of selection is returned. Otherwise the name of the item default character style is returned.</p>
<p>May raise WrongFrameTypeError.</p></dd>
 
<dt><a name="-getParagraphStyle"><strong>getParagraphStyle</strong></a>(...)</dt>
<dd><code>getParagraphStyle(["name"])</code>
<p>Return name of style applied to object named "name". If "name" is not given, the currently selected object is used.<p>
<p>Return name of paragraph style applied to object named "name". If "name" is not given, the currently selected object is used.<p>
<p>If current object has a text selection, the name of style applied to start of selection is returned. Otherwise the name of the item default style is returned.</p>
<p>May raise WrongFrameTypeError.</p></dd>
 
/trunk/Scribus/doc/fr/scripterapi-manobj.html
21,9 → 21,15
<dd><code>duplicateObject(["nom"]) -&gt; chaîne</code>
<p>Crée une copie du ou des objects sélectionnés dans le document courant.</p></dd>
 
<dt><a name="-getCharacterStyle"><strong>getCharacterStyle</strong></a>(...)</dt>
<dd><code>getCharacterStyle(["nom"]) -&gt; chaîne</code>
<p>Retourne le nom du style de caractère appliqué à l'objet "nom". Si aucun nom d'objet n'est fourni, l'élément sélectionné est utilisé.</p>
<p>Si l'objet courant poss&egrave;de une sélection de texte, le nom retourné est celui du style appliqué au début de la sélection. Sinon le nom retourné est celui du style de caractère appliqué par défaut.</p>
<p>Peut générer l'exception WrongFrameTypeError.</p></dd>
 
<dt><a name="-getParagraphStyle"><strong>getParagraphStyle</strong></a>(...)</dt>
<dd><code>getParagraphStyle(["nom"]) -&gt; chaîne</code>
<p>Retourne le nom du style appliqué à l'objet "nom". Si aucun nom d'objet n'est fourni, l'élément sélectionné est utilisé.</p>
<p>Retourne le nom du style de paragraphe appliqué à l'objet "nom". Si aucun nom d'objet n'est fourni, l'élément sélectionné est utilisé.</p>
<p>Si l'objet courant poss&egrave;de une sélection de texte, le nom retourné est celui du style appliqué au début de la sélection. Sinon le nom retourné est celui du style appliqué par défaut.</p>
<p>Peut générer l'exception WrongFrameTypeError.</p></dd>
 
/trunk/Scribus/doc/it/scripterapi-manobj.html
21,9 → 21,15
<dd><code>duplicateObject(["name"]) -&gt; string</code>
<p>Creates a Duplicate of the selected Object (or Selection Group).</p></dd>
 
<dt><a name="-getCharacterStyle"><strong>getCharacterStyle</strong></a>(...)</dt>
<dd><code>getCharacterStyle(["name"])</code>
<p>Return name of character style applied to object named "name". If "name" is not given, the currently selected object is used.<p>
<p>If current object has a text selection, the name of style applied to start of selection is returned. Otherwise the name of the item default character style is returned.</p>
<p>May raise WrongFrameTypeError.</p></dd>
 
<dt><a name="-getParagraphStyle"><strong>getParagraphStyle</strong></a>(...)</dt>
<dd><code>getParagraphStyle(["name"])</code>
<p>Return name of style applied to object named "name". If "name" is not given, the currently selected object is used.<p>
<p>Return name of paragraph style applied to object named "name". If "name" is not given, the currently selected object is used.<p>
<p>If current object has a text selection, the name of style applied to start of selection is returned. Otherwise the name of the item default style is returned.</p>
<p>May raise WrongFrameTypeError.</p></dd>
 
/trunk/Scribus/doc/ru/scripterapi-manobj.html
21,9 → 21,15
<dd><code>duplicateObject(["name"]) -&gt; string</code>
<p>Creates a Duplicate of the selected Object (or Selection Group).</p></dd>
 
<dt><a name="-getCharacterStyle"><strong>getCharacterStyle</strong></a>(...)</dt>
<dd><code>getCharacterStyle(["name"])</code>
<p>Return name of character style applied to object named "name". If "name" is not given, the currently selected object is used.<p>
<p>If current object has a text selection, the name of style applied to start of selection is returned. Otherwise the name of the item default character style is returned.</p>
<p>May raise WrongFrameTypeError.</p></dd>
 
<dt><a name="-getParagraphStyle"><strong>getParagraphStyle</strong></a>(...)</dt>
<dd><code>getParagraphStyle(["name"])</code>
<p>Return name of style applied to object named "name". If "name" is not given, the currently selected object is used.<p>
<p>Return name of paragraph style applied to object named "name". If "name" is not given, the currently selected object is used.<p>
<p>If current object has a text selection, the name of style applied to start of selection is returned. Otherwise the name of the item default style is returned.</p>
<p>May raise WrongFrameTypeError.</p></dd>
 
/trunk/Scribus/scribus/plugins/scriptplugin/cmdobj.cpp
579,7 → 579,42
return PyBool_FromLong(static_cast<long>(false));
}
 
PyObject *scribus_getcharacterstyle(PyObject* /* self */, PyObject* args)
{
char *name = const_cast<char*>("");
if (!PyArg_ParseTuple(args, "|es", "utf-8", &name))
return NULL;
if (!checkHaveDocument())
return NULL;
PageItem *item = GetUniqueItem(QString::fromUtf8(name));
if (item == NULL)
return NULL;
if ((item->itemType() != PageItem::TextFrame) && (item->itemType() != PageItem::PathText))
{
PyErr_SetString(WrongFrameTypeError, QObject::tr("Cannot get character style of a non-text frame.", "python error").toLocal8Bit().constData());
return NULL;
}
 
ScribusDoc* currentDoc = ScCore->primaryMainWindow()->doc;
StoryText& itemText = item->itemText;
 
int selectionLength = itemText.selectionLength();
if ((selectionLength > 0) || (currentDoc->appMode == modeEdit))
{
int cursorPos = (selectionLength > 0) ? itemText.startOfSelection() : itemText.cursorPosition();
const CharStyle& currentStyle = itemText.charStyle(cursorPos);
if (currentStyle.hasParent())
return PyUnicode_FromString(currentStyle.parentStyle()->name().toUtf8());
}
else
{
const CharStyle& itemDefaultStyle = itemText.defaultStyle().charStyle();
if (itemDefaultStyle.hasParent())
return PyUnicode_FromString(itemDefaultStyle.parentStyle()->name().toUtf8());
}
Py_RETURN_NONE;
};
 
/*
* Vaclav Smilauer, 2017-21-21
* Return style name of the object (or currently selected object)
600,11 → 635,14
return NULL;
}
 
int selectionLength = item->itemText.selectionLength();
if (selectionLength > 0)
ScribusDoc* currentDoc = ScCore->primaryMainWindow()->doc;
StoryText& itemText = item->itemText;
 
int selectionLength = itemText.selectionLength();
if ((selectionLength > 0) || (currentDoc->appMode == modeEdit))
{
int selectionStart = item->itemText.startOfSelection();
const ParagraphStyle& currentStyle = item->itemText.paragraphStyle(selectionStart);
int cursorPos = (selectionLength > 0) ? itemText.startOfSelection() : itemText.cursorPosition();
const ParagraphStyle& currentStyle = itemText.paragraphStyle(cursorPos);
if (currentStyle.hasParent())
return PyUnicode_FromString(currentStyle.parentStyle()->name().toUtf8());
}
900,6 → 938,7
<< scribus_copyobject__doc__
<< scribus_deleteobj__doc__
<< scribus_duplicateobject__doc__
<< scribus_getcharacterstyle__doc__
<< scribus_getcharstylenames__doc__
<< scribus_getparagraphstyle__doc__
<< scribus_getstyle__doc__
/trunk/Scribus/scribus/plugins/scriptplugin/cmdobj.h
234,13 → 234,22
*/
PyObject *scribus_objectexists(PyObject * /*self*/, PyObject* args);
 
/*! docstring */
PyDoc_STRVAR(scribus_getcharacterstyle__doc__,
QT_TR_NOOP("getCharacterStyle([\"name\"])\n\
\n\
Return name of character style applied to object named \"name\". If \"name\" is not given,\n\
the currently selected object is used. If current object has a text selection, \n\
the name of style applied to start of selection is returned. Otherwise the name \n\
of the item default character style is returned.\n\
"));
PyObject *scribus_getcharacterstyle(PyObject * /*self*/, PyObject* args);
 
 
/*! docstring */
PyDoc_STRVAR(scribus_getparagraphstyle__doc__,
QT_TR_NOOP("getParagraphStyle([\"name\"])\n\
\n\
Return name of style applied to object named \"name\". If \"name\" is not given,\n\
Return name of paragraph style applied to object named \"name\". If \"name\" is not given,\n\
the currently selected object is used. If current object has a text selection, \n\
the name of style applied to start of selection is returned. Otherwise the name \n\
of the item default style is returned.\n\
282,7 → 291,7
 
/*! docstring */
PyDoc_STRVAR(scribus_setcharstyle__doc__,
QT_TR_NOOP("setCharacterStyle(\"style\" [, \"name\"])\n\
QT_TR_NOOP("setCharacterStyle(\"style\" [, \"name\"])\n\
\n\
Apply the named character \"style\" to the object named \"name\". If object name is\n\
given, style is applied to the current text selection in object \"name\".\n\
/trunk/Scribus/scribus/plugins/scriptplugin/scriptplugin.cpp
338,6 → 338,7
{const_cast<char*>("getCellColumnSpan"), scribus_getcellcolumnspan, METH_VARARGS, tr(scribus_getcellcolumnspan__doc__)},
{const_cast<char*>("getCellRowSpan"), scribus_getcellrowspan, METH_VARARGS, tr(scribus_getcellrowspan__doc__)},
{const_cast<char*>("getCellFillColor"), scribus_getcellfillcolor, METH_VARARGS, tr(scribus_getcellfillcolor__doc__)},
{const_cast<char*>("getCharacterStyle"), scribus_getcharacterstyle, METH_VARARGS, tr(scribus_getcharacterstyle__doc__) },
{const_cast<char*>("getCharStyles"), (PyCFunction)scribus_getcharstylenames, METH_NOARGS, tr(scribus_getcharstylenames__doc__)},
{const_cast<char*>("getColorNames"), (PyCFunction)scribus_colornames, METH_NOARGS, tr(scribus_colornames__doc__)},
{const_cast<char*>("getColor"), scribus_getcolor, METH_VARARGS, tr(scribus_getcolor__doc__)},