diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-04-04 10:32:51 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-04-04 12:52:15 +0100 |
commit | c4dba436df42cef4f0048994c38dc137266ebaf9 (patch) | |
tree | 30158e55e72b308ed9fb1ada5febf65abb5d23df | |
parent | fd1e4d3b4ba54a33f61d6d40836ae2a8bcaa8c42 (diff) |
just use one try/catch level
Change-Id: I298f84df5431f0f77144db95bf2305f49e7f9302
-rw-r--r-- | unotools/source/config/fontcfg.cxx | 59 |
1 files changed, 26 insertions, 33 deletions
diff --git a/unotools/source/config/fontcfg.cxx b/unotools/source/config/fontcfg.cxx index 022c90509ced..495d082609d2 100644 --- a/unotools/source/config/fontcfg.cxx +++ b/unotools/source/config/fontcfg.cxx @@ -97,48 +97,41 @@ DefaultFontConfiguration& DefaultFontConfiguration::get() DefaultFontConfiguration::DefaultFontConfiguration() { + // create configuration hierarchical access name try { // get service provider - Reference< XComponentContext > xContext( comphelper::getProcessComponentContext() ); - // create configuration hierarchical access name - try + m_xConfigProvider = theDefaultProvider::get(comphelper::getProcessComponentContext()); + Sequence< Any > aArgs(1); + PropertyValue aVal; + aVal.Name = "nodepath"; + aVal.Value <<= OUString( "/org.openoffice.VCL/DefaultFonts" ); + aArgs.getArray()[0] <<= aVal; + m_xConfigAccess = + Reference< XNameAccess >( + m_xConfigProvider->createInstanceWithArguments( "com.sun.star.configuration.ConfigurationAccess", + aArgs ), + UNO_QUERY ); + if( m_xConfigAccess.is() ) { - m_xConfigProvider = theDefaultProvider::get( xContext ); - Sequence< Any > aArgs(1); - PropertyValue aVal; - aVal.Name = "nodepath"; - aVal.Value <<= OUString( "/org.openoffice.VCL/DefaultFonts" ); - aArgs.getArray()[0] <<= aVal; - m_xConfigAccess = - Reference< XNameAccess >( - m_xConfigProvider->createInstanceWithArguments( "com.sun.star.configuration.ConfigurationAccess", - aArgs ), - UNO_QUERY ); - if( m_xConfigAccess.is() ) + Sequence< OUString > aLocales = m_xConfigAccess->getElementNames(); + // fill config hash with empty interfaces + int nLocales = aLocales.getLength(); + const OUString* pLocaleStrings = aLocales.getConstArray(); + for( int i = 0; i < nLocales; i++ ) { - Sequence< OUString > aLocales = m_xConfigAccess->getElementNames(); - // fill config hash with empty interfaces - int nLocales = aLocales.getLength(); - const OUString* pLocaleStrings = aLocales.getConstArray(); - for( int i = 0; i < nLocales; i++ ) - { - // Feed through LanguageTag for casing. - OUString aLoc( LanguageTag( pLocaleStrings[i], true).getBcp47( false)); - m_aConfig[ aLoc ] = LocaleAccess(); - m_aConfig[ aLoc ].aConfigLocaleString = pLocaleStrings[i]; - } + // Feed through LanguageTag for casing. + OUString aLoc( LanguageTag( pLocaleStrings[i], true).getBcp47( false)); + m_aConfig[ aLoc ] = LocaleAccess(); + m_aConfig[ aLoc ].aConfigLocaleString = pLocaleStrings[i]; } } - catch (const Exception&) - { - // configuration is awry - m_xConfigProvider.clear(); - m_xConfigAccess.clear(); - } } - catch (const WrappedTargetException&) + catch (const Exception&) { + // configuration is awry + m_xConfigProvider.clear(); + m_xConfigAccess.clear(); } SAL_INFO("unotools.config", "config provider: " << static_cast<bool>(m_xConfigProvider.is()) << ", config access: " << static_cast<bool>(m_xConfigAccess.is())); |