33#include <com/sun/star/linguistic2/XThesaurus.hpp>
34#include <com/sun/star/linguistic2/XMeaning.hpp>
40 LookUp(m_xWordCB->get_active_text());
46 m_xReplaceBtn->set_sensitive(!m_xReplaceEdit->get_text().isEmpty());
64 const lang::Locale& rLocale,
65 const beans::PropertyValues& rProperties )
68 xThesaurus->queryMeanings( rTerm, rLocale, rProperties ) );
71 if ( !aMeanings.hasElements() && rTerm.endsWith(
".") )
76 aMeanings =
xThesaurus->queryMeanings( aTxt, rLocale, rProperties );
77 if (aMeanings.hasElements())
91 const sal_Int32 nMeanings = aMeanings.getLength();
98 for (sal_Int32
i = 0;
i < nMeanings; ++
i)
100 OUString rMeaningTxt = pMeanings[
i]->getMeaning();
102 const sal_Int32 nSynonyms = aSynonyms.getLength();
103 const OUString *pSynonyms = aSynonyms.getConstArray();
104 DBG_ASSERT( !rMeaningTxt.isEmpty(),
"meaning with empty text" );
105 DBG_ASSERT( nSynonyms > 0,
"meaning without synonym" );
107 OUString sHeading = OUString::number(
i + 1) +
". " + rMeaningTxt;
112 for (sal_Int32 k = 0; k < nSynonyms; ++k)
123 return nMeanings > 0;
128 if (rText !=
m_xWordCB->get_active_text())
135 if (aLookUpHistory.size() >= 2)
137 aLookUpHistory.pop();
138 m_xWordCB->set_entry_text(aLookUpHistory.top());
139 aLookUpHistory.pop();
146 OUString aLangText(rLB.get_active_text());
150 nLookUpLanguage = nLang;
151 SetWindowTitle( nLang );
157 OUString aText(
m_xWordCB->get_active_text());
181 m_aModifyIdle.Start();
186 int nEntry = rBox.get_selected_index();
189 bool bIsHeader = rBox.get_text_emphasis(nEntry, 0);
196 m_xReplaceEdit->set_text(
aStr);
197 ReplaceEditHdl_Impl(*m_xReplaceEdit);
203 int nEntry = rBox.get_selected_index();
206 bool bIsHeader = rBox.get_text_emphasis(nEntry, 0);
213 m_xWordCB->set_entry_text(
aStr);
220 if (!m_nSelectFirstEvent)
228 m_nSelectFirstEvent =
nullptr;
229 if (m_xAlternativesCT->n_children() >= 2)
231 m_xAlternativesCT->select(1);
232 AlternativesSelectHdl_Impl(*m_xAlternativesCT);
241 const OUString &rWord,
244 , m_aModifyIdle(
"cui SvxThesaurusDialog LookUp Modify")
246 , m_bWordFound(false)
247 , m_xLeftBtn(m_xBuilder->weld_button(
"left"))
248 , m_xWordCB(m_xBuilder->weld_combo_box(
"wordcb"))
249 , m_xAlternativesCT(m_xBuilder->weld_tree_view(
"alternatives"))
250 , m_xNotFound(m_xBuilder->weld_label(
"notfound"))
251 , m_xReplaceEdit(m_xBuilder->weld_entry(
"replaceed"))
252 , m_xLangLB(m_xBuilder->weld_combo_box(
"langcb"))
253 , m_xReplaceBtn(m_xBuilder->weld_button(
"ok"))
254 , m_nSelectFirstEvent(nullptr)
272 if (!rWord.isEmpty())
275 OUString aTmp( rWord );
290 const sal_Int32 nLocales = aLocales.getLength();
291 const lang::Locale *pLocales = aLocales.getConstArray();
293 std::vector< OUString > aLangVec;
294 for (sal_Int32
i = 0;
i < nLocales; ++
i)
300 std::sort( aLangVec.begin(), aLangVec.end() );
302 for (
const OUString &
i : aLangVec)
306 std::vector< OUString >::iterator aI = std::find(aLangVec.begin(), aLangVec.end(),
308 if (aI != aLangVec.end())
Reference< XExecutableDialog > m_xDialog
static ImplSVEvent * PostUserEvent(const Link< void *, void > &rLink, void *pCaller=nullptr, bool bReferenceLink=false)
static void RemoveUserEvent(ImplSVEvent *nUserEvent)
static css::lang::Locale convertToLocale(LanguageType nLangID, bool bResolveSystem=true)
static LanguageType convertToLanguageType(const css::lang::Locale &rLocale, bool bResolveSystem=true)
static OUString GetLanguageString(const LanguageType eType)
static LanguageType GetLanguageType(std::u16string_view rStr)
std::unique_ptr< weld::Button > m_xReplaceBtn
void LookUp(const OUString &rText)
std::unique_ptr< weld::TreeView > m_xAlternativesCT
std::unique_ptr< weld::ComboBox > m_xLangLB
std::unique_ptr< weld::Entry > m_xReplaceEdit
LanguageType nLookUpLanguage
css::uno::Reference< css::linguistic2::XThesaurus > xThesaurus
virtual ~SvxThesaurusDialog() override
void SetWindowTitle(LanguageType nLanguage)
std::stack< OUString > aLookUpHistory
SvxThesaurusDialog(weld::Widget *pParent, css::uno::Reference< css::linguistic2::XThesaurus > const &xThesaurus, const OUString &rWord, LanguageType nLanguage)
ImplSVEvent * m_nSelectFirstEvent
std::unique_ptr< weld::ComboBox > m_xWordCB
bool UpdateAlternativesBox_Impl()
std::unique_ptr< weld::Button > m_xLeftBtn
std::unique_ptr< weld::Label > m_xNotFound
css::uno::Sequence< css::uno::Reference< css::linguistic2::XMeaning > > queryMeanings_Impl(OUString &rTerm, const css::lang::Locale &rLocale, const css::beans::PropertyValues &rProperties)
void SetPriority(TaskPriority ePriority)
void SetInvokeHandler(const Link< Timer *, void > &rLink)
sal_uInt16 GetCode() const
#define DBG_ASSERT(sCon, aError)
constexpr sal_uInt16 KEY_RETURN
#define LANGUAGE_DONTKNOW
#define LINK(Instance, Class, Member)
OString stripEnd(const OString &rIn, char c)
bool RemoveHyphens(OUString &rTxt)
OUString GetThesaurusReplaceText(const OUString &rText)
bool ReplaceControlChars(OUString &rTxt)
IMPL_LINK_NOARG(SvxThesaurusDialog, ModifyTimer_Hdl, Timer *, void)
IMPL_LINK(SvxThesaurusDialog, KeyInputHdl, const KeyEvent &, rKEvt, bool)