diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2017-02-27 22:24:50 +0100 |
---|---|---|
committer | Björn Michaelsen <bjoern.michaelsen@canonical.com> | 2017-02-28 08:57:16 +0000 |
commit | ae181f927dfc7d18562279a49813035931667463 (patch) | |
tree | 61c382f0fe4e02067318b37627caef2ccc37a0a0 /sw | |
parent | ad85c1236dddeea20069bcda8cab43f10e3cd026 (diff) |
remove const code duplication
Change-Id: If8330d3f1ce0c92122dcecfc22c32b005deffeb3
Reviewed-on: https://gerrit.libreoffice.org/34702
Reviewed-by: Björn Michaelsen <bjoern.michaelsen@canonical.com>
Tested-by: Björn Michaelsen <bjoern.michaelsen@canonical.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/dcontact.hxx | 6 | ||||
-rw-r--r-- | sw/source/core/draw/dcontact.cxx | 12 |
2 files changed, 4 insertions, 14 deletions
diff --git a/sw/inc/dcontact.hxx b/sw/inc/dcontact.hxx index 966ddc1c1a6b..91800c480a8a 100644 --- a/sw/inc/dcontact.hxx +++ b/sw/inc/dcontact.hxx @@ -202,7 +202,8 @@ public: virtual const SwAnchoredObject* GetAnchoredObj( const SdrObject* _pSdrObj ) const override; virtual SwAnchoredObject* GetAnchoredObj( SdrObject* _pSdrObj ) override; - virtual const SdrObject* GetMaster() const override; + virtual const SdrObject* GetMaster() const override + { return const_cast<SwFlyDrawContact*>(this)->GetMaster(); }; virtual SdrObject* GetMaster() override; /** override methods to control Writer fly frames, @@ -385,7 +386,8 @@ class SwDrawContact final : public SwContact virtual const SwAnchoredObject* GetAnchoredObj( const SdrObject* _pSdrObj ) const override; virtual SwAnchoredObject* GetAnchoredObj( SdrObject* _pSdrObj ) override; - virtual const SdrObject* GetMaster() const override; + virtual const SdrObject* GetMaster() const override + { return const_cast<SwDrawContact*>(this)->GetMaster(); }; virtual SdrObject* GetMaster() override; const SwFrame* GetAnchorFrame( const SdrObject* _pDrawObj = nullptr ) const; diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx index 713524ac1ebd..f8a5eb0179fc 100644 --- a/sw/source/core/draw/dcontact.cxx +++ b/sw/source/core/draw/dcontact.cxx @@ -481,11 +481,6 @@ SwAnchoredObject* SwFlyDrawContact::GetAnchoredObj(SdrObject *const pSdrObj) return const_cast<SwAnchoredObject *>(const_cast<SwFlyDrawContact const*>(this)->GetAnchoredObj(pSdrObj)); } -const SdrObject* SwFlyDrawContact::GetMaster() const -{ - return mpMasterObj.get(); -} - SdrObject* SwFlyDrawContact::GetMaster() { return mpMasterObj.get(); @@ -723,13 +718,6 @@ SwAnchoredObject* SwDrawContact::GetAnchoredObj(SdrObject *const pSdrObj) return const_cast<SwAnchoredObject*>(const_cast<SwDrawContact const*>(this)->GetAnchoredObj(pSdrObj)); } -const SdrObject* SwDrawContact::GetMaster() const -{ - return !mbMasterObjCleared - ? maAnchoredDrawObj.GetDrawObj() - : nullptr; -} - SdrObject* SwDrawContact::GetMaster() { return !mbMasterObjCleared |