sc/inc/conditio.hxx | 1 sc/inc/datauno.hxx | 2 - sc/inc/detdata.hxx | 2 - sc/inc/dispuno.hxx | 3 -- sc/source/core/data/table3.cxx | 39 +++++++++++++-------------- sc/source/core/tool/detdata.cxx | 12 ++++---- sc/source/filter/inc/XclExpChangeTrack.hxx | 6 +--- sc/source/filter/xcl97/XclExpChangeTrack.cxx | 30 ++++++++++---------- sc/source/ui/undo/undocell.cxx | 2 - sc/source/ui/unoobj/datauno.cxx | 4 -- sc/source/ui/unoobj/dispuno.cxx | 4 -- 11 files changed, 48 insertions(+), 57 deletions(-)
New commits: commit 927447356fb7025d2b61073f525adc24643c7925 Author: Derrick Rocha <drocha...@gmail.com> Date: Sat Sep 12 16:49:29 2015 -0600 replace boost::ptr_container with std::container<std::unique_ptr> Change-Id: I8fd1121577c6443f9100b181402083d1b7c30b6b Reviewed-on: https://gerrit.libreoffice.org/18525 Tested-by: Jenkins <c...@libreoffice.org> Reviewed-by: Noel Grandin <noelgran...@gmail.com> diff --git a/sc/inc/conditio.hxx b/sc/inc/conditio.hxx index 9b13c08..5893585 100644 --- a/sc/inc/conditio.hxx +++ b/sc/inc/conditio.hxx @@ -35,7 +35,6 @@ #include <set> #include <boost/noncopyable.hpp> -#include <boost/ptr_container/ptr_vector.hpp> #include <boost/scoped_ptr.hpp> class ScFormulaCell; diff --git a/sc/inc/datauno.hxx b/sc/inc/datauno.hxx index 8fa2c09..72c69e2 100644 --- a/sc/inc/datauno.hxx +++ b/sc/inc/datauno.hxx @@ -59,7 +59,7 @@ struct ScSortParam; typedef ::com::sun::star::uno::Reference< ::com::sun::star::util::XRefreshListener > XDBRefreshListenerRef; -typedef boost::ptr_vector<XDBRefreshListenerRef> XDBRefreshListenerArr_Impl; +typedef std::vector<XDBRefreshListenerRef> XDBRefreshListenerArr_Impl; class ScDataUnoConversion { diff --git a/sc/inc/detdata.hxx b/sc/inc/detdata.hxx index 110f4a1..ab7fb71 100644 --- a/sc/inc/detdata.hxx +++ b/sc/inc/detdata.hxx @@ -56,7 +56,7 @@ public: // list of operators -typedef boost::ptr_vector<ScDetOpData> ScDetOpDataVector; +typedef std::vector<std::unique_ptr<ScDetOpData>> ScDetOpDataVector; class ScDetOpList { diff --git a/sc/inc/dispuno.hxx b/sc/inc/dispuno.hxx index 9638ed5..3b57717 100644 --- a/sc/inc/dispuno.hxx +++ b/sc/inc/dispuno.hxx @@ -25,7 +25,6 @@ #include <cppuhelper/implbase.hxx> #include <svl/lstner.hxx> #include "global.hxx" -#include <boost/ptr_container/ptr_vector.hpp> namespace com { namespace sun { namespace star { namespace frame { class XDispatchProviderInterception; @@ -35,7 +34,7 @@ class ScTabViewShell; typedef ::com::sun::star::uno::Reference< ::com::sun::star::frame::XStatusListener > XStatusListenerRef; -typedef boost::ptr_vector<XStatusListenerRef> XStatusListenerArr_Impl; +typedef std::vector<XStatusListenerRef> XStatusListenerArr_Impl; class ScDispatchProviderInterceptor : public cppu::WeakImplHelper< com::sun::star::frame::XDispatchProviderInterceptor, diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx index 0b292e6..9775e14a 100644 --- a/sc/source/core/data/table3.cxx +++ b/sc/source/core/data/table3.cxx @@ -73,7 +73,6 @@ #include <boost/scoped_ptr.hpp> #include <memory> #include <boost/noncopyable.hpp> -#include <boost/ptr_container/ptr_vector.hpp> #include <mdds/flat_segment_tree.hpp> using namespace ::com::sun::star; @@ -708,7 +707,7 @@ public: }; void fillSortedColumnArray( - boost::ptr_vector<SortedColumn>& rSortedCols, + std::vector<std::unique_ptr<SortedColumn>>& rSortedCols, SortedRowFlags& rRowFlags, std::vector<SvtListener*>& rCellListeners, ScSortInfoArray* pArray, SCTAB nTab, SCCOL nCol1, SCCOL nCol2, ScProgress* pProgress ) @@ -717,7 +716,7 @@ void fillSortedColumnArray( ScSortInfoArray::RowsType* pRows = pArray->GetDataRows(); size_t nColCount = nCol2 - nCol1 + 1; - boost::ptr_vector<SortedColumn> aSortedCols; // storage for copied cells. + std::vector<std::unique_ptr<SortedColumn>> aSortedCols; // storage for copied cells. SortedRowFlags aRowFlags; aSortedCols.reserve(nColCount); for (size_t i = 0; i < nColCount; ++i) @@ -725,7 +724,7 @@ void fillSortedColumnArray( // In the sorted column container, element positions and row // positions must match, else formula cells may mis-behave during // grouping. - aSortedCols.push_back(new SortedColumn(nRow1)); + aSortedCols.push_back(std::unique_ptr<SortedColumn>(new SortedColumn(nRow1))); } for (size_t i = 0; i < pRows->size(); ++i) @@ -737,7 +736,7 @@ void fillSortedColumnArray( ScSortInfoArray::Cell& rCell = pRow->maCells[j]; - sc::CellStoreType& rCellStore = aSortedCols.at(j).maCells; + sc::CellStoreType& rCellStore = aSortedCols.at(j).get()->maCells; switch (rCell.maCell.meType) { case CELLTYPE_STRING: @@ -786,7 +785,7 @@ void fillSortedColumnArray( rCellStore.push_back_empty(); } - sc::CellTextAttrStoreType& rAttrStore = aSortedCols.at(j).maCellTextAttrs; + sc::CellTextAttrStoreType& rAttrStore = aSortedCols.at(j).get()->maCellTextAttrs; if (rCell.mpAttr) rAttrStore.push_back(*rCell.mpAttr); else @@ -797,7 +796,7 @@ void fillSortedColumnArray( // At this point each broadcaster instance is managed by 2 // containers. We will release those in the original storage // below before transferring them to the document. - sc::BroadcasterStoreType& rBCStore = aSortedCols.at(j).maBroadcasters; + sc::BroadcasterStoreType& rBCStore = aSortedCols.at(j).get()->maBroadcasters; if (rCell.mpBroadcaster) // A const pointer would be implicitly converted to a bool type. rBCStore.push_back(const_cast<SvtBroadcaster*>(rCell.mpBroadcaster)); @@ -806,14 +805,14 @@ void fillSortedColumnArray( } // The same with cell note instances ... - sc::CellNoteStoreType& rNoteStore = aSortedCols.at(j).maCellNotes; + sc::CellNoteStoreType& rNoteStore = aSortedCols.at(j).get()->maCellNotes; if (rCell.mpNote) rNoteStore.push_back(const_cast<ScPostIt*>(rCell.mpNote)); else rNoteStore.push_back_empty(); if (rCell.mpPattern) - aSortedCols.at(j).setPattern(aCellPos.Row(), rCell.mpPattern); + aSortedCols.at(j).get()->setPattern(aCellPos.Row(), rCell.mpPattern); } if (pArray->IsKeepQuery()) @@ -1091,7 +1090,7 @@ void ScTable::SortReorderByRow( // Cells in the data rows only reference values in the document. Make // a copy before updating the document. - boost::ptr_vector<SortedColumn> aSortedCols; // storage for copied cells. + std::vector<std::unique_ptr<SortedColumn>> aSortedCols; // storage for copied cells. SortedRowFlags aRowFlags; fillSortedColumnArray(aSortedCols, aRowFlags, aCellListeners, pArray, nTab, nCol1, nCol2, pProgress); @@ -1101,18 +1100,18 @@ void ScTable::SortReorderByRow( { sc::CellStoreType& rDest = aCol[nThisCol].maCells; - sc::CellStoreType& rSrc = aSortedCols[i].maCells; + sc::CellStoreType& rSrc = aSortedCols[i].get()->maCells; rSrc.transfer(nRow1, nRow2, rDest, nRow1); } { sc::CellTextAttrStoreType& rDest = aCol[nThisCol].maCellTextAttrs; - sc::CellTextAttrStoreType& rSrc = aSortedCols[i].maCellTextAttrs; + sc::CellTextAttrStoreType& rSrc = aSortedCols[i].get()->maCellTextAttrs; rSrc.transfer(nRow1, nRow2, rDest, nRow1); } { - sc::CellNoteStoreType& rSrc = aSortedCols[i].maCellNotes; + sc::CellNoteStoreType& rSrc = aSortedCols[i].get()->maCellNotes; sc::CellNoteStoreType& rDest = aCol[nThisCol].maCellNotes; // Do the same as broadcaster storage transfer (to prevent double deletion). @@ -1125,7 +1124,7 @@ void ScTable::SortReorderByRow( // Get all row spans where the pattern is not NULL. std::vector<PatternSpan> aSpans = sc::toSpanArrayWithValue<SCROW,const ScPatternAttr*,PatternSpan>( - aSortedCols[i].maPatterns); + aSortedCols[i].get()->maPatterns); std::vector<PatternSpan>::iterator it = aSpans.begin(), itEnd = aSpans.end(); for (; it != itEnd; ++it) @@ -1276,7 +1275,7 @@ void ScTable::SortReorderByRowRefUpdate( // Cells in the data rows only reference values in the document. Make // a copy before updating the document. - boost::ptr_vector<SortedColumn> aSortedCols; // storage for copied cells. + std::vector<std::unique_ptr<SortedColumn>> aSortedCols; // storage for copied cells. SortedRowFlags aRowFlags; std::vector<SvtListener*> aListenersDummy; fillSortedColumnArray(aSortedCols, aRowFlags, aListenersDummy, pArray, nTab, nCol1, nCol2, pProgress); @@ -1287,18 +1286,18 @@ void ScTable::SortReorderByRowRefUpdate( { sc::CellStoreType& rDest = aCol[nThisCol].maCells; - sc::CellStoreType& rSrc = aSortedCols[i].maCells; + sc::CellStoreType& rSrc = aSortedCols[i].get()->maCells; rSrc.transfer(nRow1, nRow2, rDest, nRow1); } { sc::CellTextAttrStoreType& rDest = aCol[nThisCol].maCellTextAttrs; - sc::CellTextAttrStoreType& rSrc = aSortedCols[i].maCellTextAttrs; + sc::CellTextAttrStoreType& rSrc = aSortedCols[i].get()->maCellTextAttrs; rSrc.transfer(nRow1, nRow2, rDest, nRow1); } { - sc::BroadcasterStoreType& rSrc = aSortedCols[i].maBroadcasters; + sc::BroadcasterStoreType& rSrc = aSortedCols[i].get()->maBroadcasters; sc::BroadcasterStoreType& rDest = aCol[nThisCol].maBroadcasters; // Release current broadcasters first, to prevent them from getting deleted. @@ -1309,7 +1308,7 @@ void ScTable::SortReorderByRowRefUpdate( } { - sc::CellNoteStoreType& rSrc = aSortedCols[i].maCellNotes; + sc::CellNoteStoreType& rSrc = aSortedCols[i].get()->maCellNotes; sc::CellNoteStoreType& rDest = aCol[nThisCol].maCellNotes; // Do the same as broadcaster storage transfer (to prevent double deletion). @@ -1322,7 +1321,7 @@ void ScTable::SortReorderByRowRefUpdate( // Get all row spans where the pattern is not NULL. std::vector<PatternSpan> aSpans = sc::toSpanArrayWithValue<SCROW,const ScPatternAttr*,PatternSpan>( - aSortedCols[i].maPatterns); + aSortedCols[i].get()->maPatterns); std::vector<PatternSpan>::iterator it = aSpans.begin(), itEnd = aSpans.end(); for (; it != itEnd; ++it) diff --git a/sc/source/core/tool/detdata.cxx b/sc/source/core/tool/detdata.cxx index 3cdd043..b2671db 100644 --- a/sc/source/core/tool/detdata.cxx +++ b/sc/source/core/tool/detdata.cxx @@ -27,7 +27,7 @@ ScDetOpList::ScDetOpList(const ScDetOpList& rList) : size_t nCount = rList.Count(); for (size_t i=0; i<nCount; i++) - Append( new ScDetOpData(rList.aDetOpDataVector[i]) ); + Append( new ScDetOpData( (*rList.aDetOpDataVector[i].get()) ) ); } void ScDetOpList::DeleteOnTab( SCTAB nTab ) @@ -35,7 +35,7 @@ void ScDetOpList::DeleteOnTab( SCTAB nTab ) for (ScDetOpDataVector::iterator it = aDetOpDataVector.begin(); it != aDetOpDataVector.end(); /*noop*/ ) { // look for operations on the deleted sheet - if (it->GetPos().Tab() == nTab) + if ((*it)->GetPos().Tab() == nTab) it = aDetOpDataVector.erase( it); else ++it; @@ -47,7 +47,7 @@ void ScDetOpList::UpdateReference( ScDocument* pDoc, UpdateRefMode eUpdateRefMod { for (ScDetOpDataVector::iterator it = aDetOpDataVector.begin(); it != aDetOpDataVector.end(); ++it ) { - ScAddress aPos = it->GetPos(); + ScAddress aPos = (*it)->GetPos(); SCCOL nCol1 = aPos.Col(); SCROW nRow1 = aPos.Row(); SCTAB nTab1 = aPos.Tab(); @@ -61,7 +61,7 @@ void ScDetOpList::UpdateReference( ScDocument* pDoc, UpdateRefMode eUpdateRefMod rRange.aEnd.Col(), rRange.aEnd.Row(), rRange.aEnd.Tab(), nDx, nDy, nDz, nCol1, nRow1, nTab1, nCol2, nRow2, nTab2 ); if ( eRes != UR_NOTHING ) - it->SetPos( ScAddress( nCol1, nRow1, nTab1 ) ); + (*it)->SetPos( ScAddress( nCol1, nRow1, nTab1 ) ); } } @@ -70,7 +70,7 @@ void ScDetOpList::Append( ScDetOpData* pDetOpData ) if ( pDetOpData->GetOperation() == SCDETOP_ADDERROR ) bHasAddError = true; - aDetOpDataVector.push_back( pDetOpData ); + aDetOpDataVector.push_back( std::unique_ptr<ScDetOpData>(pDetOpData) ); } bool ScDetOpList::operator==( const ScDetOpList& r ) const @@ -88,7 +88,7 @@ bool ScDetOpList::operator==( const ScDetOpList& r ) const const ScDetOpData& ScDetOpList::GetObject( size_t nPos ) const { - return aDetOpDataVector[nPos]; + return (*aDetOpDataVector[nPos].get()); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/filter/inc/XclExpChangeTrack.hxx b/sc/source/filter/inc/XclExpChangeTrack.hxx index cff08cf..0d28137 100644 --- a/sc/source/filter/inc/XclExpChangeTrack.hxx +++ b/sc/source/filter/inc/XclExpChangeTrack.hxx @@ -29,8 +29,6 @@ #include "ftools.hxx" #include "excrecds.hxx" -#include <boost/ptr_container/ptr_vector.hpp> - class ExcXmlRecord : public ExcRecord { public: @@ -590,8 +588,8 @@ public: class XclExpChangeTrack : protected XclExpRoot { - typedef boost::ptr_vector<ExcRecord> RecListType; - typedef boost::ptr_vector<XclExpChTrTabIdBuffer> TabIdBufferType; + typedef std::vector<std::unique_ptr<ExcRecord>> RecListType; + typedef std::vector<std::unique_ptr<XclExpChTrTabIdBuffer>> TabIdBufferType; RecListType maRecList; // list of "Revision Log" stream records std::stack<XclExpChTrAction*> aActionStack; XclExpChTrTabIdBuffer* pTabIdBuffer; diff --git a/sc/source/filter/xcl97/XclExpChangeTrack.cxx b/sc/source/filter/xcl97/XclExpChangeTrack.cxx index acd7fa2..6a7e67b 100644 --- a/sc/source/filter/xcl97/XclExpChangeTrack.cxx +++ b/sc/source/filter/xcl97/XclExpChangeTrack.cxx @@ -1425,7 +1425,7 @@ XclExpChangeTrack::XclExpChangeTrack( const XclExpRoot& rRoot ) : return; pTabIdBuffer = new XclExpChTrTabIdBuffer( GetTabInfo().GetXclTabCount() ); - maBuffers.push_back( pTabIdBuffer ); + maBuffers.push_back( std::unique_ptr<XclExpChTrTabIdBuffer>(pTabIdBuffer) ); // calculate final table order (tab id list) const ScChangeAction* pScAction; @@ -1453,9 +1453,9 @@ XclExpChangeTrack::XclExpChangeTrack( const XclExpRoot& rRoot ) : if (GetOutput() == EXC_OUTPUT_BINARY) { pHeader = new XclExpChTrHeader; - maRecList.push_back( pHeader ); - maRecList.push_back( new XclExpChTr0x0195 ); - maRecList.push_back( new XclExpChTr0x0194( *pTempChangeTrack ) ); + maRecList.push_back( std::unique_ptr<ExcRecord>(pHeader) ); + maRecList.push_back( std::unique_ptr<ExcRecord>( new XclExpChTr0x0195 ) ); + maRecList.push_back( std::unique_ptr<ExcRecord>( new XclExpChTr0x0194( *pTempChangeTrack ) ) ); OUString sLastUsername; DateTime aLastDateTime( DateTime::EMPTY ); @@ -1475,22 +1475,22 @@ XclExpChangeTrack::XclExpChangeTrack( const XclExpRoot& rRoot ) : aLastDateTime = pAction->GetDateTime(); nLogNumber++; - maRecList.push_back( new XclExpChTrInfo(sLastUsername, aLastDateTime, aGUID) ); - maRecList.push_back( new XclExpChTrTabId(pAction->GetTabIdBuffer()) ); + maRecList.push_back( std::unique_ptr<ExcRecord>(new XclExpChTrInfo(sLastUsername, aLastDateTime, aGUID)) ); + maRecList.push_back( std::unique_ptr<ExcRecord>(new XclExpChTrTabId(pAction->GetTabIdBuffer())) ); pHeader->SetGUID( aGUID ); } pAction->SetIndex( nIndex ); - maRecList.push_back( pAction ); + maRecList.push_back( std::unique_ptr<ExcRecord>(pAction) ); } pHeader->SetGUID( aGUID ); pHeader->SetCount( nIndex - 1 ); - maRecList.push_back( new ExcEof ); + maRecList.push_back( std::unique_ptr<ExcRecord>(new ExcEof) ); } else { XclExpXmlChTrHeaders* pHeaders = new XclExpXmlChTrHeaders; - maRecList.push_back(pHeaders); + maRecList.push_back( std::unique_ptr<ExcRecord>(pHeaders)); OUString sLastUsername; DateTime aLastDateTime(DateTime::EMPTY); @@ -1512,7 +1512,7 @@ XclExpChangeTrack::XclExpChangeTrack( const XclExpRoot& rRoot ) : aLastDateTime = pAction->GetDateTime(); pCurHeader = new XclExpXmlChTrHeader(sLastUsername, aLastDateTime, aGUID, nLogNumber, pAction->GetTabIdBuffer()); - maRecList.push_back(pCurHeader); + maRecList.push_back( std::unique_ptr<ExcRecord>(pCurHeader)); nLogNumber++; pHeaders->SetGUID(aGUID); } @@ -1521,7 +1521,7 @@ XclExpChangeTrack::XclExpChangeTrack( const XclExpRoot& rRoot ) : } pHeaders->SetGUID(aGUID); - maRecList.push_back(new EndXmlElement(XML_headers)); + maRecList.push_back( std::unique_ptr<ExcRecord>(new EndXmlElement(XML_headers))); } } @@ -1584,7 +1584,7 @@ void XclExpChangeTrack::PushActionRecord( const ScChangeAction& rAction ) pXclAction = new XclExpChTrInsertTab( rAction, GetRoot(), *pTabIdBuffer ); XclExpChTrTabIdBuffer* pNewBuffer = new XclExpChTrTabIdBuffer( *pTabIdBuffer ); pNewBuffer->Remove(); - maBuffers.push_back( pNewBuffer ); + maBuffers.push_back( std::unique_ptr<XclExpChTrTabIdBuffer>(pNewBuffer) ); pTabIdBuffer = pNewBuffer; } break; @@ -1630,8 +1630,8 @@ void XclExpChangeTrack::Write() XclExpStream aXclStrm( *xSvStrm, GetRoot(), EXC_MAXRECSIZE_BIFF8 + 8 ); RecListType::iterator pIter; - for (pIter = maRecList.begin(); pIter != maRecList.end(); ++pIter) - pIter->Save(aXclStrm); + for(pIter = maRecList.begin(); pIter != maRecList.end(); ++pIter) + (*pIter)->Save(aXclStrm); xSvStrm->Commit(); } @@ -1677,7 +1677,7 @@ void XclExpChangeTrack::WriteXml( XclExpXmlStream& rWorkbookStrm ) RecListType::iterator pIter; for (pIter = maRecList.begin(); pIter != maRecList.end(); ++pIter) - pIter->SaveXml(rWorkbookStrm); + (*pIter)->SaveXml(rWorkbookStrm); rWorkbookStrm.PopStream(); } diff --git a/sc/source/ui/undo/undocell.cxx b/sc/source/ui/undo/undocell.cxx index c69c308..0f26097 100644 --- a/sc/source/ui/undo/undocell.cxx +++ b/sc/source/ui/undo/undocell.cxx @@ -922,7 +922,7 @@ void ScUndoDetective::Undo() { ScDetOpDataVector& rVec = pList->GetDataVector(); ScDetOpDataVector::iterator it = rVec.begin() + rVec.size() - 1; - if ( it->GetOperation() == (ScDetOpType) nAction && it->GetPos() == aPos ) + if ( (*it)->GetOperation() == (ScDetOpType) nAction && (*it)->GetPos() == aPos ) rVec.erase( it); else { diff --git a/sc/source/ui/unoobj/datauno.cxx b/sc/source/ui/unoobj/datauno.cxx index 7bda638..2c98dc3 100644 --- a/sc/source/ui/unoobj/datauno.cxx +++ b/sc/source/ui/unoobj/datauno.cxx @@ -1933,9 +1933,7 @@ void SAL_CALL ScDatabaseRangeObj::addRefreshListener( throw(uno::RuntimeException, std::exception) { SolarMutexGuard aGuard; - uno::Reference<util::XRefreshListener>* pObj = - new uno::Reference<util::XRefreshListener>( xListener ); - aRefreshListeners.push_back( pObj ); + aRefreshListeners.push_back( uno::Reference<util::XRefreshListener>( xListener )); // hold one additional ref to keep this object alive as long as there are listeners if ( aRefreshListeners.size() == 1 ) diff --git a/sc/source/ui/unoobj/dispuno.cxx b/sc/source/ui/unoobj/dispuno.cxx index b351694..c166330 100644 --- a/sc/source/ui/unoobj/dispuno.cxx +++ b/sc/source/ui/unoobj/dispuno.cxx @@ -281,9 +281,7 @@ void SAL_CALL ScDispatch::addStatusListener( if ( aURL.Complete.equalsAscii(cURLDocDataSource) ) { - uno::Reference<frame::XStatusListener>* pObj = - new uno::Reference<frame::XStatusListener>( xListener ); - aDataSourceListeners.push_back( pObj ); + aDataSourceListeners.push_back( uno::Reference<frame::XStatusListener>( xListener ) ); if (!bListeningToView) { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits