diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2015-08-22 11:25:13 +0100 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2015-08-31 15:11:22 +0200 |
commit | 10746579c9cee35518cdcae39c016663a6238810 (patch) | |
tree | c75bbf67f8768d078f7348e3e6cbfd6a3bd647f3 /basctl/source | |
parent | 9e59f241b973b0fe523b8a097f2fa8fd9f9bbf65 (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/17932
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 ) { |