summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorMatteo Casalin <matteo.casalin@yahoo.com>2017-11-01 11:06:28 +0100
committerMatteo Casalin <matteo.casalin@yahoo.com>2017-11-01 11:08:23 +0100
commit7ca48ce45d8c941587e296f34cba98509e35a5b5 (patch)
tree93832a041d7a2a6af3eb033347d2ccc49d79db96 /sw
parent6ee4f63438a2ea7a56a821373679aa56814b2582 (diff)
OUString: avoid temporaries, constify
Change-Id: I595b90b16c2c2a60a61811878ad06ae729a8943c
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/txtnode/fmtatr2.cxx13
-rw-r--r--sw/source/core/txtnode/fntcache.cxx10
-rw-r--r--sw/source/core/txtnode/fntcap.cxx10
-rw-r--r--sw/source/core/txtnode/swfont.cxx15
4 files changed, 17 insertions, 31 deletions
diff --git a/sw/source/core/txtnode/fmtatr2.cxx b/sw/source/core/txtnode/fmtatr2.cxx
index e0a46bff1e22..86e0053b6b31 100644
--- a/sw/source/core/txtnode/fmtatr2.cxx
+++ b/sw/source/core/txtnode/fmtatr2.cxx
@@ -138,8 +138,7 @@ SfxPoolItem* SwFormatAutoFormat::Clone( SfxItemPool* ) const
bool SwFormatAutoFormat::QueryValue( uno::Any& rVal, sal_uInt8 ) const
{
- OUString sCharFormatName = StylePool::nameOf( mpHandle );
- rVal <<= sCharFormatName;
+ rVal <<= StylePool::nameOf( mpHandle );
return true;
}
@@ -479,13 +478,9 @@ bool SwFormatRuby::PutValue( const uno::Any& rVal,
switch( nMemberId )
{
case MID_RUBY_TEXT:
- {
- OUString sTmp;
- bRet = rVal >>= sTmp;
- m_sRubyText = sTmp;
- }
- break;
- case MID_RUBY_ADJUST:
+ bRet = rVal >>= m_sRubyText;
+ break;
+ case MID_RUBY_ADJUST:
{
sal_Int16 nSet = 0;
rVal >>= nSet;
diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx
index 4bba114b9522..6bca3c4c8a52 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -81,9 +81,7 @@ long EvalGridWidthAdd( const SwTextGridItem *const pGrid, const SwDrawTextInfo &
SwDocShell* pDocShell = rInf.GetShell()->GetDoc()->GetDocShell();
SfxStyleSheetBasePool* pBasePool = pDocShell->GetStyleSheetPool();
- OUString sString(SwResId(STR_POOLCOLL_STANDARD));
-
- SfxStyleSheetBase* pStyle = pBasePool->Find(sString, SfxStyleFamily::Para);
+ SfxStyleSheetBase* pStyle = pBasePool->Find(SwResId(STR_POOLCOLL_STANDARD), SfxStyleFamily::Para);
SfxItemSet& aTmpSet = pStyle->GetItemSet();
const SvxFontHeightItem &aDefaultFontItem = static_cast<const SvxFontHeightItem&>(aTmpSet.Get(RES_CHRATR_CJK_FONTSIZE));
@@ -625,10 +623,8 @@ static sal_uInt8 lcl_WhichPunctuation( sal_Unicode cChar )
static bool lcl_IsMonoSpaceFont( const vcl::RenderContext& rOut )
{
- const OUString aStr1( u'\x3008' );
- const OUString aStr2( u'\x307C' );
- const long nWidth1 = rOut.GetTextWidth( aStr1 );
- const long nWidth2 = rOut.GetTextWidth( aStr2 );
+ const long nWidth1 = rOut.GetTextWidth( OUString( u'\x3008' ) );
+ const long nWidth2 = rOut.GetTextWidth( OUString( u'\x307C' ) );
return nWidth1 == nWidth2;
}
diff --git a/sw/source/core/txtnode/fntcap.cxx b/sw/source/core/txtnode/fntcap.cxx
index 2965b496e2d2..ebf7a3086f02 100644
--- a/sw/source/core/txtnode/fntcap.cxx
+++ b/sw/source/core/txtnode/fntcap.cxx
@@ -478,7 +478,6 @@ void SwSubFont::DoOnCapitals( SwDoCapitals &rDo )
// Look if the length of the original text and the ToUpper-converted
// text is different. If yes, do special handling.
- OUString aNewText;
SwCapitalInfo aCapInf(oldText);
bool bCaseMapLengthDiffers(aText.getLength() != oldText.getLength());
if ( bCaseMapLengthDiffers )
@@ -576,8 +575,7 @@ void SwSubFont::DoOnCapitals( SwDoCapitals &rDo )
// Build an own 'changed' string for the given part of the
// source string and use it. That new string may differ in length
// from the source string.
- const OUString aSnippet(oldText.copy(nOldPos, nPos - nOldPos));
- aNewText = CalcCaseMap( aSnippet );
+ const OUString aNewText = CalcCaseMap( oldText.copy(nOldPos, nPos-nOldPos) );
aCapInf.nIdx = nOldPos;
aCapInf.nLen = nPos - nOldPos;
rDo.GetInf().SetIdx( 0 );
@@ -643,8 +641,7 @@ void SwSubFont::DoOnCapitals( SwDoCapitals &rDo )
// Build an own 'changed' string for the given part of the
// source string and use it. That new string may differ in length
// from the source string.
- const OUString aSnippet(oldText.copy(nOldPos, nTmp - nOldPos));
- aNewText = CalcCaseMap( aSnippet );
+ const OUString aNewText = CalcCaseMap( oldText.copy(nOldPos, nTmp-nOldPos) );
aCapInf.nIdx = nOldPos;
aCapInf.nLen = nTmp - nOldPos;
rDo.GetInf().SetIdx( 0 );
@@ -684,8 +681,7 @@ void SwSubFont::DoOnCapitals( SwDoCapitals &rDo )
// Build an own 'changed' string for the given part of the
// source string and use it. That new string may differ in length
// from the source string.
- const OUString aSnippet(oldText.copy(nOldPos, nTmp - nOldPos));
- aNewText = CalcCaseMap( aSnippet );
+ const OUString aNewText = CalcCaseMap( oldText.copy(nOldPos, nTmp-nOldPos) );
aCapInf.nIdx = nOldPos;
aCapInf.nLen = nTmp - nOldPos;
rDo.GetInf().SetIdx( 0 );
diff --git a/sw/source/core/txtnode/swfont.cxx b/sw/source/core/txtnode/swfont.cxx
index b2ac4e733251..ff67f60b34a7 100644
--- a/sw/source/core/txtnode/swfont.cxx
+++ b/sw/source/core/txtnode/swfont.cxx
@@ -1067,7 +1067,7 @@ Size SwSubFont::GetTextSize_( SwDrawTextInfo& rInf )
aTextSize = pLastFont->GetTextSize( rInf );
else
{
- OUString aTmp = CalcCaseMap( rInf.GetText() );
+ const OUString aTmp = CalcCaseMap( rInf.GetText() );
const OUString oldStr = rInf.GetText();
bool bCaseMapLengthDiffers(aTmp.getLength() != oldStr.getLength());
@@ -1079,7 +1079,7 @@ Size SwSubFont::GetTextSize_( SwDrawTextInfo& rInf )
sal_Int32 nOldIdx(rInf.GetIdx());
sal_Int32 nOldLen(rInf.GetLen());
const OUString aSnippet(oldStr.copy(nOldIdx, nOldLen));
- OUString aNewText(CalcCaseMap(aSnippet));
+ const OUString aNewText(CalcCaseMap(aSnippet));
rInf.SetText( aNewText );
rInf.SetIdx( 0 );
@@ -1115,7 +1115,7 @@ Size SwSubFont::GetTextSize_( SwDrawTextInfo& rInf )
{
sal_Int32 nOldIdx(rInf.GetIdx());
sal_Int32 nOldLen(rInf.GetLen());
- OUString aNewText(CH_TXT_ATR_SUBST_FIELDSTART);
+ const OUString aNewText(CH_TXT_ATR_SUBST_FIELDSTART);
rInf.SetText( aNewText );
rInf.SetIdx( 0 );
rInf.SetLen( aNewText.getLength() );
@@ -1127,7 +1127,7 @@ Size SwSubFont::GetTextSize_( SwDrawTextInfo& rInf )
{
sal_Int32 nOldIdx(rInf.GetIdx());
sal_Int32 nOldLen(rInf.GetLen());
- OUString aNewText(CH_TXT_ATR_SUBST_FIELDEND);
+ const OUString aNewText(CH_TXT_ATR_SUBST_FIELDEND);
rInf.SetText( aNewText );
rInf.SetIdx( 0 );
rInf.SetLen( aNewText.getLength() );
@@ -1182,7 +1182,7 @@ void SwSubFont::DrawText_( SwDrawTextInfo &rInf, const bool bGrey )
else
{
const OUString oldStr = rInf.GetText();
- OUString aString( CalcCaseMap(oldStr) );
+ const OUString aString( CalcCaseMap(oldStr) );
bool bCaseMapLengthDiffers(aString.getLength() != oldStr.getLength());
if(bCaseMapLengthDiffers && rInf.GetLen())
@@ -1193,7 +1193,7 @@ void SwSubFont::DrawText_( SwDrawTextInfo &rInf, const bool bGrey )
sal_Int32 nOldIdx(rInf.GetIdx());
sal_Int32 nOldLen(rInf.GetLen());
const OUString aSnippet(oldStr.copy(nOldIdx, nOldLen));
- OUString aNewText = CalcCaseMap(aSnippet);
+ const OUString aNewText = CalcCaseMap(aSnippet);
rInf.SetText( aNewText );
rInf.SetIdx( 0 );
@@ -1373,8 +1373,7 @@ sal_Int32 SwSubFont::GetCursorOfst_( SwDrawTextInfo& rInf )
nCursor = pLastFont->GetCursorOfst( rInf );
else
{
- OUString aTmp = CalcCaseMap( rInf.GetText() );
- rInf.SetText( aTmp );
+ rInf.SetText( CalcCaseMap( rInf.GetText() ) );
nCursor = pLastFont->GetCursorOfst( rInf );
}
rInf.SetKern( nOldKern );