[Libreoffice-commits] core.git: vcl/source

Caolán McNamara caolanm at redhat.com
Fri Jul 7 07:41:24 UTC 2017


 vcl/source/outdev/text.cxx |   14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

New commits:
commit 8d80832a91520ae43f420f244bba278ead7689bc
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Jul 6 21:43:44 2017 +0100

    xContext only needed for bHyphenate case
    
    Change-Id: I5c1d7d43fb26c4adf14de6395e40833eaa3d0164
    Reviewed-on: https://gerrit.libreoffice.org/39669
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/source/outdev/text.cxx b/vcl/source/outdev/text.cxx
index 7d4a729f3bd6..ba9208d5ba1c 100644
--- a/vcl/source/outdev/text.cxx
+++ b/vcl/source/outdev/text.cxx
@@ -472,19 +472,17 @@ long OutputDevice::ImplGetTextLines( ImplMultiTextLineInfo& rLineInfo,
     rLineInfo.Clear();
     if ( !rStr.isEmpty() && (nWidth > 0) )
     {
-        css::uno::Reference < css::i18n::XBreakIterator > xBI;
-        // get service provider
-        css::uno::Reference< css::uno::XComponentContext > xContext( comphelper::getProcessComponentContext() );
-
-        bool bHyphenate = (nStyle & DrawTextFlags::WordBreakHyphenation)
-            == DrawTextFlags::WordBreakHyphenation;
+        const bool bHyphenate = (nStyle & DrawTextFlags::WordBreakHyphenation) == DrawTextFlags::WordBreakHyphenation;
         css::uno::Reference< css::linguistic2::XHyphenator > xHyph;
-        if ( bHyphenate )
+        if (bHyphenate)
         {
-            css::uno::Reference< css::linguistic2::XLinguServiceManager2> xLinguMgr = css::linguistic2::LinguServiceManager::create(xContext);
+            // get service provider
+            css::uno::Reference<css::uno::XComponentContext> xContext(comphelper::getProcessComponentContext());
+            css::uno::Reference<css::linguistic2::XLinguServiceManager2> xLinguMgr = css::linguistic2::LinguServiceManager::create(xContext);
             xHyph = xLinguMgr->getHyphenator();
         }
 
+        css::uno::Reference<css::i18n::XBreakIterator> xBI;
         sal_Int32 nPos = 0;
         sal_Int32 nLen = rStr.getLength();
         while ( nPos < nLen )


More information about the Libreoffice-commits mailing list