summaryrefslogtreecommitdiff
path: root/i18npool
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-11-02 15:13:28 +0200
committerStephan Bergmann <sbergman@redhat.com>2012-11-05 18:05:00 +0100
commit0666e43c45876199ddc71e378554878cca6f0539 (patch)
tree39fd44bd26cceaa71a86a06c480d80c8351b5e0f /i18npool
parentebc61e11cdb02f5cc33aeabead3d191eaf0d23d3 (diff)
fdo#46808, use service constructor for i18n::CharacterClassification
Change-Id: I0499ad7de27b1539e97f01ab8aa0ef2d6713ae76
Diffstat (limited to 'i18npool')
-rw-r--r--i18npool/source/collator/chaptercollator.cxx6
-rw-r--r--i18npool/source/search/textsearch.cxx33
-rw-r--r--i18npool/source/search/textsearch.hxx5
3 files changed, 18 insertions, 26 deletions
diff --git a/i18npool/source/collator/chaptercollator.cxx b/i18npool/source/collator/chaptercollator.cxx
index 837cdc639f7f..8c0c1100c308 100644
--- a/i18npool/source/collator/chaptercollator.cxx
+++ b/i18npool/source/collator/chaptercollator.cxx
@@ -24,6 +24,7 @@
#include <chaptercollator.hxx>
#include <com/sun/star/i18n/KCharacterType.hpp>
#include <com/sun/star/i18n/ParseResult.hpp>
+#include <com/sun/star/i18n/CharacterClassification.hpp>
using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::uno;
@@ -33,10 +34,7 @@ using namespace ::rtl;
ChapterCollator::ChapterCollator( const Reference < XMultiServiceFactory >& rxMSF ) : CollatorImpl(rxMSF)
{
if ( rxMSF.is()) {
- Reference < XInterface > xI =
- rxMSF->createInstance( OUString("com.sun.star.i18n.CharacterClassification"));
- if ( xI.is() )
- xI->queryInterface(::getCppuType((const Reference< XCharacterClassification>*)0)) >>= cclass;
+ cclass = CharacterClassification::create( comphelper::getComponentContext( rxMSF ) );
}
}
diff --git a/i18npool/source/search/textsearch.cxx b/i18npool/source/search/textsearch.cxx
index b28c23a4539b..1469cead0d75 100644
--- a/i18npool/source/search/textsearch.cxx
+++ b/i18npool/source/search/textsearch.cxx
@@ -39,6 +39,7 @@
#include <com/sun/star/i18n/WordType.hpp>
#include <com/sun/star/i18n/ScriptType.hpp>
#include <com/sun/star/i18n/CharacterIteratorMode.hpp>
+#include <com/sun/star/i18n/CharacterClassification.hpp>
#include <com/sun/star/i18n/KCharacterType.hpp>
#include <com/sun/star/i18n/Transliteration.hpp>
#include <com/sun/star/registry/XRegistryKey.hpp>
@@ -77,8 +78,8 @@ static const sal_Int32 COMPLEX_TRANS_MASK =
// Above 2 transliteration is simple but need to take effect in
// complex transliteration
-TextSearch::TextSearch(const Reference < XMultiServiceFactory > & rxMSF)
- : xMSF( rxMSF )
+TextSearch::TextSearch(const Reference < XComponentContext > & rxContext)
+ : m_xContext( rxContext )
, pJumpTable( 0 )
, pJumpTable2( 0 )
, pRegExp( 0 )
@@ -113,7 +114,7 @@ void TextSearch::setOptions( const SearchOptions& rOptions ) throw( RuntimeExcep
{
if( !xTranslit.is() )
{
- xTranslit.set( Transliteration::create( comphelper::getComponentContext(xMSF) ) );
+ xTranslit.set( Transliteration::create( m_xContext ) );
}
// Load transliteration module
xTranslit->loadModule(
@@ -128,7 +129,7 @@ void TextSearch::setOptions( const SearchOptions& rOptions ) throw( RuntimeExcep
{
if( !xTranslit2.is() )
{
- xTranslit2.set( Transliteration::create( comphelper::getComponentContext(xMSF) ) );
+ xTranslit2.set( Transliteration::create( m_xContext ) );
}
// Load transliteration module
xTranslit2->loadModule(
@@ -138,7 +139,7 @@ void TextSearch::setOptions( const SearchOptions& rOptions ) throw( RuntimeExcep
if ( !xBreak.is() )
{
- xBreak = BreakIterator::create(comphelper::getComponentContext(xMSF));
+ xBreak = BreakIterator::create(m_xContext);
}
sSrchStr = aSrchPara.searchString;
@@ -393,21 +394,13 @@ bool TextSearch::IsDelimiter( const OUString& rStr, sal_Int32 nPos ) const
{
if ( !xCharClass.is() )
{
- Reference < XInterface > xI = xMSF->createInstance(
- OUString("com.sun.star.i18n.CharacterClassification"));
- if( xI.is() )
- xI->queryInterface( ::getCppuType(
- (const Reference< XCharacterClassification >*)0))
- >>= xCharClass;
- }
- if ( xCharClass.is() )
- {
- sal_Int32 nCType = xCharClass->getCharacterType( rStr, nPos,
- aSrchPara.Locale );
- if( 0 != (( KCharacterType::DIGIT | KCharacterType::ALPHA |
- KCharacterType::LETTER ) & nCType ) )
- bRet = 0;
+ xCharClass = CharacterClassification::create( m_xContext );
}
+ sal_Int32 nCType = xCharClass->getCharacterType( rStr, nPos,
+ aSrchPara.Locale );
+ if( 0 != (( KCharacterType::DIGIT | KCharacterType::ALPHA |
+ KCharacterType::LETTER ) & nCType ) )
+ bRet = 0;
}
return bRet;
}
@@ -957,7 +950,7 @@ SAL_CALL TextSearch_CreateInstance(
{
return ::com::sun::star::uno::Reference<
::com::sun::star::uno::XInterface >(
- (::cppu::OWeakObject*) new TextSearch( rxMSF ) );
+ (::cppu::OWeakObject*) new TextSearch( comphelper::getComponentContext(rxMSF) ) );
}
extern "C"
diff --git a/i18npool/source/search/textsearch.hxx b/i18npool/source/search/textsearch.hxx
index 32b4d2e5af18..ca28435945f5 100644
--- a/i18npool/source/search/textsearch.hxx
+++ b/i18npool/source/search/textsearch.hxx
@@ -36,6 +36,7 @@
#include <com/sun/star/i18n/XExtendedTransliteration.hpp>
#include <com/sun/star/i18n/XCharacterClassification.hpp>
#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
#include <map>
@@ -52,7 +53,7 @@ class TextSearch: public cppu::WeakImplHelper2
::com::sun::star::lang::XServiceInfo
>
{
- ::com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory > xMSF;
+ ::com::sun::star::uno::Reference < ::com::sun::star::uno::XComponentContext > m_xContext;
::com::sun::star::util::SearchOptions aSrchPara;
::rtl::OUString sSrchStr;
@@ -125,7 +126,7 @@ class TextSearch: public cppu::WeakImplHelper2
public:
TextSearch(
- const ::com::sun::star::uno::Reference < ::com::sun::star::lang::XMultiServiceFactory >& rxMSF );
+ const ::com::sun::star::uno::Reference < ::com::sun::star::uno::XComponentContext >& rxContext );
virtual ~TextSearch();