From 5e661008a58677e8871abf93209f81200507b29f Mon Sep 17 00:00:00 2001 From: Matteo Casalin Date: Mon, 1 May 2017 18:12:17 +0200 Subject: OUStrings: constify and reduce temporaries Change-Id: Id1db5c17a346916a326529b750d2ff0a765af5da --- sfx2/source/doc/iframe.cxx | 4 ++-- sfx2/source/doc/objcont.cxx | 7 +++---- sfx2/source/doc/objmisc.cxx | 6 +++--- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/sfx2/source/doc/iframe.cxx b/sfx2/source/doc/iframe.cxx index ad44a090ef2a..8070c90c1e2c 100644 --- a/sfx2/source/doc/iframe.cxx +++ b/sfx2/source/doc/iframe.cxx @@ -327,12 +327,12 @@ uno::Any SAL_CALL IFrameObject::getPropertyValue(const OUString& aPropertyName) { case WID_FRAME_URL: { - aAny <<= OUString( maFrmDescr.GetURL().GetMainURL( INetURLObject::DecodeMechanism::NONE ) ); + aAny <<= maFrmDescr.GetURL().GetMainURL( INetURLObject::DecodeMechanism::NONE ); } break; case WID_FRAME_NAME: { - aAny <<= OUString( maFrmDescr.GetName() ); + aAny <<= maFrmDescr.GetName(); } break; case WID_FRAME_IS_AUTO_SCROLL: diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx index 61d736c027bf..148e265ae524 100644 --- a/sfx2/source/doc/objcont.cxx +++ b/sfx2/source/doc/objcont.cxx @@ -187,7 +187,7 @@ void SfxObjectShell::UpdateDocInfoForSave() } else if ( IsModified() ) { - OUString aUserName = SvtUserOptions().GetFullName(); + const OUString aUserName = SvtUserOptions().GetFullName(); if ( !IsUseUserData() ) { // remove all data pointing to the current user @@ -394,7 +394,7 @@ void SfxObjectShell::UpdateFromTemplate_Impl( ) // created from template? uno::Reference xDocProps(getDocProperties()); - OUString aTemplName( xDocProps->getTemplateName() ); + const OUString aTemplName( xDocProps->getTemplateName() ); OUString aTemplURL( xDocProps->getTemplateURL() ); OUString aFoundName; @@ -462,8 +462,7 @@ void SfxObjectShell::UpdateFromTemplate_Impl( ) bLoad = true; else if ( bCanUpdateFromTemplate == document::UpdateDocMode::ACCORDING_TO_CONFIG ) { - OUString sMessage( SfxResId(STR_QRYTEMPL_MESSAGE).toString() ); - sMessage = sMessage.replaceAll( "$(ARG1)", aTemplName ); + const OUString sMessage( SfxResId(STR_QRYTEMPL_MESSAGE).toString().replaceAll( "$(ARG1)", aTemplName ) ); ScopedVclPtrInstance< sfx2::QueryTemplateBox > aBox(GetDialogParent(), sMessage); if ( RET_YES == aBox->Execute() ) bLoad = true; diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index c91acbf1b401..ab039b5d0e2c 100644 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -203,7 +203,7 @@ void SfxObjectShell::FlushDocInfo() SetModified(); uno::Reference xDocProps(getDocProperties()); DoFlushDocInfo(); // call template method - OUString url(xDocProps->getAutoloadURL()); + const OUString url(xDocProps->getAutoloadURL()); sal_Int32 delay(xDocProps->getAutoloadSecs()); SetAutoLoad( INetURLObject(url), delay * 1000, (delay > 0) || !url.isEmpty() ); @@ -758,11 +758,11 @@ OUString SfxObjectShell::GetTitle( sal_uInt16 nMaxLength ) const return pImpl->aTitle; // must it be numbered? - OUString aNoName(SFX2_RESSTR(STR_NONAME)); + const OUString aNoName(SFX2_RESSTR(STR_NONAME)); if (pImpl->bIsNamedVisible) { // Append number - aNoName += " " + OUString::number(pImpl->nVisualDocumentNumber); + return aNoName + " " + OUString::number(pImpl->nVisualDocumentNumber); } // Document called "Untitled" for the time being -- cgit