summaryrefslogtreecommitdiff
path: root/i18npool
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2010-12-08 14:39:50 +0000
committerCaolán McNamara <caolanm@redhat.com>2010-12-08 14:39:50 +0000
commit3dc4b5a88adc062fb1c78f34ff85e129022bef08 (patch)
treee28e1313eeca47ded99734141efe2d9aa6c3aa6e /i18npool
parent929a0577150e9c3d589a549a896c64684b4b55c0 (diff)
cppunit: survice missing config and default sanely
Diffstat (limited to 'i18npool')
-rw-r--r--i18npool/source/paper/paper.cxx25
1 files changed, 15 insertions, 10 deletions
diff --git a/i18npool/source/paper/paper.cxx b/i18npool/source/paper/paper.cxx
index dc588a36b515..98e0ea230cb9 100644
--- a/i18npool/source/paper/paper.cxx
+++ b/i18npool/source/paper/paper.cxx
@@ -227,21 +227,26 @@ PaperInfo PaperInfo::getSystemDefaultPaper()
rtl::OUString aLocaleStr;
- Reference< XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory();
- Reference< XMultiServiceFactory > xConfigProv(
- xFactory->createInstance( CREATE_OUSTRING( "com.sun.star.configuration.ConfigurationProvider" ) ),
- UNO_QUERY_THROW );
-
+ Reference< XMultiServiceFactory > xConfigProv;
+ Reference< XNameAccess > xConfigNA;
Sequence< Any > aArgs( 1 );
- aArgs[ 0 ] <<= CREATE_OUSTRING( "org.openoffice.Setup/L10N/" );
- Reference< XNameAccess > xConfigNA( xConfigProv->createInstanceWithArguments(
- CREATE_OUSTRING( "com.sun.star.configuration.ConfigurationAccess" ), aArgs ), UNO_QUERY_THROW );
try
{
+ Reference< XMultiServiceFactory > xFactory = ::comphelper::getProcessServiceFactory();
+ xConfigProv = Reference< XMultiServiceFactory >(
+ xFactory->createInstance( CREATE_OUSTRING( "com.sun.star.configuration.ConfigurationProvider" ) ),
+ UNO_QUERY_THROW);
+
+ aArgs[ 0 ] <<= CREATE_OUSTRING( "org.openoffice.Setup/L10N/" );
+ xConfigNA = Reference< XNameAccess >(xConfigProv->createInstanceWithArguments(
+ CREATE_OUSTRING( "com.sun.star.configuration.ConfigurationAccess" ), aArgs ), UNO_QUERY_THROW);
+
// try user-defined locale setting
xConfigNA->getByName( CREATE_OUSTRING( "ooSetupSystemLocale" ) ) >>= aLocaleStr;
}
- catch( Exception& ) {}
+ catch( Exception& )
+ {
+ }
#ifdef UNX
// if set to "use system", get papersize from system
@@ -360,7 +365,7 @@ PaperInfo PaperInfo::getSystemDefaultPaper()
try
{
// if set to "use system", try to get locale from system
- if( aLocaleStr.getLength() == 0 )
+ if (aLocaleStr.getLength() == 0 && xConfigProv.is())
{
aArgs[ 0 ] <<= CREATE_OUSTRING( "org.openoffice.System/L10N/" );
xConfigNA.set( xConfigProv->createInstanceWithArguments(