[Libreoffice-commits] core.git: sfx2/source sot/source starmath/source svl/qa svl/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Tue Oct 1 08:47:02 UTC 2019


 sfx2/source/appl/sfxhelp.cxx         |   26 +++++++++++---------------
 sfx2/source/bastyp/helper.cxx        |   11 +++++------
 sfx2/source/control/minfitem.cxx     |   10 +++++-----
 sfx2/source/control/msg.cxx          |    4 +---
 sfx2/source/dialog/dinfdlg.cxx       |   15 +++++----------
 sfx2/source/dialog/filedlghelper.cxx |    4 ++--
 sfx2/source/doc/objstor.cxx          |   12 ++++--------
 sfx2/source/doc/templatedlg.cxx      |    4 +---
 sfx2/source/statbar/stbitem.cxx      |    3 +--
 sot/source/sdstor/ucbstorage.cxx     |   23 ++++++-----------------
 starmath/source/cfgitem.cxx          |   12 ++++++------
 starmath/source/symbol.cxx           |    3 +--
 svl/qa/unit/svl.cxx                  |   10 +++++-----
 svl/source/crypto/cryptosign.cxx     |    4 +---
 svl/source/misc/inettype.cxx         |    3 +--
 15 files changed, 55 insertions(+), 89 deletions(-)

New commits:
commit 46c2a3688c9ee7f558f75cbe856c26c4b8849b7e
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Mon Sep 30 15:12:52 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Oct 1 10:46:15 2019 +0200

    loplugin:stringadd n sfx2..svl
    
    Change-Id: Iaf1bbe37449d4e0cfa817909d56d4bffe1e5a184
    Reviewed-on: https://gerrit.libreoffice.org/79893
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx
index 73d2d2cc3619..48147b9245c5 100644
--- a/sfx2/source/appl/sfxhelp.cxx
+++ b/sfx2/source/appl/sfxhelp.cxx
@@ -621,14 +621,12 @@ OUString SfxHelp::GetHelpText( const OUString& aCommandURL, const vcl::Window* p
     // add some debug information?
     if ( bIsDebug )
     {
-        sHelpText += "\n-------------\n";
-        sHelpText += sModuleName;
-        sHelpText += ": ";
-        sHelpText += aCommandURL;
+        sHelpText += "\n-------------\n" +
+            sModuleName + ": " + aCommandURL;
         if ( !aNewHelpId.isEmpty() )
         {
-            sHelpText += " - ";
-            sHelpText += OStringToOUString(aNewHelpId, RTL_TEXTENCODING_UTF8);
+            sHelpText += " - " +
+                OStringToOUString(aNewHelpId, RTL_TEXTENCODING_UTF8);
         }
     }
 
@@ -664,14 +662,12 @@ OUString SfxHelp::GetHelpText(const OUString& aCommandURL, const weld::Widget* p
     // add some debug information?
     if ( bIsDebug )
     {
-        sHelpText += "\n-------------\n";
-        sHelpText += sModuleName;
-        sHelpText += ": ";
-        sHelpText += aCommandURL;
+        sHelpText += "\n-------------\n" +
+            sModuleName + ": " + aCommandURL;
         if ( !aNewHelpId.isEmpty() )
         {
-            sHelpText += " - ";
-            sHelpText += OStringToOUString(aNewHelpId, RTL_TEXTENCODING_UTF8);
+            sHelpText += " - " +
+                OStringToOUString(aNewHelpId, RTL_TEXTENCODING_UTF8);
         }
     }
 
@@ -956,9 +952,9 @@ static bool impl_showOfflineHelp( const OUString& rURL )
     SvStream* pStream = aTempFile.GetStream(StreamMode::WRITE);
     pStream->SetStreamCharSet(RTL_TEXTENCODING_UTF8);
 
-    OUString aTempStr(SHTML1 SHTML2);
-    aTempStr += aHelpLink + SHTML3;
-    aTempStr += aHelpLink + SHTML4;
+    OUString aTempStr = SHTML1 SHTML2 +
+        aHelpLink + SHTML3 +
+        aHelpLink + SHTML4;
 
     pStream->WriteUnicodeOrByteText(aTempStr);
 
diff --git a/sfx2/source/bastyp/helper.cxx b/sfx2/source/bastyp/helper.cxx
index 0976c8f80f28..fec0cd321c8b 100644
--- a/sfx2/source/bastyp/helper.cxx
+++ b/sfx2/source/bastyp/helper.cxx
@@ -93,10 +93,10 @@ std::vector<OUString> SfxContentHelper::GetResultSet( const OUString& rURL )
                 {
                     OUString aTitle( xRow->getString(1) );
                     OUString aType( xRow->getString(2) );
-                    OUString aRow = aTitle;
-                    aRow += "\t";
-                    aRow += aType;
-                    aRow += "\t";
+                    OUString aRow = aTitle +
+                        "\t" +
+                        aType +
+                        "\t";
                     aRow += xContentAccess->queryContentIdentifierString();
                     aList.push_back( aRow );
                 }
@@ -156,8 +156,7 @@ std::vector< OUString > SfxContentHelper::GetHelpTreeViewContents( const OUStrin
                 {
                     OUString aTitle( xRow->getString(1) );
                     bool bFolder = xRow->getBoolean(2);
-                    OUString aRow = aTitle;
-                    aRow += "\t";
+                    OUString aRow = aTitle + "\t";
                     aRow += xContentAccess->queryContentIdentifierString();
                     aRow += "\t";
                     aRow += bFolder ? OUString("1") : OUString("0");
diff --git a/sfx2/source/control/minfitem.cxx b/sfx2/source/control/minfitem.cxx
index 179e78668b60..080723380525 100644
--- a/sfx2/source/control/minfitem.cxx
+++ b/sfx2/source/control/minfitem.cxx
@@ -61,11 +61,11 @@ SfxPoolItem *SfxMacroInfoItem::Clone( SfxItemPool *) const
 
 OUString SfxMacroInfoItem::GetQualifiedName() const
 {
-    OUString aMacroName = aLibName;
-    aMacroName += ".";
-    aMacroName += aModuleName;
-    aMacroName += ".";
-    aMacroName += aMethodName;
+    OUString aMacroName = aLibName +
+        "." +
+        aModuleName +
+        "." +
+        aMethodName;
     return aMacroName;
 }
 
diff --git a/sfx2/source/control/msg.cxx b/sfx2/source/control/msg.cxx
index 711aaf992771..faf69598ea06 100644
--- a/sfx2/source/control/msg.cxx
+++ b/sfx2/source/control/msg.cxx
@@ -46,9 +46,7 @@ sal_uInt16 SfxSlot::GetWhich( const SfxItemPool &rPool ) const
 
 OString SfxSlot::GetCommand() const
 {
-    OString sRet(".uno:");
-    sRet += pUnoName;
-    return sRet;
+    return OString(".uno:") + pUnoName;
 }
 
 OUString SfxSlot::GetCommandString() const
diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx
index e826b0f68409..27239b8ba1f7 100644
--- a/sfx2/source/dialog/dinfdlg.cxx
+++ b/sfx2/source/dialog/dinfdlg.cxx
@@ -102,8 +102,7 @@ namespace {
 
 OUString CreateSizeText( sal_Int64 nSize )
 {
-    OUString aUnitStr(" ");
-    aUnitStr += SfxResId(STR_BYTES);
+    OUString aUnitStr = " " + SfxResId(STR_BYTES);
     sal_Int64 nSize1 = nSize;
     sal_Int64 nSize2 = nSize1;
     sal_Int64 nMega = 1024 * 1024;
@@ -114,24 +113,21 @@ OUString CreateSizeText( sal_Int64 nSize )
     if ( nSize1 >= 10000 && nSize1 < nMega )
     {
         nSize1 /= 1024;
-        aUnitStr = " ";
-        aUnitStr += SfxResId(STR_KB);
+        aUnitStr = " " + SfxResId(STR_KB);
         fSize /= 1024;
         nDec = 0;
     }
     else if ( nSize1 >= nMega && nSize1 < nGiga )
     {
         nSize1 /= nMega;
-        aUnitStr = " ";
-        aUnitStr += SfxResId(STR_MB);
+        aUnitStr = " " + SfxResId(STR_MB);
         fSize /= nMega;
         nDec = 2;
     }
     else if ( nSize1 >= nGiga )
     {
         nSize1 /= nGiga;
-        aUnitStr = " ";
-        aUnitStr += SfxResId(STR_GB);
+        aUnitStr = " " + SfxResId(STR_GB);
         fSize /= nGiga;
         nDec = 3;
     }
@@ -166,8 +162,7 @@ OUString ConvertDateTime_Impl( const OUString& rName,
      OUString aAuthor = comphelper::string::stripStart(rName, ' ');
      if (!aAuthor.isEmpty())
      {
-        aStr += aDelim;
-        aStr += aAuthor;
+        aStr += aDelim + aAuthor;
      }
      return aStr;
 }
diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx
index 1b6b04db197e..958ff03dc230 100644
--- a/sfx2/source/dialog/filedlghelper.cxx
+++ b/sfx2/source/dialog/filedlghelper.cxx
@@ -1176,8 +1176,8 @@ void FileDialogHelper_Impl::setControlHelpIds( const sal_Int16* _pControlId, con
             while ( *_pControlId )
             {
                 DBG_ASSERT( INetURLObject( OStringToOUString( *_pHelpId, RTL_TEXTENCODING_UTF8 ) ).GetProtocol() == INetProtocol::NotValid, "Wrong HelpId!" );
-                OUString sId( sHelpIdPrefix );
-                sId += OUString( *_pHelpId, strlen( *_pHelpId ), RTL_TEXTENCODING_UTF8 );
+                OUString sId = sHelpIdPrefix +
+                    OUString( *_pHelpId, strlen( *_pHelpId ), RTL_TEXTENCODING_UTF8 );
                 xControlAccess->setValue( *_pControlId, ControlActions::SET_HELP_URL, makeAny( sId ) );
 
                 ++_pControlId; ++_pHelpId;
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index aa4357d61b5d..5dfcd6829df5 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -2967,27 +2967,23 @@ sal_Int16 SfxObjectShell::QueryHiddenInformation(HiddenWarningFact eFact, weld::
 
         if ( nStates & HiddenInformation::RECORDEDCHANGES )
         {
-            sMessage += SfxResId(STR_HIDDENINFO_RECORDCHANGES);
-            sMessage += "\n";
+            sMessage += SfxResId(STR_HIDDENINFO_RECORDCHANGES) + "\n";
             bWarning = true;
         }
         if ( nStates & HiddenInformation::NOTES )
         {
-            sMessage += SfxResId(STR_HIDDENINFO_NOTES);
-            sMessage += "\n";
+            sMessage += SfxResId(STR_HIDDENINFO_NOTES) + "\n";
             bWarning = true;
         }
         if ( nStates & HiddenInformation::DOCUMENTVERSIONS )
         {
-            sMessage += SfxResId(STR_HIDDENINFO_DOCVERSIONS);
-            sMessage += "\n";
+            sMessage += SfxResId(STR_HIDDENINFO_DOCVERSIONS) + "\n";
             bWarning = true;
         }
 
         if ( bWarning )
         {
-            sMessage += "\n";
-            sMessage += SfxResId(pResId);
+            sMessage += "\n" + SfxResId(pResId);
             std::unique_ptr<weld::MessageDialog> xWarn(Application::CreateMessageDialog(pParent,
                                                        VclMessageType::Warning, VclButtonsType::YesNo, sMessage));
             xWarn->set_default_response(RET_NO);
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index 54cd6ffd96d8..aac1a07935d9 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -886,9 +886,7 @@ void SfxTemplateManagerDlg::OnTemplateImportCategory(const OUString& sCategory)
 
     sFilterExt += "*.vor";
 
-    sFilterName += " (";
-    sFilterName += sFilterExt;
-    sFilterName += ")";
+    sFilterName += " (" + sFilterExt + ")";
 
     aFileDlg.AddFilter( sFilterName, sFilterExt );
     aFileDlg.SetCurrentFilter( sFilterName );
diff --git a/sfx2/source/statbar/stbitem.cxx b/sfx2/source/statbar/stbitem.cxx
index f041c7a705e9..23fd6ecc41ba 100644
--- a/sfx2/source/statbar/stbitem.cxx
+++ b/sfx2/source/statbar/stbitem.cxx
@@ -119,8 +119,7 @@ svt::StatusbarController* SfxStatusBarControllerFactory(
         sal_uInt16 nSlotId = pSlot->GetSlotId();
         if ( nSlotId > 0 )
         {
-            OString aCmd(".uno:");
-            aCmd += pSlot->GetUnoName();
+            OString aCmd = OString(".uno:") + pSlot->GetUnoName();
             pStatusBar->SetHelpId( nSlotId, aCmd );
             return SfxStatusBarControl::CreateControl( nSlotId, nID, pStatusBar, pModule );
         }
diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx
index 96c593c1aea8..5edae19704cb 100644
--- a/sot/source/sdstor/ucbstorage.cxx
+++ b/sot/source/sdstor/ucbstorage.cxx
@@ -2011,8 +2011,7 @@ sal_Int16 UCBStorage_Impl::Commit()
                 if ( !pContent && pElement->IsModified() )
                 {
                     // if the element has never been opened, no content has been created until now
-                    OUString aName( m_aURL );
-                    aName += "/";
+                    OUString aName = m_aURL + "/";
                     aName += pElement->m_aOriginalName;
                     pContent = new ::ucbhelper::Content( aName, Reference< css::ucb::XCommandEnvironment >(), comphelper::getProcessComponentContext() );
                     xDeleteContent.reset(pContent);  // delete it later on exit scope
@@ -2538,9 +2537,7 @@ BaseStorageStream* UCBStorage::OpenStream( const OUString& rEleName, StreamMode
         if( nMode & StreamMode::NOCREATE )
         {
             SetError( ( nMode & StreamMode::WRITE ) ? SVSTREAM_CANNOT_MAKE : SVSTREAM_FILE_NOT_FOUND );
-            OUString aName( pImp->m_aURL );
-            aName += "/";
-            aName += rEleName;
+            OUString aName = pImp->m_aURL + "/" + rEleName;
             UCBStorageStream* pStream = new UCBStorageStream( aName, nMode, bDirect, pImp->m_bRepairPackage, pImp->m_xProgressHandler );
             pStream->SetError( GetError() );
             pStream->pImp->m_aName = rEleName;
@@ -2593,9 +2590,7 @@ BaseStorageStream* UCBStorage::OpenStream( const OUString& rEleName, StreamMode
 
 void UCBStorage_Impl::OpenStream( UCBStorageElement_Impl* pElement, StreamMode nMode, bool bDirect )
 {
-    OUString aName( m_aURL );
-    aName += "/";
-    aName += pElement->m_aOriginalName;
+    OUString aName = m_aURL + "/" +pElement->m_aOriginalName;
     pElement->m_xStream = new UCBStorageStream_Impl( aName, nMode, nullptr, bDirect, m_bRepairPackage, m_xProgressHandler );
 }
 
@@ -2633,9 +2628,7 @@ BaseStorage* UCBStorage::OpenStorage_Impl( const OUString& rEleName, StreamMode
         if( nMode & StreamMode::NOCREATE )
         {
             SetError( ( nMode & StreamMode::WRITE ) ? SVSTREAM_CANNOT_MAKE : SVSTREAM_FILE_NOT_FOUND );
-            OUString aName( pImp->m_aURL );
-            aName += "/";
-            aName += rEleName;  //  ???
+            OUString aName = pImp->m_aURL + "/" + rEleName;  //  ???
             UCBStorage *pStorage = new UCBStorage( aName, nMode, bDirect, false, pImp->m_bRepairPackage, pImp->m_xProgressHandler );
             pStorage->pImp->m_bIsRoot = false;
             pStorage->pImp->m_bListCreated = true; // the storage is pretty new, nothing to read
@@ -2695,9 +2688,7 @@ BaseStorage* UCBStorage::OpenStorage_Impl( const OUString& rEleName, StreamMode
             bool bIsWritable = bool( pElement->m_xStorage->m_nMode & StreamMode::WRITE );
             if ( !bIsWritable && ( nMode & StreamMode::WRITE ) )
             {
-                OUString aName( pImp->m_aURL );
-                aName += "/";
-                aName += pElement->m_aOriginalName;
+                OUString aName = pImp->m_aURL + "/" + pElement->m_aOriginalName;
                 UCBStorage* pStorage = new UCBStorage( aName, nMode, bDirect, false, pImp->m_bRepairPackage, pImp->m_xProgressHandler );
                 pElement->m_xStorage = pStorage->pImp;
                 return pStorage;
@@ -2744,9 +2735,7 @@ BaseStorage* UCBStorage::OpenStorage_Impl( const OUString& rEleName, StreamMode
 UCBStorage_Impl* UCBStorage_Impl::OpenStorage( UCBStorageElement_Impl* pElement, StreamMode nMode, bool bDirect )
 {
     UCBStorage_Impl* pRet = nullptr;
-    OUString aName( m_aURL );
-    aName += "/";
-    aName += pElement->m_aOriginalName;  //  ???
+    OUString aName = m_aURL + "/" + pElement->m_aOriginalName;  //  ???
 
     pElement->m_bIsStorage = pElement->m_bIsFolder = true;
 
diff --git a/starmath/source/cfgitem.cxx b/starmath/source/cfgitem.cxx
index b77ba7b2938f..76917500dee0 100644
--- a/starmath/source/cfgitem.cxx
+++ b/starmath/source/cfgitem.cxx
@@ -500,8 +500,8 @@ void SmMathConfig::SetSymbols( const std::vector< SmSym > &rNewSymbols )
     OUString aDelim( "/" );
     for (const SmSym& rSymbol : rNewSymbols)
     {
-        OUString  aNodeNameDelim( SYMBOL_LIST );
-        aNodeNameDelim += aDelim;
+        OUString  aNodeNameDelim = SYMBOL_LIST +
+            aDelim;
         aNodeNameDelim += rSymbol.GetExportName();
         aNodeNameDelim += aDelim;
 
@@ -652,10 +652,10 @@ void SmMathConfig::SaveFontFormatList()
         assert(pFntFmt);
         const SmFontFormat aFntFmt(*pFntFmt);
 
-        OUString  aNodeNameDelim( FONT_FORMAT_LIST );
-        aNodeNameDelim += aDelim;
-        aNodeNameDelim += aFntFmtId;
-        aNodeNameDelim += aDelim;
+        OUString  aNodeNameDelim = FONT_FORMAT_LIST +
+            aDelim +
+            aFntFmtId +
+            aDelim;
 
         const OUString *pName = aNames.getConstArray();
 
diff --git a/starmath/source/symbol.cxx b/starmath/source/symbol.cxx
index 22f9cdc376b6..63f20c006263 100644
--- a/starmath/source/symbol.cxx
+++ b/starmath/source/symbol.cxx
@@ -228,8 +228,7 @@ void SmSymbolManager::Load()
     // now add a %i... symbol to the 'iGreek' set for every symbol found in the 'Greek' set.
     const OUString aGreekSymbolSetName(SmLocalizedSymbolData::GetUiSymbolSetName("Greek"));
     const SymbolPtrVec_t    aGreekSymbols( GetSymbolSet( aGreekSymbolSetName ) );
-    OUString aSymbolSetName('i');
-    aSymbolSetName += aGreekSymbolSetName;
+    OUString aSymbolSetName = "i" + aGreekSymbolSetName;
     size_t nSymbols = aGreekSymbols.size();
     for (size_t i = 0;  i < nSymbols;  ++i)
     {
diff --git a/svl/qa/unit/svl.cxx b/svl/qa/unit/svl.cxx
index 9136dc76e930..04394af2090b 100644
--- a/svl/qa/unit/svl.cxx
+++ b/svl/qa/unit/svl.cxx
@@ -410,11 +410,11 @@ void Test::checkPreviewString(SvNumberFormatter& aFormatter,
     Color** ppColor = &pColor;
     if (!aFormatter.GetPreviewString(sCode, fPreviewNumber, sStr, ppColor, eLang))
     {
-        OString aMessage = "GetPreviewString( \"";
-        aMessage += OUStringToOString( sCode, RTL_TEXTENCODING_ASCII_US );
-        aMessage += "\", ";
-        aMessage += OString::number( fPreviewNumber );
-        aMessage += ", sStr, ppColor, ";
+        OString aMessage = "GetPreviewString( \"" +
+            OUStringToOString( sCode, RTL_TEXTENCODING_ASCII_US ) +
+            "\", " +
+            OString::number( fPreviewNumber ) +
+            ", sStr, ppColor, ";
         aMessage += OString::number( static_cast<sal_uInt16>(eLang) );
         aMessage += " ) failed";
         CPPUNIT_FAIL( aMessage.getStr() );
diff --git a/svl/source/crypto/cryptosign.cxx b/svl/source/crypto/cryptosign.cxx
index c85b5d5870d4..4f6d757183ef 100644
--- a/svl/source/crypto/cryptosign.cxx
+++ b/svl/source/crypto/cryptosign.cxx
@@ -370,9 +370,7 @@ OUString PKIStatusToString(int n)
 
 OUString PKIStatusInfoToString(const PKIStatusInfo& rStatusInfo)
 {
-    OUString result;
-
-    result += "{status=";
+    OUString result = "{status=";
     if (rStatusInfo.status.len == 1)
         result += PKIStatusToString(rStatusInfo.status.data[0]);
     else
diff --git a/svl/source/misc/inettype.cxx b/svl/source/misc/inettype.cxx
index 9c620694e36f..ea3675889aaa 100644
--- a/svl/source/misc/inettype.cxx
+++ b/svl/source/misc/inettype.cxx
@@ -262,8 +262,7 @@ INetContentType INetContentTypes::GetContentType(OUString const & rTypeName)
     OUString aSubType;
     if (parse(rTypeName, aType, aSubType))
     {
-        aType += "/";
-        aType += aSubType;
+        aType += "/" + aSubType;
         MediaTypeEntry const * pEntry = seekEntry(aType, aStaticTypeNameMap,
                                                   CONTENT_TYPE_LAST + 1);
         return pEntry ? pEntry->m_eTypeID : CONTENT_TYPE_UNKNOWN;


More information about the Libreoffice-commits mailing list