From 0a045a00e48978c72ba5053d8e663c193afdfc85 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Sun, 31 Dec 2017 18:05:29 +0200 Subject: improve const-correctness in ScCaptionPtr mostly to make my passstuffbyref loplugin happier Change-Id: I148b6b418100de860dfc49aaec6c544d0fe14c72 Reviewed-on: https://gerrit.libreoffice.org/47225 Tested-by: Jenkins Reviewed-by: Noel Grandin --- sc/inc/postit.hxx | 9 ++++++--- sc/source/core/data/postit.cxx | 4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-) (limited to 'sc') diff --git a/sc/inc/postit.hxx b/sc/inc/postit.hxx index c13169f1b960..345d1e03b22d 100644 --- a/sc/inc/postit.hxx +++ b/sc/inc/postit.hxx @@ -52,9 +52,12 @@ public: ScCaptionPtr& operator=( const ScCaptionPtr& r ); ScCaptionPtr& operator=( ScCaptionPtr&& r ); explicit operator bool() const { return mpCaption != nullptr; } - SdrCaptionObj* get() const { return mpCaption; } - SdrCaptionObj* operator->() const { return mpCaption; } - SdrCaptionObj& operator*() const { return *mpCaption; } + const SdrCaptionObj* get() const { return mpCaption; } + SdrCaptionObj* get() { return mpCaption; } + const SdrCaptionObj* operator->() const { return mpCaption; } + SdrCaptionObj* operator->() { return mpCaption; } + const SdrCaptionObj& operator*() const { return *mpCaption; } + SdrCaptionObj& operator*() { return *mpCaption; } // Does not default to nullptr to make it visually obvious where such is used. void reset( SdrCaptionObj* p ); diff --git a/sc/source/core/data/postit.cxx b/sc/source/core/data/postit.cxx index 879f74e03a47..e35c7708c71a 100644 --- a/sc/source/core/data/postit.cxx +++ b/sc/source/core/data/postit.cxx @@ -401,7 +401,7 @@ public: /** Create a new caption object and inserts it into the document. */ explicit ScNoteCaptionCreator( ScDocument& rDoc, const ScAddress& rPos, ScNoteData& rNoteData ); /** Manipulate an existing caption. */ - explicit ScNoteCaptionCreator( ScDocument& rDoc, const ScAddress& rPos, const ScCaptionPtr& xCaption, bool bShown ); + explicit ScNoteCaptionCreator( ScDocument& rDoc, const ScAddress& rPos, ScCaptionPtr& xCaption, bool bShown ); }; ScNoteCaptionCreator::ScNoteCaptionCreator( ScDocument& rDoc, const ScAddress& rPos, ScNoteData& rNoteData ) : @@ -425,7 +425,7 @@ ScNoteCaptionCreator::ScNoteCaptionCreator( ScDocument& rDoc, const ScAddress& r } } -ScNoteCaptionCreator::ScNoteCaptionCreator( ScDocument& rDoc, const ScAddress& rPos, const ScCaptionPtr& xCaption, bool bShown ) : +ScNoteCaptionCreator::ScNoteCaptionCreator( ScDocument& rDoc, const ScAddress& rPos, ScCaptionPtr& xCaption, bool bShown ) : ScCaptionCreator( rDoc, rPos, xCaption ) { SdrPage* pDrawPage = GetDrawPage(); -- cgit