summaryrefslogtreecommitdiff
path: root/sfx2/source
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-10-23 09:46:58 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-10-24 08:35:56 +0200
commit4e51d68dc3595dae8b2519e0a023c9b1ca13a8fd (patch)
treea73bff3750fae258b3b4321cc65e68f6ff8ed0c7 /sfx2/source
parentec98adb2ec71882801a4db031c8e2bcf3075c5a0 (diff)
clang-tidy performance-unnecessary-copy-init in sfx2..svtools
Change-Id: I1e92472b4aaeca1eb1372bd18d10cc9e0766dc39 Reviewed-on: https://gerrit.libreoffice.org/62251 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sfx2/source')
-rw-r--r--sfx2/source/appl/appcfg.cxx2
-rw-r--r--sfx2/source/appl/linkmgr2.cxx2
-rw-r--r--sfx2/source/appl/sfxhelp.cxx2
-rw-r--r--sfx2/source/control/bindings.cxx2
-rw-r--r--sfx2/source/control/emojicontrol.cxx2
-rw-r--r--sfx2/source/control/statcach.cxx2
-rw-r--r--sfx2/source/dialog/templdlg.cxx3
-rw-r--r--sfx2/source/doc/DocumentMetadataAccess.cxx6
-rw-r--r--sfx2/source/doc/docfile.cxx2
-rw-r--r--sfx2/source/doc/objmisc.cxx2
-rw-r--r--sfx2/source/doc/objserv.cxx2
-rw-r--r--sfx2/source/doc/objstor.cxx2
-rw-r--r--sfx2/source/doc/sfxbasemodel.cxx6
-rw-r--r--sfx2/source/doc/templatedlg.cxx6
-rw-r--r--sfx2/source/inet/inettbc.cxx3
-rw-r--r--sfx2/source/notebookbar/NotebookbarPopup.cxx4
-rw-r--r--sfx2/source/sidebar/ResourceManager.cxx3
-rw-r--r--sfx2/source/sidebar/UnoDeck.cxx2
-rw-r--r--sfx2/source/view/classificationcontroller.cxx2
-rw-r--r--sfx2/source/view/frame.cxx2
-rw-r--r--sfx2/source/view/lokcharthelper.cxx4
-rw-r--r--sfx2/source/view/viewfrm.cxx2
22 files changed, 30 insertions, 33 deletions
diff --git a/sfx2/source/appl/appcfg.cxx b/sfx2/source/appl/appcfg.cxx
index 789852b40e4e..5abd5594baeb 100644
--- a/sfx2/source/appl/appcfg.cxx
+++ b/sfx2/source/appl/appcfg.cxx
@@ -733,7 +733,7 @@ void SfxApplication::SetOptions(const SfxItemSet &rSet)
OUString aNoChangeStr( ' ' );
for( sal_uInt32 nPath=0; nPath<nCount; ++nPath )
{
- OUString sValue = pEnumItem->GetValueTextByPos(static_cast<sal_uInt16>(nPath));
+ const OUString& sValue = pEnumItem->GetValueTextByPos(static_cast<sal_uInt16>(nPath));
if ( sValue != aNoChangeStr )
{
switch( nPath )
diff --git a/sfx2/source/appl/linkmgr2.cxx b/sfx2/source/appl/linkmgr2.cxx
index 059dcb22a48b..e9665e6c5e74 100644
--- a/sfx2/source/appl/linkmgr2.cxx
+++ b/sfx2/source/appl/linkmgr2.cxx
@@ -217,7 +217,7 @@ bool LinkManager::GetDisplayNames( const SvBaseLink * pLink,
OUString* pFilter )
{
bool bRet = false;
- const OUString sLNm( pLink->GetLinkSourceName() );
+ const OUString& sLNm( pLink->GetLinkSourceName() );
if( !sLNm.isEmpty() )
{
switch( pLink->GetObjType() )
diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx
index 4d07364cf725..19d08453f1d7 100644
--- a/sfx2/source/appl/sfxhelp.cxx
+++ b/sfx2/source/appl/sfxhelp.cxx
@@ -691,7 +691,7 @@ static bool impl_showOnlineHelp( const OUString& rURL )
static bool impl_showOfflineHelp( const OUString& rURL )
{
- OUString aBaseInstallPath = getHelpRootURL();
+ const OUString& aBaseInstallPath = getHelpRootURL();
OUString const aInternal( "vnd.sun.star.help://" );
OUString aHelpLink( aBaseInstallPath + "/index.html?" );
diff --git a/sfx2/source/control/bindings.cxx b/sfx2/source/control/bindings.cxx
index 3e225cd367c6..2b2409be3369 100644
--- a/sfx2/source/control/bindings.cxx
+++ b/sfx2/source/control/bindings.cxx
@@ -1570,7 +1570,7 @@ SfxItemState SfxBindings::QueryState( sal_uInt16 nSlot, std::unique_ptr<SfxPoolI
else
{
css::uno::Any aAny = xBind->GetStatus().State;
- css::uno::Type aType = aAny.getValueType();
+ const css::uno::Type& aType = aAny.getValueType();
if ( aType == cppu::UnoType<bool>::get() )
{
diff --git a/sfx2/source/control/emojicontrol.cxx b/sfx2/source/control/emojicontrol.cxx
index 635408e8d77f..12b640c191fe 100644
--- a/sfx2/source/control/emojicontrol.cxx
+++ b/sfx2/source/control/emojicontrol.cxx
@@ -160,7 +160,7 @@ IMPL_LINK_NOARG(SfxEmojiControl, ActivatePageHdl, TabControl*, void)
IMPL_STATIC_LINK(SfxEmojiControl, InsertHdl, ThumbnailViewItem*, pItem, void)
{
- OUString sHexText = pItem->getTitle();
+ const OUString& sHexText = pItem->getTitle();
sal_uInt32 cEmojiChar = sHexText.toUInt32(16);
uno::Reference< uno::XComponentContext > xContext( comphelper::getProcessComponentContext() );
diff --git a/sfx2/source/control/statcach.cxx b/sfx2/source/control/statcach.cxx
index db9c1e6945eb..a190168ea1ce 100644
--- a/sfx2/source/control/statcach.cxx
+++ b/sfx2/source/control/statcach.cxx
@@ -90,7 +90,7 @@ void SAL_CALL BindDispatch_Impl::statusChanged( const css::frame::FeatureStateE
eState = SfxItemState::DEFAULT;
css::uno::Any aAny = aStatus.State;
- css::uno::Type aType = aAny.getValueType();
+ const css::uno::Type& aType = aAny.getValueType();
if ( aType == cppu::UnoType< bool >::get() )
{
bool bTemp = false;
diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx
index 226e59ba7431..78d21ebeba20 100644
--- a/sfx2/source/dialog/templdlg.cxx
+++ b/sfx2/source/dialog/templdlg.cxx
@@ -1396,8 +1396,7 @@ IMPL_LINK_NOARG( SfxCommonTemplateDialog_Impl, TimeOut, Timer *, void )
SfxTemplateItem *pState = pFamilyState[nActFamily-1].get();
if(pState)
{
- const OUString aStyle(pState->GetStyleName());
- SelectStyle(aStyle);
+ SelectStyle(pState->GetStyleName());
EnableDelete();
}
}
diff --git a/sfx2/source/doc/DocumentMetadataAccess.cxx b/sfx2/source/doc/DocumentMetadataAccess.cxx
index 6df5505c2961..c39e525ff5e1 100644
--- a/sfx2/source/doc/DocumentMetadataAccess.cxx
+++ b/sfx2/source/doc/DocumentMetadataAccess.cxx
@@ -1073,11 +1073,11 @@ void SAL_CALL DocumentMetadataAccess::loadMetadataFromStorage(
try {
const ::std::vector< uno::Reference< rdf::XURI > > parts(
getAllParts(*m_pImpl) );
- const uno::Reference<rdf::XURI> xContentFile(
+ const uno::Reference<rdf::XURI>& xContentFile(
getURI<rdf::URIs::ODF_CONTENTFILE>(m_pImpl->m_xContext));
- const uno::Reference<rdf::XURI> xStylesFile(
+ const uno::Reference<rdf::XURI>& xStylesFile(
getURI<rdf::URIs::ODF_STYLESFILE>(m_pImpl->m_xContext));
- const uno::Reference<rdf::XURI> xMetadataFile(
+ const uno::Reference<rdf::XURI>& xMetadataFile(
getURI<rdf::URIs::PKG_METADATAFILE>(m_pImpl->m_xContext));
const sal_Int32 len( baseURI.getLength() );
for (::std::vector< uno::Reference< rdf::XURI > >::const_iterator it
diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx
index fe951607c1a5..ab0645207379 100644
--- a/sfx2/source/doc/docfile.cxx
+++ b/sfx2/source/doc/docfile.cxx
@@ -1564,7 +1564,7 @@ uno::Reference < embed::XStorage > SfxMedium::GetStorage( bool bCreateTempIfNo )
{
// Unpack Stream in TempDir
::utl::TempFile aTempFile;
- OUString aTmpName = aTempFile.GetURL();
+ const OUString& aTmpName = aTempFile.GetURL();
SvFileStream aTmpStream( aTmpName, SFX_STREAM_READWRITE );
pStream->ReadStream( aTmpStream );
diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx
index f96947d94970..4bcfd9118e59 100644
--- a/sfx2/source/doc/objmisc.cxx
+++ b/sfx2/source/doc/objmisc.cxx
@@ -1576,7 +1576,7 @@ vcl::Window* SfxObjectShell::GetDialogParent( SfxMedium const * pLoadingMedium )
const SfxUnoFrameItem* pUnoItem = SfxItemSet::GetItem<SfxUnoFrameItem>(pSet, SID_FILLFRAME, false);
if ( pUnoItem )
{
- uno::Reference < frame::XFrame > xFrame( pUnoItem->GetFrame() );
+ const uno::Reference < frame::XFrame >& xFrame( pUnoItem->GetFrame() );
pWindow = VCLUnoHelper::GetWindow( xFrame->getContainerWindow() );
}
diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx
index 3874f21cd56b..ce6b1cf0666d 100644
--- a/sfx2/source/doc/objserv.cxx
+++ b/sfx2/source/doc/objserv.cxx
@@ -488,7 +488,7 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
{
// user has done some changes to DocumentInfo
pDocInfoItem->UpdateDocumentInfo(getDocProperties());
- uno::Sequence< document::CmisProperty > aNewCmisProperties =
+ const uno::Sequence< document::CmisProperty >& aNewCmisProperties =
pDocInfoItem->GetCmisProperties( );
if ( aNewCmisProperties.getLength( ) > 0 )
xCmisDoc->updateCmisProperties( aNewCmisProperties );
diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx
index 2d00677ad01a..af28e43a7185 100644
--- a/sfx2/source/doc/objstor.cxx
+++ b/sfx2/source/doc/objstor.cxx
@@ -2041,7 +2041,7 @@ bool SfxObjectShell::DoSaveCompleted( SfxMedium* pNewMed, bool bRegisterRecent )
uno::Reference< frame::XModel > xModel = GetModel();
if ( xModel.is() )
{
- const OUString aURL {pNewMed->GetOrigURL()};
+ const OUString& aURL {pNewMed->GetOrigURL()};
uno::Sequence< beans::PropertyValue > aMediaDescr;
TransformItems( SID_OPENDOC, *pNewMed->GetItemSet(), aMediaDescr );
try
diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx
index c1953d91739c..f94a6cf18d3f 100644
--- a/sfx2/source/doc/sfxbasemodel.cxx
+++ b/sfx2/source/doc/sfxbasemodel.cxx
@@ -359,7 +359,7 @@ SfxOwnFramesLocker::SfxOwnFramesLocker( SfxObjectShell const * pObjectShell )
try
{
// get vcl window related to the frame and lock it if it is still not locked
- Reference< frame::XFrame > xFrame = rSfxFrame.GetFrameInterface();
+ const Reference< frame::XFrame >& xFrame = rSfxFrame.GetFrameInterface();
vcl::Window* pWindow = GetVCLWindow( xFrame );
if ( !pWindow )
throw RuntimeException();
@@ -1726,7 +1726,7 @@ namespace {
OUString getFilterProvider( SfxMedium const & rMedium )
{
- std::shared_ptr<const SfxFilter> pFilter = rMedium.GetFilter();
+ const std::shared_ptr<const SfxFilter>& pFilter = rMedium.GetFilter();
if (!pFilter)
return OUString();
@@ -2856,7 +2856,7 @@ void SfxBaseModel::impl_store( const OUString& sURL
SfxMedium* pMedium = m_pData->m_pObjectShell->GetMedium();
if ( pMedium )
{
- std::shared_ptr<const SfxFilter> pFilter = pMedium->GetFilter();
+ const std::shared_ptr<const SfxFilter>& pFilter = pMedium->GetFilter();
if ( pFilter && aFilterName == pFilter->GetFilterName() )
{
// #i119366# - If the former file saving with password, do not trying in StoreSelf anyway...
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index 2398eb635539..2d0776b7f69c 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -577,7 +577,7 @@ IMPL_LINK_NOARG(SfxTemplateManagerDlg, MoveClickHdl, Button*, void)
if (aDlg.run() == RET_OK)
{
- OUString sCategory = aDlg.GetSelectedCategory();
+ const OUString& sCategory = aDlg.GetSelectedCategory();
bool bIsNewCategory = aDlg.IsNewCategoryCreated();
if(bIsNewCategory)
{
@@ -616,7 +616,7 @@ IMPL_LINK_NOARG(SfxTemplateManagerDlg, ImportClickHdl, Button*, void)
if (aDlg.run() == RET_OK)
{
- OUString sCategory = aDlg.GetSelectedCategory();
+ const OUString& sCategory = aDlg.GetSelectedCategory();
bool bIsNewCategory = aDlg.IsNewCategoryCreated();
if(bIsNewCategory)
{
@@ -1176,7 +1176,7 @@ void SfxTemplateManagerDlg::OnCategoryDelete()
if (aDlg.run() == RET_OK)
{
- OUString sCategory = aDlg.GetSelectedCategory();
+ const OUString& sCategory = aDlg.GetSelectedCategory();
std::unique_ptr<weld::MessageDialog> popupDlg(Application::CreateMessageDialog(GetFrameWeld(), VclMessageType::Question, VclButtonsType::YesNo,
SfxResId(STR_QMSG_SEL_FOLDER_DELETE)));
if (popupDlg->run() != RET_YES)
diff --git a/sfx2/source/inet/inettbc.cxx b/sfx2/source/inet/inettbc.cxx
index 4533f7083bb5..e5d63f757042 100644
--- a/sfx2/source/inet/inettbc.cxx
+++ b/sfx2/source/inet/inettbc.cxx
@@ -227,8 +227,7 @@ void SfxURLToolBoxControl_Impl::StateChanged
}
const SfxStringItem *pURL = dynamic_cast< const SfxStringItem* >(pState);
- OUString aRep( pURL->GetValue() );
- INetURLObject aURL( aRep );
+ INetURLObject aURL( pURL->GetValue() );
INetProtocol eProt = aURL.GetProtocol();
if ( eProt == INetProtocol::File )
{
diff --git a/sfx2/source/notebookbar/NotebookbarPopup.cxx b/sfx2/source/notebookbar/NotebookbarPopup.cxx
index aa2b6e8c277a..cba325a43c56 100644
--- a/sfx2/source/notebookbar/NotebookbarPopup.cxx
+++ b/sfx2/source/notebookbar/NotebookbarPopup.cxx
@@ -18,7 +18,7 @@ NotebookbarPopup::NotebookbarPopup(const VclPtr<VclHBox>& pParent)
get(m_pBox, "box");
m_pBox->SetSizePixel(Size(100, 75));
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
- const BitmapEx aPersona = rStyleSettings.GetPersonaHeader();
+ const BitmapEx& aPersona = rStyleSettings.GetPersonaHeader();
if (!aPersona.IsEmpty())
m_pBox->SetBackground(Wallpaper(aPersona));
@@ -120,7 +120,7 @@ void NotebookbarPopup::dispose()
void NotebookbarPopup::ApplyBackground(vcl::Window* pWindow)
{
const StyleSettings& rStyleSettings = GetSettings().GetStyleSettings();
- const BitmapEx aPersona = rStyleSettings.GetPersonaHeader();
+ const BitmapEx& aPersona = rStyleSettings.GetPersonaHeader();
if (!aPersona.IsEmpty())
pWindow->SetBackground(Wallpaper(aPersona));
diff --git a/sfx2/source/sidebar/ResourceManager.cxx b/sfx2/source/sidebar/ResourceManager.cxx
index 4596fef559b4..669402270691 100644
--- a/sfx2/source/sidebar/ResourceManager.cxx
+++ b/sfx2/source/sidebar/ResourceManager.cxx
@@ -194,10 +194,9 @@ const ResourceManager::DeckContextDescriptorContainer& ResourceManager::GetMatch
const ResourceManager::PanelContextDescriptorContainer& ResourceManager::GetMatchingPanels (
PanelContextDescriptorContainer& rPanelIds,
const Context& rContext,
- const OUString& rsDeckId,
+ const OUString& sDeckId,
const Reference<frame::XController>& rxController)
{
- OUString sDeckId(rsDeckId);
ReadLegacyAddons(rxController);
std::multimap<sal_Int32, PanelContextDescriptor> aOrderedIds;
diff --git a/sfx2/source/sidebar/UnoDeck.cxx b/sfx2/source/sidebar/UnoDeck.cxx
index 1bcc0d8f7e86..bd6dfe015e23 100644
--- a/sfx2/source/sidebar/UnoDeck.cxx
+++ b/sfx2/source/sidebar/UnoDeck.cxx
@@ -69,7 +69,7 @@ void SAL_CALL SfxUnoDeck::setTitle( const OUString& newTitle )
if (xDeckDescriptor)
{
Deck* pDeck = xDeckDescriptor->mpDeck;
- VclPtr<DeckTitleBar> pTitleBar = pDeck->GetTitleBar();
+ const VclPtr<DeckTitleBar>& pTitleBar = pDeck->GetTitleBar();
pTitleBar->SetTitle(newTitle);
xDeckDescriptor->msTitle = newTitle;
diff --git a/sfx2/source/view/classificationcontroller.cxx b/sfx2/source/view/classificationcontroller.cxx
index 56e404560f48..accb1d9d0c28 100644
--- a/sfx2/source/view/classificationcontroller.cxx
+++ b/sfx2/source/view/classificationcontroller.cxx
@@ -187,7 +187,7 @@ IMPL_LINK(ClassificationCategoriesController, SelectHdl, ListBox&, rCategory, vo
{
OUString aEntry = rCategory.GetSelectedEntry();
- OUString aType = getCategoryType();
+ const OUString& aType = getCategoryType();
uno::Sequence<beans::PropertyValue> aPropertyValues(comphelper::InitPropertySequence({
{"Name", uno::makeAny(aEntry)},
{"Type", uno::makeAny(aType)},
diff --git a/sfx2/source/view/frame.cxx b/sfx2/source/view/frame.cxx
index 6fd9832b2b4d..c7e8c7738f5d 100644
--- a/sfx2/source/view/frame.cxx
+++ b/sfx2/source/view/frame.cxx
@@ -324,7 +324,7 @@ void SfxFrame::UpdateDescriptor( SfxObjectShell const *pDoc )
// Mark FileOpen parameter
SfxItemSet* pItemSet = pMed->GetItemSet();
- std::shared_ptr<const SfxFilter> pFilter = pMed->GetFilter();
+ const std::shared_ptr<const SfxFilter>& pFilter = pMed->GetFilter();
OUString aFilter;
if ( pFilter )
aFilter = pFilter->GetFilterName();
diff --git a/sfx2/source/view/lokcharthelper.cxx b/sfx2/source/view/lokcharthelper.cxx
index 5369b803a692..04b433c66677 100644
--- a/sfx2/source/view/lokcharthelper.cxx
+++ b/sfx2/source/view/lokcharthelper.cxx
@@ -52,7 +52,7 @@ css::uno::Reference<css::frame::XController>& LokChartHelper::GetXController()
SfxInPlaceClient* pIPClient = mpViewShell->GetIPClient();
if (pIPClient)
{
- css::uno::Reference< ::css::embed::XEmbeddedObject > xEmbObj = pIPClient->GetObject();
+ const css::uno::Reference< ::css::embed::XEmbeddedObject >& xEmbObj = pIPClient->GetObject();
if( xEmbObj.is() )
{
::css::uno::Reference< ::css::chart2::XChartDocument > xChart( xEmbObj->getComponent(), uno::UNO_QUERY );
@@ -138,7 +138,7 @@ tools::Rectangle LokChartHelper::GetChartBoundingBox()
{
// In all cases, the following code fragment
// returns the chart bounding box in twips.
- MapMode aCWMapMode = pWindow->GetMapMode();
+ const MapMode& aCWMapMode = pWindow->GetMapMode();
double fXScale( aCWMapMode.GetScaleX() );
double fYScale( aCWMapMode.GetScaleY() );
Point aOffset = pWindow->GetOffsetPixelFrom(*pRootWin);
diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx
index 3a0e06f02716..b12c96a2d048 100644
--- a/sfx2/source/view/viewfrm.cxx
+++ b/sfx2/source/view/viewfrm.cxx
@@ -202,7 +202,7 @@ bool IsSignPDF(const SfxObjectShellRef& xObjSh)
SfxMedium* pMedium = xObjSh->GetMedium();
if (pMedium && !pMedium->IsOriginallyReadOnly())
{
- std::shared_ptr<const SfxFilter> pFilter = pMedium->GetFilter();
+ const std::shared_ptr<const SfxFilter>& pFilter = pMedium->GetFilter();
if (pFilter && pFilter->GetName() == "draw_pdf_import")
return true;
}