summaryrefslogtreecommitdiff
path: root/cui
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-12-11 10:03:31 +0000
committerCaolán McNamara <caolanm@redhat.com>2012-12-11 13:15:42 +0000
commit89d3780bbef785db53bafc623750bcba2ce25dc1 (patch)
treede6246c94d9fea3b10159affe1e1a998eca16248 /cui
parentc88508bc53e7df7ead7bc1b102da3d7dd81f7688 (diff)
use a ListBox instead of a MenuButton in the thesaurus dialog
Change-Id: I0cbe7b4c6d329f2780cb3cac9bce6d722b7de469
Diffstat (limited to 'cui')
-rw-r--r--cui/source/dialogs/thesdlg.cxx36
-rw-r--r--cui/source/inc/thesdlg.hxx9
2 files changed, 18 insertions, 27 deletions
diff --git a/cui/source/dialogs/thesdlg.cxx b/cui/source/dialogs/thesdlg.cxx
index 0c4e1e01d2d7..54a80f1de6fe 100644
--- a/cui/source/dialogs/thesdlg.cxx
+++ b/cui/source/dialogs/thesdlg.cxx
@@ -341,20 +341,15 @@ IMPL_LINK( SvxThesaurusDialog, LeftBtnHdl_Impl, Button *, pBtn )
return 0;
}
-IMPL_LINK( SvxThesaurusDialog, LanguageHdl_Impl, MenuButton*, pBtn )
-{
- PopupMenu *pMenu = m_pLangMBtn->GetPopupMenu();
- if (pMenu && pBtn)
- {
- 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" );
- if (xThesaurus->hasLocale( LanguageTag( nLang ).getLocale() ))
- nLookUpLanguage = nLang;
- SetWindowTitle( nLang );
- LookUp_Impl();
- }
+IMPL_LINK( SvxThesaurusDialog, LanguageHdl_Impl, ListBox*, pLB )
+{
+ String aLangText( pLB->GetSelectEntry() );
+ LanguageType nLang = SvtLanguageTable().GetType( aLangText );
+ DBG_ASSERT( nLang != LANGUAGE_NONE && nLang != LANGUAGE_DONTKNOW, "failed to get language" );
+ if (xThesaurus->hasLocale( LanguageTag( nLang ).getLocale() ))
+ nLookUpLanguage = nLang;
+ SetWindowTitle( nLang );
+ LookUp_Impl();
return 0;
}
@@ -466,12 +461,12 @@ SvxThesaurusDialog::SvxThesaurusDialog(
PushButton *pReplaceBtn = get<PushButton>("replace");
m_pReplaceEdit->init(pReplaceBtn);
- get(m_pLangMBtn, "langcb");
+ get(m_pLangLB, "langcb");
pReplaceBtn->SetClickHdl( LINK( this, SvxThesaurusDialog, ReplaceBtnHdl_Impl ) );
m_pLeftBtn->SetClickHdl( LINK( this, SvxThesaurusDialog, LeftBtnHdl_Impl ) );
m_pWordCB->SetSelectHdl( LINK( this, SvxThesaurusDialog, WordSelectHdl_Impl ) );
- m_pLangMBtn->SetSelectHdl( LINK( this, SvxThesaurusDialog, LanguageHdl_Impl ) );
+ m_pLangLB->SetSelectHdl( LINK( this, SvxThesaurusDialog, LanguageHdl_Impl ) );
m_pAlternativesCT->SetSelectHdl( LINK( this, SvxThesaurusDialog, AlternativesSelectHdl_Impl ));
m_pAlternativesCT->SetDoubleClickHdl( LINK( this, SvxThesaurusDialog, AlternativesDoubleClickHdl_Impl ));
@@ -499,9 +494,7 @@ SvxThesaurusDialog::SvxThesaurusDialog(
aLocales = xThesaurus->getLocales();
const sal_Int32 nLocales = aLocales.getLength();
const lang::Locale *pLocales = aLocales.getConstArray();
- PopupMenu* pMenu = m_pLangMBtn->GetPopupMenu();
- pMenu->Clear();
- pMenu->SetMenuFlags(MENU_FLAG_NOAUTOMNEMONICS);
+ m_pLangLB->Clear();
std::vector< OUString > aLangVec;
for (sal_Int32 i = 0; i < nLocales; ++i)
{
@@ -511,13 +504,12 @@ SvxThesaurusDialog::SvxThesaurusDialog(
}
std::sort( aLangVec.begin(), aLangVec.end() );
for (size_t i = 0; i < aLangVec.size(); ++i)
- pMenu->InsertItem( (sal_uInt16)i+1, aLangVec[i] ); // menu items should be enumerated from 1 and not 0
+ m_pLangLB->InsertEntry( aLangVec[i] );
std::vector< OUString >::iterator aI = std::find(aLangVec.begin(), aLangVec.end(), aLangTab.GetString(nLanguage));
if (aI != aLangVec.end())
{
- pMenu->SetSelectedEntry(std::distance(aLangVec.begin(), aI) + 1);
- pMenu->Select();
+ m_pLangLB->SelectEntry(*aI);
}
SetWindowTitle(nLanguage);
diff --git a/cui/source/inc/thesdlg.hxx b/cui/source/inc/thesdlg.hxx
index c27cf178b691..f8353ef17713 100644
--- a/cui/source/inc/thesdlg.hxx
+++ b/cui/source/inc/thesdlg.hxx
@@ -23,11 +23,10 @@
#include <com/sun/star/linguistic2/XThesaurus.hpp>
#include <svx/checklbx.hxx>
-#include <svx/stddlg.hxx>
#include <vcl/button.hxx>
#include <vcl/combobox.hxx>
-#include <vcl/fixed.hxx>
-#include <vcl/menubtn.hxx>
+#include <vcl/lstbox.hxx>
+#include <svx/stddlg.hxx>
#include <memory>
@@ -129,7 +128,7 @@ class SvxThesaurusDialog : public SvxStandardDialog
LookUpComboBox* m_pWordCB;
ThesaurusAlternativesCtrl* m_pAlternativesCT;
ReplaceEdit* m_pReplaceEdit;
- MenuButton* m_pLangMBtn;
+ ListBox* m_pLangLB;
OUString m_aErrStr;
@@ -146,7 +145,7 @@ public:
// Handler
DECL_LINK( ReplaceBtnHdl_Impl, Button * );
DECL_LINK( LeftBtnHdl_Impl, Button * );
- DECL_LINK( LanguageHdl_Impl, MenuButton * );
+ DECL_LINK( LanguageHdl_Impl, ListBox * );
DECL_LINK( LookUpHdl_Impl, Button * );
DECL_LINK( WordSelectHdl_Impl, ComboBox * );
DECL_LINK( AlternativesSelectHdl_Impl, SvxCheckListBox * );