diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2014-12-20 16:51:25 +0100 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2014-12-23 04:02:13 +0100 |
commit | eaf3774752869e0322a340d5be4ab1b328f3632a (patch) | |
tree | 9fb0e6ebc53f10527cf4f48176f450bf802aa921 /sw/inc/ndindex.hxx | |
parent | b74fc841445c92ce458619bbf73a5c6e08e2b640 (diff) |
inline operator=
Change-Id: I2a74b9821072025cdf374d5e157411136e08ebec
Diffstat (limited to 'sw/inc/ndindex.hxx')
-rw-r--r-- | sw/inc/ndindex.hxx | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/sw/inc/ndindex.hxx b/sw/inc/ndindex.hxx index ba3dc47f2a8a..51ae6827fb77 100644 --- a/sw/inc/ndindex.hxx +++ b/sw/inc/ndindex.hxx @@ -107,8 +107,8 @@ public: inline bool operator!=( sal_uLong nWert ) const; inline SwNodeIndex& operator=( sal_uLong ); - SwNodeIndex& operator=( const SwNodeIndex& ); - SwNodeIndex& operator=( const SwNode& ); + inline SwNodeIndex& operator=( const SwNodeIndex& ); + inline SwNodeIndex& operator=( const SwNode& ); // Return value of index as sal_uLong. inline sal_uLong GetIndex() const; @@ -256,6 +256,32 @@ inline SwNodeIndex& SwNodeIndex::operator=( sal_uLong nWert ) return *this; } +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; + return *this; +} + +SwNodeIndex& SwNodeIndex::operator=( const SwNode& rNd ) +{ + if( &pNd->GetNodes() != &rNd.GetNodes() ) + { + DeRegisterIndex( pNd->GetNodes() ); + pNd = (SwNode*)&rNd; + RegisterIndex( pNd->GetNodes() ); + } + else + pNd = (SwNode*)&rNd; + return *this; +} + #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |