From 3f15a663b273e4a437fd68335d6eab2b11fc80c9 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 2 Nov 2012 16:07:50 +0200 Subject: fdo#46808, use service constructor for i18n::TextConversion Modify the service to return XExtendedTextConversion, since that is backwards compatible and the service implements it. Change-Id: I2923969135c396d643c501ed56e0528c0bd7c14a --- editeng/inc/editeng/hangulhanja.hxx | 2 +- editeng/source/editeng/impedit4.cxx | 4 ++-- editeng/source/editeng/textconv.cxx | 4 ++-- editeng/source/editeng/textconv.hxx | 2 +- editeng/source/misc/hangulhanja.cxx | 33 +++++++++++----------------- offapi/UnoApi_offapi.mk | 2 +- offapi/com/sun/star/i18n/TextConversion.idl | 10 ++------- offapi/type_reference/types.rdb | Bin 7655424 -> 7655424 bytes sw/inc/hhcwrp.hxx | 2 +- sw/source/ui/lingu/hhcwrp.cxx | 4 ++-- sw/source/ui/uiview/viewling.cxx | 6 ++--- 11 files changed, 28 insertions(+), 41 deletions(-) diff --git a/editeng/inc/editeng/hangulhanja.hxx b/editeng/inc/editeng/hangulhanja.hxx index 614ad6c326d6..d88d39284509 100644 --- a/editeng/inc/editeng/hangulhanja.hxx +++ b/editeng/inc/editeng/hangulhanja.hxx @@ -110,7 +110,7 @@ namespace editeng public: HangulHanjaConversion( Window* _pUIParent, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& _rxORB, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, const ::com::sun::star::lang::Locale& _rSourceLocale, const ::com::sun::star::lang::Locale& _rTargetLocale, const Font* _pTargetFont, diff --git a/editeng/source/editeng/impedit4.cxx b/editeng/source/editeng/impedit4.cxx index 23d9f90b5fd0..f8fa62c7a107 100644 --- a/editeng/source/editeng/impedit4.cxx +++ b/editeng/source/editeng/impedit4.cxx @@ -1563,8 +1563,8 @@ void ImpEditEngine::Convert( EditView* pEditView, bImpConvertFirstCall = true; // next ImpConvert call is the very first in this conversion turn - Reference< lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); - TextConvWrapper aWrp( Application::GetDefDialogParent(), xMSF, + TextConvWrapper aWrp( Application::GetDefDialogParent(), + ::comphelper::getProcessComponentContext(), SvxCreateLocale( nSrcLang ), SvxCreateLocale( nDestLang ), pDestFont, nOptions, bIsInteractive, diff --git a/editeng/source/editeng/textconv.cxx b/editeng/source/editeng/textconv.cxx index d3ef8410a528..4f494f4f56de 100644 --- a/editeng/source/editeng/textconv.cxx +++ b/editeng/source/editeng/textconv.cxx @@ -46,7 +46,7 @@ using namespace com::sun::star::linguistic2; ////////////////////////////////////////////////////////////////////// TextConvWrapper::TextConvWrapper( Window* pWindow, - const Reference< XMultiServiceFactory >& rxMSF, + const Reference< XComponentContext >& rxContext, const Locale& rSourceLocale, const Locale& rTargetLocale, const Font* pTargetFont, @@ -54,7 +54,7 @@ TextConvWrapper::TextConvWrapper( Window* pWindow, sal_Bool bIsInteractive, sal_Bool bIsStart, EditView* pView ) : - HangulHanjaConversion( pWindow, rxMSF, rSourceLocale, rTargetLocale, pTargetFont, nOptions, bIsInteractive ) + HangulHanjaConversion( pWindow, rxContext, rSourceLocale, rTargetLocale, pTargetFont, nOptions, bIsInteractive ) { DBG_ASSERT( pWindow, "TextConvWrapper: window missing" ); diff --git a/editeng/source/editeng/textconv.hxx b/editeng/source/editeng/textconv.hxx index dc531e2f16ef..68975ac502ef 100644 --- a/editeng/source/editeng/textconv.hxx +++ b/editeng/source/editeng/textconv.hxx @@ -95,7 +95,7 @@ protected: public: TextConvWrapper( Window* pWindow, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxMSF, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, const ::com::sun::star::lang::Locale& rSourceLocale, const ::com::sun::star::lang::Locale& rTargetLocale, const Font* pTargetFont, diff --git a/editeng/source/misc/hangulhanja.cxx b/editeng/source/misc/hangulhanja.cxx index e42ba1f9d420..c51519626153 100644 --- a/editeng/source/misc/hangulhanja.cxx +++ b/editeng/source/misc/hangulhanja.cxx @@ -30,7 +30,7 @@ #include #include #include -#include +#include #include #include #include @@ -70,9 +70,9 @@ namespace editeng AbstractHangulHanjaConversionDialog* m_pConversionDialog; // the dialog to display for user interaction Window* m_pUIParent; // the parent window for any UI we raise - Reference< XMultiServiceFactory > - m_xORB; // the service factory to use - Reference< XTextConversion > + Reference< XComponentContext > + m_xContext; // the service factory to use + Reference< XExtendedTextConversion > m_xConverter; // the text conversion service Locale m_aSourceLocale; // the locale we're working with @@ -120,7 +120,7 @@ namespace editeng public: HangulHanjaConversion_Impl( Window* _pUIParent, - const Reference< XMultiServiceFactory >& _rxORB, + const Reference< XComponentContext >& rxContext, const Locale& _rSourceLocale, const Locale& _rTargetLocale, const Font* _pTargetFont, @@ -233,7 +233,7 @@ namespace editeng HangulHanjaConversion_Impl::StringMap HangulHanjaConversion_Impl::m_aRecentlyUsedList = HangulHanjaConversion_Impl::StringMap(); HangulHanjaConversion_Impl::HangulHanjaConversion_Impl( Window* _pUIParent, - const Reference< XMultiServiceFactory >& _rxORB, + const Reference< XComponentContext >& rxContext, const Locale& _rSourceLocale, const Locale& _rTargetLocale, const Font* _pTargetFont, @@ -242,7 +242,7 @@ namespace editeng HangulHanjaConversion* _pAntiImpl ) : m_pConversionDialog( NULL ) , m_pUIParent( _pUIParent ) -, m_xORB( _rxORB ) +, m_xContext( rxContext ) , m_aSourceLocale( _rSourceLocale ) , m_nSourceLang( SvxLocaleToLanguage( _rSourceLocale ) ) , m_nTargetLang( SvxLocaleToLanguage( _rTargetLocale ) ) @@ -259,7 +259,7 @@ namespace editeng { implReadOptionsFromConfiguration(); - DBG_ASSERT( m_xORB.is(), "HangulHanjaConversion_Impl::HangulHanjaConversion_Impl: no ORB!" ); + DBG_ASSERT( m_xContext.is(), "HangulHanjaConversion_Impl::HangulHanjaConversion_Impl: no ORB!" ); // determine conversion type if (m_nSourceLang == LANGUAGE_KOREAN && m_nTargetLang == LANGUAGE_KOREAN) @@ -279,14 +279,7 @@ namespace editeng m_ePrimaryConversionDirection = HHC::eHangulToHanja; // used for eConvHangulHanja m_eCurrentConversionDirection = HHC::eHangulToHanja; // used for eConvHangulHanja - if ( m_xORB.is() ) - { - ::rtl::OUString sTextConversionService( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.i18n.TextConversion" ) ); - m_xConverter = m_xConverter.query( m_xORB->createInstance( sTextConversionService ) ); - if ( !m_xConverter.is() ) - ShowServiceNotAvailableError( m_pUIParent, sTextConversionService, sal_True ); - } - + m_xConverter = TextConversion::create( m_xContext ); } void HangulHanjaConversion_Impl::createDialog() @@ -606,7 +599,7 @@ namespace editeng try { // get the break iterator service - Reference< XBreakIterator > xBreakIter = BreakIterator::create( comphelper::getComponentContext(m_xORB) ); + Reference< XBreakIterator > xBreakIter = BreakIterator::create( m_xContext ); sal_Int32 nNextAsianScript = xBreakIter->beginOfScript( m_sCurrentPortion, m_nCurrentStartIndex, com::sun::star::i18n::ScriptType::ASIAN ); if ( -1 == nNextAsianScript ) nNextAsianScript = xBreakIter->nextScript( m_sCurrentPortion, m_nCurrentStartIndex, com::sun::star::i18n::ScriptType::ASIAN ); @@ -614,7 +607,7 @@ namespace editeng { // found asian text // determine if it's Hangul - CharClass aCharClassificaton( comphelper::getComponentContext(m_xORB), m_aSourceLocale ); + CharClass aCharClassificaton( m_xContext, m_aSourceLocale ); sal_Int16 nScript = aCharClassificaton.getScript( m_sCurrentPortion, sal::static_int_cast< sal_uInt16 >(nNextAsianScript) ); if ( ( UnicodeScript_kHangulJamo == nScript ) || ( UnicodeScript_kHangulCompatibilityJamo == nScript ) @@ -980,11 +973,11 @@ namespace editeng HHC::ConversionDirection HangulHanjaConversion::m_ePrimaryConversionDirectionSave = HHC::eHangulToHanja; HangulHanjaConversion::HangulHanjaConversion( Window* _pUIParent, - const Reference< XMultiServiceFactory >& _rxORB, + const Reference< XComponentContext >& rxContext, const Locale& _rSourceLocale, const Locale& _rTargetLocale, const Font* _pTargetFont, sal_Int32 _nOptions, sal_Bool _bIsInteractive) - :m_pImpl( new HangulHanjaConversion_Impl( _pUIParent, _rxORB, _rSourceLocale, _rTargetLocale, _pTargetFont, _nOptions, _bIsInteractive, this ) ) + :m_pImpl( new HangulHanjaConversion_Impl( _pUIParent, rxContext, _rSourceLocale, _rTargetLocale, _pTargetFont, _nOptions, _bIsInteractive, this ) ) { } diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk index 0f154828a4f7..2cb39c035bc5 100644 --- a/offapi/UnoApi_offapi.mk +++ b/offapi/UnoApi_offapi.mk @@ -147,6 +147,7 @@ $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/i18n,\ CharacterClassification \ LocaleCalendar \ LocaleData \ + TextConversion \ Transliteration \ )) $(eval $(call gb_UnoApi_add_idlfiles_nohdl,offapi,offapi/com/sun/star/linguistic2,\ @@ -862,7 +863,6 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/i18n,\ NativeNumberSupplier \ NumberFormatMapper \ OrdinalSuffix \ - TextConversion \ )) $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,offapi/com/sun/star/image,\ ImageMap \ diff --git a/offapi/com/sun/star/i18n/TextConversion.idl b/offapi/com/sun/star/i18n/TextConversion.idl index e4d180e379c3..312dd70712c4 100644 --- a/offapi/com/sun/star/i18n/TextConversion.idl +++ b/offapi/com/sun/star/i18n/TextConversion.idl @@ -19,7 +19,7 @@ #ifndef __com_sun_star_i18n_TextConversion_idl__ #define __com_sun_star_i18n_TextConversion_idl__ -#include +#include module com { module sun { module star { module i18n { @@ -30,13 +30,7 @@ module com { module sun { module star { module i18n { @since OOo 1.1.2 */ -published service TextConversion -{ - /** to access the text conversion functionality. - */ - interface ::com::sun::star::i18n::XTextConversion; - -}; +published service TextConversion : XExtendedTextConversion; }; }; }; }; diff --git a/offapi/type_reference/types.rdb b/offapi/type_reference/types.rdb index af18ea9d7225..05eb70a05fc3 100644 Binary files a/offapi/type_reference/types.rdb and b/offapi/type_reference/types.rdb differ diff --git a/sw/inc/hhcwrp.hxx b/sw/inc/hhcwrp.hxx index 8f33df4e0217..0be12b5f08d2 100644 --- a/sw/inc/hhcwrp.hxx +++ b/sw/inc/hhcwrp.hxx @@ -96,7 +96,7 @@ protected: public: SwHHCWrapper( SwView* pView, - const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rxMSF, + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext, LanguageType nSourceLanguage, LanguageType nTargetLanguage, const Font *pTargetFont, sal_Int32 nConvOptions, sal_Bool bIsInteractive, diff --git a/sw/source/ui/lingu/hhcwrp.cxx b/sw/source/ui/lingu/hhcwrp.cxx index 015de0cfc62c..7592c1612b73 100644 --- a/sw/source/ui/lingu/hhcwrp.cxx +++ b/sw/source/ui/lingu/hhcwrp.cxx @@ -99,14 +99,14 @@ public: SwHHCWrapper::SwHHCWrapper( SwView* pSwView, - const uno::Reference< lang::XMultiServiceFactory >& rxMSF, + const uno::Reference< uno::XComponentContext >& rxContext, LanguageType nSourceLanguage, LanguageType nTargetLanguage, const Font *pTargetFont, sal_Int32 nConvOptions, sal_Bool bIsInteractive, sal_Bool bStart, sal_Bool bOther, sal_Bool bSelection ) : - editeng::HangulHanjaConversion( &pSwView->GetEditWin(), rxMSF, + editeng::HangulHanjaConversion( &pSwView->GetEditWin(), rxContext, SvxCreateLocale( nSourceLanguage ), SvxCreateLocale( nTargetLanguage ), pTargetFont, diff --git a/sw/source/ui/uiview/viewling.cxx b/sw/source/ui/uiview/viewling.cxx index 1c8fd6eb4eec..466fe5da8c4f 100644 --- a/sw/source/ui/uiview/viewling.cxx +++ b/sw/source/ui/uiview/viewling.cxx @@ -260,9 +260,9 @@ void SwView::StartTextConversion( sal_Bool bOther = !bSelection && !(pWrtShell->GetFrmType(0,sal_True) & FRMTYPE_BODY); { - const uno::Reference< lang::XMultiServiceFactory > xMgr( - comphelper::getProcessServiceFactory() ); - SwHHCWrapper aWrap( this, xMgr, nSourceLang, nTargetLang, pTargetFont, + const uno::Reference< uno::XComponentContext > xContext( + comphelper::getProcessComponentContext() ); + SwHHCWrapper aWrap( this, xContext, nSourceLang, nTargetLang, pTargetFont, nOptions, bIsInteractive, bStart, bOther, bSelection ); aWrap.Convert(); -- cgit v1.2.3