summaryrefslogtreecommitdiff
path: root/sw/inc/ndindex.hxx
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@canonical.com>2014-12-22 00:03:44 +0100
committerBjoern Michaelsen <bjoern.michaelsen@canonical.com>2014-12-23 04:02:14 +0100
commita6c0583675b6fe4210ae8249728fe5d4df125f5c (patch)
treefd1df4ad693c205eccf464e8fbe41b6162086128 /sw/inc/ndindex.hxx
parent583c949612ac40c21b02886f4d37a45212946138 (diff)
remove duplicated code
Change-Id: Id306d1dc75ef9d5ec5ec2e48be318e0632ea2377
Diffstat (limited to 'sw/inc/ndindex.hxx')
-rw-r--r--sw/inc/ndindex.hxx27
1 files changed, 3 insertions, 24 deletions
diff --git a/sw/inc/ndindex.hxx b/sw/inc/ndindex.hxx
index b6e7ca2e22a9..2663fcb9e795 100644
--- a/sw/inc/ndindex.hxx
+++ b/sw/inc/ndindex.hxx
@@ -261,14 +261,7 @@ inline SwNodeIndex& SwNodeIndex::operator=( sal_uLong nWert )
SwNodeIndex& SwNodeIndex::operator=( const SwNodeIndex& rIdx )
{
- if( &pNd->GetNodes() != &rIdx.pNd->GetNodes() )
- {
- DeRegisterIndex( pNd->GetNodes() );
- pNd = rIdx.pNd;
- RegisterIndex( pNd->GetNodes() );
- }
- else
- pNd = rIdx.pNd;
+ *this = *(rIdx.pNd);
return *this;
}
@@ -287,27 +280,13 @@ SwNodeIndex& SwNodeIndex::operator=( const SwNode& rNd )
SwNodeIndex& SwNodeIndex::Assign( SwNodes& rNds, sal_uLong nIdx )
{
- if( &pNd->GetNodes() != &rNds )
- {
- DeRegisterIndex( pNd->GetNodes() );
- pNd = rNds[ nIdx ];
- RegisterIndex( pNd->GetNodes() );
- }
- else
- pNd = rNds[ nIdx ];
+ *this = *rNds[ nIdx ];
return *this;
}
SwNodeIndex& SwNodeIndex::Assign( const SwNode& rNd, long nOffset )
{
- if( &pNd->GetNodes() != &rNd.GetNodes() )
- {
- DeRegisterIndex( pNd->GetNodes() );
- pNd = const_cast<SwNode*>(&rNd);
- RegisterIndex( pNd->GetNodes() );
- }
- else
- pNd = const_cast<SwNode*>(&rNd);
+ *this = rNd;
if( nOffset )
pNd = pNd->GetNodes()[ pNd->GetIndex() + nOffset ];