diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-03-22 15:21:14 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2018-03-23 11:34:50 +0100 |
commit | b1119ed70bae01a862067c43722c55e7c39667f6 (patch) | |
tree | c866ef1e799dd57460679ecc9a0c44b7e0b3c4dd /sw/inc/swcrsr.hxx | |
parent | 400a70303aae6e98d2d5b1d1eb484149a70f9121 (diff) |
loplugin:useuniqueptr in SwCursor
storing a struct with two integer values in it, in a linked list, just
seems inefficient
Change-Id: I2913aa867cc978271d7778f06546d47fa6c57973
Reviewed-on: https://gerrit.libreoffice.org/51761
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'sw/inc/swcrsr.hxx')
-rw-r--r-- | sw/inc/swcrsr.hxx | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/sw/inc/swcrsr.hxx b/sw/inc/swcrsr.hxx index 1723f5e1bb0b..bebc7023f169 100644 --- a/sw/inc/swcrsr.hxx +++ b/sw/inc/swcrsr.hxx @@ -68,7 +68,7 @@ class SW_DLLPUBLIC SwCursor : public SwPaM { friend class SwCursorSaveState; - SwCursor_SavePos* m_pSavePos; + std::vector<SwCursor_SavePos> m_vSavePos; // the current entry is the last element long m_nRowSpanOffset; // required for travelling in tabs with rowspans sal_uInt8 m_nCursorBidiLevel; // bidi level of the cursor bool m_bColumnSelection; // true: cursor is aprt of a column selection @@ -83,7 +83,7 @@ protected: void SaveState(); void RestoreState(); - const SwCursor_SavePos* GetSavePos() const { return m_pSavePos; } + const SwCursor_SavePos* GetSavePos() const { return m_vSavePos.empty() ? nullptr : &m_vSavePos.back(); } virtual const SwContentFrame* DoSetBidiLevelLeftRight( bool & io_rbLeft, bool bVisualAllowed, bool bInsertCursor); @@ -242,15 +242,11 @@ struct SwCursor_SavePos final { sal_uLong nNode; sal_Int32 nContent; - SwCursor_SavePos* pNext; SwCursor_SavePos( const SwCursor& rCursor ) : nNode( rCursor.GetPoint()->nNode.GetIndex() ), - nContent( rCursor.GetPoint()->nContent.GetIndex() ), - pNext( nullptr ) + nContent( rCursor.GetPoint()->nContent.GetIndex() ) {} - - DECL_FIXEDMEMPOOL_NEWDEL( SwCursor_SavePos ) }; class SwTableCursor : public virtual SwCursor |