summaryrefslogtreecommitdiff
path: root/sw/source/uibase/shells/drawsh.cxx
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2023-01-30 20:14:10 +0900
committerTomaž Vajngerl <quikee@gmail.com>2023-01-31 07:21:39 +0000
commit1e92059fe95cc1ba31aab4a66926d55bc00d0684 (patch)
treef6d6523928daff96ff0a2d15ab923c4777ab09e7 /sw/source/uibase/shells/drawsh.cxx
parentd9ebb2e76bf7ec068ebfceccf7f477471012d157 (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 'sw/source/uibase/shells/drawsh.cxx')
-rw-r--r--sw/source/uibase/shells/drawsh.cxx18
1 files changed, 9 insertions, 9 deletions
diff --git a/sw/source/uibase/shells/drawsh.cxx b/sw/source/uibase/shells/drawsh.cxx
index f539d5a2189e..5d1bca036087 100644
--- a/sw/source/uibase/shells/drawsh.cxx
+++ b/sw/source/uibase/shells/drawsh.cxx
@@ -152,7 +152,7 @@ void SwDrawShell::InsertPictureFromFile(SdrObject& rObject)
{
pSdrView->AddUndo(std::make_unique<SdrUndoAttrObj>(rObject));
- SfxItemSetFixed<XATTR_FILLSTYLE, XATTR_FILLBITMAP> aSet(pSdrView->GetModel()->GetItemPool());
+ SfxItemSetFixed<XATTR_FILLSTYLE, XATTR_FILLBITMAP> aSet(pSdrView->GetModel().GetItemPool());
aSet.Put(XFillStyleItem(drawing::FillStyle_BITMAP));
aSet.Put(XFillBitmapItem(OUString(), std::move(aGraphic)));
@@ -175,9 +175,9 @@ void SwDrawShell::Execute(SfxRequest &rReq)
const SfxItemSet *pArgs = rReq.GetArgs();
SfxBindings &rBnd = GetView().GetViewFrame()->GetBindings();
sal_uInt16 nSlotId = rReq.GetSlot();
- bool bChanged = pSdrView->GetModel()->IsChanged();
+ bool bChanged = pSdrView->GetModel().IsChanged();
- pSdrView->GetModel()->SetChanged(false);
+ pSdrView->GetModel().SetChanged(false);
const SfxPoolItem* pItem;
if(pArgs)
@@ -395,10 +395,10 @@ void SwDrawShell::Execute(SfxRequest &rReq)
OSL_ENSURE(false, "wrong dispatcher");
return;
}
- if (pSdrView->GetModel()->IsChanged())
+ if (pSdrView->GetModel().IsChanged())
rSh.SetModified();
else if (bChanged)
- pSdrView->GetModel()->SetChanged();
+ pSdrView->GetModel().SetChanged();
}
void SwDrawShell::GetState(SfxItemSet& rSet)
@@ -563,8 +563,8 @@ void SwDrawShell::ExecFormText(SfxRequest const & rReq)
{
SwWrtShell &rSh = GetShell();
SdrView* pDrView = rSh.GetDrawView();
- bool bChanged = pDrView->GetModel()->IsChanged();
- pDrView->GetModel()->SetChanged(false);
+ bool bChanged = pDrView->GetModel().IsChanged();
+ pDrView->GetModel().SetChanged(false);
const SdrMarkList& rMarkList = pDrView->GetMarkedObjectList();
@@ -580,11 +580,11 @@ void SwDrawShell::ExecFormText(SfxRequest const & rReq)
pDrView->SetAttributes(rSet);
}
- if (pDrView->GetModel()->IsChanged())
+ if (pDrView->GetModel().IsChanged())
rSh.SetModified();
else
if (bChanged)
- pDrView->GetModel()->SetChanged();
+ pDrView->GetModel().SetChanged();
}
//Return status values for FontWork