diff options
Diffstat (limited to 'comphelper')
-rw-r--r-- | comphelper/source/compare/AnyCompareFactory.cxx | 24 | ||||
-rw-r--r-- | comphelper/source/misc/string.cxx | 8 |
2 files changed, 9 insertions, 23 deletions
diff --git a/comphelper/source/compare/AnyCompareFactory.cxx b/comphelper/source/compare/AnyCompareFactory.cxx index 609c390acb0d..69ce7d19ec84 100644 --- a/comphelper/source/compare/AnyCompareFactory.cxx +++ b/comphelper/source/compare/AnyCompareFactory.cxx @@ -21,7 +21,7 @@ #include "comphelper_module.hxx" #include <com/sun/star/ucb/XAnyCompareFactory.hpp> -#include <com/sun/star/i18n/XCollator.hpp> +#include <com/sun/star/i18n/Collator.hpp> #include <com/sun/star/lang/Locale.hpp> #include <com/sun/star/uno/Sequence.h> #include <com/sun/star/beans/PropertyValue.hpp> @@ -51,16 +51,9 @@ class AnyCompare : public ::cppu::WeakImplHelper1< XAnyCompare > public: AnyCompare( Reference< XComponentContext > xContext, const Locale& rLocale ) throw() { - Reference< XMultiComponentFactory > xFactory = xContext->getServiceManager(); - if ( xFactory.is() ) - { - m_rCollator = Reference< XCollator >( - xFactory->createInstanceWithContext( OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.i18n.Collator" )), xContext ), - UNO_QUERY ); + m_rCollator = Collator::create( xContext ); m_rCollator->loadDefaultCollator( rLocale, 0 ); //??? - } - } virtual sal_Int16 SAL_CALL compare( const Any& any1, const Any& any2 ) throw(RuntimeException); @@ -102,16 +95,13 @@ sal_Int16 SAL_CALL AnyCompare::compare( const Any& any1, const Any& any2 ) throw { sal_Int16 aResult = 0; - if( m_rCollator.is() ) - { - OUString aStr1; - OUString aStr2; + OUString aStr1; + OUString aStr2; - any1 >>= aStr1; - any2 >>= aStr2; + any1 >>= aStr1; + any2 >>= aStr2; - aResult = ( sal_Int16 )m_rCollator->compareString( aStr1, aStr2 ); - } + aResult = ( sal_Int16 )m_rCollator->compareString( aStr1, aStr2 ); return aResult; } diff --git a/comphelper/source/misc/string.cxx b/comphelper/source/misc/string.cxx index 2fe8a3f508f8..1dae9e8c203f 100644 --- a/comphelper/source/misc/string.cxx +++ b/comphelper/source/misc/string.cxx @@ -36,6 +36,7 @@ #include <com/sun/star/i18n/BreakIterator.hpp> #include <com/sun/star/i18n/CharType.hpp> +#include <com/sun/star/i18n/Collator.hpp> namespace comphelper { namespace string { @@ -343,12 +344,7 @@ NaturalStringSorter::NaturalStringSorter( const uno::Reference< uno::XComponentContext > &rContext, const lang::Locale &rLocale) : m_aLocale(rLocale) { - uno::Reference< lang::XMultiComponentFactory > xFactory(rContext->getServiceManager(), - uno::UNO_SET_THROW); - - m_xCollator = uno::Reference< i18n::XCollator >(xFactory->createInstanceWithContext( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.i18n.Collator")), rContext), - uno::UNO_QUERY_THROW); + m_xCollator = i18n::Collator::create( rContext ); m_xCollator->loadDefaultCollator(m_aLocale, 0); m_xBI = i18n::BreakIterator::create( rContext ); } |