just use one try/catch level
Change-Id: I298f84df5431f0f77144db95bf2305f49e7f9302
This commit is contained in:
@@ -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()));
|
||||
|
Reference in New Issue
Block a user