sc/source/filter/excel/excrecds.cxx | 28 ++++++++++++---------------- sc/source/filter/inc/excrecds.hxx | 4 ++-- 2 files changed, 14 insertions(+), 18 deletions(-)
New commits: commit dca6eefc211cc36b5e3ba7157d45e12ee6b9f5f8 Author: Jochen Nitschke <j.nitschke+loger...@ok.de> Date: Wed Feb 8 14:26:08 2017 +0100 use std::unique_ptr Change-Id: I6d80d47dcc40daf2749eeec58a7ca19d09c4b803 Reviewed-on: https://gerrit.libreoffice.org/34045 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sc/source/filter/excel/excrecds.cxx b/sc/source/filter/excel/excrecds.cxx index d0e96ab..92b5460 100644 --- a/sc/source/filter/excel/excrecds.cxx +++ b/sc/source/filter/excel/excrecds.cxx @@ -874,9 +874,7 @@ void XclExpAutofilter::SaveXml( XclExpXmlStream& rStrm ) ExcAutoFilterRecs::ExcAutoFilterRecs( const XclExpRoot& rRoot, SCTAB nTab, const ScDBData* pDefinedData ) : XclExpRoot( rRoot ), - pFilterMode( nullptr ), - pFilterInfo( nullptr ) - , mbAutoFilter (false) + mbAutoFilter (false) { XclExpNameManager& rNameMgr = GetNameManager(); @@ -920,7 +918,7 @@ ExcAutoFilterRecs::ExcAutoFilterRecs( const XclExpRoot& rRoot, SCTAB nTab, const rNameMgr.InsertBuiltInName( EXC_BUILTIN_EXTRACT, aDestRange ); } - pFilterMode = new XclExpFiltermode; + m_pFilterMode.reset(new XclExpFiltermode); } // AutoFilter else @@ -963,8 +961,8 @@ ExcAutoFilterRecs::ExcAutoFilterRecs( const XclExpRoot& rRoot, SCTAB nTab, const maFilterList.RemoveAllRecords(); if( !maFilterList.IsEmpty() ) - pFilterMode = new XclExpFiltermode; - pFilterInfo = new XclExpAutofilterinfo( aRange.aStart, nColCnt ); + m_pFilterMode.reset(new XclExpFiltermode); + m_pFilterInfo.reset(new XclExpAutofilterinfo( aRange.aStart, nColCnt )); if (maFilterList.IsEmpty () && !bConflict) mbAutoFilter = true; @@ -974,8 +972,6 @@ ExcAutoFilterRecs::ExcAutoFilterRecs( const XclExpRoot& rRoot, SCTAB nTab, const ExcAutoFilterRecs::~ExcAutoFilterRecs() { - delete pFilterMode; - delete pFilterInfo; } XclExpAutofilter* ExcAutoFilterRecs::GetByCol( SCCOL nCol ) @@ -1002,10 +998,10 @@ bool ExcAutoFilterRecs::IsFiltered( SCCOL nCol ) void ExcAutoFilterRecs::AddObjRecs() { - if( pFilterInfo ) + if( m_pFilterInfo ) { - ScAddress aAddr( pFilterInfo->GetStartPos() ); - for( SCCOL nObj = 0, nCount = pFilterInfo->GetColCount(); nObj < nCount; nObj++ ) + ScAddress aAddr( m_pFilterInfo->GetStartPos() ); + for( SCCOL nObj = 0, nCount = m_pFilterInfo->GetColCount(); nObj < nCount; nObj++ ) { XclObj* pObjRec = new XclObjDropDown( GetObjectManager(), aAddr, IsFiltered( nObj ) ); GetObjectManager().AddObj( pObjRec ); @@ -1016,10 +1012,10 @@ void ExcAutoFilterRecs::AddObjRecs() void ExcAutoFilterRecs::Save( XclExpStream& rStrm ) { - if( pFilterMode ) - pFilterMode->Save( rStrm ); - if( pFilterInfo ) - pFilterInfo->Save( rStrm ); + if( m_pFilterMode ) + m_pFilterMode->Save( rStrm ); + if( m_pFilterInfo ) + m_pFilterInfo->Save( rStrm ); maFilterList.Save( rStrm ); } @@ -1040,7 +1036,7 @@ void ExcAutoFilterRecs::SaveXml( XclExpXmlStream& rStrm ) bool ExcAutoFilterRecs::HasFilterMode() const { - return pFilterMode != nullptr; + return m_pFilterMode != nullptr; } XclExpFilterManager::XclExpFilterManager( const XclExpRoot& rRoot ) : diff --git a/sc/source/filter/inc/excrecds.hxx b/sc/source/filter/inc/excrecds.hxx index 3636c89..a299709 100644 --- a/sc/source/filter/inc/excrecds.hxx +++ b/sc/source/filter/inc/excrecds.hxx @@ -424,8 +424,8 @@ private: typedef XclExpAutofilterList::RecordRefType XclExpAutofilterRef; XclExpAutofilterList maFilterList; - XclExpFiltermode* pFilterMode; - XclExpAutofilterinfo* pFilterInfo; + std::unique_ptr<XclExpFiltermode> m_pFilterMode; + std::unique_ptr<XclExpAutofilterinfo> m_pFilterInfo; ScRange maRef; bool mbAutoFilter; }; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits