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
This commit is contained in:
Noel Grandin 2012-11-02 09:46:12 +02:00 committed by Stephan Bergmann
parent ec1c96a9b6
commit d2c45d0460
23 changed files with 66 additions and 83 deletions

View File

@ -42,7 +42,7 @@ namespace
public: public:
lclTransliterationWrapper() lclTransliterationWrapper()
: m_aTransliteration( : m_aTransliteration(
comphelper::getProcessServiceFactory(), comphelper::getProcessComponentContext(),
com::sun::star::i18n::TransliterationModules_IGNORE_CASE ) com::sun::star::i18n::TransliterationModules_IGNORE_CASE )
{ {
const LanguageType eOfficeLanguage = Application::GetSettings().GetLanguage(); const LanguageType eOfficeLanguage = Application::GetSettings().GetLanguage();

View File

@ -1626,9 +1626,9 @@ RTLFUNC(StrComp)
::utl::TransliterationWrapper* pTransliterationWrapper = GetSbData()->pTransliterationWrapper; ::utl::TransliterationWrapper* pTransliterationWrapper = GetSbData()->pTransliterationWrapper;
if( !pTransliterationWrapper ) if( !pTransliterationWrapper )
{ {
uno::Reference< lang::XMultiServiceFactory > xSMgr = getProcessServiceFactory(); uno::Reference< uno::XComponentContext > xContext = getProcessComponentContext();
pTransliterationWrapper = GetSbData()->pTransliterationWrapper = pTransliterationWrapper = GetSbData()->pTransliterationWrapper =
new ::utl::TransliterationWrapper( xSMgr, new ::utl::TransliterationWrapper( xContext,
i18n::TransliterationModules_IGNORE_CASE | i18n::TransliterationModules_IGNORE_CASE |
i18n::TransliterationModules_IGNORE_KANA | i18n::TransliterationModules_IGNORE_KANA |
i18n::TransliterationModules_IGNORE_WIDTH ); i18n::TransliterationModules_IGNORE_WIDTH );
@ -4082,8 +4082,8 @@ RTLFUNC(StrConv)
String aNewStr( aOldStr ); String aNewStr( aOldStr );
if( nType != 0 ) if( nType != 0 )
{ {
uno::Reference< lang::XMultiServiceFactory > xSMgr = getProcessServiceFactory(); uno::Reference< uno::XComponentContext > xContext = getProcessComponentContext();
::utl::TransliterationWrapper aTransliterationWrapper( xSMgr,nType ); ::utl::TransliterationWrapper aTransliterationWrapper( xContext, nType );
uno::Sequence<sal_Int32> aOffsets; uno::Sequence<sal_Int32> aOffsets;
aTransliterationWrapper.loadModuleIfNeeded( nLanguage ); aTransliterationWrapper.loadModuleIfNeeded( nLanguage );
aNewStr = aTransliterationWrapper.transliterate( aOldStr, nLanguage, 0, nOldLen, &aOffsets ); aNewStr = aTransliterationWrapper.transliterate( aOldStr, nLanguage, 0, nOldLen, &aOffsets );

View File

@ -2704,7 +2704,7 @@ EditSelection ImpEditEngine::TransliterateText( const EditSelection& rSelection,
sal_Bool bLenChanged = sal_False; sal_Bool bLenChanged = sal_False;
EditUndoTransliteration* pUndo = NULL; EditUndoTransliteration* pUndo = NULL;
utl::TransliterationWrapper aTranslitarationWrapper( ::comphelper::getProcessServiceFactory(), nTransliterationMode ); utl::TransliterationWrapper aTranslitarationWrapper( ::comphelper::getProcessComponentContext(), nTransliterationMode );
sal_Bool bConsiderLanguage = aTranslitarationWrapper.needLanguageForTheMode(); sal_Bool bConsiderLanguage = aTranslitarationWrapper.needLanguageForTheMode();
for ( sal_uInt16 nNode = nStartNode; nNode <= nEndNode; nNode++ ) for ( sal_uInt16 nNode = nStartNode; nNode <= nEndNode; nNode++ )

View File

@ -196,7 +196,7 @@ static LocaleDataWrapper& GetLocaleDataWrapper( sal_uInt16 nLang )
static TransliterationWrapper& GetIgnoreTranslWrapper() static TransliterationWrapper& GetIgnoreTranslWrapper()
{ {
static int bIsInit = 0; static int bIsInit = 0;
static TransliterationWrapper aWrp( GetProcessFact(), static TransliterationWrapper aWrp( ::comphelper::getProcessComponentContext(),
::com::sun::star::i18n::TransliterationModules_IGNORE_KANA | ::com::sun::star::i18n::TransliterationModules_IGNORE_KANA |
::com::sun::star::i18n::TransliterationModules_IGNORE_WIDTH ); ::com::sun::star::i18n::TransliterationModules_IGNORE_WIDTH );
if( !bIsInit ) if( !bIsInit )

View File

@ -40,6 +40,7 @@
#include <com/sun/star/i18n/ScriptType.hpp> #include <com/sun/star/i18n/ScriptType.hpp>
#include <com/sun/star/i18n/CharacterIteratorMode.hpp> #include <com/sun/star/i18n/CharacterIteratorMode.hpp>
#include <com/sun/star/i18n/KCharacterType.hpp> #include <com/sun/star/i18n/KCharacterType.hpp>
#include <com/sun/star/i18n/Transliteration.hpp>
#include <com/sun/star/registry/XRegistryKey.hpp> #include <com/sun/star/registry/XRegistryKey.hpp>
#include <cppuhelper/factory.hxx> #include <cppuhelper/factory.hxx>
#include <cppuhelper/weak.hxx> #include <cppuhelper/weak.hxx>
@ -112,19 +113,12 @@ void TextSearch::setOptions( const SearchOptions& rOptions ) throw( RuntimeExcep
{ {
if( !xTranslit.is() ) if( !xTranslit.is() )
{ {
Reference < XInterface > xI = xMSF->createInstance( xTranslit.set( Transliteration::create( comphelper::getComponentContext(xMSF) ) );
OUString(
"com.sun.star.i18n.Transliteration"));
if ( xI.is() )
xI->queryInterface( ::getCppuType(
(const Reference< XExtendedTransliteration >*)0))
>>= xTranslit;
} }
// Load transliteration module // Load transliteration module
if( xTranslit.is() ) xTranslit->loadModule(
xTranslit->loadModule( (TransliterationModules)( aSrchPara.transliterateFlags & SIMPLE_TRANS_MASK ),
(TransliterationModules)( aSrchPara.transliterateFlags & SIMPLE_TRANS_MASK ), aSrchPara.Locale);
aSrchPara.Locale);
} }
else if( xTranslit.is() ) else if( xTranslit.is() )
xTranslit = 0; xTranslit = 0;
@ -134,19 +128,12 @@ void TextSearch::setOptions( const SearchOptions& rOptions ) throw( RuntimeExcep
{ {
if( !xTranslit2.is() ) if( !xTranslit2.is() )
{ {
Reference < XInterface > xI = xMSF->createInstance( xTranslit2.set( Transliteration::create( comphelper::getComponentContext(xMSF) ) );
OUString(
"com.sun.star.i18n.Transliteration"));
if ( xI.is() )
xI->queryInterface( ::getCppuType(
(const Reference< XExtendedTransliteration >*)0))
>>= xTranslit2;
} }
// Load transliteration module // Load transliteration module
if( xTranslit2.is() ) xTranslit2->loadModule(
xTranslit2->loadModule( (TransliterationModules)( aSrchPara.transliterateFlags & COMPLEX_TRANS_MASK ),
(TransliterationModules)( aSrchPara.transliterateFlags & COMPLEX_TRANS_MASK ), aSrchPara.Locale);
aSrchPara.Locale);
} }
if ( !xBreak.is() ) if ( !xBreak.is() )

View File

@ -155,6 +155,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/i18n,\
BreakIterator \ BreakIterator \
LocaleCalendar \ LocaleCalendar \
LocaleData \ LocaleData \
Transliteration \
)) ))
$(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/linguistic2,\ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/linguistic2,\
LanguageGuessing \ LanguageGuessing \
@ -871,7 +872,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/i18n,\
NumberFormatMapper \ NumberFormatMapper \
OrdinalSuffix \ OrdinalSuffix \
TextConversion \ TextConversion \
Transliteration \
)) ))
$(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/image,\ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/image,\
ImageMap \ ImageMap \

View File

@ -28,12 +28,7 @@ module com { module sun { module star { module i18n {
/// Transliteration of characters, such as case folding /// Transliteration of characters, such as case folding
published service Transliteration published service Transliteration : XExtendedTransliteration;
{
interface com::sun::star::i18n::XTransliteration;
[optional] interface com::sun::star::i18n::XExtendedTransliteration;
};
}; }; }; }; }; }; }; };

Binary file not shown.

View File

@ -1512,7 +1512,7 @@ void ScDocument::TransliterateText( const ScMarkData& rMultiMark, sal_Int32 nTyp
{ {
OSL_ENSURE( rMultiMark.IsMultiMarked(), "TransliterateText: no selection" ); OSL_ENSURE( rMultiMark.IsMultiMarked(), "TransliterateText: no selection" );
utl::TransliterationWrapper aTranslitarationWrapper( xServiceManager, nType ); utl::TransliterationWrapper aTranslitarationWrapper( comphelper::getComponentContext(xServiceManager), nType );
bool bConsiderLanguage = aTranslitarationWrapper.needLanguageForTheMode(); bool bConsiderLanguage = aTranslitarationWrapper.needLanguageForTheMode();
sal_uInt16 nLanguage = LANGUAGE_SYSTEM; sal_uInt16 nLanguage = LANGUAGE_SYSTEM;

View File

@ -1117,7 +1117,7 @@ utl::TransliterationWrapper* ScGlobal::GetpTransliteration()
{ {
const LanguageType eOfficeLanguage = Application::GetSettings().GetLanguage(); const LanguageType eOfficeLanguage = Application::GetSettings().GetLanguage();
pTransliteration = new ::utl::TransliterationWrapper( pTransliteration = new ::utl::TransliterationWrapper(
::comphelper::getProcessServiceFactory(), SC_TRANSLITERATION_IGNORECASE ); ::comphelper::getProcessComponentContext(), SC_TRANSLITERATION_IGNORECASE );
pTransliteration->loadModuleIfNeeded( eOfficeLanguage ); pTransliteration->loadModuleIfNeeded( eOfficeLanguage );
} }
OSL_ENSURE( OSL_ENSURE(
@ -1165,7 +1165,7 @@ CollatorWrapper* ScGlobal::GetCaseCollator()
if ( !pCaseTransliteration ) if ( !pCaseTransliteration )
{ {
const LanguageType eOfficeLanguage = Application::GetSettings().GetLanguage(); const LanguageType eOfficeLanguage = Application::GetSettings().GetLanguage();
pCaseTransliteration = new ::utl::TransliterationWrapper(::comphelper::getProcessServiceFactory(), SC_TRANSLITERATION_CASESENSE ); pCaseTransliteration = new ::utl::TransliterationWrapper(::comphelper::getProcessComponentContext(), SC_TRANSLITERATION_CASESENSE );
pCaseTransliteration->loadModuleIfNeeded( eOfficeLanguage ); pCaseTransliteration->loadModuleIfNeeded( eOfficeLanguage );
} }
return pCaseTransliteration; return pCaseTransliteration;

View File

@ -179,7 +179,7 @@ void ScCellKeywordTranslator::transKeyword(rtl::OUString& rName, const Locale* p
} }
ScCellKeywordTranslator::ScCellKeywordTranslator() : ScCellKeywordTranslator::ScCellKeywordTranslator() :
maTransWrapper( ::comphelper::getProcessServiceFactory(), maTransWrapper( ::comphelper::getProcessComponentContext(),
i18n::TransliterationModules_LOWERCASE_UPPERCASE ) i18n::TransliterationModules_LOWERCASE_UPPERCASE )
{ {
init(); init();

View File

@ -3248,7 +3248,7 @@ void ScInterpreter::ScChar()
static ::rtl::OUString lcl_convertIntoHalfWidth( const ::rtl::OUString & rStr ) static ::rtl::OUString lcl_convertIntoHalfWidth( const ::rtl::OUString & rStr )
{ {
static bool bFirstASCCall = true; static bool bFirstASCCall = true;
static utl::TransliterationWrapper aTrans( ::comphelper::getProcessServiceFactory(), 0 ); static utl::TransliterationWrapper aTrans( ::comphelper::getProcessComponentContext(), 0 );
if( bFirstASCCall ) if( bFirstASCCall )
{ {
@ -3263,7 +3263,7 @@ static ::rtl::OUString lcl_convertIntoHalfWidth( const ::rtl::OUString & rStr )
static ::rtl::OUString lcl_convertIntoFullWidth( const ::rtl::OUString & rStr ) static ::rtl::OUString lcl_convertIntoFullWidth( const ::rtl::OUString & rStr )
{ {
static bool bFirstJISCall = true; static bool bFirstJISCall = true;
static utl::TransliterationWrapper aTrans( ::comphelper::getProcessServiceFactory(), 0 ); static utl::TransliterationWrapper aTrans( ::comphelper::getProcessComponentContext(), 0 );
if( bFirstJISCall ) if( bFirstJISCall )
{ {

View File

@ -1293,7 +1293,7 @@ bool ScImportExport::ExtText2Doc( SvStream& rStrm )
// For date recognition // For date recognition
::utl::TransliterationWrapper aTransliteration( ::utl::TransliterationWrapper aTransliteration(
pDoc->GetServiceManager(), SC_TRANSLITERATION_IGNORECASE ); comphelper::getComponentContext(pDoc->GetServiceManager()), SC_TRANSLITERATION_IGNORECASE );
aTransliteration.loadModuleIfNeeded( eDocLang ); aTransliteration.loadModuleIfNeeded( eDocLang );
CalendarWrapper aCalendar( comphelper::getComponentContext(pDoc->GetServiceManager()) ); CalendarWrapper aCalendar( comphelper::getComponentContext(pDoc->GetServiceManager()) );
aCalendar.loadDefaultCalendar( aCalendar.loadDefaultCalendar(
@ -1303,7 +1303,7 @@ bool ScImportExport::ExtText2Doc( SvStream& rStrm )
if ( eDocLang != LANGUAGE_ENGLISH_US ) if ( eDocLang != LANGUAGE_ENGLISH_US )
{ {
pEnglishTransliteration = new ::utl::TransliterationWrapper ( pEnglishTransliteration = new ::utl::TransliterationWrapper (
pDoc->GetServiceManager(), SC_TRANSLITERATION_IGNORECASE ); comphelper::getComponentContext(pDoc->GetServiceManager()), SC_TRANSLITERATION_IGNORECASE );
aTransliteration.loadModuleIfNeeded( LANGUAGE_ENGLISH_US ); aTransliteration.loadModuleIfNeeded( LANGUAGE_ENGLISH_US );
pEnglishCalendar = new CalendarWrapper ( comphelper::getComponentContext(pDoc->GetServiceManager()) ); pEnglishCalendar = new CalendarWrapper ( comphelper::getComponentContext(pDoc->GetServiceManager()) );
pEnglishCalendar->loadDefaultCalendar( pEnglishCalendar->loadDefaultCalendar(

View File

@ -32,6 +32,15 @@
#include <com/sun/star/uno/Reference.hxx> #include <com/sun/star/uno/Reference.hxx>
#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/lang/XMultiServiceFactory.hpp>
namespace comphelper {
com::sun::star::uno::Reference< com::sun::star::uno::XComponentContext >
getComponentContext(
com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory >
const & factory);
}
/* /*
On demand instanciation and initialization of several i18n wrappers, On demand instanciation and initialization of several i18n wrappers,
helping the number formatter to not perform worse than it already does. helping the number formatter to not perform worse than it already does.
@ -300,7 +309,7 @@ public:
if ( !bValid ) if ( !bValid )
{ {
if ( !pPtr ) if ( !pPtr )
pPtr = new ::utl::TransliterationWrapper( xSMgr, nType ); pPtr = new ::utl::TransliterationWrapper( comphelper::getComponentContext(xSMgr), nType );
pPtr->loadModuleIfNeeded( eLanguage ); pPtr->loadModuleIfNeeded( eLanguage );
bValid = true; bValid = true;
} }
@ -310,7 +319,7 @@ public:
const ::utl::TransliterationWrapper* getForModule( const String& rModule, LanguageType eLang ) const const ::utl::TransliterationWrapper* getForModule( const String& rModule, LanguageType eLang ) const
{ {
if ( !pPtr ) if ( !pPtr )
pPtr = new ::utl::TransliterationWrapper( xSMgr, nType ); pPtr = new ::utl::TransliterationWrapper( comphelper::getComponentContext(xSMgr), nType );
pPtr->loadModuleByImplName( rModule, eLang ); pPtr->loadModuleByImplName( rModule, eLang );
bValid = false; // reforce settings change in get() bValid = false; // reforce settings change in get()
return pPtr; return pPtr;

View File

@ -865,9 +865,9 @@ namespace
public: public:
TransWrp() TransWrp()
{ {
uno::Reference< lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
xTransWrp.reset(new ::utl::TransliterationWrapper( xMSF, xTransWrp.reset(new ::utl::TransliterationWrapper( xContext,
i18n::TransliterationModules_IGNORE_CASE | i18n::TransliterationModules_IGNORE_CASE |
i18n::TransliterationModules_IGNORE_KANA | i18n::TransliterationModules_IGNORE_KANA |
i18n::TransliterationModules_IGNORE_WIDTH )); i18n::TransliterationModules_IGNORE_WIDTH ));

View File

@ -1126,7 +1126,7 @@ void SwEditShell::SetExtTextInputData( const CommandExtTextInputData& rData )
void SwEditShell::TransliterateText( sal_uInt32 nType ) void SwEditShell::TransliterateText( sal_uInt32 nType )
{ {
utl::TransliterationWrapper aTrans( ::comphelper::getProcessServiceFactory(), nType ); utl::TransliterationWrapper aTrans( ::comphelper::getProcessComponentContext(), nType );
StartAllAction(); StartAllAction();
SET_CURR_SHELL( this ); SET_CURR_SHELL( this );

View File

@ -382,7 +382,7 @@ void SwUndoTransliterate::RepeatImpl(::sw::RepeatContext & rContext)
void SwUndoTransliterate::DoTransliterate(SwDoc & rDoc, SwPaM & rPam) void SwUndoTransliterate::DoTransliterate(SwDoc & rDoc, SwPaM & rPam)
{ {
utl::TransliterationWrapper aTrans( ::comphelper::getProcessServiceFactory(), nType ); utl::TransliterationWrapper aTrans( ::comphelper::getProcessComponentContext(), nType );
rDoc.TransliterateText( rPam, aTrans ); rDoc.TransliterateText( rPam, aTrans );
} }

View File

@ -25,8 +25,8 @@
#include <com/sun/star/i18n/XExtendedTransliteration.hpp> #include <com/sun/star/i18n/XExtendedTransliteration.hpp>
namespace com { namespace sun { namespace star { namespace com { namespace sun { namespace star {
namespace lang { namespace uno {
class XMultiServiceFactory; class XComponentContext;
} }
}}} }}}
@ -35,8 +35,6 @@ namespace utl
class UNOTOOLS_DLLPUBLIC TransliterationWrapper class UNOTOOLS_DLLPUBLIC TransliterationWrapper
{ {
::com::sun::star::uno::Reference<
::com::sun::star::lang::XMultiServiceFactory > xSMgr;
::com::sun::star::uno::Reference< ::com::sun::star::uno::Reference<
::com::sun::star::i18n::XExtendedTransliteration > xTrans; ::com::sun::star::i18n::XExtendedTransliteration > xTrans;
::com::sun::star::lang::Locale aLocale; ::com::sun::star::lang::Locale aLocale;
@ -53,7 +51,7 @@ class UNOTOOLS_DLLPUBLIC TransliterationWrapper
public: public:
TransliterationWrapper( const ::com::sun::star::uno::Reference< TransliterationWrapper( const ::com::sun::star::uno::Reference<
::com::sun::star::lang::XMultiServiceFactory > & xSF, ::com::sun::star::uno::XComponentContext > & rxContext,
sal_uInt32 nType ); sal_uInt32 nType );
~TransliterationWrapper(); ~TransliterationWrapper();

View File

@ -24,6 +24,7 @@
#include "instance.hxx" #include "instance.hxx"
#include <com/sun/star/i18n/TransliterationModulesExtra.hpp> #include <com/sun/star/i18n/TransliterationModulesExtra.hpp>
#include <com/sun/star/i18n/Transliteration.hpp>
using namespace ::com::sun::star::lang; using namespace ::com::sun::star::lang;
using namespace ::com::sun::star::i18n; using namespace ::com::sun::star::i18n;
@ -31,14 +32,11 @@ using namespace ::com::sun::star::uno;
using namespace ::utl; using namespace ::utl;
TransliterationWrapper::TransliterationWrapper( TransliterationWrapper::TransliterationWrapper(
const Reference< XMultiServiceFactory > & xSF, const Reference< XComponentContext > & rxContext,
sal_uInt32 nTyp ) sal_uInt32 nTyp )
: xSMgr( xSF ), nType( nTyp ), nLanguage( 0 ), bFirstCall( sal_True ) : nType( nTyp ), nLanguage( 0 ), bFirstCall( sal_True )
{ {
xTrans = Reference< XExtendedTransliteration > ( xTrans = Transliteration::create(rxContext);
intl_createInstance( xSMgr, "com.sun.star.i18n.Transliteration",
"TransliterationWrapper" ), UNO_QUERY );
DBG_ASSERT( xTrans.is(), "TransliterationWrapper: no Transliteraion available" );
} }

View File

@ -27,6 +27,7 @@
************************************************************************/ ************************************************************************/
#include "comphelper/processfactory.hxx"
#include "unotools/localedatawrapper.hxx" #include "unotools/localedatawrapper.hxx"
#include "unotools/transliterationwrapper.hxx" #include "unotools/transliterationwrapper.hxx"
@ -72,7 +73,7 @@ utl::TransliterationWrapper& vcl::I18nHelper::ImplGetTransliterationWrapper() co
if ( mbTransliterateIgnoreCase ) if ( mbTransliterateIgnoreCase )
nModules |= i18n::TransliterationModules_IGNORE_CASE; nModules |= i18n::TransliterationModules_IGNORE_CASE;
((vcl::I18nHelper*)this)->mpTransliterationWrapper = new utl::TransliterationWrapper( mxMSF, (i18n::TransliterationModules)nModules ); ((vcl::I18nHelper*)this)->mpTransliterationWrapper = new utl::TransliterationWrapper( comphelper::getComponentContext(mxMSF), (i18n::TransliterationModules)nModules );
((vcl::I18nHelper*)this)->mpTransliterationWrapper->loadModuleIfNeeded( MsLangId::convertLocaleToLanguage( maLocale ) ); ((vcl::I18nHelper*)this)->mpTransliterationWrapper->loadModuleIfNeeded( MsLangId::convertLocaleToLanguage( maLocale ) );
} }
return *mpTransliterationWrapper; return *mpTransliterationWrapper;

View File

@ -258,7 +258,7 @@ class ResultSetForQueryFactory
{ {
private: private:
uno::Reference< lang::XMultiServiceFactory > m_xSMgr; uno::Reference< uno::XComponentContext > m_xContext;
uno::Reference< ucb::XContentProvider > m_xProvider; uno::Reference< ucb::XContentProvider > m_xProvider;
sal_Int32 m_nOpenMode; sal_Int32 m_nOpenMode;
uno::Sequence< beans::Property > m_seq; uno::Sequence< beans::Property > m_seq;
@ -270,14 +270,14 @@ private:
public: public:
ResultSetForQueryFactory( ResultSetForQueryFactory(
const uno::Reference< lang::XMultiServiceFactory >& xSMgr, const uno::Reference< uno::XComponentContext >& rxContext,
const uno::Reference< ucb::XContentProvider >& xProvider, const uno::Reference< ucb::XContentProvider >& xProvider,
sal_Int32 nOpenMode, sal_Int32 nOpenMode,
const uno::Sequence< beans::Property >& seq, const uno::Sequence< beans::Property >& seq,
const uno::Sequence< ucb::NumberedSortingInfo >& seqSort, const uno::Sequence< ucb::NumberedSortingInfo >& seqSort,
URLParameter aURLParameter, URLParameter aURLParameter,
Databases* pDatabases ) Databases* pDatabases )
: m_xSMgr( xSMgr ), : m_xContext( rxContext ),
m_xProvider( xProvider ), m_xProvider( xProvider ),
m_nOpenMode( nOpenMode ), m_nOpenMode( nOpenMode ),
m_seq( seq ), m_seq( seq ),
@ -289,7 +289,7 @@ public:
ResultSetBase* createResultSet() ResultSetBase* createResultSet()
{ {
return new ResultSetForQuery( m_xSMgr, return new ResultSetForQuery( m_xContext,
m_xProvider, m_xProvider,
m_nOpenMode, m_nOpenMode,
m_seq, m_seq,
@ -420,7 +420,7 @@ uno::Any SAL_CALL Content::execute(
aOpenCommand, aOpenCommand,
Environment, Environment,
new ResultSetForQueryFactory( new ResultSetForQueryFactory(
m_xSMgr, comphelper::getComponentContext(m_xSMgr),
m_xProvider.get(), m_xProvider.get(),
aOpenCommand.Mode, aOpenCommand.Mode,
aOpenCommand.Properties, aOpenCommand.Properties,

View File

@ -29,7 +29,7 @@
#include <comphelper/processfactory.hxx> #include <comphelper/processfactory.hxx>
#include <com/sun/star/ucb/Command.hpp> #include <com/sun/star/ucb/Command.hpp>
#include <com/sun/star/ucb/XCommandEnvironment.hpp> #include <com/sun/star/ucb/XCommandEnvironment.hpp>
#include <com/sun/star/i18n/XExtendedTransliteration.hpp> #include <com/sun/star/i18n/Transliteration.hpp>
#include <com/sun/star/ucb/XCommandProcessor.hpp> #include <com/sun/star/ucb/XCommandProcessor.hpp>
#include <com/sun/star/lang/Locale.hpp> #include <com/sun/star/lang/Locale.hpp>
#include <com/sun/star/script/XInvocation.hpp> #include <com/sun/star/script/XInvocation.hpp>
@ -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, const uno::Reference< XContentProvider >& xProvider,
sal_Int32 nOpenMode, sal_Int32 nOpenMode,
const uno::Sequence< beans::Property >& seq, const uno::Sequence< beans::Property >& seq,
const uno::Sequence< NumberedSortingInfo >& seqSort, const uno::Sequence< NumberedSortingInfo >& seqSort,
URLParameter& aURLParameter, URLParameter& aURLParameter,
Databases* pDatabases ) Databases* pDatabases )
: ResultSetBase( comphelper::getComponentContext(xMSF),xProvider,nOpenMode,seq,seqSort ), : ResultSetBase( rxContext,xProvider,nOpenMode,seq,seqSort ),
m_aURLParameter( aURLParameter ) m_aURLParameter( aURLParameter )
{ {
Reference< XTransliteration > xTrans( Reference< XExtendedTransliteration > xTrans = Transliteration::create( rxContext );
xMSF->createInstance( rtl::OUString( "com.sun.star.i18n.Transliteration" ) ),
UNO_QUERY );
Locale aLocale( aURLParameter.get_language(), Locale aLocale( aURLParameter.get_language(),
rtl::OUString(), rtl::OUString(),
rtl::OUString() ); rtl::OUString() );
if(xTrans.is()) xTrans->loadModule(TransliterationModules_UPPERCASE_LOWERCASE,
xTrans->loadModule(TransliterationModules_UPPERCASE_LOWERCASE, aLocale );
aLocale );
vector< vector< rtl::OUString > > queryList; vector< vector< rtl::OUString > > queryList;
{ {
@ -121,11 +118,9 @@ ResultSetForQuery::ResultSetForQuery( const uno::Reference< lang::XMultiServiceF
vector< rtl::OUString > currentQuery; vector< rtl::OUString > currentQuery;
rtl::OUString tmp(query.copy( 0,idx )); rtl::OUString tmp(query.copy( 0,idx ));
rtl:: OUString toliterate = tmp; rtl:: OUString toliterate = tmp;
if(xTrans.is()) { Sequence<sal_Int32> aSeq;
Sequence<sal_Int32> aSeq; toliterate = xTrans->transliterate(
toliterate = xTrans->transliterate( tmp,0,tmp.getLength(),aSeq);
tmp,0,tmp.getLength(),aSeq);
}
currentQuery.push_back( toliterate ); currentQuery.push_back( toliterate );
queryList.push_back( currentQuery ); queryList.push_back( currentQuery );

View File

@ -19,7 +19,7 @@
#ifndef _RESULTSETFORQUERY_HXX #ifndef _RESULTSETFORQUERY_HXX
#define _RESULTSETFORQUERY_HXX #define _RESULTSETFORQUERY_HXX
#include <com/sun/star/lang/XMultiServiceFactory.hpp> #include <com/sun/star/uno/XComponentContext.hpp>
#include <com/sun/star/ucb/XContentProvider.hpp> #include <com/sun/star/ucb/XContentProvider.hpp>
#include <com/sun/star/beans/Property.hpp> #include <com/sun/star/beans/Property.hpp>
#include <com/sun/star/ucb/NumberedSortingInfo.hpp> #include <com/sun/star/ucb/NumberedSortingInfo.hpp>
@ -36,7 +36,7 @@ namespace chelp {
{ {
public: public:
ResultSetForQuery( const com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory>& xMSF, ResultSetForQuery( const com::sun::star::uno::Reference<com::sun::star::uno::XComponentContext>& rxContext,
const com::sun::star::uno::Reference<com::sun::star::ucb::XContentProvider>& xProvider, const com::sun::star::uno::Reference<com::sun::star::ucb::XContentProvider>& xProvider,
sal_Int32 nOpenMode, sal_Int32 nOpenMode,
const com::sun::star::uno::Sequence< com::sun::star::beans::Property >& seq, const com::sun::star::uno::Sequence< com::sun::star::beans::Property >& seq,