summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-08-06 17:17:20 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-08-08 09:31:02 +0200
commit6a6774cc4b22aceaca4441318420bb9dfb1cacab (patch)
treeab2dd62d7a69f1127fed8192268e16fbdaacd9fa /sc
parent1444bd72006fec7ebcd3c5df2399da26ad3b1466 (diff)
loplugin:useuniqueptr in SfxApplication::LoadTemplate and SfxMedium
pass SfxItemSet around by std::unique_ptr Change-Id: I54da96d8df224f7c4f2fb9ebf06ed32d479298e7 Reviewed-on: https://gerrit.libreoffice.org/58649 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/docshell/docsh4.cxx4
-rw-r--r--sc/source/ui/docshell/externalrefmgr.cxx4
-rw-r--r--sc/source/ui/docshell/tablink.cxx8
3 files changed, 8 insertions, 8 deletions
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index c1139561817e..3d7b30aec367 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -750,12 +750,12 @@ void ScDocShell::Execute( SfxRequest& rReq )
ScDocumentLoader::RemoveAppPrefix( aFilterName );
std::shared_ptr<const SfxFilter> pFilter = ScDocShell::Factory().GetFilterContainer()->GetFilter4FilterName( aFilterName );
- SfxItemSet* pSet = new SfxAllItemSet( pApp->GetPool() );
+ std::unique_ptr<SfxItemSet> pSet(new SfxAllItemSet( pApp->GetPool() ));
if (!aOptions.isEmpty())
pSet->Put( SfxStringItem( SID_FILE_FILTEROPTIONS, aOptions ) );
if ( nVersion != 0 )
pSet->Put( SfxInt16Item( SID_VERSION, nVersion ) );
- pMed = new SfxMedium( aFileName, StreamMode::STD_READ, pFilter, pSet );
+ pMed = new SfxMedium( aFileName, StreamMode::STD_READ, pFilter, std::move(pSet) );
}
else
{
diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx
index a70d2019a69d..f274fd5d657a 100644
--- a/sc/source/ui/docshell/externalrefmgr.cxx
+++ b/sc/source/ui/docshell/externalrefmgr.cxx
@@ -2502,7 +2502,7 @@ SfxObjectShellRef ScExternalRefManager::loadSrcDocument(sal_uInt16 nFileId, OUSt
setRelativeFileName(nFileId, aStr);
}
- SfxItemSet* pSet = new SfxAllItemSet(SfxGetpApp()->GetPool());
+ std::unique_ptr<SfxItemSet> pSet(new SfxAllItemSet(SfxGetpApp()->GetPool()));
if (!aOptions.isEmpty())
pSet->Put(SfxStringItem(SID_FILE_FILTEROPTIONS, aOptions));
@@ -2524,7 +2524,7 @@ SfxObjectShellRef ScExternalRefManager::loadSrcDocument(sal_uInt16 nFileId, OUSt
}
}
- unique_ptr<SfxMedium> pMedium(new SfxMedium(aFile, StreamMode::STD_READ, pFilter, pSet));
+ unique_ptr<SfxMedium> pMedium(new SfxMedium(aFile, StreamMode::STD_READ, pFilter, std::move(pSet)));
if (pMedium->GetError() != ERRCODE_NONE)
return nullptr;
diff --git a/sc/source/ui/docshell/tablink.cxx b/sc/source/ui/docshell/tablink.cxx
index 527aefedb0fb..816a69bbf8a1 100644
--- a/sc/source/ui/docshell/tablink.cxx
+++ b/sc/source/ui/docshell/tablink.cxx
@@ -187,11 +187,11 @@ bool ScTableLink::Refresh(const OUString& rNewFile, const OUString& rNewFilter,
aOptions = *pNewOptions;
// always create ItemSet, so that DocShell can set the options
- SfxItemSet* pSet = new SfxAllItemSet( SfxGetpApp()->GetPool() );
+ std::unique_ptr<SfxItemSet> pSet(new SfxAllItemSet( SfxGetpApp()->GetPool() ));
if (!aOptions.isEmpty())
pSet->Put( SfxStringItem( SID_FILE_FILTEROPTIONS, aOptions ) );
- SfxMedium* pMed = new SfxMedium(aNewUrl, StreamMode::STD_READ, pFilter, pSet);
+ SfxMedium* pMed = new SfxMedium(aNewUrl, StreamMode::STD_READ, pFilter, std::move(pSet));
if ( bInEdit ) // only if using the edit dialog,
pMed->UseInteractionHandler(true); // enable the filter options dialog
@@ -496,7 +496,7 @@ SfxMedium* ScDocumentLoader::CreateMedium( const OUString& rFileName, std::share
const OUString& rOptions, weld::Window* pInteractionParent )
{
// Always create SfxItemSet so ScDocShell can set options.
- SfxItemSet* pSet = new SfxAllItemSet( SfxGetpApp()->GetPool() );
+ std::unique_ptr<SfxItemSet> pSet(new SfxAllItemSet( SfxGetpApp()->GetPool() ));
if ( !rOptions.isEmpty() )
pSet->Put( SfxStringItem( SID_FILE_FILTEROPTIONS, rOptions ) );
@@ -508,7 +508,7 @@ SfxMedium* ScDocumentLoader::CreateMedium( const OUString& rFileName, std::share
pSet->Put(SfxUnoAnyItem(SID_INTERACTIONHANDLER, makeAny(xIHdl)));
}
- SfxMedium *pRet = new SfxMedium( rFileName, StreamMode::STD_READ, pFilter, pSet );
+ SfxMedium *pRet = new SfxMedium( rFileName, StreamMode::STD_READ, pFilter, std::move(pSet) );
if (pInteractionParent)
pRet->UseInteractionHandler(true); // to enable the filter options dialog
return pRet;