[Libreoffice-commits] core.git: vcl/source
Stephan Bergmann
sbergman at redhat.com
Mon Aug 5 05:00:39 PDT 2013
vcl/source/gdi/outdev3.cxx | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
New commits:
commit a333ad86b6f1f79e46ade1e308dbb799b0abc1ea
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Mon Aug 5 13:57:36 2013 +0200
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
diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx
index a0315ee..4a257d4 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 )
More information about the Libreoffice-commits
mailing list