summaryrefslogtreecommitdiff
path: root/scripting
diff options
context:
space:
mode:
Diffstat (limited to 'scripting')
-rw-r--r--scripting/source/stringresource/stringresource.cxx20
-rw-r--r--scripting/source/stringresource/stringresource.hxx3
2 files changed, 19 insertions, 4 deletions
diff --git a/scripting/source/stringresource/stringresource.cxx b/scripting/source/stringresource/stringresource.cxx
index 4b1a4489a4a4..b011eaccacc8 100644
--- a/scripting/source/stringresource/stringresource.cxx
+++ b/scripting/source/stringresource/stringresource.cxx
@@ -359,8 +359,9 @@ sal_Bool StringResourceImpl::isReadOnly()
return m_bReadOnly;
}
-void StringResourceImpl::setCurrentLocale( const Locale& locale, sal_Bool FindClosestMatch )
- throw (IllegalArgumentException, RuntimeException)
+void StringResourceImpl::implSetCurrentLocale( const Locale& locale,
+ sal_Bool FindClosestMatch, sal_Bool bUseDefaultIfNoMatch )
+ throw (IllegalArgumentException, RuntimeException)
{
::osl::MutexGuard aGuard( getMutex() );
@@ -370,6 +371,9 @@ void StringResourceImpl::setCurrentLocale( const Locale& locale, sal_Bool FindCl
else
pLocaleItem = getItemForLocale( locale, true );
+ if( pLocaleItem == NULL && bUseDefaultIfNoMatch )
+ pLocaleItem = m_pDefaultLocaleItem;
+
if( pLocaleItem != NULL )
{
loadLocale( pLocaleItem );
@@ -380,6 +384,13 @@ void StringResourceImpl::setCurrentLocale( const Locale& locale, sal_Bool FindCl
}
}
+void StringResourceImpl::setCurrentLocale( const Locale& locale, sal_Bool FindClosestMatch )
+ throw (IllegalArgumentException, RuntimeException)
+{
+ sal_Bool bUseDefaultIfNoMatch = false;
+ implSetCurrentLocale( locale, FindClosestMatch, bUseDefaultIfNoMatch );
+}
+
void StringResourceImpl::setDefaultLocale( const Locale& locale )
throw (IllegalArgumentException, RuntimeException,NoSupportException)
{
@@ -500,7 +511,7 @@ void StringResourceImpl::newLocale( const Locale& locale )
LocaleItem* pCopyFromItem = m_pDefaultLocaleItem;
if( pCopyFromItem == NULL )
pCopyFromItem = m_pCurrentLocaleItem;
- if( pCopyFromItem != NULL )
+ if( pCopyFromItem != NULL && loadLocale( pCopyFromItem ) )
{
const IdToStringMap& rSourceMap = pCopyFromItem->m_aIdToStringMap;
IdToStringMap& rTargetMap = pLocaleItem->m_aIdToStringMap;
@@ -863,7 +874,8 @@ void StringResourcePersistenceImpl::implInitializeCommonParameters
implScanLocales();
sal_Bool FindClosestMatch = true;
- setCurrentLocale( aCurrentLocale, FindClosestMatch );
+ sal_Bool bUseDefaultIfNoMatch = true;
+ implSetCurrentLocale( aCurrentLocale, FindClosestMatch, bUseDefaultIfNoMatch );
}
// -----------------------------------------------------------------------------
diff --git a/scripting/source/stringresource/stringresource.hxx b/scripting/source/stringresource/stringresource.hxx
index e5e3a7c12a35..71d26f05dec7 100644
--- a/scripting/source/stringresource/stringresource.hxx
+++ b/scripting/source/stringresource/stringresource.hxx
@@ -169,6 +169,9 @@ protected:
// Returns the LocalItem for a given locale, if it exists, otherwise NULL
// This method performes a closest match search, at least the language must match
LocaleItem* getClosestMatchItemForLocale( const ::com::sun::star::lang::Locale& locale );
+ void implSetCurrentLocale( const ::com::sun::star::lang::Locale& locale,
+ sal_Bool FindClosestMatch, sal_Bool bUseDefaultIfNoMatch )
+ throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
void implModified( void );
void implNotifyListeners( void );