Kaydet (Commit) 3f15a663 authored tarafından Noel Grandin's avatar Noel Grandin Kaydeden (comit) Stephan Bergmann

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
üst ed80674e
......@@ -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,
......
......@@ -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,
......
......@@ -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" );
......
......@@ -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,
......
......@@ -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 ) )
{
}
......
......@@ -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 \
......
......@@ -19,7 +19,7 @@
#ifndef __com_sun_star_i18n_TextConversion_idl__
#define __com_sun_star_i18n_TextConversion_idl__
#include <com/sun/star/i18n/XTextConversion.idl>
#include <com/sun/star/i18n/XExtendedTextConversion.idl>
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;
}; }; }; };
......
......@@ -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,
......
......@@ -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,
......
......@@ -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();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment