/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
// text with '.' at the end? if ( !aMeanings.hasElements() && rTerm.endsWith(".") )
{ // try again without trailing '.' chars. It may be a word at the // end of a sentence and not an abbreviation...
OUString aTxt(comphelper::string::stripEnd(rTerm, '.'));
aMeanings = xThesaurus->queryMeanings( aTxt, rLocale, rProperties ); if (aMeanings.hasElements())
{
rTerm = aTxt;
}
}
for (auto& synonym : aSynonyms)
{ // GetThesaurusReplaceText will strip the leading spaces
m_xAlternativesCT->append_text(" " + synonym);
m_xAlternativesCT->set_text_emphasis(nRow, false, 0);
++nRow;
}
}
m_xAlternativesCT->thaw();
return nMeanings > 0;
}
void SvxThesaurusDialog::LookUp( const OUString &rText )
{ if (rText != m_xWordCB->get_active_text()) // avoid moving of the cursor if the text is the same
m_xWordCB->set_entry_text(rText);
LookUp_Impl();
}
IMPL_LINK_NOARG(SvxThesaurusDialog, LeftBtnHdl_Impl, weld::Button&, void)
{ if (aLookUpHistory.size() >= 2)
{
aLookUpHistory.pop(); // remove current look up word from stack
m_xWordCB->set_entry_text(aLookUpHistory.top()); // retrieve previous look up word
aLookUpHistory.pop();
LookUp_Impl();
}
}
IMPL_LINK( SvxThesaurusDialog, AlternativesDoubleClickHdl_Impl, weld::TreeView&, rBox, bool )
{ int nEntry = rBox.get_selected_index(); if (nEntry != -1)
{ bool bIsHeader = rBox.get_text_emphasis(nEntry, 0); if (bIsHeader)
{
++nEntry;
rBox.select(nEntry);
}
OUString aStr = linguistic::GetThesaurusReplaceText(rBox.get_text(nEntry));
m_xWordCB->set_entry_text(aStr); if (!aStr.isEmpty())
LookUp_Impl();
}
//! workaround to set the selection since calling SelectEntryPos within //! the double click handler does not work if (!m_nSelectFirstEvent)
m_nSelectFirstEvent = Application::PostUserEvent(LINK(this, SvxThesaurusDialog, SelectFirstHdl_Impl));
returntrue;
}
IMPL_LINK_NOARG(SvxThesaurusDialog, SelectFirstHdl_Impl, void *, void)
{
m_nSelectFirstEvent = nullptr; if (m_xAlternativesCT->n_children() >= 2)
{
m_xAlternativesCT->select(1); // pos 0 is a 'header' that is not selectable
AlternativesSelectHdl_Impl(*m_xAlternativesCT);
}
}
// class SvxThesaurusDialog ----------------------------------------------
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.