Jump to content

Calligra/Libs/KoText/Text Plugins

From KDE Community Wiki

Text Plugins

For the text engine we need several technologies that will assist in adding required features.

Inline object plugins

We need a way to have items flow in the text with a custom way of positioning/painting it.

  • Bookmarks. We want to be able to give names to specific locations in text so they can be quickly found again.
  • Comments/Annotations. We should be able to add a note to a specific location in the text. The note should not be layouted, but we should be able to see a (non-printable) indication of the note so we can reshow it.
  • Mail merge. This is tightly coupled to variables. What we want is a variable that is an end of record marker after which the variable-database will be able to go to the next record of a mail-merge database.

Event based, asynchronous plugins

I want to have plugins that get called by the tool (while typing) when the user finishes typing a new word and/or a new sentence. The plugin then gets to alter the text of that sentence the user just typed. Manual calling of the plugin on a selection should be possible as well. Usecases:

  • Text-snippet plugin. When the user selects a section of text and right clicks on it, I want to be able to show menu entries for plugins that are able to handle a piece of text. Where they can take a string and return a replaced string. Examples that can use this are;
    • Replace word. Use a Thesaurus to replace the text with a new one.
    • Texting-Language. Just an example; there are many engines on the web that can replace normal text with some sort of funny version.
    • Colorization plugin. For those that publish pieces with sourcecode, being able to colorize text is a really useful tool.
  • Completion. A plugin where the user can type a certain key-combo (or, just at any keystroke) and the current paragraph-text upto the cursor position is passed to the plugin after which it can suggest completions.
  • A plugin that recognizes (media)wiki type markup and replaces it with KWord style markup.

Misc usecases

Support for these has to be done separately;

  • Auto-hyphenation. In the final layout step of text we should allow the automatic insertion of soft-hyphens so the text engine will do hyphenation.