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 | |
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')
27 files changed, 230 insertions, 242 deletions
diff --git a/svx/source/dialog/graphctl.cxx b/svx/source/dialog/graphctl.cxx index 12416b6beaa6..56c1509fa776 100644 --- a/svx/source/dialog/graphctl.cxx +++ b/svx/source/dialog/graphctl.cxx @@ -136,7 +136,7 @@ void GraphCtrl::InitSdrModel() pView.reset(new GraphCtrlView(*pModel, this)); pView->SetWorkArea( tools::Rectangle( Point(), aGraphSize ) ); pView->EnableExtendedMouseEventDispatcher( true ); - pView->ShowSdrPage(pView->GetModel()->GetPage(0)); + pView->ShowSdrPage(pView->GetModel().GetPage(0)); pView->SetFrameDragSingles(); pView->SetMarkedPointsSmooth( SdrPathSmoothKind::Symmetric ); pView->SetEditMode(); diff --git a/svx/source/engine3d/view3d.cxx b/svx/source/engine3d/view3d.cxx index ece5281baf63..29a048e3f055 100644 --- a/svx/source/engine3d/view3d.cxx +++ b/svx/source/engine3d/view3d.cxx @@ -572,8 +572,8 @@ bool E3dView::ImpCloneAll3DObjectsToDestScene(E3dScene const * pSrcScene, E3dSce bRetval = true; // Create undo - if( GetModel()->IsUndoEnabled() ) - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoNewObject(*pNewCompoundObj)); + if( GetModel().IsUndoEnabled() ) + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoNewObject(*pNewCompoundObj)); } } } @@ -648,8 +648,8 @@ void E3dView::ImpChangeSomeAttributesFor3DConversion(SdrObject* pObj) pObj->SetMergedItem(SvxColorItem(COL_BLACK, EE_CHAR_COLOR)); // add undo now - if( GetModel()->IsUndoEnabled() ) - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoAttrObject(*pObj)); + if (GetModel().IsUndoEnabled()) + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoAttrObject(*pObj)); } pObj->SetMergedItem(SvxColorItem(COL_GRAY, EE_CHAR_COLOR)); @@ -671,9 +671,9 @@ void E3dView::ImpChangeSomeAttributesFor3DConversion2(SdrObject* pObj) && !nLineWidth && eFillStyle != drawing::FillStyle_NONE) { - if(pObj->getSdrPageFromSdrObject() && GetModel()->IsUndoEnabled() ) + if (pObj->getSdrPageFromSdrObject() && GetModel().IsUndoEnabled()) { - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoAttrObject(*pObj)); + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoAttrObject(*pObj)); } pObj->SetMergedItem(XLineStyleItem(drawing::LineStyle_NONE)); 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: */ diff --git a/svx/source/form/fmshell.cxx b/svx/source/form/fmshell.cxx index a115b1c896a0..fa485e478c72 100644 --- a/svx/source/form/fmshell.cxx +++ b/svx/source/form/fmshell.cxx @@ -1155,7 +1155,7 @@ void FmFormShell::SetView( FmFormView* _pView ) m_pFormView = _pView; m_pFormView->SetFormShell( this, FmFormView::FormShellAccess() ); - m_pFormModel = static_cast<FmFormModel*>(m_pFormView->GetModel()); + m_pFormModel = static_cast<FmFormModel*>(&m_pFormView->GetModel()); impl_setDesignMode( m_pFormView->IsDesignMode() ); diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx index 04390bde7063..ee604b6277f2 100644 --- a/svx/source/form/fmshimp.cxx +++ b/svx/source/form/fmshimp.cxx @@ -3600,8 +3600,9 @@ void FmXFormShell::viewActivated_Lock(FmFormView& _rCurrentView, bool _bSyncActi // first-time initializations for the views if ( !_rCurrentView.GetImpl()->hasEverBeenActivated( ) ) { - _rCurrentView.GetImpl()->onFirstViewActivation( dynamic_cast<FmFormModel*>( _rCurrentView.GetModel() ) ); - _rCurrentView.GetImpl()->setHasBeenActivated( ); + auto* pFormModel = dynamic_cast<FmFormModel*>(&_rCurrentView.GetModel()); + _rCurrentView.GetImpl()->onFirstViewActivation(pFormModel); + _rCurrentView.GetImpl()->setHasBeenActivated(); } // activate the current view diff --git a/svx/source/form/fmview.cxx b/svx/source/form/fmview.cxx index d656464f1698..64af0e9aa0fb 100644 --- a/svx/source/form/fmview.cxx +++ b/svx/source/form/fmview.cxx @@ -79,7 +79,7 @@ void FmFormView::Init() pImpl = new FmXFormView(this); // set model - SdrModel* pModel = GetModel(); + SdrModel* pModel = &GetModel(); DBG_ASSERT( dynamic_cast<const FmFormModel*>( pModel) != nullptr, "Wrong model" ); FmFormModel* pFormModel = dynamic_cast<FmFormModel*>(pModel); @@ -201,7 +201,7 @@ void FmFormView::ChangeDesignMode(bool bDesign) if (bDesign == IsDesignMode()) return; - FmFormModel* pModel = dynamic_cast<FmFormModel*>( GetModel() ); + FmFormModel* pModel = dynamic_cast<FmFormModel*>(&GetModel()); if (pModel) { // For the duration of the transition the Undo-Environment is disabled. This ensures that non-transient Properties can // also be changed (this should be done with care and also reversed before switching the mode back. An example is the diff --git a/svx/source/gallery2/galtheme.cxx b/svx/source/gallery2/galtheme.cxx index 94940f355a42..25c072ee65a8 100644 --- a/svx/source/gallery2/galtheme.cxx +++ b/svx/source/gallery2/galtheme.cxx @@ -347,7 +347,7 @@ bool GalleryTheme::GetGraphic(sal_uInt32 nPos, Graphic& rGraphic) FmFormView aView(*aModel.GetModel(), pVDev); aView.hideMarkHandles(); - aView.ShowSdrPage(aView.GetModel()->GetPage(0)); + aView.ShowSdrPage(aView.GetModel().GetPage(0)); aView.MarkAll(); rGraphic = aView.GetAllMarkedGraphic(); bRet = true; diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx index 7d829d324aab..6721b11ba0a9 100644 --- a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx +++ b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx @@ -237,7 +237,7 @@ void PosSizePropertyPanel::Initialize() if ( mpView != nullptr ) { - maUIScale = mpView->GetModel()->GetUIScale(); + maUIScale = mpView->GetModel().GetUIScale(); mbAdjustEnabled = hasText(*mpView); } @@ -400,7 +400,7 @@ IMPL_LINK_NOARG( PosSizePropertyPanel, ChangePosXHdl, weld::MetricSpinButton&, v { tools::Long lX = GetCoreValue( *mxMtrPosX, mePoolUnit ); - Fraction aUIScale = mpView->GetModel()->GetUIScale(); + Fraction aUIScale = mpView->GetModel().GetUIScale(); lX = tools::Long( lX * aUIScale ); SfxInt32Item aPosXItem( SID_ATTR_TRANSFORM_POS_X,static_cast<sal_uInt32>(lX)); @@ -416,7 +416,7 @@ IMPL_LINK_NOARG( PosSizePropertyPanel, ChangePosYHdl, weld::MetricSpinButton&, v { tools::Long lY = GetCoreValue( *mxMtrPosY, mePoolUnit ); - Fraction aUIScale = mpView->GetModel()->GetUIScale(); + Fraction aUIScale = mpView->GetModel().GetUIScale(); lY = tools::Long( lY * aUIScale ); SfxInt32Item aPosYItem( SID_ATTR_TRANSFORM_POS_Y,static_cast<sal_uInt32>(lY)); @@ -444,7 +444,7 @@ IMPL_LINK_NOARG( PosSizePropertyPanel, RotationHdl, DialControl&, void ) Degree100 nTmp = mxCtrlDial->GetRotation(); // #i123993# Need to take UIScale into account when executing rotations - const double fUIScale(mpView && mpView->GetModel() ? double(mpView->GetModel()->GetUIScale()) : 1.0); + const double fUIScale(mpView ? double(mpView->GetModel().GetUIScale()) : 1.0); SdrAngleItem aAngleItem( SID_ATTR_TRANSFORM_ANGLE, nTmp); SfxInt32Item aRotXItem( SID_ATTR_TRANSFORM_ROT_X, basegfx::fround(mlRotX * fUIScale)); SfxInt32Item aRotYItem( SID_ATTR_TRANSFORM_ROT_Y, basegfx::fround(mlRotY * fUIScale)); @@ -804,7 +804,7 @@ void PosSizePropertyPanel::executeSize() if ( !mxMtrWidth->get_value_changed_from_saved() && !mxMtrHeight->get_value_changed_from_saved()) return; - Fraction aUIScale = mpView->GetModel()->GetUIScale(); + Fraction aUIScale = mpView->GetModel().GetUIScale(); // get Width double nWidth = static_cast<double>(mxMtrWidth->get_value(FieldUnit::MM_100TH)); @@ -1021,7 +1021,7 @@ void PosSizePropertyPanel::SetPosSizeMinMax() pPV->LogicToPagePos(aTmpRect2); maWorkArea = vcl::unotools::b2DRectangleFromRectangle(aTmpRect2); - const Fraction aUIScale(mpView->GetModel()->GetUIScale()); + const Fraction aUIScale(mpView->GetModel().GetUIScale()); TransfrmHelper::ScaleRect( maWorkArea, aUIScale ); TransfrmHelper::ScaleRect( maRect, aUIScale ); @@ -1060,7 +1060,7 @@ void PosSizePropertyPanel::SetPosSizeMinMax() void PosSizePropertyPanel::UpdateUIScale() { - const Fraction aUIScale (mpView->GetModel()->GetUIScale()); + const Fraction aUIScale (mpView->GetModel().GetUIScale()); if (maUIScale == aUIScale) return; diff --git a/svx/source/svdraw/sdrpagewindow.cxx b/svx/source/svdraw/sdrpagewindow.cxx index 01be77135674..123d1d2d03a6 100644 --- a/svx/source/svdraw/sdrpagewindow.cxx +++ b/svx/source/svdraw/sdrpagewindow.cxx @@ -324,7 +324,7 @@ void SdrPageWindow::RedrawAll( sdr::contact::ViewObjectContactRedirector* pRedir // set PaintingPageView const SdrView& rView = mpImpl->mrPageView.GetView(); - SdrModel& rModel = *(rView.GetModel()); + SdrModel& rModel = rView.GetModel(); // get to be processed layers const bool bPrinter(GetPaintWindow().OutputToPrinter()); @@ -378,7 +378,7 @@ void SdrPageWindow::RedrawLayer(const SdrLayerID* pId, // set PaintingPageView const SdrView& rView = mpImpl->mrPageView.GetView(); - SdrModel& rModel = *(rView.GetModel()); + SdrModel& rModel = rView.GetModel(); // get the layers to process const bool bPrinter(GetPaintWindow().OutputToPrinter()); diff --git a/svx/source/svdraw/svdcrtv.cxx b/svx/source/svdraw/svdcrtv.cxx index 7e025cf044e1..8c3c0750377f 100644 --- a/svx/source/svdraw/svdcrtv.cxx +++ b/svx/source/svdraw/svdcrtv.cxx @@ -339,7 +339,7 @@ void SdrCreateView::SetCurrentObj(SdrObjKind nIdent, SdrInventor nInvent) mnCurrentIdent=nIdent; rtl::Reference<SdrObject> pObj = (nIdent == SdrObjKind::NONE) ? nullptr : SdrObjFactory::MakeNewObject( - *GetModel(), + GetModel(), nInvent, nIdent); @@ -397,9 +397,7 @@ bool SdrCreateView::ImpBegCreateObj(SdrInventor nInvent, SdrObjKind nIdent, cons else { mpCurrentCreate = SdrObjFactory::MakeNewObject( - *mpModel, - nInvent, - nIdent); + GetModel(), nInvent, nIdent); } Point aPnt(rPnt); @@ -421,19 +419,18 @@ bool SdrCreateView::ImpBegCreateObj(SdrInventor nInvent, SdrObjKind nIdent, cons mpCurrentCreate->SetMergedItemSet(maDefaultAttr); } - if (mpModel && dynamic_cast<const SdrCaptionObj *>(mpCurrentCreate.get()) != nullptr) + if (dynamic_cast<const SdrCaptionObj *>(mpCurrentCreate.get()) != nullptr) { - SfxItemSet aSet(mpModel->GetItemPool()); + SfxItemSet aSet(GetModel().GetItemPool()); aSet.Put(XFillColorItem(OUString(),COL_WHITE)); // in case someone turns on Solid aSet.Put(XFillStyleItem(drawing::FillStyle_NONE)); mpCurrentCreate->SetMergedItemSet(aSet); } - if (mpModel && nInvent==SdrInventor::Default && (nIdent==SdrObjKind::Text || - nIdent==SdrObjKind::TitleText || nIdent==SdrObjKind::OutlineText)) + if (nInvent == SdrInventor::Default && (nIdent==SdrObjKind::Text || nIdent==SdrObjKind::TitleText || nIdent==SdrObjKind::OutlineText)) { // default for all text frames: no background, no border - SfxItemSet aSet(mpModel->GetItemPool()); + SfxItemSet aSet(GetModel().GetItemPool()); aSet.Put(XFillColorItem(OUString(),COL_WHITE)); // in case someone turns on Solid aSet.Put(XFillStyleItem(drawing::FillStyle_NONE)); aSet.Put(XLineColorItem(OUString(),COL_BLACK)); // in case someone turns on Solid diff --git a/svx/source/svdraw/svddrgmt.cxx b/svx/source/svdraw/svddrgmt.cxx index 37531632c5b4..166b174c89be 100644 --- a/svx/source/svdraw/svddrgmt.cxx +++ b/svx/source/svdraw/svddrgmt.cxx @@ -1354,18 +1354,18 @@ bool SdrDragObjOwn::EndSdrDrag(bool /*bCopy*/) { if (DragStat().IsEndDragChangesAttributes()) { - pUndo=getSdrDragView().GetModel()->GetSdrUndoFactory().CreateUndoAttrObject(*pObj); + pUndo=getSdrDragView().GetModel().GetSdrUndoFactory().CreateUndoAttrObject(*pObj); if (DragStat().IsEndDragChangesGeoAndAttributes()) { vConnectorUndoActions = getSdrDragView().CreateConnectorUndo( *pObj ); - pUndo2 = getSdrDragView().GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj); + pUndo2 = getSdrDragView().GetModel().GetSdrUndoFactory().CreateUndoGeoObject(*pObj); } } else { vConnectorUndoActions = getSdrDragView().CreateConnectorUndo( *pObj ); - pUndo= getSdrDragView().GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj); + pUndo= getSdrDragView().GetModel().GetSdrUndoFactory().CreateUndoGeoObject(*pObj); } } @@ -1474,9 +1474,9 @@ OUString SdrDragMove::GetSdrDragComment() const { OUString aStr = ImpGetDescriptionStr(STR_DragMethMove) + " (x=" - + getSdrDragView().GetModel()->GetMetricString(DragStat().GetDX()) + + getSdrDragView().GetModel().GetMetricString(DragStat().GetDX()) + " y=" - + getSdrDragView().GetModel()->GetMetricString(DragStat().GetDY()) + + getSdrDragView().GetModel().GetMetricString(DragStat().GetDY()) + ")"; if(getSdrDragView().IsDragWithCopy()) @@ -3352,7 +3352,7 @@ bool SdrDragCrook::EndSdrDrag(bool bCopy) Size aSiz(aCtr1.X()-aCtr0.X(),aCtr1.Y()-aCtr0.Y()); if( bUndo ) - AddUndo(getSdrDragView().GetModel()->GetSdrUndoFactory().CreateUndoMoveObject(*pO,aSiz)); + AddUndo(getSdrDragView().GetModel().GetSdrUndoFactory().CreateUndoMoveObject(*pO,aSiz)); pO->Move(aSiz); } } @@ -3393,9 +3393,9 @@ OUString SdrDragDistort::GetSdrDragComment() const { OUString aStr = ImpGetDescriptionStr(STR_DragMethDistort) + " (x=" - + getSdrDragView().GetModel()->GetMetricString(DragStat().GetDX()) + + getSdrDragView().GetModel().GetMetricString(DragStat().GetDX()) + " y=" - + getSdrDragView().GetModel()->GetMetricString(DragStat().GetDY()) + + getSdrDragView().GetModel().GetMetricString(DragStat().GetDY()) + ")"; if(getSdrDragView().IsDragWithCopy()) @@ -3538,9 +3538,9 @@ OUString SdrDragCrop::GetSdrDragComment() const { OUString aStr = ImpGetDescriptionStr(STR_DragMethCrop) + " (x=" - + getSdrDragView().GetModel()->GetMetricString(DragStat().GetDX()) + + getSdrDragView().GetModel().GetMetricString(DragStat().GetDX()) + " y=" - + getSdrDragView().GetModel()->GetMetricString(DragStat().GetDY()) + + getSdrDragView().GetModel().GetMetricString(DragStat().GetDY()) + ")"; if(getSdrDragView().IsDragWithCopy()) @@ -3625,9 +3625,9 @@ bool SdrDragCrop::EndSdrDrag(bool /*bCopy*/) OUString aUndoStr = ImpGetDescriptionStr(STR_DragMethCrop); getSdrDragView().BegUndo( aUndoStr ); - getSdrDragView().AddUndo( getSdrDragView().GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj)); + getSdrDragView().AddUndo(getSdrDragView().GetModel().GetSdrUndoFactory().CreateUndoGeoObject(*pObj)); // also need attr undo, the SdrGrafCropItem will be changed - getSdrDragView().AddUndo( getSdrDragView().GetModel()->GetSdrUndoFactory().CreateUndoAttrObject(*pObj)); + getSdrDragView().AddUndo(getSdrDragView().GetModel().GetSdrUndoFactory().CreateUndoAttrObject(*pObj)); } // get the original objects transformation @@ -3839,7 +3839,7 @@ bool SdrDragCrop::EndSdrDrag(bool /*bCopy*/) sal_Int32 nRightCrop = static_cast<sal_Int32>( rOldCrop.GetRight() - nDiffRight * fScaleX ); sal_Int32 nBottomCrop = static_cast<sal_Int32>( rOldCrop.GetBottom() - nDiffBottom * fScaleY ); - SfxItemPool& rPool = getSdrDragView().GetModel()->GetItemPool(); + SfxItemPool& rPool = getSdrDragView().GetModel().GetItemPool(); SfxItemSetFixed<SDRATTR_GRAFCROP, SDRATTR_GRAFCROP> aSet( rPool ); aSet.Put( SdrGrafCropItem( nLeftCrop, nTopCrop, nRightCrop, nBottomCrop ) ); getSdrDragView().SetAttributes( aSet, false ); diff --git a/svx/source/svdraw/svddrgv.cxx b/svx/source/svdraw/svddrgv.cxx index 27b62dd17946..9616b85bcb4c 100644 --- a/svx/source/svdraw/svddrgv.cxx +++ b/svx/source/svdraw/svddrgv.cxx @@ -641,7 +641,7 @@ bool SdrDragView::ImpBegInsObjPoint(bool bIdxZwang, const Point& rPnt, bool bNew if(auto pMarkedPath = dynamic_cast<SdrPathObj*>( mpMarkedObj)) { BrkAction(); - mpInsPointUndo = dynamic_cast< SdrUndoGeoObj* >( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*mpMarkedObj).release() ); + mpInsPointUndo = dynamic_cast<SdrUndoGeoObj*>(GetModel().GetSdrUndoFactory().CreateUndoGeoObject(*mpMarkedObj).release()); DBG_ASSERT( mpInsPointUndo, "svx::SdrDragView::BegInsObjPoint(), could not create correct undo object!" ); OUString aStr(SvxResId(STR_DragInsertPoint)); @@ -739,7 +739,7 @@ bool SdrDragView::BegInsGluePoint(const Point& rPnt) { BrkAction(); UnmarkAllGluePoints(); - mpInsPointUndo= dynamic_cast< SdrUndoGeoObj* >( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj).release() ); + mpInsPointUndo = dynamic_cast<SdrUndoGeoObj*>(GetModel().GetSdrUndoFactory().CreateUndoGeoObject(*pObj).release()); DBG_ASSERT( mpInsPointUndo, "svx::SdrDragView::BegInsObjPoint(), could not create correct undo object!" ); OUString aStr(SvxResId(STR_DragInsertGluePoint)); diff --git a/svx/source/svdraw/svdedtv.cxx b/svx/source/svdraw/svdedtv.cxx index 58812d849403..66ab88e786f7 100644 --- a/svx/source/svdraw/svdedtv.cxx +++ b/svx/source/svdraw/svdedtv.cxx @@ -128,15 +128,15 @@ SdrEditView::~SdrEditView() void SdrEditView::InsertNewLayer(const OUString& rName, sal_uInt16 nPos) { - SdrLayerAdmin& rLA=mpModel->GetLayerAdmin(); + SdrLayerAdmin& rLA = GetModel().GetLayerAdmin(); sal_uInt16 nMax=rLA.GetLayerCount(); if (nPos>nMax) nPos=nMax; rLA.NewLayer(rName,nPos); - if( GetModel()->IsUndoEnabled() ) - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoNewLayer(nPos,rLA,*mpModel)); + if( GetModel().IsUndoEnabled() ) + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoNewLayer(nPos,rLA, GetModel())); - mpModel->SetChanged(); + GetModel().SetChanged(); } bool SdrEditView::ImpDelLayerCheck(SdrObjList const * pOL, SdrLayerID nDelID) const @@ -175,7 +175,7 @@ void SdrEditView::ImpDelLayerDelObjs(SdrObjList* pOL, SdrLayerID nDelID) // make sure OrdNums are correct pOL->GetObj(0)->GetOrdNum(); - const bool bUndo = GetModel()->IsUndoEnabled(); + const bool bUndo = GetModel().IsUndoEnabled(); for(size_t nObjNum = nObjCount; nObjNum > 0;) { @@ -190,7 +190,7 @@ void SdrEditView::ImpDelLayerDelObjs(SdrObjList* pOL, SdrLayerID nDelID) if(ImpDelLayerCheck(pSubOL, nDelID)) { if( bUndo ) - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoDeleteObject(*pObj, true)); + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoDeleteObject(*pObj, true)); pOL->RemoveObject(nObjNum); } else @@ -203,7 +203,7 @@ void SdrEditView::ImpDelLayerDelObjs(SdrObjList* pOL, SdrLayerID nDelID) if(pObj->GetLayer() == nDelID) { if( bUndo ) - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoDeleteObject(*pObj, true)); + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoDeleteObject(*pObj, true)); pOL->RemoveObject(nObjNum); } } @@ -212,7 +212,7 @@ void SdrEditView::ImpDelLayerDelObjs(SdrObjList* pOL, SdrLayerID nDelID) void SdrEditView::DeleteLayer(const OUString& rName) { - SdrLayerAdmin& rLA = mpModel->GetLayerAdmin(); + SdrLayerAdmin& rLA = GetModel().GetLayerAdmin(); SdrLayer* pLayer = rLA.GetLayer(rName); if(!pLayer) @@ -230,12 +230,12 @@ void SdrEditView::DeleteLayer(const OUString& rName) for(sal_uInt16 nPageKind(0); nPageKind < 2; nPageKind++) { // MasterPages and DrawPages - sal_uInt16 nPgCount(bMaPg ? mpModel->GetMasterPageCount() : mpModel->GetPageCount()); + sal_uInt16 nPgCount(bMaPg ? GetModel().GetMasterPageCount() : GetModel().GetPageCount()); for(sal_uInt16 nPgNum(0); nPgNum < nPgCount; nPgNum++) { // over all pages - SdrPage* pPage = bMaPg ? mpModel->GetMasterPage(nPgNum) : mpModel->GetPage(nPgNum); + SdrPage* pPage = bMaPg ? GetModel().GetMasterPage(nPgNum) : GetModel().GetPage(nPgNum); const size_t nObjCount(pPage->GetObjCount()); // make sure OrdNums are correct @@ -254,7 +254,7 @@ void SdrEditView::DeleteLayer(const OUString& rName) if(ImpDelLayerCheck(pSubOL, nDelID)) { if( bUndo ) - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoDeleteObject(*pObj, true)); + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoDeleteObject(*pObj, true)); pPage->RemoveObject(nObjNum); } else @@ -267,7 +267,7 @@ void SdrEditView::DeleteLayer(const OUString& rName) if(pObj->GetLayer() == nDelID) { if( bUndo ) - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoDeleteObject(*pObj, true)); + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoDeleteObject(*pObj, true)); pPage->RemoveObject(nObjNum); } } @@ -278,7 +278,7 @@ void SdrEditView::DeleteLayer(const OUString& rName) if( bUndo ) { - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoDeleteLayer(nLayerNum, rLA, *mpModel)); + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoDeleteLayer(nLayerNum, rLA, GetModel())); // coverity[leaked_storage] - ownership transferred to UndoDeleteLayer rLA.RemoveLayer(nLayerNum).release(); EndUndo(); @@ -288,7 +288,7 @@ void SdrEditView::DeleteLayer(const OUString& rName) rLA.RemoveLayer(nLayerNum); } - mpModel->SetChanged(); + GetModel().SetChanged(); } @@ -297,7 +297,7 @@ void SdrEditView::EndUndo() // #i13033# // Comparison changed to 1L since EndUndo() is called later now // and EndUndo WILL change count to count-1 - if(1 == mpModel->GetUndoBracketLevel()) + if(1 == GetModel().GetUndoBracketLevel()) { ImpBroadcastEdgesOfMarkedNodes(); } @@ -305,7 +305,7 @@ void SdrEditView::EndUndo() // #i13033# // moved to bottom to still have access to UNDOs inside of // ImpBroadcastEdgesOfMarkedNodes() - mpModel->EndUndo(); + GetModel().EndUndo(); } void SdrEditView::ImpBroadcastEdgesOfMarkedNodes() @@ -333,7 +333,7 @@ void SdrEditView::ImpBroadcastEdgesOfMarkedNodes() if (iterPos == rAllMarkedObjects.end()) { if( IsUndoEnabled() ) - AddUndo( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pEdge)); + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoGeoObject(*pEdge)); pEdge->DisconnectFromNode(false); } } @@ -345,7 +345,7 @@ void SdrEditView::ImpBroadcastEdgesOfMarkedNodes() if (iterPos == rAllMarkedObjects.end()) { if( IsUndoEnabled() ) - AddUndo( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pEdge)); + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoGeoObject(*pEdge)); pEdge->DisconnectFromNode(true); } } @@ -739,7 +739,7 @@ std::vector<SdrObject*> SdrEditView::DeleteMarkedList(SdrMarkList const& rMark) // extra undo actions for changed connector which now may hold its laid out path (SJ) AddUndoActions(CreateConnectorUndo( *pObj )); - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoDeleteObject(*pObj)); + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoDeleteObject(*pObj)); } } @@ -935,7 +935,7 @@ void SdrEditView::CopyMarkedObj() pM->GetPageView()->GetObjList()->InsertObjectThenMakeNameUnique(pO.get(), aNameSet); if( bUndo ) - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoCopyObject(*pO)); + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoCopyObject(*pO)); SdrMark aME(*pM); aME.SetMarkedSdrObj(pO.get()); @@ -999,18 +999,18 @@ bool SdrEditView::InsertObjectAtView(SdrObject* pObj, SdrPageView& rPV, SdrInser { bool bDontDeleteReally = true; EndTextEditCurrentView(bDontDeleteReally); - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoNewObject(*pObj)); + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoNewObject(*pObj)); } - css::uno::Reference<lang::XServiceInfo> xServices(GetModel()->getUnoModel(), + css::uno::Reference<lang::XServiceInfo> xServices(GetModel().getUnoModel(), css::uno::UNO_QUERY); if (xServices.is() && (xServices->supportsService("com.sun.star.sheet.SpreadsheetDocument") || xServices->supportsService("com.sun.star.text.TextDocument"))) { const bool bUndo(IsUndoEnabled()); - GetModel()->EnableUndo(false); + GetModel().EnableUndo(false); pObj->MakeNameUnique(); - GetModel()->EnableUndo(bUndo); + GetModel().EnableUndo(bUndo); } if (!(nOptions & SdrInsertFlags::DONTMARK)) { @@ -1045,7 +1045,7 @@ void SdrEditView::ReplaceObjectAtView(SdrObject* pOldObj, SdrPageView& rPV, SdrO SdrObjList* pOL=pOldObj->getParentSdrObjListFromSdrObject(); const bool bUndo = IsUndoEnabled(); if( bUndo ) - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoReplaceObject(*pOldObj,*pNewObj)); + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoReplaceObject(*pOldObj,*pNewObj)); if( IsObjMarked( pOldObj ) ) MarkObj( pOldObj, &rPV, true /*unmark!*/ ); @@ -1058,15 +1058,15 @@ void SdrEditView::ReplaceObjectAtView(SdrObject* pOldObj, SdrPageView& rPV, SdrO bool SdrEditView::IsUndoEnabled() const { - return mpModel->IsUndoEnabled(); + return GetModel().IsUndoEnabled(); } void SdrEditView::EndTextEditAllViews() const { - size_t nViews = mpModel->GetListenerCount(); + size_t nViews = GetModel().GetListenerCount(); for (size_t nView = 0; nView < nViews; ++nView) { - SdrObjEditView* pView = dynamic_cast<SdrObjEditView*>(mpModel->GetListener(nView)); + SdrObjEditView* pView = dynamic_cast<SdrObjEditView*>(GetModel().GetListener(nView)); if (!pView) continue; diff --git a/svx/source/svdraw/svdedtv1.cxx b/svx/source/svdraw/svdedtv1.cxx index 2e4d218a3aee..1b6d3078da9f 100644 --- a/svx/source/svdraw/svdedtv1.cxx +++ b/svx/source/svdraw/svdedtv1.cxx @@ -103,8 +103,8 @@ void SdrEditView::SetMarkedObjRect(const tools::Rectangle& rRect) { SdrMark* pM=GetSdrMarkByIndex(nm); SdrObject* pO=pM->GetMarkedSdrObj(); - if( bUndo ) - AddUndo( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pO)); + if (bUndo) + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoGeoObject(*pO)); tools::Rectangle aR1(pO->GetSnapRect()); if (!aR1.IsEmpty()) @@ -165,7 +165,7 @@ std::vector< std::unique_ptr<SdrUndoAction> > SdrEditView::CreateConnectorUndo( if ( ( pPartObj->GetConnectedNode( false ) == &rO ) || ( pPartObj->GetConnectedNode( true ) == &rO ) ) { - vUndoActions.push_back( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject( *pPartObj ) ); + vUndoActions.push_back(GetModel().GetSdrUndoFactory().CreateUndoGeoObject(*pPartObj)); } } } @@ -205,7 +205,7 @@ void SdrEditView::MoveMarkedObj(const Size& rSiz, bool bCopy) if( bUndo ) { AddUndoActions( CreateConnectorUndo( *pO ) ); - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoMoveObject(*pO,rSiz)); + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoMoveObject(*pO,rSiz)); } pO->Move(rSiz); } @@ -237,7 +237,7 @@ void SdrEditView::ResizeMarkedObj(const Point& rRef, const Fraction& xFact, cons if( bUndo ) { AddUndoActions( CreateConnectorUndo( *pO ) ); - AddUndo( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pO)); + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoGeoObject(*pO)); } pO->Resize(rRef,xFact,yFact); } @@ -266,7 +266,7 @@ void SdrEditView::ResizeMultMarkedObj(const Point& rRef, if( bUndo ) { AddUndoActions( CreateConnectorUndo( *pO ) ); - AddUndo( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pO)); + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoGeoObject(*pO)); } Fraction aFrac(1,1); @@ -328,7 +328,7 @@ void SdrEditView::RotateMarkedObj(const Point& rRef, Degree100 nAngle, bool bCop // extra undo actions for changed connector which now may hold its laid out path (SJ) AddUndoActions( CreateConnectorUndo( *pO ) ); - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pO)); + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoGeoObject(*pO)); } // set up a scene updater if object is a 3d object @@ -392,7 +392,7 @@ void SdrEditView::MirrorMarkedObj(const Point& rRef1, const Point& rRef2, bool b // extra undo actions for changed connector which now may hold its laid out path (SJ) AddUndoActions( CreateConnectorUndo( *pO ) ); - AddUndo( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pO)); + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoGeoObject(*pO)); } // set up a scene updater if object is a 3d object @@ -477,7 +477,7 @@ void SdrEditView::ShearMarkedObj(const Point& rRef, Degree100 nAngle, bool bVShe if( bUndo ) { AddUndoActions( CreateConnectorUndo( *pO ) ); - AddUndo( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pO)); + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoGeoObject(*pO)); } pO->Shear(rRef,nAngle,nTan,bVShear); } @@ -589,8 +589,8 @@ void SdrEditView::CrookMarkedObj(const Point& rRef, const Point& rRad, SdrCrookM { SdrMark* pM=GetSdrMarkByIndex(nm); SdrObject* pO=pM->GetMarkedSdrObj(); - if( bUndo ) - AddUndo( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pO)); + if (bUndo) + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoGeoObject(*pO)); const SdrObjList* pOL=pO->GetSubList(); if (bNoContortion || pOL==nullptr) { @@ -663,8 +663,8 @@ void SdrEditView::DistortMarkedObj(const tools::Rectangle& rRef, const XPolygon& { SdrMark* pM=GetSdrMarkByIndex(nm); SdrObject* pO=pM->GetMarkedSdrObj(); - if( bUndo ) - AddUndo( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pO)); + if (bUndo) + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoGeoObject(*pO)); tools::Rectangle aRefRect(rRef); const SdrObjList* pOL=pO->GetSubList(); @@ -774,8 +774,8 @@ void SdrEditView::SetNotPersistAttrToMarked(const SfxItemSet& rAttr) { const SdrMark* pM=GetSdrMarkByIndex(nm); SdrObject* pObj=pM->GetMarkedSdrObj(); - if( bUndo ) - AddUndo( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj)); + if (bUndo) + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoGeoObject(*pObj)); pObj->ApplyNotPersistAttr(rAttr); } @@ -890,7 +890,7 @@ void SdrEditView::MergeNotPersistAttrFromMarked(SfxItemSet& rAttr) const SfxItemSet SdrEditView::GetAttrFromMarked(bool bOnlyHardAttr) const { - SfxItemSet aSet(mpModel->GetItemPool()); + SfxItemSet aSet(GetModel().GetItemPool()); MergeAttrFromMarked(aSet,bOnlyHardAttr); //the EE_FEATURE items should not be set with SetAttrToMarked (see error message there) //so we do not set them here @@ -1170,7 +1170,7 @@ void SdrEditView::SetAttrToMarked(const SfxItemSet& rAttr, bool bReplaceAll) if(bPossibleGeomChange && bUndo) { // save position and size of object, too - AddUndo( GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj)); + AddUndo( GetModel().GetSdrUndoFactory().CreateUndoGeoObject(*pObj)); } if( bUndo ) @@ -1184,7 +1184,7 @@ void SdrEditView::SetAttrToMarked(const SfxItemSet& rAttr, bool bReplaceAll) const bool bRescueText = DynCastSdrTextObj(pObj) != nullptr; // add attribute undo - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoAttrObject(*pObj,false,bHasEEItems || bPossibleGeomChange || bRescueText)); + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoAttrObject(*pObj,false,bHasEEItems || bPossibleGeomChange || bRescueText)); } // set up a scene updater if object is a 3d object @@ -1316,8 +1316,8 @@ void SdrEditView::SetStyleSheetToMarked(SfxStyleSheet* pStyleSheet, bool bDontRe SdrMark* pM=GetSdrMarkByIndex(nm); if( bUndo ) { - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pM->GetMarkedSdrObj())); - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoAttrObject(*pM->GetMarkedSdrObj(),true,true)); + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoGeoObject(*pM->GetMarkedSdrObj())); + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoAttrObject(*pM->GetMarkedSdrObj(),true,true)); } pM->GetMarkedSdrObj()->SetStyleSheet(pStyleSheet,bDontRemoveHardAttr); } @@ -1370,7 +1370,7 @@ void SdrEditView::SetStyleSheet(SfxStyleSheet* pStyleSheet, bool bDontRemoveHard SfxItemSet SdrEditView::GetGeoAttrFromMarked() const { SfxItemSet aRetSet( - mpModel->GetItemPool(), + GetModel().GetItemPool(), svl::Items< // SID_ATTR_TRANSFORM_... from s:svxids.hrc SDRATTR_CORNER_RADIUS, SDRATTR_CORNER_RADIUS, SID_ATTR_TRANSFORM_POS_X, SID_ATTR_TRANSFORM_ANGLE, @@ -1603,7 +1603,7 @@ void SdrEditView::SetGeoAttrToMarked(const SfxItemSet& rAttr, bool addPageMargin bool bShear =false; bool bSetAttr=false; - SfxItemSet aSetAttr(mpModel->GetItemPool()); + SfxItemSet aSetAttr(GetModel().GetItemPool()); // position if (const SfxInt32Item *pPoolItem = rAttr.GetItemIfSet(SID_ATTR_TRANSFORM_POS_X)) @@ -2001,10 +2001,10 @@ void SdrEditView::AlignMarkedObjects(SdrHorAlign eHor, SdrVertAlign eVert) { if( dynamic_cast<SdrEdgeObj*>(pObj) ) { - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj)); + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoGeoObject(*pObj)); } - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoMoveObject(*pObj,Size(nXMov,nYMov))); + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoMoveObject(*pObj,Size(nXMov,nYMov))); } pObj->Move(Size(nXMov,nYMov)); diff --git a/svx/source/svdraw/svdedtv2.cxx b/svx/source/svdraw/svdedtv2.cxx index 38c07fbba1f0..e9cb2be04633 100644 --- a/svx/source/svdraw/svdedtv2.cxx +++ b/svx/source/svdraw/svdedtv2.cxx @@ -143,7 +143,7 @@ void SdrEditView::MovMarkedToTop() bChg=true; pOL->SetObjectOrdNum(nNowPos,nNewPos); if( bUndo ) - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoObjectOrdNum(*pObj,nNowPos,nNewPos)); + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoObjectOrdNum(*pObj,nNowPos,nNewPos)); ObjOrderChanged(pObj,nNowPos,nNewPos); } nNewPos--; @@ -233,7 +233,7 @@ void SdrEditView::MovMarkedToBtm() bChg=true; pOL->SetObjectOrdNum(nNowPos,nNewPos); if( bUndo ) - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoObjectOrdNum(*pObj,nNowPos,nNewPos)); + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoObjectOrdNum(*pObj,nNowPos,nNewPos)); ObjOrderChanged(pObj,nNowPos,nNewPos); } nNewPos++; @@ -333,7 +333,7 @@ void SdrEditView::PutMarkedInFrontOfObj(const SdrObject* pRefObj) bChg=true; pOL->SetObjectOrdNum(nNowPos,nNewPos); if( bUndo ) - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoObjectOrdNum(*pObj,nNowPos,nNewPos)); + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoObjectOrdNum(*pObj,nNowPos,nNewPos)); ObjOrderChanged(pObj,nNowPos,nNewPos); } nNewPos--; @@ -417,7 +417,7 @@ void SdrEditView::PutMarkedBehindObj(const SdrObject* pRefObj) bChg=true; pOL->SetObjectOrdNum(nNowPos,nNewPos); if( bUndo ) - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoObjectOrdNum(*pObj,nNowPos,nNewPos)); + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoObjectOrdNum(*pObj,nNowPos,nNewPos)); ObjOrderChanged(pObj,nNowPos,nNewPos); } nNewPos++; @@ -463,8 +463,8 @@ void SdrEditView::ReverseOrderOfMarked() const size_t nOrd2=pObj2->GetOrdNumDirect(); if( bUndo ) { - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoObjectOrdNum(*pObj1,nOrd1,nOrd2)); - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoObjectOrdNum(*pObj2,nOrd2-1,nOrd1)); + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoObjectOrdNum(*pObj1,nOrd1,nOrd2)); + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoObjectOrdNum(*pObj2,nOrd2-1,nOrd1)); } pOL->SetObjectOrdNum(nOrd1,nOrd2); // Obj 2 has moved forward by one position, so now nOrd2-1 @@ -558,9 +558,9 @@ void SdrEditView::ImpCopyAttributes(const SdrObject* pSource, SdrObject* pDest) if(!(pSource && pDest)) return; - SfxItemSetFixed<SDRATTR_START, SDRATTR_NOTPERSIST_FIRST-1, - SDRATTR_NOTPERSIST_LAST+1, SDRATTR_END, - EE_ITEMS_START, EE_ITEMS_END> aSet(mpModel->GetItemPool()); + SfxItemSetFixed<SDRATTR_START, SDRATTR_NOTPERSIST_FIRST-1, + SDRATTR_NOTPERSIST_LAST+1, SDRATTR_END, + EE_ITEMS_START, EE_ITEMS_END> aSet(GetModel().GetItemPool()); aSet.Put(pSource->GetMergedItemSet()); @@ -861,7 +861,7 @@ void SdrEditView::DistributeMarkedObjects(sal_uInt16 SlotID) ImpDistributeEntry& rNext = aEntryList[ i + 1]; sal_Int32 nDelta = static_cast<sal_Int32>(fStepStart + 0.5) - rCurr.mnPos; if( bUndo ) - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*rCurr.mpObj)); + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoGeoObject(*rCurr.mpObj)); rCurr.mpObj->Move(Size(nDelta, 0)); fStepStart += fStepWidth + static_cast<double>((rCurr.mnLength + rNext.mnLength) / 2); } @@ -880,7 +880,7 @@ void SdrEditView::DistributeMarkedObjects(sal_uInt16 SlotID) ImpDistributeEntry& rCurr = aEntryList[ i ]; sal_Int32 nDelta = static_cast<sal_Int32>(fStepStart + 0.5) - rCurr.mnPos; if( bUndo ) - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*rCurr.mpObj)); + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoGeoObject(*rCurr.mpObj)); rCurr.mpObj->Move(Size(nDelta, 0)); fStepStart += fStepWidth; } @@ -952,7 +952,7 @@ void SdrEditView::DistributeMarkedObjects(sal_uInt16 SlotID) ImpDistributeEntry& rNext = aEntryList[ i + 1 ]; sal_Int32 nDelta = static_cast<sal_Int32>(fStepStart + 0.5) - rCurr.mnPos; if( bUndo ) - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*rCurr.mpObj)); + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoGeoObject(*rCurr.mpObj)); rCurr.mpObj->Move(Size(0, nDelta)); fStepStart += fStepWidth + static_cast<double>((rCurr.mnLength + rNext.mnLength) / 2); } @@ -971,7 +971,7 @@ void SdrEditView::DistributeMarkedObjects(sal_uInt16 SlotID) ImpDistributeEntry& rCurr = aEntryList[ i ]; sal_Int32 nDelta = static_cast<sal_Int32>(fStepStart + 0.5) - rCurr.mnPos; if( bUndo ) - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*rCurr.mpObj)); + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoGeoObject(*rCurr.mpObj)); rCurr.mpObj->Move(Size(0, nDelta)); fStepStart += fStepWidth; } @@ -982,7 +982,7 @@ void SdrEditView::DistributeMarkedObjects(sal_uInt16 SlotID) } // UNDO-Comment and end of UNDO - mpModel->SetUndoComment(SvxResId(STR_DistributeMarkedObjects)); + GetModel().SetUndoComment(SvxResId(STR_DistributeMarkedObjects)); if( bUndo ) EndUndo(); @@ -1124,7 +1124,7 @@ void SdrEditView::MergeMarkedObjects(SdrMergeMode eMode) ImpCopyAttributes(pAttrObj, pPath.get()); pInsOL->InsertObject(pPath.get(), nInsPos); if( bUndo ) - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoNewObject(*pPath)); + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoNewObject(*pPath)); // #i124760# To have a correct selection with only the new object it is necessary to // unmark all objects first. If not doing so, there may remain invalid pointers to objects @@ -1207,7 +1207,7 @@ void SdrEditView::EqualizeMarkedObjects(bool bWidth) aLogicRectSize.setHeight( aLastRectSize.Height() ); aLogicRect.SetSize(aLogicRectSize); if (bUndo) - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj)); + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoGeoObject(*pObj)); pObj->SetLogicRect(aLogicRect); } @@ -1435,7 +1435,7 @@ void SdrEditView::CombineMarkedObjects(bool bNoPolyPoly) pInsOL->InsertObject(pPath.get(),nInsPos); if( bUndo ) - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoNewObject(*pPath)); + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoNewObject(*pPath)); // Here was a severe error: Without UnmarkAllObj, the new object was marked // additionally to the two ones which are deleted below. As long as those are @@ -1591,7 +1591,7 @@ void SdrEditView::ImpDismantleOneObject(const SdrObject* pObj, SdrObjList& rOL, pLast = pPath.get(); rOL.InsertObject(pPath.get(), rPos); if( bUndo ) - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoNewObject(*pPath, true)); + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoNewObject(*pPath, true)); MarkObj(pPath.get(), pPV, false, true); rPos++; } @@ -1628,7 +1628,7 @@ void SdrEditView::ImpDismantleOneObject(const SdrObject* pObj, SdrObjList& rOL, pLast = pPath.get(); rOL.InsertObject(pPath.get(), rPos); if( bUndo ) - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoNewObject(*pPath, true)); + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoNewObject(*pPath, true)); MarkObj(pPath.get(), pPV, false, true); rPos++; } @@ -1662,7 +1662,7 @@ void SdrEditView::ImpDismantleOneObject(const SdrObject* pObj, SdrObjList& rOL, rOL.InsertObject(pCandidate.get(), rPos); if( bUndo ) - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoNewObject(*pCandidate, true)); + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoNewObject(*pCandidate, true)); MarkObj(pCandidate.get(), pPV, false, true); if(pCustomShape->HasText() && !pCustomShape->IsTextPath()) @@ -1709,7 +1709,7 @@ void SdrEditView::ImpDismantleOneObject(const SdrObject* pObj, SdrObjList& rOL, // insert object rOL.InsertObject(pTextObj.get(), rPos + 1); if( bUndo ) - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoNewObject(*pTextObj, true)); + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoNewObject(*pTextObj, true)); MarkObj(pTextObj.get(), pPV, false, true); } } @@ -1755,7 +1755,7 @@ void SdrEditView::DismantleMarkedObjects(bool bMakeLines) ImpDismantleOneObject(pObj,*pOL,nPos,pPV,bMakeLines); } if( bUndo ) - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoDeleteObject(*pObj,true)); + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoDeleteObject(*pObj,true)); pOL->RemoveObject(nPos0); } } @@ -1792,7 +1792,7 @@ void SdrEditView::GroupMarked() SdrMark* pM=GetSdrMarkByIndex(nm); SdrObject* pObj = pM->GetMarkedSdrObj(); AddUndoActions( CreateConnectorUndo( *pObj ) ); - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoRemoveObject( *pObj )); + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoRemoveObject( *pObj )); } } @@ -1855,10 +1855,10 @@ void SdrEditView::GroupMarked() pCurrentLst->InsertObject(pGrp.get(),nInsPos); if( bUndo ) { - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoNewObject(*pGrp,true)); // no recalculation! + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoNewObject(*pGrp,true)); // no recalculation! for (size_t no=0; no<nCount; ++no) { - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoInsertObject(*pDstLst->GetObj(no))); + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoInsertObject(*pDstLst->GetObj(no))); } } } @@ -1930,7 +1930,7 @@ void SdrEditView::UnGroupMarked() // Undo of these is handled by SdrUndoGeoObj which holds a SdrObjGeoData, // create one if( bUndo ) - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj)); + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoGeoObject(*pObj)); pObj->SetMoveProtect(false); pObj->SetResizeProtect(false); @@ -1940,7 +1940,7 @@ void SdrEditView::UnGroupMarked() // If it has no FillStyle it is not useful for any further processing // but only was used as a placeholder, get directly rid of it if( bUndo ) - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoDeleteObject(*pObj)); + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoDeleteObject(*pObj)); pSrcLst->RemoveObject(0); @@ -1958,7 +1958,7 @@ void SdrEditView::UnGroupMarked() { no--; SdrObject* pObj=pSrcLst->GetObj(no); - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoRemoveObject(*pObj)); + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoRemoveObject(*pObj)); } } @@ -1967,7 +1967,7 @@ void SdrEditView::UnGroupMarked() rtl::Reference<SdrObject> pObj=pSrcLst->RemoveObject(0); pDstLst->InsertObject(pObj.get(),nDstCnt); if( bUndo ) - AddUndo( GetModel()->GetSdrUndoFactory().CreateUndoInsertObject(*pObj,true)); + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoInsertObject(*pObj,true)); nDstCnt++; // No SortCheck when inserting into MarkList, because that would // provoke a RecalcOrdNums() each time because of pObj->GetOrdNum(): @@ -1980,7 +1980,7 @@ void SdrEditView::UnGroupMarked() // MigrateItemPool now only for itself, not for the sub-objects. // nDstCnt is right, because previous inserts move group // object deeper and increase nDstCnt. - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoDeleteObject(*pGrp)); + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoDeleteObject(*pGrp)); } pDstLst->RemoveObject(nDstCnt); @@ -2016,7 +2016,7 @@ rtl::Reference<SdrObject> SdrEditView::ImpConvertOneObj(SdrObject* pObj, bool bP SdrObjList* pOL = pObj->getParentSdrObjListFromSdrObject(); const bool bUndo = IsUndoEnabled(); if( bUndo ) - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoReplaceObject(*pObj,*pNewObj)); + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoReplaceObject(*pObj,*pNewObj)); pOL->ReplaceObject(pNewObj.get(), pObj->GetOrdNum()); } @@ -2143,7 +2143,7 @@ void SdrEditView::DoImportMarkedMtf(SvdProgressInfo *pProgrInfo) if (pPdfium) { aLogicRect = pGraf->GetLogicRect(); - ImpSdrPdfImport aFilter(*mpModel, pObj->GetLayer(), aLogicRect, aGraphic); + ImpSdrPdfImport aFilter(GetModel(), pObj->GetLayer(), aLogicRect, aGraphic); if (aGraphic.getPageNumber() < aFilter.GetPageCount()) { nInsCnt = aFilter.DoImport(*pOL, nInsPos, aGraphic.getPageNumber(), pProgrInfo); @@ -2156,7 +2156,7 @@ void SdrEditView::DoImportMarkedMtf(SvdProgressInfo *pProgrInfo) if (aMetaFile.GetActionSize()) { aLogicRect = pGraf->GetLogicRect(); - ImpSdrGDIMetaFileImport aFilter(*mpModel, pObj->GetLayer(), aLogicRect); + ImpSdrGDIMetaFileImport aFilter(GetModel(), pObj->GetLayer(), aLogicRect); nInsCnt = aFilter.DoImport(aMetaFile, *pOL, nInsPos, pProgrInfo); } } @@ -2166,7 +2166,7 @@ void SdrEditView::DoImportMarkedMtf(SvdProgressInfo *pProgrInfo) if (pOle2 != nullptr && pOle2->GetGraphic()) { aLogicRect = pOle2->GetLogicRect(); - ImpSdrGDIMetaFileImport aFilter(*mpModel, pObj->GetLayer(), aLogicRect); + ImpSdrGDIMetaFileImport aFilter(GetModel(), pObj->GetLayer(), aLogicRect); nInsCnt = aFilter.DoImport(pOle2->GetGraphic()->GetGDIMetaFile(), *pOL, nInsPos, pProgrInfo); } @@ -2185,7 +2185,7 @@ void SdrEditView::DoImportMarkedMtf(SvdProgressInfo *pProgrInfo) for (size_t i = 0; i < nInsCnt; i++) { if (bUndo) - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoNewObject(*pOL->GetObj(nObj))); + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoNewObject(*pOL->GetObj(nObj))); // update new MarkList SdrObject* pCandidate = pOL->GetObj(nObj); @@ -2206,7 +2206,7 @@ void SdrEditView::DoImportMarkedMtf(SvdProgressInfo *pProgrInfo) aForTheDescription.InsertEntry(*pM); if (bUndo) - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoDeleteObject(*pObj)); + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoDeleteObject(*pObj)); // remove object from selection and delete GetMarkedObjectListWriteAccess().DeleteMark(TryToFindMarkedObject(pObj)); diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx index 42be2aff97fb..2710b52c4c0d 100644 --- a/svx/source/svdraw/svdedxv.cxx +++ b/svx/source/svdraw/svdedxv.cxx @@ -235,11 +235,11 @@ void SdrObjEditView::Notify(SfxBroadcaster& rBC, const SfxHint& rHint) SdrHintKind eKind = pSdrHint->GetKind(); if (eKind == SdrHintKind::RefDeviceChange) { - mpTextEditOutliner->SetRefDevice(mpModel->GetRefDevice()); + mpTextEditOutliner->SetRefDevice(GetModel().GetRefDevice()); } if (eKind == SdrHintKind::DefaultTabChange) { - mpTextEditOutliner->SetDefTab(mpModel->GetDefaultTabulator()); + mpTextEditOutliner->SetDefTab(GetModel().GetDefaultTabulator()); } } @@ -1102,12 +1102,12 @@ void SdrObjEditView::ImpChainingEventHdl() // Handling Undo const int nText = 0; // XXX: hardcoded index (SdrTextObj::getText handles only 0) - const bool bUndoEnabled = GetModel() && IsUndoEnabled(); + const bool bUndoEnabled = IsUndoEnabled(); std::unique_ptr<SdrUndoObjSetText> pTxtUndo; if (bUndoEnabled) pTxtUndo.reset( dynamic_cast<SdrUndoObjSetText*>(GetModel() - ->GetSdrUndoFactory() + .GetSdrUndoFactory() .CreateUndoObjectSetText(*pTextObj, nText) .release())); @@ -1198,7 +1198,7 @@ IMPL_LINK(SdrObjEditView, ImpOutlinerCalcFieldValueHdl, EditFieldInfo*, pFI, voi } } } - Outliner& rDrawOutl = mpModel->GetDrawOutliner(pTextObj.get()); + Outliner& rDrawOutl = GetModel().GetDrawOutliner(pTextObj.get()); Link<EditFieldInfo*, void> aDrawOutlLink = rDrawOutl.GetCalcFieldValueHdl(); if (!bOk && aDrawOutlLink.IsSet()) { @@ -1495,19 +1495,15 @@ bool SdrObjEditView::SdrBeginTextEdit(SdrObject* pObj_, SdrPageView* pPV, vcl::W pWin->Invalidate(aTextEditArea); } - if (GetModel()) - { - SdrHint aHint(SdrHintKind::BeginEdit, *pTextObj); - GetModel()->Broadcast(aHint); - } + SdrHint aHint(SdrHintKind::BeginEdit, *pTextObj); + GetModel().Broadcast(aHint); mpTextEditOutliner->setVisualizedPage(nullptr); if (mxSelectionController.is()) mxSelectionController->onSelectionHasChanged(); - if (GetModel() && IsUndoEnabled() - && !GetModel()->GetDisableTextEditUsesCommonUndoManager()) + if (IsUndoEnabled() && !GetModel().GetDisableTextEditUsesCommonUndoManager()) { SdrUndoManager* pSdrUndoManager = nullptr; mpLocalTextEditUndoManager = createLocalTextUndoManager(); @@ -1577,8 +1573,8 @@ SdrEndTextEditKind SdrObjEditView::SdrEndTextEdit(bool bDontDeleteReally) SdrUndoManager* pUndoEditUndoManager = nullptr; bool bNeedToUndoSavedRedoTextEdit(false); - if (GetModel() && IsUndoEnabled() && pTEObj && mpTextEditOutliner - && !GetModel()->GetDisableTextEditUsesCommonUndoManager()) + if (IsUndoEnabled() && pTEObj && mpTextEditOutliner + && !GetModel().GetDisableTextEditUsesCommonUndoManager()) { // change back the UndoManager to the remembered original one SfxUndoManager* pOriginal = mpTextEditOutliner->SetUndoManager(mpOldTextEditUndoManager); @@ -1632,12 +1628,11 @@ SdrEndTextEditKind SdrObjEditView::SdrEndTextEdit(bool bDontDeleteReally) assert(nullptr == mpOldTextEditUndoManager); // cannot be restored! } - if (GetModel()) - if (auto pTextEditObj = mxWeakTextEditObj.get()) - { - SdrHint aHint(SdrHintKind::EndEdit, *pTextEditObj); - GetModel()->Broadcast(aHint); - } + if (auto pTextEditObj = mxWeakTextEditObj.get()) + { + SdrHint aHint(SdrHintKind::EndEdit, *pTextEditObj); + GetModel().Broadcast(aHint); + } // if new mechanism was used, clean it up. At cleanup no need to check // for LibreOfficeKit @@ -1676,7 +1671,7 @@ SdrEndTextEditKind SdrObjEditView::SdrEndTextEdit(bool bDontDeleteReally) pTxtUndo.reset( dynamic_cast<SdrUndoObjSetText*>(GetModel() - ->GetSdrUndoFactory() + .GetSdrUndoFactory() .CreateUndoObjectSetText(*pTEObj, nText) .release())); } @@ -1724,7 +1719,7 @@ SdrEndTextEditKind SdrObjEditView::SdrEndTextEdit(bool bDontDeleteReally) SdrObjKind eIdent = pTEObj->GetObjIdentifier(); if (eIdent == SdrObjKind::Text) { - pDelUndo = GetModel()->GetSdrUndoFactory().CreateUndoDeleteObject(*pTEObj); + pDelUndo = GetModel().GetSdrUndoFactory().CreateUndoDeleteObject(*pTEObj); } } } @@ -1969,11 +1964,8 @@ bool SdrObjEditView::KeyInput(const KeyEvent& rKEvt, vcl::Window* pWin) if (mpTextEditOutlinerView->PostKeyEvent(rKEvt, pWin)) { - if (mpModel) - { - if (mpTextEditOutliner && mpTextEditOutliner->IsModified()) - mpModel->SetChanged(); - } + if (mpTextEditOutliner && mpTextEditOutliner->IsModified()) + GetModel().SetChanged(); /* Start chaining processing */ ImpChainingEventHdl(); @@ -2159,12 +2151,12 @@ bool SdrObjEditView::Command(const CommandEvent& rCEvt, vcl::Window* pWin) else { mpTextEditOutlinerView->Command(rCEvt); - if (mpModel && comphelper::LibreOfficeKit::isActive()) + if (comphelper::LibreOfficeKit::isActive()) { // It could execute CommandEventId::ExtTextInput, while SdrObjEditView::KeyInput // isn't called if (mpTextEditOutliner && mpTextEditOutliner->IsModified()) - mpModel->SetChanged(); + GetModel().SetChanged(); } return true; } @@ -2358,7 +2350,7 @@ bool SdrObjEditView::SetAttributes(const SfxItemSet& rSet, bool bReplaceAll) if (bUndo) { BegUndo(ImpGetDescriptionString(STR_EditSetAttributes)); - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pTextEditObj)); + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoGeoObject(*pTextEditObj)); // If this is a text object also rescue the OutlinerParaObject since // applying attributes to the object may change text layout when @@ -2367,7 +2359,7 @@ bool SdrObjEditView::SetAttributes(const SfxItemSet& rSet, bool bReplaceAll) // implementation itself. bool bRescueText(pTextEditObj); - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoAttrObject( + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoAttrObject( *pTextEditObj, false, !bNoEEItems || bRescueText)); EndUndo(); } @@ -2384,7 +2376,7 @@ bool SdrObjEditView::SetAttributes(const SfxItemSet& rSet, bool bReplaceAll) // *pSet (otherwise it would be a copy). WhichRangesContainer pNewWhichTable = RemoveWhichRange(pSet->GetRanges(), EE_ITEMS_START, EE_ITEMS_END); - SfxItemSet aSet(mpModel->GetItemPool(), std::move(pNewWhichTable)); + SfxItemSet aSet(GetModel().GetItemPool(), std::move(pNewWhichTable)); SfxWhichIter aIter(aSet); sal_uInt16 nWhich = aIter.FirstWhich(); while (nWhich != 0) @@ -2404,8 +2396,8 @@ bool SdrObjEditView::SetAttributes(const SfxItemSet& rSet, bool bReplaceAll) if (IsUndoEnabled()) { BegUndo(ImpGetDescriptionString(STR_EditSetAttributes)); - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pTextEditObj)); - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoAttrObject(*pTextEditObj)); + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoGeoObject(*pTextEditObj)); + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoAttrObject(*pTextEditObj)); EndUndo(); } @@ -2428,8 +2420,8 @@ bool SdrObjEditView::SetAttributes(const SfxItemSet& rSet, bool bReplaceAll) mpTextEditOutlinerView->SetAttribs(rSet); Outliner* pTEOutliner = mpTextEditOutlinerView->GetOutliner(); - if (mpModel && pTEOutliner && pTEOutliner->IsModified()) - mpModel->SetChanged(); + if (pTEOutliner && pTEOutliner->IsModified()) + GetModel().SetChanged(); ImpMakeTextCursorAreaVisible(); } @@ -2814,7 +2806,7 @@ void SdrObjEditView::TakeFormatPaintBrush(std::shared_ptr<SfxItemSet>& rFormatSe OutlinerView* pOLV = GetTextEditOutlinerView(); - rFormatSet = std::make_shared<SfxItemSet>(GetModel()->GetItemPool(), + rFormatSet = std::make_shared<SfxItemSet>(GetModel().GetItemPool(), GetFormatRangeImpl(pOLV != nullptr)); if (pOLV) { diff --git a/svx/source/svdraw/svdglev.cxx b/svx/source/svdraw/svdglev.cxx index 67c64eb1a8df..5a67e3685f85 100644 --- a/svx/source/svdraw/svdglev.cxx +++ b/svx/source/svdraw/svdglev.cxx @@ -58,7 +58,7 @@ void SdrGlueEditView::ImpDoMarkedGluePoints(PGlueDoFunc pDoFunc, bool bConst, co if (pGPL!=nullptr) { if(!bConst && IsUndoEnabled() ) - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj)); + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoGeoObject(*pObj)); for(sal_uInt16 nPtId : rPts) { @@ -77,7 +77,8 @@ void SdrGlueEditView::ImpDoMarkedGluePoints(PGlueDoFunc pDoFunc, bool bConst, co } } } - if (!bConst && nMarkCount!=0) mpModel->SetChanged(); + if (!bConst && nMarkCount!=0) + GetModel().SetChanged(); } @@ -239,7 +240,7 @@ void SdrGlueEditView::DeleteMarkedGluePoints() if (pGPL!=nullptr) { if( bUndo ) - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj)); + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoGeoObject(*pObj)); for(sal_uInt16 nPtId : rPts) { @@ -258,7 +259,7 @@ void SdrGlueEditView::DeleteMarkedGluePoints() EndUndo(); UnmarkAllGluePoints(); if (nMarkCount!=0) - mpModel->SetChanged(); + GetModel().SetChanged(); } @@ -279,7 +280,7 @@ void SdrGlueEditView::ImpCopyMarkedGluePoints() if (!rPts.empty() && pGPL!=nullptr) { if( bUndo ) - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj)); + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoGeoObject(*pObj)); SdrUShortCont aIdsToErase; SdrUShortCont aIdsToInsert; @@ -304,7 +305,7 @@ void SdrGlueEditView::ImpCopyMarkedGluePoints() EndUndo(); if (nMarkCount!=0) - mpModel->SetChanged(); + GetModel().SetChanged(); } @@ -320,7 +321,7 @@ void SdrGlueEditView::ImpTransformMarkedGluePoints(PGlueTrFunc pTrFunc, const vo if (pGPL!=nullptr) { if( IsUndoEnabled() ) - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj)); + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoGeoObject(*pObj)); for(sal_uInt16 nPtId : rPts) { @@ -337,7 +338,8 @@ void SdrGlueEditView::ImpTransformMarkedGluePoints(PGlueTrFunc pTrFunc, const vo } } } - if (nMarkCount!=0) mpModel->SetChanged(); + if (nMarkCount!=0) + GetModel().SetChanged(); } diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx index 912135b0d1c0..02fdbc26230a 100644 --- a/svx/source/svdraw/svdmrkv.cxx +++ b/svx/source/svdraw/svdmrkv.cxx @@ -1554,7 +1554,7 @@ void SdrMarkView::AddDragModeHdl(SdrDragMode eMode) if(nMarkCount == 1) { SdrObject* pObj = GetMarkedObjectByIndex(0); - SdrModel* pModel = GetModel(); + SdrModel& rModel = GetModel(); const SfxItemSet& rSet = pObj->GetMergedItemSet(); if(SfxItemState::SET != rSet.GetItemState(XATTR_FILLFLOATTRANSPARENCE, false)) @@ -1569,14 +1569,14 @@ void SdrMarkView::AddDragModeHdl(SdrDragMode eMode) aNewItem.SetGradientValue(aGrad); // add undo to allow user to take back this step - if( pModel->IsUndoEnabled() ) + if (rModel.IsUndoEnabled()) { - pModel->BegUndo(SvxResId(SIP_XA_FILLTRANSPARENCE)); - pModel->AddUndo(pModel->GetSdrUndoFactory().CreateUndoAttrObject(*pObj)); - pModel->EndUndo(); + rModel.BegUndo(SvxResId(SIP_XA_FILLTRANSPARENCE)); + rModel.AddUndo(rModel.GetSdrUndoFactory().CreateUndoAttrObject(*pObj)); + rModel.EndUndo(); } - SfxItemSet aNewSet(pModel->GetItemPool()); + SfxItemSet aNewSet(rModel.GetItemPool()); aNewSet.Put(aNewItem); pObj->SetMergedItemSetAndBroadcast(aNewSet); } diff --git a/svx/source/svdraw/svdpagv.cxx b/svx/source/svdraw/svdpagv.cxx index 14acfd4a993b..ab82cf2e3301 100644 --- a/svx/source/svdraw/svdpagv.cxx +++ b/svx/source/svdraw/svdpagv.cxx @@ -157,7 +157,7 @@ void SdrPageView::ModelHasChanged() bool SdrPageView::IsReadOnly() const { - return (nullptr == GetPage() || GetView().GetModel()->IsReadOnly() || GetPage()->IsReadOnly() || GetObjList()->IsReadOnly()); + return (nullptr == GetPage() || GetView().GetModel().IsReadOnly() || GetPage()->IsReadOnly() || GetObjList()->IsReadOnly()); } void SdrPageView::Show() diff --git a/svx/source/svdraw/svdpntv.cxx b/svx/source/svdraw/svdpntv.cxx index 7e47af6ddced..901ddd8c0aaf 100644 --- a/svx/source/svdraw/svdpntv.cxx +++ b/svx/source/svdraw/svdpntv.cxx @@ -129,8 +129,7 @@ BitmapEx convertMetafileToBitmapEx( } SdrPaintView::SdrPaintView(SdrModel& rSdrModel, OutputDevice* pOut) - : mrSdrModelFromSdrView(rSdrModel) - , mpModel(&rSdrModel) + : mrModel(rSdrModel) , mpActualOutDev(nullptr) , mpDragWin(nullptr) , mpDefaultStyleSheet(nullptr) @@ -171,8 +170,7 @@ SdrPaintView::SdrPaintView(SdrModel& rSdrModel, OutputDevice* pOut) maComeBackIdle.SetPriority(TaskPriority::REPAINT); maComeBackIdle.SetInvokeHandler(LINK(this,SdrPaintView,ImpComeBackHdl)); - if (mpModel) - SetDefaultStyleSheet(mpModel->GetDefaultStyleSheet(), true); + SetDefaultStyleSheet(GetModel().GetDefaultStyleSheet(), true); if (pOut) AddDeviceToPaintView(*pOut, nullptr); @@ -769,7 +767,7 @@ void SdrPaintView::ImpFormLayerDrawing( SdrPaintWindow& rPaintWindow ) if(pKnownTarget) { - const SdrModel& rModel = *(GetModel()); + const SdrModel& rModel = GetModel(); const SdrLayerAdmin& rLayerAdmin = rModel.GetLayerAdmin(); const SdrLayerID nControlLayerId = rLayerAdmin.GetLayerID(rLayerAdmin.GetControlLayerName()); @@ -907,7 +905,7 @@ void SdrPaintView::SetNotPersistDefaultAttr(const SfxItemSet& rAttr) if (const SdrLayerIdItem *pPoolItem = rAttr.GetItemIfSet(SDRATTR_LAYERID)) { SdrLayerID nLayerId = pPoolItem->GetValue(); - const SdrLayer* pLayer=mpModel->GetLayerAdmin().GetLayerPerID(nLayerId); + const SdrLayer* pLayer = GetModel().GetLayerAdmin().GetLayerPerID(nLayerId); if (pLayer!=nullptr) { if (bMeasure) maMeasureLayer=pLayer->GetName(); else maActualLayer=pLayer->GetName(); @@ -926,7 +924,7 @@ void SdrPaintView::MergeNotPersistDefaultAttr(SfxItemSet& rAttr) const bool bMeasure= dynamic_cast<const SdrView*>(this) != nullptr && static_cast<const SdrView*>(this)->IsMeasureTool(); const OUString& aNam = bMeasure ? maMeasureLayer : maActualLayer; rAttr.Put(SdrLayerNameItem(aNam)); - SdrLayerID nLayer=mpModel->GetLayerAdmin().GetLayerID(aNam); + SdrLayerID nLayer = GetModel().GetLayerAdmin().GetLayerID(aNam); if (nLayer!=SDRLAYER_NOTFOUND) { rAttr.Put(SdrLayerIdItem(nLayer)); } diff --git a/svx/source/svdraw/svdpoev.cxx b/svx/source/svdraw/svdpoev.cxx index b7365ea3b047..1cfca1ab94b8 100644 --- a/svx/source/svdraw/svdpoev.cxx +++ b/svx/source/svdraw/svdpoev.cxx @@ -212,7 +212,7 @@ void SdrPolyEditView::SetMarkedPointsSmooth(SdrPathSmoothKind eKind) if (aEditor.SetPointsSmooth(eFlags, rPts)) { if( bUndo ) - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pPath)); + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoGeoObject(*pPath)); pPath->SetPathPoly(aEditor.GetPolyPolygon()); } } @@ -245,7 +245,7 @@ void SdrPolyEditView::SetMarkedSegmentsKind(SdrPathSegmentKind eKind) if (aEditor.SetSegmentsKind(eKind, rPts)) { if( bUndo ) - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pPath)); + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoGeoObject(*pPath)); pPath->SetPathPoly(aEditor.GetPolyPolygon()); } } @@ -313,14 +313,14 @@ void SdrPolyEditView::DeleteMarkedPoints() { if( aEditor.GetPolyPolygon().count() ) { - if( bUndo ) - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pPath )); + if (bUndo) + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoGeoObject(*pPath)); pPath->SetPathPoly( aEditor.GetPolyPolygon() ); } else { - if( bUndo ) - AddUndo( GetModel()->GetSdrUndoFactory().CreateUndoDeleteObject(*pPath ) ); + if (bUndo) + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoDeleteObject(*pPath)); pM->GetPageView()->GetObjList()->RemoveObject(pPath->GetOrdNum()); } } @@ -354,8 +354,8 @@ void SdrPolyEditView::RipUpAtMarkedPoints() SdrUShortCont& rPts = pM->GetMarkedPoints(); - if( bUndo ) - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj)); + if (bUndo) + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoGeoObject(*pObj)); bool bCorrectionFlag(false); sal_uInt32 nMax(pObj->GetHdlCount()); @@ -367,8 +367,8 @@ void SdrPolyEditView::RipUpAtMarkedPoints() if(pNewObj) { pM->GetPageView()->GetObjList()->InsertObject(pNewObj.get(), pObj->GetOrdNum() + 1); - if( bUndo ) - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoNewObject(*pNewObj)); + if (bUndo) + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoNewObject(*pNewObj)); MarkObj(pNewObj.get(), pM->GetPageView(), false, true); } @@ -533,7 +533,7 @@ void SdrPolyEditView::ImpTransformMarkedPoints(PPolyTrFunc pTrFunc, const void* continue; if( bUndo ) - AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pObj)); + AddUndo(GetModel().GetSdrUndoFactory().CreateUndoGeoObject(*pObj)); basegfx::B2DPolyPolygon aXPP(pPath->GetPathPoly()); diff --git a/svx/source/svdraw/svdview.cxx b/svx/source/svdraw/svdview.cxx index e4e40a5ba2aa..06680bd5eecc 100644 --- a/svx/source/svdraw/svdview.cxx +++ b/svx/source/svdraw/svdview.cxx @@ -165,8 +165,8 @@ bool SdrView::KeyInput(const KeyEvent& rKEvt, vcl::Window* pWin) bRet = true; switch (rKEvt.GetKeyCode().GetFullFunction()) { case KeyFuncType::DELETE: DeleteMarked(); break; - case KeyFuncType::UNDO: mpModel->Undo(); break; - case KeyFuncType::REDO: mpModel->Redo(); break; + case KeyFuncType::UNDO: GetModel().Undo(); break; + case KeyFuncType::REDO: GetModel().Redo(); break; default: { switch (rKEvt.GetKeyCode().GetFullCode()) { case KEY_ESCAPE: { @@ -175,9 +175,9 @@ bool SdrView::KeyInput(const KeyEvent& rKEvt, vcl::Window* pWin) if (pWin!=nullptr) pWin->ReleaseMouse(); } break; case KEY_DELETE: DeleteMarked(); break; - case KEY_UNDO: case KEY_BACKSPACE+KEY_MOD2: mpModel->Undo(); break; - case KEY_BACKSPACE+KEY_MOD2+KEY_SHIFT: mpModel->Redo(); break; - case KEY_REPEAT: case KEY_BACKSPACE+KEY_MOD2+KEY_MOD1: mpModel->Repeat(*this); break; + case KEY_UNDO: case KEY_BACKSPACE+KEY_MOD2: GetModel().Undo(); break; + case KEY_BACKSPACE+KEY_MOD2+KEY_SHIFT: GetModel().Redo(); break; + case KEY_REPEAT: case KEY_BACKSPACE+KEY_MOD2+KEY_MOD1: GetModel().Repeat(*this); break; case KEY_MOD1+KEY_A: MarkAll(); break; default: bRet=false; } // switch diff --git a/svx/source/svdraw/svdxcgv.cxx b/svx/source/svdraw/svdxcgv.cxx index 3ae384d344d8..4c425a627bc5 100644 --- a/svx/source/svdraw/svdxcgv.cxx +++ b/svx/source/svdraw/svdxcgv.cxx @@ -154,7 +154,7 @@ bool SdrExchangeView::Paste(const OUString& rStr, const Point& rPos, SdrObjList* pObj->SetMergedItemSet(maDefaultAttr); - SfxItemSet aTempAttr(mpModel->GetItemPool()); // no fill, no line + SfxItemSet aTempAttr(GetModel().GetItemPool()); // no fill, no line aTempAttr.Put(XLineStyleItem(drawing::LineStyle_NONE)); aTempAttr.Put(XFillStyleItem(drawing::FillStyle_NONE)); @@ -162,7 +162,7 @@ bool SdrExchangeView::Paste(const OUString& rStr, const Point& rPos, SdrObjList* pObj->FitFrameToTextSize(); Size aSiz(pObj->GetLogicRect().GetSize()); - MapUnit eMap = mpModel->GetScaleUnit(); + MapUnit eMap = GetModel().GetScaleUnit(); Fraction aMap(1,1); ImpPasteObject(pObj.get(),*pLst,aPos,aSiz,MapMode(eMap,Point(0,0),aMap,aMap),nOptions); return true; @@ -193,7 +193,7 @@ bool SdrExchangeView::Paste(SvStream& rInput, EETextFormat eFormat, const Point& pObj->SetMergedItemSet(maDefaultAttr); - SfxItemSet aTempAttr(mpModel->GetItemPool()); // no fill, no line + SfxItemSet aTempAttr(GetModel().GetItemPool()); // no fill, no line aTempAttr.Put(XLineStyleItem(drawing::LineStyle_NONE)); aTempAttr.Put(XFillStyleItem(drawing::FillStyle_NONE)); @@ -202,7 +202,7 @@ bool SdrExchangeView::Paste(SvStream& rInput, EETextFormat eFormat, const Point& pObj->NbcSetText(rInput,OUString(),eFormat); pObj->FitFrameToTextSize(); Size aSiz(pObj->GetLogicRect().GetSize()); - MapUnit eMap=mpModel->GetScaleUnit(); + MapUnit eMap = GetModel().GetScaleUnit(); Fraction aMap(1,1); ImpPasteObject(pObj.get(),*pLst,aPos,aSiz,MapMode(eMap,Point(0,0),aMap,aMap),nOptions); @@ -233,7 +233,7 @@ bool SdrExchangeView::Paste( const SdrModel& rMod, const Point& rPos, SdrObjList* pLst, SdrInsertFlags nOptions) { const SdrModel* pSrcMod=&rMod; - if (pSrcMod==mpModel) + if (pSrcMod == &GetModel()) return false; // this can't work, right? const bool bUndo = IsUndoEnabled(); @@ -266,8 +266,8 @@ bool SdrExchangeView::Paste( // Rescale, if the Model uses a different MapUnit. // Calculate the necessary factors first. - MapUnit eSrcUnit=pSrcMod->GetScaleUnit(); - MapUnit eDstUnit=mpModel->GetScaleUnit(); + MapUnit eSrcUnit = pSrcMod->GetScaleUnit(); + MapUnit eDstUnit = GetModel().GetScaleUnit(); bool bResize=eSrcUnit!=eDstUnit; Fraction aXResize,aYResize; Point aPt0; @@ -302,7 +302,7 @@ bool SdrExchangeView::Paste( { const SdrObject* pSrcOb=pSrcPg->GetObj(nOb); - rtl::Reference<SdrObject> pNewObj(pSrcOb->CloneSdrObject(*mpModel)); + rtl::Reference<SdrObject> pNewObj(pSrcOb->CloneSdrObject(GetModel())); if (pNewObj!=nullptr) { @@ -399,7 +399,7 @@ void SdrExchangeView::ImpPasteObject(SdrObject* pObj, SdrObjList& rLst, const Po BigInt nSizX(rSiz.Width()); BigInt nSizY(rSiz.Height()); MapUnit eSrcMU=rMap.GetMapUnit(); - MapUnit eDstMU=mpModel->GetScaleUnit(); + MapUnit eDstMU = GetModel().GetScaleUnit(); FrPair aMapFact(GetMapFactor(eSrcMU,eDstMU)); Fraction aDstFr(1,1); nSizX *= double(aMapFact.X() * rMap.GetScaleX() * aDstFr); @@ -500,7 +500,7 @@ BitmapEx SdrExchangeView::GetMarkedObjBitmapEx(bool bNoVDevIfOneBmpMarked, const { o3tl::Length eRangeUnit = o3tl::Length::mm100; - if (GetModel()->IsWriter()) + if (GetModel().IsWriter()) { eRangeUnit = o3tl::Length::twip; } @@ -530,7 +530,7 @@ GDIMetaFile SdrExchangeView::GetMarkedObjMetaFile(bool bNoVDevIfOneMtfMarked) co { tools::Rectangle aBound( GetMarkedObjBoundRect() ); Size aBoundSize( aBound.GetWidth(), aBound.GetHeight() ); - MapMode aMap(mpModel->GetScaleUnit(), Point(), Fraction(1,1), Fraction(1,1)); + MapMode aMap(GetModel().GetScaleUnit(), Point(), Fraction(1,1), Fraction(1,1)); if( bNoVDevIfOneMtfMarked ) { @@ -686,7 +686,7 @@ Graphic SdrExchangeView::GetObjGraphic(const SdrObject& rSdrObject) ::std::vector< ::std::vector< SdrMark* > > aObjVectors( 2 ); ::std::vector< SdrMark* >& rObjVector1 = aObjVectors[ 0 ]; ::std::vector< SdrMark* >& rObjVector2 = aObjVectors[ 1 ]; - const SdrLayerAdmin& rLayerAdmin = mpModel->GetLayerAdmin(); + const SdrLayerAdmin& rLayerAdmin = GetModel().GetLayerAdmin(); const SdrLayerID nControlLayerId = rLayerAdmin.GetLayerID( rLayerAdmin.GetControlLayerName() ); for( size_t n = 0, nCount = GetMarkedObjectCount(); n < nCount; ++n ) @@ -731,7 +731,7 @@ std::unique_ptr<SdrModel> SdrExchangeView::CreateMarkedObjModel() const // Sorting the MarkList here might be problematic in the future, so // use a copy. SortMarkedObjects(); - std::unique_ptr<SdrModel> pNewModel(mpModel->AllocModel()); + std::unique_ptr<SdrModel> pNewModel(GetModel().AllocModel()); rtl::Reference<SdrPage> pNewPage = pNewModel->AllocPage(false); pNewModel->InsertPage(pNewPage.get()); ::std::vector< SdrObject* > aSdrObjects(GetMarkedObjects()); @@ -766,7 +766,7 @@ std::unique_ptr<SdrModel> SdrExchangeView::CreateMarkedObjModel() const if(!pNewObj) { // not cloned yet - if(pObj->GetObjIdentifier() == SdrObjKind::OLE2 && nullptr == mpModel->GetPersist()) + if(pObj->GetObjIdentifier() == SdrObjKind::OLE2 && nullptr == GetModel().GetPersist()) { // tdf#125520 - former fix was wrong, the SdrModel // has to have a GetPersist() already, see task. diff --git a/svx/source/tbxctrls/colrctrl.cxx b/svx/source/tbxctrls/colrctrl.cxx index 37e28b995cb1..da829d127e5d 100644 --- a/svx/source/tbxctrls/colrctrl.cxx +++ b/svx/source/tbxctrls/colrctrl.cxx @@ -360,7 +360,7 @@ IMPL_LINK_NOARG(SvxColorDockingWindow, SelectHdl, ValueSet*, void) SdrView* pView = pViewSh->GetDrawView(); if ( pView ) { - SfxItemSet aAttrSet( pView->GetModel()->GetItemPool() ); + SfxItemSet aAttrSet(pView->GetModel().GetItemPool()); pView->GetAttributes( aAttrSet ); if ( aAttrSet.GetItemState( XATTR_LINESTYLE ) != SfxItemState::DONTCARE ) { diff --git a/svx/source/tbxctrls/grafctrl.cxx b/svx/source/tbxctrls/grafctrl.cxx index 733cfb3af88d..6c723b36dbf9 100644 --- a/svx/source/tbxctrls/grafctrl.cxx +++ b/svx/source/tbxctrls/grafctrl.cxx @@ -499,7 +499,7 @@ VclPtr<InterimItemWindow> SvxGrafModeToolBoxControl::CreateItemWindow( vcl::Wind void SvxGrafAttrHelper::ExecuteGrafAttr( SfxRequest& rReq, SdrView& rView ) { - SfxItemPool& rPool = rView.GetModel()->GetItemPool(); + SfxItemPool& rPool = rView.GetModel().GetItemPool(); SfxItemSetFixed<SDRATTR_GRAF_FIRST, SDRATTR_GRAF_LAST> aSet( rPool ); OUString aUndoStr; const bool bUndo = rView.IsUndoEnabled(); @@ -725,7 +725,7 @@ void SvxGrafAttrHelper::ExecuteGrafAttr( SfxRequest& rReq, SdrView& rView ) if( bUndo ) { rView.BegUndo( aUndoStr ); - rView.AddUndo( rView.GetModel()->GetSdrUndoFactory().CreateUndoGeoObject( *pObj ) ); + rView.AddUndo(rView.GetModel().GetSdrUndoFactory().CreateUndoGeoObject(*pObj)); } pObj->SetSnapRect( aNewRect ); rView.SetAttributes( aSet ); @@ -770,7 +770,7 @@ void SvxGrafAttrHelper::ExecuteGrafAttr( SfxRequest& rReq, SdrView& rView ) void SvxGrafAttrHelper::GetGrafAttrState( SfxItemSet& rSet, SdrView const & rView ) { - SfxItemPool& rPool = rView.GetModel()->GetItemPool(); + SfxItemPool& rPool = rView.GetModel().GetItemPool(); SfxItemSet aAttrSet( rPool ); SfxWhichIter aIter( rSet ); sal_uInt16 nWhich = aIter.FirstWhich(); diff --git a/svx/source/toolbars/extrusionbar.cxx b/svx/source/toolbars/extrusionbar.cxx index 3e0273c2862c..7c56a6609e4d 100644 --- a/svx/source/toolbars/extrusionbar.cxx +++ b/svx/source/toolbars/extrusionbar.cxx @@ -616,7 +616,7 @@ void ExtrusionBar::execute( SdrView* pSdrView, SfxRequest const & rReq, SfxBindi { OUString aStr( SvxResId( pStrResId ) ); pSdrView->BegUndo( aStr ); - pSdrView->AddUndo( pSdrView->GetModel()->GetSdrUndoFactory().CreateUndoAttrObject( *pObj ) ); + pSdrView->AddUndo( pSdrView->GetModel().GetSdrUndoFactory().CreateUndoAttrObject( *pObj ) ); } SdrCustomShapeGeometryItem aGeometryItem( pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) ); impl_execute( rReq, aGeometryItem, pObj ); @@ -1027,11 +1027,9 @@ static void getExtrusionDepthState( SdrView const * pSdrView, SfxItemSet& rSet ) } } - if( pSdrView->GetModel() ) - { - FieldUnit eUnit = pSdrView->GetModel()->GetUIUnit(); - rSet.Put( SfxUInt16Item( SID_ATTR_METRIC, static_cast<sal_uInt16>(eUnit) ) ); - } + + FieldUnit eUnit = pSdrView->GetModel().GetUIUnit(); + rSet.Put( SfxUInt16Item( SID_ATTR_METRIC, static_cast<sal_uInt16>(eUnit) ) ); if( bHasCustomShape ) rSet.Put( SvxDoubleItem( fFinalDepth, SID_EXTRUSION_DEPTH ) ); diff --git a/svx/source/toolbars/fontworkbar.cxx b/svx/source/toolbars/fontworkbar.cxx index 7b2e8653b09d..03c8f42c7a34 100644 --- a/svx/source/toolbars/fontworkbar.cxx +++ b/svx/source/toolbars/fontworkbar.cxx @@ -448,7 +448,7 @@ void FontworkBar::execute( SdrView& rSdrView, SfxRequest const & rReq, SfxBindin { OUString aStr( SvxResId( RID_SVXSTR_UNDO_APPLY_FONTWORK_SHAPE ) ); rSdrView.BegUndo(aStr); - rSdrView.AddUndo(rSdrView.GetModel()->GetSdrUndoFactory().CreateUndoAttrObject(*pObj)); + rSdrView.AddUndo(rSdrView.GetModel().GetSdrUndoFactory().CreateUndoAttrObject(*pObj)); } SdrCustomShapeGeometryItem aGeometryItem( pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) ); GetGeometryForCustomShape( aGeometryItem, aCustomShape ); @@ -526,7 +526,7 @@ void FontworkBar::execute( SdrView& rSdrView, SfxRequest const & rReq, SfxBindin { OUString aStr( SvxResId( pStrResId ) ); rSdrView.BegUndo(aStr); - rSdrView.AddUndo(rSdrView.GetModel()->GetSdrUndoFactory().CreateUndoAttrObject(*pObj)); + rSdrView.AddUndo(rSdrView.GetModel().GetSdrUndoFactory().CreateUndoAttrObject(*pObj)); } SdrCustomShapeGeometryItem aGeometryItem( pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ) ); impl_execute( rReq, aGeometryItem, pObj ); |