From c0f865c9b5a34b272c9e0b22d18969554265914a Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 15 Oct 2012 15:20:48 +0200 Subject: fdo#46808, use service constructor for i18n::BreakIterator Note that I found a pre-existing bug in linguistic/source/gciterator.cxx but I was not able to fix it, because doing so appears to expose bugs elsewhere! Change-Id: I17fb9108d98a98d0ae13fe5a8e043d2db5b27a6a --- comphelper/source/misc/accessibletexthelper.cxx | 9 +++------ comphelper/source/misc/string.cxx | 5 ++--- 2 files changed, 5 insertions(+), 9 deletions(-) (limited to 'comphelper/source') diff --git a/comphelper/source/misc/accessibletexthelper.cxx b/comphelper/source/misc/accessibletexthelper.cxx index ed85437a180e..6098abc2e3c8 100644 --- a/comphelper/source/misc/accessibletexthelper.cxx +++ b/comphelper/source/misc/accessibletexthelper.cxx @@ -19,6 +19,7 @@ #include #include +#include #include #include #include @@ -58,12 +59,8 @@ namespace comphelper { if ( !m_xBreakIter.is() ) { - Reference< lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); - if ( xMSF.is() ) - { - m_xBreakIter = Reference< i18n::XBreakIterator > - ( xMSF->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.i18n.BreakIterator" ) ) ), UNO_QUERY ); - } + Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + m_xBreakIter = i18n::BreakIterator::create(xContext); } return m_xBreakIter; diff --git a/comphelper/source/misc/string.cxx b/comphelper/source/misc/string.cxx index d35a3faff0ec..2fe8a3f508f8 100644 --- a/comphelper/source/misc/string.cxx +++ b/comphelper/source/misc/string.cxx @@ -34,6 +34,7 @@ #include #include +#include #include @@ -349,9 +350,7 @@ NaturalStringSorter::NaturalStringSorter( rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.i18n.Collator")), rContext), uno::UNO_QUERY_THROW); m_xCollator->loadDefaultCollator(m_aLocale, 0); - m_xBI = uno::Reference< i18n::XBreakIterator >(xFactory->createInstanceWithContext( - rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.i18n.BreakIterator")), rContext), - uno::UNO_QUERY_THROW); + m_xBI = i18n::BreakIterator::create( rContext ); } namespace -- cgit