mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-14 06:57:01 +00:00
2a31934f38
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8766 a592a061-630c-0410-9148-cb99ea01b6c8
66 lines
1.3 KiB
C
66 lines
1.3 KiB
C
/**
|
|
* \file ControlThesaurus.C
|
|
* This file is part of LyX, the document processor.
|
|
* Licence details can be found in the file COPYING.
|
|
*
|
|
* \author John Levon
|
|
*
|
|
* Full author contact details are available in file CREDITS.
|
|
*/
|
|
|
|
#include <config.h>
|
|
|
|
#include "ControlThesaurus.h"
|
|
|
|
#include "lyxfind.h"
|
|
#include "funcrequest.h"
|
|
|
|
using std::string;
|
|
|
|
namespace lyx {
|
|
namespace frontend {
|
|
|
|
ControlThesaurus::ControlThesaurus(Dialog & parent)
|
|
: Dialog::Controller(parent)
|
|
{}
|
|
|
|
|
|
bool ControlThesaurus::initialiseParams(string const & data)
|
|
{
|
|
oldstr_ = data;
|
|
return true;
|
|
}
|
|
|
|
|
|
void ControlThesaurus::clearParams()
|
|
{
|
|
oldstr_.erase();
|
|
}
|
|
|
|
|
|
void ControlThesaurus::replace(string const & newstr)
|
|
{
|
|
/* FIXME: this is not suitable ! We need to have a "lock"
|
|
* on a particular charpos in a paragraph that is broken on
|
|
* deletion/change !
|
|
*/
|
|
string const data =
|
|
find::replace2string(oldstr_, newstr,
|
|
true, // case sensitive
|
|
true, // match word
|
|
false, // all words
|
|
true); // forward
|
|
kernel().dispatch(FuncRequest(LFUN_WORD_REPLACE, data));
|
|
}
|
|
|
|
|
|
Thesaurus::Meanings const & ControlThesaurus::getMeanings(string const & str)
|
|
{
|
|
if (str != laststr_)
|
|
meanings_ = thesaurus.lookup(str);
|
|
return meanings_;
|
|
}
|
|
|
|
} // namespace frontend
|
|
} // namespace lyx
|