From 9d8c206ee4a5c130e11a4e786b4286f3362f9ca1 Mon Sep 17 00:00:00 2001 From: Fakabbir Amin Date: Wed, 15 Feb 2017 15:47:31 +0530 Subject: tdf#100726 Improved readability of OUString concatenations Cleanup in filter, framework and svtools directory. Change-Id: Icf4f04cff1207e58ce55ea3dc8c21b0635c3b6ec Reviewed-on: https://gerrit.libreoffice.org/34298 Tested-by: Jenkins Reviewed-by: Stephan Bergmann --- svtools/source/brwbox/brwbox3.cxx | 30 +++++++++++++++--------------- svtools/source/contnr/fileview.cxx | 31 +++++++++++++------------------ svtools/source/contnr/treelistbox.cxx | 9 +++------ svtools/source/control/calendar.cxx | 32 +++++++++++++++----------------- 4 files changed, 46 insertions(+), 56 deletions(-) (limited to 'svtools') diff --git a/svtools/source/brwbox/brwbox3.cxx b/svtools/source/brwbox/brwbox3.cxx index faaf3a31d5cc..b0f5d518e849 100644 --- a/svtools/source/brwbox/brwbox3.cxx +++ b/svtools/source/brwbox/brwbox3.cxx @@ -235,11 +235,11 @@ OUString BrowseBox::GetAccessibleObjectName( ::svt::AccessibleBrowseBoxObjType e else aRetText = "TableCell"; #if OSL_DEBUG_LEVEL > 0 - aRetText += " ["; - aRetText += OUString::number(sal_Int32(GetCurRow())); - aRetText += ","; - aRetText += OUString::number(sal_Int32(GetCurColumnId())); - aRetText += "]"; + aRetText += " [" + + OUString::number(sal_Int32(GetCurRow())) + + "," + + OUString::number(sal_Int32(GetCurColumnId())) + + "]"; #endif break; case ::svt::BBTYPE_ROWHEADERCELL: @@ -248,21 +248,21 @@ OUString BrowseBox::GetAccessibleObjectName( ::svt::AccessibleBrowseBoxObjType e aRetText = OUString::number( rowId ); } #if OSL_DEBUG_LEVEL > 0 - aRetText += " ["; - aRetText += OUString::number(sal_Int32(GetCurRow())); - aRetText += ","; - aRetText += OUString::number(sal_Int32(GetCurColumnId())); - aRetText += "]"; + aRetText += " [" + + OUString::number(sal_Int32(GetCurRow())) + + "," + + OUString::number(sal_Int32(GetCurColumnId())) + + "]"; #endif break; case ::svt::BBTYPE_COLUMNHEADERCELL: aRetText = GetColumnDescription( sal_Int16( _nPosition ) ); #if OSL_DEBUG_LEVEL > 0 - aRetText += " ["; - aRetText += OUString::number(sal_Int32(GetCurRow())); - aRetText += ","; - aRetText += OUString::number(sal_Int32(GetCurColumnId())); - aRetText += "]"; + aRetText += " [" + + OUString::number(sal_Int32(GetCurRow())) + + "," + + OUString::number(sal_Int32(GetCurColumnId())) + + "]"; #endif break; default: diff --git a/svtools/source/contnr/fileview.cxx b/svtools/source/contnr/fileview.cxx index f18e73ff4cdf..bcbf2c775acf 100644 --- a/svtools/source/contnr/fileview.cxx +++ b/svtools/source/contnr/fileview.cxx @@ -1320,8 +1320,7 @@ OUString SvtFileView::GetConfigString() const DBG_ASSERT( pBar, "invalid headerbar" ); // sort order - sRet += OUString::number( mpImpl->mnSortColumn ); - sRet += ";"; + sRet += OUString::number( mpImpl->mnSortColumn ) + ";"; HeaderBarItemBits nBits = pBar->GetItemBits( mpImpl->mnSortColumn ); bool bUp = ( ( nBits & HeaderBarItemBits::UPARROW ) == HeaderBarItemBits::UPARROW ); sRet += bUp ? OUString("1") : OUString("0"); @@ -1331,10 +1330,10 @@ OUString SvtFileView::GetConfigString() const for ( sal_uInt16 i = 0; i < nCount; ++i ) { sal_uInt16 nId = pBar->GetItemId(i); - sRet += OUString::number( nId ); - sRet += ";"; - sRet += OUString::number( pBar->GetItemSize( nId ) ); - sRet += ";"; + sRet += OUString::number( nId ) + + ";" + + OUString::number( pBar->GetItemSize( nId ) ) + + ";"; } sRet = comphelper::string::stripEnd(sRet, ';'); @@ -1893,9 +1892,7 @@ void SvtFileView_Impl::CreateDisplayText_Impl() // title, type, size, date aValue = (*aIt)->GetTitle(); ReplaceTabWithString( aValue ); - aValue += aTab; - aValue += (*aIt)->maType; - aValue += aTab; + aValue += aTab + (*aIt)->maType + aTab; // folders don't have a size if ( ! (*aIt)->mbIsFolder ) aValue += CreateExactSizeText( (*aIt)->maSize ); @@ -1905,9 +1902,9 @@ void SvtFileView_Impl::CreateDisplayText_Impl() { SvtSysLocale aSysLocale; const LocaleDataWrapper& rLocaleData = aSysLocale.GetLocaleData(); - aValue += rLocaleData.getDate( (*aIt)->maModDate ); - aValue += aDateSep; - aValue += rLocaleData.getTime( (*aIt)->maModDate, false ); + aValue += rLocaleData.getDate( (*aIt)->maModDate ) + + aDateSep + + rLocaleData.getTime( (*aIt)->maModDate, false ); } (*aIt)->maDisplayText = aValue; @@ -2135,17 +2132,15 @@ OUString SvtFileView_Impl::FolderInserted( const OUString& rURL, const OUString& // title, type, size, date aValue = pData->GetTitle(); ReplaceTabWithString( aValue ); - aValue += aTab; - aValue += pData->maType; - aValue += aTab; + aValue += aTab + pData->maType + aTab; // folders don't have a size aValue += aTab; // set the date SvtSysLocale aSysLocale; const LocaleDataWrapper& rLocaleData = aSysLocale.GetLocaleData(); - aValue += rLocaleData.getDate( pData->maModDate ); - aValue += aDateSep; - aValue += rLocaleData.getTime( pData->maModDate ); + aValue += rLocaleData.getDate( pData->maModDate ) + + aDateSep + + rLocaleData.getTime( pData->maModDate ); pData->maDisplayText = aValue; maContent.push_back( pData ); diff --git a/svtools/source/contnr/treelistbox.cxx b/svtools/source/contnr/treelistbox.cxx index fcbdc002b123..964158cca94f 100644 --- a/svtools/source/contnr/treelistbox.cxx +++ b/svtools/source/contnr/treelistbox.cxx @@ -1354,8 +1354,7 @@ OUString SvTreeListBox::SearchEntryTextWithHeadTitle( SvTreeListEntry* pEntry ) } if (!headString.isEmpty()) { - sRet += headString ; - sRet += ":" ; + sRet += headString + ":"; } } else @@ -1367,8 +1366,7 @@ OUString SvTreeListBox::SearchEntryTextWithHeadTitle( SvTreeListEntry* pEntry ) } if (!aString.isEmpty()) { - sRet += aString ; - sRet += ":" ; + sRet += aString + ":"; } nHeaderCur++; } @@ -1376,8 +1374,7 @@ OUString SvTreeListBox::SearchEntryTextWithHeadTitle( SvTreeListEntry* pEntry ) } else { - sRet += static_cast( rItem ).GetText(); - sRet += ","; + sRet += static_cast( rItem ).GetText() + ","; } //end want to the column header } diff --git a/svtools/source/control/calendar.cxx b/svtools/source/control/calendar.cxx index a6d1fe0e8e5c..edb5663a6e64 100644 --- a/svtools/source/control/calendar.cxx +++ b/svtools/source/control/calendar.cxx @@ -823,9 +823,9 @@ void Calendar::ImplDraw(vcl::RenderContext& rRenderContext) // display month in title bar nDeltaX = nX; nDeltaY = nY + TITLE_BORDERY; - OUString aMonthText(maCalendarWrapper.getDisplayName(i18n::CalendarDisplayIndex::MONTH, nMonth - 1, 1)); - aMonthText += " "; - aMonthText += OUString::number(nYear); + OUString aMonthText = maCalendarWrapper.getDisplayName(i18n::CalendarDisplayIndex::MONTH, nMonth - 1, 1) + + " " + + OUString::number(nYear); long nMonthTextWidth = rRenderContext.GetTextWidth(aMonthText); long nMonthOffX1 = 0; long nMonthOffX2 = 0; @@ -840,9 +840,9 @@ void Calendar::ImplDraw(vcl::RenderContext& rRenderContext) if (nMonthTextWidth > nMaxMonthWidth) { // Abbreviated month name. - aMonthText = maCalendarWrapper.getDisplayName(i18n::CalendarDisplayIndex::MONTH, nMonth - 1, 0); - aMonthText += " "; - aMonthText += OUString::number(nYear); + aMonthText = maCalendarWrapper.getDisplayName(i18n::CalendarDisplayIndex::MONTH, nMonth - 1, 0) + + " " + + OUString::number(nYear); nMonthTextWidth = rRenderContext.GetTextWidth(aMonthText); } long nTempOff = (mnMonthWidth - nMonthTextWidth + 1) / 2; @@ -1539,23 +1539,21 @@ void Calendar::RequestHelp( const HelpEvent& rHEvt ) maCalendarWrapper.setGregorianDateTime( aDate); sal_uInt16 nWeek = (sal_uInt16) maCalendarWrapper.getValue( i18n::CalendarFieldIndex::WEEK_OF_YEAR); sal_uInt16 nMonth = aDate.GetMonth(); - OUString aStr( maDayText ); - aStr += ": "; - aStr += OUString::number(aDate.GetDayOfYear()); - aStr += " / "; - aStr += maWeekText; - aStr += ": "; - aStr += OUString::number(nWeek); + OUString aStr = maDayText + + ": " + + OUString::number(aDate.GetDayOfYear()) + + " / " + + maWeekText + + ": " + + OUString::number(nWeek); // if year is not the same, add it if ( (nMonth == 12) && (nWeek == 1) ) { - aStr += ", "; - aStr += OUString::number(aDate.GetNextYear()); + aStr += ", " + OUString::number(aDate.GetNextYear()); } else if ( (nMonth == 1) && (nWeek > 50) ) { - aStr += ", "; - aStr += OUString::number(aDate.GetYear()-1); + aStr += ", " + OUString::number(aDate.GetYear()-1); } Help::ShowQuickHelp( this, aDateRect, aStr ); return; -- cgit