diff options
author | Kurt Zenker <kz@openoffice.org> | 2006-07-20 15:08:23 +0000 |
---|---|---|
committer | Kurt Zenker <kz@openoffice.org> | 2006-07-20 15:08:23 +0000 |
commit | 813cc01131f50387794537fbb3171d169c68829e (patch) | |
tree | d59b35b0cc7197ba1f2a4a0a2f5d76ac742d0978 /vcl/source | |
parent | 4802e681f887f17f72e0f5342a6548ffde7e8407 (diff) |
INTEGRATION: CWS vcl62 (1.39.58); FILE MERGED
2006/07/18 16:57:44 pl 1.39.58.1: #i65382# catch missing font configuration
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/gdi/fontcfg.cxx | 162 |
1 files changed, 90 insertions, 72 deletions
diff --git a/vcl/source/gdi/fontcfg.cxx b/vcl/source/gdi/fontcfg.cxx index 5b8f13ad1991..678667f2c5c0 100644 --- a/vcl/source/gdi/fontcfg.cxx +++ b/vcl/source/gdi/fontcfg.cxx @@ -4,9 +4,9 @@ * * $RCSfile: fontcfg.cxx,v $ * - * $Revision: 1.39 $ + * $Revision: 1.40 $ * - * last change: $Author: hr $ $Date: 2006-06-19 19:22:47 $ + * last change: $Author: kz $ $Date: 2006-07-20 16:08:23 $ * * The Contents of this file are made available subject to * the terms of GNU Lesser General Public License Version 2.1. @@ -143,48 +143,57 @@ DefaultFontConfiguration::DefaultFontConfiguration() // create configuration hierachical access name if( xSMgr.is() ) { - m_xConfigProvider = - Reference< XMultiServiceFactory >( - xSMgr->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.configuration.ConfigurationProvider" ))), - UNO_QUERY ); - if( m_xConfigProvider.is() ) + try { - Sequence< Any > aArgs(1); - PropertyValue aVal; - aVal.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ) ); - aVal.Value <<= OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.VCL/DefaultFonts" ) ); - aArgs.getArray()[0] <<= aVal; - m_xConfigAccess = - Reference< XNameAccess >( - m_xConfigProvider->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.configuration.ConfigurationAccess" )), - aArgs ), + m_xConfigProvider = + Reference< XMultiServiceFactory >( + xSMgr->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.configuration.ConfigurationProvider" ))), UNO_QUERY ); - if( m_xConfigAccess.is() ) + if( m_xConfigProvider.is() ) { - Sequence< OUString > aLocales = m_xConfigAccess->getElementNames(); - // fill config hash with empty interfaces - int nLocales = aLocales.getLength(); - const OUString* pLocaleStrings = aLocales.getConstArray(); - Locale aLoc; - for( int i = 0; i < nLocales; i++ ) + Sequence< Any > aArgs(1); + PropertyValue aVal; + aVal.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ) ); + aVal.Value <<= OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.VCL/DefaultFonts" ) ); + aArgs.getArray()[0] <<= aVal; + m_xConfigAccess = + Reference< XNameAccess >( + m_xConfigProvider->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.configuration.ConfigurationAccess" )), + aArgs ), + UNO_QUERY ); + if( m_xConfigAccess.is() ) { - sal_Int32 nIndex = 0; - aLoc.Language = pLocaleStrings[i].getToken( 0, sal_Unicode('-'), nIndex ).toAsciiLowerCase(); - if( nIndex != -1 ) - aLoc.Country = pLocaleStrings[i].getToken( 0, sal_Unicode('-'), nIndex ).toAsciiUpperCase(); - else - aLoc.Country = OUString(); - if( nIndex != -1 ) - aLoc.Variant = pLocaleStrings[i].getToken( 0, sal_Unicode('-'), nIndex ).toAsciiUpperCase(); - else - aLoc.Variant = OUString(); - m_aConfig[ aLoc ] = LocaleAccess(); - m_aConfig[ aLoc ].aConfigLocaleString = pLocaleStrings[i]; + Sequence< OUString > aLocales = m_xConfigAccess->getElementNames(); + // fill config hash with empty interfaces + int nLocales = aLocales.getLength(); + const OUString* pLocaleStrings = aLocales.getConstArray(); + Locale aLoc; + for( int i = 0; i < nLocales; i++ ) + { + sal_Int32 nIndex = 0; + aLoc.Language = pLocaleStrings[i].getToken( 0, sal_Unicode('-'), nIndex ).toAsciiLowerCase(); + if( nIndex != -1 ) + aLoc.Country = pLocaleStrings[i].getToken( 0, sal_Unicode('-'), nIndex ).toAsciiUpperCase(); + else + aLoc.Country = OUString(); + if( nIndex != -1 ) + aLoc.Variant = pLocaleStrings[i].getToken( 0, sal_Unicode('-'), nIndex ).toAsciiUpperCase(); + else + aLoc.Variant = OUString(); + m_aConfig[ aLoc ] = LocaleAccess(); + m_aConfig[ aLoc ].aConfigLocaleString = pLocaleStrings[i]; + } } } } + catch( Exception& ) + { + // configuration is awry + m_xConfigProvider.clear(); + m_xConfigAccess.clear(); + } } } catch( WrappedTargetException& ) @@ -408,48 +417,57 @@ FontSubstConfiguration::FontSubstConfiguration() // create configuration hierachical access name if( xSMgr.is() ) { - m_xConfigProvider = - Reference< XMultiServiceFactory >( - xSMgr->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.configuration.ConfigurationProvider" ))), - UNO_QUERY ); - if( m_xConfigProvider.is() ) + try { - Sequence< Any > aArgs(1); - PropertyValue aVal; - aVal.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ) ); - aVal.Value <<= OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.VCL/FontSubstitutions" ) ); - aArgs.getArray()[0] <<= aVal; - m_xConfigAccess = - Reference< XNameAccess >( - m_xConfigProvider->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( - "com.sun.star.configuration.ConfigurationAccess" )), - aArgs ), + m_xConfigProvider = + Reference< XMultiServiceFactory >( + xSMgr->createInstance( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.configuration.ConfigurationProvider" ))), UNO_QUERY ); - if( m_xConfigAccess.is() ) + if( m_xConfigProvider.is() ) { - Sequence< OUString > aLocales = m_xConfigAccess->getElementNames(); - // fill config hash with empty interfaces - int nLocales = aLocales.getLength(); - const OUString* pLocaleStrings = aLocales.getConstArray(); - Locale aLoc; - for( int i = 0; i < nLocales; i++ ) + Sequence< Any > aArgs(1); + PropertyValue aVal; + aVal.Name = OUString( RTL_CONSTASCII_USTRINGPARAM( "nodepath" ) ); + aVal.Value <<= OUString( RTL_CONSTASCII_USTRINGPARAM( "/org.openoffice.VCL/FontSubstitutions" ) ); + aArgs.getArray()[0] <<= aVal; + m_xConfigAccess = + Reference< XNameAccess >( + m_xConfigProvider->createInstanceWithArguments( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( + "com.sun.star.configuration.ConfigurationAccess" )), + aArgs ), + UNO_QUERY ); + if( m_xConfigAccess.is() ) { - sal_Int32 nIndex = 0; - aLoc.Language = pLocaleStrings[i].getToken( 0, sal_Unicode('-'), nIndex ).toAsciiLowerCase(); - if( nIndex != -1 ) - aLoc.Country = pLocaleStrings[i].getToken( 0, sal_Unicode('-'), nIndex ).toAsciiUpperCase(); - else - aLoc.Country = OUString(); - if( nIndex != -1 ) - aLoc.Variant = pLocaleStrings[i].getToken( 0, sal_Unicode('-'), nIndex ).toAsciiUpperCase(); - else - aLoc.Variant = OUString(); - m_aSubst[ aLoc ] = LocaleSubst(); - m_aSubst[ aLoc ].aConfigLocaleString = pLocaleStrings[i]; + Sequence< OUString > aLocales = m_xConfigAccess->getElementNames(); + // fill config hash with empty interfaces + int nLocales = aLocales.getLength(); + const OUString* pLocaleStrings = aLocales.getConstArray(); + Locale aLoc; + for( int i = 0; i < nLocales; i++ ) + { + sal_Int32 nIndex = 0; + aLoc.Language = pLocaleStrings[i].getToken( 0, sal_Unicode('-'), nIndex ).toAsciiLowerCase(); + if( nIndex != -1 ) + aLoc.Country = pLocaleStrings[i].getToken( 0, sal_Unicode('-'), nIndex ).toAsciiUpperCase(); + else + aLoc.Country = OUString(); + if( nIndex != -1 ) + aLoc.Variant = pLocaleStrings[i].getToken( 0, sal_Unicode('-'), nIndex ).toAsciiUpperCase(); + else + aLoc.Variant = OUString(); + m_aSubst[ aLoc ] = LocaleSubst(); + m_aSubst[ aLoc ].aConfigLocaleString = pLocaleStrings[i]; + } } } } + catch( Exception& ) + { + // configuration is awry + m_xConfigProvider.clear(); + m_xConfigAccess.clear(); + } } } catch( WrappedTargetException& ) |