From 03f92217ee2336adcbf9b1343ea03edac490ade5 Mon Sep 17 00:00:00 2001 From: craig Date: Mon, 30 Apr 2012 21:42:55 +0000 Subject: Update hunspell plugin, plugin manager to allow SE to see plugins, scplugin to have SE plugin attributes git-svn-id: svn://scribus.net/branches/Version14x/Scribus@17485 11d20701-8431-0410-a711-e3c959e3b870 --- .../tools/hunspellcheck/hunspellpluginimpl.cpp | 54 ++++++++++++++++++---- 1 file changed, 45 insertions(+), 9 deletions(-) (limited to 'scribus/plugins/tools/hunspellcheck/hunspellpluginimpl.cpp') diff --git a/scribus/plugins/tools/hunspellcheck/hunspellpluginimpl.cpp b/scribus/plugins/tools/hunspellcheck/hunspellpluginimpl.cpp index 1b169e7..8fff975 100644 --- a/scribus/plugins/tools/hunspellcheck/hunspellpluginimpl.cpp +++ b/scribus/plugins/tools/hunspellcheck/hunspellpluginimpl.cpp @@ -12,6 +12,7 @@ for which a new license (GPL+exception) is in place. #include "scpaths.h" #include "scribusdoc.h" #include "scribus.h" +#include "storyeditor.h" #include "text/specialchars.h" #include "util.h" @@ -31,6 +32,8 @@ HunspellPluginImpl::HunspellPluginImpl() : QObject(0) { hspellers=NULL; numDicts=0; + m_runningForSE=false; + m_SE=NULL; } HunspellPluginImpl::~HunspellPluginImpl() @@ -55,7 +58,17 @@ bool HunspellPluginImpl::run(const QString & target, ScribusDoc* doc) qDebug()<<"Hunspell Init Ok:"<m_Selection->count(); ++i ) { frameToCheck = m_doc->m_Selection->itemAt(i); - parseTextFrame(frameToCheck); - openGUIForTextFrame(frameToCheck); + StoryText *iText=&frameToCheck->itemText; + parseTextFrame(iText); + openGUIForTextFrame(iText); m_doc->view()->DrawNew(); } return true; } -bool HunspellPluginImpl::parseTextFrame(PageItem *frameToCheck) +bool HunspellPluginImpl::checkWithHunspellSE() +{ + StoryText *iText=&(m_SE->Editor->StyledText); + parseTextFrame(iText); + openGUIForStoryEditor(iText); + m_SE->Editor->updateAll(); + return true; +} + +bool HunspellPluginImpl::parseTextFrame(StoryText *iText) { - StoryText *iText=&frameToCheck->itemText; int len=iText->length(); - QString text=iText->text(0,len); -// qDebug()<scMW(), m_doc, frameToCheck); + HunspellDialog hsDialog(m_doc->scMW(), m_doc, iText); hsDialog.set(&dictEntries, hspellers, &wordsToCorrect); hsDialog.exec(); if (hsDialog.docChanged()) @@ -195,3 +215,19 @@ bool HunspellPluginImpl::openGUIForTextFrame(PageItem *frameToCheck) return true; } +bool HunspellPluginImpl::openGUIForStoryEditor(StoryText *iText) +{ + m_SE->setSpellActive(true); + HunspellDialog hsDialog(m_SE, m_doc, iText); + hsDialog.set(&dictEntries, hspellers, &wordsToCorrect); + hsDialog.exec(); + m_SE->setSpellActive(false); + return true; +} + +void HunspellPluginImpl::setRunningForSE(bool rfSE, StoryEditor *sE) +{ + m_runningForSE=rfSE; + m_SE=sE; +} + -- cgit