use std::unique_ptr

Change-Id: I6d80d47dcc40daf2749eeec58a7ca19d09c4b803
Reviewed-on: https://gerrit.libreoffice.org/34045
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Jochen Nitschke
2017-02-08 14:26:08 +01:00
committed by Noel Grandin
parent 1d2c7fd407
commit dca6eefc21
2 changed files with 14 additions and 18 deletions

View File

@@ -874,9 +874,7 @@ void XclExpAutofilter::SaveXml( XclExpXmlStream& rStrm )
ExcAutoFilterRecs::ExcAutoFilterRecs( const XclExpRoot& rRoot, SCTAB nTab, const ScDBData* pDefinedData ) : ExcAutoFilterRecs::ExcAutoFilterRecs( const XclExpRoot& rRoot, SCTAB nTab, const ScDBData* pDefinedData ) :
XclExpRoot( rRoot ), XclExpRoot( rRoot ),
pFilterMode( nullptr ), mbAutoFilter (false)
pFilterInfo( nullptr )
, mbAutoFilter (false)
{ {
XclExpNameManager& rNameMgr = GetNameManager(); XclExpNameManager& rNameMgr = GetNameManager();
@@ -920,7 +918,7 @@ ExcAutoFilterRecs::ExcAutoFilterRecs( const XclExpRoot& rRoot, SCTAB nTab, const
rNameMgr.InsertBuiltInName( EXC_BUILTIN_EXTRACT, aDestRange ); rNameMgr.InsertBuiltInName( EXC_BUILTIN_EXTRACT, aDestRange );
} }
pFilterMode = new XclExpFiltermode; m_pFilterMode.reset(new XclExpFiltermode);
} }
// AutoFilter // AutoFilter
else else
@@ -963,8 +961,8 @@ ExcAutoFilterRecs::ExcAutoFilterRecs( const XclExpRoot& rRoot, SCTAB nTab, const
maFilterList.RemoveAllRecords(); maFilterList.RemoveAllRecords();
if( !maFilterList.IsEmpty() ) if( !maFilterList.IsEmpty() )
pFilterMode = new XclExpFiltermode; m_pFilterMode.reset(new XclExpFiltermode);
pFilterInfo = new XclExpAutofilterinfo( aRange.aStart, nColCnt ); m_pFilterInfo.reset(new XclExpAutofilterinfo( aRange.aStart, nColCnt ));
if (maFilterList.IsEmpty () && !bConflict) if (maFilterList.IsEmpty () && !bConflict)
mbAutoFilter = true; mbAutoFilter = true;
@@ -974,8 +972,6 @@ ExcAutoFilterRecs::ExcAutoFilterRecs( const XclExpRoot& rRoot, SCTAB nTab, const
ExcAutoFilterRecs::~ExcAutoFilterRecs() ExcAutoFilterRecs::~ExcAutoFilterRecs()
{ {
delete pFilterMode;
delete pFilterInfo;
} }
XclExpAutofilter* ExcAutoFilterRecs::GetByCol( SCCOL nCol ) XclExpAutofilter* ExcAutoFilterRecs::GetByCol( SCCOL nCol )
@@ -1002,10 +998,10 @@ bool ExcAutoFilterRecs::IsFiltered( SCCOL nCol )
void ExcAutoFilterRecs::AddObjRecs() void ExcAutoFilterRecs::AddObjRecs()
{ {
if( pFilterInfo ) if( m_pFilterInfo )
{ {
ScAddress aAddr( pFilterInfo->GetStartPos() ); ScAddress aAddr( m_pFilterInfo->GetStartPos() );
for( SCCOL nObj = 0, nCount = pFilterInfo->GetColCount(); nObj < nCount; nObj++ ) for( SCCOL nObj = 0, nCount = m_pFilterInfo->GetColCount(); nObj < nCount; nObj++ )
{ {
XclObj* pObjRec = new XclObjDropDown( GetObjectManager(), aAddr, IsFiltered( nObj ) ); XclObj* pObjRec = new XclObjDropDown( GetObjectManager(), aAddr, IsFiltered( nObj ) );
GetObjectManager().AddObj( pObjRec ); GetObjectManager().AddObj( pObjRec );
@@ -1016,10 +1012,10 @@ void ExcAutoFilterRecs::AddObjRecs()
void ExcAutoFilterRecs::Save( XclExpStream& rStrm ) void ExcAutoFilterRecs::Save( XclExpStream& rStrm )
{ {
if( pFilterMode ) if( m_pFilterMode )
pFilterMode->Save( rStrm ); m_pFilterMode->Save( rStrm );
if( pFilterInfo ) if( m_pFilterInfo )
pFilterInfo->Save( rStrm ); m_pFilterInfo->Save( rStrm );
maFilterList.Save( rStrm ); maFilterList.Save( rStrm );
} }
@@ -1040,7 +1036,7 @@ void ExcAutoFilterRecs::SaveXml( XclExpXmlStream& rStrm )
bool ExcAutoFilterRecs::HasFilterMode() const bool ExcAutoFilterRecs::HasFilterMode() const
{ {
return pFilterMode != nullptr; return m_pFilterMode != nullptr;
} }
XclExpFilterManager::XclExpFilterManager( const XclExpRoot& rRoot ) : XclExpFilterManager::XclExpFilterManager( const XclExpRoot& rRoot ) :

View File

@@ -424,8 +424,8 @@ private:
typedef XclExpAutofilterList::RecordRefType XclExpAutofilterRef; typedef XclExpAutofilterList::RecordRefType XclExpAutofilterRef;
XclExpAutofilterList maFilterList; XclExpAutofilterList maFilterList;
XclExpFiltermode* pFilterMode; std::unique_ptr<XclExpFiltermode> m_pFilterMode;
XclExpAutofilterinfo* pFilterInfo; std::unique_ptr<XclExpAutofilterinfo> m_pFilterInfo;
ScRange maRef; ScRange maRef;
bool mbAutoFilter; bool mbAutoFilter;
}; };