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 --- vcl/source/app/unohelp.cxx | 16 +++------------- vcl/source/control/edit.cxx | 16 +++------------- 2 files changed, 6 insertions(+), 26 deletions(-) (limited to 'vcl') diff --git a/vcl/source/app/unohelp.cxx b/vcl/source/app/unohelp.cxx index 329159250b95..a7ba55577b07 100644 --- a/vcl/source/app/unohelp.cxx +++ b/vcl/source/app/unohelp.cxx @@ -42,7 +42,7 @@ #include #include -#include +#include #include #include #include @@ -136,18 +136,8 @@ uno::Reference< lang::XMultiServiceFactory > vcl::unohelper::GetMultiServiceFact uno::Reference < i18n::XBreakIterator > vcl::unohelper::CreateBreakIterator() { - uno::Reference < i18n::XBreakIterator > xB; - uno::Reference< lang::XMultiServiceFactory > xMSF = GetMultiServiceFactory(); - if ( xMSF.is() ) - { - uno::Reference < uno::XInterface > xI = xMSF->createInstance( ::rtl::OUString("com.sun.star.i18n.BreakIterator") ); - if ( xI.is() ) - { - uno::Any x = xI->queryInterface( ::getCppuType((const uno::Reference< i18n::XBreakIterator >*)0) ); - x >>= xB; - } - } - return xB; + uno::Reference< uno::XComponentContext > xContext = comphelper::getComponentContext(GetMultiServiceFactory()); + return i18n::BreakIterator::create(xContext); } uno::Reference < i18n::XCharacterClassification > vcl::unohelper::CreateCharacterClassification() diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index a8d018e8a7be..40d75bf7b43f 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -46,7 +46,7 @@ #include -#include +#include #include #include #include @@ -857,18 +857,8 @@ uno::Reference < i18n::XBreakIterator > Edit::ImplGetBreakIterator() const //!! since we don't want to become incompatible in the next minor update //!! where this code will get integrated into, xISC will be a local //!! variable instead of a class member! - uno::Reference < i18n::XBreakIterator > xBI; -// if ( !xBI.is() ) - { - uno::Reference< lang::XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); - uno::Reference < XInterface > xI = xMSF->createInstance( OUString("com.sun.star.i18n.BreakIterator") ); - if ( xI.is() ) - { - Any x = xI->queryInterface( ::getCppuType((const uno::Reference< i18n::XBreakIterator >*)0) ); - x >>= xBI; - } - } - return xBI; + uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + return i18n::BreakIterator::create(xContext); } // ----------------------------------------------------------------------- -- cgit