loplugin:mergeclasses

Change-Id: Ia4ae4f17fba9775fc53618ab1662c10e37ee4be3
This commit is contained in:
Noel Grandin
2015-10-09 11:14:47 +02:00
parent 14421f20dc
commit 3e6ff89b5c
3 changed files with 28 additions and 31 deletions

View File

@@ -83,7 +83,6 @@ merge XFDate with XFDateStart
merge XFDateTimePart with XFTimePart
merge XMLTransformer with XMLTransformerBase
merge XclDebugObjCounter with XclRootData
merge _SwRedlineTable with SwRedlineTable
merge abp::OModuleResourceClient with abp::OABSPilotUno
merge accessibility::IComboListBoxHelper with VCLListBoxHelper
merge basctl::docs::IDocumentDescriptorFilter with basctl::(anonymous namespace)::FilterDocuments

View File

@@ -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...

View File

@@ -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() )