diff options
Diffstat (limited to 'cui/source/dialogs/thesdlg.cxx')
-rw-r--r--[-rwxr-xr-x] | cui/source/dialogs/thesdlg.cxx | 79 |
1 files changed, 11 insertions, 68 deletions
diff --git a/cui/source/dialogs/thesdlg.cxx b/cui/source/dialogs/thesdlg.cxx index fd8a6e56bf21..ddd77621f322 100755..100644 --- a/cui/source/dialogs/thesdlg.cxx +++ b/cui/source/dialogs/thesdlg.cxx @@ -1,3 +1,4 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /************************************************************************* * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -25,17 +26,12 @@ * ************************************************************************/ -// MARKER(update_precomp.py): autogen include statement, do not remove - -#include "precompiled_cui.hxx" - #include "thesdlg.hrc" #include "thesdlg.hxx" #include "thesdlg_impl.hxx" #include "cuires.hrc" #include "dialmgr.hxx" -#include <editeng/unolingu.hxx> #include <tools/shl.hxx> #include <svl/lngmisc.hxx> #include <svtools/filter.hxx> @@ -44,8 +40,6 @@ #include <vcl/wrkwin.hxx> #include <vcl/msgbox.hxx> #include <vcl/svapp.hxx> -#include <com/sun/star/linguistic2/XThesaurus.hpp> -#include <com/sun/star/linguistic2/XMeaning.hpp> #include <thesdlg.hxx> #include <svx/dlgutil.hxx> #include <svx/dialmgr.hxx> @@ -59,7 +53,6 @@ #include <osl/file.hxx> #include <svl/lngmisc.hxx> - #include <stack> #include <algorithm> @@ -70,10 +63,8 @@ using namespace ::com::sun::star; using ::rtl::OUString; - #define A2S(x) String::CreateFromAscii( x ) - // class LookUpComboBox_Impl -------------------------------------------------- LookUpComboBox_Impl::LookUpComboBox_Impl( @@ -87,18 +78,15 @@ LookUpComboBox_Impl::LookUpComboBox_Impl( EnableAutocomplete( sal_False ); } - LookUpComboBox_Impl::~LookUpComboBox_Impl() { } - void LookUpComboBox_Impl::Modify() { m_aModifyTimer.Start(); } - IMPL_LINK( LookUpComboBox_Impl, ModifyTimer_Hdl, Timer *, EMPTYARG /*pTimer*/ ) { m_rDialogImpl.LookUp( GetText() ); @@ -106,21 +94,18 @@ IMPL_LINK( LookUpComboBox_Impl, ModifyTimer_Hdl, Timer *, EMPTYARG /*pTimer*/ ) return 0; } - // class ReplaceEdit_Impl -------------------------------------------------- -ReplaceEdit_Impl::ReplaceEdit_Impl( - Window *pParent, const ResId &rResId ) : - Edit (pParent, rResId) +ReplaceEdit_Impl::ReplaceEdit_Impl( Window *pParent, const ResId &rResId ) + : Edit(pParent, rResId) + , m_pBtn(NULL) { } - ReplaceEdit_Impl::~ReplaceEdit_Impl() { } - void ReplaceEdit_Impl::Modify() { if (m_pBtn) @@ -133,20 +118,18 @@ void ReplaceEdit_Impl::SetText( const XubString& rStr ) Modify(); } - void ReplaceEdit_Impl::SetText( const XubString& rStr, const Selection& rNewSelection ) { Edit::SetText( rStr, rNewSelection ); Modify(); } - // class ThesaurusAlternativesCtrl_Impl ---------------------------------- AlternativesString_Impl::AlternativesString_Impl( ThesaurusAlternativesCtrl_Impl &rControl, SvLBoxEntry* pEntry, sal_uInt16 nFlags, const String& rStr ) : - // + SvLBoxString( pEntry, nFlags, rStr ), m_rControlImpl( rControl ) { @@ -173,7 +156,6 @@ void AlternativesString_Impl::Paint( rDev.SetFont( aOldFont ); } - ThesaurusAlternativesCtrl_Impl::ThesaurusAlternativesCtrl_Impl( Window* pParent, SvxThesaurusDialog_Impl &rImpl ) : @@ -184,20 +166,17 @@ ThesaurusAlternativesCtrl_Impl::ThesaurusAlternativesCtrl_Impl( SetHighlightRange(); } - ThesaurusAlternativesCtrl_Impl::~ThesaurusAlternativesCtrl_Impl() { ClearExtraData(); } - void ThesaurusAlternativesCtrl_Impl::ClearExtraData() { UserDataMap_t aEmpty; m_aUserData.swap( aEmpty ); } - void ThesaurusAlternativesCtrl_Impl::SetExtraData( const SvLBoxEntry *pEntry, const AlternativesExtraData &rData ) @@ -212,7 +191,6 @@ void ThesaurusAlternativesCtrl_Impl::SetExtraData( m_aUserData[ pEntry ] = rData; } - AlternativesExtraData * ThesaurusAlternativesCtrl_Impl::GetExtraData( const SvLBoxEntry *pEntry ) { @@ -223,7 +201,6 @@ AlternativesExtraData * ThesaurusAlternativesCtrl_Impl::GetExtraData( return pRes; } - SvLBoxEntry * ThesaurusAlternativesCtrl_Impl::AddEntry( sal_Int32 nVal, const String &rText, bool bIsHeader ) { SvLBoxEntry* pEntry = new SvLBoxEntry; @@ -247,7 +224,6 @@ SvLBoxEntry * ThesaurusAlternativesCtrl_Impl::AddEntry( sal_Int32 nVal, const St return pEntry; } - void ThesaurusAlternativesCtrl_Impl::KeyInput( const KeyEvent& rKEvt ) { const KeyCode& rKey = rKEvt.GetKeyCode(); @@ -260,32 +236,23 @@ void ThesaurusAlternativesCtrl_Impl::KeyInput( const KeyEvent& rKEvt ) SvxCheckListBox::KeyInput( rKEvt ); } - void ThesaurusAlternativesCtrl_Impl::Paint( const Rectangle& rRect ) { if (!m_rDialogImpl.m_bWordFound) { -/* Push( PUSH_FONT ); - - Font aFont( GetFont() ); - aFont.SetHeight( 2 * aFont.GetHeight() ); - SetFont( aFont ); -*/ Size aTextSize( GetTextWidth( m_rDialogImpl.aErrStr ), GetTextHeight() ); aTextSize = LogicToPixel( aTextSize ); Point aPos; aPos.X() += GetSizePixel().Width() / 2 - aTextSize.Width() / 2; - aPos.Y() += GetSizePixel().Height() / 2 /*- aTextSize.Height() / 2*/; + aPos.Y() += GetSizePixel().Height() / 2; aPos = PixelToLogic( aPos ); DrawText( aPos, m_rDialogImpl.aErrStr ); -// Pop(); } else SvxCheckListBox::Paint( rRect ); } - // struct SvxThesaurusDialog_Impl ---------------------------------------- SvxThesaurusDialog_Impl::SvxThesaurusDialog_Impl( SvxThesaurusDialog * pDialog ) : @@ -305,7 +272,6 @@ SvxThesaurusDialog_Impl::SvxThesaurusDialog_Impl( SvxThesaurusDialog * pDialog ) aCancelBtn ( pDialog, CUI_RES( BTN_THES_CANCEL ) ), aErrStr ( CUI_RES( STR_ERR_TEXTNOTFOUND ) ), aVendorDefaultImage ( CUI_RES( IMG_DEFAULT_VENDOR ) ), - aVendorDefaultImageHC ( CUI_RES( IMG_DEFAULT_VENDOR_HC ) ), xThesaurus ( NULL ), aLookUpText (), nLookUpLanguage ( LANGUAGE_NONE ), @@ -324,13 +290,11 @@ SvxThesaurusDialog_Impl::SvxThesaurusDialog_Impl( SvxThesaurusDialog * pDialog ) Application::PostUserEvent( STATIC_LINK( this, SvxThesaurusDialog_Impl, VendorImageInitHdl ) ); } - SvxThesaurusDialog_Impl::~SvxThesaurusDialog_Impl() { delete aLangMBtn.GetPopupMenu(); } - uno::Sequence< uno::Reference< linguistic2::XMeaning > > SAL_CALL SvxThesaurusDialog_Impl::queryMeanings_Impl( OUString& rTerm, const lang::Locale& rLocale, @@ -358,7 +322,6 @@ uno::Sequence< uno::Reference< linguistic2::XMeaning > > SAL_CALL SvxThesaurusDi return aMeanings; } - bool SvxThesaurusDialog_Impl::UpdateAlternativesBox_Impl() { lang::Locale aLocale( SvxCreateLocale( nLookUpLanguage ) ); @@ -392,7 +355,6 @@ bool SvxThesaurusDialog_Impl::UpdateAlternativesBox_Impl() return nMeanings > 0; } - void SvxThesaurusDialog_Impl::LookUp( const String &rText ) { if (rText != aWordCB.GetText()) // avoid moving of the cursor if the text is the same @@ -400,7 +362,6 @@ void SvxThesaurusDialog_Impl::LookUp( const String &rText ) LookUp_Impl(); } - IMPL_LINK( SvxThesaurusDialog_Impl, LeftBtnHdl_Impl, Button *, pBtn ) { if (pBtn && aLookUpHistory.size() >= 2) @@ -413,7 +374,6 @@ IMPL_LINK( SvxThesaurusDialog_Impl, LeftBtnHdl_Impl, Button *, pBtn ) return 0; } - IMPL_LINK( SvxThesaurusDialog_Impl, LanguageHdl_Impl, MenuButton *, pBtn ) { PopupMenu *pMenu = aLangMBtn.GetPopupMenu(); @@ -432,7 +392,6 @@ IMPL_LINK( SvxThesaurusDialog_Impl, LanguageHdl_Impl, MenuButton *, pBtn ) return 0; } - void SvxThesaurusDialog_Impl::LookUp_Impl() { String aText( aWordCB.GetText() ); @@ -452,7 +411,6 @@ void SvxThesaurusDialog_Impl::LookUp_Impl() aLeftBtn.Enable( aLookUpHistory.size() > 1 ); } - IMPL_LINK( SvxThesaurusDialog_Impl, WordSelectHdl_Impl, ComboBox *, pBox ) { if (pBox && !aWordCB.IsTravelSelect()) // act only upon return key and not when traveling with cursor keys @@ -467,7 +425,6 @@ IMPL_LINK( SvxThesaurusDialog_Impl, WordSelectHdl_Impl, ComboBox *, pBox ) return 0; } - IMPL_LINK( SvxThesaurusDialog_Impl, AlternativesSelectHdl_Impl, SvxCheckListBox *, pBox ) { SvLBoxEntry *pEntry = pBox ? pBox->GetCurEntry() : NULL; @@ -485,7 +442,6 @@ IMPL_LINK( SvxThesaurusDialog_Impl, AlternativesSelectHdl_Impl, SvxCheckListBox return 0; } - IMPL_LINK( SvxThesaurusDialog_Impl, AlternativesDoubleClickHdl_Impl, SvxCheckListBox *, pBox ) { SvLBoxEntry *pEntry = pBox ? pBox->GetCurEntry() : NULL; @@ -510,7 +466,6 @@ IMPL_LINK( SvxThesaurusDialog_Impl, AlternativesDoubleClickHdl_Impl, SvxCheckLis return 0; } - IMPL_STATIC_LINK( SvxThesaurusDialog_Impl, SelectFirstHdl_Impl, SvxCheckListBox *, pBox ) { (void) pThis; @@ -537,7 +492,6 @@ static Image lcl_GetImageFromPngUrl( const OUString &rFileUrl ) return aRes; } - static String lcl_GetThesImplName( const lang::Locale &rLocale ) { String aRes; @@ -554,7 +508,7 @@ static String lcl_GetThesImplName( const lang::Locale &rLocale ) if (xLngMgr.is()) { uno::Sequence< OUString > aServiceNames = xLngMgr->getConfiguredServices( - OUString::createFromAscii("com.sun.star.linguistic2.Thesaurus"), rLocale ); + OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.linguistic2.Thesaurus")), rLocale ); // there should be at most one thesaurus configured for each language DBG_ASSERT( aServiceNames.getLength() <= 1, "more than one thesaurus found. Should not be possible" ); if (aServiceNames.getLength() == 1) @@ -570,7 +524,6 @@ static String lcl_GetThesImplName( const lang::Locale &rLocale ) return aRes; } - void SvxThesaurusDialog_Impl::UpdateVendorImage() { m_pDialog->SetUpdateMode( sal_False ); @@ -578,22 +531,19 @@ void SvxThesaurusDialog_Impl::UpdateVendorImage() SvtLinguConfig aCfg; if (aCfg.HasVendorImages( "ThesaurusDialogImage" )) { - const bool bHC = Application::GetSettings().GetStyleSettings().GetHighContrastMode(); - Image aImage; String sThesImplName( lcl_GetThesImplName( SvxCreateLocale( nLookUpLanguage ) ) ); - OUString aThesDialogImageUrl( aCfg.GetThesaurusDialogImage( sThesImplName, bHC ) ); + OUString aThesDialogImageUrl( aCfg.GetThesaurusDialogImage( sThesImplName ) ); if (sThesImplName.Len() > 0 && aThesDialogImageUrl.getLength() > 0) aImage = Image( lcl_GetImageFromPngUrl( aThesDialogImageUrl ) ); else - aImage = bHC ? aVendorDefaultImageHC : aVendorDefaultImage; + aImage = aVendorDefaultImage; aVendorImageFI.SetImage( aImage ); } m_pDialog->SetUpdateMode( sal_True ); } - IMPL_STATIC_LINK( SvxThesaurusDialog_Impl, VendorImageInitHdl, SvxThesaurusDialog_Impl *, EMPTYARG ) { pThis->m_pDialog->SetUpdateMode( sal_False ); @@ -601,8 +551,7 @@ IMPL_STATIC_LINK( SvxThesaurusDialog_Impl, VendorImageInitHdl, SvxThesaurusDialo SvtLinguConfig aCfg; if (aCfg.HasVendorImages( "ThesaurusDialogImage" )) { - const bool bHC = Application::GetSettings().GetStyleSettings().GetHighContrastMode(); - Image aImage( bHC ? pThis->aVendorDefaultImageHC : pThis->aVendorDefaultImage ); + Image aImage( pThis->aVendorDefaultImage ); pThis->aVendorImageFI.SetImage( aImage ); pThis->aVendorImageFI.Show(); @@ -653,7 +602,6 @@ IMPL_STATIC_LINK( SvxThesaurusDialog_Impl, VendorImageInitHdl, SvxThesaurusDialo return 0; }; - // class SvxThesaurusDialog ---------------------------------------------- SvxThesaurusDialog::SvxThesaurusDialog( @@ -714,12 +662,10 @@ SvxThesaurusDialog::SvxThesaurusDialog( Enable( sal_False ); } - SvxThesaurusDialog::~SvxThesaurusDialog() { } - void SvxThesaurusDialog::SetWindowTitle( LanguageType nLanguage ) { // Sprache anpassen @@ -731,21 +677,18 @@ void SvxThesaurusDialog::SetWindowTitle( LanguageType nLanguage ) SetText( aStr ); // set window title } - String SvxThesaurusDialog::GetWord() { return m_pImpl->aReplaceEdit.GetText(); } - sal_uInt16 SvxThesaurusDialog::GetLanguage() const { return m_pImpl->nLookUpLanguage; } - void SvxThesaurusDialog::Apply() { } - +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |