Kaydet (Commit) 4e51d68d authored tarafından Noel Grandin's avatar Noel Grandin

clang-tidy performance-unnecessary-copy-init in sfx2..svtools

Change-Id: I1e92472b4aaeca1eb1372bd18d10cc9e0766dc39
Reviewed-on: https://gerrit.libreoffice.org/62251
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst ec98adb2
......@@ -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 )
......
......@@ -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() )
......
......@@ -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?" );
......
......@@ -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() )
{
......
......@@ -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() );
......
......@@ -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;
......
......@@ -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();
}
}
......
......@@ -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
......
......@@ -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 );
......
......@@ -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() );
}
......
......@@ -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 );
......
......@@ -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
......
......@@ -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...
......
......@@ -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)
......
......@@ -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 )
{
......
......@@ -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));
......
......@@ -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;
......
......@@ -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;
......
......@@ -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)},
......
......@@ -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();
......
......@@ -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);
......
......@@ -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;
}
......
......@@ -518,7 +518,7 @@ namespace svgio
if(pCandidate)
{
const localTextBreakupHelper alocalTextBreakupHelper(*pCandidate, rSvgTextPosition);
const drawinglayer::primitive2d::Primitive2DContainer aResult(
const drawinglayer::primitive2d::Primitive2DContainer& aResult(
alocalTextBreakupHelper.getResult());
if(!aResult.empty())
......
......@@ -507,7 +507,7 @@ namespace svgio
if(pSvgTitleDescNode && mpTarget)
{
const OUString aText(pSvgTitleDescNode->getText());
const OUString& aText(pSvgTitleDescNode->getText());
if(!aText.isEmpty())
{
......
......@@ -677,7 +677,7 @@ namespace svgio
// the geometry for a single dot
if(1 == rPath.count())
{
const basegfx::B2DPolygon aSingle(rPath.getB2DPolygon(0));
const basegfx::B2DPolygon& aSingle(rPath.getB2DPolygon(0));
if(2 == aSingle.count() && aSingle.getB2DPoint(0).equal(aSingle.getB2DPoint(1)))
{
......@@ -925,7 +925,7 @@ namespace svgio
for (sal_uInt32 a(0); a < nSubPathCount; a++)
{
// iterate over sub-paths
const basegfx::B2DPolygon aSubPolygonPath(rPath.getB2DPolygon(a));
const basegfx::B2DPolygon& aSubPolygonPath(rPath.getB2DPolygon(a));
const sal_uInt32 nSubPolygonPointCount(aSubPolygonPath.count());
const bool bSubPolygonPathIsClosed(aSubPolygonPath.isClosed());
......
......@@ -418,7 +418,7 @@ namespace svgio
fPosition,
rTextStart);
const drawinglayer::primitive2d::Primitive2DContainer aResult(
const drawinglayer::primitive2d::Primitive2DContainer& aResult(
aPathTextBreakupHelper.getResult());
if(!aResult.empty())
......
......@@ -289,7 +289,7 @@ static void lclDrawPolygon( OutputDevice& rDev, const basegfx::B2DPolygon& rPoly
for ( sal_uInt32 i = 0; i < aPolygons.count( ); i++ )
{
basegfx::B2DPolygon aDash = aPolygons.getB2DPolygon( i );
const basegfx::B2DPolygon& aDash = aPolygons.getB2DPolygon( i );
basegfx::B2DPoint aStart = aDash.getB2DPoint( 0 );
basegfx::B2DPoint aEnd = aDash.getB2DPoint( aDash.count() - 1 );
......@@ -851,7 +851,7 @@ void FontNameBox::UserDraw( const UserDrawEvent& rUDEvt )
tools::Rectangle aTextRect;
// Preview the font name
OUString sFontName = rFontMetric.GetFamilyName();
const OUString& sFontName = rFontMetric.GetFamilyName();
//If it shouldn't or can't draw its own name because it doesn't have the glyphs
if (!canRenderNameOfSelectedFont(*pRenderContext))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment