Kaydet (Commit) a333ad86 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

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
üst 7ee94597
...@@ -4683,11 +4683,12 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, ...@@ -4683,11 +4683,12 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo,
// get service provider // get service provider
uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() ); uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() );
uno::Reference< linguistic2::XLinguServiceManager2> xLinguMgr = linguistic2::LinguServiceManager::create(xContext); uno::Reference< linguistic2::XHyphenator > xHyph;
uno::Reference< linguistic2::XHyphenator > xHyph = xLinguMgr->getHyphenator(); if ( nStyle & TEXT_DRAW_WORDBREAK )
{
i18n::LineBreakHyphenationOptions aHyphOptions( xHyph, uno::Sequence <beans::PropertyValue>(), 1 ); uno::Reference< linguistic2::XLinguServiceManager2> xLinguMgr = linguistic2::LinguServiceManager::create(xContext);
i18n::LineBreakUserOptions aUserOptions; xHyph = xLinguMgr->getHyphenator();
}
sal_Int32 nPos = 0; sal_Int32 nPos = 0;
sal_Int32 nLen = rStr.getLength(); sal_Int32 nLen = rStr.getLength();
...@@ -4709,6 +4710,8 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo, ...@@ -4709,6 +4710,8 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo,
const com::sun::star::lang::Locale& rDefLocale(Application::GetSettings().GetUILanguageTag().getLocale()); const com::sun::star::lang::Locale& rDefLocale(Application::GetSettings().GetUILanguageTag().getLocale());
xub_StrLen nSoftBreak = _rLayout.GetTextBreak( rStr, nWidth, nPos, nBreakPos - nPos ); xub_StrLen nSoftBreak = _rLayout.GetTextBreak( rStr, nWidth, nPos, nBreakPos - nPos );
DBG_ASSERT( nSoftBreak < nBreakPos, "Break?!" ); 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 ); i18n::LineBreakResults aLBR = xBI->getLineBreak( aText, nSoftBreak, rDefLocale, nPos, aHyphOptions, aUserOptions );
nBreakPos = (xub_StrLen)aLBR.breakIndex; nBreakPos = (xub_StrLen)aLBR.breakIndex;
if ( nBreakPos <= nPos ) if ( nBreakPos <= nPos )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment