View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0008291 | Scribus | Plug-ins | public | 2009-07-16 07:52 | 2012-11-13 20:41 |
Reporter | caolan | Assigned To | cbradney | ||
Priority | normal | Severity | feature | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Product Version | 1.3.5svn | ||||
Target Version | 1.4.2 | Fixed in Version | 1.4.2.svn | ||
Summary | 0008291: use hunspell where available before aspell | ||||
Description | Using enchant gives access to the same hunspell dictionaries as used by OpenOffice.org, Firefox, and typically (http://fedoraproject.org/wiki/Releases/FeatureDictionary) these days the same dictionaries as used by generic KDE and generic GNOME apps | ||||
Additional Information | Even if this patch isn't accepted, there are two additional little generic gotchas which are fixed/go away with this patch a)"QString locale(QLocale::system().name().left(2))" to get the language code (e.g. en) isn't safe anymore as I see that in a recent qt three letter ISO 639-2/3 code now seems supported, e.g. fil_PH would be truncated to fi, and similarly the search for a default dictionary based on the prefix could pick fil if the language happened to be fi b) the aspell-based spell-checking will crash if there are no aspell dictionaries installed I believe | ||||
Tags | No tags attached. | ||||
Patch | |||||
2009-07-16 07:52
|
scribus.enchant.patch (60,703 bytes)
diff -ru scribus-1.3.5.rc2.orig/BUILDING scribus-1.3.5.rc2/BUILDING --- scribus-1.3.5.rc2.orig/BUILDING 2009-07-15 09:33:47.000000000 +0100 +++ scribus-1.3.5.rc2/BUILDING 2009-07-15 12:48:37.000000000 +0100 @@ -255,7 +255,7 @@ python-devel tk python-imaging - aspell-devel + enchant-devel boost-devel You can install these packages using YaST. You may find it difficult to compile diff -ru scribus-1.3.5.rc2.orig/CMakeLists.txt scribus-1.3.5.rc2/CMakeLists.txt --- scribus-1.3.5.rc2.orig/CMakeLists.txt 2009-07-15 09:35:21.000000000 +0100 +++ scribus-1.3.5.rc2/CMakeLists.txt 2009-07-15 12:48:37.000000000 +0100 @@ -609,15 +609,25 @@ ENDIF(NOT WIN32) #>>FontConfig -#<<ASPELL for Speelling support -FIND_PACKAGE(ASPELL) -IF (ASPELL_FOUND) - MESSAGE("ASpell Found OK") - SET(HAVE_ASPELL 1) -ELSE(ASPELL_FOUND) - MESSAGE("ASpell or its developer libraries NOT found - Disabling support for spell checking") -ENDIF(ASPELL_FOUND) -#>>ASPELL for Speelling support +#<<ENCHANT for Spelling support +SET(ENCHANT_DIR ${CMAKE_MODULE_PATH}) +FIND_PACKAGE(ENCHANT) +IF (ENCHANT_FOUND) + MESSAGE("Enchant Found OK") + SET(HAVE_ENCHANT 1) +ELSE(ENCHANT_FOUND) + MESSAGE("Enchant or its developer libraries NOT found - Trying aspell instead") + #<<ASPELL for Spelling support + FIND_PACKAGE(ASPELL) + IF (ASPELL_FOUND) + MESSAGE("ASpell Found OK") + SET(HAVE_ASPELL 1) + ELSE(ASPELL_FOUND) + MESSAGE("ASpell or its developer libraries NOT found - Disabling support for spell checking") + ENDIF(ASPELL_FOUND) + #>>ASPELL for Spelling support +ENDIF(ENCHANT_FOUND) +#>>ENCHANT for Spelling support #<<PoDoFo for AI PDF import diff -ru scribus-1.3.5.rc2.orig/scribus/plugins/tools/CMakeLists.txt scribus-1.3.5.rc2/scribus/plugins/tools/CMakeLists.txt --- scribus-1.3.5.rc2.orig/scribus/plugins/tools/CMakeLists.txt 2009-07-15 09:33:54.000000000 +0100 +++ scribus-1.3.5.rc2/scribus/plugins/tools/CMakeLists.txt 2009-07-15 12:48:37.000000000 +0100 @@ -6,7 +6,9 @@ ADD_SUBDIRECTORY(pathfinder) ADD_SUBDIRECTORY(pathstroker) ADD_SUBDIRECTORY(subdivide) -if (HAVE_ASPELL) +if (HAVE_ENCHANT) ADD_SUBDIRECTORY(spellcheck) -endif (HAVE_ASPELL) +elseif (HAVE_ASPELL) + ADD_SUBDIRECTORY(spellcheck) +endif () ADD_SUBDIRECTORY(transform) diff -ru scribus-1.3.5.rc2.orig/scribus/plugins/tools/spellcheck/aspellpluginbase.ui scribus-1.3.5.rc2/scribus/plugins/tools/spellcheck/aspellpluginbase.ui --- scribus-1.3.5.rc2.orig/scribus/plugins/tools/spellcheck/aspellpluginbase.ui 2009-07-15 09:33:53.000000000 +0100 +++ scribus-1.3.5.rc2/scribus/plugins/tools/spellcheck/aspellpluginbase.ui 2009-07-15 13:04:05.000000000 +0100 @@ -1,6 +1,6 @@ <ui version="4.0" > - <class>AspellPluginBase</class> - <widget class="QDialog" name="AspellPluginBase" > + <class>SpellPluginBase</class> + <widget class="QDialog" name="SpellPluginBase" > <property name="geometry" > <rect> <x>0</x> diff -ru scribus-1.3.5.rc2.orig/scribus/plugins/tools/spellcheck/aspellplugin.cpp scribus-1.3.5.rc2/scribus/plugins/tools/spellcheck/aspellplugin.cpp --- scribus-1.3.5.rc2.orig/scribus/plugins/tools/spellcheck/aspellplugin.cpp 2009-07-15 09:33:53.000000000 +0100 +++ scribus-1.3.5.rc2/scribus/plugins/tools/spellcheck/aspellplugin.cpp 2009-07-15 13:07:51.000000000 +0100 @@ -13,21 +13,21 @@ // Please don't implement the functionality of your plugin here; do that // in aspellpluginimpl.h and aspellpluginimpl.cpp . -AspellPlugin::AspellPlugin() : ScActionPlugin() +SpellPlugin::SpellPlugin() : ScActionPlugin() { // Set action info in languageChange, so we only have to do // it in one place. languageChange(); } -AspellPlugin::~AspellPlugin() {}; +SpellPlugin::~SpellPlugin() {}; -void AspellPlugin::languageChange() +void SpellPlugin::languageChange() { // Note that we leave the unused members unset. They'll be initialised // with their default ctors during construction. // Action name - m_actionInfo.name = "AspellPlugin"; + m_actionInfo.name = "SpellPlugin"; // Action text for menu, including &accel m_actionInfo.text = tr("Spell Checker"); // Menu @@ -51,20 +51,29 @@ m_actionInfo.enabledOnStartup = false; } -const QString AspellPlugin::fullTrName() const +const QString SpellPlugin::fullTrName() const { +#if defined(USE_ENCHANT) + return QObject::tr("Spell check (enchant)"); +#else return QObject::tr("Spell check (aspell)"); +#endif } -const ScActionPlugin::AboutData* AspellPlugin::getAboutData() const +const ScActionPlugin::AboutData* SpellPlugin::getAboutData() const { AboutData* about = new AboutData; Q_CHECK_PTR(about); about->authors = "Gora Mohanty <gora@srijan.in>"; about->shortDescription = tr( "Spell-checking support" ); about->description = +#if defined(USE_ENCHANT) + tr( "Adds support for spell-checking via enchant. Languages " + "can be chosen from among the installed enchant " +#else tr( "Adds support for spell-checking via aspell. Languages " "can be chosen from among the installed aspell " +#endif "dictionaries, and spell-checking can be done on the " "fly, or on selected text." ); about->version = tr( "0.1" ); @@ -73,15 +82,15 @@ return about; } -void AspellPlugin::deleteAboutData(const AboutData* about) const +void SpellPlugin::deleteAboutData(const AboutData* about) const { Q_ASSERT(about); delete about; } -bool AspellPlugin::run(ScribusDoc* doc, QString target) +bool SpellPlugin::run(ScribusDoc* doc, QString target) { - AspellPluginImpl *myPluginImpl = new AspellPluginImpl( doc ); + SpellPluginImpl *myPluginImpl = new SpellPluginImpl( doc ); Q_CHECK_PTR(myPluginImpl); // The spellcheck is disabled when there are no available // dictionaries. @@ -92,7 +101,7 @@ doc->scMW()->scrActions[m_actionInfo.name]->setEnabled(false); doc->scMW()->scrActions[m_actionInfo.name]->setVisible(false); QMessageBox::warning(doc->scMW(), - tr("Aspell Plugin Error"), + tr("Spell Plugin Error"), myPluginImpl->errorMessage()); } delete myPluginImpl; @@ -100,21 +109,21 @@ } // Low level plugin API -int x_aspellplugin_getPluginAPIVersion() +int spellplugin_getPluginAPIVersion() { return PLUGIN_API_VERSION; } -ScPlugin* x_aspellplugin_getPlugin() +ScPlugin* spellplugin_getPlugin() { - AspellPlugin* plug = new AspellPlugin(); + SpellPlugin* plug = new SpellPlugin(); Q_CHECK_PTR(plug); return plug; } -void x_aspellplugin_freePlugin(ScPlugin* plugin) +void spellplugin_freePlugin(ScPlugin* plugin) { - AspellPlugin* plug = dynamic_cast<AspellPlugin*>(plugin); + SpellPlugin* plug = dynamic_cast<SpellPlugin*>(plugin); Q_ASSERT(plug); delete plug; } diff -ru scribus-1.3.5.rc2.orig/scribus/plugins/tools/spellcheck/aspellplugin.h scribus-1.3.5.rc2/scribus/plugins/tools/spellcheck/aspellplugin.h --- scribus-1.3.5.rc2.orig/scribus/plugins/tools/spellcheck/aspellplugin.h 2009-07-15 09:33:53.000000000 +0100 +++ scribus-1.3.5.rc2/scribus/plugins/tools/spellcheck/aspellplugin.h 2009-07-15 13:01:40.000000000 +0100 @@ -14,14 +14,14 @@ That documentatation is not duplicated here. Please don't implement the functionality of your plugin here; do that in aspellpluginimpl.h and aspellpluginimpl.cpp. */ -class PLUGIN_API AspellPlugin : public ScActionPlugin +class PLUGIN_API SpellPlugin : public ScActionPlugin { Q_OBJECT public: //! \brief Standard plugin implementation - AspellPlugin(); - virtual ~AspellPlugin(); + SpellPlugin(); + virtual ~SpellPlugin(); //! \brief main method to run the plug virtual bool run(ScribusDoc* doc, QString target = QString::null); virtual const QString fullTrName() const; @@ -33,8 +33,8 @@ // Special features (none) }; -extern "C" PLUGIN_API int x_aspellplugin_getPluginAPIVersion(); -extern "C" PLUGIN_API ScPlugin* x_aspellplugin_getPlugin(); -extern "C" PLUGIN_API void x_aspellplugin_freePlugin(ScPlugin* plugin); +extern "C" PLUGIN_API int spellplugin_getPluginAPIVersion(); +extern "C" PLUGIN_API ScPlugin* spellplugin_getPlugin(); +extern "C" PLUGIN_API void spellplugin_freePlugin(ScPlugin* plugin); #endif diff -ru scribus-1.3.5.rc2.orig/scribus/plugins/tools/spellcheck/aspellpluginimpl.cpp scribus-1.3.5.rc2/scribus/plugins/tools/spellcheck/aspellpluginimpl.cpp --- scribus-1.3.5.rc2.orig/scribus/plugins/tools/spellcheck/aspellpluginimpl.cpp 2009-07-15 09:33:53.000000000 +0100 +++ scribus-1.3.5.rc2/scribus/plugins/tools/spellcheck/aspellpluginimpl.cpp 2009-07-15 13:07:20.000000000 +0100 @@ -10,15 +10,15 @@ #include "util.h" #include <QMessageBox> -const char* AspellPluginImpl::kDEF_CONTEXT = "AspellPlugin"; -const QString AspellPluginImpl::kDEF_ASPELL_ENTRY = - QString( "en" ) + Speller::Aspell::Suggest::kDICT_DELIM + - QString( "en" ) + Speller::Aspell::Suggest::kDICT_DELIM + - QString( "*" ) + Speller::Aspell::Suggest::kDICT_DELIM + +const char* SpellPluginImpl::kDEF_CONTEXT = "SpellPlugin"; +const QString SpellPluginImpl::kDEF_ASPELL_ENTRY = + QString( "en" ) + Speller::Spell::Suggest::kDICT_DELIM + + QString( "en" ) + Speller::Spell::Suggest::kDICT_DELIM + + QString( "*" ) + Speller::Spell::Suggest::kDICT_DELIM + QString( "60" ); // I.e., en/en/*/60 corresponding to default English dictionary // Initialize members here, if any -AspellPluginImpl::AspellPluginImpl(ScribusDoc* doc, QWidget* parent) : +SpellPluginImpl::SpellPluginImpl(ScribusDoc* doc, QWidget* parent) : QDialog( parent ), fdoc( doc ), m_docIsChanged(false), @@ -34,7 +34,12 @@ // Get stored language, jargon, encoding settings fprefs = PrefsManager::instance()->prefsFile->getPluginContext( kDEF_CONTEXT ); getPreferences(); - QString text = tr( "Loaded " ) + (fentry == kDEF_ASPELL_ENTRY ? tr( "default " ) : "") + fentry + tr( " aspell dictionary." ); + QString text = tr( "Loaded " ) + (fentry == kDEF_ASPELL_ENTRY ? tr( "default " ) : "") + fentry + +#if defined(USE_ENCHANT) + tr( " enchant dictionary." ); +#else + tr( " aspell dictionary." ); +#endif doc->scMW()->setStatusBarInfoText( text ); try { @@ -44,7 +49,11 @@ // Create speller, and get list of available aspell // dictionaries. - fsuggest = new Speller::Aspell::Suggest( flang.toUtf8().data(), fjargon.toUtf8().data(), fencoding.toUtf8().data() ); + fsuggest = new Speller::Spell::Suggest( flang.toUtf8().data() +#if !defined(USE_ENCHANT) + , fjargon.toUtf8().data(), fencoding.toUtf8().data() +#endif + ); Q_CHECK_PTR( fsuggest ); // Get list of available aspell dictionaries @@ -59,16 +68,33 @@ // check the availability of any dict. If == 0 then the plugin // is disabled in all GUI. if (flistDicts->count() == 0) - m_errorMessage = tr("No available Aspell dictionaries found. Install some, please."); + m_errorMessage = tr("No available spelling dictionaries found. Install some, please."); // use dict for system local if there are no preferences set before - QString locale(QLocale::system().name().left(2)); if (fentry.isEmpty()) { - int ix = flistDicts->findText(locale, Qt::MatchStartsWith); + QString locale = QLocale::system().name(); + int ix = flistDicts->findText(locale); //Exact match + if (ix == -1) + { + QString language_pattern('^'); + language_pattern.append(locale); + language_pattern.append("([^a-zA-Z]|$).*"); + ix = flistDicts->findText(language_pattern, Qt::MatchRegExp); //Very close match + } + if (ix == -1) + { + QString language_pattern('^'); + QStringList fields = locale.split( '_' ); + QString language = fields[0]; + language_pattern.append(language); + language_pattern.append("([^a-zA-Z]|$).*"); + ix = flistDicts->findText(language_pattern, Qt::MatchRegExp); //Close enough match + } if (ix != -1) flistDicts->setCurrentIndex(ix); else { + fentry = kDEF_ASPELL_ENTRY; setCurrentComboItem(flistDicts, fentry); } @@ -79,23 +105,23 @@ } catch( const std::invalid_argument& err ) { - QString warn = tr( "aspellplugin (AspellPluginImpl::" - "AspellPluginImpl): Error in aspell " + QString warn = tr( "aspellplugin (SpellPluginImpl::" + "SpellPluginImpl): Error in " "speller configuration." ); qWarning( "%s", warn.toUtf8().data() ); } catch( const std::runtime_error& err ) { - QString warn = tr( "aspellplugin (AspellPluginImpl::" - "AspellPluginImpl): Error in creating " - "aspell speller." ); + QString warn = tr( "aspellplugin (SpellPluginImpl::" + "SpellPluginImpl): Error in creating " + "speller." ); qWarning( "%s", warn.toUtf8().data() ); } activateSpellGUI(true); parseSelection(); } //__________________________________________________________________________ -AspellPluginImpl::~AspellPluginImpl() +SpellPluginImpl::~SpellPluginImpl() { // Destructor try @@ -104,14 +130,14 @@ } catch( const std::runtime_error& err ) { - qWarning( "aspellplugin (AspellPluginImpl::~AspellPlugin" + qWarning( "aspellplugin (SpellPluginImpl::~SpellPlugin" "Impl): Error in saving aspell word lists." ); } delete fsuggest; } //__________________________________________________________________________ -void AspellPluginImpl::activateSpellGUI(bool active) +void SpellPluginImpl::activateSpellGUI(bool active) { // Activates spell-checking GUI elements in spell-checking // tab, i.e., everything except combo box at top @@ -129,7 +155,7 @@ flistDicts->setEnabled( active ); } //__________________________________________________________________________ -void AspellPluginImpl::nextWord() +void SpellPluginImpl::nextWord() { QChar ch; QString wordBoundaries = QString(" .,:;\"'!?\n"); @@ -164,7 +190,7 @@ fpos = pa; } //__________________________________________________________________________ -void AspellPluginImpl::checkText() +void SpellPluginImpl::checkText() { // Called from parseXXX(), after filling in the currently // relevant text into 'fcontent'. Handles spell-checking of @@ -228,7 +254,7 @@ } } //__________________________________________________________________________ -void AspellPluginImpl::spellCheckDone() +void SpellPluginImpl::spellCheckDone() { // Called once all words in the current text, i.e., in 'fcontent' // have been spell-checked. Pops up an information dialog. @@ -250,14 +276,14 @@ close(); } //__________________________________________________________________________ -void AspellPluginImpl::on_fcloseBtn_clicked() +void SpellPluginImpl::on_fcloseBtn_clicked() { // Called when the "Close" button is clicked. Makes any pending // replacements and closes the spell-checking window. spellCheckDone(); // Also closes spell-checking window. } //__________________________________________________________________________ -void AspellPluginImpl::on_fchangeBtn_clicked() +void SpellPluginImpl::on_fchangeBtn_clicked() { // Called when the "Change" button is clicked. Replaces the word // being spell-checked with the current word in text edit box. @@ -292,7 +318,7 @@ checkText(); } //__________________________________________________________________________ -void AspellPluginImpl::on_fchangeAllBtn_clicked() +void SpellPluginImpl::on_fchangeAllBtn_clicked() { // Called when the "Change All" button is clicked. Replaces all // instances of the word being spell-checked with the current word in @@ -329,7 +355,7 @@ checkText(); } //__________________________________________________________________________ -void AspellPluginImpl::on_fskipBtn_clicked() +void SpellPluginImpl::on_fskipBtn_clicked() { // Called when the "Skip" button is clicked. Skips the word currently // being spell-checked. @@ -338,7 +364,7 @@ checkText(); } //__________________________________________________________________________ -void AspellPluginImpl::on_fskipAllBtn_clicked() +void SpellPluginImpl::on_fskipAllBtn_clicked() { // Called when the "Skip All" button is clicked. Puts the word // currently being spell-checked into the list of words to be ignored @@ -355,7 +381,7 @@ { QString warn = - tr( "AspellPluginImpl::on_fskipAllBtn_clicked(): Unable " + tr( "SpellPluginImpl::on_fskipAllBtn_clicked(): Unable " "to skip all instances of \"" ) + fcontent + tr(" by adding it to the session list."); qWarning( "%s", warn.toUtf8().data() ); @@ -365,7 +391,7 @@ checkText(); } //__________________________________________________________________________ -void AspellPluginImpl::on_faddWordBtn_clicked() +void SpellPluginImpl::on_faddWordBtn_clicked() { // Called when the "Add word" button is clicked. Adds word to personal // word list. @@ -378,13 +404,13 @@ catch( const std::runtime_error& err ) { QString warn = - tr( "AspellPluginImpl::on_faddWordBtn_clicked(): " + tr( "SpellPluginImpl::on_faddWordBtn_clicked(): " "Unable to add word to personal list." ); qWarning( "%s", warn.toUtf8().data() ); } } //__________________________________________________________________________ -void AspellPluginImpl::on_flistReplacements_itemActivated() +void SpellPluginImpl::on_flistReplacements_itemActivated() { // Called when an item in the list of replacements is // selected. Replaces current word in text edit box with the text @@ -392,27 +418,37 @@ fcurrWord->setText( flistReplacements->currentItem()->text() ); } -bool AspellPluginImpl::handleSpellConfig(const QString & dictFullName) +bool SpellPluginImpl::handleSpellConfig(const QString & dictFullName) { QString entry(dictFullName); - QStringList fields = entry.split( Speller::Aspell::Suggest::kDICT_DELIM ); + QStringList fields = entry.split( Speller::Spell::Suggest::kDICT_DELIM ); +#if defined(USE_ENCHANT) + // Ensure that we have sufficient fields. + if( fields.size() > 2 ) + { + fsuggest->resetConfig( fields[1].toAscii().data() ); + setPreferences( fields[1] ); + return true; + } +#else // Ensure that we have at least the right no.of fields. if( fields.size() == 4 ) { QString value = - fields[0] + Speller::Aspell::Suggest::kDICT_DELIM + - fields[1] + Speller::Aspell::Suggest::kDICT_DELIM + - fields[2] + Speller::Aspell::Suggest::kDICT_DELIM + + fields[0] + Speller::Spell::Suggest::kDICT_DELIM + + fields[1] + Speller::Spell::Suggest::kDICT_DELIM + + fields[2] + Speller::Spell::Suggest::kDICT_DELIM + fields[3]; fsuggest->resetConfig( fields[1].toAscii().data(), fields[2].toAscii().data() ); // FIXME: Handle encodings other than UTF-8. - setPreferences( fields[1], fields[2], Speller::Aspell::Suggest::kDEF_ENCODING, value ); + setPreferences( fields[1], fields[2], Speller::Spell::Suggest::kDEF_ENCODING, value ); return true; } +#endif return false; } //__________________________________________________________________________ -void AspellPluginImpl::on_flistDicts_activated() +void SpellPluginImpl::on_flistDicts_activated() { // Called when an item in the list of available aspell dictionaries is // selected, i.e., by double-clicking, or pressing enter. Resets @@ -436,38 +472,45 @@ } } //__________________________________________________________________________ -void AspellPluginImpl::getPreferences() +void SpellPluginImpl::getPreferences() { // Retrieves user preferences from saved settings. Defaults are // supplied - flang = fprefs->get( "lang", Speller::Aspell::Suggest::kDEF_LANG ); - fjargon = fprefs->get( "jargon", Speller::Aspell::Suggest::kDEF_JARGON ); + flang = fprefs->get( "lang", Speller::Spell::Suggest::kDEF_LANG ); +#if !defined(USE_ENCHANT) + fjargon = fprefs->get( "jargon", Speller::Spell::Suggest::kDEF_JARGON ); // FIXME: Handle encodings other than UTF-8. - fencoding = fprefs->get( "encoding", Speller::Aspell::Suggest::kDEF_ENCODING ); + fencoding = fprefs->get( "encoding", Speller::Spell::Suggest::kDEF_ENCODING ); // Don't use kDEF_ASPELL_ENTRY here. It's checked // against system locale later when there is no preferences for it. fentry = fprefs->get( "entry", "");//kDEF_ASPELL_ENTRY ); +#endif } //__________________________________________________________________________ -void AspellPluginImpl::setPreferences(const QString& lang, - const QString& jargon, - const QString& encoding, - const QString& entry) +void SpellPluginImpl::setPreferences(const QString& lang +#if !defined(USE_ENCHANT) + , const QString& jargon + , const QString& encoding + , const QString& entry +#endif + ) { // Saves user preferences using Scribus preferences manager. fprefs->set( "lang", lang ); - QString val = jargon == Speller::Aspell::Suggest::kEMPTY ? "" : jargon; +#if !defined(USE_ENCHANT) + QString val = jargon == Speller::Spell::Suggest::kEMPTY ? "" : jargon; fprefs->set( "jargon", val ); fprefs->set( "encoding", encoding ); fprefs->set( "entry", entry ); +#endif } //__________________________________________________________________________ -void AspellPluginImpl::languageChange() +void SpellPluginImpl::languageChange() { - qWarning( "AspellPluginImpl::languageChange(): Not implemented yet" ); + qWarning( "SpellPluginImpl::languageChange(): Not implemented yet" ); } //__________________________________________________________________________ -void AspellPluginImpl::parseItem() +void SpellPluginImpl::parseItem() { // Parse text in a frame, and spell-check it. // Process only text frames @@ -478,7 +521,7 @@ } } //__________________________________________________________________________ -void AspellPluginImpl::parseSelection() +void SpellPluginImpl::parseSelection() { fcontent.truncate( 0 ); // Start with empty string uint ndocs = fdoc->m_Selection->count(); diff -ru scribus-1.3.5.rc2.orig/scribus/plugins/tools/spellcheck/aspellpluginimpl.h scribus-1.3.5.rc2/scribus/plugins/tools/spellcheck/aspellpluginimpl.h --- scribus-1.3.5.rc2.orig/scribus/plugins/tools/spellcheck/aspellpluginimpl.h 2009-07-15 09:33:53.000000000 +0100 +++ scribus-1.3.5.rc2/scribus/plugins/tools/spellcheck/aspellpluginimpl.h 2009-07-15 13:03:49.000000000 +0100 @@ -27,11 +27,11 @@ #include "suggest.h" // For aspell interface class /*! -\class AspellPluginImpl +\class SpellPluginImpl \author Gora Mohanty <gora@srijan.in> -\brief 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 +\brief Implementation of plugin. GUI part is derived from SpellPluginBase class, as aspellpluginbase.{cpp,h} get overwritten by uic. Interface to aspell uses Speller::Spell::Suggest */ -class AspellPluginImpl : public QDialog, private Ui::AspellPluginBase +class SpellPluginImpl : public QDialog, private Ui::SpellPluginBase { Q_OBJECT private: @@ -39,8 +39,8 @@ static const char* kDEF_CONTEXT; /*! Formatted string for aspell dictionary entry: Form of <name>--<lang>--<jargon>--<size> */ static const QString kDEF_ASPELL_ENTRY; - /*! \brief Aspell interface object. */ - Speller::Aspell::Suggest* fsuggest; + /*! \brief Spell interface object. */ + Speller::Spell::Suggest* fsuggest; /*! \brief Scribus preferences object. */ PrefsContext* fprefs; /*! \brief Language for aspell dictionary. */ @@ -115,10 +115,13 @@ \param encoding: Encoding for aspell dictionary \retval None */ - void setPreferences(const QString& lang, - const QString& jargon, - const QString& encoding=Speller::Aspell::Suggest::kDEF_ENCODING, - const QString& entry=kDEF_ASPELL_ENTRY); + void setPreferences(const QString& lang +#if ! defined(USE_ENCHANT) + , const QString& jargon + , const QString& encoding=Speller::Spell::Suggest::kDEF_ENCODING + , const QString& entry=kDEF_ASPELL_ENTRY +#endif + ); /*! \author Gora Mohanty <gora@srijan.in> \brief Retrieve saved user preferences: language, jargon, encoding. @@ -170,14 +173,14 @@ \param parent: Parent window that this is a child of. \retval None */ - AspellPluginImpl(ScribusDoc* doc, QWidget* parent=NULL); + SpellPluginImpl(ScribusDoc* doc, QWidget* parent=NULL); /*! \author Gora Mohanty <gora@srijan.in> \brief Destructor for spell-checking plugin implementation. \param None \retval None */ - ~AspellPluginImpl(); + ~SpellPluginImpl(); /*! \brief Returns a error message for caller. It should disable the plugin then diff -ru scribus-1.3.5.rc2.orig/scribus/plugins/tools/spellcheck/ChangeLog scribus-1.3.5.rc2/scribus/plugins/tools/spellcheck/ChangeLog --- scribus-1.3.5.rc2.orig/scribus/plugins/tools/spellcheck/ChangeLog 2009-07-15 09:33:53.000000000 +0100 +++ scribus-1.3.5.rc2/scribus/plugins/tools/spellcheck/ChangeLog 2009-07-15 12:48:37.000000000 +0100 @@ -1,3 +1,6 @@ +2009-06-15 Caolán McNamara <caolanm@redhat.com> + * use enchant if available + 2007-11-23 Franz Schmid * aspellpluginimpl.ui Added proper layouts to the Gui diff -ru scribus-1.3.5.rc2.orig/scribus/plugins/tools/spellcheck/CMakeLists.txt scribus-1.3.5.rc2/scribus/plugins/tools/spellcheck/CMakeLists.txt --- scribus-1.3.5.rc2.orig/scribus/plugins/tools/spellcheck/CMakeLists.txt 2009-07-15 09:33:53.000000000 +0100 +++ scribus-1.3.5.rc2/scribus/plugins/tools/spellcheck/CMakeLists.txt 2009-07-15 13:00:10.000000000 +0100 @@ -1,10 +1,61 @@ -IF (ASPELL_FOUND) +IF (ENCHANT_FOUND) + INCLUDE_DIRECTORIES( + ${CMAKE_SOURCE_DIR} + ${CMAKE_SOURCE_DIR}/scribus + ${ENCHANT_INCLUDE_DIR} + ) + + ADD_DEFINITIONS("-DUSE_ENCHANT") + + SET(ASPELL_PLUGIN_UI_SRC + aspellpluginbase.ui +# donedlgbase.ui + ) + + SET(ASPELL_PLUGIN_MOC_CLASSES + aspellplugin.h + aspellpluginimpl.h +# donedlgimpl.h + ) + + SET(ASPELL_PLUGIN_SOURCES + aspellplugin.cpp + aspellpluginimpl.cpp +# donedlgimpl.cpp + suggest.cpp + ) + + SET(SCRIBUS_ASPELL_PLUGIN "spellplugin") + + QT4_WRAP_UI(ASPELL_PLUGIN_UI_SOURCES ${ASPELL_PLUGIN_UI_SRC} ) + QT4_WRAP_CPP(ASPELL_PLUGIN_MOC_SOURCES ${ASPELL_PLUGIN_MOC_CLASSES}) + + ADD_LIBRARY(${SCRIBUS_ASPELL_PLUGIN} MODULE + ${ASPELL_PLUGIN_SOURCES} + ${ASPELL_PLUGIN_MOC_SOURCES} + ${ASPELL_PLUGIN_UI_SOURCES} + ) + + TARGET_LINK_LIBRARIES(${SCRIBUS_ASPELL_PLUGIN} ${ENCHANT_LIBRARIES} ${PLUGIN_LIBRARIES}) + + INSTALL(TARGETS ${SCRIBUS_ASPELL_PLUGIN} + LIBRARY + DESTINATION ${PLUGINDIR} + PERMISSIONS ${PLUGIN_PERMISSIONS} + ) + + ADD_DEPENDENCIES(${SCRIBUS_ASPELL_PLUGIN} ${EXE_NAME}) + +# SET_TARGET_PROPERTIES(${SCRIBUS_ASPELL_PLUGIN} PROPERTIES VERSION "0.0.1") +ELSEIF (ASPELL_FOUND) INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/scribus ${ASPELL_INCLUDE_DIR} ) + ADD_DEFINITIONS("-DUSE_ASPELL") + SET(ASPELL_PLUGIN_UI_SRC aspellpluginbase.ui # donedlgbase.ui @@ -32,7 +83,7 @@ # INSTALL(CODE "FILE(MAKE_DIRECTORY ${ENV}${CMAKE_INSTALL_PREFIX}/${ASPELLRELATIVEDICTDIR})") ENDIF (APPLEBUNDLE) - SET(SCRIBUS_ASPELL_PLUGIN "x_aspellplugin") + SET(SCRIBUS_ASPELL_PLUGIN "spellplugin") QT4_WRAP_UI(ASPELL_PLUGIN_UI_SOURCES ${ASPELL_PLUGIN_UI_SRC} ) QT4_WRAP_CPP(ASPELL_PLUGIN_MOC_SOURCES ${ASPELL_PLUGIN_MOC_CLASSES}) @@ -54,5 +105,4 @@ ADD_DEPENDENCIES(${SCRIBUS_ASPELL_PLUGIN} ${EXE_NAME}) # SET_TARGET_PROPERTIES(${SCRIBUS_ASPELL_PLUGIN} PROPERTIES VERSION "0.0.1") -ENDIF (ASPELL_FOUND) - +ENDIF () diff -ru scribus-1.3.5.rc2.orig/scribus/plugins/tools/spellcheck/suggest.cpp scribus-1.3.5.rc2/scribus/plugins/tools/spellcheck/suggest.cpp --- scribus-1.3.5.rc2.orig/scribus/plugins/tools/spellcheck/suggest.cpp 2009-07-15 09:33:53.000000000 +0100 +++ scribus-1.3.5.rc2/scribus/plugins/tools/spellcheck/suggest.cpp 2009-07-15 13:06:19.000000000 +0100 @@ -8,47 +8,68 @@ #include "suggest.h" #include "scpaths.h" #include <QFileInfo> +#include <algorithm> /*! \brief Delimiter between different components of formatted strings for aspell dictionary entries. */ -const char* Speller::Aspell::Suggest::kDICT_DELIM = "/"; -const char* Speller::Aspell::Suggest::kEMPTY = "*"; -const char* Speller::Aspell::Suggest::kDEF_LANG = "en"; -const char* Speller::Aspell::Suggest::kDEF_JARGON = ""; // I.e., no jargon -const char* Speller::Aspell::Suggest::kDEF_ENCODING = "utf-8"; +#if defined(USE_ENCHANT) +#include <enchant++.h> +const char* Speller::Spell::Suggest::kDEF_LANG = "en_US"; +#else +const char* Speller::Spell::Suggest::kDEF_LANG = "en"; +const char* Speller::Spell::Suggest::kDEF_JARGON = ""; // I.e., no jargon +const char* Speller::Spell::Suggest::kDEF_ENCODING = "utf-8"; +#endif +const char* Speller::Spell::Suggest::kDICT_DELIM = "/"; +const char* Speller::Spell::Suggest::kEMPTY = "*"; -void Speller::Aspell::Suggest::checkError() throw( std::runtime_error ) +#if ! defined(USE_ENCHANT) +void Speller::Spell::Suggest::checkError() throw( std::runtime_error ) { if( aspell_speller_error_number( fspeller ) != 0 ) { std::string err_msg = - std::string( "(Aspell::Speller::Suggest::checkError): " + std::string( "(Spell::Speller::Suggest::checkError): " "aspell speller error " ) + aspell_speller_error_message( fspeller ); throw std::runtime_error( err_msg ); } } //__________________________________________________________________________ -void Speller::Aspell::Suggest::checkConfigError() +void Speller::Spell::Suggest::checkConfigError() throw( std::runtime_error ) { if( aspell_config_error_number( fconfig ) != 0 ) { std::string err_msg = - std::string( "(Aspell::Speller::Suggest::checkConfig" + std::string( "(Spell::Speller::Suggest::checkConfig" "Error): aspell speller error " ) + aspell_config_error_message( fconfig ); throw std::runtime_error( err_msg ); } } +#endif //__________________________________________________________________________ -void Speller::Aspell::Suggest::init(const std::string& lang, - const std::string& jargon, - const std::string& encoding) +void Speller::Spell::Suggest::init(const std::string& lang +#if ! defined(USE_ENCHANT) + , const std::string& jargon + , const std::string& encoding +#endif +) throw( std::invalid_argument, std::runtime_error ) { // Save aspell configuration values flang = lang; +#if defined(USE_ENCHANT) + try + { + fspeller = enchant::Broker::instance()->request_dict(flang); + } + catch( enchant::Exception& err ) + { + throw std::invalid_argument(err.what()); + } +#else fjargon = jargon; fencoding = encoding; @@ -67,7 +88,7 @@ if( aspell_error_number( ret ) != 0 ) { delete_aspell_can_have_error( ret ); - throw std::runtime_error( "(Aspell::Speller::Suggest::init" + throw std::runtime_error( "(Spell::Speller::Suggest::init" "): Error in creating speller." ); } else @@ -75,9 +96,11 @@ fspeller = to_aspell_speller( ret ); fconfig = aspell_speller_config( fspeller ); } +#endif } +#if ! defined(USE_ENCHANT) //__________________________________________________________________________ -void Speller::Aspell::Suggest::listDicts(std::vector<AspellDictInfo>& vals) +void Speller::Spell::Suggest::listDicts(std::vector<AspellDictInfo>& vals) { AspellDictInfoList* dlist = get_aspell_dict_info_list( fconfig ); AspellDictInfoEnumeration* dinfo_enum = @@ -89,9 +112,26 @@ } delete_aspell_dict_info_enumeration( dinfo_enum ); } +#endif +#if defined(USE_ENCHANT) +void EnchantDictDescribe(const char * const lang_tag, + const char * const , + const char * const , + const char * const , + void * user_data) +{ + std::vector<std::string> *detected = (std::vector<std::string>*)user_data; + detected->push_back(std::string(lang_tag)); +} +#endif + //__________________________________________________________________________ -void Speller::Aspell::Suggest::listDicts(std::vector<std::string>& vals) +void Speller::Spell::Suggest::listDicts(std::vector<std::string>& vals) { +#if defined(USE_ENCHANT) + enchant::Broker::instance()->list_dicts(EnchantDictDescribe, &vals); + std::sort(vals.begin(), vals.end()); +#else std::vector<AspellDictInfo> entries; listDicts( entries ); for( std::vector<AspellDictInfo>::const_iterator i = entries.begin(); @@ -105,16 +145,27 @@ << i->size; vals.push_back( fmt_entry.str() ); } +#endif } //__________________________________________________________________________ void -Speller::Aspell::Suggest::printWordList(const AspellWordList* wlist, +Speller::Spell::Suggest::printWordList( +#if defined(USE_ENCHANT) + const std::vector<std::string> & wlist, +#else + const AspellWordList* wlist, +#endif char delim) throw( std::invalid_argument ) { +#if defined(USE_ENCHANT) + std::vector<std::string>::const_iterator aEnd = wlist.end(); + for (std::vector<std::string>::const_iterator aI = wlist.begin(); aI != aEnd; ++aI) + std::cout << *aI << delim; +#else if( ! wlist ) { - throw std::invalid_argument( "(Aspell.Speller.Suggest.print" + throw std::invalid_argument( "(Spell.Speller.Suggest.print" "WordList): word list pointer " "is null." ); } @@ -127,9 +178,11 @@ std::cout << next << delim; } delete_aspell_string_enumeration( enum_list ); +#endif } +#if ! defined(USE_ENCHANT) //__________________________________________________________________________ -void Speller::Aspell::Suggest::setConfig() throw( std::invalid_argument ) +void Speller::Spell::Suggest::setConfig() throw( std::invalid_argument ) { try { @@ -150,13 +203,13 @@ } //__________________________________________________________________________ void -Speller::Aspell::Suggest::storeWordList(const AspellWordList* wlist, +Speller::Spell::Suggest::storeWordList(const AspellWordList* wlist, std::vector<std::string>& replacement) throw( std::invalid_argument ) { if( ! wlist ) { - throw std::invalid_argument( "(Aspell.Speller.Suggest.store" + throw std::invalid_argument( "(Spell.Speller.Suggest.store" "WordList): word list pointer " "is null." ); } @@ -170,16 +223,24 @@ } delete_aspell_string_enumeration( enum_list ); } +#endif //__________________________________________________________________________ -Speller::Aspell::Suggest::Suggest(const std::string& lang, - const std::string& jargon, - const std::string& encoding) +Speller::Spell::Suggest::Suggest(const std::string& lang +#if ! defined(USE_ENCHANT) + , const std::string& jargon + , const std::string& encoding +#endif + ) throw( std::invalid_argument, std::runtime_error ) { // Default constructor try { - init( lang, jargon, encoding ); + init( lang +#if ! defined(USE_ENCHANT) + , jargon, encoding +#endif + ); } catch( const std::invalid_argument& err ) { @@ -190,8 +251,9 @@ throw err; } } +#if ! defined(USE_ENCHANT) //__________________________________________________________________________ -Speller::Aspell::Suggest::Suggest(const AspellDictInfo* dinfo, +Speller::Spell::Suggest::Suggest(const AspellDictInfo* dinfo, const std::string& encoding) throw( std::invalid_argument, std::runtime_error ) { @@ -208,10 +270,21 @@ throw err; } } +#endif +Speller::Spell::Suggest::~Suggest() +{ +#if defined(USE_ENCHANT) + delete fspeller; +#endif +} //__________________________________________________________________________ -void Speller::Aspell::Suggest::addPersonalList(const std::string& word) +void Speller::Spell::Suggest::addPersonalList(const std::string& word) throw( std::runtime_error ) { +#if defined(USE_ENCHANT) + if (fspeller) + fspeller->add(word); +#else // A std::runtime_error exception is thrown if // an error occcurs. @@ -226,20 +299,25 @@ { throw err; } +#endif } //__________________________________________________________________________ -bool Speller::Aspell::Suggest::checkWord(const std::string& word) +bool Speller::Spell::Suggest::checkWord(const std::string& word) { bool status = true; - +#if defined(USE_ENCHANT) + if (fspeller) + status = fspeller->check(word); +#else if( aspell_speller_check( fspeller, word.c_str(), -1 ) == 0 ) { status = false; } +#endif return status; } //__________________________________________________________________________ -bool Speller::Aspell::Suggest::checkWord(const std::string& word, +bool Speller::Spell::Suggest::checkWord(const std::string& word, std::vector<std::string>& replacement, bool always) throw( std::invalid_argument ) @@ -252,8 +330,12 @@ // 'word'is spelt incorrectly. bool status = checkWord( word ); - if( always ) + if( !status || always ) { +#if defined(USE_ENCHANT) + if (fspeller) + fspeller->suggest (word, replacement); +#else const AspellWordList* wlist = aspell_speller_suggest( fspeller, word.c_str(), -1 ); try @@ -264,28 +346,13 @@ { throw err; } - } - else - { - if( ! status ) - { - const AspellWordList* wlist = - aspell_speller_suggest( fspeller, word.c_str(), - -1 ); - try - { - storeWordList( wlist, replacement ); - } - catch( const std::invalid_argument& err ) - { - throw err; - } - } +#endif } return status; } +#if !defined(USE_ENCHANT) //__________________________________________________________________________ -void Speller::Aspell::Suggest::clearSessionList() throw( std::runtime_error ) +void Speller::Spell::Suggest::clearSessionList() throw( std::runtime_error ) { aspell_speller_clear_session( fspeller ); try @@ -297,35 +364,15 @@ throw err; } } +#endif //__________________________________________________________________________ -std::string Speller::Aspell::Suggest::getConfigOpt(const std::string& opt) -{ - return std::string( aspell_config_retrieve( fconfig, opt.c_str() ) ); -} -//__________________________________________________________________________ -void Speller::Aspell::Suggest::getConfigOpt(const std::string& opt, - std::vector<std::string>& vals) -{ - // Stores current setting of configuration option, 'opt', which - // has a value of list type, in 'vals'. - AspellStringList* list = new_aspell_string_list(); - AspellMutableContainer* lst0 = - aspell_string_list_to_mutable_container( list ); - aspell_config_retrieve_list( fconfig, opt.c_str(), lst0 ); - AspellStringEnumeration* enum_list = - aspell_string_list_elements( list ); - const char* next; - while( (next = aspell_string_enumeration_next( enum_list )) ) - { - vals.push_back( next ); - } - delete_aspell_string_enumeration( enum_list ); - delete_aspell_string_list( list ); -} -//__________________________________________________________________________ -void Speller::Aspell::Suggest::ignoreWord(const std::string& word) +void Speller::Spell::Suggest::ignoreWord(const std::string& word) throw( std::runtime_error ) { +#if defined(USE_ENCHANT) + if (fspeller) + fspeller->add_to_session(word); +#else // FIXME: Return value should be something meaningful from // aspell_speller_add_to_session. aspell_speller_add_to_session( fspeller, word.c_str(), -1 ); @@ -337,9 +384,11 @@ { throw err; } +#endif } +#if !defined(USE_ENCHANT) //__________________________________________________________________________ -void Speller::Aspell::Suggest::printMainList() throw( std::invalid_argument ) +void Speller::Spell::Suggest::printMainList() throw( std::invalid_argument ) { const AspellWordList* wlist = aspell_speller_main_word_list( fspeller ); @@ -353,7 +402,7 @@ } } //__________________________________________________________________________ -void Speller::Aspell::Suggest::printPersonalList() +void Speller::Spell::Suggest::printPersonalList() throw( std::invalid_argument ) { const AspellWordList* wlist = @@ -368,7 +417,7 @@ } } //__________________________________________________________________________ -void Speller::Aspell::Suggest::printSessionList() +void Speller::Spell::Suggest::printSessionList() throw( std::invalid_argument ) { const AspellWordList* wlist = @@ -382,8 +431,9 @@ throw err; } } +#endif //__________________________________________________________________________ -bool Speller::Aspell::Suggest::printSuggestions(const std::string& word, +bool Speller::Spell::Suggest::printSuggestions(const std::string& word, bool always) throw( std::invalid_argument ) { @@ -394,8 +444,12 @@ // false, only prints the list if 'word' is incorrect. bool status = checkWord( word ); - if( always ) + if( !status || always ) { +#if defined(USE_ENCHANT) + if (fspeller) + printWordList( fspeller->suggest (word) ); +#else const AspellWordList* wlist = aspell_speller_suggest( fspeller, word.c_str(), -1 ); try @@ -406,32 +460,21 @@ { throw err; } - } - else - { - if( ! status ) - { - const AspellWordList* wlist = - aspell_speller_suggest( fspeller, word.c_str(), - -1 ); - try - { - printWordList( wlist ); - } - catch( const std::invalid_argument& err ) - { - throw err; - } - } +#endif } return status; } //__________________________________________________________________________ -void Speller::Aspell::Suggest::resetConfig() +void Speller::Spell::Suggest::resetConfig() throw( std::invalid_argument, std::runtime_error ) { +#if defined(USE_ENCHANT) + delete fspeller; + fspeller = enchant::Broker::instance()->request_dict(flang); +#else delete_aspell_config( fconfig ); fconfig = new_aspell_config(); + try { setConfig(); @@ -445,7 +488,7 @@ if( aspell_error_number( ret ) != 0 ) { delete_aspell_can_have_error( ret ); - throw std::runtime_error( "(Aspell::Speller::Suggest::Reset" + throw std::runtime_error( "(Spell::Speller::Suggest::Reset" "Config): Error in creating " "speller." ); } @@ -457,17 +500,23 @@ delete_aspell_config( fconfig ); fconfig = aspell_speller_config( fspeller ); } +#endif } //__________________________________________________________________________ -void Speller::Aspell::Suggest::resetConfig(const std::string& lang, - const std::string& jargon, - const std::string& encoding) +void Speller::Spell::Suggest::resetConfig(const std::string& lang +#if !defined(USE_ENCHANT) + , const std::string& jargon + , const std::string& encoding +#endif + ) throw( std::invalid_argument, std::runtime_error ) { // Save new aspell configuration values flang = lang; +#if !defined(USE_ENCHANT) fjargon = jargon; fencoding = encoding; +#endif try { @@ -483,8 +532,9 @@ } } //__________________________________________________________________________ -void Speller::Aspell::Suggest::saveLists() throw( std::runtime_error ) +void Speller::Spell::Suggest::saveLists() throw( std::runtime_error ) { +#if !defined(USE_ENCHANT) // Saves all word lists. aspell_speller_save_all_word_lists( fspeller ); try @@ -495,9 +545,11 @@ { throw err; } +#endif } +#if !defined(USE_ENCHANT) //__________________________________________________________________________ -void Speller::Aspell::Suggest::setConfigOpt(const std::string& opt, +void Speller::Spell::Suggest::setConfigOpt(const std::string& opt, const std::string& val) throw( std::invalid_argument ) { @@ -513,7 +565,7 @@ } //__________________________________________________________________________ void -Speller::Aspell::Suggest::StoreMainList(std::vector<std::string>& replacement) +Speller::Spell::Suggest::StoreMainList(std::vector<std::string>& replacement) throw( std::invalid_argument ) { const AspellWordList* wlist = @@ -528,7 +580,7 @@ } } //__________________________________________________________________________ -void Speller::Aspell::Suggest::StorePersonalList(std::vector<std::string>& replacement) throw( std::invalid_argument ) +void Speller::Spell::Suggest::StorePersonalList(std::vector<std::string>& replacement) throw( std::invalid_argument ) { // Stores personal word list. A std::invalid_argument // exception is thrown in case of error. @@ -544,7 +596,7 @@ } } //__________________________________________________________________________ -void Speller::Aspell::Suggest::StoreSessionList(std::vector<std::string>& replacement) throw( std::invalid_argument ) +void Speller::Spell::Suggest::StoreSessionList(std::vector<std::string>& replacement) throw( std::invalid_argument ) { // Stores session word list. A std::invalid_argument exception // is thrown in case of error. @@ -559,5 +611,6 @@ throw err; } } +#endif //__________________________________________________________________________ //@@@@@@@@@@@@@@@@@@@@@@@@@ END OF FILE @@@@@@@@@@@@@@@@@@@@@@@@@ diff -ru scribus-1.3.5.rc2.orig/scribus/plugins/tools/spellcheck/suggest.h scribus-1.3.5.rc2/scribus/plugins/tools/spellcheck/suggest.h --- scribus-1.3.5.rc2.orig/scribus/plugins/tools/spellcheck/suggest.h 2009-07-15 09:33:53.000000000 +0100 +++ scribus-1.3.5.rc2/scribus/plugins/tools/spellcheck/suggest.h 2009-07-15 13:04:39.000000000 +0100 @@ -14,22 +14,36 @@ #include <string> // Used in function arguments, errors #include <vector> // Used in function arguments #include <iostream> // Printing to std::cout +#if defined(USE_ENCHANT) +// enchant definitions +namespace enchant +{ + class Dict; +} +#else // aspell include files #include <aspell.h> +#endif /*! \brief Nested namespaces to allow different interfaces to different spell-checking engines. */ namespace Speller { - namespace Aspell { + namespace Spell { /*! -\class Speller::Aspell::Suggest +\class Speller::Spell::Suggest \author Gora Mohanty <gora@srijan.in> \brief Class for interfacing with aspell. Should work with any aspell version from 0.60 onwards */ class Suggest { private: +#if defined(USE_ENCHANT) + /*! \brief Enchant speller object. */ + enchant::Dict* fspeller; + /*! \brief Language for aspell dictionary. */ + std::string flang; +#else /*! \brief Aspell configuration object. */ AspellConfig* fconfig; /*! \brief Aspell speller object. */ @@ -40,7 +54,8 @@ std::string fjargon; /*! \brief Character encoding for words. */ std::string fencoding; - +#endif +#if ! defined(USE_ENCHANT) /*! \author Gora Mohanty <gora@srijan.in> \brief Checks aspell speller for an error condition. @@ -57,6 +72,7 @@ \exception std::runtime_error if an error condition exists */ void checkConfigError() throw( std::runtime_error ); +#endif /*! \author Gora Mohanty <gora@srijan.in> \brief Initializes aspell: called from constructors. @@ -67,8 +83,12 @@ \exception std::invalid_argument from setConfig(). \exception std::runtime_error for error in creating speller. */ - void init(const std::string& lang, const std::string& jargon, - const std::string& encoding) + void init(const std::string& lang +#if ! defined(USE_ENCHANT) + ,const std::string& jargon + ,const std::string& encoding +#endif + ) throw( std::invalid_argument, std::runtime_error ); /*! \author Gora Mohanty <gora@srijan.in> @@ -78,8 +98,24 @@ \retval None \exception std::invalid_argument if 'wlist' is null */ +#if defined(USE_ENCHANT) + void printWordList(const std::vector<std::string> & wlist, +#else void printWordList(const AspellWordList* wlist, +#endif char delim='\n') throw(std::invalid_argument); +#if !defined(USE_ENCHANT) + /*! + \author Gora Mohanty <gora@srijan.in> + \brief Sets configuration option, 'opt' to value 'val'. + \param opt: Option to be set. + \param val: Value of option to be set. + \retval None + \exception std::invalid_argument if option value is incorrect + */ + void setConfigOpt(const std::string& opt, const std::string& val) + throw( std::invalid_argument ); +#endif /*! \author Gora Mohanty <gora@srijan.in> \brief Sets aspell speller configuration, as per current set of parameters. @@ -88,6 +124,18 @@ \exception std::invalid_argument from setConfigOpt() */ void setConfig() throw( std::invalid_argument ); + + /*! + \author Gora Mohanty <gora@srijan.in> + \brief Resets aspell configuration, as per current set of parameters. + \param None + \retval None + \exception std::invalid_argument from setConfig(). + \exception std::runtime_error for error in recreating speller. + */ + void resetConfig() + throw( std::invalid_argument, std::runtime_error ); +#if !defined(USE_ENCHANT) /*! \author Gora Mohanty <gora@srijan.in> \brief Stores list of words in 'replacement'. @@ -99,7 +147,73 @@ void storeWordList(const AspellWordList* wlist, std::vector<std::string>& replacement) throw( std::invalid_argument ); - + /*! + \author Gora Mohanty <gora@srijan.in> + \brief Obtains list of available aspell dictionaries. + \param vals: Array of aspell dictionary info structs + \retval None + */ + void listDicts(std::vector<AspellDictInfo>& vals); + /*! + \author Gora Mohanty <gora@srijan.in> + \brief Clears the current session word list. + \param None + \retval None + \exception std::runtime_error for error in clearing list. + */ + void clearSessionList() throw( std::runtime_error ); + /*! + \author Gora Mohanty <gora@srijan.in> + \brief Prints main word list. WARNING: This causes a crash due to a bug in aspell, as of aspell version 0.60.3. + \param None + \retval None. + \exception std::invalid_argument from printWordList(). + */ + void printMainList() throw( std::invalid_argument ); + /*! + \author Gora Mohanty <gora@srijan.in> + \brief Prints personal word list. + \param None + \retval None. + \exception std::invalid_argument from printWordList(). + */ + void printPersonalList() throw( std::invalid_argument ); + /*! + \author Gora Mohanty <gora@srijan.in> + \brief Prints session word list. + \param None + \retval None. + \exception std::invalid_argument from printWordList(). + */ + void printSessionList() throw( std::invalid_argument ); + /*! + \author Gora Mohanty <gora@srijan.in> + \brief Stores main word list. WARNING: This causes a crash due to a bug in aspell, as of aspell version 0.60.3. + \param None + \retval None. + \exception std::invalid_argument from storeWordList(). + */ + void StoreMainList(std::vector<std::string>& replacement) + throw( std::invalid_argument ); + /*! + \author Gora Mohanty <gora@srijan.in> + \brief Stores personal word list. + \param None + \retval None. + \exception std::invalid_argument from storeWordList(). + */ + void StorePersonalList(std::vector<std::string>& replacement) + throw( std::invalid_argument ); + /*! + \author Gora Mohanty <gora@srijan.in> + \brief Stores session word list. + \param None + \retval None. + \exception std::invalid_argument from storeWordList(). + */ + void StoreSessionList(std::vector<std::string>& replacement) + throw( std::invalid_argument ); +#endif public: /*! \brief Delimiter between different components of formatted strings for aspell dictionary entries. @@ -111,10 +225,12 @@ static const char* kEMPTY; /*! \brief Default language for aspell dictionary. */ static const char* kDEF_LANG; +#if !defined(USE_ENCHANT) /*! \brief Default jargon for aspell dictionary. */ static const char* kDEF_JARGON; /*! \brief Default character encoding for words. */ static const char* kDEF_ENCODING; +#endif // Defaults are for standard aspell English dictionary. Use // "iso8859-1" for Basic Latin. See aspell lang.dat file for @@ -129,10 +245,14 @@ \exception std::invalid_argument from setConfig(). \exception std::runtime_error for error in creating speller. */ - Suggest(const std::string& lang=kDEF_LANG, - const std::string& jargon=kDEF_JARGON, - const std::string& encoding=kDEF_ENCODING) + Suggest(const std::string& lang=kDEF_LANG +#if !defined(USE_ENCHANT) + , const std::string& jargon=kDEF_JARGON + , const std::string& encoding=kDEF_ENCODING +#endif + ) throw( std::invalid_argument, std::runtime_error ); +#if !defined(USE_ENCHANT) /*! \author Gora Mohanty <gora@srijan.in> \brief Constructor for spell-checking class. @@ -145,6 +265,8 @@ Suggest(const AspellDictInfo* dinfo, const std::string& encoding=kDEF_ENCODING) throw( std::invalid_argument, std::runtime_error ); +#endif + ~Suggest(); /*! \author Gora Mohanty <gora@srijan.in> \brief Adds 'word' to personal list. @@ -173,30 +295,6 @@ bool always=true) throw( std::invalid_argument ); /*! \author Gora Mohanty <gora@srijan.in> - \brief Clears the current session word list. - \param None - \retval None - \exception std::runtime_error for error in clearing list. - */ - void clearSessionList() throw( std::runtime_error ); - /*! - \author Gora Mohanty <gora@srijan.in> - \brief Gets value of configuration option, 'opt'. - \param opt: Name of option whose setting is to be retrieved. - \retval Value of option setting. - */ - std::string getConfigOpt(const std::string& opt); - /*! - \author Gora Mohanty <gora@srijan.in> - \brief Gets value of list type configuration option, 'opt'. - \param opt: Name of option whose setting is to be retrieved. - \param vals: Vector for storing values for the list type object. - \retval None. - */ - void getConfigOpt(const std::string& opt, - std::vector<std::string>& vals); - /*! - \author Gora Mohanty <gora@srijan.in> \brief Ignores 'word' for current session. \param word: Word to be ignored. \retval None. @@ -204,13 +302,7 @@ */ void ignoreWord(const std::string& word) throw( std::runtime_error ); - /*! - \author Gora Mohanty <gora@srijan.in> - \brief Obtains list of available aspell dictionaries. - \param vals: Array of aspell dictionary info structs - \retval None - */ - void listDicts(std::vector<AspellDictInfo>& vals); + /*! \author Gora Mohanty <gora@srijan.in> \brief Obtains list of available aspell dictionaries. @@ -220,30 +312,6 @@ void listDicts(std::vector<std::string>& vals); /*! \author Gora Mohanty <gora@srijan.in> - \brief Prints main word list. WARNING: This causes a crash due to a bug in aspell, as of aspell version 0.60.3. - \param None - \retval None. - \exception std::invalid_argument from printWordList(). - */ - void printMainList() throw( std::invalid_argument ); - /*! - \author Gora Mohanty <gora@srijan.in> - \brief Prints personal word list. - \param None - \retval None. - \exception std::invalid_argument from printWordList(). - */ - void printPersonalList() throw( std::invalid_argument ); - /*! - \author Gora Mohanty <gora@srijan.in> - \brief Prints session word list. - \param None - \retval None. - \exception std::invalid_argument from printWordList(). - */ - void printSessionList() throw( std::invalid_argument ); - /*! - \author Gora Mohanty <gora@srijan.in> \brief Spell-checks word, and prints suggested replacements. \param word: Word to be checked. \param always: If true, replacements are always printed, else only if word is mis-spelt. @@ -254,16 +322,6 @@ throw( std::invalid_argument ); /*! \author Gora Mohanty <gora@srijan.in> - \brief Resets aspell configuration, as per current set of parameters. - \param None - \retval None - \exception std::invalid_argument from setConfig(). - \exception std::runtime_error for error in recreating speller. - */ - void resetConfig() - throw( std::invalid_argument, std::runtime_error ); - /*! - \author Gora Mohanty <gora@srijan.in> \brief Resets aspell configuration, as per current set of parameters, after resetting lang, jargon, and encoding. \param lang: Language of aspell dictionary. \param jargon: Jargon for aspell dictionary. @@ -272,9 +330,12 @@ \exception std::invalid_argument from setConfig(). \exception std::runtime_error for error in recreating speller. */ - void resetConfig(const std::string& lang, - const std::string& jargon, - const std::string& encoding=kDEF_ENCODING) + void resetConfig(const std::string& lang +#if ! defined(USE_ENCHANT) + , const std::string& jargon + , const std::string& encoding=kDEF_ENCODING +#endif + ) throw( std::invalid_argument, std::runtime_error ); /*! \author Gora Mohanty <gora@srijan.in> @@ -284,45 +345,8 @@ \exception std::runtime_error for error in saving lists. */ void saveLists() throw( std::runtime_error ); - /*! - \author Gora Mohanty <gora@srijan.in> - \brief Sets configuration option, 'opt' to value 'val'. - \param opt: Option to be set. - \param val: Value of option to be set. - \retval None - \exception std::invalid_argument if option value is incorrect - */ - void setConfigOpt(const std::string& opt, const std::string& val) - throw( std::invalid_argument ); - /*! - \author Gora Mohanty <gora@srijan.in> - \brief Stores main word list. WARNING: This causes a crash due to a bug in aspell, as of aspell version 0.60.3. - \param None - \retval None. - \exception std::invalid_argument from storeWordList(). - */ - void StoreMainList(std::vector<std::string>& replacement) - throw( std::invalid_argument ); - /*! - \author Gora Mohanty <gora@srijan.in> - \brief Stores personal word list. - \param None - \retval None. - \exception std::invalid_argument from storeWordList(). - */ - void StorePersonalList(std::vector<std::string>& replacement) - throw( std::invalid_argument ); - /*! - \author Gora Mohanty <gora@srijan.in> - \brief Stores session word list. - \param None - \retval None. - \exception std::invalid_argument from storeWordList(). - */ - void StoreSessionList(std::vector<std::string>& replacement) - throw( std::invalid_argument ); }; // class Suggest - } // namespace Aspell + } // namespace Spell } // namespace Speller #endif // #ifndef SUGGEST_H //@@@@@@@@@@@@@@@@@@@@@@@@@ END OF FILE @@@@@@@@@@@@@@@@@@@@@@@@@ --- /dev/null 2009-07-13 20:06:56.536016917 +0100 +++ scribus-1.3.5.rc2/cmake/modules/FindENCHANT.cmake 2009-07-15 12:48:37.000000000 +0100 @@ -0,0 +1,44 @@ +# - Try to find the Enchant spell checker +# Once done this will define +# +# ENCHANT_FOUND - system has ENCHANT +# ENCHANT_INCLUDE_DIR - the ENCHANT include directory +# ENCHANT_LIBRARIES - Link these to use ENCHANT +# ENCHANT_DEFINITIONS - Compiler switches required for using ENCHANT + +# Copyright (c) 2006, Zack Rusin, <zack@kde.org> +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + + +if (ENCHANT_INCLUDE_DIR AND ENCHANT_LIBRARIES) + + # in cache already + set(ENCHANT_FOUND TRUE) + +else (ENCHANT_INCLUDE_DIR AND ENCHANT_LIBRARIES) + if (NOT WIN32) + # use pkg-config to get the directories and then use these values + # in the FIND_PATH() and FIND_LIBRARY() calls + find_package(PkgConfig) + pkg_check_modules(PC_ENCHANT QUIET enchant) + set(ENCHANT_DEFINITIONS ${PC_ENCHANT_CFLAGS_OTHER}) + endif (NOT WIN32) + + find_path(ENCHANT_INCLUDE_DIR + NAMES enchant++.h + HINTS ${PC_ENCHANT_INCLUDEDIR} + ${PC_ENCHANT_INCLUDE_DIRS} + PATH_SUFFIXES enchant ) + + find_library(ENCHANT_LIBRARIES NAMES enchant + HINTS ${PC_ENCHANT_LIBDIR} + ${PC_ENCHANT_LIBRARY_DIRS} ) + + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(ENCHANT DEFAULT_MSG ENCHANT_INCLUDE_DIR ENCHANT_LIBRARIES ) + + mark_as_advanced(ENCHANT_INCLUDE_DIR ENCHANT_LIBRARIES) + +endif (ENCHANT_INCLUDE_DIR AND ENCHANT_LIBRARIES) |
2009-10-08 16:18
|
enchant081009.diff (58,284 bytes)
Index: scribus/plugins/tools/spellcheck/aspellplugin.cpp =================================================================== --- scribus/plugins/tools/spellcheck/aspellplugin.cpp (revision 14117) +++ scribus/plugins/tools/spellcheck/aspellplugin.cpp (working copy) @@ -17,21 +17,21 @@ // Please don't implement the functionality of your plugin here; do that // in aspellpluginimpl.h and aspellpluginimpl.cpp . -AspellPlugin::AspellPlugin() : ScActionPlugin() +SpellPlugin::SpellPlugin() : ScActionPlugin() { // Set action info in languageChange, so we only have to do // it in one place. languageChange(); } -AspellPlugin::~AspellPlugin() {}; +SpellPlugin::~SpellPlugin() {}; -void AspellPlugin::languageChange() +void SpellPlugin::languageChange() { // Note that we leave the unused members unset. They'll be initialised // with their default ctors during construction. // Action name - m_actionInfo.name = "AspellPlugin"; + m_actionInfo.name = "SpellPlugin"; // Action text for menu, including &accel m_actionInfo.text = tr("Spell Checker"); // Menu @@ -55,20 +55,29 @@ m_actionInfo.enabledOnStartup = false; } -const QString AspellPlugin::fullTrName() const +const QString SpellPlugin::fullTrName() const { +#if defined(USE_ENCHANT) + return QObject::tr("Spell check (enchant)"); +#else return QObject::tr("Spell check (aspell)"); +#endif } -const ScActionPlugin::AboutData* AspellPlugin::getAboutData() const +const ScActionPlugin::AboutData* SpellPlugin::getAboutData() const { AboutData* about = new AboutData; Q_CHECK_PTR(about); about->authors = "Gora Mohanty <gora@srijan.in>"; about->shortDescription = tr( "Spell-checking support" ); about->description = +#if defined(USE_ENCHANT) + tr( "Adds support for spell-checking via enchant. Languages " + "can be chosen from among the installed enchant " +#else tr( "Adds support for spell-checking via aspell. Languages " "can be chosen from among the installed aspell " +#endif "dictionaries, and spell-checking can be done on the " "fly, or on selected text." ); about->version = tr( "0.1" ); @@ -77,15 +86,15 @@ return about; } -void AspellPlugin::deleteAboutData(const AboutData* about) const +void SpellPlugin::deleteAboutData(const AboutData* about) const { Q_ASSERT(about); delete about; } -bool AspellPlugin::run(ScribusDoc* doc, QString target) +bool SpellPlugin::run(ScribusDoc* doc, QString target) { - AspellPluginImpl *myPluginImpl = new AspellPluginImpl( doc ); + SpellPluginImpl *myPluginImpl = new SpellPluginImpl( doc ); Q_CHECK_PTR(myPluginImpl); // The spellcheck is disabled when there are no available // dictionaries. @@ -96,7 +105,7 @@ doc->scMW()->scrActions[m_actionInfo.name]->setEnabled(false); doc->scMW()->scrActions[m_actionInfo.name]->setVisible(false); QMessageBox::warning(doc->scMW(), - tr("Aspell Plugin Error"), + tr("Spell Plugin Error"), myPluginImpl->errorMessage()); } delete myPluginImpl; @@ -104,21 +113,21 @@ } // Low level plugin API -int x_aspellplugin_getPluginAPIVersion() +int spellplugin_getPluginAPIVersion() { return PLUGIN_API_VERSION; } -ScPlugin* x_aspellplugin_getPlugin() +ScPlugin* spellplugin_getPlugin() { - AspellPlugin* plug = new AspellPlugin(); + SpellPlugin* plug = new SpellPlugin(); Q_CHECK_PTR(plug); return plug; } -void x_aspellplugin_freePlugin(ScPlugin* plugin) +void spellplugin_freePlugin(ScPlugin* plugin) { - AspellPlugin* plug = dynamic_cast<AspellPlugin*>(plugin); + SpellPlugin* plug = dynamic_cast<SpellPlugin*>(plugin); Q_ASSERT(plug); delete plug; } Index: scribus/plugins/tools/spellcheck/aspellpluginimpl.cpp =================================================================== --- scribus/plugins/tools/spellcheck/aspellpluginimpl.cpp (revision 14117) +++ scribus/plugins/tools/spellcheck/aspellpluginimpl.cpp (working copy) @@ -17,15 +17,15 @@ #include "util.h" #include <QMessageBox> -const char* AspellPluginImpl::kDEF_CONTEXT = "AspellPlugin"; -const QString AspellPluginImpl::kDEF_ASPELL_ENTRY = - QString( "en" ) + Speller::Aspell::Suggest::kDICT_DELIM + - QString( "en" ) + Speller::Aspell::Suggest::kDICT_DELIM + - QString( "*" ) + Speller::Aspell::Suggest::kDICT_DELIM + +const char* SpellPluginImpl::kDEF_CONTEXT = "SpellPlugin"; +const QString SpellPluginImpl::kDEF_ASPELL_ENTRY = + QString( "en" ) + Speller::Spell::Suggest::kDICT_DELIM + + QString( "en" ) + Speller::Spell::Suggest::kDICT_DELIM + + QString( "*" ) + Speller::Spell::Suggest::kDICT_DELIM + QString( "60" ); // I.e., en/en/*/60 corresponding to default English dictionary // Initialize members here, if any -AspellPluginImpl::AspellPluginImpl(ScribusDoc* doc, QWidget* parent) : +SpellPluginImpl::SpellPluginImpl(ScribusDoc* doc, QWidget* parent) : QDialog( parent ), fdoc( doc ), m_docIsChanged(false), @@ -41,7 +41,12 @@ // Get stored language, jargon, encoding settings fprefs = PrefsManager::instance()->prefsFile->getPluginContext( kDEF_CONTEXT ); getPreferences(); - QString text = tr( "Loaded " ) + (fentry == kDEF_ASPELL_ENTRY ? tr( "default " ) : "") + fentry + tr( " aspell dictionary." ); + QString text = tr( "Loaded " ) + (fentry == kDEF_ASPELL_ENTRY ? tr( "default " ) : "") + fentry + +#if defined(USE_ENCHANT) + tr( " enchant dictionary." ); +#else + tr( " aspell dictionary." ); +#endif doc->scMW()->setStatusBarInfoText( text ); try { @@ -51,7 +56,11 @@ // Create speller, and get list of available aspell // dictionaries. - fsuggest = new Speller::Aspell::Suggest( flang.toUtf8().data(), fjargon.toUtf8().data(), fencoding.toUtf8().data() ); + fsuggest = new Speller::Spell::Suggest( flang.toUtf8().data() +#if !defined(USE_ENCHANT) + , fjargon.toUtf8().data(), fencoding.toUtf8().data() +#endif + ); Q_CHECK_PTR( fsuggest ); // Get list of available aspell dictionaries @@ -66,16 +75,33 @@ // check the availability of any dict. If == 0 then the plugin // is disabled in all GUI. if (flistDicts->count() == 0) - m_errorMessage = tr("No available Aspell dictionaries found. Install some, please."); + m_errorMessage = tr("No available spelling dictionaries found. Install some, please."); // use dict for system local if there are no preferences set before - QString locale(QLocale::system().name().left(2)); if (fentry.isEmpty()) { - int ix = flistDicts->findText(locale, Qt::MatchStartsWith); + QString locale = QLocale::system().name(); + int ix = flistDicts->findText(locale); //Exact match + if (ix == -1) + { + QString language_pattern('^'); + language_pattern.append(locale); + language_pattern.append("([^a-zA-Z]|$).*"); + ix = flistDicts->findText(language_pattern, Qt::MatchRegExp); //Very close match + } + if (ix == -1) + { + QString language_pattern('^'); + QStringList fields = locale.split( '_' ); + QString language = fields[0]; + language_pattern.append(language); + language_pattern.append("([^a-zA-Z]|$).*"); + ix = flistDicts->findText(language_pattern, Qt::MatchRegExp); //Close enough match + } if (ix != -1) flistDicts->setCurrentIndex(ix); else { + fentry = kDEF_ASPELL_ENTRY; setCurrentComboItem(flistDicts, fentry); } @@ -86,23 +112,23 @@ } catch( const std::invalid_argument& err ) { - QString warn = tr( "aspellplugin (AspellPluginImpl::" - "AspellPluginImpl): Error in aspell " + QString warn = tr( "aspellplugin (SpellPluginImpl::" + "SpellPluginImpl): Error in " "speller configuration." ); qWarning( "%s", warn.toUtf8().data() ); } catch( const std::runtime_error& err ) { - QString warn = tr( "aspellplugin (AspellPluginImpl::" - "AspellPluginImpl): Error in creating " - "aspell speller." ); + QString warn = tr( "aspellplugin (SpellPluginImpl::" + "SpellPluginImpl): Error in creating " + "speller." ); qWarning( "%s", warn.toUtf8().data() ); } activateSpellGUI(true); parseSelection(); } //__________________________________________________________________________ -AspellPluginImpl::~AspellPluginImpl() +SpellPluginImpl::~SpellPluginImpl() { // Destructor try @@ -111,14 +137,14 @@ } catch( const std::runtime_error& err ) { - qWarning( "aspellplugin (AspellPluginImpl::~AspellPlugin" + qWarning( "aspellplugin (SpellPluginImpl::~SpellPlugin" "Impl): Error in saving aspell word lists." ); } delete fsuggest; } //__________________________________________________________________________ -void AspellPluginImpl::activateSpellGUI(bool active) +void SpellPluginImpl::activateSpellGUI(bool active) { // Activates spell-checking GUI elements in spell-checking // tab, i.e., everything except combo box at top @@ -136,7 +162,7 @@ flistDicts->setEnabled( active ); } //__________________________________________________________________________ -void AspellPluginImpl::nextWord() +void SpellPluginImpl::nextWord() { QChar ch; QString wordBoundaries = QString(" .,:;\"'!?\n"); @@ -171,7 +197,7 @@ fpos = pa; } //__________________________________________________________________________ -void AspellPluginImpl::checkText() +void SpellPluginImpl::checkText() { // Called from parseXXX(), after filling in the currently // relevant text into 'fcontent'. Handles spell-checking of @@ -235,7 +261,7 @@ } } //__________________________________________________________________________ -void AspellPluginImpl::spellCheckDone() +void SpellPluginImpl::spellCheckDone() { // Called once all words in the current text, i.e., in 'fcontent' // have been spell-checked. Pops up an information dialog. @@ -257,14 +283,14 @@ close(); } //__________________________________________________________________________ -void AspellPluginImpl::on_fcloseBtn_clicked() +void SpellPluginImpl::on_fcloseBtn_clicked() { // Called when the "Close" button is clicked. Makes any pending // replacements and closes the spell-checking window. spellCheckDone(); // Also closes spell-checking window. } //__________________________________________________________________________ -void AspellPluginImpl::on_fchangeBtn_clicked() +void SpellPluginImpl::on_fchangeBtn_clicked() { // Called when the "Change" button is clicked. Replaces the word // being spell-checked with the current word in text edit box. @@ -299,7 +325,7 @@ checkText(); } //__________________________________________________________________________ -void AspellPluginImpl::on_fchangeAllBtn_clicked() +void SpellPluginImpl::on_fchangeAllBtn_clicked() { // Called when the "Change All" button is clicked. Replaces all // instances of the word being spell-checked with the current word in @@ -336,7 +362,7 @@ checkText(); } //__________________________________________________________________________ -void AspellPluginImpl::on_fskipBtn_clicked() +void SpellPluginImpl::on_fskipBtn_clicked() { // Called when the "Skip" button is clicked. Skips the word currently // being spell-checked. @@ -345,7 +371,7 @@ checkText(); } //__________________________________________________________________________ -void AspellPluginImpl::on_fskipAllBtn_clicked() +void SpellPluginImpl::on_fskipAllBtn_clicked() { // Called when the "Skip All" button is clicked. Puts the word // currently being spell-checked into the list of words to be ignored @@ -362,7 +388,7 @@ { QString warn = - tr( "AspellPluginImpl::on_fskipAllBtn_clicked(): Unable " + tr( "SpellPluginImpl::on_fskipAllBtn_clicked(): Unable " "to skip all instances of \"" ) + fcontent + tr(" by adding it to the session list."); qWarning( "%s", warn.toUtf8().data() ); @@ -372,7 +398,7 @@ checkText(); } //__________________________________________________________________________ -void AspellPluginImpl::on_faddWordBtn_clicked() +void SpellPluginImpl::on_faddWordBtn_clicked() { // Called when the "Add word" button is clicked. Adds word to personal // word list. @@ -385,13 +411,13 @@ catch( const std::runtime_error& err ) { QString warn = - tr( "AspellPluginImpl::on_faddWordBtn_clicked(): " + tr( "SpellPluginImpl::on_faddWordBtn_clicked(): " "Unable to add word to personal list." ); qWarning( "%s", warn.toUtf8().data() ); } } //__________________________________________________________________________ -void AspellPluginImpl::on_flistReplacements_itemActivated() +void SpellPluginImpl::on_flistReplacements_itemActivated() { // Called when an item in the list of replacements is // selected. Replaces current word in text edit box with the text @@ -399,27 +425,37 @@ fcurrWord->setText( flistReplacements->currentItem()->text() ); } -bool AspellPluginImpl::handleSpellConfig(const QString & dictFullName) +bool SpellPluginImpl::handleSpellConfig(const QString & dictFullName) { QString entry(dictFullName); - QStringList fields = entry.split( Speller::Aspell::Suggest::kDICT_DELIM ); + QStringList fields = entry.split( Speller::Spell::Suggest::kDICT_DELIM ); +#if defined(USE_ENCHANT) + // Ensure that we have sufficient fields. + if( fields.size() > 2 ) + { + fsuggest->resetConfig( fields[1].toAscii().data() ); + setPreferences( fields[1] ); + return true; + } +#else // Ensure that we have at least the right no.of fields. if( fields.size() == 4 ) { QString value = - fields[0] + Speller::Aspell::Suggest::kDICT_DELIM + - fields[1] + Speller::Aspell::Suggest::kDICT_DELIM + - fields[2] + Speller::Aspell::Suggest::kDICT_DELIM + + fields[0] + Speller::Spell::Suggest::kDICT_DELIM + + fields[1] + Speller::Spell::Suggest::kDICT_DELIM + + fields[2] + Speller::Spell::Suggest::kDICT_DELIM + fields[3]; fsuggest->resetConfig( fields[1].toAscii().data(), fields[2].toAscii().data() ); // FIXME: Handle encodings other than UTF-8. - setPreferences( fields[1], fields[2], Speller::Aspell::Suggest::kDEF_ENCODING, value ); + setPreferences( fields[1], fields[2], Speller::Spell::Suggest::kDEF_ENCODING, value ); return true; } +#endif return false; } //__________________________________________________________________________ -void AspellPluginImpl::on_flistDicts_activated() +void SpellPluginImpl::on_flistDicts_activated() { // Called when an item in the list of available aspell dictionaries is // selected, i.e., by double-clicking, or pressing enter. Resets @@ -443,38 +479,45 @@ } } //__________________________________________________________________________ -void AspellPluginImpl::getPreferences() +void SpellPluginImpl::getPreferences() { // Retrieves user preferences from saved settings. Defaults are // supplied - flang = fprefs->get( "lang", Speller::Aspell::Suggest::kDEF_LANG ); - fjargon = fprefs->get( "jargon", Speller::Aspell::Suggest::kDEF_JARGON ); + flang = fprefs->get( "lang", Speller::Spell::Suggest::kDEF_LANG ); +#if !defined(USE_ENCHANT) + fjargon = fprefs->get( "jargon", Speller::Spell::Suggest::kDEF_JARGON ); // FIXME: Handle encodings other than UTF-8. - fencoding = fprefs->get( "encoding", Speller::Aspell::Suggest::kDEF_ENCODING ); + fencoding = fprefs->get( "encoding", Speller::Spell::Suggest::kDEF_ENCODING ); // Don't use kDEF_ASPELL_ENTRY here. It's checked // against system locale later when there is no preferences for it. fentry = fprefs->get( "entry", "");//kDEF_ASPELL_ENTRY ); +#endif } //__________________________________________________________________________ -void AspellPluginImpl::setPreferences(const QString& lang, - const QString& jargon, - const QString& encoding, - const QString& entry) +void SpellPluginImpl::setPreferences(const QString& lang +#if !defined(USE_ENCHANT) + , const QString& jargon + , const QString& encoding + , const QString& entry +#endif + ) { // Saves user preferences using Scribus preferences manager. fprefs->set( "lang", lang ); - QString val = jargon == Speller::Aspell::Suggest::kEMPTY ? "" : jargon; +#if !defined(USE_ENCHANT) + QString val = jargon == Speller::Spell::Suggest::kEMPTY ? "" : jargon; fprefs->set( "jargon", val ); fprefs->set( "encoding", encoding ); fprefs->set( "entry", entry ); +#endif } //__________________________________________________________________________ -void AspellPluginImpl::languageChange() +void SpellPluginImpl::languageChange() { - qWarning( "AspellPluginImpl::languageChange(): Not implemented yet" ); + qWarning( "SpellPluginImpl::languageChange(): Not implemented yet" ); } //__________________________________________________________________________ -void AspellPluginImpl::parseItem() +void SpellPluginImpl::parseItem() { // Parse text in a frame, and spell-check it. // Process only text frames @@ -485,7 +528,7 @@ } } //__________________________________________________________________________ -void AspellPluginImpl::parseSelection() +void SpellPluginImpl::parseSelection() { fcontent.truncate( 0 ); // Start with empty string uint ndocs = fdoc->m_Selection->count(); Index: scribus/plugins/tools/spellcheck/suggest.cpp =================================================================== --- scribus/plugins/tools/spellcheck/suggest.cpp (revision 14117) +++ scribus/plugins/tools/spellcheck/suggest.cpp (working copy) @@ -8,47 +8,68 @@ #include "suggest.h" #include "scpaths.h" #include <QFileInfo> +#include <algorithm> /*! \brief Delimiter between different components of formatted strings for aspell dictionary entries. */ -const char* Speller::Aspell::Suggest::kDICT_DELIM = "/"; -const char* Speller::Aspell::Suggest::kEMPTY = "*"; -const char* Speller::Aspell::Suggest::kDEF_LANG = "en"; -const char* Speller::Aspell::Suggest::kDEF_JARGON = ""; // I.e., no jargon -const char* Speller::Aspell::Suggest::kDEF_ENCODING = "utf-8"; +#if defined(USE_ENCHANT) +#include <enchant++.h> +const char* Speller::Spell::Suggest::kDEF_LANG = "en_US"; +#else +const char* Speller::Spell::Suggest::kDEF_LANG = "en"; +const char* Speller::Spell::Suggest::kDEF_JARGON = ""; // I.e., no jargon +const char* Speller::Spell::Suggest::kDEF_ENCODING = "utf-8"; +#endif +const char* Speller::Spell::Suggest::kDICT_DELIM = "/"; +const char* Speller::Spell::Suggest::kEMPTY = "*"; -void Speller::Aspell::Suggest::checkError() throw( std::runtime_error ) +#if ! defined(USE_ENCHANT) +void Speller::Spell::Suggest::checkError() throw( std::runtime_error ) { if( aspell_speller_error_number( fspeller ) != 0 ) { std::string err_msg = - std::string( "(Aspell::Speller::Suggest::checkError): " + std::string( "(Spell::Speller::Suggest::checkError): " "aspell speller error " ) + aspell_speller_error_message( fspeller ); throw std::runtime_error( err_msg ); } } //__________________________________________________________________________ -void Speller::Aspell::Suggest::checkConfigError() +void Speller::Spell::Suggest::checkConfigError() throw( std::runtime_error ) { if( aspell_config_error_number( fconfig ) != 0 ) { std::string err_msg = - std::string( "(Aspell::Speller::Suggest::checkConfig" + std::string( "(Spell::Speller::Suggest::checkConfig" "Error): aspell speller error " ) + aspell_config_error_message( fconfig ); throw std::runtime_error( err_msg ); } } +#endif //__________________________________________________________________________ -void Speller::Aspell::Suggest::init(const std::string& lang, - const std::string& jargon, - const std::string& encoding) +void Speller::Spell::Suggest::init(const std::string& lang +#if ! defined(USE_ENCHANT) + , const std::string& jargon + , const std::string& encoding +#endif +) throw( std::invalid_argument, std::runtime_error ) { // Save aspell configuration values flang = lang; +#if defined(USE_ENCHANT) + try + { + fspeller = enchant::Broker::instance()->request_dict(flang); + } + catch( enchant::Exception& err ) + { + throw std::invalid_argument(err.what()); + } +#else fjargon = jargon; fencoding = encoding; @@ -67,7 +88,7 @@ if( aspell_error_number( ret ) != 0 ) { delete_aspell_can_have_error( ret ); - throw std::runtime_error( "(Aspell::Speller::Suggest::init" + throw std::runtime_error( "(Spell::Speller::Suggest::init" "): Error in creating speller." ); } else @@ -75,9 +96,11 @@ fspeller = to_aspell_speller( ret ); fconfig = aspell_speller_config( fspeller ); } +#endif } +#if ! defined(USE_ENCHANT) //__________________________________________________________________________ -void Speller::Aspell::Suggest::listDicts(std::vector<AspellDictInfo>& vals) +void Speller::Spell::Suggest::listDicts(std::vector<AspellDictInfo>& vals) { AspellDictInfoList* dlist = get_aspell_dict_info_list( fconfig ); AspellDictInfoEnumeration* dinfo_enum = @@ -89,9 +112,26 @@ } delete_aspell_dict_info_enumeration( dinfo_enum ); } +#endif +#if defined(USE_ENCHANT) +void EnchantDictDescribe(const char * const lang_tag, + const char * const , + const char * const , + const char * const , + void * user_data) +{ + std::vector<std::string> *detected = (std::vector<std::string>*)user_data; + detected->push_back(std::string(lang_tag)); +} +#endif + //__________________________________________________________________________ -void Speller::Aspell::Suggest::listDicts(std::vector<std::string>& vals) +void Speller::Spell::Suggest::listDicts(std::vector<std::string>& vals) { +#if defined(USE_ENCHANT) + enchant::Broker::instance()->list_dicts(EnchantDictDescribe, &vals); + std::sort(vals.begin(), vals.end()); +#else std::vector<AspellDictInfo> entries; listDicts( entries ); for( std::vector<AspellDictInfo>::const_iterator i = entries.begin(); @@ -105,16 +145,27 @@ << i->size; vals.push_back( fmt_entry.str() ); } +#endif } //__________________________________________________________________________ void -Speller::Aspell::Suggest::printWordList(const AspellWordList* wlist, +Speller::Spell::Suggest::printWordList( +#if defined(USE_ENCHANT) + const std::vector<std::string> & wlist, +#else + const AspellWordList* wlist, +#endif char delim) throw( std::invalid_argument ) { +#if defined(USE_ENCHANT) + std::vector<std::string>::const_iterator aEnd = wlist.end(); + for (std::vector<std::string>::const_iterator aI = wlist.begin(); aI != aEnd; ++aI) + std::cout << *aI << delim; +#else if( ! wlist ) { - throw std::invalid_argument( "(Aspell.Speller.Suggest.print" + throw std::invalid_argument( "(Spell.Speller.Suggest.print" "WordList): word list pointer " "is null." ); } @@ -127,9 +178,11 @@ std::cout << next << delim; } delete_aspell_string_enumeration( enum_list ); +#endif } +#if ! defined(USE_ENCHANT) //__________________________________________________________________________ -void Speller::Aspell::Suggest::setConfig() throw( std::invalid_argument ) +void Speller::Spell::Suggest::setConfig() throw( std::invalid_argument ) { try { @@ -150,13 +203,13 @@ } //__________________________________________________________________________ void -Speller::Aspell::Suggest::storeWordList(const AspellWordList* wlist, +Speller::Spell::Suggest::storeWordList(const AspellWordList* wlist, std::vector<std::string>& replacement) throw( std::invalid_argument ) { if( ! wlist ) { - throw std::invalid_argument( "(Aspell.Speller.Suggest.store" + throw std::invalid_argument( "(Spell.Speller.Suggest.store" "WordList): word list pointer " "is null." ); } @@ -170,16 +223,24 @@ } delete_aspell_string_enumeration( enum_list ); } +#endif //__________________________________________________________________________ -Speller::Aspell::Suggest::Suggest(const std::string& lang, - const std::string& jargon, - const std::string& encoding) +Speller::Spell::Suggest::Suggest(const std::string& lang +#if ! defined(USE_ENCHANT) + , const std::string& jargon + , const std::string& encoding +#endif + ) throw( std::invalid_argument, std::runtime_error ) { // Default constructor try { - init( lang, jargon, encoding ); + init( lang +#if ! defined(USE_ENCHANT) + , jargon, encoding +#endif + ); } catch( const std::invalid_argument& err ) { @@ -190,8 +251,9 @@ throw err; } } +#if ! defined(USE_ENCHANT) //__________________________________________________________________________ -Speller::Aspell::Suggest::Suggest(const AspellDictInfo* dinfo, +Speller::Spell::Suggest::Suggest(const AspellDictInfo* dinfo, const std::string& encoding) throw( std::invalid_argument, std::runtime_error ) { @@ -208,10 +270,21 @@ throw err; } } +#endif +Speller::Spell::Suggest::~Suggest() +{ +#if defined(USE_ENCHANT) + delete fspeller; +#endif +} //__________________________________________________________________________ -void Speller::Aspell::Suggest::addPersonalList(const std::string& word) +void Speller::Spell::Suggest::addPersonalList(const std::string& word) throw( std::runtime_error ) { +#if defined(USE_ENCHANT) + if (fspeller) + fspeller->add(word); +#else // A std::runtime_error exception is thrown if // an error occcurs. @@ -226,20 +299,25 @@ { throw err; } +#endif } //__________________________________________________________________________ -bool Speller::Aspell::Suggest::checkWord(const std::string& word) +bool Speller::Spell::Suggest::checkWord(const std::string& word) { bool status = true; - +#if defined(USE_ENCHANT) + if (fspeller) + status = fspeller->check(word); +#else if( aspell_speller_check( fspeller, word.c_str(), -1 ) == 0 ) { status = false; } +#endif return status; } //__________________________________________________________________________ -bool Speller::Aspell::Suggest::checkWord(const std::string& word, +bool Speller::Spell::Suggest::checkWord(const std::string& word, std::vector<std::string>& replacement, bool always) throw( std::invalid_argument ) @@ -252,8 +330,12 @@ // 'word'is spelt incorrectly. bool status = checkWord( word ); - if( always ) + if( !status || always ) { +#if defined(USE_ENCHANT) + if (fspeller) + fspeller->suggest (word, replacement); +#else const AspellWordList* wlist = aspell_speller_suggest( fspeller, word.c_str(), -1 ); try @@ -264,28 +346,13 @@ { throw err; } +#endif } - else - { - if( ! status ) - { - const AspellWordList* wlist = - aspell_speller_suggest( fspeller, word.c_str(), - -1 ); - try - { - storeWordList( wlist, replacement ); - } - catch( const std::invalid_argument& err ) - { - throw err; - } - } - } return status; } +#if !defined(USE_ENCHANT) //__________________________________________________________________________ -void Speller::Aspell::Suggest::clearSessionList() throw( std::runtime_error ) +void Speller::Spell::Suggest::clearSessionList() throw( std::runtime_error ) { aspell_speller_clear_session( fspeller ); try @@ -297,35 +364,15 @@ throw err; } } +#endif //__________________________________________________________________________ -std::string Speller::Aspell::Suggest::getConfigOpt(const std::string& opt) -{ - return std::string( aspell_config_retrieve( fconfig, opt.c_str() ) ); -} -//__________________________________________________________________________ -void Speller::Aspell::Suggest::getConfigOpt(const std::string& opt, - std::vector<std::string>& vals) -{ - // Stores current setting of configuration option, 'opt', which - // has a value of list type, in 'vals'. - AspellStringList* list = new_aspell_string_list(); - AspellMutableContainer* lst0 = - aspell_string_list_to_mutable_container( list ); - aspell_config_retrieve_list( fconfig, opt.c_str(), lst0 ); - AspellStringEnumeration* enum_list = - aspell_string_list_elements( list ); - const char* next; - while( (next = aspell_string_enumeration_next( enum_list )) ) - { - vals.push_back( next ); - } - delete_aspell_string_enumeration( enum_list ); - delete_aspell_string_list( list ); -} -//__________________________________________________________________________ -void Speller::Aspell::Suggest::ignoreWord(const std::string& word) +void Speller::Spell::Suggest::ignoreWord(const std::string& word) throw( std::runtime_error ) { +#if defined(USE_ENCHANT) + if (fspeller) + fspeller->add_to_session(word); +#else // FIXME: Return value should be something meaningful from // aspell_speller_add_to_session. aspell_speller_add_to_session( fspeller, word.c_str(), -1 ); @@ -337,9 +384,11 @@ { throw err; } +#endif } +#if !defined(USE_ENCHANT) //__________________________________________________________________________ -void Speller::Aspell::Suggest::printMainList() throw( std::invalid_argument ) +void Speller::Spell::Suggest::printMainList() throw( std::invalid_argument ) { const AspellWordList* wlist = aspell_speller_main_word_list( fspeller ); @@ -353,7 +402,7 @@ } } //__________________________________________________________________________ -void Speller::Aspell::Suggest::printPersonalList() +void Speller::Spell::Suggest::printPersonalList() throw( std::invalid_argument ) { const AspellWordList* wlist = @@ -368,7 +417,7 @@ } } //__________________________________________________________________________ -void Speller::Aspell::Suggest::printSessionList() +void Speller::Spell::Suggest::printSessionList() throw( std::invalid_argument ) { const AspellWordList* wlist = @@ -382,8 +431,9 @@ throw err; } } +#endif //__________________________________________________________________________ -bool Speller::Aspell::Suggest::printSuggestions(const std::string& word, +bool Speller::Spell::Suggest::printSuggestions(const std::string& word, bool always) throw( std::invalid_argument ) { @@ -394,8 +444,12 @@ // false, only prints the list if 'word' is incorrect. bool status = checkWord( word ); - if( always ) + if( !status || always ) { +#if defined(USE_ENCHANT) + if (fspeller) + printWordList( fspeller->suggest (word) ); +#else const AspellWordList* wlist = aspell_speller_suggest( fspeller, word.c_str(), -1 ); try @@ -406,32 +460,21 @@ { throw err; } +#endif } - else - { - if( ! status ) - { - const AspellWordList* wlist = - aspell_speller_suggest( fspeller, word.c_str(), - -1 ); - try - { - printWordList( wlist ); - } - catch( const std::invalid_argument& err ) - { - throw err; - } - } - } return status; } //__________________________________________________________________________ -void Speller::Aspell::Suggest::resetConfig() +void Speller::Spell::Suggest::resetConfig() throw( std::invalid_argument, std::runtime_error ) { +#if defined(USE_ENCHANT) + delete fspeller; + fspeller = enchant::Broker::instance()->request_dict(flang); +#else delete_aspell_config( fconfig ); fconfig = new_aspell_config(); + try { setConfig(); @@ -445,7 +488,7 @@ if( aspell_error_number( ret ) != 0 ) { delete_aspell_can_have_error( ret ); - throw std::runtime_error( "(Aspell::Speller::Suggest::Reset" + throw std::runtime_error( "(Spell::Speller::Suggest::Reset" "Config): Error in creating " "speller." ); } @@ -457,17 +500,23 @@ delete_aspell_config( fconfig ); fconfig = aspell_speller_config( fspeller ); } +#endif } //__________________________________________________________________________ -void Speller::Aspell::Suggest::resetConfig(const std::string& lang, - const std::string& jargon, - const std::string& encoding) +void Speller::Spell::Suggest::resetConfig(const std::string& lang +#if !defined(USE_ENCHANT) + , const std::string& jargon + , const std::string& encoding +#endif + ) throw( std::invalid_argument, std::runtime_error ) { // Save new aspell configuration values flang = lang; +#if !defined(USE_ENCHANT) fjargon = jargon; fencoding = encoding; +#endif try { @@ -483,8 +532,9 @@ } } //__________________________________________________________________________ -void Speller::Aspell::Suggest::saveLists() throw( std::runtime_error ) +void Speller::Spell::Suggest::saveLists() throw( std::runtime_error ) { +#if !defined(USE_ENCHANT) // Saves all word lists. aspell_speller_save_all_word_lists( fspeller ); try @@ -495,9 +545,11 @@ { throw err; } +#endif } +#if !defined(USE_ENCHANT) //__________________________________________________________________________ -void Speller::Aspell::Suggest::setConfigOpt(const std::string& opt, +void Speller::Spell::Suggest::setConfigOpt(const std::string& opt, const std::string& val) throw( std::invalid_argument ) { @@ -513,7 +565,7 @@ } //__________________________________________________________________________ void -Speller::Aspell::Suggest::StoreMainList(std::vector<std::string>& replacement) +Speller::Spell::Suggest::StoreMainList(std::vector<std::string>& replacement) throw( std::invalid_argument ) { const AspellWordList* wlist = @@ -528,7 +580,7 @@ } } //__________________________________________________________________________ -void Speller::Aspell::Suggest::StorePersonalList(std::vector<std::string>& replacement) throw( std::invalid_argument ) +void Speller::Spell::Suggest::StorePersonalList(std::vector<std::string>& replacement) throw( std::invalid_argument ) { // Stores personal word list. A std::invalid_argument // exception is thrown in case of error. @@ -544,7 +596,7 @@ } } //__________________________________________________________________________ -void Speller::Aspell::Suggest::StoreSessionList(std::vector<std::string>& replacement) throw( std::invalid_argument ) +void Speller::Spell::Suggest::StoreSessionList(std::vector<std::string>& replacement) throw( std::invalid_argument ) { // Stores session word list. A std::invalid_argument exception // is thrown in case of error. @@ -559,5 +611,6 @@ throw err; } } +#endif //__________________________________________________________________________ //@@@@@@@@@@@@@@@@@@@@@@@@@ END OF FILE @@@@@@@@@@@@@@@@@@@@@@@@@ Index: scribus/plugins/tools/spellcheck/aspellplugin.h =================================================================== --- scribus/plugins/tools/spellcheck/aspellplugin.h (revision 14117) +++ scribus/plugins/tools/spellcheck/aspellplugin.h (working copy) @@ -14,14 +14,14 @@ That documentatation is not duplicated here. Please don't implement the functionality of your plugin here; do that in aspellpluginimpl.h and aspellpluginimpl.cpp. */ -class PLUGIN_API AspellPlugin : public ScActionPlugin +class PLUGIN_API SpellPlugin : public ScActionPlugin { Q_OBJECT public: //! \brief Standard plugin implementation - AspellPlugin(); - virtual ~AspellPlugin(); + SpellPlugin(); + virtual ~SpellPlugin(); //! \brief main method to run the plug virtual bool run(ScribusDoc* doc, QString target = QString::null); virtual const QString fullTrName() const; @@ -33,8 +33,8 @@ // Special features (none) }; -extern "C" PLUGIN_API int x_aspellplugin_getPluginAPIVersion(); -extern "C" PLUGIN_API ScPlugin* x_aspellplugin_getPlugin(); -extern "C" PLUGIN_API void x_aspellplugin_freePlugin(ScPlugin* plugin); +extern "C" PLUGIN_API int spellplugin_getPluginAPIVersion(); +extern "C" PLUGIN_API ScPlugin* spellplugin_getPlugin(); +extern "C" PLUGIN_API void spellplugin_freePlugin(ScPlugin* plugin); #endif Index: scribus/plugins/tools/spellcheck/aspellpluginbase.ui =================================================================== --- scribus/plugins/tools/spellcheck/aspellpluginbase.ui (revision 14117) +++ scribus/plugins/tools/spellcheck/aspellpluginbase.ui (working copy) @@ -1,6 +1,6 @@ <ui version="4.0" > - <class>AspellPluginBase</class> - <widget class="QDialog" name="AspellPluginBase" > + <class>SpellPluginBase</class> + <widget class="QDialog" name="SpellPluginBase" > <property name="geometry" > <rect> <x>0</x> Index: scribus/plugins/tools/spellcheck/ChangeLog =================================================================== --- scribus/plugins/tools/spellcheck/ChangeLog (revision 14117) +++ scribus/plugins/tools/spellcheck/ChangeLog (working copy) @@ -1,3 +1,6 @@ +2009-06-15 Caolán McNamara <caolanm@redhat.com> + * use enchant if available + 2007-11-23 Franz Schmid * aspellpluginimpl.ui Added proper layouts to the Gui Index: scribus/plugins/tools/spellcheck/aspellpluginimpl.h =================================================================== --- scribus/plugins/tools/spellcheck/aspellpluginimpl.h (revision 14117) +++ scribus/plugins/tools/spellcheck/aspellpluginimpl.h (working copy) @@ -25,11 +25,11 @@ class PageItem; /*! -\class AspellPluginImpl +\class SpellPluginImpl \author Gora Mohanty <gora@srijan.in> -\brief 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 +\brief Implementation of plugin. GUI part is derived from SpellPluginBase class, as aspellpluginbase.{cpp,h} get overwritten by uic. Interface to aspell uses Speller::Spell::Suggest */ -class AspellPluginImpl : public QDialog, private Ui::AspellPluginBase +class SpellPluginImpl : public QDialog, private Ui::SpellPluginBase { Q_OBJECT private: @@ -37,8 +37,8 @@ static const char* kDEF_CONTEXT; /*! Formatted string for aspell dictionary entry: Form of <name>--<lang>--<jargon>--<size> */ static const QString kDEF_ASPELL_ENTRY; - /*! \brief Aspell interface object. */ - Speller::Aspell::Suggest* fsuggest; + /*! \brief Spell interface object. */ + Speller::Spell::Suggest* fsuggest; /*! \brief Scribus preferences object. */ PrefsContext* fprefs; /*! \brief Language for aspell dictionary. */ @@ -113,10 +113,13 @@ \param encoding: Encoding for aspell dictionary \retval None */ - void setPreferences(const QString& lang, - const QString& jargon, - const QString& encoding=Speller::Aspell::Suggest::kDEF_ENCODING, - const QString& entry=kDEF_ASPELL_ENTRY); + void setPreferences(const QString& lang +#if ! defined(USE_ENCHANT) + , const QString& jargon + , const QString& encoding=Speller::Spell::Suggest::kDEF_ENCODING + , const QString& entry=kDEF_ASPELL_ENTRY +#endif + ); /*! \author Gora Mohanty <gora@srijan.in> \brief Retrieve saved user preferences: language, jargon, encoding. @@ -168,14 +171,14 @@ \param parent: Parent window that this is a child of. \retval None */ - AspellPluginImpl(ScribusDoc* doc, QWidget* parent=NULL); + SpellPluginImpl(ScribusDoc* doc, QWidget* parent=NULL); /*! \author Gora Mohanty <gora@srijan.in> \brief Destructor for spell-checking plugin implementation. \param None \retval None */ - ~AspellPluginImpl(); + ~SpellPluginImpl(); /*! \brief Returns a error message for caller. It should disable the plugin then Index: scribus/plugins/tools/spellcheck/suggest.h =================================================================== --- scribus/plugins/tools/spellcheck/suggest.h (revision 14117) +++ scribus/plugins/tools/spellcheck/suggest.h (working copy) @@ -14,22 +14,36 @@ #include <string> // Used in function arguments, errors #include <vector> // Used in function arguments #include <iostream> // Printing to std::cout +#if defined(USE_ENCHANT) +// enchant definitions +namespace enchant +{ + class Dict; +} +#else // aspell include files #include <aspell.h> +#endif /*! \brief Nested namespaces to allow different interfaces to different spell-checking engines. */ namespace Speller { - namespace Aspell { + namespace Spell { /*! -\class Speller::Aspell::Suggest +\class Speller::Spell::Suggest \author Gora Mohanty <gora@srijan.in> \brief Class for interfacing with aspell. Should work with any aspell version from 0.60 onwards */ class Suggest { private: +#if defined(USE_ENCHANT) + /*! \brief Enchant speller object. */ + enchant::Dict* fspeller; + /*! \brief Language for aspell dictionary. */ + std::string flang; +#else /*! \brief Aspell configuration object. */ AspellConfig* fconfig; /*! \brief Aspell speller object. */ @@ -40,7 +54,8 @@ std::string fjargon; /*! \brief Character encoding for words. */ std::string fencoding; - +#endif +#if ! defined(USE_ENCHANT) /*! \author Gora Mohanty <gora@srijan.in> \brief Checks aspell speller for an error condition. @@ -57,6 +72,7 @@ \exception std::runtime_error if an error condition exists */ void checkConfigError() throw( std::runtime_error ); +#endif /*! \author Gora Mohanty <gora@srijan.in> \brief Initializes aspell: called from constructors. @@ -67,8 +83,12 @@ \exception std::invalid_argument from setConfig(). \exception std::runtime_error for error in creating speller. */ - void init(const std::string& lang, const std::string& jargon, - const std::string& encoding) + void init(const std::string& lang +#if ! defined(USE_ENCHANT) + ,const std::string& jargon + ,const std::string& encoding +#endif + ) throw( std::invalid_argument, std::runtime_error ); /*! \author Gora Mohanty <gora@srijan.in> @@ -78,18 +98,46 @@ \retval None \exception std::invalid_argument if 'wlist' is null */ +#if defined(USE_ENCHANT) + void printWordList(const std::vector<std::string> & wlist, +#else void printWordList(const AspellWordList* wlist, +#endif char delim='\n') throw(std::invalid_argument); +#if !defined(USE_ENCHANT) /*! \author Gora Mohanty <gora@srijan.in> + \brief Sets configuration option, 'opt' to value 'val'. + \param opt: Option to be set. + \param val: Value of option to be set. + \retval None + \exception std::invalid_argument if option value is incorrect + */ + void setConfigOpt(const std::string& opt, const std::string& val) + throw( std::invalid_argument ); +#endif + /*! + \author Gora Mohanty <gora@srijan.in> \brief Sets aspell speller configuration, as per current set of parameters. \param None \retval None \exception std::invalid_argument from setConfigOpt() */ void setConfig() throw( std::invalid_argument ); + /*! \author Gora Mohanty <gora@srijan.in> + \brief Resets aspell configuration, as per current set of parameters. + \param None + \retval None + \exception std::invalid_argument from setConfig(). + \exception std::runtime_error for error in recreating speller. + */ + void resetConfig() + throw( std::invalid_argument, std::runtime_error ); +#if !defined(USE_ENCHANT) + /*! + \author Gora Mohanty <gora@srijan.in> \brief Stores list of words in 'replacement'. \param wlist: Pointer to start of word list. \param replacement: Vector to hold suggested replacement words. @@ -99,7 +147,73 @@ void storeWordList(const AspellWordList* wlist, std::vector<std::string>& replacement) throw( std::invalid_argument ); - + /*! + \author Gora Mohanty <gora@srijan.in> + \brief Obtains list of available aspell dictionaries. + \param vals: Array of aspell dictionary info structs + \retval None + */ + void listDicts(std::vector<AspellDictInfo>& vals); + /*! + \author Gora Mohanty <gora@srijan.in> + \brief Clears the current session word list. + \param None + \retval None + \exception std::runtime_error for error in clearing list. + */ + void clearSessionList() throw( std::runtime_error ); + /*! + \author Gora Mohanty <gora@srijan.in> + \brief Prints main word list. WARNING: This causes a crash due to a bug in aspell, as of aspell version 0.60.3. + \param None + \retval None. + \exception std::invalid_argument from printWordList(). + */ + void printMainList() throw( std::invalid_argument ); + /*! + \author Gora Mohanty <gora@srijan.in> + \brief Prints personal word list. + \param None + \retval None. + \exception std::invalid_argument from printWordList(). + */ + void printPersonalList() throw( std::invalid_argument ); + /*! + \author Gora Mohanty <gora@srijan.in> + \brief Prints session word list. + \param None + \retval None. + \exception std::invalid_argument from printWordList(). + */ + void printSessionList() throw( std::invalid_argument ); + /*! + \author Gora Mohanty <gora@srijan.in> + \brief Stores main word list. WARNING: This causes a crash due to a bug in aspell, as of aspell version 0.60.3. + \param None + \retval None. + \exception std::invalid_argument from storeWordList(). + */ + void StoreMainList(std::vector<std::string>& replacement) + throw( std::invalid_argument ); + /*! + \author Gora Mohanty <gora@srijan.in> + \brief Stores personal word list. + \param None + \retval None. + \exception std::invalid_argument from storeWordList(). + */ + void StorePersonalList(std::vector<std::string>& replacement) + throw( std::invalid_argument ); + /*! + \author Gora Mohanty <gora@srijan.in> + \brief Stores session word list. + \param None + \retval None. + \exception std::invalid_argument from storeWordList(). + */ + void StoreSessionList(std::vector<std::string>& replacement) + throw( std::invalid_argument ); +#endif public: /*! \brief Delimiter between different components of formatted strings for aspell dictionary entries. @@ -111,10 +225,12 @@ static const char* kEMPTY; /*! \brief Default language for aspell dictionary. */ static const char* kDEF_LANG; +#if !defined(USE_ENCHANT) /*! \brief Default jargon for aspell dictionary. */ static const char* kDEF_JARGON; /*! \brief Default character encoding for words. */ static const char* kDEF_ENCODING; +#endif // Defaults are for standard aspell English dictionary. Use // "iso8859-1" for Basic Latin. See aspell lang.dat file for @@ -129,10 +245,14 @@ \exception std::invalid_argument from setConfig(). \exception std::runtime_error for error in creating speller. */ - Suggest(const std::string& lang=kDEF_LANG, - const std::string& jargon=kDEF_JARGON, - const std::string& encoding=kDEF_ENCODING) + Suggest(const std::string& lang=kDEF_LANG +#if !defined(USE_ENCHANT) + , const std::string& jargon=kDEF_JARGON + , const std::string& encoding=kDEF_ENCODING +#endif + ) throw( std::invalid_argument, std::runtime_error ); +#if !defined(USE_ENCHANT) /*! \author Gora Mohanty <gora@srijan.in> \brief Constructor for spell-checking class. @@ -145,6 +265,8 @@ Suggest(const AspellDictInfo* dinfo, const std::string& encoding=kDEF_ENCODING) throw( std::invalid_argument, std::runtime_error ); +#endif + ~Suggest(); /*! \author Gora Mohanty <gora@srijan.in> \brief Adds 'word' to personal list. @@ -173,30 +295,6 @@ bool always=true) throw( std::invalid_argument ); /*! \author Gora Mohanty <gora@srijan.in> - \brief Clears the current session word list. - \param None - \retval None - \exception std::runtime_error for error in clearing list. - */ - void clearSessionList() throw( std::runtime_error ); - /*! - \author Gora Mohanty <gora@srijan.in> - \brief Gets value of configuration option, 'opt'. - \param opt: Name of option whose setting is to be retrieved. - \retval Value of option setting. - */ - std::string getConfigOpt(const std::string& opt); - /*! - \author Gora Mohanty <gora@srijan.in> - \brief Gets value of list type configuration option, 'opt'. - \param opt: Name of option whose setting is to be retrieved. - \param vals: Vector for storing values for the list type object. - \retval None. - */ - void getConfigOpt(const std::string& opt, - std::vector<std::string>& vals); - /*! - \author Gora Mohanty <gora@srijan.in> \brief Ignores 'word' for current session. \param word: Word to be ignored. \retval None. @@ -204,46 +302,16 @@ */ void ignoreWord(const std::string& word) throw( std::runtime_error ); + /*! \author Gora Mohanty <gora@srijan.in> \brief Obtains list of available aspell dictionaries. - \param vals: Array of aspell dictionary info structs - \retval None - */ - void listDicts(std::vector<AspellDictInfo>& vals); - /*! - \author Gora Mohanty <gora@srijan.in> - \brief Obtains list of available aspell dictionaries. \param vals: Array of formatted strings for aspell dictionary entries. Each has format <name>--<lang>--<jargon>--<size> \retval None */ void listDicts(std::vector<std::string>& vals); /*! \author Gora Mohanty <gora@srijan.in> - \brief Prints main word list. WARNING: This causes a crash due to a bug in aspell, as of aspell version 0.60.3. - \param None - \retval None. - \exception std::invalid_argument from printWordList(). - */ - void printMainList() throw( std::invalid_argument ); - /*! - \author Gora Mohanty <gora@srijan.in> - \brief Prints personal word list. - \param None - \retval None. - \exception std::invalid_argument from printWordList(). - */ - void printPersonalList() throw( std::invalid_argument ); - /*! - \author Gora Mohanty <gora@srijan.in> - \brief Prints session word list. - \param None - \retval None. - \exception std::invalid_argument from printWordList(). - */ - void printSessionList() throw( std::invalid_argument ); - /*! - \author Gora Mohanty <gora@srijan.in> \brief Spell-checks word, and prints suggested replacements. \param word: Word to be checked. \param always: If true, replacements are always printed, else only if word is mis-spelt. @@ -254,16 +322,6 @@ throw( std::invalid_argument ); /*! \author Gora Mohanty <gora@srijan.in> - \brief Resets aspell configuration, as per current set of parameters. - \param None - \retval None - \exception std::invalid_argument from setConfig(). - \exception std::runtime_error for error in recreating speller. - */ - void resetConfig() - throw( std::invalid_argument, std::runtime_error ); - /*! - \author Gora Mohanty <gora@srijan.in> \brief Resets aspell configuration, as per current set of parameters, after resetting lang, jargon, and encoding. \param lang: Language of aspell dictionary. \param jargon: Jargon for aspell dictionary. @@ -272,9 +330,12 @@ \exception std::invalid_argument from setConfig(). \exception std::runtime_error for error in recreating speller. */ - void resetConfig(const std::string& lang, - const std::string& jargon, - const std::string& encoding=kDEF_ENCODING) + void resetConfig(const std::string& lang +#if ! defined(USE_ENCHANT) + , const std::string& jargon + , const std::string& encoding=kDEF_ENCODING +#endif + ) throw( std::invalid_argument, std::runtime_error ); /*! \author Gora Mohanty <gora@srijan.in> @@ -284,45 +345,8 @@ \exception std::runtime_error for error in saving lists. */ void saveLists() throw( std::runtime_error ); - /*! - \author Gora Mohanty <gora@srijan.in> - \brief Sets configuration option, 'opt' to value 'val'. - \param opt: Option to be set. - \param val: Value of option to be set. - \retval None - \exception std::invalid_argument if option value is incorrect - */ - void setConfigOpt(const std::string& opt, const std::string& val) - throw( std::invalid_argument ); - /*! - \author Gora Mohanty <gora@srijan.in> - \brief Stores main word list. WARNING: This causes a crash due to a bug in aspell, as of aspell version 0.60.3. - \param None - \retval None. - \exception std::invalid_argument from storeWordList(). - */ - void StoreMainList(std::vector<std::string>& replacement) - throw( std::invalid_argument ); - /*! - \author Gora Mohanty <gora@srijan.in> - \brief Stores personal word list. - \param None - \retval None. - \exception std::invalid_argument from storeWordList(). - */ - void StorePersonalList(std::vector<std::string>& replacement) - throw( std::invalid_argument ); - /*! - \author Gora Mohanty <gora@srijan.in> - \brief Stores session word list. - \param None - \retval None. - \exception std::invalid_argument from storeWordList(). - */ - void StoreSessionList(std::vector<std::string>& replacement) - throw( std::invalid_argument ); }; // class Suggest - } // namespace Aspell + } // namespace Spell } // namespace Speller #endif // #ifndef SUGGEST_H //@@@@@@@@@@@@@@@@@@@@@@@@@ END OF FILE @@@@@@@@@@@@@@@@@@@@@@@@@ Index: scribus/plugins/tools/spellcheck/CMakeLists.txt =================================================================== --- scribus/plugins/tools/spellcheck/CMakeLists.txt (revision 14117) +++ scribus/plugins/tools/spellcheck/CMakeLists.txt (working copy) @@ -1,10 +1,61 @@ -IF (ASPELL_FOUND) +IF (ENCHANT_FOUND) INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/scribus + ${ENCHANT_INCLUDE_DIR} + ) + + ADD_DEFINITIONS("-DUSE_ENCHANT") + + SET(ASPELL_PLUGIN_UI_SRC + aspellpluginbase.ui +# donedlgbase.ui + ) + + SET(ASPELL_PLUGIN_MOC_CLASSES + aspellplugin.h + aspellpluginimpl.h +# donedlgimpl.h + ) + + SET(ASPELL_PLUGIN_SOURCES + aspellplugin.cpp + aspellpluginimpl.cpp +# donedlgimpl.cpp + suggest.cpp + ) + + SET(SCRIBUS_ASPELL_PLUGIN "spellplugin") + + QT4_WRAP_UI(ASPELL_PLUGIN_UI_SOURCES ${ASPELL_PLUGIN_UI_SRC} ) + QT4_WRAP_CPP(ASPELL_PLUGIN_MOC_SOURCES ${ASPELL_PLUGIN_MOC_CLASSES}) + + ADD_LIBRARY(${SCRIBUS_ASPELL_PLUGIN} MODULE + ${ASPELL_PLUGIN_SOURCES} + ${ASPELL_PLUGIN_MOC_SOURCES} + ${ASPELL_PLUGIN_UI_SOURCES} + ) + + TARGET_LINK_LIBRARIES(${SCRIBUS_ASPELL_PLUGIN} ${ENCHANT_LIBRARIES} ${PLUGIN_LIBRARIES}) + + INSTALL(TARGETS ${SCRIBUS_ASPELL_PLUGIN} + LIBRARY + DESTINATION ${PLUGINDIR} + PERMISSIONS ${PLUGIN_PERMISSIONS} + ) + + ADD_DEPENDENCIES(${SCRIBUS_ASPELL_PLUGIN} ${EXE_NAME}) + +# SET_TARGET_PROPERTIES(${SCRIBUS_ASPELL_PLUGIN} PROPERTIES VERSION "0.0.1") +ELSEIF (ASPELL_FOUND) + INCLUDE_DIRECTORIES( + ${CMAKE_SOURCE_DIR} + ${CMAKE_SOURCE_DIR}/scribus ${ASPELL_INCLUDE_DIR} ) + ADD_DEFINITIONS("-DUSE_ASPELL") + SET(ASPELL_PLUGIN_UI_SRC aspellpluginbase.ui # donedlgbase.ui @@ -32,7 +83,7 @@ # INSTALL(CODE "FILE(MAKE_DIRECTORY ${ENV}${CMAKE_INSTALL_PREFIX}/${ASPELLRELATIVEDICTDIR})") ENDIF (APPLEBUNDLE) - SET(SCRIBUS_ASPELL_PLUGIN "x_aspellplugin") + SET(SCRIBUS_ASPELL_PLUGIN "spellplugin") QT4_WRAP_UI(ASPELL_PLUGIN_UI_SOURCES ${ASPELL_PLUGIN_UI_SRC} ) QT4_WRAP_CPP(ASPELL_PLUGIN_MOC_SOURCES ${ASPELL_PLUGIN_MOC_CLASSES}) @@ -54,5 +105,4 @@ ADD_DEPENDENCIES(${SCRIBUS_ASPELL_PLUGIN} ${EXE_NAME}) # SET_TARGET_PROPERTIES(${SCRIBUS_ASPELL_PLUGIN} PROPERTIES VERSION "0.0.1") -ENDIF (ASPELL_FOUND) - +ENDIF () Index: scribus/plugins/tools/CMakeLists.txt =================================================================== --- scribus/plugins/tools/CMakeLists.txt (revision 14117) +++ scribus/plugins/tools/CMakeLists.txt (working copy) @@ -6,7 +6,9 @@ ADD_SUBDIRECTORY(pathfinder) ADD_SUBDIRECTORY(pathstroker) ADD_SUBDIRECTORY(subdivide) -if (HAVE_ASPELL) +if (HAVE_ENCHANT) ADD_SUBDIRECTORY(spellcheck) -endif (HAVE_ASPELL) +elseif (HAVE_ASPELL) + ADD_SUBDIRECTORY(spellcheck) +endif () ADD_SUBDIRECTORY(transform) Index: CMakeLists.txt =================================================================== --- CMakeLists.txt (revision 14117) +++ CMakeLists.txt (working copy) @@ -632,17 +632,33 @@ ENDIF(NOT WIN32) #>>FontConfig -#<<ASPELL for Speelling support -FIND_PACKAGE(ASPELL) -IF (ASPELL_FOUND) - MESSAGE("ASpell Found OK") - SET(HAVE_ASPELL 1) -ELSE(ASPELL_FOUND) - MESSAGE("ASpell or its developer libraries NOT found - Disabling support for spell checking") -ENDIF(ASPELL_FOUND) -#>>ASPELL for Speelling support +#<<ENCHANT for Spelling support +IF (WANT_ENCHANT) + SET(ENCHANT_DIR ${CMAKE_MODULE_PATH}) + FIND_PACKAGE(ENCHANT) +ELSEIF (WANT_ENCHANT) + SET (ENCHANT_FOUND FALSE CACHE TYPE BOOL) + SET (HAVE_ENCHANT FALSE CACHE TYPE BOOL) +ENDIF (WANT_ENCHANT) +IF (ENCHANT_FOUND) + MESSAGE("Enchant Found OK") + SET(HAVE_ENCHANT 1) +ELSE(ENCHANT_FOUND) + MESSAGE("Enchant or its developer libraries NOT found - Trying aspell instead") + #<<ASPELL for Spelling support + FIND_PACKAGE(ASPELL) + IF (ASPELL_FOUND) + MESSAGE("ASpell Found OK") + SET(HAVE_ASPELL 1) + ELSE(ASPELL_FOUND) + MESSAGE("ASpell or its developer libraries NOT found - Disabling support for spell checking") + ENDIF(ASPELL_FOUND) + #>>ASPELL for Spelling support +ENDIF(ENCHANT_FOUND) +#>>ENCHANT for Spelling support + #<<PoDoFo for AI PDF import FIND_PACKAGE(LIBPODOFO) IF(LIBPODOFO_FOUND) Index: BUILDING =================================================================== --- BUILDING (revision 14117) +++ BUILDING (working copy) @@ -256,7 +256,7 @@ python-devel tk python-imaging - aspell-devel + enchant-devel boost-devel You can install these packages using YaST. You may find it difficult to compile |
|
Uploaded a new diff against 150svn. The enchant version does not work that well, and I am not sure if the patches break the aspell version a little too. The GUI does not respond well and the first two or three items to be checked to not appear in the GUI. Please have a look and see what could be the problem and if you can replicate this. |
|
Hi.. are you still interested in this one? Otherwise I will close it due to the bugs in the patches... thanks. |
|
Hi, we (= Fedora) are still interested in spell-checker consolidation over the system, please wait for updated patches. |
|
Ok, FYI, we want to release 1.3.8 within a few weeks.. |
|
Hi.. any interest? we are now at 1.3.9.svn.. |
|
I am working on new patches right now. Any chance they could go into the 1.3.9+ series? |
|
That depends on how well they work.. if they work.. then yes.. It would be good to have them for 1.4.0. How long do you estimate? |
|
I expect to have the patch by the end of this week, but the original author from Fedora was Caolan and I need to understand the changes first. |
|
New patch uploaded, I've made it as a series of small patches that should help to keep it up-to-date in the Version135 branch and also with porting to 1.5svn It seems to work for me, but the spell-check workflow looks a bit weird, even when it's same as with aspell (like the changes in text are seen after the spell check dialog is closed, the dialog is opened even for known/correct words, etc). |
|
I don't see any new patch? But if it doesn't work.. ???? |
|
scribus-1.3.8-enchant.patch (89,403 bytes)
From c26bb55c4f6af84b740a9164f28136c8a376f2aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <dan@danny.cz> Date: Sun, 26 Sep 2010 12:13:15 +0200 Subject: [PATCH 01/12] rename AspellPlugin classes to SpellPlugin --- .../plugins/tools/spellcheck/aspellplugin.cpp | 20 +++--- .../plugins/tools/spellcheck/aspellplugin.h | 6 +- .../plugins/tools/spellcheck/aspellpluginbase.ui | 4 +- .../plugins/tools/spellcheck/aspellpluginimpl.cpp | 60 ++++++++++---------- .../plugins/tools/spellcheck/aspellpluginimpl.h | 10 ++-- 5 files changed, 50 insertions(+), 50 deletions(-) diff --git a/Scribus/scribus/plugins/tools/spellcheck/aspellplugin.cpp b/Scribus/scribus/plugins/tools/spellcheck/aspellplugin.cpp index 37f0c64..2eca171 100644 --- a/Scribus/scribus/plugins/tools/spellcheck/aspellplugin.cpp +++ b/Scribus/scribus/plugins/tools/spellcheck/aspellplugin.cpp @@ -13,16 +13,16 @@ for which a new license (GPL+exception) is in place. // Please don't implement the functionality of your plugin here; do that // in aspellpluginimpl.h and aspellpluginimpl.cpp . -AspellPlugin::AspellPlugin() : ScActionPlugin() +SpellPlugin::SpellPlugin() : ScActionPlugin() { // Set action info in languageChange, so we only have to do // it in one place. languageChange(); } -AspellPlugin::~AspellPlugin() {}; +SpellPlugin::~SpellPlugin() {}; -void AspellPlugin::languageChange() +void SpellPlugin::languageChange() { // Note that we leave the unused members unset. They'll be initialised // with their default ctors during construction. @@ -51,12 +51,12 @@ void AspellPlugin::languageChange() m_actionInfo.enabledOnStartup = false; } -const QString AspellPlugin::fullTrName() const +const QString SpellPlugin::fullTrName() const { return QObject::tr("Spell check (aspell)"); } -const ScActionPlugin::AboutData* AspellPlugin::getAboutData() const +const ScActionPlugin::AboutData* SpellPlugin::getAboutData() const { AboutData* about = new AboutData; Q_CHECK_PTR(about); @@ -73,15 +73,15 @@ const ScActionPlugin::AboutData* AspellPlugin::getAboutData() const return about; } -void AspellPlugin::deleteAboutData(const AboutData* about) const +void SpellPlugin::deleteAboutData(const AboutData* about) const { Q_ASSERT(about); delete about; } -bool AspellPlugin::run(ScribusDoc* doc, QString target) +bool SpellPlugin::run(ScribusDoc* doc, QString target) { - AspellPluginImpl *myPluginImpl = new AspellPluginImpl( doc ); + SpellPluginImpl *myPluginImpl = new SpellPluginImpl( doc ); Q_CHECK_PTR(myPluginImpl); // The spellcheck is disabled when there are no available // dictionaries. @@ -107,14 +107,14 @@ int x_aspellplugin_getPluginAPIVersion() ScPlugin* x_aspellplugin_getPlugin() { - AspellPlugin* plug = new AspellPlugin(); + SpellPlugin* plug = new SpellPlugin(); Q_CHECK_PTR(plug); return plug; } void x_aspellplugin_freePlugin(ScPlugin* plugin) { - AspellPlugin* plug = dynamic_cast<AspellPlugin*>(plugin); + SpellPlugin* plug = dynamic_cast<SpellPlugin*>(plugin); Q_ASSERT(plug); delete plug; } diff --git a/Scribus/scribus/plugins/tools/spellcheck/aspellplugin.h b/Scribus/scribus/plugins/tools/spellcheck/aspellplugin.h index 55d8cd7..bbfbf7c 100644 --- a/Scribus/scribus/plugins/tools/spellcheck/aspellplugin.h +++ b/Scribus/scribus/plugins/tools/spellcheck/aspellplugin.h @@ -14,14 +14,14 @@ for which a new license (GPL+exception) is in place. That documentatation is not duplicated here. Please don't implement the functionality of your plugin here; do that in aspellpluginimpl.h and aspellpluginimpl.cpp. */ -class PLUGIN_API AspellPlugin : public ScActionPlugin +class PLUGIN_API SpellPlugin : public ScActionPlugin { Q_OBJECT public: //! \brief Standard plugin implementation - AspellPlugin(); - virtual ~AspellPlugin(); + SpellPlugin(); + virtual ~SpellPlugin(); //! \brief main method to run the plug virtual bool run(ScribusDoc* doc, QString target = QString::null); virtual const QString fullTrName() const; diff --git a/Scribus/scribus/plugins/tools/spellcheck/aspellpluginbase.ui b/Scribus/scribus/plugins/tools/spellcheck/aspellpluginbase.ui index 91f4ffd..fbe02fb 100644 --- a/Scribus/scribus/plugins/tools/spellcheck/aspellpluginbase.ui +++ b/Scribus/scribus/plugins/tools/spellcheck/aspellpluginbase.ui @@ -1,6 +1,6 @@ <ui version="4.0" > - <class>AspellPluginBase</class> - <widget class="QDialog" name="AspellPluginBase" > + <class>SpellPluginBase</class> + <widget class="QDialog" name="SpellPluginBase" > <property name="geometry" > <rect> <x>0</x> diff --git a/Scribus/scribus/plugins/tools/spellcheck/aspellpluginimpl.cpp b/Scribus/scribus/plugins/tools/spellcheck/aspellpluginimpl.cpp index cf1585b..3c83d8c 100644 --- a/Scribus/scribus/plugins/tools/spellcheck/aspellpluginimpl.cpp +++ b/Scribus/scribus/plugins/tools/spellcheck/aspellpluginimpl.cpp @@ -10,15 +10,15 @@ for which a new license (GPL+exception) is in place. #include "util.h" #include <QMessageBox> -const char* AspellPluginImpl::kDEF_CONTEXT = "AspellPlugin"; -const QString AspellPluginImpl::kDEF_ASPELL_ENTRY = +const char* SpellPluginImpl::kDEF_CONTEXT = "AspellPlugin"; +const QString SpellPluginImpl::kDEF_ASPELL_ENTRY = QString( "en" ) + Speller::Aspell::Suggest::kDICT_DELIM + QString( "en" ) + Speller::Aspell::Suggest::kDICT_DELIM + QString( "*" ) + Speller::Aspell::Suggest::kDICT_DELIM + QString( "60" ); // I.e., en/en/*/60 corresponding to default English dictionary // Initialize members here, if any -AspellPluginImpl::AspellPluginImpl(ScribusDoc* doc, QWidget* parent) : +SpellPluginImpl::SpellPluginImpl(ScribusDoc* doc, QWidget* parent) : QDialog( parent ), fdoc( doc ), m_docIsChanged(false), @@ -79,15 +79,15 @@ AspellPluginImpl::AspellPluginImpl(ScribusDoc* doc, QWidget* parent) : } catch( const std::invalid_argument& err ) { - QString warn = tr( "aspellplugin (AspellPluginImpl::" - "AspellPluginImpl): Error in aspell " + QString warn = tr( "aspellplugin (SpellPluginImpl::" + "SpellPluginImpl): Error in aspell " "speller configuration." ); qWarning( "%s", warn.toUtf8().data() ); } catch( const std::runtime_error& err ) { - QString warn = tr( "aspellplugin (AspellPluginImpl::" - "AspellPluginImpl): Error in creating " + QString warn = tr( "aspellplugin (SpellPluginImpl::" + "SpellPluginImpl): Error in creating " "aspell speller." ); qWarning( "%s", warn.toUtf8().data() ); } @@ -95,7 +95,7 @@ AspellPluginImpl::AspellPluginImpl(ScribusDoc* doc, QWidget* parent) : parseSelection(); } //__________________________________________________________________________ -AspellPluginImpl::~AspellPluginImpl() +SpellPluginImpl::~SpellPluginImpl() { // Destructor try @@ -104,14 +104,14 @@ AspellPluginImpl::~AspellPluginImpl() } catch( const std::runtime_error& err ) { - qWarning( "aspellplugin (AspellPluginImpl::~AspellPlugin" + qWarning( "aspellplugin (SpellPluginImpl::~SpellPlugin" "Impl): Error in saving aspell word lists." ); } delete fsuggest; } //__________________________________________________________________________ -void AspellPluginImpl::activateSpellGUI(bool active) +void SpellPluginImpl::activateSpellGUI(bool active) { // Activates spell-checking GUI elements in spell-checking // tab, i.e., everything except combo box at top @@ -129,7 +129,7 @@ void AspellPluginImpl::activateSpellGUI(bool active) flistDicts->setEnabled( active ); } //__________________________________________________________________________ -void AspellPluginImpl::nextWord() +void SpellPluginImpl::nextWord() { QChar ch; QString wordBoundaries = QString(" .,:;\"'!?\n"); @@ -164,7 +164,7 @@ void AspellPluginImpl::nextWord() fpos = pa; } //__________________________________________________________________________ -void AspellPluginImpl::checkText() +void SpellPluginImpl::checkText() { // Called from parseXXX(), after filling in the currently // relevant text into 'fcontent'. Handles spell-checking of @@ -228,7 +228,7 @@ void AspellPluginImpl::checkText() } } //__________________________________________________________________________ -void AspellPluginImpl::spellCheckDone() +void SpellPluginImpl::spellCheckDone() { // Called once all words in the current text, i.e., in 'fcontent' // have been spell-checked. Pops up an information dialog. @@ -250,14 +250,14 @@ void AspellPluginImpl::spellCheckDone() close(); } //__________________________________________________________________________ -void AspellPluginImpl::on_fcloseBtn_clicked() +void SpellPluginImpl::on_fcloseBtn_clicked() { // Called when the "Close" button is clicked. Makes any pending // replacements and closes the spell-checking window. spellCheckDone(); // Also closes spell-checking window. } //__________________________________________________________________________ -void AspellPluginImpl::on_fchangeBtn_clicked() +void SpellPluginImpl::on_fchangeBtn_clicked() { // Called when the "Change" button is clicked. Replaces the word // being spell-checked with the current word in text edit box. @@ -292,7 +292,7 @@ void AspellPluginImpl::on_fchangeBtn_clicked() checkText(); } //__________________________________________________________________________ -void AspellPluginImpl::on_fchangeAllBtn_clicked() +void SpellPluginImpl::on_fchangeAllBtn_clicked() { // Called when the "Change All" button is clicked. Replaces all // instances of the word being spell-checked with the current word in @@ -329,7 +329,7 @@ void AspellPluginImpl::on_fchangeAllBtn_clicked() checkText(); } //__________________________________________________________________________ -void AspellPluginImpl::on_fskipBtn_clicked() +void SpellPluginImpl::on_fskipBtn_clicked() { // Called when the "Skip" button is clicked. Skips the word currently // being spell-checked. @@ -338,7 +338,7 @@ void AspellPluginImpl::on_fskipBtn_clicked() checkText(); } //__________________________________________________________________________ -void AspellPluginImpl::on_fskipAllBtn_clicked() +void SpellPluginImpl::on_fskipAllBtn_clicked() { // Called when the "Skip All" button is clicked. Puts the word // currently being spell-checked into the list of words to be ignored @@ -355,7 +355,7 @@ void AspellPluginImpl::on_fskipAllBtn_clicked() { QString warn = - tr( "AspellPluginImpl::on_fskipAllBtn_clicked(): Unable " + tr( "SpellPluginImpl::on_fskipAllBtn_clicked(): Unable " "to skip all instances of \"" ) + fcontent + tr(" by adding it to the session list."); qWarning( "%s", warn.toUtf8().data() ); @@ -365,7 +365,7 @@ void AspellPluginImpl::on_fskipAllBtn_clicked() checkText(); } //__________________________________________________________________________ -void AspellPluginImpl::on_faddWordBtn_clicked() +void SpellPluginImpl::on_faddWordBtn_clicked() { // Called when the "Add word" button is clicked. Adds word to personal // word list. @@ -378,13 +378,13 @@ void AspellPluginImpl::on_faddWordBtn_clicked() catch( const std::runtime_error& err ) { QString warn = - tr( "AspellPluginImpl::on_faddWordBtn_clicked(): " + tr( "SpellPluginImpl::on_faddWordBtn_clicked(): " "Unable to add word to personal list." ); qWarning( "%s", warn.toUtf8().data() ); } } //__________________________________________________________________________ -void AspellPluginImpl::on_flistReplacements_itemActivated() +void SpellPluginImpl::on_flistReplacements_itemActivated() { // Called when an item in the list of replacements is // selected. Replaces current word in text edit box with the text @@ -392,7 +392,7 @@ void AspellPluginImpl::on_flistReplacements_itemActivated() fcurrWord->setText( flistReplacements->currentItem()->text() ); } -bool AspellPluginImpl::handleSpellConfig(const QString & dictFullName) +bool SpellPluginImpl::handleSpellConfig(const QString & dictFullName) { QString entry(dictFullName); QStringList fields = entry.split( Speller::Aspell::Suggest::kDICT_DELIM ); @@ -412,7 +412,7 @@ bool AspellPluginImpl::handleSpellConfig(const QString & dictFullName) return false; } //__________________________________________________________________________ -void AspellPluginImpl::on_flistDicts_activated() +void SpellPluginImpl::on_flistDicts_activated() { // Called when an item in the list of available aspell dictionaries is // selected, i.e., by double-clicking, or pressing enter. Resets @@ -436,7 +436,7 @@ void AspellPluginImpl::on_flistDicts_activated() } } //__________________________________________________________________________ -void AspellPluginImpl::getPreferences() +void SpellPluginImpl::getPreferences() { // Retrieves user preferences from saved settings. Defaults are // supplied @@ -449,7 +449,7 @@ void AspellPluginImpl::getPreferences() fentry = fprefs->get( "entry", "");//kDEF_ASPELL_ENTRY ); } //__________________________________________________________________________ -void AspellPluginImpl::setPreferences(const QString& lang, +void SpellPluginImpl::setPreferences(const QString& lang, const QString& jargon, const QString& encoding, const QString& entry) @@ -462,12 +462,12 @@ void AspellPluginImpl::setPreferences(const QString& lang, fprefs->set( "entry", entry ); } //__________________________________________________________________________ -void AspellPluginImpl::languageChange() +void SpellPluginImpl::languageChange() { - qWarning( "AspellPluginImpl::languageChange(): Not implemented yet" ); + qWarning( "SpellPluginImpl::languageChange(): Not implemented yet" ); } //__________________________________________________________________________ -void AspellPluginImpl::parseItem() +void SpellPluginImpl::parseItem() { // Parse text in a frame, and spell-check it. // Process only text frames @@ -478,7 +478,7 @@ void AspellPluginImpl::parseItem() } } //__________________________________________________________________________ -void AspellPluginImpl::parseSelection() +void SpellPluginImpl::parseSelection() { fcontent.truncate( 0 ); // Start with empty string uint ndocs = fdoc->m_Selection->count(); diff --git a/Scribus/scribus/plugins/tools/spellcheck/aspellpluginimpl.h b/Scribus/scribus/plugins/tools/spellcheck/aspellpluginimpl.h index 25a76bc..608ec10 100644 --- a/Scribus/scribus/plugins/tools/spellcheck/aspellpluginimpl.h +++ b/Scribus/scribus/plugins/tools/spellcheck/aspellpluginimpl.h @@ -27,11 +27,11 @@ for which a new license (GPL+exception) is in place. #include "suggest.h" // For aspell interface class /*! -\class AspellPluginImpl +\class SpellPluginImpl \author Gora Mohanty <gora@srijan.in> -\brief 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 +\brief Implementation of plugin. GUI part is derived from SpellPluginBase class, as aspellpluginbase.{cpp,h} get overwritten by uic. Interface to aspell uses Speller::Aspell::Suggest */ -class AspellPluginImpl : public QDialog, private Ui::AspellPluginBase +class SpellPluginImpl : public QDialog, private Ui::SpellPluginBase { Q_OBJECT private: @@ -170,14 +170,14 @@ public: \param parent: Parent window that this is a child of. \retval None */ - AspellPluginImpl(ScribusDoc* doc, QWidget* parent=NULL); + SpellPluginImpl(ScribusDoc* doc, QWidget* parent=NULL); /*! \author Gora Mohanty <gora@srijan.in> \brief Destructor for spell-checking plugin implementation. \param None \retval None */ - ~AspellPluginImpl(); + ~SpellPluginImpl(); /*! \brief Returns a error message for caller. It should disable the plugin then -- 1.7.2.3 From edf091ef8ea95fce9f0c0cb51a5f0bea457f84c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <dan@danny.cz> Date: Sun, 26 Sep 2010 12:19:06 +0200 Subject: [PATCH 02/12] rename plugin interface functions --- .../plugins/tools/spellcheck/aspellplugin.cpp | 6 +++--- .../plugins/tools/spellcheck/aspellplugin.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Scribus/scribus/plugins/tools/spellcheck/aspellplugin.cpp b/Scribus/scribus/plugins/tools/spellcheck/aspellplugin.cpp index 2eca171..67ed464 100644 --- a/Scribus/scribus/plugins/tools/spellcheck/aspellplugin.cpp +++ b/Scribus/scribus/plugins/tools/spellcheck/aspellplugin.cpp @@ -100,19 +100,19 @@ bool SpellPlugin::run(ScribusDoc* doc, QString target) } // Low level plugin API -int x_aspellplugin_getPluginAPIVersion() +int spellplugin_getPluginAPIVersion() { return PLUGIN_API_VERSION; } -ScPlugin* x_aspellplugin_getPlugin() +ScPlugin* spellplugin_getPlugin() { SpellPlugin* plug = new SpellPlugin(); Q_CHECK_PTR(plug); return plug; } -void x_aspellplugin_freePlugin(ScPlugin* plugin) +void spellplugin_freePlugin(ScPlugin* plugin) { SpellPlugin* plug = dynamic_cast<SpellPlugin*>(plugin); Q_ASSERT(plug); diff --git a/Scribus/scribus/plugins/tools/spellcheck/aspellplugin.h b/Scribus/scribus/plugins/tools/spellcheck/aspellplugin.h index bbfbf7c..b773f81 100644 --- a/Scribus/scribus/plugins/tools/spellcheck/aspellplugin.h +++ b/Scribus/scribus/plugins/tools/spellcheck/aspellplugin.h @@ -33,8 +33,8 @@ class PLUGIN_API SpellPlugin : public ScActionPlugin // Special features (none) }; -extern "C" PLUGIN_API int x_aspellplugin_getPluginAPIVersion(); -extern "C" PLUGIN_API ScPlugin* x_aspellplugin_getPlugin(); -extern "C" PLUGIN_API void x_aspellplugin_freePlugin(ScPlugin* plugin); +extern "C" PLUGIN_API int spellplugin_getPluginAPIVersion(); +extern "C" PLUGIN_API ScPlugin* spellplugin_getPlugin(); +extern "C" PLUGIN_API void spellplugin_freePlugin(ScPlugin* plugin); #endif -- 1.7.2.3 From 8308ee6b2929719268e240ec484d0419f7fb57f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <dan@danny.cz> Date: Mon, 27 Sep 2010 10:16:28 +0200 Subject: [PATCH 03/12] add cmake module for enchant --- Scribus/cmake/modules/FindENCHANT.cmake | 44 +++++++++++++++++++++++++++++++ 1 files changed, 44 insertions(+), 0 deletions(-) create mode 100644 Scribus/cmake/modules/FindENCHANT.cmake diff --git a/Scribus/cmake/modules/FindENCHANT.cmake b/Scribus/cmake/modules/FindENCHANT.cmake new file mode 100644 index 0000000..0b30f32 --- /dev/null +++ b/Scribus/cmake/modules/FindENCHANT.cmake @@ -0,0 +1,44 @@ +# - Try to find the Enchant spell checker +# Once done this will define +# +# ENCHANT_FOUND - system has ENCHANT +# ENCHANT_INCLUDE_DIR - the ENCHANT include directory +# ENCHANT_LIBRARIES - Link these to use ENCHANT +# ENCHANT_DEFINITIONS - Compiler switches required for using ENCHANT + +# Copyright (c) 2006, Zack Rusin, <zack@kde.org> +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + + +if (ENCHANT_INCLUDE_DIR AND ENCHANT_LIBRARIES) + + # in cache already + set(ENCHANT_FOUND TRUE) + +else (ENCHANT_INCLUDE_DIR AND ENCHANT_LIBRARIES) + if (NOT WIN32) + # use pkg-config to get the directories and then use these values + # in the FIND_PATH() and FIND_LIBRARY() calls + find_package(PkgConfig) + pkg_check_modules(PC_ENCHANT enchant) + set(ENCHANT_DEFINITIONS ${PC_ENCHANT_CFLAGS_OTHER}) + endif (NOT WIN32) + + find_path(ENCHANT_INCLUDE_DIR + NAMES enchant++.h + HINTS ${PC_ENCHANT_INCLUDEDIR} + ${PC_ENCHANT_INCLUDE_DIRS} + PATH_SUFFIXES enchant ) + + find_library(ENCHANT_LIBRARIES NAMES enchant + HINTS ${PC_ENCHANT_LIBDIR} + ${PC_ENCHANT_LIBRARY_DIRS} ) + + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(ENCHANT DEFAULT_MSG ENCHANT_INCLUDE_DIR ENCHANT_LIBRARIES ) + + mark_as_advanced(ENCHANT_INCLUDE_DIR ENCHANT_LIBRARIES) + +endif (ENCHANT_INCLUDE_DIR AND ENCHANT_LIBRARIES) -- 1.7.2.3 From 78688766344c38ffd1fe09b2532ad659fdaee21a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <dan@danny.cz> Date: Mon, 27 Sep 2010 10:17:27 +0200 Subject: [PATCH 04/12] add check for enchant --- Scribus/CMakeLists.txt | 28 ++++++++++++++++++++-------- 1 files changed, 20 insertions(+), 8 deletions(-) diff --git a/Scribus/CMakeLists.txt b/Scribus/CMakeLists.txt index 2cb5c74..570a038 100644 --- a/Scribus/CMakeLists.txt +++ b/Scribus/CMakeLists.txt @@ -657,19 +657,31 @@ ELSE(NOT WIN32) ENDIF(NOT WIN32) #>>FontConfig -#<<ASPELL for Speelling support -OPTION(WITH_ASPELL "Enable support for spell checking" ON) -IF (WITH_ASPELL) +#<<ENCHANT for Spelling support +IF (WANT_ENCHANT) + SET(ENCHANT_DIR ${CMAKE_MODULE_PATH}) + FIND_PACKAGE(ENCHANT) +ELSEIF (WANT_ENCHANT) + SET (ENCHANT_FOUND FALSE CACHE TYPE BOOL) + SET (HAVE_ENCHANT FALSE CACHE TYPE BOOL) +ENDIF (WANT_ENCHANT) + +IF (ENCHANT_FOUND) + MESSAGE("Enchant Found OK") + SET(HAVE_ENCHANT 1) +ELSE(ENCHANT_FOUND) + MESSAGE("Enchant or its developer libraries NOT found - Trying aspell instead") + #<<ASPELL for Spelling support FIND_PACKAGE(ASPELL) IF (ASPELL_FOUND) MESSAGE("ASpell Found OK") SET(HAVE_ASPELL 1) - ELSE (ASPELL_FOUND) + ELSE(ASPELL_FOUND) MESSAGE("ASpell or its developer libraries NOT found - Disabling support for spell checking") - ENDIF (ASPELL_FOUND) -ENDIF (WITH_ASPELL) -#>>ASPELL for Speelling support - + ENDIF(ASPELL_FOUND) + #>>ASPELL for Spelling support +ENDIF(ENCHANT_FOUND) +#>>ENCHANT for Spelling support #<<PoDoFo for AI PDF import OPTION(WITH_PODOFO "Enable support for PDF embedded in AI" ON) -- 1.7.2.3 From d565ddea6c3f3c5fe9046dad6c1aaad6947be4d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <dan@danny.cz> Date: Mon, 27 Sep 2010 10:39:52 +0200 Subject: [PATCH 05/12] build the spellcheck plugin when enchant or aspell is found --- Scribus/scribus/plugins/tools/CMakeLists.txt | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Scribus/scribus/plugins/tools/CMakeLists.txt b/Scribus/scribus/plugins/tools/CMakeLists.txt index 16805ec..f82644b 100644 --- a/Scribus/scribus/plugins/tools/CMakeLists.txt +++ b/Scribus/scribus/plugins/tools/CMakeLists.txt @@ -6,7 +6,7 @@ ADD_SUBDIRECTORY(pathcut) ADD_SUBDIRECTORY(pathfinder) ADD_SUBDIRECTORY(pathstroker) ADD_SUBDIRECTORY(subdivide) -if (HAVE_ASPELL) +if (HAVE_ENCHANT OR HAVE_ASPELL) ADD_SUBDIRECTORY(spellcheck) -endif (HAVE_ASPELL) +endif (HAVE_ENCHANT OR HAVE_ASPELL) ADD_SUBDIRECTORY(transform) -- 1.7.2.3 From 7e2474b44c58226600e785a7ab7987830be5984a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <dan@danny.cz> Date: Mon, 27 Sep 2010 11:24:26 +0200 Subject: [PATCH 06/12] rename variables from ASPELL_PLUGIN* to SPELL_PLUGIN* in CMakeLists.txt --- .../plugins/tools/spellcheck/CMakeLists.txt | 28 ++++++++++---------- 1 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Scribus/scribus/plugins/tools/spellcheck/CMakeLists.txt b/Scribus/scribus/plugins/tools/spellcheck/CMakeLists.txt index 90f86a5..118359d 100644 --- a/Scribus/scribus/plugins/tools/spellcheck/CMakeLists.txt +++ b/Scribus/scribus/plugins/tools/spellcheck/CMakeLists.txt @@ -5,18 +5,18 @@ IF (ASPELL_FOUND) ${ASPELL_INCLUDE_DIR} ) - SET(ASPELL_PLUGIN_UI_SRC + SET(SPELL_PLUGIN_UI_SRC aspellpluginbase.ui # donedlgbase.ui ) - SET(ASPELL_PLUGIN_MOC_CLASSES + SET(SPELL_PLUGIN_MOC_CLASSES aspellplugin.h aspellpluginimpl.h # donedlgimpl.h ) - SET(ASPELL_PLUGIN_SOURCES + SET(SPELL_PLUGIN_SOURCES aspellplugin.cpp aspellpluginimpl.cpp # donedlgimpl.cpp @@ -32,27 +32,27 @@ IF (APPLEBUNDLE) # INSTALL(CODE "FILE(MAKE_DIRECTORY ${ENV}${CMAKE_INSTALL_PREFIX}/${ASPELLRELATIVEDICTDIR})") ENDIF (APPLEBUNDLE) - SET(SCRIBUS_ASPELL_PLUGIN "x_aspellplugin") + SET(SCRIBUS_SPELL_PLUGIN "spellplugin") - QT4_WRAP_UI(ASPELL_PLUGIN_UI_SOURCES ${ASPELL_PLUGIN_UI_SRC} ) - QT4_WRAP_CPP(ASPELL_PLUGIN_MOC_SOURCES ${ASPELL_PLUGIN_MOC_CLASSES}) + QT4_WRAP_UI(SPELL_PLUGIN_UI_SOURCES ${SPELL_PLUGIN_UI_SRC} ) + QT4_WRAP_CPP(SPELL_PLUGIN_MOC_SOURCES ${SPELL_PLUGIN_MOC_CLASSES}) - ADD_LIBRARY(${SCRIBUS_ASPELL_PLUGIN} MODULE - ${ASPELL_PLUGIN_SOURCES} - ${ASPELL_PLUGIN_MOC_SOURCES} - ${ASPELL_PLUGIN_UI_SOURCES} + ADD_LIBRARY(${SCRIBUS_SPELL_PLUGIN} MODULE + ${SPELL_PLUGIN_SOURCES} + ${SPELL_PLUGIN_MOC_SOURCES} + ${SPELL_PLUGIN_UI_SOURCES} ) - TARGET_LINK_LIBRARIES(${SCRIBUS_ASPELL_PLUGIN} ${ASPELL_LIBRARIES} ${PLUGIN_LIBRARIES}) + TARGET_LINK_LIBRARIES(${SCRIBUS_SPELL_PLUGIN} ${ASPELL_LIBRARIES} ${PLUGIN_LIBRARIES}) - INSTALL(TARGETS ${SCRIBUS_ASPELL_PLUGIN} + INSTALL(TARGETS ${SCRIBUS_SPELL_PLUGIN} LIBRARY DESTINATION ${PLUGINDIR} PERMISSIONS ${PLUGIN_PERMISSIONS} ) - ADD_DEPENDENCIES(${SCRIBUS_ASPELL_PLUGIN} ${EXE_NAME}) + ADD_DEPENDENCIES(${SCRIBUS_SPELL_PLUGIN} ${EXE_NAME}) -# SET_TARGET_PROPERTIES(${SCRIBUS_ASPELL_PLUGIN} PROPERTIES VERSION "0.0.1") +# SET_TARGET_PROPERTIES(${SCRIBUS_SPELL_PLUGIN} PROPERTIES VERSION "0.0.1") ENDIF (ASPELL_FOUND) -- 1.7.2.3 From f7f71f7c027d15bec8d9676ae2464311e9f6bb99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <dan@danny.cz> Date: Mon, 27 Sep 2010 11:28:22 +0200 Subject: [PATCH 07/12] add enchant support into spellcheck/CMakeLists.txt The majority of CMakeLists.txt is common to both and it differs only in the include paths and linked libraries that are specific to each spellchecker.. --- .../plugins/tools/spellcheck/CMakeLists.txt | 24 ++++++++++++++++--- 1 files changed, 20 insertions(+), 4 deletions(-) diff --git a/Scribus/scribus/plugins/tools/spellcheck/CMakeLists.txt b/Scribus/scribus/plugins/tools/spellcheck/CMakeLists.txt index 118359d..cd6d442 100644 --- a/Scribus/scribus/plugins/tools/spellcheck/CMakeLists.txt +++ b/Scribus/scribus/plugins/tools/spellcheck/CMakeLists.txt @@ -1,8 +1,6 @@ -IF (ASPELL_FOUND) INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/scribus - ${ASPELL_INCLUDE_DIR} ) SET(SPELL_PLUGIN_UI_SRC @@ -43,7 +41,7 @@ ENDIF (APPLEBUNDLE) ${SPELL_PLUGIN_UI_SOURCES} ) - TARGET_LINK_LIBRARIES(${SCRIBUS_SPELL_PLUGIN} ${ASPELL_LIBRARIES} ${PLUGIN_LIBRARIES}) + TARGET_LINK_LIBRARIES(${SCRIBUS_SPELL_PLUGIN} ${PLUGIN_LIBRARIES}) INSTALL(TARGETS ${SCRIBUS_SPELL_PLUGIN} LIBRARY @@ -54,5 +52,23 @@ ENDIF (APPLEBUNDLE) ADD_DEPENDENCIES(${SCRIBUS_SPELL_PLUGIN} ${EXE_NAME}) # SET_TARGET_PROPERTIES(${SCRIBUS_SPELL_PLUGIN} PROPERTIES VERSION "0.0.1") -ENDIF (ASPELL_FOUND) +IF (ENCHANT_FOUND) + INCLUDE_DIRECTORIES( + ${ENCHANT_INCLUDE_DIR} + ) + + TARGET_LINK_LIBRARIES(${SCRIBUS_SPELL_PLUGIN} ${ENCHANT_LIBRARIES}) + + ADD_DEFINITIONS("-DUSE_ENCHANT") + +ELSEIF (ASPELL_FOUND) + INCLUDE_DIRECTORIES( + ${ASPELL_INCLUDE_DIR} + ) + + TARGET_LINK_LIBRARIES(${SCRIBUS_SPELL_PLUGIN} ${ASPELL_LIBRARIES}) + + ADD_DEFINITIONS("-DUSE_ASPELL") + +ENDIF () -- 1.7.2.3 From 071874e70199c22f5a601909780fdedbd9a83ad7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <dan@danny.cz> Date: Mon, 27 Sep 2010 12:00:51 +0200 Subject: [PATCH 08/12] rename the Aspell namespace to Spell --- .../plugins/tools/spellcheck/aspellpluginimpl.cpp | 26 ++++---- .../plugins/tools/spellcheck/aspellpluginimpl.h | 6 +- .../scribus/plugins/tools/spellcheck/suggest.cpp | 74 ++++++++++---------- Scribus/scribus/plugins/tools/spellcheck/suggest.h | 6 +- 4 files changed, 56 insertions(+), 56 deletions(-) diff --git a/Scribus/scribus/plugins/tools/spellcheck/aspellpluginimpl.cpp b/Scribus/scribus/plugins/tools/spellcheck/aspellpluginimpl.cpp index 3c83d8c..1d2cc95 100644 --- a/Scribus/scribus/plugins/tools/spellcheck/aspellpluginimpl.cpp +++ b/Scribus/scribus/plugins/tools/spellcheck/aspellpluginimpl.cpp @@ -12,9 +12,9 @@ for which a new license (GPL+exception) is in place. const char* SpellPluginImpl::kDEF_CONTEXT = "AspellPlugin"; const QString SpellPluginImpl::kDEF_ASPELL_ENTRY = - QString( "en" ) + Speller::Aspell::Suggest::kDICT_DELIM + - QString( "en" ) + Speller::Aspell::Suggest::kDICT_DELIM + - QString( "*" ) + Speller::Aspell::Suggest::kDICT_DELIM + + QString( "en" ) + Speller::Spell::Suggest::kDICT_DELIM + + QString( "en" ) + Speller::Spell::Suggest::kDICT_DELIM + + QString( "*" ) + Speller::Spell::Suggest::kDICT_DELIM + QString( "60" ); // I.e., en/en/*/60 corresponding to default English dictionary // Initialize members here, if any @@ -44,7 +44,7 @@ SpellPluginImpl::SpellPluginImpl(ScribusDoc* doc, QWidget* parent) : // Create speller, and get list of available aspell // dictionaries. - fsuggest = new Speller::Aspell::Suggest( flang.toUtf8().data(), fjargon.toUtf8().data(), fencoding.toUtf8().data() ); + fsuggest = new Speller::Spell::Suggest( flang.toUtf8().data(), fjargon.toUtf8().data(), fencoding.toUtf8().data() ); Q_CHECK_PTR( fsuggest ); // Get list of available aspell dictionaries @@ -395,18 +395,18 @@ void SpellPluginImpl::on_flistReplacements_itemActivated() bool SpellPluginImpl::handleSpellConfig(const QString & dictFullName) { QString entry(dictFullName); - QStringList fields = entry.split( Speller::Aspell::Suggest::kDICT_DELIM ); + QStringList fields = entry.split( Speller::Spell::Suggest::kDICT_DELIM ); // Ensure that we have at least the right no.of fields. if( fields.size() == 4 ) { QString value = - fields[0] + Speller::Aspell::Suggest::kDICT_DELIM + - fields[1] + Speller::Aspell::Suggest::kDICT_DELIM + - fields[2] + Speller::Aspell::Suggest::kDICT_DELIM + + fields[0] + Speller::Spell::Suggest::kDICT_DELIM + + fields[1] + Speller::Spell::Suggest::kDICT_DELIM + + fields[2] + Speller::Spell::Suggest::kDICT_DELIM + fields[3]; fsuggest->resetConfig( fields[1].toAscii().data(), fields[2].toAscii().data() ); // FIXME: Handle encodings other than UTF-8. - setPreferences( fields[1], fields[2], Speller::Aspell::Suggest::kDEF_ENCODING, value ); + setPreferences( fields[1], fields[2], Speller::Spell::Suggest::kDEF_ENCODING, value ); return true; } return false; @@ -440,10 +440,10 @@ void SpellPluginImpl::getPreferences() { // Retrieves user preferences from saved settings. Defaults are // supplied - flang = fprefs->get( "lang", Speller::Aspell::Suggest::kDEF_LANG ); - fjargon = fprefs->get( "jargon", Speller::Aspell::Suggest::kDEF_JARGON ); + flang = fprefs->get( "lang", Speller::Spell::Suggest::kDEF_LANG ); + fjargon = fprefs->get( "jargon", Speller::Spell::Suggest::kDEF_JARGON ); // FIXME: Handle encodings other than UTF-8. - fencoding = fprefs->get( "encoding", Speller::Aspell::Suggest::kDEF_ENCODING ); + fencoding = fprefs->get( "encoding", Speller::Spell::Suggest::kDEF_ENCODING ); // Don't use kDEF_ASPELL_ENTRY here. It's checked // against system locale later when there is no preferences for it. fentry = fprefs->get( "entry", "");//kDEF_ASPELL_ENTRY ); @@ -456,7 +456,7 @@ void SpellPluginImpl::setPreferences(const QString& lang, { // Saves user preferences using Scribus preferences manager. fprefs->set( "lang", lang ); - QString val = jargon == Speller::Aspell::Suggest::kEMPTY ? "" : jargon; + QString val = jargon == Speller::Spell::Suggest::kEMPTY ? "" : jargon; fprefs->set( "jargon", val ); fprefs->set( "encoding", encoding ); fprefs->set( "entry", entry ); diff --git a/Scribus/scribus/plugins/tools/spellcheck/aspellpluginimpl.h b/Scribus/scribus/plugins/tools/spellcheck/aspellpluginimpl.h index 608ec10..5afa343 100644 --- a/Scribus/scribus/plugins/tools/spellcheck/aspellpluginimpl.h +++ b/Scribus/scribus/plugins/tools/spellcheck/aspellpluginimpl.h @@ -29,7 +29,7 @@ for which a new license (GPL+exception) is in place. /*! \class SpellPluginImpl \author Gora Mohanty <gora@srijan.in> -\brief Implementation of plugin. GUI part is derived from SpellPluginBase class, as aspellpluginbase.{cpp,h} get overwritten by uic. Interface to aspell uses Speller::Aspell::Suggest +\brief Implementation of plugin. GUI part is derived from SpellPluginBase class, as aspellpluginbase.{cpp,h} get overwritten by uic. Interface to aspell uses Speller::Spell::Suggest */ class SpellPluginImpl : public QDialog, private Ui::SpellPluginBase { @@ -40,7 +40,7 @@ private: /*! Formatted string for aspell dictionary entry: Form of <name>--<lang>--<jargon>--<size> */ static const QString kDEF_ASPELL_ENTRY; /*! \brief Aspell interface object. */ - Speller::Aspell::Suggest* fsuggest; + Speller::Spell::Suggest* fsuggest; /*! \brief Scribus preferences object. */ PrefsContext* fprefs; /*! \brief Language for aspell dictionary. */ @@ -117,7 +117,7 @@ protected: */ void setPreferences(const QString& lang, const QString& jargon, - const QString& encoding=Speller::Aspell::Suggest::kDEF_ENCODING, + const QString& encoding=Speller::Spell::Suggest::kDEF_ENCODING, const QString& entry=kDEF_ASPELL_ENTRY); /*! \author Gora Mohanty <gora@srijan.in> diff --git a/Scribus/scribus/plugins/tools/spellcheck/suggest.cpp b/Scribus/scribus/plugins/tools/spellcheck/suggest.cpp index d0dd1aa..53273af 100644 --- a/Scribus/scribus/plugins/tools/spellcheck/suggest.cpp +++ b/Scribus/scribus/plugins/tools/spellcheck/suggest.cpp @@ -11,38 +11,38 @@ /*! \brief Delimiter between different components of formatted strings for aspell dictionary entries. */ -const char* Speller::Aspell::Suggest::kDICT_DELIM = "/"; -const char* Speller::Aspell::Suggest::kEMPTY = "*"; -const char* Speller::Aspell::Suggest::kDEF_LANG = "en"; -const char* Speller::Aspell::Suggest::kDEF_JARGON = ""; // I.e., no jargon -const char* Speller::Aspell::Suggest::kDEF_ENCODING = "utf-8"; +const char* Speller::Spell::Suggest::kDICT_DELIM = "/"; +const char* Speller::Spell::Suggest::kEMPTY = "*"; +const char* Speller::Spell::Suggest::kDEF_LANG = "en"; +const char* Speller::Spell::Suggest::kDEF_JARGON = ""; // I.e., no jargon +const char* Speller::Spell::Suggest::kDEF_ENCODING = "utf-8"; -void Speller::Aspell::Suggest::checkError() throw( std::runtime_error ) +void Speller::Spell::Suggest::checkError() throw( std::runtime_error ) { if( aspell_speller_error_number( fspeller ) != 0 ) { std::string err_msg = - std::string( "(Aspell::Speller::Suggest::checkError): " + std::string( "(Spell::Speller::Suggest::checkError): " "aspell speller error " ) + aspell_speller_error_message( fspeller ); throw std::runtime_error( err_msg ); } } //__________________________________________________________________________ -void Speller::Aspell::Suggest::checkConfigError() +void Speller::Spell::Suggest::checkConfigError() throw( std::runtime_error ) { if( aspell_config_error_number( fconfig ) != 0 ) { std::string err_msg = - std::string( "(Aspell::Speller::Suggest::checkConfig" + std::string( "(Spell::Speller::Suggest::checkConfig" "Error): aspell speller error " ) + aspell_config_error_message( fconfig ); throw std::runtime_error( err_msg ); } } //__________________________________________________________________________ -void Speller::Aspell::Suggest::init(const std::string& lang, +void Speller::Spell::Suggest::init(const std::string& lang, const std::string& jargon, const std::string& encoding) throw( std::invalid_argument, std::runtime_error ) @@ -67,7 +67,7 @@ void Speller::Aspell::Suggest::init(const std::string& lang, if( aspell_error_number( ret ) != 0 ) { delete_aspell_can_have_error( ret ); - throw std::runtime_error( "(Aspell::Speller::Suggest::init" + throw std::runtime_error( "(Spell::Speller::Suggest::init" "): Error in creating speller." ); } else @@ -77,7 +77,7 @@ void Speller::Aspell::Suggest::init(const std::string& lang, } } //__________________________________________________________________________ -void Speller::Aspell::Suggest::listDicts(std::vector<AspellDictInfo>& vals) +void Speller::Spell::Suggest::listDicts(std::vector<AspellDictInfo>& vals) { AspellDictInfoList* dlist = get_aspell_dict_info_list( fconfig ); AspellDictInfoEnumeration* dinfo_enum = @@ -90,7 +90,7 @@ void Speller::Aspell::Suggest::listDicts(std::vector<AspellDictInfo>& vals) delete_aspell_dict_info_enumeration( dinfo_enum ); } //__________________________________________________________________________ -void Speller::Aspell::Suggest::listDicts(std::vector<std::string>& vals) +void Speller::Spell::Suggest::listDicts(std::vector<std::string>& vals) { std::vector<AspellDictInfo> entries; listDicts( entries ); @@ -108,7 +108,7 @@ void Speller::Aspell::Suggest::listDicts(std::vector<std::string>& vals) } //__________________________________________________________________________ void -Speller::Aspell::Suggest::printWordList(const AspellWordList* wlist, +Speller::Spell::Suggest::printWordList(const AspellWordList* wlist, char delim) throw( std::invalid_argument ) { @@ -129,7 +129,7 @@ Speller::Aspell::Suggest::printWordList(const AspellWordList* wlist, delete_aspell_string_enumeration( enum_list ); } //__________________________________________________________________________ -void Speller::Aspell::Suggest::setConfig() throw( std::invalid_argument ) +void Speller::Spell::Suggest::setConfig() throw( std::invalid_argument ) { try { @@ -150,7 +150,7 @@ void Speller::Aspell::Suggest::setConfig() throw( std::invalid_argument ) } //__________________________________________________________________________ void -Speller::Aspell::Suggest::storeWordList(const AspellWordList* wlist, +Speller::Spell::Suggest::storeWordList(const AspellWordList* wlist, std::vector<std::string>& replacement) throw( std::invalid_argument ) { @@ -171,7 +171,7 @@ Speller::Aspell::Suggest::storeWordList(const AspellWordList* wlist, delete_aspell_string_enumeration( enum_list ); } //__________________________________________________________________________ -Speller::Aspell::Suggest::Suggest(const std::string& lang, +Speller::Spell::Suggest::Suggest(const std::string& lang, const std::string& jargon, const std::string& encoding) throw( std::invalid_argument, std::runtime_error ) @@ -191,7 +191,7 @@ Speller::Aspell::Suggest::Suggest(const std::string& lang, } } //__________________________________________________________________________ -Speller::Aspell::Suggest::Suggest(const AspellDictInfo* dinfo, +Speller::Spell::Suggest::Suggest(const AspellDictInfo* dinfo, const std::string& encoding) throw( std::invalid_argument, std::runtime_error ) { @@ -209,7 +209,7 @@ Speller::Aspell::Suggest::Suggest(const AspellDictInfo* dinfo, } } //__________________________________________________________________________ -void Speller::Aspell::Suggest::addPersonalList(const std::string& word) +void Speller::Spell::Suggest::addPersonalList(const std::string& word) throw( std::runtime_error ) { // A std::runtime_error exception is thrown if @@ -228,7 +228,7 @@ void Speller::Aspell::Suggest::addPersonalList(const std::string& word) } } //__________________________________________________________________________ -bool Speller::Aspell::Suggest::checkWord(const std::string& word) +bool Speller::Spell::Suggest::checkWord(const std::string& word) { bool status = true; @@ -239,7 +239,7 @@ bool Speller::Aspell::Suggest::checkWord(const std::string& word) return status; } //__________________________________________________________________________ -bool Speller::Aspell::Suggest::checkWord(const std::string& word, +bool Speller::Spell::Suggest::checkWord(const std::string& word, std::vector<std::string>& replacement, bool always) throw( std::invalid_argument ) @@ -285,7 +285,7 @@ bool Speller::Aspell::Suggest::checkWord(const std::string& word, return status; } //__________________________________________________________________________ -void Speller::Aspell::Suggest::clearSessionList() throw( std::runtime_error ) +void Speller::Spell::Suggest::clearSessionList() throw( std::runtime_error ) { aspell_speller_clear_session( fspeller ); try @@ -298,12 +298,12 @@ void Speller::Aspell::Suggest::clearSessionList() throw( std::runtime_error ) } } //__________________________________________________________________________ -std::string Speller::Aspell::Suggest::getConfigOpt(const std::string& opt) +std::string Speller::Spell::Suggest::getConfigOpt(const std::string& opt) { return std::string( aspell_config_retrieve( fconfig, opt.c_str() ) ); } //__________________________________________________________________________ -void Speller::Aspell::Suggest::getConfigOpt(const std::string& opt, +void Speller::Spell::Suggest::getConfigOpt(const std::string& opt, std::vector<std::string>& vals) { // Stores current setting of configuration option, 'opt', which @@ -323,7 +323,7 @@ void Speller::Aspell::Suggest::getConfigOpt(const std::string& opt, delete_aspell_string_list( list ); } //__________________________________________________________________________ -void Speller::Aspell::Suggest::ignoreWord(const std::string& word) +void Speller::Spell::Suggest::ignoreWord(const std::string& word) throw( std::runtime_error ) { // FIXME: Return value should be something meaningful from @@ -339,7 +339,7 @@ void Speller::Aspell::Suggest::ignoreWord(const std::string& word) } } //__________________________________________________________________________ -void Speller::Aspell::Suggest::printMainList() throw( std::invalid_argument ) +void Speller::Spell::Suggest::printMainList() throw( std::invalid_argument ) { const AspellWordList* wlist = aspell_speller_main_word_list( fspeller ); @@ -353,7 +353,7 @@ void Speller::Aspell::Suggest::printMainList() throw( std::invalid_argument ) } } //__________________________________________________________________________ -void Speller::Aspell::Suggest::printPersonalList() +void Speller::Spell::Suggest::printPersonalList() throw( std::invalid_argument ) { const AspellWordList* wlist = @@ -368,7 +368,7 @@ void Speller::Aspell::Suggest::printPersonalList() } } //__________________________________________________________________________ -void Speller::Aspell::Suggest::printSessionList() +void Speller::Spell::Suggest::printSessionList() throw( std::invalid_argument ) { const AspellWordList* wlist = @@ -383,7 +383,7 @@ void Speller::Aspell::Suggest::printSessionList() } } //__________________________________________________________________________ -bool Speller::Aspell::Suggest::printSuggestions(const std::string& word, +bool Speller::Spell::Suggest::printSuggestions(const std::string& word, bool always) throw( std::invalid_argument ) { @@ -427,7 +427,7 @@ bool Speller::Aspell::Suggest::printSuggestions(const std::string& word, return status; } //__________________________________________________________________________ -void Speller::Aspell::Suggest::resetConfig() +void Speller::Spell::Suggest::resetConfig() throw( std::invalid_argument, std::runtime_error ) { delete_aspell_config( fconfig ); @@ -445,7 +445,7 @@ void Speller::Aspell::Suggest::resetConfig() if( aspell_error_number( ret ) != 0 ) { delete_aspell_can_have_error( ret ); - throw std::runtime_error( "(Aspell::Speller::Suggest::Reset" + throw std::runtime_error( "(Spell::Speller::Suggest::Reset" "Config): Error in creating " "speller." ); } @@ -459,7 +459,7 @@ void Speller::Aspell::Suggest::resetConfig() } } //__________________________________________________________________________ -void Speller::Aspell::Suggest::resetConfig(const std::string& lang, +void Speller::Spell::Suggest::resetConfig(const std::string& lang, const std::string& jargon, const std::string& encoding) throw( std::invalid_argument, std::runtime_error ) @@ -483,7 +483,7 @@ void Speller::Aspell::Suggest::resetConfig(const std::string& lang, } } //__________________________________________________________________________ -void Speller::Aspell::Suggest::saveLists() throw( std::runtime_error ) +void Speller::Spell::Suggest::saveLists() throw( std::runtime_error ) { // Saves all word lists. aspell_speller_save_all_word_lists( fspeller ); @@ -497,7 +497,7 @@ void Speller::Aspell::Suggest::saveLists() throw( std::runtime_error ) } } //__________________________________________________________________________ -void Speller::Aspell::Suggest::setConfigOpt(const std::string& opt, +void Speller::Spell::Suggest::setConfigOpt(const std::string& opt, const std::string& val) throw( std::invalid_argument ) { @@ -513,7 +513,7 @@ void Speller::Aspell::Suggest::setConfigOpt(const std::string& opt, } //__________________________________________________________________________ void -Speller::Aspell::Suggest::StoreMainList(std::vector<std::string>& replacement) +Speller::Spell::Suggest::StoreMainList(std::vector<std::string>& replacement) throw( std::invalid_argument ) { const AspellWordList* wlist = @@ -528,7 +528,7 @@ Speller::Aspell::Suggest::StoreMainList(std::vector<std::string>& replacement) } } //__________________________________________________________________________ -void Speller::Aspell::Suggest::StorePersonalList(std::vector<std::string>& replacement) throw( std::invalid_argument ) +void Speller::Spell::Suggest::StorePersonalList(std::vector<std::string>& replacement) throw( std::invalid_argument ) { // Stores personal word list. A std::invalid_argument // exception is thrown in case of error. @@ -544,7 +544,7 @@ void Speller::Aspell::Suggest::StorePersonalList(std::vector<std::string>& repla } } //__________________________________________________________________________ -void Speller::Aspell::Suggest::StoreSessionList(std::vector<std::string>& replacement) throw( std::invalid_argument ) +void Speller::Spell::Suggest::StoreSessionList(std::vector<std::string>& replacement) throw( std::invalid_argument ) { // Stores session word list. A std::invalid_argument exception // is thrown in case of error. diff --git a/Scribus/scribus/plugins/tools/spellcheck/suggest.h b/Scribus/scribus/plugins/tools/spellcheck/suggest.h index 6683cfc..2c740cf 100644 --- a/Scribus/scribus/plugins/tools/spellcheck/suggest.h +++ b/Scribus/scribus/plugins/tools/spellcheck/suggest.h @@ -21,9 +21,9 @@ \brief Nested namespaces to allow different interfaces to different spell-checking engines. */ namespace Speller { - namespace Aspell { + namespace Spell { /*! -\class Speller::Aspell::Suggest +\class Speller::Spell::Suggest \author Gora Mohanty <gora@srijan.in> \brief Class for interfacing with aspell. Should work with any aspell version from 0.60 onwards @@ -322,7 +322,7 @@ from 0.60 onwards void StoreSessionList(std::vector<std::string>& replacement) throw( std::invalid_argument ); }; // class Suggest - } // namespace Aspell + } // namespace Spell } // namespace Speller #endif // #ifndef SUGGEST_H //@@@@@@@@@@@@@@@@@@@@@@@@@ END OF FILE @@@@@@@@@@@@@@@@@@@@@@@@@ -- 1.7.2.3 From 03c83f3e3631773db4c7df26bd86cef7ed9a5f04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <dan@danny.cz> Date: Mon, 27 Sep 2010 13:08:42 +0200 Subject: [PATCH 09/12] use SPELL_CHECKER_STR or "speller" instead of "aspell" --- .../plugins/tools/spellcheck/CMakeLists.txt | 4 +- .../plugins/tools/spellcheck/aspellplugin.cpp | 6 ++-- .../plugins/tools/spellcheck/aspellpluginimpl.cpp | 26 ++++++++++---------- .../scribus/plugins/tools/spellcheck/suggest.cpp | 4 +- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/Scribus/scribus/plugins/tools/spellcheck/CMakeLists.txt b/Scribus/scribus/plugins/tools/spellcheck/CMakeLists.txt index cd6d442..2e131be 100644 --- a/Scribus/scribus/plugins/tools/spellcheck/CMakeLists.txt +++ b/Scribus/scribus/plugins/tools/spellcheck/CMakeLists.txt @@ -60,7 +60,7 @@ IF (ENCHANT_FOUND) TARGET_LINK_LIBRARIES(${SCRIBUS_SPELL_PLUGIN} ${ENCHANT_LIBRARIES}) - ADD_DEFINITIONS("-DUSE_ENCHANT") + ADD_DEFINITIONS("-DUSE_ENCHANT -DSPELL_CHECKER_STR=\\\"enchant\\\"") ELSEIF (ASPELL_FOUND) INCLUDE_DIRECTORIES( @@ -69,6 +69,6 @@ ELSEIF (ASPELL_FOUND) TARGET_LINK_LIBRARIES(${SCRIBUS_SPELL_PLUGIN} ${ASPELL_LIBRARIES}) - ADD_DEFINITIONS("-DUSE_ASPELL") + ADD_DEFINITIONS("-DUSE_ASPELL -DSPELL_CHECKER_STR=\\\"aspell\\\"") ENDIF () diff --git a/Scribus/scribus/plugins/tools/spellcheck/aspellplugin.cpp b/Scribus/scribus/plugins/tools/spellcheck/aspellplugin.cpp index 67ed464..98999a3 100644 --- a/Scribus/scribus/plugins/tools/spellcheck/aspellplugin.cpp +++ b/Scribus/scribus/plugins/tools/spellcheck/aspellplugin.cpp @@ -53,7 +53,7 @@ void SpellPlugin::languageChange() const QString SpellPlugin::fullTrName() const { - return QObject::tr("Spell check (aspell)"); + return QObject::tr("Spell check (" SPELL_CHECKER_STR ")"); } const ScActionPlugin::AboutData* SpellPlugin::getAboutData() const @@ -63,8 +63,8 @@ const ScActionPlugin::AboutData* SpellPlugin::getAboutData() const about->authors = "Gora Mohanty <gora@srijan.in>"; about->shortDescription = tr( "Spell-checking support" ); about->description = - tr( "Adds support for spell-checking via aspell. Languages " - "can be chosen from among the installed aspell " + tr( "Adds support for spell-checking via " SPELL_CHECKER_STR ". Languages " + "can be chosen from among the installed " SPELL_CHECKER_STR " " "dictionaries, and spell-checking can be done on the " "fly, or on selected text." ); about->version = tr( "0.1" ); diff --git a/Scribus/scribus/plugins/tools/spellcheck/aspellpluginimpl.cpp b/Scribus/scribus/plugins/tools/spellcheck/aspellpluginimpl.cpp index 1d2cc95..03da044 100644 --- a/Scribus/scribus/plugins/tools/spellcheck/aspellpluginimpl.cpp +++ b/Scribus/scribus/plugins/tools/spellcheck/aspellpluginimpl.cpp @@ -34,20 +34,20 @@ SpellPluginImpl::SpellPluginImpl(ScribusDoc* doc, QWidget* parent) : // Get stored language, jargon, encoding settings fprefs = PrefsManager::instance()->prefsFile->getPluginContext( kDEF_CONTEXT ); getPreferences(); - QString text = tr( "Loaded " ) + (fentry == kDEF_ASPELL_ENTRY ? tr( "default " ) : "") + fentry + tr( " aspell dictionary." ); + QString text = tr( "Loaded " ) + (fentry == kDEF_ASPELL_ENTRY ? tr( "default " ) : "") + fentry + tr( " " SPELL_CHECKER_STR " dictionary." ); doc->scMW()->setStatusBarInfoText( text ); try { - // Deactivate GUI elements in spell-checking tab until an - // aspell dictionary is chosen. + // Deactivate GUI elements in speller tab until an + // speller dictionary is chosen. activateSpellGUI(false); - // Create speller, and get list of available aspell + // Create speller, and get list of available speller // dictionaries. fsuggest = new Speller::Spell::Suggest( flang.toUtf8().data(), fjargon.toUtf8().data(), fencoding.toUtf8().data() ); Q_CHECK_PTR( fsuggest ); - // Get list of available aspell dictionaries + // Get list of available speller dictionaries std::vector<std::string> entries; fsuggest->listDicts( entries ); for( std::vector<std::string>::const_iterator i = entries.begin(); i != entries.end(); ++i ) @@ -79,16 +79,16 @@ SpellPluginImpl::SpellPluginImpl(ScribusDoc* doc, QWidget* parent) : } catch( const std::invalid_argument& err ) { - QString warn = tr( "aspellplugin (SpellPluginImpl::" - "SpellPluginImpl): Error in aspell " + QString warn = tr( "spellplugin (SpellPluginImpl::" + "SpellPluginImpl): Error in " "speller configuration." ); qWarning( "%s", warn.toUtf8().data() ); } catch( const std::runtime_error& err ) { - QString warn = tr( "aspellplugin (SpellPluginImpl::" + QString warn = tr( "spellplugin (SpellPluginImpl::" "SpellPluginImpl): Error in creating " - "aspell speller." ); + "speller." ); qWarning( "%s", warn.toUtf8().data() ); } activateSpellGUI(true); @@ -104,8 +104,8 @@ SpellPluginImpl::~SpellPluginImpl() } catch( const std::runtime_error& err ) { - qWarning( "aspellplugin (SpellPluginImpl::~SpellPlugin" - "Impl): Error in saving aspell word lists." ); + qWarning( "spellplugin (SpellPluginImpl::~SpellPlugin" + "Impl): Error in saving speller word lists." ); } delete fsuggest; @@ -414,9 +414,9 @@ bool SpellPluginImpl::handleSpellConfig(const QString & dictFullName) //__________________________________________________________________________ void SpellPluginImpl::on_flistDicts_activated() { - // Called when an item in the list of available aspell dictionaries is + // Called when an item in the list of available speller dictionaries is // selected, i.e., by double-clicking, or pressing enter. Resets - // aspell configuration to use the selected dictionary. + // speller configuration to use the selected dictionary. if (handleSpellConfig(flistDicts->currentText())) { // PV - 7523: In the spell checker, the only option to change diff --git a/Scribus/scribus/plugins/tools/spellcheck/suggest.cpp b/Scribus/scribus/plugins/tools/spellcheck/suggest.cpp index 53273af..875f1d0 100644 --- a/Scribus/scribus/plugins/tools/spellcheck/suggest.cpp +++ b/Scribus/scribus/plugins/tools/spellcheck/suggest.cpp @@ -23,7 +23,7 @@ void Speller::Spell::Suggest::checkError() throw( std::runtime_error ) { std::string err_msg = std::string( "(Spell::Speller::Suggest::checkError): " - "aspell speller error " ) + + "speller error " ) + aspell_speller_error_message( fspeller ); throw std::runtime_error( err_msg ); } @@ -36,7 +36,7 @@ void Speller::Spell::Suggest::checkConfigError() { std::string err_msg = std::string( "(Spell::Speller::Suggest::checkConfig" - "Error): aspell speller error " ) + + "Error): speller error " ) + aspell_config_error_message( fconfig ); throw std::runtime_error( err_msg ); } -- 1.7.2.3 From fe2be01d79927ed1dc8f4468b93cb4ef6c5b91a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <dan@danny.cz> Date: Mon, 4 Oct 2010 16:25:25 +0200 Subject: [PATCH 10/12] remove unused getConfigOpt() methods --- .../scribus/plugins/tools/spellcheck/suggest.cpp | 25 -------------------- Scribus/scribus/plugins/tools/spellcheck/suggest.h | 16 ------------ 2 files changed, 0 insertions(+), 41 deletions(-) diff --git a/Scribus/scribus/plugins/tools/spellcheck/suggest.cpp b/Scribus/scribus/plugins/tools/spellcheck/suggest.cpp index 875f1d0..f25919e 100644 --- a/Scribus/scribus/plugins/tools/spellcheck/suggest.cpp +++ b/Scribus/scribus/plugins/tools/spellcheck/suggest.cpp @@ -298,31 +298,6 @@ void Speller::Spell::Suggest::clearSessionList() throw( std::runtime_error ) } } //__________________________________________________________________________ -std::string Speller::Spell::Suggest::getConfigOpt(const std::string& opt) -{ - return std::string( aspell_config_retrieve( fconfig, opt.c_str() ) ); -} -//__________________________________________________________________________ -void Speller::Spell::Suggest::getConfigOpt(const std::string& opt, - std::vector<std::string>& vals) -{ - // Stores current setting of configuration option, 'opt', which - // has a value of list type, in 'vals'. - AspellStringList* list = new_aspell_string_list(); - AspellMutableContainer* lst0 = - aspell_string_list_to_mutable_container( list ); - aspell_config_retrieve_list( fconfig, opt.c_str(), lst0 ); - AspellStringEnumeration* enum_list = - aspell_string_list_elements( list ); - const char* next; - while( (next = aspell_string_enumeration_next( enum_list )) ) - { - vals.push_back( next ); - } - delete_aspell_string_enumeration( enum_list ); - delete_aspell_string_list( list ); -} -//__________________________________________________________________________ void Speller::Spell::Suggest::ignoreWord(const std::string& word) throw( std::runtime_error ) { diff --git a/Scribus/scribus/plugins/tools/spellcheck/suggest.h b/Scribus/scribus/plugins/tools/spellcheck/suggest.h index 2c740cf..46ea987 100644 --- a/Scribus/scribus/plugins/tools/spellcheck/suggest.h +++ b/Scribus/scribus/plugins/tools/spellcheck/suggest.h @@ -181,22 +181,6 @@ from 0.60 onwards void clearSessionList() throw( std::runtime_error ); /*! \author Gora Mohanty <gora@srijan.in> - \brief Gets value of configuration option, 'opt'. - \param opt: Name of option whose setting is to be retrieved. - \retval Value of option setting. - */ - std::string getConfigOpt(const std::string& opt); - /*! - \author Gora Mohanty <gora@srijan.in> - \brief Gets value of list type configuration option, 'opt'. - \param opt: Name of option whose setting is to be retrieved. - \param vals: Vector for storing values for the list type object. - \retval None. - */ - void getConfigOpt(const std::string& opt, - std::vector<std::string>& vals); - /*! - \author Gora Mohanty <gora@srijan.in> \brief Ignores 'word' for current session. \param word: Word to be ignored. \retval None. -- 1.7.2.3 From b20209a292e6ce14e187ba0e560657ee21af4622 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <dan@danny.cz> Date: Mon, 4 Oct 2010 18:51:07 +0200 Subject: [PATCH 11/12] make some methods private --- Scribus/scribus/plugins/tools/spellcheck/suggest.h | 172 ++++++++++---------- 1 files changed, 86 insertions(+), 86 deletions(-) diff --git a/Scribus/scribus/plugins/tools/spellcheck/suggest.h b/Scribus/scribus/plugins/tools/spellcheck/suggest.h index 46ea987..5664e75 100644 --- a/Scribus/scribus/plugins/tools/spellcheck/suggest.h +++ b/Scribus/scribus/plugins/tools/spellcheck/suggest.h @@ -82,6 +82,16 @@ from 0.60 onwards char delim='\n') throw(std::invalid_argument); /*! \author Gora Mohanty <gora@srijan.in> + \brief Sets configuration option, 'opt' to value 'val'. + \param opt: Option to be set. + \param val: Value of option to be set. + \retval None + \exception std::invalid_argument if option value is incorrect + */ + void setConfigOpt(const std::string& opt, const std::string& val) + throw( std::invalid_argument ); + /*! + \author Gora Mohanty <gora@srijan.in> \brief Sets aspell speller configuration, as per current set of parameters. \param None \retval None @@ -90,6 +100,16 @@ from 0.60 onwards void setConfig() throw( std::invalid_argument ); /*! \author Gora Mohanty <gora@srijan.in> + \brief Resets aspell configuration, as per current set of parameters. + \param None + \retval None + \exception std::invalid_argument from setConfig(). + \exception std::runtime_error for error in recreating speller. + */ + void resetConfig() + throw( std::invalid_argument, std::runtime_error ); + /*! + \author Gora Mohanty <gora@srijan.in> \brief Stores list of words in 'replacement'. \param wlist: Pointer to start of word list. \param replacement: Vector to hold suggested replacement words. @@ -99,6 +119,72 @@ from 0.60 onwards void storeWordList(const AspellWordList* wlist, std::vector<std::string>& replacement) throw( std::invalid_argument ); + /*! + \author Gora Mohanty <gora@srijan.in> + \brief Obtains list of available aspell dictionaries. + \param vals: Array of aspell dictionary info structs + \retval None + */ + void listDicts(std::vector<AspellDictInfo>& vals); + /*! + \author Gora Mohanty <gora@srijan.in> + \brief Clears the current session word list. + \param None + \retval None + \exception std::runtime_error for error in clearing list. + */ + void clearSessionList() throw( std::runtime_error ); + /*! + \author Gora Mohanty <gora@srijan.in> + \brief Prints main word list. WARNING: This causes a crash due to a bug in aspell, as of aspell version 0.60.3. + \param None + \retval None. + \exception std::invalid_argument from printWordList(). + */ + void printMainList() throw( std::invalid_argument ); + /*! + \author Gora Mohanty <gora@srijan.in> + \brief Prints personal word list. + \param None + \retval None. + \exception std::invalid_argument from printWordList(). + */ + void printPersonalList() throw( std::invalid_argument ); + /*! + \author Gora Mohanty <gora@srijan.in> + \brief Prints session word list. + \param None + \retval None. + \exception std::invalid_argument from printWordList(). + */ + void printSessionList() throw( std::invalid_argument ); + /*! + \author Gora Mohanty <gora@srijan.in> + \brief Stores main word list. WARNING: This causes a crash due to a bug in aspell, as of aspell version 0.60.3. + \param None + \retval None. + \exception std::invalid_argument from storeWordList(). + */ + void StoreMainList(std::vector<std::string>& replacement) + throw( std::invalid_argument ); + /*! + \author Gora Mohanty <gora@srijan.in> + \brief Stores personal word list. + \param None + \retval None. + \exception std::invalid_argument from storeWordList(). + */ + void StorePersonalList(std::vector<std::string>& replacement) + throw( std::invalid_argument ); + /*! + \author Gora Mohanty <gora@srijan.in> + \brief Stores session word list. + \param None + \retval None. + \exception std::invalid_argument from storeWordList(). + */ + void StoreSessionList(std::vector<std::string>& replacement) + throw( std::invalid_argument ); public: /*! @@ -173,14 +259,6 @@ from 0.60 onwards bool always=true) throw( std::invalid_argument ); /*! \author Gora Mohanty <gora@srijan.in> - \brief Clears the current session word list. - \param None - \retval None - \exception std::runtime_error for error in clearing list. - */ - void clearSessionList() throw( std::runtime_error ); - /*! - \author Gora Mohanty <gora@srijan.in> \brief Ignores 'word' for current session. \param word: Word to be ignored. \retval None. @@ -191,43 +269,12 @@ from 0.60 onwards /*! \author Gora Mohanty <gora@srijan.in> \brief Obtains list of available aspell dictionaries. - \param vals: Array of aspell dictionary info structs - \retval None - */ - void listDicts(std::vector<AspellDictInfo>& vals); - /*! - \author Gora Mohanty <gora@srijan.in> - \brief Obtains list of available aspell dictionaries. \param vals: Array of formatted strings for aspell dictionary entries. Each has format <name>--<lang>--<jargon>--<size> \retval None */ void listDicts(std::vector<std::string>& vals); /*! \author Gora Mohanty <gora@srijan.in> - \brief Prints main word list. WARNING: This causes a crash due to a bug in aspell, as of aspell version 0.60.3. - \param None - \retval None. - \exception std::invalid_argument from printWordList(). - */ - void printMainList() throw( std::invalid_argument ); - /*! - \author Gora Mohanty <gora@srijan.in> - \brief Prints personal word list. - \param None - \retval None. - \exception std::invalid_argument from printWordList(). - */ - void printPersonalList() throw( std::invalid_argument ); - /*! - \author Gora Mohanty <gora@srijan.in> - \brief Prints session word list. - \param None - \retval None. - \exception std::invalid_argument from printWordList(). - */ - void printSessionList() throw( std::invalid_argument ); - /*! - \author Gora Mohanty <gora@srijan.in> \brief Spell-checks word, and prints suggested replacements. \param word: Word to be checked. \param always: If true, replacements are always printed, else only if word is mis-spelt. @@ -238,16 +285,6 @@ from 0.60 onwards throw( std::invalid_argument ); /*! \author Gora Mohanty <gora@srijan.in> - \brief Resets aspell configuration, as per current set of parameters. - \param None - \retval None - \exception std::invalid_argument from setConfig(). - \exception std::runtime_error for error in recreating speller. - */ - void resetConfig() - throw( std::invalid_argument, std::runtime_error ); - /*! - \author Gora Mohanty <gora@srijan.in> \brief Resets aspell configuration, as per current set of parameters, after resetting lang, jargon, and encoding. \param lang: Language of aspell dictionary. \param jargon: Jargon for aspell dictionary. @@ -268,43 +305,6 @@ from 0.60 onwards \exception std::runtime_error for error in saving lists. */ void saveLists() throw( std::runtime_error ); - /*! - \author Gora Mohanty <gora@srijan.in> - \brief Sets configuration option, 'opt' to value 'val'. - \param opt: Option to be set. - \param val: Value of option to be set. - \retval None - \exception std::invalid_argument if option value is incorrect - */ - void setConfigOpt(const std::string& opt, const std::string& val) - throw( std::invalid_argument ); - /*! - \author Gora Mohanty <gora@srijan.in> - \brief Stores main word list. WARNING: This causes a crash due to a bug in aspell, as of aspell version 0.60.3. - \param None - \retval None. - \exception std::invalid_argument from storeWordList(). - */ - void StoreMainList(std::vector<std::string>& replacement) - throw( std::invalid_argument ); - /*! - \author Gora Mohanty <gora@srijan.in> - \brief Stores personal word list. - \param None - \retval None. - \exception std::invalid_argument from storeWordList(). - */ - void StorePersonalList(std::vector<std::string>& replacement) - throw( std::invalid_argument ); - /*! - \author Gora Mohanty <gora@srijan.in> - \brief Stores session word list. - \param None - \retval None. - \exception std::invalid_argument from storeWordList(). - */ - void StoreSessionList(std::vector<std::string>& replacement) - throw( std::invalid_argument ); }; // class Suggest } // namespace Spell } // namespace Speller -- 1.7.2.3 From d0a145ebd58ef42692582c215a028c538c19160b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <dan@danny.cz> Date: Mon, 4 Oct 2010 23:50:19 +0200 Subject: [PATCH 12/12] add enchant support to the spellcheck plugin --- .../plugins/tools/spellcheck/aspellpluginimpl.cpp | 31 +++- .../plugins/tools/spellcheck/aspellpluginimpl.h | 11 +- .../scribus/plugins/tools/spellcheck/suggest.cpp | 169 ++++++++++++++------ Scribus/scribus/plugins/tools/spellcheck/suggest.h | 60 ++++++- 4 files changed, 206 insertions(+), 65 deletions(-) diff --git a/Scribus/scribus/plugins/tools/spellcheck/aspellpluginimpl.cpp b/Scribus/scribus/plugins/tools/spellcheck/aspellpluginimpl.cpp index 03da044..570f175 100644 --- a/Scribus/scribus/plugins/tools/spellcheck/aspellpluginimpl.cpp +++ b/Scribus/scribus/plugins/tools/spellcheck/aspellpluginimpl.cpp @@ -44,7 +44,11 @@ SpellPluginImpl::SpellPluginImpl(ScribusDoc* doc, QWidget* parent) : // Create speller, and get list of available speller // dictionaries. - fsuggest = new Speller::Spell::Suggest( flang.toUtf8().data(), fjargon.toUtf8().data(), fencoding.toUtf8().data() ); + fsuggest = new Speller::Spell::Suggest( flang.toUtf8().data() +#if defined(USE_ASPELL) + , fjargon.toUtf8().data(), fencoding.toUtf8().data() +#endif + ); Q_CHECK_PTR( fsuggest ); // Get list of available speller dictionaries @@ -396,6 +400,15 @@ bool SpellPluginImpl::handleSpellConfig(const QString & dictFullName) { QString entry(dictFullName); QStringList fields = entry.split( Speller::Spell::Suggest::kDICT_DELIM ); +#if defined(USE_ENCHANT) + // Ensure that we have sufficient fields. + if( fields.size() > 2 ) + { + fsuggest->resetConfig( fields[1].toAscii().data() ); + setPreferences( fields[1] ); + return true; + } +#elif defined(USE_ASPELL) // Ensure that we have at least the right no.of fields. if( fields.size() == 4 ) { @@ -409,6 +422,7 @@ bool SpellPluginImpl::handleSpellConfig(const QString & dictFullName) setPreferences( fields[1], fields[2], Speller::Spell::Suggest::kDEF_ENCODING, value ); return true; } +#endif return false; } //__________________________________________________________________________ @@ -441,25 +455,32 @@ void SpellPluginImpl::getPreferences() // Retrieves user preferences from saved settings. Defaults are // supplied flang = fprefs->get( "lang", Speller::Spell::Suggest::kDEF_LANG ); +#if defined(USE_ASPELL) fjargon = fprefs->get( "jargon", Speller::Spell::Suggest::kDEF_JARGON ); // FIXME: Handle encodings other than UTF-8. fencoding = fprefs->get( "encoding", Speller::Spell::Suggest::kDEF_ENCODING ); // Don't use kDEF_ASPELL_ENTRY here. It's checked // against system locale later when there is no preferences for it. fentry = fprefs->get( "entry", "");//kDEF_ASPELL_ENTRY ); +#endif } //__________________________________________________________________________ -void SpellPluginImpl::setPreferences(const QString& lang, - const QString& jargon, - const QString& encoding, - const QString& entry) +void SpellPluginImpl::setPreferences(const QString& lang +#if defined(USE_ASPELL) + , const QString& jargon + , const QString& encoding + , const QString& entry +#endif +) { // Saves user preferences using Scribus preferences manager. fprefs->set( "lang", lang ); +#if defined(USE_ASPELL) QString val = jargon == Speller::Spell::Suggest::kEMPTY ? "" : jargon; fprefs->set( "jargon", val ); fprefs->set( "encoding", encoding ); fprefs->set( "entry", entry ); +#endif } //__________________________________________________________________________ void SpellPluginImpl::languageChange() diff --git a/Scribus/scribus/plugins/tools/spellcheck/aspellpluginimpl.h b/Scribus/scribus/plugins/tools/spellcheck/aspellpluginimpl.h index 5afa343..e0017a3 100644 --- a/Scribus/scribus/plugins/tools/spellcheck/aspellpluginimpl.h +++ b/Scribus/scribus/plugins/tools/spellcheck/aspellpluginimpl.h @@ -115,10 +115,13 @@ protected: \param encoding: Encoding for aspell dictionary \retval None */ - void setPreferences(const QString& lang, - const QString& jargon, - const QString& encoding=Speller::Spell::Suggest::kDEF_ENCODING, - const QString& entry=kDEF_ASPELL_ENTRY); + void setPreferences(const QString& lang +#if defined(USE_ASPELL) + , const QString& jargon + , const QString& encoding=Speller::Spell::Suggest::kDEF_ENCODING + , const QString& entry=kDEF_ASPELL_ENTRY +#endif + ); /*! \author Gora Mohanty <gora@srijan.in> \brief Retrieve saved user preferences: language, jargon, encoding. diff --git a/Scribus/scribus/plugins/tools/spellcheck/suggest.cpp b/Scribus/scribus/plugins/tools/spellcheck/suggest.cpp index f25919e..74a0282 100644 --- a/Scribus/scribus/plugins/tools/spellcheck/suggest.cpp +++ b/Scribus/scribus/plugins/tools/spellcheck/suggest.cpp @@ -8,15 +8,24 @@ #include "suggest.h" #include "scpaths.h" #include <QFileInfo> +#include <algorithm> +#if defined(USE_ENCHANT) +#include <enchant++.h> +#endif /*! \brief Delimiter between different components of formatted strings for aspell dictionary entries. */ const char* Speller::Spell::Suggest::kDICT_DELIM = "/"; const char* Speller::Spell::Suggest::kEMPTY = "*"; +#if defined(USE_ENCHANT) +const char* Speller::Spell::Suggest::kDEF_LANG = "en_US"; +#elif defined(USE_ASPELL) const char* Speller::Spell::Suggest::kDEF_LANG = "en"; const char* Speller::Spell::Suggest::kDEF_JARGON = ""; // I.e., no jargon const char* Speller::Spell::Suggest::kDEF_ENCODING = "utf-8"; +#endif +#if defined(USE_ASPELL) void Speller::Spell::Suggest::checkError() throw( std::runtime_error ) { if( aspell_speller_error_number( fspeller ) != 0 ) @@ -41,14 +50,21 @@ void Speller::Spell::Suggest::checkConfigError() throw std::runtime_error( err_msg ); } } +#endif //__________________________________________________________________________ -void Speller::Spell::Suggest::init(const std::string& lang, - const std::string& jargon, - const std::string& encoding) +void Speller::Spell::Suggest::init(const std::string& lang +#if defined(USE_ASPELL) + , const std::string& jargon + , const std::string& encoding +#endif + ) throw( std::invalid_argument, std::runtime_error ) { // Save aspell configuration values flang = lang; +#if defined(USE_ENCHANT) + +#elif defined(USE_ASPELL) fjargon = jargon; fencoding = encoding; @@ -75,8 +91,10 @@ void Speller::Spell::Suggest::init(const std::string& lang, fspeller = to_aspell_speller( ret ); fconfig = aspell_speller_config( fspeller ); } +#endif } //__________________________________________________________________________ +#if defined(USE_ASPELL) void Speller::Spell::Suggest::listDicts(std::vector<AspellDictInfo>& vals) { AspellDictInfoList* dlist = get_aspell_dict_info_list( fconfig ); @@ -89,9 +107,27 @@ void Speller::Spell::Suggest::listDicts(std::vector<AspellDictInfo>& vals) } delete_aspell_dict_info_enumeration( dinfo_enum ); } +#endif + +#if defined(USE_ENCHANT) +void EnchantDictDescribe(const char * const lang_tag, + const char * const , + const char * const , + const char * const , + void * user_data) +{ + std::vector<std::string> *detected = (std::vector<std::string>*)user_data; + detected->push_back(std::string(lang_tag)); +} +#endif + //__________________________________________________________________________ void Speller::Spell::Suggest::listDicts(std::vector<std::string>& vals) { +#if defined(USE_ENCHANT) + enchant::Broker::instance()->list_dicts(EnchantDictDescribe, &vals); + std::sort(vals.begin(), vals.end()); +#elif defined(USE_ASPELL) std::vector<AspellDictInfo> entries; listDicts( entries ); for( std::vector<AspellDictInfo>::const_iterator i = entries.begin(); @@ -105,13 +141,24 @@ void Speller::Spell::Suggest::listDicts(std::vector<std::string>& vals) << i->size; vals.push_back( fmt_entry.str() ); } +#endif } //__________________________________________________________________________ void -Speller::Spell::Suggest::printWordList(const AspellWordList* wlist, +Speller::Spell::Suggest::printWordList( +#if defined(USE_ENCHANT) + const std::vector<std::string> & wlist, +#elif defined(USE_ASPELL) + const AspellWordList* wlist, +#endif char delim) throw( std::invalid_argument ) { +#if defined(USE_ENCHANT) + std::vector<std::string>::const_iterator aEnd = wlist.end(); + for (std::vector<std::string>::const_iterator aI = wlist.begin(); aI != aEnd; ++aI) + std::cout << *aI << delim; +#elif defined(USE_ASPELL) if( ! wlist ) { throw std::invalid_argument( "(Aspell.Speller.Suggest.print" @@ -127,8 +174,10 @@ Speller::Spell::Suggest::printWordList(const AspellWordList* wlist, std::cout << next << delim; } delete_aspell_string_enumeration( enum_list ); +#endif } //__________________________________________________________________________ +#if defined(USE_ASPELL) void Speller::Spell::Suggest::setConfig() throw( std::invalid_argument ) { try @@ -170,16 +219,24 @@ Speller::Spell::Suggest::storeWordList(const AspellWordList* wlist, } delete_aspell_string_enumeration( enum_list ); } +#endif //__________________________________________________________________________ -Speller::Spell::Suggest::Suggest(const std::string& lang, - const std::string& jargon, - const std::string& encoding) +Speller::Spell::Suggest::Suggest(const std::string& lang +#if defined(USE_ASPELL) + , const std::string& jargon + , const std::string& encoding +#endif + ) throw( std::invalid_argument, std::runtime_error ) { // Default constructor try { - init( lang, jargon, encoding ); + init( lang +#if defined(USE_ASPELL) + , jargon, encoding +#endif + ); } catch( const std::invalid_argument& err ) { @@ -191,6 +248,7 @@ Speller::Spell::Suggest::Suggest(const std::string& lang, } } //__________________________________________________________________________ +#if defined(USE_ASPELL) Speller::Spell::Suggest::Suggest(const AspellDictInfo* dinfo, const std::string& encoding) throw( std::invalid_argument, std::runtime_error ) @@ -208,10 +266,22 @@ Speller::Spell::Suggest::Suggest(const AspellDictInfo* dinfo, throw err; } } +#endif + +Speller::Spell::Suggest::~Suggest() +{ +#if defined(USE_ENCHANT) + delete fspeller; +#endif +} //__________________________________________________________________________ void Speller::Spell::Suggest::addPersonalList(const std::string& word) throw( std::runtime_error ) { +#if defined(USE_ENCHANT) + if (fspeller) + fspeller->add(word); +#elif defined(USE_APELL) // A std::runtime_error exception is thrown if // an error occcurs. @@ -226,16 +296,22 @@ void Speller::Spell::Suggest::addPersonalList(const std::string& word) { throw err; } +#endif } //__________________________________________________________________________ bool Speller::Spell::Suggest::checkWord(const std::string& word) { bool status = true; +#if defined(USE_ENCHANT) + if (fspeller) + status = fspeller->check(word); +#elif defined(USE_ASPELL) if( aspell_speller_check( fspeller, word.c_str(), -1 ) == 0 ) { status = false; } +#endif return status; } //__________________________________________________________________________ @@ -252,8 +328,12 @@ bool Speller::Spell::Suggest::checkWord(const std::string& word, // 'word'is spelt incorrectly. bool status = checkWord( word ); - if( always ) + if( !status || always ) { +#if defined(USE_ENCHANT) + if (fspeller) + fspeller->suggest(word, replacement); +#elif defined(USE_ASPELL) const AspellWordList* wlist = aspell_speller_suggest( fspeller, word.c_str(), -1 ); try @@ -264,27 +344,12 @@ bool Speller::Spell::Suggest::checkWord(const std::string& word, { throw err; } - } - else - { - if( ! status ) - { - const AspellWordList* wlist = - aspell_speller_suggest( fspeller, word.c_str(), - -1 ); - try - { - storeWordList( wlist, replacement ); - } - catch( const std::invalid_argument& err ) - { - throw err; - } - } +#endif } return status; } //__________________________________________________________________________ +#if defined(USE_ASPELL) void Speller::Spell::Suggest::clearSessionList() throw( std::runtime_error ) { aspell_speller_clear_session( fspeller ); @@ -297,10 +362,15 @@ void Speller::Spell::Suggest::clearSessionList() throw( std::runtime_error ) throw err; } } +#endif //__________________________________________________________________________ void Speller::Spell::Suggest::ignoreWord(const std::string& word) throw( std::runtime_error ) { +#if defined(USE_ENCHANT) + if (fspeller) + fspeller->add_to_session(word); +#elif defined(USE_ASPELL) // FIXME: Return value should be something meaningful from // aspell_speller_add_to_session. aspell_speller_add_to_session( fspeller, word.c_str(), -1 ); @@ -312,8 +382,10 @@ void Speller::Spell::Suggest::ignoreWord(const std::string& word) { throw err; } +#endif } //__________________________________________________________________________ +#if defined(USE_ASPELL) void Speller::Spell::Suggest::printMainList() throw( std::invalid_argument ) { const AspellWordList* wlist = @@ -357,6 +429,7 @@ void Speller::Spell::Suggest::printSessionList() throw err; } } +#endif //__________________________________________________________________________ bool Speller::Spell::Suggest::printSuggestions(const std::string& word, bool always) @@ -369,8 +442,12 @@ bool Speller::Spell::Suggest::printSuggestions(const std::string& word, // false, only prints the list if 'word' is incorrect. bool status = checkWord( word ); - if( always ) + if( !status || always ) { +#if defined(USE_ENCHANT) + if (fspeller) + printWordList( fspeller->suggest(word) ); +#elif defined(USE_ASPELL) const AspellWordList* wlist = aspell_speller_suggest( fspeller, word.c_str(), -1 ); try @@ -381,23 +458,7 @@ bool Speller::Spell::Suggest::printSuggestions(const std::string& word, { throw err; } - } - else - { - if( ! status ) - { - const AspellWordList* wlist = - aspell_speller_suggest( fspeller, word.c_str(), - -1 ); - try - { - printWordList( wlist ); - } - catch( const std::invalid_argument& err ) - { - throw err; - } - } +#endif } return status; } @@ -405,6 +466,10 @@ bool Speller::Spell::Suggest::printSuggestions(const std::string& word, void Speller::Spell::Suggest::resetConfig() throw( std::invalid_argument, std::runtime_error ) { +#if defined(USE_ENCHANT) + delete fspeller; + fspeller = enchant::Broker::instance()->request_dict(flang); +#elif defined(USE_ASPELL) delete_aspell_config( fconfig ); fconfig = new_aspell_config(); try @@ -432,17 +497,23 @@ void Speller::Spell::Suggest::resetConfig() delete_aspell_config( fconfig ); fconfig = aspell_speller_config( fspeller ); } +#endif } //__________________________________________________________________________ -void Speller::Spell::Suggest::resetConfig(const std::string& lang, - const std::string& jargon, - const std::string& encoding) +void Speller::Spell::Suggest::resetConfig(const std::string& lang +#if defined(USE_ASPELL) + , const std::string& jargon + , const std::string& encoding +#endif + ) throw( std::invalid_argument, std::runtime_error ) { // Save new aspell configuration values flang = lang; +#if defined(USE_ASPELL) fjargon = jargon; fencoding = encoding; +#endif try { @@ -460,6 +531,7 @@ void Speller::Spell::Suggest::resetConfig(const std::string& lang, //__________________________________________________________________________ void Speller::Spell::Suggest::saveLists() throw( std::runtime_error ) { +#if defined(USE_ASPELL) // Saves all word lists. aspell_speller_save_all_word_lists( fspeller ); try @@ -470,8 +542,10 @@ void Speller::Spell::Suggest::saveLists() throw( std::runtime_error ) { throw err; } +#endif } //__________________________________________________________________________ +#if defined(USE_ASPELL) void Speller::Spell::Suggest::setConfigOpt(const std::string& opt, const std::string& val) throw( std::invalid_argument ) @@ -534,5 +608,6 @@ void Speller::Spell::Suggest::StoreSessionList(std::vector<std::string>& replace throw err; } } +#endif //__________________________________________________________________________ //@@@@@@@@@@@@@@@@@@@@@@@@@ END OF FILE @@@@@@@@@@@@@@@@@@@@@@@@@ diff --git a/Scribus/scribus/plugins/tools/spellcheck/suggest.h b/Scribus/scribus/plugins/tools/spellcheck/suggest.h index 5664e75..7e25b1e 100644 --- a/Scribus/scribus/plugins/tools/spellcheck/suggest.h +++ b/Scribus/scribus/plugins/tools/spellcheck/suggest.h @@ -14,8 +14,15 @@ #include <string> // Used in function arguments, errors #include <vector> // Used in function arguments #include <iostream> // Printing to std::cout +#if defined(USE_ENCHANT) +// enchant definitions +namespace enchant { + class Dict; +} +#elif defined(USE_ASPELL) // aspell include files #include <aspell.h> +#endif /*! \brief Nested namespaces to allow different interfaces to different spell-checking engines. @@ -30,6 +37,12 @@ from 0.60 onwards */ class Suggest { private: +#if defined(USE_ENCHANT) + /*! \brief Enchant speller object. */ + enchant::Dict* fspeller; + /*! \brief Language for aspell dictionary. */ + std::string flang; +#elif defined(USE_ASPELL) /*! \brief Aspell configuration object. */ AspellConfig* fconfig; /*! \brief Aspell speller object. */ @@ -40,7 +53,9 @@ from 0.60 onwards std::string fjargon; /*! \brief Character encoding for words. */ std::string fencoding; +#endif +#if defined(USE_ASPELL) /*! \author Gora Mohanty <gora@srijan.in> \brief Checks aspell speller for an error condition. @@ -57,6 +72,7 @@ from 0.60 onwards \exception std::runtime_error if an error condition exists */ void checkConfigError() throw( std::runtime_error ); +#endif /*! \author Gora Mohanty <gora@srijan.in> \brief Initializes aspell: called from constructors. @@ -67,8 +83,12 @@ from 0.60 onwards \exception std::invalid_argument from setConfig(). \exception std::runtime_error for error in creating speller. */ - void init(const std::string& lang, const std::string& jargon, - const std::string& encoding) + void init(const std::string& lang +#if defined(USE_ASPELL) + , const std::string& jargon + , const std::string& encoding +#endif + ) throw( std::invalid_argument, std::runtime_error ); /*! \author Gora Mohanty <gora@srijan.in> @@ -78,8 +98,14 @@ from 0.60 onwards \retval None \exception std::invalid_argument if 'wlist' is null */ - void printWordList(const AspellWordList* wlist, + void printWordList( +#if defined(USE_ENCHANT) + const std::vector<std::string> & wlist, +#elif defined(USE_ASPELL) + const AspellWordList* wlist, +#endif char delim='\n') throw(std::invalid_argument); +#if defined(USE_ASPELL) /*! \author Gora Mohanty <gora@srijan.in> \brief Sets configuration option, 'opt' to value 'val'. @@ -90,6 +116,7 @@ from 0.60 onwards */ void setConfigOpt(const std::string& opt, const std::string& val) throw( std::invalid_argument ); +#endif /*! \author Gora Mohanty <gora@srijan.in> \brief Sets aspell speller configuration, as per current set of parameters. @@ -116,6 +143,7 @@ from 0.60 onwards \retval None \exception std::invalid_argument if 'wlist' is null */ +#if defined(USE_ASPELL) void storeWordList(const AspellWordList* wlist, std::vector<std::string>& replacement) throw( std::invalid_argument ); @@ -185,6 +213,7 @@ from 0.60 onwards */ void StoreSessionList(std::vector<std::string>& replacement) throw( std::invalid_argument ); +#endif public: /*! @@ -197,10 +226,12 @@ from 0.60 onwards static const char* kEMPTY; /*! \brief Default language for aspell dictionary. */ static const char* kDEF_LANG; +#if defined(USE_ASPELL) /*! \brief Default jargon for aspell dictionary. */ static const char* kDEF_JARGON; /*! \brief Default character encoding for words. */ static const char* kDEF_ENCODING; +#endif // Defaults are for standard aspell English dictionary. Use // "iso8859-1" for Basic Latin. See aspell lang.dat file for @@ -215,10 +246,14 @@ from 0.60 onwards \exception std::invalid_argument from setConfig(). \exception std::runtime_error for error in creating speller. */ - Suggest(const std::string& lang=kDEF_LANG, - const std::string& jargon=kDEF_JARGON, - const std::string& encoding=kDEF_ENCODING) + Suggest(const std::string& lang=kDEF_LANG +#if defined(USE_ASPELL) + , const std::string& jargon=kDEF_JARGON + , const std::string& encoding=kDEF_ENCODING +#endif + ) throw( std::invalid_argument, std::runtime_error ); +#if defined(USE_ASPELL) /*! \author Gora Mohanty <gora@srijan.in> \brief Constructor for spell-checking class. @@ -231,6 +266,10 @@ from 0.60 onwards Suggest(const AspellDictInfo* dinfo, const std::string& encoding=kDEF_ENCODING) throw( std::invalid_argument, std::runtime_error ); +#endif + + ~Suggest(); + /*! \author Gora Mohanty <gora@srijan.in> \brief Adds 'word' to personal list. @@ -293,9 +332,12 @@ from 0.60 onwards \exception std::invalid_argument from setConfig(). \exception std::runtime_error for error in recreating speller. */ - void resetConfig(const std::string& lang, - const std::string& jargon, - const std::string& encoding=kDEF_ENCODING) + void resetConfig(const std::string& lang +#if defined(USE_ASPELL) + , const std::string& jargon + , const std::string& encoding=kDEF_ENCODING +#endif + ) throw( std::invalid_argument, std::runtime_error ); /*! \author Gora Mohanty <gora@srijan.in> -- 1.7.2.3 |
|
Hm, seems I forgot to press the Upload button before adding the comment. It does work, but the workflow (same with both enchant and the original aspell) is a bit weird for me. |
|
This patch is a nightmare, sorry, can you please provide a single patch from current SVN to your version? |
|
got it applied eventually.. <grumble> :) |
|
This patch still has the same problems.. hmm |
|
@sharkcz , any progress on this issue? Do you plan to deal with the patch so that it supports enchant before aspell? I'm maintaining scribus package for my distro, Pardus (http://distrowatch.com/table.php?distribution=pardus), and I'm interested in this feature. |
|
Hi Without further response, we wont be putting this into the first RC/beta of 1.4.0, which also means it is likely to miss out on going into 1.4.0. Can you please respond? thanks |
|
I appreciate the work on this, but I am deferring this until 1.4.1. Not enough testing on it and we want to release 1.4.0 soon. RC1 is today. |
|
sharkcz.. now is the time to re-work this patch for 1.4.1svn code. Where did you get up to? This may also allow us to release on OSX with enchant libraries active instead of aspell as with aspell we couldn't relocate the aspell dirs into the bundle. |
|
ping? |
|
I need few more weeks (ETA end of February) to rebase the patch-set to recent scribus 1.4 as I'm busy with higher priority work, but it's definitely something Fedora wants. |
|
Moving this to 1.4.2 target. I have a hunspell based checker working now so will use this bug for it. |
|
Resolving this bug as the hunspell based spellchecker in now both in 1.4.x branch and trunk. |
Date Modified | Username | Field | Change |
---|---|---|---|
2009-07-16 07:52 | caolan | New Issue | |
2009-07-16 07:52 | caolan | File Added: scribus.enchant.patch | |
2009-07-17 21:44 |
|
Status | new => assigned |
2009-07-17 21:44 |
|
Assigned To | => cbradney |
2009-07-17 21:44 |
|
Fixed in Version | => 1.4.0svn |
2009-07-17 21:45 |
|
Fixed in Version | 1.4.0svn => |
2009-07-17 21:45 |
|
Target Version | => 1.4.0svn |
2009-10-07 08:09 | jghali | Target Version | 1.4.0svn => 1.4.0 |
2009-10-08 16:18 | cbradney | File Added: enchant081009.diff | |
2009-10-08 16:19 | cbradney | Note Added: 0022639 | |
2010-06-17 21:04 | cbradney | Note Added: 0024122 | |
2010-06-20 07:32 | sharkcz | Note Added: 0024155 | |
2010-06-20 10:41 | cbradney | Note Added: 0024158 | |
2010-07-27 22:56 | cbradney | Note Added: 0024388 | |
2010-09-26 09:56 | sharkcz | Note Added: 0024590 | |
2010-09-26 15:38 | cbradney | Note Added: 0024591 | |
2010-09-27 07:37 | sharkcz | Note Added: 0024594 | |
2010-10-05 12:22 | sharkcz | Note Added: 0024613 | |
2010-10-10 21:32 | cbradney | Note Added: 0024637 | |
2010-10-15 16:19 | sharkcz | File Added: scribus-1.3.8-enchant.patch | |
2010-10-15 16:21 | sharkcz | Note Added: 0024657 | |
2010-10-28 19:52 | cbradney | Note Added: 0024752 | |
2010-10-28 20:21 | cbradney | Note Added: 0024753 | |
2010-10-28 20:39 | cbradney | Note Added: 0024754 | |
2010-12-21 12:51 | dalgic.srdr | Note Added: 0025173 | |
2011-01-16 11:53 | cbradney | Note Added: 0025404 | |
2011-02-16 16:24 |
|
Note Added: 0025608 | |
2011-02-16 16:24 |
|
Target Version | 1.4.0 => 1.4.1.svn |
2011-04-16 10:06 | cbradney | Target Version | 1.4.1.svn => 1.4.1 |
2012-01-03 20:15 | cbradney | Note Added: 0027443 | |
2012-01-23 21:43 | cbradney | Note Added: 0027590 | |
2012-01-30 17:40 | sharkcz | Note Added: 0027628 | |
2012-04-28 21:26 | cbradney | Note Added: 0027977 | |
2012-04-28 21:26 | cbradney | Target Version | 1.4.1 => 1.4.2 |
2012-07-03 22:03 | jghali | Summary | patch to use enchant where available before aspell => use hunspell where available before aspell |
2012-07-03 22:04 | jghali | Note Added: 0028359 | |
2012-07-03 22:04 | jghali | Status | assigned => resolved |
2012-07-03 22:04 | jghali | Fixed in Version | => 1.4.2.svn |
2012-07-03 22:04 | jghali | Resolution | open => fixed |
2012-11-13 20:41 | cbradney | Status | resolved => closed |