From 1254a00da0fff439c8f8ac1697da7a96e10b1705 Mon Sep 17 00:00:00 2001 From: Eike Rathke Date: Thu, 11 Jul 2013 23:08:40 +0200 Subject: eliminated some back and forth conversion between bcp47 and Locale Change-Id: If97a4b695262a99979dbab1bcec75fe694c4de80 --- include/unotools/fontcfg.hxx | 39 ++++----------------------------------- 1 file changed, 4 insertions(+), 35 deletions(-) (limited to 'include/unotools') diff --git a/include/unotools/fontcfg.hxx b/include/unotools/fontcfg.hxx index 3e7f0ac95200..5e63ddb7fbdf 100644 --- a/include/unotools/fontcfg.hxx +++ b/include/unotools/fontcfg.hxx @@ -30,37 +30,9 @@ #include #include -namespace com { -namespace sun { -namespace star { -namespace lang { - -// equality operator needed for hash_map; -// (-> why does this need to be in the namespace of Locale ? g++ fails to compile else) -inline bool operator==( const com::sun::star::lang::Locale& rLeft, const com::sun::star::lang::Locale& rRight ) -{ - return - rLeft.Language.equals( rRight.Language ) && - rLeft.Country.equals( rRight.Country ) && - rLeft.Variant.equals( rRight.Variant ) - ; -} -}}}} - namespace utl { -struct LocaleHash -{ - size_t operator()( const com::sun::star::lang::Locale& rLocale ) const - { - return - (size_t)rLocale.Language.hashCode() ^ - (size_t)rLocale.Country.hashCode() ^ - (size_t)rLocale.Variant.hashCode(); - } -}; - class UNOTOOLS_DLLPUBLIC DefaultFontConfiguration { com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > @@ -77,12 +49,9 @@ class UNOTOOLS_DLLPUBLIC DefaultFontConfiguration mutable com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > xAccess; }; - boost::unordered_map< com::sun::star::lang::Locale, - LocaleAccess, - utl::LocaleHash > - m_aConfig; + boost::unordered_map< OUString, LocaleAccess, OUStringHash > m_aConfig; - OUString tryLocale( const com::sun::star::lang::Locale& rLocale, const OUString& rType ) const; + OUString tryLocale( const OUString& rBcp47, const OUString& rType ) const; public: DefaultFontConfiguration(); @@ -183,7 +152,7 @@ private: LocaleSubst() : bConfigRead( false ) {} }; - boost::unordered_map< com::sun::star::lang::Locale, LocaleSubst, utl::LocaleHash > m_aSubst; + boost::unordered_map< OUString, LocaleSubst, OUStringHash > m_aSubst; typedef boost::unordered_set< OUString, OUStringHash > UniqueSubstHash; mutable UniqueSubstHash maSubstHash; @@ -197,7 +166,7 @@ private: const OUString& rType ) const; unsigned long getSubstType( const com::sun::star::uno::Reference< com::sun::star::container::XNameAccess > xFont, const OUString& rType ) const; - void readLocaleSubst( const com::sun::star::lang::Locale& rLocale ) const; + void readLocaleSubst( const OUString& rBcp47 ) const; public: FontSubstConfiguration(); ~FontSubstConfiguration(); -- cgit v1.2.3