1*2ee96f1cSAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*2ee96f1cSAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*2ee96f1cSAndrew Rist * or more contributor license agreements. See the NOTICE file 5*2ee96f1cSAndrew Rist * distributed with this work for additional information 6*2ee96f1cSAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*2ee96f1cSAndrew Rist * to you under the Apache License, Version 2.0 (the 8*2ee96f1cSAndrew Rist * "License"); you may not use this file except in compliance 9*2ee96f1cSAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*2ee96f1cSAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*2ee96f1cSAndrew Rist * Unless required by applicable law or agreed to in writing, 14*2ee96f1cSAndrew Rist * software distributed under the License is distributed on an 15*2ee96f1cSAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*2ee96f1cSAndrew Rist * KIND, either express or implied. See the License for the 17*2ee96f1cSAndrew Rist * specific language governing permissions and limitations 18*2ee96f1cSAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*2ee96f1cSAndrew Rist *************************************************************/ 21*2ee96f1cSAndrew Rist 22*2ee96f1cSAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir 26cdf0e10cSrcweir #include "precompiled_cui.hxx" 27cdf0e10cSrcweir 28cdf0e10cSrcweir #include "thesdlg.hrc" 29cdf0e10cSrcweir #include "thesdlg.hxx" 30cdf0e10cSrcweir #include "thesdlg_impl.hxx" 31cdf0e10cSrcweir #include "cuires.hrc" 32cdf0e10cSrcweir #include "dialmgr.hxx" 33cdf0e10cSrcweir 34cdf0e10cSrcweir #include <editeng/unolingu.hxx> 35cdf0e10cSrcweir #include <tools/shl.hxx> 36cdf0e10cSrcweir #include <svl/lngmisc.hxx> 37cdf0e10cSrcweir #include <svtools/filter.hxx> 38cdf0e10cSrcweir #include <svtools/svlbitm.hxx> 39cdf0e10cSrcweir #include <svtools/svtreebx.hxx> 40cdf0e10cSrcweir #include <vcl/wrkwin.hxx> 41cdf0e10cSrcweir #include <vcl/msgbox.hxx> 42cdf0e10cSrcweir #include <vcl/svapp.hxx> 43cdf0e10cSrcweir #include <com/sun/star/linguistic2/XThesaurus.hpp> 44cdf0e10cSrcweir #include <com/sun/star/linguistic2/XMeaning.hpp> 45cdf0e10cSrcweir #include <thesdlg.hxx> 46cdf0e10cSrcweir #include <svx/dlgutil.hxx> 47cdf0e10cSrcweir #include <svx/dialmgr.hxx> 48cdf0e10cSrcweir #include <svx/svxerr.hxx> 49cdf0e10cSrcweir #include <editeng/unolingu.hxx> 50cdf0e10cSrcweir #include <svx/langbox.hxx> 51cdf0e10cSrcweir #include <svtools/langtab.hxx> 52cdf0e10cSrcweir #include <unotools/lingucfg.hxx> 53cdf0e10cSrcweir #include <i18npool/mslangid.hxx> 54cdf0e10cSrcweir #include <comphelper/processfactory.hxx> 55cdf0e10cSrcweir #include <osl/file.hxx> 56cdf0e10cSrcweir #include <svl/lngmisc.hxx> 57cdf0e10cSrcweir 58cdf0e10cSrcweir 59cdf0e10cSrcweir #include <stack> 60cdf0e10cSrcweir #include <algorithm> 61cdf0e10cSrcweir 62cdf0e10cSrcweir #include <com/sun/star/linguistic2/XThesaurus.hpp> 63cdf0e10cSrcweir #include <com/sun/star/linguistic2/XMeaning.hpp> 64cdf0e10cSrcweir #include <com/sun/star/linguistic2/XLinguServiceManager.hpp> 65cdf0e10cSrcweir 66cdf0e10cSrcweir using namespace ::com::sun::star; 67cdf0e10cSrcweir using ::rtl::OUString; 68cdf0e10cSrcweir 69cdf0e10cSrcweir 70cdf0e10cSrcweir #define A2S(x) String::CreateFromAscii( x ) 71cdf0e10cSrcweir 72cdf0e10cSrcweir 73cdf0e10cSrcweir // class LookUpComboBox_Impl -------------------------------------------------- 74cdf0e10cSrcweir 75cdf0e10cSrcweir LookUpComboBox_Impl::LookUpComboBox_Impl( 76cdf0e10cSrcweir Window *pParent, const ResId &rResId, SvxThesaurusDialog_Impl &rImpl ) : 77cdf0e10cSrcweir ComboBox (pParent, rResId), 78cdf0e10cSrcweir m_rDialogImpl( rImpl ) 79cdf0e10cSrcweir { 80cdf0e10cSrcweir m_aModifyTimer.SetTimeoutHdl( LINK( this, LookUpComboBox_Impl, ModifyTimer_Hdl ) ); 81cdf0e10cSrcweir m_aModifyTimer.SetTimeout( 500 ); 82cdf0e10cSrcweir 83cdf0e10cSrcweir EnableAutocomplete( sal_False ); 84cdf0e10cSrcweir } 85cdf0e10cSrcweir 86cdf0e10cSrcweir 87cdf0e10cSrcweir LookUpComboBox_Impl::~LookUpComboBox_Impl() 88cdf0e10cSrcweir { 89cdf0e10cSrcweir } 90cdf0e10cSrcweir 91cdf0e10cSrcweir 92cdf0e10cSrcweir void LookUpComboBox_Impl::Modify() 93cdf0e10cSrcweir { 94cdf0e10cSrcweir m_aModifyTimer.Start(); 95cdf0e10cSrcweir } 96cdf0e10cSrcweir 97cdf0e10cSrcweir 98cdf0e10cSrcweir IMPL_LINK( LookUpComboBox_Impl, ModifyTimer_Hdl, Timer *, EMPTYARG /*pTimer*/ ) 99cdf0e10cSrcweir { 100cdf0e10cSrcweir m_rDialogImpl.LookUp( GetText() ); 101cdf0e10cSrcweir m_aModifyTimer.Stop(); 102cdf0e10cSrcweir return 0; 103cdf0e10cSrcweir } 104cdf0e10cSrcweir 105cdf0e10cSrcweir 106cdf0e10cSrcweir // class ReplaceEdit_Impl -------------------------------------------------- 107cdf0e10cSrcweir 108cdf0e10cSrcweir ReplaceEdit_Impl::ReplaceEdit_Impl( 109cdf0e10cSrcweir Window *pParent, const ResId &rResId ) : 110cdf0e10cSrcweir Edit (pParent, rResId) 111cdf0e10cSrcweir { 112cdf0e10cSrcweir } 113cdf0e10cSrcweir 114cdf0e10cSrcweir 115cdf0e10cSrcweir ReplaceEdit_Impl::~ReplaceEdit_Impl() 116cdf0e10cSrcweir { 117cdf0e10cSrcweir } 118cdf0e10cSrcweir 119cdf0e10cSrcweir 120cdf0e10cSrcweir void ReplaceEdit_Impl::Modify() 121cdf0e10cSrcweir { 122cdf0e10cSrcweir if (m_pBtn) 123cdf0e10cSrcweir m_pBtn->Enable( GetText().Len() > 0 ); 124cdf0e10cSrcweir } 125cdf0e10cSrcweir 126cdf0e10cSrcweir void ReplaceEdit_Impl::SetText( const XubString& rStr ) 127cdf0e10cSrcweir { 128cdf0e10cSrcweir Edit::SetText( rStr ); 129cdf0e10cSrcweir Modify(); 130cdf0e10cSrcweir } 131cdf0e10cSrcweir 132cdf0e10cSrcweir 133cdf0e10cSrcweir void ReplaceEdit_Impl::SetText( const XubString& rStr, const Selection& rNewSelection ) 134cdf0e10cSrcweir { 135cdf0e10cSrcweir Edit::SetText( rStr, rNewSelection ); 136cdf0e10cSrcweir Modify(); 137cdf0e10cSrcweir } 138cdf0e10cSrcweir 139cdf0e10cSrcweir 140cdf0e10cSrcweir // class ThesaurusAlternativesCtrl_Impl ---------------------------------- 141cdf0e10cSrcweir 142cdf0e10cSrcweir AlternativesString_Impl::AlternativesString_Impl( 143cdf0e10cSrcweir ThesaurusAlternativesCtrl_Impl &rControl, 144cdf0e10cSrcweir SvLBoxEntry* pEntry, sal_uInt16 nFlags, const String& rStr ) : 145cdf0e10cSrcweir // 146cdf0e10cSrcweir SvLBoxString( pEntry, nFlags, rStr ), 147cdf0e10cSrcweir m_rControlImpl( rControl ) 148cdf0e10cSrcweir { 149cdf0e10cSrcweir } 150cdf0e10cSrcweir 151cdf0e10cSrcweir void AlternativesString_Impl::Paint( 152cdf0e10cSrcweir const Point& rPos, 153cdf0e10cSrcweir SvLBox& rDev, sal_uInt16, 154cdf0e10cSrcweir SvLBoxEntry* pEntry ) 155cdf0e10cSrcweir { 156cdf0e10cSrcweir AlternativesExtraData* pData = m_rControlImpl.GetExtraData( pEntry ); 157cdf0e10cSrcweir Point aPos( rPos ); 158cdf0e10cSrcweir Font aOldFont( rDev.GetFont()); 159cdf0e10cSrcweir if (pData && pData->IsHeader()) 160cdf0e10cSrcweir { 161cdf0e10cSrcweir Font aFont( aOldFont ); 162cdf0e10cSrcweir aFont.SetWeight( WEIGHT_BOLD ); 163cdf0e10cSrcweir rDev.SetFont( aFont ); 164cdf0e10cSrcweir aPos.X() = 0; 165cdf0e10cSrcweir } 166cdf0e10cSrcweir else 167cdf0e10cSrcweir aPos.X() += 5; 168cdf0e10cSrcweir rDev.DrawText( aPos, GetText() ); 169cdf0e10cSrcweir rDev.SetFont( aOldFont ); 170cdf0e10cSrcweir } 171cdf0e10cSrcweir 172cdf0e10cSrcweir 173cdf0e10cSrcweir ThesaurusAlternativesCtrl_Impl::ThesaurusAlternativesCtrl_Impl( 174cdf0e10cSrcweir Window* pParent, 175cdf0e10cSrcweir SvxThesaurusDialog_Impl &rImpl ) : 176cdf0e10cSrcweir SvxCheckListBox( pParent, CUI_RES( CT_THES_ALTERNATIVES ) ), 177cdf0e10cSrcweir m_rDialogImpl( rImpl ) 178cdf0e10cSrcweir { 179cdf0e10cSrcweir SetStyle( GetStyle() | WB_CLIPCHILDREN | WB_HSCROLL | WB_FORCE_MAKEVISIBLE ); 180cdf0e10cSrcweir SetHighlightRange(); 181cdf0e10cSrcweir } 182cdf0e10cSrcweir 183cdf0e10cSrcweir 184cdf0e10cSrcweir ThesaurusAlternativesCtrl_Impl::~ThesaurusAlternativesCtrl_Impl() 185cdf0e10cSrcweir { 186cdf0e10cSrcweir ClearExtraData(); 187cdf0e10cSrcweir } 188cdf0e10cSrcweir 189cdf0e10cSrcweir 190cdf0e10cSrcweir void ThesaurusAlternativesCtrl_Impl::ClearExtraData() 191cdf0e10cSrcweir { 192cdf0e10cSrcweir UserDataMap_t aEmpty; 193cdf0e10cSrcweir m_aUserData.swap( aEmpty ); 194cdf0e10cSrcweir } 195cdf0e10cSrcweir 196cdf0e10cSrcweir 197cdf0e10cSrcweir void ThesaurusAlternativesCtrl_Impl::SetExtraData( 198cdf0e10cSrcweir const SvLBoxEntry *pEntry, 199cdf0e10cSrcweir const AlternativesExtraData &rData ) 200cdf0e10cSrcweir { 201cdf0e10cSrcweir if (!pEntry) 202cdf0e10cSrcweir return; 203cdf0e10cSrcweir 204cdf0e10cSrcweir UserDataMap_t::iterator aIt( m_aUserData.find( pEntry ) ); 205cdf0e10cSrcweir if (aIt != m_aUserData.end()) 206cdf0e10cSrcweir aIt->second = rData; 207cdf0e10cSrcweir else 208cdf0e10cSrcweir m_aUserData[ pEntry ] = rData; 209cdf0e10cSrcweir } 210cdf0e10cSrcweir 211cdf0e10cSrcweir 212cdf0e10cSrcweir AlternativesExtraData * ThesaurusAlternativesCtrl_Impl::GetExtraData( 213cdf0e10cSrcweir const SvLBoxEntry *pEntry ) 214cdf0e10cSrcweir { 215cdf0e10cSrcweir AlternativesExtraData *pRes = NULL; 216cdf0e10cSrcweir UserDataMap_t::iterator aIt( m_aUserData.find( pEntry ) ); 217cdf0e10cSrcweir if (aIt != m_aUserData.end()) 218cdf0e10cSrcweir pRes = &aIt->second; 219cdf0e10cSrcweir return pRes; 220cdf0e10cSrcweir } 221cdf0e10cSrcweir 222cdf0e10cSrcweir 223cdf0e10cSrcweir SvLBoxEntry * ThesaurusAlternativesCtrl_Impl::AddEntry( sal_Int32 nVal, const String &rText, bool bIsHeader ) 224cdf0e10cSrcweir { 225cdf0e10cSrcweir SvLBoxEntry* pEntry = new SvLBoxEntry; 226cdf0e10cSrcweir String aText; 227cdf0e10cSrcweir if (bIsHeader && nVal >= 0) 228cdf0e10cSrcweir { 229cdf0e10cSrcweir aText = String::CreateFromInt32( nVal ); 230cdf0e10cSrcweir aText += A2S( ". " ); 231cdf0e10cSrcweir } 232cdf0e10cSrcweir pEntry->AddItem( new SvLBoxString( pEntry, 0, String() ) ); // add empty column 233cdf0e10cSrcweir aText += rText; 234cdf0e10cSrcweir pEntry->AddItem( new SvLBoxContextBmp( pEntry, 0, Image(), Image(), 0 ) ); // otherwise crash 235cdf0e10cSrcweir pEntry->AddItem( new AlternativesString_Impl( *this, pEntry, 0, aText ) ); 236cdf0e10cSrcweir 237cdf0e10cSrcweir SetExtraData( pEntry, AlternativesExtraData( rText, bIsHeader ) ); 238cdf0e10cSrcweir GetModel()->Insert( pEntry ); 239cdf0e10cSrcweir 240cdf0e10cSrcweir if (bIsHeader) 241cdf0e10cSrcweir GetViewDataEntry( pEntry )->SetSelectable( false ); 242cdf0e10cSrcweir 243cdf0e10cSrcweir return pEntry; 244cdf0e10cSrcweir } 245cdf0e10cSrcweir 246cdf0e10cSrcweir 247cdf0e10cSrcweir void ThesaurusAlternativesCtrl_Impl::KeyInput( const KeyEvent& rKEvt ) 248cdf0e10cSrcweir { 249cdf0e10cSrcweir const KeyCode& rKey = rKEvt.GetKeyCode(); 250cdf0e10cSrcweir 251cdf0e10cSrcweir if (rKey.GetCode() == KEY_RETURN || rKey.GetCode() == KEY_ESCAPE) 252cdf0e10cSrcweir GetParent()->KeyInput( rKEvt ); // parent will close dialog... 253cdf0e10cSrcweir else if (rKey.GetCode() == KEY_SPACE) 254cdf0e10cSrcweir m_rDialogImpl.AlternativesDoubleClickHdl_Impl( this ); // look up current selected entry 255cdf0e10cSrcweir else if (GetEntryCount()) 256cdf0e10cSrcweir SvxCheckListBox::KeyInput( rKEvt ); 257cdf0e10cSrcweir } 258cdf0e10cSrcweir 259cdf0e10cSrcweir 260cdf0e10cSrcweir void ThesaurusAlternativesCtrl_Impl::Paint( const Rectangle& rRect ) 261cdf0e10cSrcweir { 262cdf0e10cSrcweir if (!m_rDialogImpl.m_bWordFound) 263cdf0e10cSrcweir { 264cdf0e10cSrcweir /* Push( PUSH_FONT ); 265cdf0e10cSrcweir 266cdf0e10cSrcweir Font aFont( GetFont() ); 267cdf0e10cSrcweir aFont.SetHeight( 2 * aFont.GetHeight() ); 268cdf0e10cSrcweir SetFont( aFont ); 269cdf0e10cSrcweir */ 270cdf0e10cSrcweir Size aTextSize( GetTextWidth( m_rDialogImpl.aErrStr ), GetTextHeight() ); 271cdf0e10cSrcweir aTextSize = LogicToPixel( aTextSize ); 272cdf0e10cSrcweir Point aPos; 273cdf0e10cSrcweir aPos.X() += GetSizePixel().Width() / 2 - aTextSize.Width() / 2; 274cdf0e10cSrcweir aPos.Y() += GetSizePixel().Height() / 2 /*- aTextSize.Height() / 2*/; 275cdf0e10cSrcweir aPos = PixelToLogic( aPos ); 276cdf0e10cSrcweir DrawText( aPos, m_rDialogImpl.aErrStr ); 277cdf0e10cSrcweir 278cdf0e10cSrcweir // Pop(); 279cdf0e10cSrcweir } 280cdf0e10cSrcweir else 281cdf0e10cSrcweir SvxCheckListBox::Paint( rRect ); 282cdf0e10cSrcweir } 283cdf0e10cSrcweir 284cdf0e10cSrcweir 285cdf0e10cSrcweir // struct SvxThesaurusDialog_Impl ---------------------------------------- 286cdf0e10cSrcweir 287cdf0e10cSrcweir SvxThesaurusDialog_Impl::SvxThesaurusDialog_Impl( SvxThesaurusDialog * pDialog ) : 288cdf0e10cSrcweir m_pDialog ( pDialog ), 289cdf0e10cSrcweir aVendorImageFI ( pDialog, CUI_RES( IMG_VENDOR ) ), 290cdf0e10cSrcweir aLeftBtn ( pDialog, CUI_RES( BTN_LEFT ) ), 291cdf0e10cSrcweir aWordText ( pDialog, CUI_RES( FT_WORD ) ), 292cdf0e10cSrcweir aWordCB ( pDialog, CUI_RES( CB_WORD ), *this ), 293cdf0e10cSrcweir m_aAlternativesText ( pDialog, CUI_RES( FT_THES_ALTERNATIVES ) ), 294cdf0e10cSrcweir m_pAlternativesCT ( new ThesaurusAlternativesCtrl_Impl( pDialog, *this ) ), 295cdf0e10cSrcweir aReplaceText ( pDialog, CUI_RES( FT_REPL ) ), 296cdf0e10cSrcweir aReplaceEdit ( pDialog, CUI_RES( ED_REPL ) ), 297cdf0e10cSrcweir aFL ( pDialog, CUI_RES( FL_VAR ) ), 298cdf0e10cSrcweir aHelpBtn ( pDialog, CUI_RES( BTN_THES_HELP ) ), 299cdf0e10cSrcweir aLangMBtn ( pDialog, CUI_RES( MB_LANGUAGE ) ), 300cdf0e10cSrcweir aReplaceBtn ( pDialog, CUI_RES( BTN_THES_OK ) ), 301cdf0e10cSrcweir aCancelBtn ( pDialog, CUI_RES( BTN_THES_CANCEL ) ), 302cdf0e10cSrcweir aErrStr ( CUI_RES( STR_ERR_TEXTNOTFOUND ) ), 303cdf0e10cSrcweir aVendorDefaultImage ( CUI_RES( IMG_DEFAULT_VENDOR ) ), 304cdf0e10cSrcweir aVendorDefaultImageHC ( CUI_RES( IMG_DEFAULT_VENDOR_HC ) ), 305cdf0e10cSrcweir xThesaurus ( NULL ), 306cdf0e10cSrcweir aLookUpText (), 307cdf0e10cSrcweir nLookUpLanguage ( LANGUAGE_NONE ), 308cdf0e10cSrcweir m_bWordFound( false ) 309cdf0e10cSrcweir { 310cdf0e10cSrcweir // note: FreeResource must only be called in the c-tor of SvxThesaurusDialog 311cdf0e10cSrcweir 312cdf0e10cSrcweir aReplaceEdit.SetButton( &aReplaceBtn ); 313cdf0e10cSrcweir 314cdf0e10cSrcweir aLeftBtn.SetClickHdl( LINK( this, SvxThesaurusDialog_Impl, LeftBtnHdl_Impl ) ); 315cdf0e10cSrcweir aWordCB.SetSelectHdl( LINK( this, SvxThesaurusDialog_Impl, WordSelectHdl_Impl ) ); 316cdf0e10cSrcweir aLangMBtn.SetSelectHdl( LINK( this, SvxThesaurusDialog_Impl, LanguageHdl_Impl ) ); 317cdf0e10cSrcweir m_pAlternativesCT->SetSelectHdl( LINK( this, SvxThesaurusDialog_Impl, AlternativesSelectHdl_Impl )); 318cdf0e10cSrcweir m_pAlternativesCT->SetDoubleClickHdl( LINK( this, SvxThesaurusDialog_Impl, AlternativesDoubleClickHdl_Impl )); 319cdf0e10cSrcweir 320cdf0e10cSrcweir Application::PostUserEvent( STATIC_LINK( this, SvxThesaurusDialog_Impl, VendorImageInitHdl ) ); 321cdf0e10cSrcweir } 322cdf0e10cSrcweir 323cdf0e10cSrcweir 324cdf0e10cSrcweir SvxThesaurusDialog_Impl::~SvxThesaurusDialog_Impl() 325cdf0e10cSrcweir { 326cdf0e10cSrcweir delete aLangMBtn.GetPopupMenu(); 327cdf0e10cSrcweir } 328cdf0e10cSrcweir 329cdf0e10cSrcweir 330cdf0e10cSrcweir uno::Sequence< uno::Reference< linguistic2::XMeaning > > SAL_CALL SvxThesaurusDialog_Impl::queryMeanings_Impl( 331cdf0e10cSrcweir OUString& rTerm, 332cdf0e10cSrcweir const lang::Locale& rLocale, 333cdf0e10cSrcweir const beans::PropertyValues& rProperties ) 334cdf0e10cSrcweir throw(lang::IllegalArgumentException, uno::RuntimeException) 335cdf0e10cSrcweir { 336cdf0e10cSrcweir uno::Sequence< uno::Reference< linguistic2::XMeaning > > aMeanings( 337cdf0e10cSrcweir xThesaurus->queryMeanings( rTerm, rLocale, rProperties ) ); 338cdf0e10cSrcweir 339cdf0e10cSrcweir // text with '.' at the end? 340cdf0e10cSrcweir if (0 == aMeanings.getLength() && rTerm.getLength() && 341cdf0e10cSrcweir rTerm.getStr()[ rTerm.getLength() - 1 ] == '.') 342cdf0e10cSrcweir { 343cdf0e10cSrcweir // try again without trailing '.' chars. It may be a word at the 344cdf0e10cSrcweir // end of a sentence and not an abbreviation... 345cdf0e10cSrcweir String aTxt( rTerm ); 346cdf0e10cSrcweir aTxt.EraseTrailingChars( '.' ); 347cdf0e10cSrcweir aMeanings = xThesaurus->queryMeanings( aTxt, rLocale, rProperties ); 348cdf0e10cSrcweir if (aMeanings.getLength()) 349cdf0e10cSrcweir { 350cdf0e10cSrcweir rTerm = aTxt; 351cdf0e10cSrcweir } 352cdf0e10cSrcweir } 353cdf0e10cSrcweir 354cdf0e10cSrcweir return aMeanings; 355cdf0e10cSrcweir } 356cdf0e10cSrcweir 357cdf0e10cSrcweir 358cdf0e10cSrcweir bool SvxThesaurusDialog_Impl::UpdateAlternativesBox_Impl() 359cdf0e10cSrcweir { 360cdf0e10cSrcweir lang::Locale aLocale( SvxCreateLocale( nLookUpLanguage ) ); 361cdf0e10cSrcweir uno::Sequence< uno::Reference< linguistic2::XMeaning > > aMeanings = queryMeanings_Impl( 362cdf0e10cSrcweir aLookUpText, aLocale, uno::Sequence< beans::PropertyValue >() ); 363cdf0e10cSrcweir const sal_Int32 nMeanings = aMeanings.getLength(); 364cdf0e10cSrcweir const uno::Reference< linguistic2::XMeaning > *pMeanings = aMeanings.getConstArray(); 365cdf0e10cSrcweir 366cdf0e10cSrcweir m_pAlternativesCT->SetUpdateMode( sal_False ); 367cdf0e10cSrcweir 368cdf0e10cSrcweir // clear old user data of control before creating new ones via AddEntry below 369cdf0e10cSrcweir m_pAlternativesCT->ClearExtraData(); 370cdf0e10cSrcweir 371cdf0e10cSrcweir m_pAlternativesCT->Clear(); 372cdf0e10cSrcweir for (sal_Int32 i = 0; i < nMeanings; ++i) 373cdf0e10cSrcweir { 374cdf0e10cSrcweir OUString rMeaningTxt = pMeanings[i]->getMeaning(); 375cdf0e10cSrcweir uno::Sequence< OUString > aSynonyms( pMeanings[i]->querySynonyms() ); 376cdf0e10cSrcweir const sal_Int32 nSynonyms = aSynonyms.getLength(); 377cdf0e10cSrcweir const OUString *pSynonyms = aSynonyms.getConstArray(); 378cdf0e10cSrcweir DBG_ASSERT( rMeaningTxt.getLength() > 0, "meaning with empty text" ); 379cdf0e10cSrcweir DBG_ASSERT( nSynonyms > 0, "meaning without synonym" ); 380cdf0e10cSrcweir 381cdf0e10cSrcweir m_pAlternativesCT->AddEntry( i + 1, rMeaningTxt, true ); 382cdf0e10cSrcweir for (sal_Int32 k = 0; k < nSynonyms; ++k) 383cdf0e10cSrcweir m_pAlternativesCT->AddEntry( -1, pSynonyms[k], false ); 384cdf0e10cSrcweir } 385cdf0e10cSrcweir 386cdf0e10cSrcweir m_pAlternativesCT->SetUpdateMode( sal_True ); 387cdf0e10cSrcweir 388cdf0e10cSrcweir return nMeanings > 0; 389cdf0e10cSrcweir } 390cdf0e10cSrcweir 391cdf0e10cSrcweir 392cdf0e10cSrcweir void SvxThesaurusDialog_Impl::LookUp( const String &rText ) 393cdf0e10cSrcweir { 394cdf0e10cSrcweir if (rText != aWordCB.GetText()) // avoid moving of the cursor if the text is the same 395cdf0e10cSrcweir aWordCB.SetText( rText ); 396cdf0e10cSrcweir LookUp_Impl(); 397cdf0e10cSrcweir } 398cdf0e10cSrcweir 399cdf0e10cSrcweir 400cdf0e10cSrcweir IMPL_LINK( SvxThesaurusDialog_Impl, LeftBtnHdl_Impl, Button *, pBtn ) 401cdf0e10cSrcweir { 402cdf0e10cSrcweir if (pBtn && aLookUpHistory.size() >= 2) 403cdf0e10cSrcweir { 404cdf0e10cSrcweir aLookUpHistory.pop(); // remove current look up word from stack 405cdf0e10cSrcweir aWordCB.SetText( aLookUpHistory.top() ); // retrieve previous look up word 406cdf0e10cSrcweir aLookUpHistory.pop(); 407cdf0e10cSrcweir LookUp_Impl(); 408cdf0e10cSrcweir } 409cdf0e10cSrcweir return 0; 410cdf0e10cSrcweir } 411cdf0e10cSrcweir 412cdf0e10cSrcweir 413cdf0e10cSrcweir IMPL_LINK( SvxThesaurusDialog_Impl, LanguageHdl_Impl, MenuButton *, pBtn ) 414cdf0e10cSrcweir { 415cdf0e10cSrcweir PopupMenu *pMenu = aLangMBtn.GetPopupMenu(); 416cdf0e10cSrcweir if (pMenu && pBtn) 417cdf0e10cSrcweir { 418cdf0e10cSrcweir sal_uInt16 nItem = pBtn->GetCurItemId(); 419cdf0e10cSrcweir String aLangText( pMenu->GetItemText( nItem ) ); 420cdf0e10cSrcweir LanguageType nLang = SvtLanguageTable().GetType( aLangText ); 421cdf0e10cSrcweir DBG_ASSERT( nLang != LANGUAGE_NONE && nLang != LANGUAGE_DONTKNOW, "failed to get language" ); 422cdf0e10cSrcweir if (xThesaurus->hasLocale( SvxCreateLocale( nLang ) )) 423cdf0e10cSrcweir nLookUpLanguage = nLang; 424cdf0e10cSrcweir m_pDialog->SetWindowTitle( nLang ); 425cdf0e10cSrcweir UpdateVendorImage(); 426cdf0e10cSrcweir LookUp_Impl(); 427cdf0e10cSrcweir } 428cdf0e10cSrcweir return 0; 429cdf0e10cSrcweir } 430cdf0e10cSrcweir 431cdf0e10cSrcweir 432cdf0e10cSrcweir void SvxThesaurusDialog_Impl::LookUp_Impl() 433cdf0e10cSrcweir { 434cdf0e10cSrcweir String aText( aWordCB.GetText() ); 435cdf0e10cSrcweir 436cdf0e10cSrcweir aLookUpText = OUString( aText ); 437cdf0e10cSrcweir if (aLookUpText.getLength() > 0 && 438cdf0e10cSrcweir (aLookUpHistory.size() == 0 || aLookUpText != aLookUpHistory.top())) 439cdf0e10cSrcweir aLookUpHistory.push( aLookUpText ); 440cdf0e10cSrcweir 441cdf0e10cSrcweir m_bWordFound = UpdateAlternativesBox_Impl(); 442cdf0e10cSrcweir m_pAlternativesCT->Enable( m_bWordFound ); 443cdf0e10cSrcweir 444cdf0e10cSrcweir if ( aWordCB.GetEntryPos( aText ) == LISTBOX_ENTRY_NOTFOUND ) 445cdf0e10cSrcweir aWordCB.InsertEntry( aText ); 446cdf0e10cSrcweir 447cdf0e10cSrcweir aReplaceEdit.SetText( String() ); 448cdf0e10cSrcweir aLeftBtn.Enable( aLookUpHistory.size() > 1 ); 449cdf0e10cSrcweir } 450cdf0e10cSrcweir 451cdf0e10cSrcweir 452cdf0e10cSrcweir IMPL_LINK( SvxThesaurusDialog_Impl, WordSelectHdl_Impl, ComboBox *, pBox ) 453cdf0e10cSrcweir { 454cdf0e10cSrcweir if (pBox && !aWordCB.IsTravelSelect()) // act only upon return key and not when traveling with cursor keys 455cdf0e10cSrcweir { 456cdf0e10cSrcweir sal_uInt16 nPos = pBox->GetSelectEntryPos(); 457cdf0e10cSrcweir String aStr( pBox->GetEntry( nPos ) ); 458cdf0e10cSrcweir aStr = linguistic::GetThesaurusReplaceText( aStr ); 459cdf0e10cSrcweir aWordCB.SetText( aStr ); 460cdf0e10cSrcweir LookUp_Impl(); 461cdf0e10cSrcweir } 462cdf0e10cSrcweir 463cdf0e10cSrcweir return 0; 464cdf0e10cSrcweir } 465cdf0e10cSrcweir 466cdf0e10cSrcweir 467cdf0e10cSrcweir IMPL_LINK( SvxThesaurusDialog_Impl, AlternativesSelectHdl_Impl, SvxCheckListBox *, pBox ) 468cdf0e10cSrcweir { 469cdf0e10cSrcweir SvLBoxEntry *pEntry = pBox ? pBox->GetCurEntry() : NULL; 470cdf0e10cSrcweir if (pEntry) 471cdf0e10cSrcweir { 472cdf0e10cSrcweir AlternativesExtraData * pData = m_pAlternativesCT->GetExtraData( pEntry ); 473cdf0e10cSrcweir String aStr; 474cdf0e10cSrcweir if (pData && !pData->IsHeader()) 475cdf0e10cSrcweir { 476cdf0e10cSrcweir aStr = pData->GetText(); 477cdf0e10cSrcweir aStr = linguistic::GetThesaurusReplaceText( aStr ); 478cdf0e10cSrcweir } 479cdf0e10cSrcweir aReplaceEdit.SetText( aStr ); 480cdf0e10cSrcweir } 481cdf0e10cSrcweir return 0; 482cdf0e10cSrcweir } 483cdf0e10cSrcweir 484cdf0e10cSrcweir 485cdf0e10cSrcweir IMPL_LINK( SvxThesaurusDialog_Impl, AlternativesDoubleClickHdl_Impl, SvxCheckListBox *, pBox ) 486cdf0e10cSrcweir { 487cdf0e10cSrcweir SvLBoxEntry *pEntry = pBox ? pBox->GetCurEntry() : NULL; 488cdf0e10cSrcweir if (pEntry) 489cdf0e10cSrcweir { 490cdf0e10cSrcweir AlternativesExtraData * pData = m_pAlternativesCT->GetExtraData( pEntry ); 491cdf0e10cSrcweir String aStr; 492cdf0e10cSrcweir if (pData && !pData->IsHeader()) 493cdf0e10cSrcweir { 494cdf0e10cSrcweir aStr = pData->GetText(); 495cdf0e10cSrcweir aStr = linguistic::GetThesaurusReplaceText( aStr ); 496cdf0e10cSrcweir } 497cdf0e10cSrcweir 498cdf0e10cSrcweir aWordCB.SetText( aStr ); 499cdf0e10cSrcweir if (aStr.Len() > 0) 500cdf0e10cSrcweir LookUp_Impl(); 501cdf0e10cSrcweir } 502cdf0e10cSrcweir 503cdf0e10cSrcweir //! workaround to set the selection since calling SelectEntryPos within 504cdf0e10cSrcweir //! the double click handler does not work 505cdf0e10cSrcweir Application::PostUserEvent( STATIC_LINK( this, SvxThesaurusDialog_Impl, SelectFirstHdl_Impl ), pBox ); 506cdf0e10cSrcweir return 0; 507cdf0e10cSrcweir } 508cdf0e10cSrcweir 509cdf0e10cSrcweir 510cdf0e10cSrcweir IMPL_STATIC_LINK( SvxThesaurusDialog_Impl, SelectFirstHdl_Impl, SvxCheckListBox *, pBox ) 511cdf0e10cSrcweir { 512cdf0e10cSrcweir (void) pThis; 513cdf0e10cSrcweir if (pBox && pBox->GetEntryCount() >= 2) 514cdf0e10cSrcweir pBox->SelectEntryPos( 1 ); // pos 0 is a 'header' that is not selectable 515cdf0e10cSrcweir return 0; 516cdf0e10cSrcweir } 517cdf0e10cSrcweir 518cdf0e10cSrcweir //////////////////////////////////////////////////////////// 519cdf0e10cSrcweir 520cdf0e10cSrcweir static Image lcl_GetImageFromPngUrl( const OUString &rFileUrl ) 521cdf0e10cSrcweir { 522cdf0e10cSrcweir Image aRes; 523cdf0e10cSrcweir 524cdf0e10cSrcweir OUString aTmp; 525cdf0e10cSrcweir osl::FileBase::getSystemPathFromFileURL( rFileUrl, aTmp ); 526cdf0e10cSrcweir 527cdf0e10cSrcweir Graphic aGraphic; 528cdf0e10cSrcweir const String aFilterName( RTL_CONSTASCII_USTRINGPARAM( IMP_PNG ) ); 529cdf0e10cSrcweir if( GRFILTER_OK == GraphicFilter::LoadGraphic( aTmp, aFilterName, aGraphic, NULL, NULL ) ) 530cdf0e10cSrcweir { 531cdf0e10cSrcweir aRes = Image( aGraphic.GetBitmapEx() ); 532cdf0e10cSrcweir } 533cdf0e10cSrcweir return aRes; 534cdf0e10cSrcweir } 535cdf0e10cSrcweir 536cdf0e10cSrcweir 537cdf0e10cSrcweir static String lcl_GetThesImplName( const lang::Locale &rLocale ) 538cdf0e10cSrcweir { 539cdf0e10cSrcweir String aRes; 540cdf0e10cSrcweir 541cdf0e10cSrcweir uno::Reference< linguistic2::XLinguServiceManager > xLngMgr; 542cdf0e10cSrcweir try 543cdf0e10cSrcweir { 544cdf0e10cSrcweir uno::Reference< lang::XMultiServiceFactory > xMSF( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW ); 545cdf0e10cSrcweir xLngMgr = uno::Reference< linguistic2::XLinguServiceManager >( xMSF->createInstance( 546cdf0e10cSrcweir OUString( RTL_CONSTASCII_USTRINGPARAM( 547cdf0e10cSrcweir "com.sun.star.linguistic2.LinguServiceManager" ))), uno::UNO_QUERY_THROW ); 548cdf0e10cSrcweir 549cdf0e10cSrcweir DBG_ASSERT( xLngMgr.is(), "LinguServiceManager missing" ); 550cdf0e10cSrcweir if (xLngMgr.is()) 551cdf0e10cSrcweir { 552cdf0e10cSrcweir uno::Sequence< OUString > aServiceNames = xLngMgr->getConfiguredServices( 553cdf0e10cSrcweir OUString::createFromAscii("com.sun.star.linguistic2.Thesaurus"), rLocale ); 554cdf0e10cSrcweir // there should be at most one thesaurus configured for each language 555cdf0e10cSrcweir DBG_ASSERT( aServiceNames.getLength() <= 1, "more than one thesaurus found. Should not be possible" ); 556cdf0e10cSrcweir if (aServiceNames.getLength() == 1) 557cdf0e10cSrcweir aRes = aServiceNames[0]; 558cdf0e10cSrcweir } 559cdf0e10cSrcweir } 560cdf0e10cSrcweir catch (uno::Exception &e) 561cdf0e10cSrcweir { 562cdf0e10cSrcweir (void) e; 563cdf0e10cSrcweir DBG_ASSERT( 0, "failed to get thesaurus" ); 564cdf0e10cSrcweir } 565cdf0e10cSrcweir 566cdf0e10cSrcweir return aRes; 567cdf0e10cSrcweir } 568cdf0e10cSrcweir 569cdf0e10cSrcweir 570cdf0e10cSrcweir void SvxThesaurusDialog_Impl::UpdateVendorImage() 571cdf0e10cSrcweir { 572cdf0e10cSrcweir m_pDialog->SetUpdateMode( sal_False ); 573cdf0e10cSrcweir 574cdf0e10cSrcweir SvtLinguConfig aCfg; 575cdf0e10cSrcweir if (aCfg.HasVendorImages( "ThesaurusDialogImage" )) 576cdf0e10cSrcweir { 577cdf0e10cSrcweir const bool bHC = Application::GetSettings().GetStyleSettings().GetHighContrastMode(); 578cdf0e10cSrcweir 579cdf0e10cSrcweir Image aImage; 580cdf0e10cSrcweir String sThesImplName( lcl_GetThesImplName( SvxCreateLocale( nLookUpLanguage ) ) ); 581cdf0e10cSrcweir OUString aThesDialogImageUrl( aCfg.GetThesaurusDialogImage( sThesImplName, bHC ) ); 582cdf0e10cSrcweir if (sThesImplName.Len() > 0 && aThesDialogImageUrl.getLength() > 0) 583cdf0e10cSrcweir aImage = Image( lcl_GetImageFromPngUrl( aThesDialogImageUrl ) ); 584cdf0e10cSrcweir else 585cdf0e10cSrcweir aImage = bHC ? aVendorDefaultImageHC : aVendorDefaultImage; 586cdf0e10cSrcweir aVendorImageFI.SetImage( aImage ); 587cdf0e10cSrcweir } 588cdf0e10cSrcweir 589cdf0e10cSrcweir m_pDialog->SetUpdateMode( sal_True ); 590cdf0e10cSrcweir } 591cdf0e10cSrcweir 592cdf0e10cSrcweir 593cdf0e10cSrcweir IMPL_STATIC_LINK( SvxThesaurusDialog_Impl, VendorImageInitHdl, SvxThesaurusDialog_Impl *, EMPTYARG ) 594cdf0e10cSrcweir { 595cdf0e10cSrcweir pThis->m_pDialog->SetUpdateMode( sal_False ); 596cdf0e10cSrcweir 597cdf0e10cSrcweir SvtLinguConfig aCfg; 598cdf0e10cSrcweir if (aCfg.HasVendorImages( "ThesaurusDialogImage" )) 599cdf0e10cSrcweir { 600cdf0e10cSrcweir const bool bHC = Application::GetSettings().GetStyleSettings().GetHighContrastMode(); 601cdf0e10cSrcweir Image aImage( bHC ? pThis->aVendorDefaultImageHC : pThis->aVendorDefaultImage ); 602cdf0e10cSrcweir pThis->aVendorImageFI.SetImage( aImage ); 603cdf0e10cSrcweir pThis->aVendorImageFI.Show(); 604cdf0e10cSrcweir 605cdf0e10cSrcweir // move down visible controls according to the vendor images height 606cdf0e10cSrcweir Size aVendorSize = pThis->aVendorImageFI.GetSizePixel(); 607cdf0e10cSrcweir Size aImageSize = pThis->aVendorImageFI.GetImage().GetSizePixel(); 608cdf0e10cSrcweir if (aImageSize.Height()) 609cdf0e10cSrcweir { 610cdf0e10cSrcweir aVendorSize.Height() = aImageSize.Height(); 611cdf0e10cSrcweir if(aVendorSize.Width() < aImageSize.Width()) 612cdf0e10cSrcweir aVendorSize.Width() = aImageSize.Width(); 613cdf0e10cSrcweir pThis->aVendorImageFI.SetSizePixel( aVendorSize ); 614cdf0e10cSrcweir } 615cdf0e10cSrcweir const sal_Int32 nDiff = aVendorSize.Height(); 616cdf0e10cSrcweir pThis->aVendorImageFI.SetSizePixel( aVendorSize ); 617cdf0e10cSrcweir Control* aControls[] = { 618cdf0e10cSrcweir &pThis->aLeftBtn, 619cdf0e10cSrcweir &pThis->aWordText, 620cdf0e10cSrcweir &pThis->aWordCB, 621cdf0e10cSrcweir &pThis->m_aAlternativesText, 622cdf0e10cSrcweir pThis->m_pAlternativesCT.get(), 623cdf0e10cSrcweir &pThis->aReplaceText, 624cdf0e10cSrcweir &pThis->aReplaceEdit, 625cdf0e10cSrcweir &pThis->aFL, 626cdf0e10cSrcweir &pThis->aHelpBtn, 627cdf0e10cSrcweir &pThis->aLangMBtn, 628cdf0e10cSrcweir &pThis->aReplaceBtn, 629cdf0e10cSrcweir &pThis->aCancelBtn, 630cdf0e10cSrcweir 0 631cdf0e10cSrcweir }; 632cdf0e10cSrcweir sal_Int32 nControl = 0; 633cdf0e10cSrcweir while (aControls[nControl]) 634cdf0e10cSrcweir { 635cdf0e10cSrcweir Point aPos = aControls[nControl]->GetPosPixel(); 636cdf0e10cSrcweir aPos.Y() += nDiff; 637cdf0e10cSrcweir aControls[nControl]->SetPosPixel(aPos); 638cdf0e10cSrcweir ++nControl; 639cdf0e10cSrcweir } 640cdf0e10cSrcweir Size aDlgSize = pThis->m_pDialog->GetSizePixel(); 641cdf0e10cSrcweir aDlgSize.Height() += nDiff; 642cdf0e10cSrcweir pThis->m_pDialog->SetSizePixel( aDlgSize ); 643cdf0e10cSrcweir pThis->m_pDialog->Invalidate(); 644cdf0e10cSrcweir } 645cdf0e10cSrcweir 646cdf0e10cSrcweir pThis->UpdateVendorImage(); 647cdf0e10cSrcweir pThis->m_pDialog->SetUpdateMode( sal_True ); 648cdf0e10cSrcweir 649cdf0e10cSrcweir return 0; 650cdf0e10cSrcweir }; 651cdf0e10cSrcweir 652cdf0e10cSrcweir 653cdf0e10cSrcweir // class SvxThesaurusDialog ---------------------------------------------- 654cdf0e10cSrcweir 655cdf0e10cSrcweir SvxThesaurusDialog::SvxThesaurusDialog( 656cdf0e10cSrcweir Window* pParent, 657cdf0e10cSrcweir uno::Reference< linguistic2::XThesaurus > xThes, 658cdf0e10cSrcweir const String &rWord, 659cdf0e10cSrcweir LanguageType nLanguage ) : 660cdf0e10cSrcweir 661cdf0e10cSrcweir SvxStandardDialog( pParent, CUI_RES( RID_SVXDLG_THESAURUS ) ) 662cdf0e10cSrcweir { 663cdf0e10cSrcweir m_pImpl = std::auto_ptr< SvxThesaurusDialog_Impl >(new SvxThesaurusDialog_Impl( this )); 664cdf0e10cSrcweir 665cdf0e10cSrcweir m_pImpl->xThesaurus = xThes; 666cdf0e10cSrcweir m_pImpl->aLookUpText = OUString( rWord ); 667cdf0e10cSrcweir m_pImpl->nLookUpLanguage = nLanguage; 668cdf0e10cSrcweir if (rWord.Len() > 0) 669cdf0e10cSrcweir m_pImpl->aLookUpHistory.push( rWord ); 670cdf0e10cSrcweir 671cdf0e10cSrcweir FreeResource(); 672cdf0e10cSrcweir 673cdf0e10cSrcweir OUString aTmp( rWord ); 674cdf0e10cSrcweir linguistic::RemoveHyphens( aTmp ); 675cdf0e10cSrcweir linguistic::ReplaceControlChars( aTmp ); 676cdf0e10cSrcweir String aTmp2( aTmp ); 677cdf0e10cSrcweir m_pImpl->aReplaceEdit.SetText( aTmp2 ); 678cdf0e10cSrcweir m_pImpl->aWordCB.InsertEntry( aTmp2 ); 679cdf0e10cSrcweir 680cdf0e10cSrcweir m_pImpl->LookUp( aTmp2 ); 681cdf0e10cSrcweir m_pImpl->m_pAlternativesCT->GrabFocus(); 682cdf0e10cSrcweir m_pImpl->aLeftBtn.Enable( sal_False ); 683cdf0e10cSrcweir 684cdf0e10cSrcweir // fill language menu button list 685cdf0e10cSrcweir SvtLanguageTable aLangTab; 686cdf0e10cSrcweir uno::Sequence< lang::Locale > aLocales; 687cdf0e10cSrcweir if (m_pImpl->xThesaurus.is()) 688cdf0e10cSrcweir aLocales = m_pImpl->xThesaurus->getLocales(); 689cdf0e10cSrcweir const sal_Int32 nLocales = aLocales.getLength(); 690cdf0e10cSrcweir const lang::Locale *pLocales = aLocales.getConstArray(); 691cdf0e10cSrcweir delete m_pImpl->aLangMBtn.GetPopupMenu(); 692cdf0e10cSrcweir PopupMenu* pMenu = new PopupMenu; 693cdf0e10cSrcweir pMenu->SetMenuFlags( MENU_FLAG_NOAUTOMNEMONICS ); 694cdf0e10cSrcweir std::vector< OUString > aLangVec; 695cdf0e10cSrcweir for (sal_Int32 i = 0; i < nLocales; ++i ) 696cdf0e10cSrcweir { 697cdf0e10cSrcweir const LanguageType nLang = SvxLocaleToLanguage( pLocales[i] ); 698cdf0e10cSrcweir DBG_ASSERT( nLang != LANGUAGE_NONE && nLang != LANGUAGE_DONTKNOW, "failed to get language" ); 699cdf0e10cSrcweir aLangVec.push_back( aLangTab.GetString( nLang ) ); 700cdf0e10cSrcweir } 701cdf0e10cSrcweir std::sort( aLangVec.begin(), aLangVec.end() ); 702cdf0e10cSrcweir for (size_t i = 0; i < aLangVec.size(); ++i) 703cdf0e10cSrcweir pMenu->InsertItem( (sal_uInt16)i+1, aLangVec[i] ); // menu items should be enumerated from 1 and not 0 704cdf0e10cSrcweir m_pImpl->aLangMBtn.SetPopupMenu( pMenu ); 705cdf0e10cSrcweir 706cdf0e10cSrcweir SetWindowTitle( nLanguage ); 707cdf0e10cSrcweir 708cdf0e10cSrcweir // disable controls if service is missing 709cdf0e10cSrcweir if (!m_pImpl->xThesaurus.is()) 710cdf0e10cSrcweir Enable( sal_False ); 711cdf0e10cSrcweir } 712cdf0e10cSrcweir 713cdf0e10cSrcweir 714cdf0e10cSrcweir SvxThesaurusDialog::~SvxThesaurusDialog() 715cdf0e10cSrcweir { 716cdf0e10cSrcweir } 717cdf0e10cSrcweir 718cdf0e10cSrcweir 719cdf0e10cSrcweir void SvxThesaurusDialog::SetWindowTitle( LanguageType nLanguage ) 720cdf0e10cSrcweir { 721cdf0e10cSrcweir // Sprache anpassen 722cdf0e10cSrcweir String aStr( GetText() ); 723cdf0e10cSrcweir aStr.Erase( aStr.Search( sal_Unicode( '(' ) ) - 1 ); 724cdf0e10cSrcweir aStr.Append( UniString::CreateFromAscii( RTL_CONSTASCII_STRINGPARAM( " (" ) ) ); 725cdf0e10cSrcweir aStr += SvtLanguageTable().GetLanguageString( nLanguage ); 726cdf0e10cSrcweir aStr.Append( sal_Unicode( ')' ) ); 727cdf0e10cSrcweir SetText( aStr ); // set window title 728cdf0e10cSrcweir } 729cdf0e10cSrcweir 730cdf0e10cSrcweir 731cdf0e10cSrcweir String SvxThesaurusDialog::GetWord() 732cdf0e10cSrcweir { 733cdf0e10cSrcweir return m_pImpl->aReplaceEdit.GetText(); 734cdf0e10cSrcweir } 735cdf0e10cSrcweir 736cdf0e10cSrcweir 737cdf0e10cSrcweir sal_uInt16 SvxThesaurusDialog::GetLanguage() const 738cdf0e10cSrcweir { 739cdf0e10cSrcweir return m_pImpl->nLookUpLanguage; 740cdf0e10cSrcweir } 741cdf0e10cSrcweir 742cdf0e10cSrcweir 743cdf0e10cSrcweir void SvxThesaurusDialog::Apply() 744cdf0e10cSrcweir { 745cdf0e10cSrcweir } 746cdf0e10cSrcweir 747cdf0e10cSrcweir 748