summaryrefslogtreecommitdiff
path: root/sw/inc/ndindex.hxx
diff options
context:
space:
mode:
authorBjoern Michaelsen <bjoern.michaelsen@canonical.com>2014-12-20 16:53:29 +0100
committerBjoern Michaelsen <bjoern.michaelsen@canonical.com>2014-12-23 04:02:13 +0100
commit96c7fff36eb2ed21bba604b3c0c376559e14539c (patch)
tree54b29d97962dfcc42b739917743fb092c9f4249b /sw/inc/ndindex.hxx
parenteaf3774752869e0322a340d5be4ab1b328f3632a (diff)
inline Assign
Change-Id: Ibeb8d7b8e83d432a502707f83a8fde7900596aec
Diffstat (limited to 'sw/inc/ndindex.hxx')
-rw-r--r--sw/inc/ndindex.hxx34
1 files changed, 32 insertions, 2 deletions
diff --git a/sw/inc/ndindex.hxx b/sw/inc/ndindex.hxx
index 51ae6827fb77..72f28de07124 100644
--- a/sw/inc/ndindex.hxx
+++ b/sw/inc/ndindex.hxx
@@ -114,8 +114,8 @@ public:
inline sal_uLong GetIndex() const;
// Enables assignments without creation of a temporary object.
- SwNodeIndex& Assign( SwNodes& rNds, sal_uLong );
- SwNodeIndex& Assign( const SwNode& rNd, long nOffset = 0 );
+ inline SwNodeIndex& Assign( SwNodes& rNds, sal_uLong );
+ inline SwNodeIndex& Assign( const SwNode& rNd, long nOffset = 0 );
// Gets pointer on NodesArray.
inline const SwNodes& GetNodes() const;
@@ -282,6 +282,36 @@ SwNodeIndex& SwNodeIndex::operator=( const SwNode& rNd )
return *this;
}
+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 ];
+ return *this;
+}
+
+SwNodeIndex& SwNodeIndex::Assign( const SwNode& rNd, long nOffset )
+{
+ if( &pNd->GetNodes() != &rNd.GetNodes() )
+ {
+ DeRegisterIndex( pNd->GetNodes() );
+ pNd = (SwNode*)&rNd;
+ RegisterIndex( pNd->GetNodes() );
+ }
+ else
+ pNd = (SwNode*)&rNd;
+
+ if( nOffset )
+ pNd = pNd->GetNodes()[ pNd->GetIndex() + nOffset ];
+
+ return *this;
+}
+
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */