From d2c45d0460cf99aadde1aaec11e032f488fa277b Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 2 Nov 2012 09:46:12 +0200 Subject: fdo#46808, Adapt i18n::Transliteration UNO service to new style Simply make the service implement XExtendedTransliteration, since all of the implementatins already do that. Change-Id: If03bf56a8d33931ad0230743a4603e2ae9b104ac --- xmlhelp/source/cxxhelp/provider/content.cxx | 10 +++++----- .../source/cxxhelp/provider/resultsetforquery.cxx | 23 +++++++++------------- .../source/cxxhelp/provider/resultsetforquery.hxx | 4 ++-- 3 files changed, 16 insertions(+), 21 deletions(-) (limited to 'xmlhelp') diff --git a/xmlhelp/source/cxxhelp/provider/content.cxx b/xmlhelp/source/cxxhelp/provider/content.cxx index d4fc1cb668a9..fe166e37abfe 100644 --- a/xmlhelp/source/cxxhelp/provider/content.cxx +++ b/xmlhelp/source/cxxhelp/provider/content.cxx @@ -258,7 +258,7 @@ class ResultSetForQueryFactory { private: - uno::Reference< lang::XMultiServiceFactory > m_xSMgr; + uno::Reference< uno::XComponentContext > m_xContext; uno::Reference< ucb::XContentProvider > m_xProvider; sal_Int32 m_nOpenMode; uno::Sequence< beans::Property > m_seq; @@ -270,14 +270,14 @@ private: public: ResultSetForQueryFactory( - const uno::Reference< lang::XMultiServiceFactory >& xSMgr, + const uno::Reference< uno::XComponentContext >& rxContext, const uno::Reference< ucb::XContentProvider >& xProvider, sal_Int32 nOpenMode, const uno::Sequence< beans::Property >& seq, const uno::Sequence< ucb::NumberedSortingInfo >& seqSort, URLParameter aURLParameter, Databases* pDatabases ) - : m_xSMgr( xSMgr ), + : m_xContext( rxContext ), m_xProvider( xProvider ), m_nOpenMode( nOpenMode ), m_seq( seq ), @@ -289,7 +289,7 @@ public: ResultSetBase* createResultSet() { - return new ResultSetForQuery( m_xSMgr, + return new ResultSetForQuery( m_xContext, m_xProvider, m_nOpenMode, m_seq, @@ -420,7 +420,7 @@ uno::Any SAL_CALL Content::execute( aOpenCommand, Environment, new ResultSetForQueryFactory( - m_xSMgr, + comphelper::getComponentContext(m_xSMgr), m_xProvider.get(), aOpenCommand.Mode, aOpenCommand.Properties, diff --git a/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx b/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx index 93f3e4dfced5..97f32329b3f0 100644 --- a/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx +++ b/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include #include #include @@ -88,25 +88,22 @@ struct HitItem } }; -ResultSetForQuery::ResultSetForQuery( const uno::Reference< lang::XMultiServiceFactory >& xMSF, +ResultSetForQuery::ResultSetForQuery( const uno::Reference< uno::XComponentContext >& rxContext, const uno::Reference< XContentProvider >& xProvider, sal_Int32 nOpenMode, const uno::Sequence< beans::Property >& seq, const uno::Sequence< NumberedSortingInfo >& seqSort, URLParameter& aURLParameter, Databases* pDatabases ) - : ResultSetBase( comphelper::getComponentContext(xMSF),xProvider,nOpenMode,seq,seqSort ), + : ResultSetBase( rxContext,xProvider,nOpenMode,seq,seqSort ), m_aURLParameter( aURLParameter ) { - Reference< XTransliteration > xTrans( - xMSF->createInstance( rtl::OUString( "com.sun.star.i18n.Transliteration" ) ), - UNO_QUERY ); + Reference< XExtendedTransliteration > xTrans = Transliteration::create( rxContext ); Locale aLocale( aURLParameter.get_language(), rtl::OUString(), rtl::OUString() ); - if(xTrans.is()) - xTrans->loadModule(TransliterationModules_UPPERCASE_LOWERCASE, - aLocale ); + xTrans->loadModule(TransliterationModules_UPPERCASE_LOWERCASE, + aLocale ); vector< vector< rtl::OUString > > queryList; { @@ -121,11 +118,9 @@ ResultSetForQuery::ResultSetForQuery( const uno::Reference< lang::XMultiServiceF vector< rtl::OUString > currentQuery; rtl::OUString tmp(query.copy( 0,idx )); rtl:: OUString toliterate = tmp; - if(xTrans.is()) { - Sequence aSeq; - toliterate = xTrans->transliterate( - tmp,0,tmp.getLength(),aSeq); - } + Sequence aSeq; + toliterate = xTrans->transliterate( + tmp,0,tmp.getLength(),aSeq); currentQuery.push_back( toliterate ); queryList.push_back( currentQuery ); diff --git a/xmlhelp/source/cxxhelp/provider/resultsetforquery.hxx b/xmlhelp/source/cxxhelp/provider/resultsetforquery.hxx index 8f7d7f32d1e1..fca1bfbbd390 100644 --- a/xmlhelp/source/cxxhelp/provider/resultsetforquery.hxx +++ b/xmlhelp/source/cxxhelp/provider/resultsetforquery.hxx @@ -19,7 +19,7 @@ #ifndef _RESULTSETFORQUERY_HXX #define _RESULTSETFORQUERY_HXX -#include +#include #include #include #include @@ -36,7 +36,7 @@ namespace chelp { { public: - ResultSetForQuery( const com::sun::star::uno::Reference& xMSF, + ResultSetForQuery( const com::sun::star::uno::Reference& rxContext, const com::sun::star::uno::Reference& xProvider, sal_Int32 nOpenMode, const com::sun::star::uno::Sequence< com::sun::star::beans::Property >& seq, -- cgit v1.2.3