diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-07-02 15:20:42 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-07-03 08:17:26 +0200 |
commit | 09d9419bf2072fdab2d7c1d1c6a8dee70b9f0f8a (patch) | |
tree | 605387a086777705ffa8f573b3507c2e732d080b /sw/source/core/inc/wrong.hxx | |
parent | 1c588317c6e55ede11c577ea16e1af85eee4810a (diff) |
loplugin:useuniqueptr in SwWrongList
and simplify, just use copy constructors and operator=, instead of
special-case CopyFrom methods
Change-Id: I3e14fa08e820cf7ae2c5424ae22ae95516933773
Reviewed-on: https://gerrit.libreoffice.org/56831
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw/source/core/inc/wrong.hxx')
-rw-r--r-- | sw/source/core/inc/wrong.hxx | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/sw/source/core/inc/wrong.hxx b/sw/source/core/inc/wrong.hxx index 0003d54266ba..695a33b6219d 100644 --- a/sw/source/core/inc/wrong.hxx +++ b/sw/source/core/inc/wrong.hxx @@ -59,7 +59,7 @@ public: css::uno::Reference< css::container::XStringKeyMap > mxPropertyBag; sal_Int32 mnPos; sal_Int32 mnLen; - SwWrongList* mpSubList; + std::unique_ptr<SwWrongList> mpSubList; Color mColor; WrongAreaLineType mLineType; @@ -75,6 +75,10 @@ public: sal_Int32 nPos, sal_Int32 nLen, SwWrongList* pSubList); + + SwWrongArea( const SwWrongArea& ); + SwWrongArea& operator=( const SwWrongArea& ); + private: static Color getGrammarColor ( css::uno::Reference< css::container::XStringKeyMap > const & xPropertyBag) @@ -253,14 +257,13 @@ class SwWrongList void Remove( sal_uInt16 nIdx, sal_uInt16 nLen ); SwWrongList& operator= (const SwWrongList &) = delete; - SwWrongList( const SwWrongList& rCpy ) = delete; public: SwWrongList( WrongListType eType ); + SwWrongList( SwWrongList const & ); virtual ~SwWrongList(); - virtual SwWrongList* Clone(); - virtual void CopyFrom( const SwWrongList& rCopy ); + virtual std::unique_ptr<SwWrongList> Clone(); WrongListType GetWrongListType() const { return meType; } sal_Int32 GetBeginInv() const { return mnBeginInvalid; } @@ -319,14 +322,14 @@ public: SwWrongList* SubList( sal_uInt16 nIdx ) const { - return nIdx < maList.size() ? maList[nIdx].mpSubList : nullptr; + return maList[nIdx].mpSubList.get(); } void InsertSubList( sal_Int32 nNewPos, sal_Int32 nNewLen, sal_uInt16 nWhere, SwWrongList* pSubList ); const SwWrongArea* GetElement( sal_uInt16 nIdx ) const { - return nIdx < maList.size() ? &maList[nIdx] : nullptr; + return &maList[nIdx]; } void RemoveEntry( sal_Int32 nBegin, sal_Int32 nEnd ); bool LookForEntry( sal_Int32 nBegin, sal_Int32 nEnd ); |