diff options
Diffstat (limited to 'cui/source/dialogs/thesdlg.cxx')
-rw-r--r-- | cui/source/dialogs/thesdlg.cxx | 54 |
1 files changed, 13 insertions, 41 deletions
diff --git a/cui/source/dialogs/thesdlg.cxx b/cui/source/dialogs/thesdlg.cxx index 6c28969d43f8..ddd77621f322 100644 --- a/cui/source/dialogs/thesdlg.cxx +++ b/cui/source/dialogs/thesdlg.cxx @@ -51,6 +51,7 @@ #include <i18npool/mslangid.hxx> #include <comphelper/processfactory.hxx> #include <osl/file.hxx> +#include <svl/lngmisc.hxx> #include <stack> #include <algorithm> @@ -64,35 +65,6 @@ using ::rtl::OUString; #define A2S(x) String::CreateFromAscii( x ) -// GetReplaceEditString ------------------------------- - -static void GetReplaceEditString( String &rText ) -{ - // The strings returned by the thesaurus saometimes have some - // explanation text put in between '(' and ')' or a trailing '*'. - // These parts should not be put in the ReplaceEdit Text that may get - // inserted into the document. Thus we strip them from the text. - - xub_StrLen nPos = rText.Search( sal_Unicode('(') ); - while (STRING_NOTFOUND != nPos) - { - xub_StrLen nEnd = rText.Search( sal_Unicode(')'), nPos ); - if (STRING_NOTFOUND != nEnd) - rText.Erase( nPos, nEnd-nPos+1 ); - else - break; - nPos = rText.Search( sal_Unicode('(') ); - } - - nPos = rText.Search( sal_Unicode('*') ); - if (STRING_NOTFOUND != nPos) - rText.Erase( nPos ); - - // remove any possible remaining ' ' that may confuse the thesaurus - // when it gets called with the text - rText.EraseLeadingAndTrailingChars( sal_Unicode(' ') ); -} - // class LookUpComboBox_Impl -------------------------------------------------- LookUpComboBox_Impl::LookUpComboBox_Impl( @@ -103,7 +75,7 @@ LookUpComboBox_Impl::LookUpComboBox_Impl( m_aModifyTimer.SetTimeoutHdl( LINK( this, LookUpComboBox_Impl, ModifyTimer_Hdl ) ); m_aModifyTimer.SetTimeout( 500 ); - EnableAutocomplete( FALSE ); + EnableAutocomplete( sal_False ); } LookUpComboBox_Impl::~LookUpComboBox_Impl() @@ -156,7 +128,7 @@ void ReplaceEdit_Impl::SetText( const XubString& rStr, const Selection& rNewSele AlternativesString_Impl::AlternativesString_Impl( ThesaurusAlternativesCtrl_Impl &rControl, - SvLBoxEntry* pEntry, USHORT nFlags, const String& rStr ) : + SvLBoxEntry* pEntry, sal_uInt16 nFlags, const String& rStr ) : SvLBoxString( pEntry, nFlags, rStr ), m_rControlImpl( rControl ) @@ -165,7 +137,7 @@ AlternativesString_Impl::AlternativesString_Impl( void AlternativesString_Impl::Paint( const Point& rPos, - SvLBox& rDev, USHORT, + SvLBox& rDev, sal_uInt16, SvLBoxEntry* pEntry ) { AlternativesExtraData* pData = m_rControlImpl.GetExtraData( pEntry ); @@ -190,7 +162,7 @@ ThesaurusAlternativesCtrl_Impl::ThesaurusAlternativesCtrl_Impl( SvxCheckListBox( pParent, CUI_RES( CT_THES_ALTERNATIVES ) ), m_rDialogImpl( rImpl ) { - SetWindowBits( WB_CLIPCHILDREN | WB_HSCROLL | WB_FORCE_MAKEVISIBLE ); + SetStyle( GetStyle() | WB_CLIPCHILDREN | WB_HSCROLL | WB_FORCE_MAKEVISIBLE ); SetHighlightRange(); } @@ -358,7 +330,7 @@ bool SvxThesaurusDialog_Impl::UpdateAlternativesBox_Impl() const sal_Int32 nMeanings = aMeanings.getLength(); const uno::Reference< linguistic2::XMeaning > *pMeanings = aMeanings.getConstArray(); - m_pAlternativesCT->SetUpdateMode( FALSE ); + m_pAlternativesCT->SetUpdateMode( sal_False ); // clear old user data of control before creating new ones via AddEntry below m_pAlternativesCT->ClearExtraData(); @@ -378,7 +350,7 @@ bool SvxThesaurusDialog_Impl::UpdateAlternativesBox_Impl() m_pAlternativesCT->AddEntry( -1, pSynonyms[k], false ); } - m_pAlternativesCT->SetUpdateMode( TRUE ); + m_pAlternativesCT->SetUpdateMode( sal_True ); return nMeanings > 0; } @@ -407,7 +379,7 @@ IMPL_LINK( SvxThesaurusDialog_Impl, LanguageHdl_Impl, MenuButton *, pBtn ) PopupMenu *pMenu = aLangMBtn.GetPopupMenu(); if (pMenu && pBtn) { - USHORT nItem = pBtn->GetCurItemId(); + sal_uInt16 nItem = pBtn->GetCurItemId(); String aLangText( pMenu->GetItemText( nItem ) ); LanguageType nLang = SvtLanguageTable().GetType( aLangText ); DBG_ASSERT( nLang != LANGUAGE_NONE && nLang != LANGUAGE_DONTKNOW, "failed to get language" ); @@ -443,9 +415,9 @@ IMPL_LINK( SvxThesaurusDialog_Impl, WordSelectHdl_Impl, ComboBox *, pBox ) { if (pBox && !aWordCB.IsTravelSelect()) // act only upon return key and not when traveling with cursor keys { - USHORT nPos = pBox->GetSelectEntryPos(); + sal_uInt16 nPos = pBox->GetSelectEntryPos(); String aStr( pBox->GetEntry( nPos ) ); - GetReplaceEditString( aStr ); + aStr = linguistic::GetThesaurusReplaceText( aStr ); aWordCB.SetText( aStr ); LookUp_Impl(); } @@ -463,7 +435,7 @@ IMPL_LINK( SvxThesaurusDialog_Impl, AlternativesSelectHdl_Impl, SvxCheckListBox if (pData && !pData->IsHeader()) { aStr = pData->GetText(); - GetReplaceEditString( aStr ); + aStr = linguistic::GetThesaurusReplaceText( aStr ); } aReplaceEdit.SetText( aStr ); } @@ -480,7 +452,7 @@ IMPL_LINK( SvxThesaurusDialog_Impl, AlternativesDoubleClickHdl_Impl, SvxCheckLis if (pData && !pData->IsHeader()) { aStr = pData->GetText(); - GetReplaceEditString( aStr ); + aStr = linguistic::GetThesaurusReplaceText( aStr ); } aWordCB.SetText( aStr ); @@ -680,7 +652,7 @@ SvxThesaurusDialog::SvxThesaurusDialog( } std::sort( aLangVec.begin(), aLangVec.end() ); for (size_t i = 0; i < aLangVec.size(); ++i) - pMenu->InsertItem( (USHORT)i+1, aLangVec[i] ); // menu items should be enumerated from 1 and not 0 + pMenu->InsertItem( (sal_uInt16)i+1, aLangVec[i] ); // menu items should be enumerated from 1 and not 0 m_pImpl->aLangMBtn.SetPopupMenu( pMenu ); SetWindowTitle( nLanguage ); |