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

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Fri Jun 26 08:46:39 UTC 2020


 editeng/source/editeng/impedit3.cxx |   10 ++++------
 editeng/source/misc/svxacorr.cxx    |    8 +++-----
 editeng/source/uno/unotext.cxx      |    6 ++----
 3 files changed, 9 insertions(+), 15 deletions(-)

New commits:
commit 658dbdaa5178012cd8bd54118026cca1b69159d6
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Fri Jun 26 08:39:35 2020 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Fri Jun 26 10:45:57 2020 +0200

    Upcoming improved loplugin:elidestringvar: editeng
    
    Change-Id: I8181697f608f8472482905b21328744fe7909349
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97196
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index 0d00c5197184..eba85963052e 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -79,7 +79,7 @@ using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::beans;
 using namespace ::com::sun::star::linguistic2;
 
-#define CH_HYPH     '-'
+#define CH_HYPH     "-"
 
 #define WRONG_SHOW_MIN       5
 
@@ -2048,7 +2048,6 @@ void ImpEditEngine::ImpBreakLine( ParaPortion* pParaPortion, EditLine* pLine, Te
         // A portion for inserting the separator...
         TextPortion* pHyphPortion = new TextPortion( 0 );
         pHyphPortion->SetKind( PortionKind::HYPHENATOR );
-        OUString aHyphText(CH_HYPH);
         if ( (cAlternateReplChar || cAlternateExtraChar) && bAltFullRight ) // alternation after the break doesn't supported
         {
             TextPortion& rPrev = pParaPortion->GetTextPortions()[nEndPortion];
@@ -2066,7 +2065,7 @@ void ImpEditEngine::ImpBreakLine( ParaPortion* pParaPortion, EditLine* pLine, Te
         SeekCursor( pParaPortion->GetNode(), nBreakPos, aFont );
         aFont.SetPhysFont( GetRefDevice() );
         pHyphPortion->GetSize().setHeight( GetRefDevice()->GetTextHeight() );
-        pHyphPortion->GetSize().setWidth( GetRefDevice()->GetTextWidth( aHyphText ) );
+        pHyphPortion->GetSize().setWidth( GetRefDevice()->GetTextWidth( CH_HYPH ) );
 
         pParaPortion->GetTextPortions().Insert(++nEndPortion, pHyphPortion);
     }
@@ -3195,8 +3194,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, tools::Rectangle aClipRect, Po
 
                                             if ( 0x200B == cChar || 0x2060 == cChar )
                                             {
-                                                const OUString aBlank( ' ' );
-                                                long nHalfBlankWidth = aTmpFont.QuickGetTextSize( pOutDev, aBlank, 0, 1 ).Width() / 2;
+                                                long nHalfBlankWidth = aTmpFont.QuickGetTextSize( pOutDev, " ", 0, 1 ).Width() / 2;
 
                                                 const long nAdvanceX = ( nTmpIdx == nTmpEnd ?
                                                                          rTextPortion.GetSize().Width() :
@@ -3377,7 +3375,7 @@ void ImpEditEngine::Paint( OutputDevice* pOutDev, tools::Rectangle aClipRect, Po
                                 {
                                     if ( rTextPortion.GetExtraValue() )
                                         aText = OUString(rTextPortion.GetExtraValue());
-                                    aText += OUStringChar(CH_HYPH);
+                                    aText += CH_HYPH;
                                     nTextStart = 0;
                                     nTextLen = aText.getLength();
 
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index e8ae81f045d2..efab7967deb7 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -93,7 +93,7 @@ enum class Flags {
 namespace o3tl {
     template<> struct typed_flags<Flags> : is_typed_flags<Flags, 0x07> {};
 }
-static const sal_Unicode cNonBreakingSpace = 0xA0;
+static const sal_Unicode cNonBreakingSpace = 0xA0; // UNICODE code for no break space
 
 static const char pXMLImplWrdStt_ExcptLstStr[] = "WordExceptList.xml";
 static const char pXMLImplCplStt_ExcptLstStr[] = "SentenceExceptList.xml";
@@ -1231,8 +1231,7 @@ void SvxAutoCorrect::InsertQuote( SvxAutoCorrDoc& rDoc, sal_Int32 nInsPos,
 
     if( eType == ACQuotes::NonBreakingSpace )
     {
-        OUString s( cNonBreakingSpace ); // UNICODE code for no break space
-        if( rDoc.Insert( bSttQuote ? nInsPos+1 : nInsPos, s ))
+        if( rDoc.Insert( bSttQuote ? nInsPos+1 : nInsPos, OUStringChar(cNonBreakingSpace) ))
         {
             if( !bSttQuote )
                 ++nInsPos;
@@ -2003,8 +2002,7 @@ bool SvxAutoCorrect::FindInWrdSttExceptList( LanguageType eLang,
 
 static bool lcl_FindAbbreviation(const SvStringsISortDtor* pList, const OUString& sWord)
 {
-    OUString sAbk('~');
-    SvStringsISortDtor::const_iterator it = pList->find( sAbk );
+    SvStringsISortDtor::const_iterator it = pList->find( "~" );
     SvStringsISortDtor::size_type nPos = it - pList->begin();
     if( nPos < pList->size() )
     {
diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx
index 75854d802f42..6cb3adb37a46 100644
--- a/editeng/source/uno/unotext.cxx
+++ b/editeng/source/uno/unotext.cxx
@@ -1774,8 +1774,7 @@ void SAL_CALL SvxUnoTextBase::insertControlCharacter( const uno::Reference< text
     {
     case text::ControlCharacter::PARAGRAPH_BREAK:
     {
-        const OUString aText( u'\x000D' );
-        insertString( xRange, aText, bAbsorb );
+        insertString( xRange, "\x0D", bAbsorb );
 
         return;
     }
@@ -1824,8 +1823,7 @@ void SAL_CALL SvxUnoTextBase::insertControlCharacter( const uno::Reference< text
             aRange.nEndPos  = aRange.nStartPos;
 
             pRange->SetSelection( aRange );
-            const OUString aText( u'\x000D' );
-            pRange->setString( aText );
+            pRange->setString( "\x0D" );
 
             aRange.nStartPos = 0;
             aRange.nStartPara += 1;


More information about the Libreoffice-commits mailing list