diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2015-08-22 11:25:13 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-08-22 19:10:46 +0000 |
commit | f2f97ec5bf4f2808544bef5eb583ed4d424acfa9 (patch) | |
tree | 84e95651f1380de183a24aca63d942c7a10638df /basctl/source | |
parent | 1ce2375b17912622e6db4c2c81afa24527a0104b (diff) |
tdf#93077 - basic dialog localization issues.
Don't remove non-existent languages to clean the dialog.
Avoid crashing when adding languages to a non-localized dialog.
Change-Id: Ie356177e00e56c214727d513ae0ce6d62d32591c
Reviewed-on: https://gerrit.libreoffice.org/17929
Tested-by: Jenkins <ci@libreoffice.org>
Tested-by: Julien Nabet <serval2412@yahoo.fr>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'basctl/source')
-rw-r--r-- | basctl/source/dlged/managelang.cxx | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/basctl/source/dlged/managelang.cxx b/basctl/source/dlged/managelang.cxx index 998a6880e1a1..bde64e28cf6e 100644 --- a/basctl/source/dlged/managelang.cxx +++ b/basctl/source/dlged/managelang.cxx @@ -149,12 +149,19 @@ IMPL_LINK_NOARG(ManageLanguageDialog, AddHdl) ScopedVclPtrInstance< SetDefaultLanguageDialog > aDlg( this, m_xLocalizationMgr ); if ( RET_OK == aDlg->Execute() ) { - // add new locales - Sequence< Locale > aLocaleSeq = aDlg->GetLocales(); - m_xLocalizationMgr->handleAddLocales( aLocaleSeq ); - // update listbox - ClearLanguageBox(); - FillLanguageBox(); + if (!m_xLocalizationMgr->isLibraryLocalized()) + { + SAL_WARN("basctl.basicide", "Adding langs to non-localized library tdf#93077"); + } + else + { + // add new locales + Sequence< Locale > aLocaleSeq = aDlg->GetLocales(); + m_xLocalizationMgr->handleAddLocales( aLocaleSeq ); + // update listbox + ClearLanguageBox(); + FillLanguageBox(); + } if (SfxBindings* pBindings = GetBindingsPtr()) pBindings->Invalidate( SID_BASICIDE_CURRENT_LANG ); @@ -277,16 +284,17 @@ void SetDefaultLanguageDialog::FillLanguageBox() { // fill list with all languages m_pLanguageLB->SetLanguageList( SvxLanguageListFlags::ALL, false ); - // remove the already localized languages - Sequence< Locale > aLocaleSeq = m_xLocalizationMgr->getStringResourceManager()->getLocales(); - const Locale* pLocale = aLocaleSeq.getConstArray(); - sal_Int32 i, nCount = aLocaleSeq.getLength(); - for ( i = 0; i < nCount; ++i ) - m_pLanguageLB->RemoveLanguage( LanguageTag::convertToLanguageType( pLocale[i] ) ); - - // fill checklistbox if not in default mode + if ( m_xLocalizationMgr->isLibraryLocalized() ) { + // remove the already localized languages + Sequence< Locale > aLocaleSeq = m_xLocalizationMgr->getStringResourceManager()->getLocales(); + const Locale* pLocale = aLocaleSeq.getConstArray(); + sal_Int32 i, nCount = aLocaleSeq.getLength(); + for ( i = 0; i < nCount; ++i ) + m_pLanguageLB->RemoveLanguage( LanguageTag::convertToLanguageType( pLocale[i] ) ); + + // fill checklistbox if not in default mode sal_uInt16 j, nCount_ = m_pLanguageLB->GetEntryCount(); for ( j = 0; j < nCount_; ++j ) { |