summaryrefslogtreecommitdiffstats
path: root/sc
diff options
context:
space:
mode:
authorMichael Stahl <mstahl@redhat.com>2015-11-02 17:12:26 +0100
committerMichael Stahl <mstahl@redhat.com>2015-11-02 21:11:42 +0100
commit64f3c1ecce7038a7890947020540161ec31204c7 (patch)
tree014cb9a4a5d66ac226f3355d82d3f08625dada57 /sc
parentHandle case that pDock may have no items (diff)
downloadcore-64f3c1ecce7038a7890947020540161ec31204c7.tar.gz
core-64f3c1ecce7038a7890947020540161ec31204c7.zip
sc: replace boost::ptr_vector with std::vector<std::unique_ptr>
Change-Id: I21719d513aa4af7a7f9621e19d529fd0c4425f58
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/document.hxx4
-rw-r--r--sc/source/core/data/documen2.cxx1
-rw-r--r--sc/source/core/data/document.cxx4
-rw-r--r--sc/source/core/tool/interpr4.cxx38
4 files changed, 25 insertions, 22 deletions
diff --git a/sc/inc/document.hxx b/sc/inc/document.hxx
index db0f6d2d81a1..ec019b098c64 100644
--- a/sc/inc/document.hxx
+++ b/sc/inc/document.hxx
@@ -44,7 +44,6 @@
#include <map>
#include <set>
#include <vector>
-#include <boost/ptr_container/ptr_vector.hpp>
#include "markdata.hxx"
@@ -374,7 +373,8 @@ private:
css::uno::Reference< css::script::vba::XVBAEventProcessor >
mxVbaEvents;
public:
- boost::ptr_vector< ScInterpreterTableOpParams > aTableOpList; // list of ScInterpreterTableOpParams currently in use
+ /// list of ScInterpreterTableOpParams currently in use
+ std::vector<std::unique_ptr<ScInterpreterTableOpParams>> m_TableOpList;
ScInterpreterTableOpParams aLastTableOpParams; // remember last params
private:
diff --git a/sc/source/core/data/documen2.cxx b/sc/source/core/data/documen2.cxx
index 38ca15dbc198..b7cc1ed0689b 100644
--- a/sc/source/core/data/documen2.cxx
+++ b/sc/source/core/data/documen2.cxx
@@ -170,7 +170,6 @@ ScDocument::ScDocument( ScDocumentMode eMode, SfxObjectShell* pDocShell ) :
nUnoObjectId( 0 ),
nRangeOverflowType( 0 ),
aCurTextWidthCalcPos(MAXCOL,0,0),
- aTableOpList( 0 ),
nFormulaCodeInTree(0),
nXMLImportedFormulaCount( 0 ),
nInterpretLevel(0),
diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx
index 9bfee0bdf1ae..054dc9f246fc 100644
--- a/sc/source/core/data/document.cxx
+++ b/sc/source/core/data/document.cxx
@@ -3755,9 +3755,9 @@ void ScDocument::InterpretDirtyCells( const ScRangeList& rRanges )
void ScDocument::AddTableOpFormulaCell( ScFormulaCell* pCell )
{
- if ( !aTableOpList.empty() )
+ if (!m_TableOpList.empty())
{
- ScInterpreterTableOpParams* p = &aTableOpList.back();
+ ScInterpreterTableOpParams *const p = m_TableOpList.back().get();
if ( p->bCollectNotifications )
{
if ( p->bRefresh )
diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx
index d21e9e6f1cf0..53ac379271f7 100644
--- a/sc/source/core/tool/interpr4.cxx
+++ b/sc/source/core/tool/interpr4.cxx
@@ -87,10 +87,10 @@ using ::std::unique_ptr;
void ScInterpreter::ReplaceCell( ScAddress& rPos )
{
- size_t ListSize = pDok->aTableOpList.size();
+ size_t ListSize = pDok->m_TableOpList.size();
for ( size_t i = 0; i < ListSize; ++i )
{
- ScInterpreterTableOpParams* pTOp = &pDok->aTableOpList[ i ];
+ ScInterpreterTableOpParams *const pTOp = pDok->m_TableOpList[ i ].get();
if ( rPos == pTOp->aOld1 )
{
rPos = pTOp->aNew1;
@@ -107,10 +107,10 @@ void ScInterpreter::ReplaceCell( ScAddress& rPos )
void ScInterpreter::ReplaceCell( SCCOL& rCol, SCROW& rRow, SCTAB& rTab )
{
ScAddress aCellPos( rCol, rRow, rTab );
- size_t ListSize = pDok->aTableOpList.size();
+ size_t ListSize = pDok->m_TableOpList.size();
for ( size_t i = 0; i < ListSize; ++i )
{
- ScInterpreterTableOpParams* pTOp = &pDok->aTableOpList[ i ];
+ ScInterpreterTableOpParams *const pTOp = pDok->m_TableOpList[ i ].get();
if ( aCellPos == pTOp->aOld1 )
{
rCol = pTOp->aNew1.Col();
@@ -134,10 +134,10 @@ bool ScInterpreter::IsTableOpInRange( const ScRange& rRange )
return false; // not considered to be a range in TableOp sense
// we can't replace a single cell in a range
- size_t ListSize = pDok->aTableOpList.size();
+ size_t ListSize = pDok->m_TableOpList.size();
for ( size_t i = 0; i < ListSize; ++i )
{
- ScInterpreterTableOpParams* pTOp = &pDok->aTableOpList[ i ];
+ ScInterpreterTableOpParams *const pTOp = pDok->m_TableOpList[ i ].get();
if ( rRange.In( pTOp->aOld1 ) )
return true;
if ( rRange.In( pTOp->aOld2 ) )
@@ -911,7 +911,7 @@ void ScInterpreter::PopSingleRef(SCCOL& rCol, SCROW &rRow, SCTAB& rTab)
break;
case svSingleRef:
SingleRefToVars( *p->GetSingleRef(), rCol, rRow, rTab);
- if ( !pDok->aTableOpList.empty() )
+ if (!pDok->m_TableOpList.empty())
ReplaceCell( rCol, rRow, rTab );
break;
default:
@@ -940,7 +940,7 @@ void ScInterpreter::PopSingleRef( ScAddress& rAdr )
SCTAB nTab;
SingleRefToVars( *p->GetSingleRef(), nCol, nRow, nTab);
rAdr.Set( nCol, nRow, nTab );
- if ( !pDok->aTableOpList.empty() )
+ if (!pDok->m_TableOpList.empty())
ReplaceCell( rAdr );
}
break;
@@ -960,7 +960,7 @@ void ScInterpreter::DoubleRefToVars( const formula::FormulaToken* p,
const ScComplexRefData& rCRef = *p->GetDoubleRef();
SingleRefToVars( rCRef.Ref1, rCol1, rRow1, rTab1);
SingleRefToVars( rCRef.Ref2, rCol2, rRow2, rTab2);
- if ( !pDok->aTableOpList.empty() && !bDontCheckForTableOp )
+ if (!pDok->m_TableOpList.empty() && !bDontCheckForTableOp)
{
ScRange aRange( rCol1, rRow1, rTab1, rCol2, rRow2, rTab2 );
if ( IsTableOpInRange( aRange ) )
@@ -1045,7 +1045,7 @@ void ScInterpreter::DoubleRefToRange( const ScComplexRefData & rCRef,
SingleRefToVars( rCRef.Ref2, nCol, nRow, nTab);
rRange.aEnd.Set( nCol, nRow, nTab );
rRange.PutInOrder();
- if (! pDok->aTableOpList.empty() && !bDontCheckForTableOp )
+ if (!pDok->m_TableOpList.empty() && !bDontCheckForTableOp)
{
if ( IsTableOpInRange( rRange ) )
SetError( errIllegalParameter );
@@ -3219,9 +3219,9 @@ class FindByPointer : ::std::unary_function<ScInterpreterTableOpParams, bool>
const ScInterpreterTableOpParams* mpTableOp;
public:
explicit FindByPointer(const ScInterpreterTableOpParams* p) : mpTableOp(p) {}
- bool operator() (const ScInterpreterTableOpParams& val) const
+ bool operator() (const auto& val) const
{
- return &val == mpTableOp;
+ return val.get() == mpTableOp;
}
};
@@ -3246,7 +3246,8 @@ void ScInterpreter::ScTableOp()
PopSingleRef( pTableOp->aFormulaPos );
pTableOp->bValid = true;
- pDok->aTableOpList.push_back( pTableOp );
+ pDok->m_TableOpList.push_back(
+ std::unique_ptr<ScInterpreterTableOpParams>(pTableOp));
pDok->IncInterpreterTableOpLevel();
bool bReuseLastParams = (pDok->aLastTableOpParams == *pTableOp);
@@ -3286,10 +3287,13 @@ void ScInterpreter::ScTableOp()
PushString( aCellString );
}
- boost::ptr_vector< ScInterpreterTableOpParams >::iterator itr =
- ::std::find_if(pDok->aTableOpList.begin(), pDok->aTableOpList.end(), FindByPointer(pTableOp));
- if (itr != pDok->aTableOpList.end())
- pTableOp = pDok->aTableOpList.release(itr).release();
+ auto const itr =
+ ::std::find_if(pDok->m_TableOpList.begin(), pDok->m_TableOpList.end(), FindByPointer(pTableOp));
+ if (itr != pDok->m_TableOpList.end())
+ {
+ pTableOp = itr->release();
+ pDok->m_TableOpList.erase(itr);
+ }
// set dirty again once more to be able to recalculate original
for ( ::std::vector< ScFormulaCell* >::const_iterator iBroadcast(