diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2023-01-30 20:14:10 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2023-01-31 07:21:39 +0000 |
commit | 1e92059fe95cc1ba31aab4a66926d55bc00d0684 (patch) | |
tree | f6d6523928daff96ff0a2d15ab923c4777ab09e7 /svx/source/engine3d/view3d1.cxx | |
parent | d9ebb2e76bf7ec068ebfceccf7f477471012d157 (diff) |
svx: Refactor (sdr) views to access the SdrModel by reference
In SdrPaintView (and subclasses) the mpModel variable is always
the same as the input (reference) model, so there is no need for
that extra variable.
Change the strange and confusing var. name mrSdrModelFromSdrView
(the input reference to SdrModel) to just mrModel and use that in
GetModel(). Change the GetModel() to return a reference instead
of a pointer and reactor the code to accomodate the change.
This gets rid of many nullptr checks for the pointer that the
GetModel() returns and makes the code more simple is some cases.
Change-Id: I18351a417fd82f49262a83de036ec1420a65399c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146373
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'svx/source/engine3d/view3d1.cxx')
-rw-r--r-- | svx/source/engine3d/view3d1.cxx | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/svx/source/engine3d/view3d1.cxx b/svx/source/engine3d/view3d1.cxx index e647fe11625c..bc5cfbaf5116 100644 --- a/svx/source/engine3d/view3d1.cxx +++ b/svx/source/engine3d/view3d1.cxx @@ -91,10 +91,10 @@ static void Imp_E3dView_InorderRun3DObjects(const SdrObject* pObj, sal_uInt32& r SfxItemSet E3dView::Get3DAttributes() const { // Creating itemset with corresponding field + SfxItemPool& rPool = GetModel().GetItemPool(); SfxItemSet aSet( - mpModel->GetItemPool(), - svl::Items<SDRATTR_START, SDRATTR_END, - SID_ATTR_3D_INTERN, SID_ATTR_3D_INTERN>); + rPool, + svl::Items<SDRATTR_START, SDRATTR_END, SID_ATTR_3D_INTERN, SID_ATTR_3D_INTERN>); sal_uInt32 nSelectedItems(0); @@ -118,7 +118,7 @@ SfxItemSet E3dView::Get3DAttributes() const if(!nSelectedItems) { // Get defaults and apply - SfxItemSetFixed<SDRATTR_3D_FIRST, SDRATTR_3D_LAST> aDefaultSet(mpModel->GetItemPool()); + SfxItemSetFixed<SDRATTR_3D_FIRST, SDRATTR_3D_LAST> aDefaultSet(GetModel().GetItemPool()); GetAttributes(aDefaultSet); aSet.Put(aDefaultSet); @@ -158,7 +158,7 @@ void E3dView::Set3DAttributes( const SfxItemSet& rAttr) if(!nSelectedItems) { // Set defaults - SfxItemSetFixed<SDRATTR_3D_FIRST, SDRATTR_3D_LAST> aDefaultSet(mpModel->GetItemPool()); + SfxItemSetFixed<SDRATTR_3D_FIRST, SDRATTR_3D_LAST> aDefaultSet(GetModel().GetItemPool()); aDefaultSet.Put(rAttr); SetAttributes(aDefaultSet); } @@ -166,12 +166,12 @@ void E3dView::Set3DAttributes( const SfxItemSet& rAttr) double E3dView::GetDefaultCamPosZ() { - return static_cast<double>(mpModel->GetItemPool().GetDefaultItem(SDRATTR_3DSCENE_DISTANCE).GetValue()); + return static_cast<double>(GetModel().GetItemPool().GetDefaultItem(SDRATTR_3DSCENE_DISTANCE).GetValue()); } double E3dView::GetDefaultCamFocal() { - return static_cast<double>(mpModel->GetItemPool().GetDefaultItem(SDRATTR_3DSCENE_FOCAL_LENGTH).GetValue()); + return static_cast<double>(GetModel().GetItemPool().GetDefaultItem(SDRATTR_3DSCENE_FOCAL_LENGTH).GetValue()); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |