just use one try/catch level
Change-Id: I298f84df5431f0f77144db95bf2305f49e7f9302
This commit is contained in:
@@ -97,48 +97,41 @@ DefaultFontConfiguration& DefaultFontConfiguration::get()
|
|||||||
|
|
||||||
DefaultFontConfiguration::DefaultFontConfiguration()
|
DefaultFontConfiguration::DefaultFontConfiguration()
|
||||||
{
|
{
|
||||||
|
// create configuration hierarchical access name
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// get service provider
|
// get service provider
|
||||||
Reference< XComponentContext > xContext( comphelper::getProcessComponentContext() );
|
m_xConfigProvider = theDefaultProvider::get(comphelper::getProcessComponentContext());
|
||||||
// create configuration hierarchical access name
|
Sequence< Any > aArgs(1);
|
||||||
try
|
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< OUString > aLocales = m_xConfigAccess->getElementNames();
|
||||||
Sequence< Any > aArgs(1);
|
// fill config hash with empty interfaces
|
||||||
PropertyValue aVal;
|
int nLocales = aLocales.getLength();
|
||||||
aVal.Name = "nodepath";
|
const OUString* pLocaleStrings = aLocales.getConstArray();
|
||||||
aVal.Value <<= OUString( "/org.openoffice.VCL/DefaultFonts" );
|
for( int i = 0; i < nLocales; i++ )
|
||||||
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();
|
// Feed through LanguageTag for casing.
|
||||||
// fill config hash with empty interfaces
|
OUString aLoc( LanguageTag( pLocaleStrings[i], true).getBcp47( false));
|
||||||
int nLocales = aLocales.getLength();
|
m_aConfig[ aLoc ] = LocaleAccess();
|
||||||
const OUString* pLocaleStrings = aLocales.getConstArray();
|
m_aConfig[ aLoc ].aConfigLocaleString = pLocaleStrings[i];
|
||||||
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];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
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())
|
SAL_INFO("unotools.config", "config provider: " << static_cast<bool>(m_xConfigProvider.is())
|
||||||
<< ", config access: " << static_cast<bool>(m_xConfigAccess.is()));
|
<< ", config access: " << static_cast<bool>(m_xConfigAccess.is()));
|
||||||
|
Reference in New Issue
Block a user