summaryrefslogtreecommitdiff
path: root/editeng/source/misc/hangulhanja.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-11-02 16:07:50 +0200
committerStephan Bergmann <sbergman@redhat.com>2012-11-15 08:28:43 +0100
commit3f15a663b273e4a437fd68335d6eab2b11fc80c9 (patch)
tree5651b63a998b26f12c5626f4a3fc8490bceed35b /editeng/source/misc/hangulhanja.cxx
parented80674ec793f640916ad4162ee4121aeceac7f6 (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/misc/hangulhanja.cxx')
-rw-r--r--editeng/source/misc/hangulhanja.cxx33
1 files changed, 13 insertions, 20 deletions
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 ) )
{
}