diff options
author | Noel Grandin <noel@peralex.com> | 2015-10-09 11:14:47 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2015-10-12 09:13:33 +0200 |
commit | 3e6ff89b5ca9c9b164deae82ab24a7ba1552e89e (patch) | |
tree | 0388efc9b21cfac9974f3aa2d32c2e2483992404 /sw | |
parent | 14421f20dca120aeee3cdd56cdcb6b25637fda2c (diff) |
loplugin:mergeclasses
Change-Id: Ia4ae4f17fba9775fc53618ab1662c10e37ee4be3
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/docary.hxx | 32 | ||||
-rw-r--r-- | sw/source/core/doc/docredln.cxx | 26 |
2 files changed, 28 insertions, 30 deletions
diff --git a/sw/inc/docary.hxx b/sw/inc/docary.hxx index dcacc218f592..f690261308b5 100644 --- a/sw/inc/docary.hxx +++ b/sw/inc/docary.hxx @@ -183,18 +183,18 @@ struct CompareSwRedlineTable { bool operator()(SwRangeRedline* const &lhs, SwRangeRedline* const &rhs) const; }; -class _SwRedlineTable - : public o3tl::sorted_vector<SwRangeRedline*, CompareSwRedlineTable, - o3tl::find_partialorder_ptrequals> -{ -public: - ~_SwRedlineTable(); -}; -class SwRedlineTable : private _SwRedlineTable +class SwRedlineTable { public: - bool Contains(const SwRangeRedline* p) const { return find(const_cast<SwRangeRedline* const>(p)) != end(); } + typedef o3tl::sorted_vector<SwRangeRedline*, CompareSwRedlineTable, + o3tl::find_partialorder_ptrequals> vector_type; + typedef vector_type::size_type size_type; +private: + vector_type maVector; +public: + ~SwRedlineTable(); + bool Contains(const SwRangeRedline* p) const { return maVector.find(const_cast<SwRangeRedline* const>(p)) != maVector.end(); } sal_uInt16 GetPos(const SwRangeRedline* p) const; bool Insert( SwRangeRedline* p, bool bIns = true ); @@ -227,14 +227,12 @@ public: */ const SwRangeRedline* FindAtPosition( const SwPosition& startPosition, sal_uInt16& tableIndex, bool next = true ) const; - using _SwRedlineTable::const_iterator; - using _SwRedlineTable::begin; - using _SwRedlineTable::end; - using _SwRedlineTable::size; - using _SwRedlineTable::size_type; - using _SwRedlineTable::operator[]; - using _SwRedlineTable::empty; - using _SwRedlineTable::Resort; + bool empty() const { return maVector.empty(); } + size_type size() const { return maVector.size(); } + SwRangeRedline* operator[]( size_type idx ) const { return maVector[idx]; } + vector_type::const_iterator begin() const { return maVector.begin(); } + vector_type::const_iterator end() const { return maVector.end(); } + void Resort() { maVector.Resort(); } }; /// Table that holds 'extra' redlines, such as 'table row insert\delete', 'paragraph moves' etc... diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx index 1cbb2b55caa7..3a870a9f981a 100644 --- a/sw/source/core/doc/docredln.cxx +++ b/sw/source/core/doc/docredln.cxx @@ -295,7 +295,7 @@ bool SwRedlineTable::Insert( SwRangeRedline* p, bool bIns ) { if( p->HasValidRange() ) { - std::pair<_SwRedlineTable::const_iterator, bool> rv = insert( p ); + std::pair<vector_type::const_iterator, bool> rv = maVector.insert( p ); size_t nP = rv.first - begin(); p->CallDisplayFunc(0, nP); return rv.second; @@ -311,7 +311,7 @@ bool SwRedlineTable::Insert( SwRangeRedline* p, sal_uInt16& rP, bool bIns ) { if( p->HasValidRange() ) { - std::pair<_SwRedlineTable::const_iterator, bool> rv = insert( p ); + std::pair<vector_type::const_iterator, bool> rv = maVector.insert( p ); rP = rv.first - begin(); p->CallDisplayFunc(0, rP); return rv.second; @@ -439,17 +439,17 @@ bool CompareSwRedlineTable::operator()(SwRangeRedline* const &lhs, SwRangeRedlin return *lhs < *rhs; } -_SwRedlineTable::~_SwRedlineTable() +SwRedlineTable::~SwRedlineTable() { - DeleteAndDestroyAll(); + maVector.DeleteAndDestroyAll(); } sal_uInt16 SwRedlineTable::GetPos(const SwRangeRedline* p) const { - const_iterator it = find(const_cast<SwRangeRedline* const>(p)); - if( it == end() ) + vector_type::const_iterator it = maVector.find(const_cast<SwRangeRedline* const>(p)); + if( it == maVector.end() ) return USHRT_MAX; - return it - begin(); + return it - maVector.begin(); } bool SwRedlineTable::Remove( const SwRangeRedline* p ) @@ -465,9 +465,9 @@ void SwRedlineTable::Remove( sal_uInt16 nP ) { SwDoc* pDoc = 0; if( !nP && 1 == size() ) - pDoc = front()->GetDoc(); + pDoc = maVector.front()->GetDoc(); - erase( begin() + nP ); + maVector.erase( maVector.begin() + nP ); SwViewShell* pSh; if( pDoc && !pDoc->IsInDtor() && @@ -484,11 +484,11 @@ void SwRedlineTable::DeleteAndDestroy( sal_uInt16 nP, sal_uInt16 nL ) { SwDoc* pDoc = 0; if( !nP && nL && nL == size() ) - pDoc = front()->GetDoc(); + pDoc = maVector.front()->GetDoc(); - for( const_iterator it = begin() + nP; it != begin() + nP + nL; ++it ) + for( vector_type::const_iterator it = maVector.begin() + nP; it != maVector.begin() + nP + nL; ++it ) delete *it; - erase( begin() + nP, begin() + nP + nL ); + maVector.erase( maVector.begin() + nP, maVector.begin() + nP + nL ); SwViewShell* pSh; if( pDoc && !pDoc->IsInDtor() && @@ -563,7 +563,7 @@ const SwRangeRedline* SwRedlineTable::FindAtPosition( const SwPosition& rSttPos, bool bNext ) const { const SwRangeRedline* pFnd = 0; - for( ; rPos < size() ; ++rPos ) + for( ; rPos < maVector.size() ; ++rPos ) { const SwRangeRedline* pTmp = (*this)[ rPos ]; if( pTmp->HasMark() && pTmp->IsVisible() ) |