diff options
author | Noel Grandin <noel@peralex.com> | 2012-10-15 15:20:48 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-10-23 15:27:49 +0200 |
commit | c0f865c9b5a34b272c9e0b22d18969554265914a (patch) | |
tree | ee4bc2c0579245e92f51c82d91136e32cce7c9ca /sw/source/ui/chrdlg | |
parent | e41f21b4165e40e1564cc75928b4b085ce7072e1 (diff) |
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
Diffstat (limited to 'sw/source/ui/chrdlg')
-rw-r--r-- | sw/source/ui/chrdlg/drpcps.cxx | 46 |
1 files changed, 21 insertions, 25 deletions
diff --git a/sw/source/ui/chrdlg/drpcps.cxx b/sw/source/ui/chrdlg/drpcps.cxx index f96a2e7cd6fc..cd44c3c258f8 100644 --- a/sw/source/ui/chrdlg/drpcps.cxx +++ b/sw/source/ui/chrdlg/drpcps.cxx @@ -44,7 +44,7 @@ #include <sfx2/printer.hxx> #include <com/sun/star/i18n/ScriptType.hpp> #include <editeng/scripttypeitem.hxx> -#include <com/sun/star/i18n/XBreakIterator.hpp> +#include <com/sun/star/i18n/BreakIterator.hpp> #include <comphelper/processfactory.hxx> #include "charatr.hxx" @@ -411,34 +411,30 @@ void SwDropCapsPict::CheckScript( void ) maScriptChanges.clear(); if( !xBreak.is() ) { - Reference< XMultiServiceFactory > xMSF = ::comphelper::getProcessServiceFactory(); - xBreak = Reference< I18N::XBreakIterator >(xMSF->createInstance( - ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.i18n.BreakIterator")) ),UNO_QUERY); + Reference< XComponentContext > xContext = ::comphelper::getProcessComponentContext(); + xBreak = I18N::BreakIterator::create(xContext); } - if( xBreak.is() ) + sal_uInt16 nScript = xBreak->getScriptType( maText, 0 ); + sal_uInt16 nChg = 0; + if( I18N_SCRIPTTYPE::WEAK == nScript ) { - sal_uInt16 nScript = xBreak->getScriptType( maText, 0 ); - sal_uInt16 nChg = 0; - if( I18N_SCRIPTTYPE::WEAK == nScript ) - { - nChg = (xub_StrLen)xBreak->endOfScript( maText, nChg, nScript ); - if( nChg < maText.Len() ) - nScript = xBreak->getScriptType( maText, nChg ); - else - nScript = I18N_SCRIPTTYPE::LATIN; - } + nChg = (xub_StrLen)xBreak->endOfScript( maText, nChg, nScript ); + if( nChg < maText.Len() ) + nScript = xBreak->getScriptType( maText, nChg ); + else + nScript = I18N_SCRIPTTYPE::LATIN; + } - do - { - nChg = (xub_StrLen)xBreak->endOfScript( maText, nChg, nScript ); - maScriptChanges.push_back( _ScriptInfo(0, nScript, nChg) ); + do + { + nChg = (xub_StrLen)xBreak->endOfScript( maText, nChg, nScript ); + maScriptChanges.push_back( _ScriptInfo(0, nScript, nChg) ); - if( nChg < maText.Len() ) - nScript = xBreak->getScriptType( maText, nChg ); - else - break; - } while( sal_True ); - } + if( nChg < maText.Len() ) + nScript = xBreak->getScriptType( maText, nChg ); + else + break; + } while( sal_True ); } Size SwDropCapsPict::CalcTextSize( void ) |