diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2013-08-05 13:57:36 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2013-08-05 14:00:13 +0200 |
commit | a333ad86b6f1f79e46ade1e308dbb799b0abc1ea (patch) | |
tree | 966f4a3800982a054f8cdc58d16be0f7ee9ebeac /vcl | |
parent | 7ee94597030e986ece350036093d1e4a213dcddc (diff) |
Do not instantiate LinguServiceManager when it is not needed
...this e.g. prevents endless recursion when broken JVM detection leads to a
message box that in turn tries to instantiate a Java-based service from
LinguServiceManager.
Change-Id: I0e78ab3ea05ce16544846803d5bb84c789a61eef
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/gdi/outdev3.cxx | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx index a0315ee8c1ba..4a257d439ba3 100644 --- a/vcl/source/gdi/outdev3.cxx +++ b/vcl/source/gdi/outdev3.cxx @@ -4683,11 +4683,12 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, // get service provider uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() ); - uno::Reference< linguistic2::XLinguServiceManager2> xLinguMgr = linguistic2::LinguServiceManager::create(xContext); - uno::Reference< linguistic2::XHyphenator > xHyph = xLinguMgr->getHyphenator(); - - i18n::LineBreakHyphenationOptions aHyphOptions( xHyph, uno::Sequence <beans::PropertyValue>(), 1 ); - i18n::LineBreakUserOptions aUserOptions; + uno::Reference< linguistic2::XHyphenator > xHyph; + if ( nStyle & TEXT_DRAW_WORDBREAK ) + { + uno::Reference< linguistic2::XLinguServiceManager2> xLinguMgr = linguistic2::LinguServiceManager::create(xContext); + xHyph = xLinguMgr->getHyphenator(); + } sal_Int32 nPos = 0; sal_Int32 nLen = rStr.getLength(); @@ -4709,6 +4710,8 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, const com::sun::star::lang::Locale& rDefLocale(Application::GetSettings().GetUILanguageTag().getLocale()); xub_StrLen nSoftBreak = _rLayout.GetTextBreak( rStr, nWidth, nPos, nBreakPos - nPos ); DBG_ASSERT( nSoftBreak < nBreakPos, "Break?!" ); + i18n::LineBreakHyphenationOptions aHyphOptions( xHyph, uno::Sequence <beans::PropertyValue>(), 1 ); + i18n::LineBreakUserOptions aUserOptions; i18n::LineBreakResults aLBR = xBI->getLineBreak( aText, nSoftBreak, rDefLocale, nPos, aHyphOptions, aUserOptions ); nBreakPos = (xub_StrLen)aLBR.breakIndex; if ( nBreakPos <= nPos ) |