diff options
author | Noel Grandin <noel@peralex.com> | 2012-11-02 16:07:50 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-11-15 08:28:43 +0100 |
commit | 3f15a663b273e4a437fd68335d6eab2b11fc80c9 (patch) | |
tree | 5651b63a998b26f12c5626f4a3fc8490bceed35b /editeng/source | |
parent | ed80674ec793f640916ad4162ee4121aeceac7f6 (diff) |
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
Diffstat (limited to 'editeng/source')
-rw-r--r-- | editeng/source/editeng/impedit4.cxx | 4 | ||||
-rw-r--r-- | editeng/source/editeng/textconv.cxx | 4 | ||||
-rw-r--r-- | editeng/source/editeng/textconv.hxx | 2 | ||||
-rw-r--r-- | editeng/source/misc/hangulhanja.cxx | 33 |
4 files changed, 18 insertions, 25 deletions
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 <com/sun/star/i18n/BreakIterator.hpp> #include <com/sun/star/i18n/ScriptType.hpp> #include <com/sun/star/i18n/UnicodeScript.hpp> -#include <com/sun/star/i18n/XTextConversion.hpp> +#include <com/sun/star/i18n/TextConversion.hpp> #include <com/sun/star/i18n/XExtendedTextConversion.hpp> #include <com/sun/star/i18n/TextConversionType.hpp> #include <com/sun/star/i18n/TextConversionOption.hpp> @@ -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 ) ) { } |