summaryrefslogtreecommitdiff
path: root/fpicker
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-02-07 12:36:25 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-02-19 07:13:46 +0100
commit9ee96d942603ff45370558c55ff989700b64045e (patch)
treec6355838188e242f0788f4541794ee3755a4f7ef /fpicker
parente5fe9cbb421dfc0f373e5ea56c93aab2a149ddcc (diff)
loplugin:useuniqueptr in filepicker
Change-Id: I367bea33bdb9ea3132d3ed079a16b516498b4fcc Reviewed-on: https://gerrit.libreoffice.org/49947 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'fpicker')
-rw-r--r--fpicker/source/office/OfficeFilePicker.cxx19
-rw-r--r--fpicker/source/office/OfficeFilePicker.hxx6
-rw-r--r--fpicker/source/office/iodlg.cxx9
-rw-r--r--fpicker/source/office/iodlgimp.cxx2
-rw-r--r--fpicker/source/office/iodlgimp.hxx2
5 files changed, 15 insertions, 23 deletions
diff --git a/fpicker/source/office/OfficeFilePicker.cxx b/fpicker/source/office/OfficeFilePicker.cxx
index 82f9dca8bf12..23aabac5962b 100644
--- a/fpicker/source/office/OfficeFilePicker.cxx
+++ b/fpicker/source/office/OfficeFilePicker.cxx
@@ -407,7 +407,7 @@ void SvtFilePicker::ensureFilterList( const OUString& _rInitialCurrentFilter )
{
if ( !m_pFilterList )
{
- m_pFilterList = new FilterList;
+ m_pFilterList.reset( new FilterList );
// set the first filter to the current filter
if ( m_aCurrentFilter.isEmpty() )
@@ -419,22 +419,13 @@ void SvtFilePicker::ensureFilterList( const OUString& _rInitialCurrentFilter )
// class SvtFilePicker
SvtFilePicker::SvtFilePicker()
- :m_pFilterList ( nullptr )
- ,m_pElemList ( nullptr )
- ,m_bMultiSelection ( false )
+ :m_bMultiSelection ( false )
,m_nServiceType ( TemplateDescription::FILEOPEN_SIMPLE )
{
}
SvtFilePicker::~SvtFilePicker()
{
- if ( m_pFilterList && !m_pFilterList->empty() )
- m_pFilterList->erase( m_pFilterList->begin(), m_pFilterList->end() );
- delete m_pFilterList;
-
- if ( m_pElemList && !m_pElemList->empty() )
- m_pElemList->erase( m_pElemList->begin(), m_pElemList->end() );
- delete m_pElemList;
}
@@ -629,7 +620,7 @@ void SAL_CALL SvtFilePicker::setValue( sal_Int16 nElementID,
else
{
if ( !m_pElemList )
- m_pElemList = new ElementList;
+ m_pElemList.reset( new ElementList );
bool bFound = false;
ElementList::iterator aListIter;
@@ -705,7 +696,7 @@ void SAL_CALL SvtFilePicker::setLabel( sal_Int16 nLabelID, const OUString& rValu
else
{
if ( !m_pElemList )
- m_pElemList = new ElementList;
+ m_pElemList.reset( new ElementList );
bool bFound = false;
ElementList::iterator aListIter;
@@ -776,7 +767,7 @@ void SAL_CALL SvtFilePicker::enableControl( sal_Int16 nElementID, sal_Bool bEnab
else
{
if ( !m_pElemList )
- m_pElemList = new ElementList;
+ m_pElemList.reset( new ElementList );
bool bFound = false;
ElementList::iterator aListIter;
diff --git a/fpicker/source/office/OfficeFilePicker.hxx b/fpicker/source/office/OfficeFilePicker.hxx
index 27e761f39f05..af60daa9ee0b 100644
--- a/fpicker/source/office/OfficeFilePicker.hxx
+++ b/fpicker/source/office/OfficeFilePicker.hxx
@@ -61,8 +61,10 @@ class SvtFilePicker :public SvtFilePicker_Base
,public ::svt::IFilePickerListener
{
protected:
- FilterList* m_pFilterList;
- ElementList* m_pElemList;
+ std::unique_ptr<FilterList>
+ m_pFilterList;
+ std::unique_ptr<ElementList>
+ m_pElemList;
bool m_bMultiSelection;
sal_Int16 m_nServiceType;
diff --git a/fpicker/source/office/iodlg.cxx b/fpicker/source/office/iodlg.cxx
index f8b5e1dd5d7f..873b5ccd2f76 100644
--- a/fpicker/source/office/iodlg.cxx
+++ b/fpicker/source/office/iodlg.cxx
@@ -119,7 +119,7 @@ namespace
OUString getMostCurrentFilter( std::unique_ptr<SvtExpFileDlg_Impl> const & pImpl )
{
assert( pImpl && "invalid impl pointer" );
- const SvtFileDialogFilter_Impl* pFilter = pImpl->_pUserFilter;
+ const SvtFileDialogFilter_Impl* pFilter = pImpl->_pUserFilter.get();
if ( !pFilter )
pFilter = pImpl->GetCurFilter();
@@ -768,8 +768,7 @@ IMPL_LINK_NOARG( SvtFileDialog, NewFolderHdl_Impl, Button*, void)
void SvtFileDialog::createNewUserFilter( const OUString& _rNewFilter )
{
// delete the old user filter and create a new one
- DELETEZ( pImpl->_pUserFilter );
- pImpl->_pUserFilter = new SvtFileDialogFilter_Impl( _rNewFilter, _rNewFilter );
+ pImpl->_pUserFilter.reset( new SvtFileDialogFilter_Impl( _rNewFilter, _rNewFilter ) );
// remember the extension
bool bIsAllFiles = _rNewFilter == FILEDIALOG_FILTER_ALL;
@@ -910,7 +909,7 @@ void SvtFileDialog::OpenHdl_Impl(void const * pVoid)
// MBA->PB: ?!
if ( aFileName.isEmpty() && pVoid == pImpl->_pEdFileName && pImpl->_pUserFilter )
{
- DELETEZ( pImpl->_pUserFilter );
+ pImpl->_pUserFilter.reset();
return;
}
@@ -1181,7 +1180,7 @@ IMPL_LINK_NOARG( SvtFileDialog, FilterSelectHdl_Impl, ListBox&, void )
{
// Store the old filter for the auto extension handling
OUString sLastFilterExt = pImpl->GetCurFilter()->GetExtension();
- DELETEZ( pImpl->_pUserFilter );
+ pImpl->_pUserFilter.reset();
// if applicable remove filter of the user
pImpl->SetCurFilter( pSelectedFilter, sSelectedFilterDisplayName );
diff --git a/fpicker/source/office/iodlgimp.cxx b/fpicker/source/office/iodlgimp.cxx
index 6328c7a44d19..63f93699b1cb 100644
--- a/fpicker/source/office/iodlgimp.cxx
+++ b/fpicker/source/office/iodlgimp.cxx
@@ -215,7 +215,7 @@ SvtExpFileDlg_Impl::SvtExpFileDlg_Impl() :
SvtExpFileDlg_Impl::~SvtExpFileDlg_Impl()
{
_pBtnUp.disposeAndClear();
- delete _pUserFilter;
+ _pUserFilter.reset();
_pPlaces.disposeAndClear();
}
diff --git a/fpicker/source/office/iodlgimp.hxx b/fpicker/source/office/iodlgimp.hxx
index 2146900e15df..099cf0575d8d 100644
--- a/fpicker/source/office/iodlgimp.hxx
+++ b/fpicker/source/office/iodlgimp.hxx
@@ -123,7 +123,7 @@ private:
public:
SvtFileDialogFilterList_Impl m_aFilter;
- SvtFileDialogFilter_Impl* _pUserFilter;
+ std::unique_ptr<SvtFileDialogFilter_Impl> _pUserFilter;
VclPtr<FixedText> _pFtFileName;
VclPtr<SvtURLBox> _pEdFileName;