Scribus API for plugins
A stable, high level and documented interface to the Scribus core that plugin developers can use to access the Scribus features.
|
Public Member Functions | |
ScribusAPIDocumentItemText (ScribusAPIDocumentItem *documentItem) | |
bool | isFirstInChain () |
bool | isEmpty () |
QVector< ScribusAPIDocumentItemTextRuns > | getStoryRuns () |
Get the runs for the full story of the text frame. More... | |
QVector< ScribusAPIDocumentItemTextRuns > | getRuns () |
Get the runs in the text frame. More... | |
QVector< ScribusAPIDocumentItemTextRuns > | getRuns (int start, int end) |
Parse the text and define the runs list. More... | |
QList< QDomElement > | getDom (QDomDocument xhtmlDocument) |
ScribusAPIDocumentItemTextFormatting | getFormattingAtPosition (int position) |
int | getLength () |
Get the number of characters in the frame. | |
int | getStoryLength () |
void | setCursorPosition (int position) |
void | insert (const QString text, const QString paragraphStyle="", const QString characterStyle="") |
Insert text at the current cursor position. More... | |
void | append (const QString text, const QString paragraphStyle="", const QString characterStyle="") |
Append text at the end of the chain of text frames. More... | |
void | appendParagraph (const QString text, const QString paragraphStyle="") |
Append a paragraph at the end of the chain of text frames. More... | |
void | applyParagraphStyle (const QString styleName) |
Apply the paragraph style at the current cursor position. More... | |
void | applyParagraphStyle (int position, const QString styleName) |
Apply the paragraph style at a specific position. | |
void | applyCharacterStyle (const QString styleName) |
Apply the character style at the current cursor position. More... | |
void ScribusAPIDocumentItemText::append | ( | const QString | text, |
const QString | paragraphStyle = "" , |
||
const QString | characterStyle = "" |
||
) |
Append text at the end of the chain of text frames.
The cursor is moved to the end of the text in the chain.
void ScribusAPIDocumentItemText::appendParagraph | ( | const QString | text, |
const QString | paragraphStyle = "" |
||
) |
Append a paragraph at the end of the chain of text frames.
If the story is not empty, add a new line before inserting the text. The cursor does not move.
void ScribusAPIDocumentItemText::applyCharacterStyle | ( | const QString | styleName | ) |
Apply the character style at the current cursor position.
void ScribusDoc::itemSelection_SetNamedCharStyle(const QString& name, Selection* customSelection)
void ScribusAPIDocumentItemText::applyParagraphStyle | ( | const QString | styleName | ) |
Apply the paragraph style at the current cursor position.
void ScribusDoc::itemSelection_SetNamedCharStyle(const QString& name, Selection* customSelection)
a good example for applying the paragraph style seems to be void ScribusMainWindow::setNewCharStyle(const QString& name) in scribus.cpp, which is called from the properties palette.
QList< QDomElement > ScribusAPIDocumentItemText::getDom | ( | QDomDocument | xhtmlDocument | ) |
example of charStyle() use in svgexplugin.cpp cf. short-words/parse.cpp cf. Scribus150Format::writeITEXTs() for getting the local formatting in plugins/fileloader/scribus150format/scribus150format_save.cpp
QVector< ScribusAPIDocumentItemTextRuns > ScribusAPIDocumentItemText::getRuns | ( | ) |
Get the runs in the text frame.
QVector< ScribusAPIDocumentItemTextRuns > ScribusAPIDocumentItemText::getRuns | ( | int | start, |
int | end | ||
) |
Parse the text and define the runs list.
Get the runs for a specific range in the story.
Runs are strings with a common formatting. The paragraph mark ends the run.
this method is based on pierre's work for the mitical OIF branch ... also inspired by Scribus150Format::writeITEXTs
QVector< ScribusAPIDocumentItemTextRuns > ScribusAPIDocumentItemText::getStoryRuns | ( | ) |
Get the runs for the full story of the text frame.
When looping through all the items in a document, you will probably want to check if the current item is the beginning of a chain before calling getStoryRuns().
void ScribusAPIDocumentItemText::insert | ( | const QString | text, |
const QString | paragraphStyle = "" , |
||
const QString | characterStyle = "" |
||
) |
Insert text at the current cursor position.
Insert the text before the cursor position.
Use append() to insert text after the last character.