summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-05-09 09:40:59 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-05-14 11:11:33 +0200
commit5c3816cce5054ef41af441f9a280a8025ff6d691 (patch)
treeaed2cd395aae20afa516c16d6393915e69e9a4fd /sfx2
parent943e12e73dfa7ec9c09e97be5bdaf851277c25a6 (diff)
loplugin:useuniqueptr in SfxTabDialog
Change-Id: I460bf5aac44e6fd08a5bd5ab8af217dedbcc3cf8 Reviewed-on: https://gerrit.libreoffice.org/54174 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/dialog/tabdlg.cxx27
1 files changed, 12 insertions, 15 deletions
diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx
index 160af8d6af54..ae8023773e14 100644
--- a/sfx2/source/dialog/tabdlg.cxx
+++ b/sfx2/source/dialog/tabdlg.cxx
@@ -429,13 +429,11 @@ void SfxTabDialog::dispose()
}
m_pImpl.reset();
- delete m_pSet;
- m_pSet = nullptr;
+ m_pSet.reset();
m_pOutSet.reset();
delete m_pExampleSet;
m_pExampleSet = nullptr;
- delete [] m_pRanges;
- m_pRanges = nullptr;
+ m_pRanges.reset();
if (m_bOwnsBaseFmtBtn)
m_pBaseFmtBtn.disposeAndClear();
@@ -779,7 +777,7 @@ SfxItemSet* SfxTabDialog::GetInputSetImpl()
*/
{
- return m_pSet;
+ return m_pSet.get();
}
@@ -1017,7 +1015,7 @@ IMPL_LINK_NOARG(SfxTabDialog, ResetHdl, Button*, void)
Data_Impl* pDataObject = Find( m_pImpl->aData, nId );
DBG_ASSERT( pDataObject, "Id not known" );
- pDataObject->pTabPage->Reset( m_pSet );
+ pDataObject->pTabPage->Reset( m_pSet.get() );
// Also reset relevant items of ExampleSet and OutSet to initial state
if (pDataObject->fnGetRanges)
{
@@ -1165,7 +1163,7 @@ IMPL_LINK( SfxTabDialog, ActivatePageHdl, TabControl *, pTabCtrl, void )
if ( !pTabPage )
{
if ( m_pSet )
- pTabPage = (pDataObject->fnCreatePage)(static_cast<vcl::Window*>(pTabCtrl), m_pSet);
+ pTabPage = (pDataObject->fnCreatePage)(static_cast<vcl::Window*>(pTabCtrl), m_pSet.get());
else
pTabPage = (pDataObject->fnCreatePage)(pTabCtrl, CreateInputItemSet(nId));
DBG_ASSERT( nullptr == pDataObject->pTabPage, "create TabPage more than once" );
@@ -1197,12 +1195,12 @@ IMPL_LINK( SfxTabDialog, ActivatePageHdl, TabControl *, pTabCtrl, void )
PageCreated( nId, *pTabPage );
- pTabPage->Reset( m_pSet );
+ pTabPage->Reset( m_pSet.get() );
pTabCtrl->SetTabPage( nId, pTabPage );
}
else if ( pDataObject->bRefresh )
- pTabPage->Reset( m_pSet );
+ pTabPage->Reset( m_pSet.get() );
pDataObject->bRefresh = false;
if ( m_pExampleSet )
@@ -1343,7 +1341,7 @@ const sal_uInt16* SfxTabDialog::GetInputRanges( const SfxItemPool& rPool )
}
if ( m_pRanges )
- return m_pRanges;
+ return m_pRanges.get();
std::vector<sal_uInt16> aUS;
for (auto const& elem : m_pImpl->aData)
@@ -1373,10 +1371,10 @@ const sal_uInt16* SfxTabDialog::GetInputRanges( const SfxItemPool& rPool )
std::sort( aUS.begin(), aUS.end() );
}
- m_pRanges = new sal_uInt16[aUS.size() + 1];
- std::copy( aUS.begin(), aUS.end(), m_pRanges );
+ m_pRanges.reset(new sal_uInt16[aUS.size() + 1]);
+ std::copy( aUS.begin(), aUS.end(), m_pRanges.get() );
m_pRanges[aUS.size()] = 0;
- return m_pRanges;
+ return m_pRanges.get();
}
@@ -1389,8 +1387,7 @@ void SfxTabDialog::SetInputSet( const SfxItemSet* pInSet )
{
bool bSet = ( m_pSet != nullptr );
- delete m_pSet;
- m_pSet = pInSet ? new SfxItemSet(*pInSet) : nullptr;
+ m_pSet.reset(pInSet ? new SfxItemSet(*pInSet) : nullptr);
if (!bSet && !m_pExampleSet && !m_pOutSet && m_pSet)
{