summaryrefslogtreecommitdiffstats
path: root/scribus/plugins/tools/hunspellcheck/hunspellplugin.cpp
diff options
context:
space:
mode:
authorcraig <craig@11d20701-8431-0410-a711-e3c959e3b870>2012-04-12 21:33:03 +0000
committercraig <craig@11d20701-8431-0410-a711-e3c959e3b870>2012-04-12 21:33:03 +0000
commitf3403971efbfd72c8a59eb1957292cf534f1233b (patch)
treee7f9c07edc09836a262befb69e7af168bc0b8563 /scribus/plugins/tools/hunspellcheck/hunspellplugin.cpp
parentedaa5356a69507d02769dc9a69f32021e6e07ac3 (diff)
downloadscribus-f3403971efbfd72c8a59eb1957292cf534f1233b.tar.gz
scribus-f3403971efbfd72c8a59eb1957292cf534f1233b.tar.xz
scribus-f3403971efbfd72c8a59eb1957292cf534f1233b.zip
Add hunspell based spell checker - not enabled, backup only for now, not enabled in the build
git-svn-id: svn://scribus.net/branches/Version14x/Scribus@17437 11d20701-8431-0410-a711-e3c959e3b870
Diffstat (limited to 'scribus/plugins/tools/hunspellcheck/hunspellplugin.cpp')
-rw-r--r--scribus/plugins/tools/hunspellcheck/hunspellplugin.cpp95
1 files changed, 95 insertions, 0 deletions
diff --git a/scribus/plugins/tools/hunspellcheck/hunspellplugin.cpp b/scribus/plugins/tools/hunspellcheck/hunspellplugin.cpp
new file mode 100644
index 0000000..5b089a7
--- /dev/null
+++ b/scribus/plugins/tools/hunspellcheck/hunspellplugin.cpp
@@ -0,0 +1,95 @@
+/*
+For general Scribus (>=1.3.2) copyright and licensing information please refer
+to the COPYING file provided with the program. Following this notice may exist
+a copyright and/or license notice that predates the release of Scribus 1.3.2
+for which a new license (GPL+exception) is in place.
+*/
+#include "hunspellplugin.h"
+#include "hunspellpluginimpl.h"
+#include "scribuscore.h"
+
+// See scplugin.h and pluginmanager.{cpp,h} for detail on what these methods
+// do. That documentatation is not duplicated here.
+// Please don't implement the functionality of your plugin here; do that
+// in mypluginimpl.h and mypluginimpl.cpp .
+
+HunspellPlugin::HunspellPlugin() : ScActionPlugin()
+{
+ // Set action info in languageChange, so we only have to do
+ // it in one place.
+ languageChange();
+}
+
+HunspellPlugin::~HunspellPlugin() {};
+
+void HunspellPlugin::languageChange()
+{
+ // Note that we leave the unused members unset. They'll be initialised
+ // with their default ctors during construction.
+ // Action name
+ m_actionInfo.name = "HunspellPlugin";
+ // Action text for menu, including &accel
+ m_actionInfo.text = tr("Hunspell &Plugin");
+ // Menu
+ m_actionInfo.menu = "Item";
+ // If needed, what item to add the menu item after
+ //m_actionInfo.menuAfterName = "ColorWheel"
+ // If needed, the keyboard shortcut for the plugin
+ m_actionInfo.keySequence = "SHIFT+F7";
+ // Should the menu item be enabled when the app starts
+ // (even without a document open) ?
+ m_actionInfo.enabledOnStartup = false;
+ m_actionInfo.notSuitableFor.append(PageItem::Line);
+ m_actionInfo.notSuitableFor.append(PageItem::Polygon);
+ m_actionInfo.notSuitableFor.append(PageItem::ImageFrame);
+ m_actionInfo.notSuitableFor.append(PageItem::PathText);
+ m_actionInfo.notSuitableFor.append(PageItem::LatexFrame);
+ m_actionInfo.needsNumObjects = 1;
+}
+
+const QString HunspellPlugin::fullTrName() const
+{
+ return QObject::tr("Hunspell Plugin");
+}
+
+const ScActionPlugin::AboutData* HunspellPlugin::getAboutData() const
+{
+ AboutData* about = new AboutData;
+ Q_CHECK_PTR(about);
+ return about;
+}
+
+void HunspellPlugin::deleteAboutData(const AboutData* about) const
+{
+ Q_ASSERT(about);
+ delete about;
+}
+
+bool HunspellPlugin::run(ScribusDoc* doc, QString target)
+{
+ HunspellPluginImpl *hunspellPluginImpl = new HunspellPluginImpl();
+ Q_CHECK_PTR(hunspellPluginImpl);
+ bool result = hunspellPluginImpl->run(target, doc);
+ delete hunspellPluginImpl;
+ return result;
+}
+
+// Low level plugin API
+int hunspellplugin_getPluginAPIVersion()
+{
+ return PLUGIN_API_VERSION;
+}
+
+ScPlugin* hunspellplugin_getPlugin()
+{
+ HunspellPlugin* plug = new HunspellPlugin();
+ Q_CHECK_PTR(plug);
+ return plug;
+}
+
+void hunspellplugin_freePlugin(ScPlugin* plugin)
+{
+ HunspellPlugin* plug = dynamic_cast<HunspellPlugin*>(plugin);
+ Q_ASSERT(plug);
+ delete plug;
+}