Scribus Developer Documentation - API
logo-pen

Scribus Developer Documentation - API

AspellPluginImpl Class Reference

Implementation of plugin. GUI part is derived from AspellPluginBase class, as aspellpluginbase.{cpp,h} get overwritten by uic. Interface to aspell uses Speller::Aspell::Suggest. More...

#include <aspellpluginimpl.h>

Collaboration diagram for AspellPluginImpl:

Collaboration graph
[legend]

List of all members.

Public Slots

void on_fcloseBtn_clicked ()
 Slot: Called when the "Close" button is clicked. Makes any pending replacements, and closes spell-check window.
void on_fchangeBtn_clicked ()
 Slot: Called when the "Change" button is clicked. Replaces the word being checked with the currently selected replacement.
void on_fchangeAllBtn_clicked ()
 Slot: Called when the "Change All" button is clicked. Replaces all occurrences of the word being checked with the currently selected replacement.
void on_fskipBtn_clicked ()
 Slot: Called when the "Skip" button is clicked. Skips the word currently being spell-checked.
void on_fskipAllBtn_clicked ()
 Slot: Called when the "Skip All" button is clicked. Skips all occurences of the word currently being spell-checked.
void on_faddWordBtn_clicked ()
 Slot: Called when the "Add word" button is clicked. Adds current suggestion to user's personal directory.
void on_flistReplacements_itemActivated ()
void on_flistDicts_activated ()

Public Member Functions

 AspellPluginImpl (ScribusDoc *doc, QWidget *parent=NULL)
 ~AspellPluginImpl ()
 Destructor for spell-checking plugin implementation.

Protected Slots

void languageChange ()

Protected Member Functions

void checkText ()
 Model for list of dictionaries.
void nextWord ()
 Skips to the beginning of the next word in 'fcontent', the text being spell-checked.
void setPreferences (const QString &lang, const QString &jargon, const QString &encoding=Speller::Aspell::Suggest::kDEF_ENCODING, const QString &entry=kDEF_ASPELL_ENTRY)
void getPreferences ()
 Retrieve saved user preferences: language, jargon, encoding.
void activateSpellGUI ()
 Activates spell-checking GUI elements in spell-checking tab, i.e., everything except combo box at top.
void deactivateSpellGUI ()
 Deactivates spell-checking GUI elements in spell-checking tab, i.e., everything except combo box at top.
void parseItem ()
 Base method to spell-check text in current frame.
void parseSelection ()
 Spell-check selected frames in the page.
void spellCheckDone ()
 Called when spell-checking is completed. Pops up an information dialog.

Private Attributes

Speller::Aspell::Suggestfsuggest
 Aspell interface object.
PrefsContextfprefs
 Scribus preferences object.
QString flang
 Language for aspell dictionary.
QString fjargon
 Jargon for aspell dictionary.
QString fencoding
 Character encoding for words.
QString fentry
 Formatted string for aspell dictionary entry: Form of <name>--<lang>--<jargon>--<size>.
ScribusDocfdoc
 Pointer to current document.
struct AspellPluginImpl::Changes fnchanges
QString fcontent
 Extracted string of text from one frame.
uint fpos
 Position in 'fcontent' of word being spell-checked.
QHash< QString, QString > rememberedWords
int fidx
 Index in 'fcontent' of word being spell-checked.
QStringList fwordlist
 Word currently being spell-checked.
PageItemfFrame
 Pointer to current frame.

Static Private Attributes

static const char * kDEF_CONTEXT = "AspellPlugin"
 Context name for storing preferences.
static const QString kDEF_ASPELL_ENTRY

Classes

struct  Changes
 Structure to keep track of number of changes made. More...


Detailed Description

Implementation of plugin. GUI part is derived from AspellPluginBase class, as aspellpluginbase.{cpp,h} get overwritten by uic. Interface to aspell uses Speller::Aspell::Suggest.

Author:
Gora Mohanty <gora@srijan.in>

Definition at line 34 of file aspellpluginimpl.h.


Constructor & Destructor Documentation

AspellPluginImpl::AspellPluginImpl ( ScribusDoc doc,
QWidget *  parent = NULL 
)

AspellPluginImpl::~AspellPluginImpl (  ) 

Destructor for spell-checking plugin implementation.

Author:
Gora Mohanty <gora@srijan.in>
Parameters:
None 
Return values:
None 

Definition at line 71 of file aspellpluginimpl.cpp.

References fsuggest, and Speller::Aspell::Suggest::saveLists().


Member Function Documentation

AspellPluginImpl::checkText (  )  [protected]

Model for list of dictionaries.

Author:
Gora Mohanty <gora@srijan.in> Initializes the position in the current text, sets the current word, and starts spell-checking.
Parameters:
None 
Return values:
None 

Definition at line 144 of file aspellpluginimpl.cpp.

References Speller::Aspell::Suggest::checkWord(), fcontent, fFrame, fpos, fsuggest, StoryText::insertChars(), PageItem::itemText, StoryText::length(), nextWord(), rememberedWords, StoryText::removeChars(), and StoryText::replaceChar().

Referenced by on_fchangeAllBtn_clicked(), on_fchangeBtn_clicked(), on_fskipAllBtn_clicked(), on_fskipBtn_clicked(), and parseItem().

AspellPluginImpl::nextWord (  )  [protected]

Skips to the beginning of the next word in 'fcontent', the text being spell-checked.

Author:
Gora Mohanty <gora@srijan.in>
Parameters:
None 
Return values:
None 

Definition at line 125 of file aspellpluginimpl.cpp.

References fcontent, fFrame, fpos, PageItem::itemText, StoryText::length(), StoryText::text(), and wordBoundaries().

Referenced by checkText(), on_fchangeAllBtn_clicked(), on_fchangeBtn_clicked(), on_fskipAllBtn_clicked(), on_fskipBtn_clicked(), and parseItem().

void AspellPluginImpl::setPreferences ( const QString &  lang,
const QString &  jargon,
const QString &  encoding = Speller::Aspell::Suggest::kDEF_ENCODING,
const QString &  entry = kDEF_ASPELL_ENTRY 
) [protected]

AspellPluginImpl::getPreferences (  )  [protected]

Retrieve saved user preferences: language, jargon, encoding.

Author:
Gora Mohanty <gora@srijan.in>
Parameters:
None 
Return values:
None 

Definition at line 386 of file aspellpluginimpl.cpp.

References fencoding, fentry, fjargon, flang, fprefs, PrefsContext::get(), kDEF_ASPELL_ENTRY, Speller::Aspell::Suggest::kDEF_ENCODING, Speller::Aspell::Suggest::kDEF_JARGON, and Speller::Aspell::Suggest::kDEF_LANG.

Referenced by AspellPluginImpl().

AspellPluginImpl::activateSpellGUI (  )  [protected]

Activates spell-checking GUI elements in spell-checking tab, i.e., everything except combo box at top.

Author:
Gora Mohanty <gora@srijan.in>
Parameters:
None 
Return values:
None 

Definition at line 87 of file aspellpluginimpl.cpp.

Referenced by AspellPluginImpl().

AspellPluginImpl::deactivateSpellGUI (  )  [protected]

Deactivates spell-checking GUI elements in spell-checking tab, i.e., everything except combo box at top.

Author:
Gora Mohanty <gora@srijan.in>
Parameters:
None 
Return values:
None 

Definition at line 106 of file aspellpluginimpl.cpp.

Referenced by AspellPluginImpl().

AspellPluginImpl::parseItem (  )  [protected]

Base method to spell-check text in current frame.

Author:
Gora Mohanty <gora@srijan.in>
Parameters:
None 
Return values:
None 

Definition at line 415 of file aspellpluginimpl.cpp.

References PageItem::asTextFrame(), checkText(), fFrame, and nextWord().

Referenced by parseSelection().

AspellPluginImpl::parseSelection (  )  [protected]

Spell-check selected frames in the page.

Author:
Gora Mohanty <gora@srijan.in>
Parameters:
None 
Return values:
None 

Definition at line 426 of file aspellpluginimpl.cpp.

References Selection::count(), fcontent, fdoc, fFrame, Selection::itemAt(), ScribusDoc::m_Selection, and parseItem().

Referenced by AspellPluginImpl().

AspellPluginImpl::spellCheckDone (  )  [protected]

Called when spell-checking is completed. Pops up an information dialog.

Author:
Gora Mohanty <gora@srijan.in>
Parameters:
None 
Return values:
None 

Definition at line 207 of file aspellpluginimpl.cpp.

References PageItem::asTextFrame(), ScribusDoc::changed(), ScribusView::DrawNew(), fdoc, fFrame, fnchanges, AspellPluginImpl::Changes::fntot, PageItem_TextFrame::invalidateLayout(), ScribusMainWindow::mainWindowProgressBar, ScribusDoc::scMW(), ScribusMainWindow::setStatusBarInfoText(), tr(), and ScribusDoc::view().

Referenced by on_fcloseBtn_clicked().

AspellPluginImpl::on_fcloseBtn_clicked (  )  [slot]

Slot: Called when the "Close" button is clicked. Makes any pending replacements, and closes spell-check window.

Author:
Gora Mohanty <gora@srijan.in>
Parameters:
None 
Return values:
None 

Definition at line 227 of file aspellpluginimpl.cpp.

References spellCheckDone().

AspellPluginImpl::on_fchangeBtn_clicked (  )  [slot]

Slot: Called when the "Change" button is clicked. Replaces the word being checked with the currently selected replacement.

Author:
Gora Mohanty <gora@srijan.in>
Parameters:
None 
Return values:
None 

Definition at line 234 of file aspellpluginimpl.cpp.

References checkText(), fcontent, fFrame, fpos, StoryText::insertChars(), PageItem::itemText, nextWord(), StoryText::removeChars(), and StoryText::replaceChar().

AspellPluginImpl::on_fchangeAllBtn_clicked (  )  [slot]

Slot: Called when the "Change All" button is clicked. Replaces all occurrences of the word being checked with the currently selected replacement.

Author:
Gora Mohanty <gora@srijan.in>
Parameters:
None 
Return values:
None 

Definition at line 267 of file aspellpluginimpl.cpp.

References checkText(), fcontent, fFrame, fpos, StoryText::insertChars(), PageItem::itemText, nextWord(), rememberedWords, StoryText::removeChars(), and StoryText::replaceChar().

AspellPluginImpl::on_fskipBtn_clicked (  )  [slot]

Slot: Called when the "Skip" button is clicked. Skips the word currently being spell-checked.

Author:
Gora Mohanty <gora@srijan.in>
Parameters:
None 
Return values:
None 

Definition at line 302 of file aspellpluginimpl.cpp.

References checkText(), fcontent, fpos, and nextWord().

AspellPluginImpl::on_fskipAllBtn_clicked (  )  [slot]

Slot: Called when the "Skip All" button is clicked. Skips all occurences of the word currently being spell-checked.

Author:
Gora Mohanty <gora@srijan.in>
Parameters:
None 
Return values:
None 

Definition at line 311 of file aspellpluginimpl.cpp.

References checkText(), fcontent, fidx, fpos, fsuggest, fwordlist, Speller::Aspell::Suggest::ignoreWord(), nextWord(), and tr().

AspellPluginImpl::on_faddWordBtn_clicked (  )  [slot]

Slot: Called when the "Add word" button is clicked. Adds current suggestion to user's personal directory.

Author:
Gora Mohanty <gora@srijan.in>
Parameters:
None 
Return values:
None 

Definition at line 338 of file aspellpluginimpl.cpp.

References Speller::Aspell::Suggest::addPersonalList(), fsuggest, and tr().

void AspellPluginImpl::on_flistReplacements_itemActivated (  )  [slot]

Definition at line 357 of file aspellpluginimpl.cpp.

void AspellPluginImpl::on_flistDicts_activated (  )  [slot]

void AspellPluginImpl::languageChange (  )  [protected, slot]

Definition at line 410 of file aspellpluginimpl.cpp.


Member Data Documentation

const char * AspellPluginImpl::kDEF_CONTEXT = "AspellPlugin" [static, private]

Context name for storing preferences.

Definition at line 39 of file aspellpluginimpl.h.

Referenced by AspellPluginImpl().

const QString AspellPluginImpl::kDEF_ASPELL_ENTRY [static, private]

Initial value:

    QString( "en" ) + Speller::Aspell::Suggest::kDICT_DELIM +
    QString( "en" ) + Speller::Aspell::Suggest::kDICT_DELIM +
    QString( "*" ) + Speller::Aspell::Suggest::kDICT_DELIM +
    QString( "60" )
Formatted string for aspell dictionary entry: Form of <name>--<lang>--<jargon>--<size>

Definition at line 41 of file aspellpluginimpl.h.

Referenced by AspellPluginImpl(), and getPreferences().

Scribus preferences object.

Definition at line 45 of file aspellpluginimpl.h.

Referenced by AspellPluginImpl(), getPreferences(), and setPreferences().

QString AspellPluginImpl::flang [private]

Language for aspell dictionary.

Definition at line 47 of file aspellpluginimpl.h.

Referenced by AspellPluginImpl(), and getPreferences().

QString AspellPluginImpl::fjargon [private]

Jargon for aspell dictionary.

Definition at line 49 of file aspellpluginimpl.h.

Referenced by AspellPluginImpl(), and getPreferences().

QString AspellPluginImpl::fencoding [private]

Character encoding for words.

Definition at line 51 of file aspellpluginimpl.h.

Referenced by AspellPluginImpl(), and getPreferences().

QString AspellPluginImpl::fentry [private]

Formatted string for aspell dictionary entry: Form of <name>--<lang>--<jargon>--<size>.

Definition at line 53 of file aspellpluginimpl.h.

Referenced by AspellPluginImpl(), and getPreferences().

Pointer to current document.

Definition at line 55 of file aspellpluginimpl.h.

Referenced by parseSelection(), and spellCheckDone().

Referenced by spellCheckDone().

QString AspellPluginImpl::fcontent [private]

Extracted string of text from one frame.

Definition at line 78 of file aspellpluginimpl.h.

Referenced by checkText(), nextWord(), on_fchangeAllBtn_clicked(), on_fchangeBtn_clicked(), on_fskipAllBtn_clicked(), on_fskipBtn_clicked(), and parseSelection().

uint AspellPluginImpl::fpos [private]

Position in 'fcontent' of word being spell-checked.

Definition at line 80 of file aspellpluginimpl.h.

Referenced by checkText(), nextWord(), on_fchangeAllBtn_clicked(), on_fchangeBtn_clicked(), on_fskipAllBtn_clicked(), and on_fskipBtn_clicked().

QHash<QString, QString> AspellPluginImpl::rememberedWords [private]

Definition at line 81 of file aspellpluginimpl.h.

Referenced by AspellPluginImpl(), checkText(), and on_fchangeAllBtn_clicked().

int AspellPluginImpl::fidx [private]

Index in 'fcontent' of word being spell-checked.

Definition at line 83 of file aspellpluginimpl.h.

Referenced by on_fskipAllBtn_clicked().

QStringList AspellPluginImpl::fwordlist [private]

Word currently being spell-checked.

Definition at line 85 of file aspellpluginimpl.h.

Referenced by on_fskipAllBtn_clicked().

Pointer to current frame.

Definition at line 87 of file aspellpluginimpl.h.

Referenced by checkText(), nextWord(), on_fchangeAllBtn_clicked(), on_fchangeBtn_clicked(), parseItem(), parseSelection(), and spellCheckDone().


The documentation for this class was generated from the following files:
Created with personalized Doxygen. This is documentation for GPL software Scribus - Open Source Desktop Publishing.