sd/inc/sdundo.hxx                                      |    4 -
 sd/inc/undoanim.hxx                                    |    2 
 sd/source/core/ThemeColorChanger.cxx                   |    2 
 sd/source/core/drawdoc.cxx                             |    4 -
 sd/source/core/drawdoc3.cxx                            |   16 +++----
 sd/source/core/undo/undoobjects.cxx                    |    6 +-
 sd/source/core/undoanim.cxx                            |    4 -
 sd/source/ui/animations/SlideTransitionPane.cxx        |    4 -
 sd/source/ui/dlg/LayerTabBar.cxx                       |    4 -
 sd/source/ui/dlg/UndoThemeChange.cxx                   |    4 -
 sd/source/ui/dlg/headerfooterdlg.cxx                   |    4 -
 sd/source/ui/dlg/unchss.cxx                            |   10 ++--
 sd/source/ui/func/fuoaprms.cxx                         |    6 +-
 sd/source/ui/func/undoback.cxx                         |    4 -
 sd/source/ui/func/undoheaderfooter.cxx                 |    4 -
 sd/source/ui/func/undolayer.cxx                        |    8 +--
 sd/source/ui/func/unmovss.cxx                          |    6 +-
 sd/source/ui/func/unprlout.cxx                         |    4 -
 sd/source/ui/inc/UndoThemeChange.hxx                   |    2 
 sd/source/ui/inc/sdundogr.hxx                          |    4 -
 sd/source/ui/inc/undoheaderfooter.hxx                  |    2 
 sd/source/ui/inc/undolayer.hxx                         |    2 
 sd/source/ui/inc/undopage.hxx                          |   12 ++---
 sd/source/ui/inc/unmodpg.hxx                           |    8 +--
 sd/source/ui/inc/unmovss.hxx                           |    2 
 sd/source/ui/inc/unoaprms.hxx                          |    4 -
 sd/source/ui/inc/unprlout.hxx                          |    2 
 sd/source/ui/sidebar/DocumentHelper.cxx                |    2 
 sd/source/ui/slidesorter/controller/SlsSlotManager.cxx |    8 +--
 sd/source/ui/view/ViewShellImplementation.cxx          |    2 
 sd/source/ui/view/drviews2.cxx                         |    2 
 sd/source/ui/view/drviews3.cxx                         |   12 ++---
 sd/source/ui/view/drviewsb.cxx                         |    2 
 sd/source/ui/view/sdview2.cxx                          |    2 
 sd/source/ui/view/unmodpg.cxx                          |   36 ++++++++---------
 sd/source/ui/view/viewshe2.cxx                         |    2 
 36 files changed, 101 insertions(+), 101 deletions(-)

New commits:
commit a76c597187c988f7e3840c808c70d08c2414d269
Author:     Xisco Fauli <[email protected]>
AuthorDate: Fri May 30 13:58:24 2025 +0200
Commit:     Xisco Fauli <[email protected]>
CommitDate: Fri May 30 15:12:26 2025 +0200

    SdUndoAction: pass SdDrawDocument by ref
    
    Change-Id: I0f15f2e93e701f23dd588a891e3d40cc0854ce78
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186041
    Tested-by: Jenkins
    Reviewed-by: Xisco Fauli <[email protected]>

diff --git a/sd/inc/sdundo.hxx b/sd/inc/sdundo.hxx
index fbcc03574c56..54097f03f5ca 100644
--- a/sd/inc/sdundo.hxx
+++ b/sd/inc/sdundo.hxx
@@ -27,7 +27,7 @@ class SdDrawDocument;
 class SD_DLLPUBLIC SdUndoAction : public SfxUndoAction
 {
 public:
-                            SdUndoAction(SdDrawDocument* pSdDrawDocument);
+                            SdUndoAction(SdDrawDocument& rSdDrawDocument);
 
     void                    SetComment(const OUString& rStr) { maComment = 
rStr; }
     virtual OUString        GetComment() const override { return maComment; }
@@ -36,7 +36,7 @@ public:
     ViewShellId GetViewShellId() const override;
 
 protected:
-    SdDrawDocument* mpDoc;
+    SdDrawDocument& mrDoc;
     ViewShellId mnViewShellId;
 private:
     OUString maComment;
diff --git a/sd/inc/undoanim.hxx b/sd/inc/undoanim.hxx
index 2d329b50da45..dbd36382fff9 100644
--- a/sd/inc/undoanim.hxx
+++ b/sd/inc/undoanim.hxx
@@ -68,7 +68,7 @@ struct UndoTransitionImpl;
 class UndoTransition final : public SdUndoAction
 {
 public:
-    UndoTransition(SdDrawDocument* pDoc, SdPage* pThePage);
+    UndoTransition(SdDrawDocument& rDoc, SdPage* pThePage);
     virtual ~UndoTransition() override;
 
     virtual void Undo() override;
diff --git a/sd/source/core/ThemeColorChanger.cxx 
b/sd/source/core/ThemeColorChanger.cxx
index b7634b9fa587..b06acf6891d3 100644
--- a/sd/source/core/ThemeColorChanger.cxx
+++ b/sd/source/core/ThemeColorChanger.cxx
@@ -58,7 +58,7 @@ void changeThemeColors(sd::DrawDocShell* pDocShell, SdrPage* 
pMasterPage,
     if (pUndoManager)
     {
         pUndoManager->AddUndoAction(std::make_unique<UndoThemeChange>(
-            pDocShell->GetDoc(), pMasterPage, pOldColorSet, pNewColorSet));
+            *pDocShell->GetDoc(), pMasterPage, pOldColorSet, pNewColorSet));
     }
 
     pTheme->setColorSet(pNewColorSet);
diff --git a/sd/source/core/drawdoc.cxx b/sd/source/core/drawdoc.cxx
index 7a77e451db22..7edfe9249557 100644
--- a/sd/source/core/drawdoc.cxx
+++ b/sd/source/core/drawdoc.cxx
@@ -459,7 +459,7 @@ void SdDrawDocument::AdaptPageSizeForAllPages(
         {
             SdUndoAction* pUndo(
                 new SdPageFormatUndoAction(
-                    this,
+                    *this,
                     pPage,
                     pPage->GetSize(),
                     pPage->GetLeftBorder(), pPage->GetRightBorder(),
@@ -514,7 +514,7 @@ void SdDrawDocument::AdaptPageSizeForAllPages(
         {
             SdUndoAction* pUndo(
                 new SdPageFormatUndoAction(
-                    this,
+                    *this,
                     pPage,
                     pPage->GetSize(),
                     pPage->GetLeftBorder(), pPage->GetRightBorder(),
diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx
index 7ebb5bd5829d..b30f630b3072 100644
--- a/sd/source/core/drawdoc3.cxx
+++ b/sd/source/core/drawdoc3.cxx
@@ -525,7 +525,7 @@ void SdDrawDocument::transferLayoutStyles(const 
SlideLayoutNameList& aLayoutsToT
         {
             if( pUndoMgr )
             {
-                
pUndoMgr->AddUndoAction(std::make_unique<SdMoveStyleSheetsUndoAction>(this, 
aCreatedStyles, true));
+                
pUndoMgr->AddUndoAction(std::make_unique<SdMoveStyleSheetsUndoAction>(*this, 
aCreatedStyles, true));
             }
         }
 
@@ -1060,7 +1060,7 @@ void SdDrawDocument::cleanupStyles(SfxUndoManager* 
pUndoMgr,
 {
     lcl_removeUnusedStyles(GetStyleSheetPool(), rStyleContext.aGraphicStyles);
     if (!rStyleContext.aGraphicStyles.empty() && pUndoMgr)
-        
pUndoMgr->AddUndoAction(std::make_unique<SdMoveStyleSheetsUndoAction>(this, 
rStyleContext.aGraphicStyles, true));
+        
pUndoMgr->AddUndoAction(std::make_unique<SdMoveStyleSheetsUndoAction>(*this, 
rStyleContext.aGraphicStyles, true));
     
lcl_removeUnusedTableStyles(static_cast<SdStyleSheetPool*>(GetStyleSheetPool()),
 rStyleContext.aTableStyles);
     lcl_removeUnusedStyles(GetStyleSheetPool(), rStyleContext.aCellStyles);
 }
@@ -1462,7 +1462,7 @@ void SdDrawDocument::RemoveUnnecessaryMasterPages(SdPage* 
pMasterPage, bool bOnl
                             aUndoRemove.emplace_back(a.get(), true);
 
                         if (pUndoMgr)
-                            
pUndoMgr->AddUndoAction(std::make_unique<SdMoveStyleSheetsUndoAction>(this, 
aUndoRemove, false));
+                            
pUndoMgr->AddUndoAction(std::make_unique<SdMoveStyleSheetsUndoAction>(*this, 
aUndoRemove, false));
                     }
 
                     for( const auto& a : aRemove )
@@ -1774,7 +1774,7 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
             {
                 // Add UndoAction for creating and inserting the stylesheets to
                 // the top of the UndoManager
-                
pUndoMgr->AddUndoAction(std::make_unique<SdMoveStyleSheetsUndoAction>( this, 
aCreatedStyles, true));
+                
pUndoMgr->AddUndoAction(std::make_unique<SdMoveStyleSheetsUndoAction>( *this, 
aCreatedStyles, true));
             }
         }
 
@@ -1861,7 +1861,7 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
             if( bUndo )
             {
                 
pUndoMgr->AddUndoAction(std::make_unique<SdPresentationLayoutUndoAction>
-                        (this,
+                        (*this,
                         pPage->IsMasterPage() ? aLayoutName : aOldLayoutName,
                         aLayoutName,
                          eAutoLayout, eAutoLayout, false, pPage.get()));
@@ -1926,7 +1926,7 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
             aUndoInsert.reserve(aCreatedStyles.size());
             for (const auto& a : aCreatedStyles)
                 aUndoInsert.emplace_back(a.get(), true);
-            
pUndoMgr->AddUndoAction(std::make_unique<SdMoveStyleSheetsUndoAction>(this, 
aUndoInsert, true));
+            
pUndoMgr->AddUndoAction(std::make_unique<SdMoveStyleSheetsUndoAction>(*this, 
aUndoInsert, true));
             // Generate new master pages and register them with the document
             BegUndo();
         }
@@ -1994,7 +1994,7 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
             if( bUndo )
             {
                 
pUndoMgr->AddUndoAction(std::make_unique<SdPresentationLayoutUndoAction>
-                            (this, aOldLayoutName, aName,
+                            (*this, aOldLayoutName, aName,
                              eOldAutoLayout, eNewAutoLayout, true,
                              rpPage));
             }
@@ -2098,7 +2098,7 @@ SdPage* SdDrawDocument::AddNewMasterPageFromExisting(
 
     if(!aCreatedStyles.empty() && bUndo && pUndoMgr)
     {
-        
pUndoMgr->AddUndoAction(std::make_unique<SdMoveStyleSheetsUndoAction>(this, 
aCreatedStyles, true));
+        
pUndoMgr->AddUndoAction(std::make_unique<SdMoveStyleSheetsUndoAction>(*this, 
aCreatedStyles, true));
     }
 
     if(bUndo && pUndoMgr)
diff --git a/sd/source/core/undo/undoobjects.cxx 
b/sd/source/core/undo/undoobjects.cxx
index 62cc3accae7a..20aa060bfe72 100644
--- a/sd/source/core/undo/undoobjects.cxx
+++ b/sd/source/core/undo/undoobjects.cxx
@@ -29,11 +29,11 @@
 
 using namespace sd;
 
-SdUndoAction::SdUndoAction(SdDrawDocument* pSdDrawDocument)
-    : mpDoc(pSdDrawDocument),
+SdUndoAction::SdUndoAction(SdDrawDocument& rSdDrawDocument)
+    : mrDoc(rSdDrawDocument),
       mnViewShellId(-1)
 {
-    sd::DrawDocShell* pDocShell = pSdDrawDocument ? 
pSdDrawDocument->GetDocSh() : nullptr;
+    sd::DrawDocShell* pDocShell = rSdDrawDocument.GetDocSh();
     sd::ViewShell* pViewShell = pDocShell ? pDocShell->GetViewShell() : 
nullptr;
     if (pViewShell)
         mnViewShellId = pViewShell->GetViewShellBase().GetViewShellId();
diff --git a/sd/source/core/undoanim.cxx b/sd/source/core/undoanim.cxx
index a64f14931253..bc3c10f1abb4 100644
--- a/sd/source/core/undoanim.cxx
+++ b/sd/source/core/undoanim.cxx
@@ -210,8 +210,8 @@ struct UndoTransitionImpl
     bool mbOldStopSound;
 };
 
-UndoTransition::UndoTransition( SdDrawDocument* _pDoc, SdPage* pThePage )
-: SdUndoAction( _pDoc ), mpImpl( new UndoTransitionImpl )
+UndoTransition::UndoTransition( SdDrawDocument& rDoc, SdPage* pThePage )
+: SdUndoAction( rDoc ), mpImpl( new UndoTransitionImpl )
 {
     mpImpl->mpPage = pThePage;
 
diff --git a/sd/source/ui/animations/SlideTransitionPane.cxx 
b/sd/source/ui/animations/SlideTransitionPane.cxx
index 91a053b0db44..3f51df5b6d10 100644
--- a/sd/source/ui/animations/SlideTransitionPane.cxx
+++ b/sd/source/ui/animations/SlideTransitionPane.cxx
@@ -244,12 +244,12 @@ void lcl_CreateUndoForPages(
 
     OUString aComment( SdResId(STR_UNDO_SLIDE_PARAMS) );
     pManager->EnterListAction(aComment, aComment, 0, rBase.GetViewShellId());
-    std::unique_ptr<SdUndoGroup> pUndoGroup(new SdUndoGroup( pDoc ));
+    std::unique_ptr<SdUndoGroup> pUndoGroup(new SdUndoGroup( *pDoc ));
     pUndoGroup->SetComment( aComment );
 
     for( const auto& rpPage : *rpPages )
     {
-        pUndoGroup->AddAction( new sd::UndoTransition( pDoc, rpPage ) );
+        pUndoGroup->AddAction( new sd::UndoTransition( *pDoc, rpPage ) );
     }
 
     pManager->AddUndoAction( std::move(pUndoGroup) );
diff --git a/sd/source/ui/dlg/LayerTabBar.cxx b/sd/source/ui/dlg/LayerTabBar.cxx
index 0955b8551805..5a85fa94859d 100644
--- a/sd/source/ui/dlg/LayerTabBar.cxx
+++ b/sd/source/ui/dlg/LayerTabBar.cxx
@@ -338,7 +338,7 @@ void LayerTabBar::MouseButtonDown(const MouseEvent& rMEvt)
                 {
                     SfxUndoManager* pManager = 
rDoc.GetDocSh()->GetUndoManager();
                     std::unique_ptr<SdLayerModifyUndoAction> pAction(new 
SdLayerModifyUndoAction(
-                        &rDoc,
+                        rDoc,
                         pLayer,
                         aName,
                         pLayer->GetTitle(),
@@ -518,7 +518,7 @@ void LayerTabBar::EndRenaming()
     {
         SfxUndoManager* pManager = rDoc.GetDocSh()->GetUndoManager();
         std::unique_ptr<SdLayerModifyUndoAction> pAction(new 
SdLayerModifyUndoAction(
-            &rDoc,
+            rDoc,
             pLayer,
             aLayerName,
             pLayer->GetTitle(),
diff --git a/sd/source/ui/dlg/UndoThemeChange.cxx 
b/sd/source/ui/dlg/UndoThemeChange.cxx
index 1270dc06cab7..468268958bf7 100644
--- a/sd/source/ui/dlg/UndoThemeChange.cxx
+++ b/sd/source/ui/dlg/UndoThemeChange.cxx
@@ -13,10 +13,10 @@
 
 namespace sd
 {
-UndoThemeChange::UndoThemeChange(SdDrawDocument* pDocument, SdrPage* 
pMasterPage,
+UndoThemeChange::UndoThemeChange(SdDrawDocument& rDocument, SdrPage* 
pMasterPage,
                                  std::shared_ptr<model::ColorSet> const& 
pOldColorSet,
                                  std::shared_ptr<model::ColorSet> const& 
pNewColorSet)
-    : SdUndoAction(pDocument)
+    : SdUndoAction(rDocument)
     , mpMasterPage(pMasterPage)
     , mpOldColorSet(pOldColorSet)
     , mpNewColorSet(pNewColorSet)
diff --git a/sd/source/ui/dlg/headerfooterdlg.cxx 
b/sd/source/ui/dlg/headerfooterdlg.cxx
index 95f8249699bc..7a30848d3a51 100644
--- a/sd/source/ui/dlg/headerfooterdlg.cxx
+++ b/sd/source/ui/dlg/headerfooterdlg.cxx
@@ -271,7 +271,7 @@ void HeaderFooterDialog::Apply()
 
 void HeaderFooterDialog::apply( bool bToAll, bool bForceSlides )
 {
-    std::unique_ptr<SdUndoGroup> pUndoGroup(new SdUndoGroup(mpDoc));
+    std::unique_ptr<SdUndoGroup> pUndoGroup(new SdUndoGroup(*mpDoc));
     OUString aComment( m_xDialog->get_title() );
     pUndoGroup->SetComment( aComment );
 
@@ -349,7 +349,7 @@ void HeaderFooterDialog::apply( bool bToAll, bool 
bForceSlides )
 
 void HeaderFooterDialog::change( SdUndoGroup* pUndoGroup, SdPage* pPage, const 
HeaderFooterSettings& rNewSettings )
 {
-    pUndoGroup->AddAction(new SdHeaderFooterUndoAction(mpDoc, pPage, 
rNewSettings ));
+    pUndoGroup->AddAction(new SdHeaderFooterUndoAction(*mpDoc, pPage, 
rNewSettings ));
     pPage->setHeaderFooterSettings( rNewSettings );
 }
 
diff --git a/sd/source/ui/dlg/unchss.cxx b/sd/source/ui/dlg/unchss.cxx
index 5727bb0deaed..52386706306a 100644
--- a/sd/source/ui/dlg/unchss.cxx
+++ b/sd/source/ui/dlg/unchss.cxx
@@ -36,7 +36,7 @@
 StyleSheetUndoAction::StyleSheetUndoAction(SdDrawDocument& rTheDoc,
                                            SfxStyleSheet& rTheStyleSheet,
                                            const SfxItemSet* pTheNewItemSet)
-    : SdUndoAction(&rTheDoc),
+    : SdUndoAction(rTheDoc),
       mrStyleSheet(rTheStyleSheet)
 {
     // Create ItemSets; Attention, it is possible that the new one is from a,
@@ -92,8 +92,8 @@ StyleSheetUndoAction::StyleSheetUndoAction(SdDrawDocument& 
rTheDoc,
 
 void StyleSheetUndoAction::Undo()
 {
-    SfxItemSet aNewSet( mpDoc->GetItemPool(), mpOldSet->GetRanges() );
-    SdrModel::MigrateItemSet( mpOldSet.get(), &aNewSet, *mpDoc );
+    SfxItemSet aNewSet( mrDoc.GetItemPool(), mpOldSet->GetRanges() );
+    SdrModel::MigrateItemSet( mpOldSet.get(), &aNewSet, mrDoc );
 
     mrStyleSheet.GetItemSet().Set(aNewSet);
     if( mrStyleSheet.GetFamily() == SfxStyleFamily::Pseudo )
@@ -104,8 +104,8 @@ void StyleSheetUndoAction::Undo()
 
 void StyleSheetUndoAction::Redo()
 {
-    SfxItemSet aNewSet( mpDoc->GetItemPool(), mpOldSet->GetRanges() );
-    SdrModel::MigrateItemSet( mpNewSet.get(), &aNewSet, *mpDoc );
+    SfxItemSet aNewSet( mrDoc.GetItemPool(), mpOldSet->GetRanges() );
+    SdrModel::MigrateItemSet( mpNewSet.get(), &aNewSet, mrDoc );
 
     mrStyleSheet.GetItemSet().Set(aNewSet);
     if( mrStyleSheet.GetFamily() == SfxStyleFamily::Pseudo )
diff --git a/sd/source/ui/func/fuoaprms.cxx b/sd/source/ui/func/fuoaprms.cxx
index a177c9318a42..e34e9341749f 100644
--- a/sd/source/ui/func/fuoaprms.cxx
+++ b/sd/source/ui/func/fuoaprms.cxx
@@ -667,7 +667,7 @@ void FuObjectAnimationParameters::Finish( const 
std::shared_ptr<SfxRequest>& xRe
     pUndoMgr->EnterListAction(aComment, aComment, 0, 
mrViewShell.GetViewShellBase().GetViewShellId());
 
     // create undo group
-    std::unique_ptr<SdUndoGroup> pUndoGroup(new SdUndoGroup(&mrDoc));
+    std::unique_ptr<SdUndoGroup> pUndoGroup(new SdUndoGroup(mrDoc));
     pUndoGroup->SetComment(aComment);
 
     // for the path effect, remember some stuff
@@ -737,7 +737,7 @@ void FuObjectAnimationParameters::Finish( const 
std::shared_ptr<SfxRequest>& xRe
         if (eEffect == presentation::AnimationEffect_PATH && pObject == pPath)
         {
             SdAnimationPrmsUndoAction* pAction = new SdAnimationPrmsUndoAction
-                                            (&mrDoc, pObject, bCreated);
+                                            (mrDoc, pObject, bCreated);
             pAction->SetActive(pInfo->mbActive, pInfo->mbActive);
             pAction->SetEffect(pInfo->meEffect, pInfo->meEffect);
             pAction->SetTextEffect(pInfo->meTextEffect, pInfo->meTextEffect);
@@ -763,7 +763,7 @@ void FuObjectAnimationParameters::Finish( const 
std::shared_ptr<SfxRequest>& xRe
 
             // create undo action with old and new sizes
             SdAnimationPrmsUndoAction* pAction = new SdAnimationPrmsUndoAction
-                                            (&mrDoc, pObject, bCreated);
+                                            (mrDoc, pObject, bCreated);
             pAction->SetActive(pInfo->mbActive, bActive);
             pAction->SetEffect(pInfo->meEffect, eEffect);
             pAction->SetTextEffect(pInfo->meTextEffect, eTextEffect);
diff --git a/sd/source/ui/func/undoback.cxx b/sd/source/ui/func/undoback.cxx
index 768ca2ec2f1a..054298c0f866 100644
--- a/sd/source/ui/func/undoback.cxx
+++ b/sd/source/ui/func/undoback.cxx
@@ -36,7 +36,7 @@ SdBackgroundObjUndoAction::SdBackgroundObjUndoAction(
     SdDrawDocument& rDoc,
     SdPage& rPage,
     const SfxItemSet& rItemSet)
-:   SdUndoAction(&rDoc),
+:   SdUndoAction(rDoc),
     mrPage(rPage),
     mpItemSet(std::make_unique<SfxItemSet>(rItemSet)),
     mbHasFillBitmap(false)
@@ -74,7 +74,7 @@ void SdBackgroundObjUndoAction::Redo()
 
 SdUndoAction* SdBackgroundObjUndoAction::Clone() const
 {
-    std::unique_ptr<SdBackgroundObjUndoAction> pCopy = 
std::make_unique<SdBackgroundObjUndoAction>(*mpDoc, mrPage, *mpItemSet);
+    std::unique_ptr<SdBackgroundObjUndoAction> pCopy = 
std::make_unique<SdBackgroundObjUndoAction>(mrDoc, mrPage, *mpItemSet);
     if (mpFillBitmapItem)
         pCopy->mpFillBitmapItem.reset(mpFillBitmapItem->Clone());
     pCopy->mbHasFillBitmap = mbHasFillBitmap;
diff --git a/sd/source/ui/func/undoheaderfooter.cxx 
b/sd/source/ui/func/undoheaderfooter.cxx
index 6f386a42fd11..77be1b246368 100644
--- a/sd/source/ui/func/undoheaderfooter.cxx
+++ b/sd/source/ui/func/undoheaderfooter.cxx
@@ -25,8 +25,8 @@
 #include <utility>
 
 
-SdHeaderFooterUndoAction::SdHeaderFooterUndoAction( SdDrawDocument* pDoc, 
SdPage* pPage, sd::HeaderFooterSettings aNewSettings )
-:   SdUndoAction(pDoc),
+SdHeaderFooterUndoAction::SdHeaderFooterUndoAction( SdDrawDocument& rDoc, 
SdPage* pPage, sd::HeaderFooterSettings aNewSettings )
+:   SdUndoAction(rDoc),
     mpPage(pPage),
     maOldSettings(pPage->getHeaderFooterSettings()),
     maNewSettings(std::move(aNewSettings))
diff --git a/sd/source/ui/func/undolayer.cxx b/sd/source/ui/func/undolayer.cxx
index 15084376b9a5..2e01f242862c 100644
--- a/sd/source/ui/func/undolayer.cxx
+++ b/sd/source/ui/func/undolayer.cxx
@@ -28,10 +28,10 @@
 
 
 SdLayerModifyUndoAction::SdLayerModifyUndoAction(
-    SdDrawDocument* _pDoc, SdrLayer* pLayer,
+    SdDrawDocument& rDoc, SdrLayer* pLayer,
     OUString aOldLayerName, OUString aOldLayerTitle, OUString aOldLayerDesc, 
bool bOldIsVisible, bool bOldIsLocked, bool bOldIsPrintable,
     OUString aNewLayerName, OUString aNewLayerTitle, OUString aNewLayerDesc, 
bool bNewIsVisible, bool bNewIsLocked, bool bNewIsPrintable )
-:   SdUndoAction( _pDoc ),
+:   SdUndoAction( rDoc ),
     mpLayer( pLayer ),
     maOldLayerName(std::move( aOldLayerName )),
     maOldLayerTitle(std::move( aOldLayerTitle )),
@@ -52,7 +52,7 @@ SdLayerModifyUndoAction::SdLayerModifyUndoAction(
 
 void SdLayerModifyUndoAction::Undo()
 {
-    ::sd::DrawDocShell* pDocSh = mpDoc->GetDocSh();
+    ::sd::DrawDocShell* pDocSh = mrDoc.GetDocSh();
     if( pDocSh )
     {
         ::sd::DrawViewShell* pDrViewSh = dynamic_cast< ::sd::DrawViewShell*> ( 
pDocSh->GetViewShell() );
@@ -65,7 +65,7 @@ void SdLayerModifyUndoAction::Undo()
 
 void SdLayerModifyUndoAction::Redo()
 {
-    ::sd::DrawDocShell* pDocSh = mpDoc->GetDocSh();
+    ::sd::DrawDocShell* pDocSh = mrDoc.GetDocSh();
     if( pDocSh )
     {
         ::sd::DrawViewShell* pDrViewSh = dynamic_cast< ::sd::DrawViewShell* >( 
pDocSh->GetViewShell() );
diff --git a/sd/source/ui/func/unmovss.cxx b/sd/source/ui/func/unmovss.cxx
index d21f83b39af2..e1cbdd3d6008 100644
--- a/sd/source/ui/func/unmovss.cxx
+++ b/sd/source/ui/func/unmovss.cxx
@@ -22,8 +22,8 @@
 #include <stlsheet.hxx>
 #include <stlpool.hxx>
 
-SdMoveStyleSheetsUndoAction::SdMoveStyleSheetsUndoAction( SdDrawDocument* 
pTheDoc, StyleSheetCopyResultVector& rTheStyles, bool bInserted)
-: SdUndoAction(pTheDoc)
+SdMoveStyleSheetsUndoAction::SdMoveStyleSheetsUndoAction( SdDrawDocument& 
rTheDoc, StyleSheetCopyResultVector& rTheStyles, bool bInserted)
+: SdUndoAction(rTheDoc)
 , mbMySheets( !bInserted )
 {
     maStyles.swap( rTheStyles );
@@ -39,7 +39,7 @@ SdMoveStyleSheetsUndoAction::SdMoveStyleSheetsUndoAction( 
SdDrawDocument* pTheDo
 
 void SdMoveStyleSheetsUndoAction::Undo()
 {
-    SfxStyleSheetBasePool* pPool  = mpDoc->GetStyleSheetPool();
+    SfxStyleSheetBasePool* pPool  = mrDoc.GetStyleSheetPool();
 
     if (mbMySheets)
     {
diff --git a/sd/source/ui/func/unprlout.cxx b/sd/source/ui/func/unprlout.cxx
index 218883349882..875ccdc13ae6 100644
--- a/sd/source/ui/func/unprlout.cxx
+++ b/sd/source/ui/func/unprlout.cxx
@@ -27,14 +27,14 @@
 
 
 SdPresentationLayoutUndoAction::SdPresentationLayoutUndoAction(
-                            SdDrawDocument* pTheDoc,
+                            SdDrawDocument& rTheDoc,
                             const OUString& aTheOldLayoutName,
                             const OUString& aTheNewLayoutName,
                             AutoLayout      eTheOldAutoLayout,
                             AutoLayout      eTheNewAutoLayout,
                             bool            bSet,
                             SdPage*         pThePage):
-                      SdUndoAction(pTheDoc)
+                      SdUndoAction(rTheDoc)
 {
     aOldLayoutName = aTheOldLayoutName;
     aNewLayoutName = aTheNewLayoutName;
diff --git a/sd/source/ui/inc/UndoThemeChange.hxx 
b/sd/source/ui/inc/UndoThemeChange.hxx
index 798f2adb50bf..52e34554982a 100644
--- a/sd/source/ui/inc/UndoThemeChange.hxx
+++ b/sd/source/ui/inc/UndoThemeChange.hxx
@@ -26,7 +26,7 @@ private:
     std::shared_ptr<model::ColorSet> mpNewColorSet;
 
 public:
-    UndoThemeChange(SdDrawDocument* pDocument, SdrPage* pMasterPage,
+    UndoThemeChange(SdDrawDocument& rDocument, SdrPage* pMasterPage,
                     std::shared_ptr<model::ColorSet> const& pOldColorSet,
                     std::shared_ptr<model::ColorSet> const& pNewColorSet);
 
diff --git a/sd/source/ui/inc/sdundogr.hxx b/sd/source/ui/inc/sdundogr.hxx
index 466182faf422..687b5108b486 100644
--- a/sd/source/ui/inc/sdundogr.hxx
+++ b/sd/source/ui/inc/sdundogr.hxx
@@ -29,8 +29,8 @@ class SD_DLLPUBLIC SdUndoGroup final : public SdUndoAction
 {
     std::vector<std::unique_ptr<SdUndoAction>> aCtn;
 public:
-                   SdUndoGroup(SdDrawDocument* pSdDrawDocument)
-                              : SdUndoAction(pSdDrawDocument)
+                   SdUndoGroup(SdDrawDocument& rSdDrawDocument)
+                              : SdUndoAction(rSdDrawDocument)
                               {}
     virtual       ~SdUndoGroup() override;
 
diff --git a/sd/source/ui/inc/undoheaderfooter.hxx 
b/sd/source/ui/inc/undoheaderfooter.hxx
index a6928a63c205..74c1ba35d0dc 100644
--- a/sd/source/ui/inc/undoheaderfooter.hxx
+++ b/sd/source/ui/inc/undoheaderfooter.hxx
@@ -35,7 +35,7 @@ class SD_DLLPUBLIC SdHeaderFooterUndoAction final : public 
SdUndoAction
     const sd::HeaderFooterSettings  maNewSettings;
 
 public:
-    SdHeaderFooterUndoAction( SdDrawDocument* pDoc, SdPage* pPage, 
sd::HeaderFooterSettings aNewSettings );
+    SdHeaderFooterUndoAction( SdDrawDocument& rDoc, SdPage* pPage, 
sd::HeaderFooterSettings aNewSettings );
     virtual ~SdHeaderFooterUndoAction() override;
 
     virtual void Undo() override;
diff --git a/sd/source/ui/inc/undolayer.hxx b/sd/source/ui/inc/undolayer.hxx
index 7b0d33d9ae9d..131f009bb9e6 100644
--- a/sd/source/ui/inc/undolayer.hxx
+++ b/sd/source/ui/inc/undolayer.hxx
@@ -30,7 +30,7 @@ class SdLayerModifyUndoAction final : public SdUndoAction
 {
 
 public:
-    SdLayerModifyUndoAction( SdDrawDocument* _pDoc, SdrLayer* pLayer,
+    SdLayerModifyUndoAction( SdDrawDocument& rDoc, SdrLayer* pLayer,
     OUString aOldLayerName, OUString aOldLayerTitle, OUString aOldLayerDesc, 
bool bOldIsVisible, bool bOldIsLocked, bool bOldIsPrintable,
     OUString aNewLayerName, OUString aNewLayerTitle, OUString aNewLayerDesc, 
bool bNewIsVisible, bool bNewIsLocked, bool bNewIsPrintable );
 
diff --git a/sd/source/ui/inc/undopage.hxx b/sd/source/ui/inc/undopage.hxx
index 87d5b5b21748..e9d7f1822edb 100644
--- a/sd/source/ui/inc/undopage.hxx
+++ b/sd/source/ui/inc/undopage.hxx
@@ -53,7 +53,7 @@ class SdPageFormatUndoAction final : public SdUndoAction
     bool        mbNewFullSize;
 
 public:
-    SdPageFormatUndoAction( SdDrawDocument* pDoc,
+    SdPageFormatUndoAction( SdDrawDocument& rDoc,
                             SdPage*         pThePage,
                             const Size&     rOldSz,
                             sal_Int32           nOldLft,
@@ -74,7 +74,7 @@ public:
                             sal_uInt16          nNPaperBin,
                             bool            bNFullSize
                             ) :
-        SdUndoAction(pDoc),
+        SdUndoAction(rDoc),
         mpPage      (pThePage),
         maOldSize   (rOldSz),
         mnOldLeft   (nOldLft),
@@ -114,10 +114,10 @@ class SdPageLRUndoAction final : public SdUndoAction
     sal_Int32   mnNewRight;
 
 public:
-    SdPageLRUndoAction( SdDrawDocument* pDoc, SdPage* pThePage,
+    SdPageLRUndoAction( SdDrawDocument& rDoc, SdPage* pThePage,
                         sal_Int32 nOldLft, sal_Int32 nOldRgt,
                         sal_Int32 nNewLft, sal_Int32 nNewRgt ) :
-        SdUndoAction(pDoc),
+        SdUndoAction(rDoc),
         mpPage      (pThePage),
         mnOldLeft   (nOldLft),
         mnOldRight  (nOldRgt),
@@ -142,10 +142,10 @@ class SdPageULUndoAction final : public SdUndoAction
     sal_Int32   mnNewLower;
 
 public:
-    SdPageULUndoAction( SdDrawDocument* pDoc, SdPage* pThePage,
+    SdPageULUndoAction( SdDrawDocument& rDoc, SdPage* pThePage,
                         sal_Int32 nOldUpr, sal_Int32 nOldLwr,
                         sal_Int32 nNewUpr, sal_Int32 nNewLwr ) :
-        SdUndoAction(pDoc),
+        SdUndoAction(rDoc),
         mpPage      (pThePage),
         mnOldUpper  (nOldUpr),
         mnOldLower  (nOldLwr),
diff --git a/sd/source/ui/inc/unmodpg.hxx b/sd/source/ui/inc/unmodpg.hxx
index 02920c27ab1c..148e27f6c59c 100644
--- a/sd/source/ui/inc/unmodpg.hxx
+++ b/sd/source/ui/inc/unmodpg.hxx
@@ -43,7 +43,7 @@ class ModifyPageUndoAction final : public SdUndoAction
 
 public:
     ModifyPageUndoAction(
-        SdDrawDocument*         pTheDoc,
+        SdDrawDocument&         rTheDoc,
         SdPage*                 pThePage,
         const OUString&         aTheNewName,
         AutoLayout              eTheNewAutoLayout,
@@ -58,12 +58,12 @@ public:
 class ChangeSlideExclusionStateUndoAction final : public SdUndoAction
 {
 public:
-    ChangeSlideExclusionStateUndoAction(SdDrawDocument* pDocument,
+    ChangeSlideExclusionStateUndoAction(SdDrawDocument& rDocument,
                                         const 
sd::slidesorter::model::PageDescriptor::State eState,
                                         const bool bOldStateValue);
 
     ChangeSlideExclusionStateUndoAction(
-        SdDrawDocument* pDocument, const 
sd::slidesorter::model::SharedPageDescriptor& rpDescriptor,
+        SdDrawDocument& rDocument, const 
sd::slidesorter::model::SharedPageDescriptor& rpDescriptor,
         const sd::slidesorter::model::PageDescriptor::State eState, const bool 
bOldStateValue);
 
     virtual void Undo() override;
@@ -84,7 +84,7 @@ class RenameLayoutTemplateUndoAction final : public 
SdUndoAction
 {
 public:
     RenameLayoutTemplateUndoAction(
-        SdDrawDocument* pDocument,
+        SdDrawDocument& rDocument,
         OUString aOldLayoutName,
         OUString aNewLayoutName);
 
diff --git a/sd/source/ui/inc/unmovss.hxx b/sd/source/ui/inc/unmovss.hxx
index 93e87cd407b2..5e96d95fb204 100644
--- a/sd/source/ui/inc/unmovss.hxx
+++ b/sd/source/ui/inc/unmovss.hxx
@@ -32,7 +32,7 @@ class SdMoveStyleSheetsUndoAction final : public SdUndoAction
     bool                                mbMySheets;
 
 public:
-    SdMoveStyleSheetsUndoAction(SdDrawDocument* pTheDoc, 
StyleSheetCopyResultVector& rTheStyles, bool bInserted);
+    SdMoveStyleSheetsUndoAction(SdDrawDocument& rTheDoc, 
StyleSheetCopyResultVector& rTheStyles, bool bInserted);
 
     virtual ~SdMoveStyleSheetsUndoAction() override;
     virtual void Undo() override;
diff --git a/sd/source/ui/inc/unoaprms.hxx b/sd/source/ui/inc/unoaprms.hxx
index 9ad32766842a..28b9b613f6b4 100644
--- a/sd/source/ui/inc/unoaprms.hxx
+++ b/sd/source/ui/inc/unoaprms.hxx
@@ -69,9 +69,9 @@ class SdAnimationPrmsUndoAction final : public SdUndoAction
     bool            bInfoCreated;
 
 public:
-    SdAnimationPrmsUndoAction(SdDrawDocument* pTheDoc, SdrObject* pObj,
+    SdAnimationPrmsUndoAction(SdDrawDocument& rTheDoc, SdrObject* pObj,
                                   bool bCreated)
-        : SdUndoAction(pTheDoc)
+        : SdUndoAction(rTheDoc)
         , pObject(pObj)
         , bOldActive(false)
         , bNewActive(false)
diff --git a/sd/source/ui/inc/unprlout.hxx b/sd/source/ui/inc/unprlout.hxx
index 8d75204f195f..c1e7b24917d0 100644
--- a/sd/source/ui/inc/unprlout.hxx
+++ b/sd/source/ui/inc/unprlout.hxx
@@ -37,7 +37,7 @@ class SdPresentationLayoutUndoAction final : public 
SdUndoAction
     OUString        aComment;
 
 public:
-    SdPresentationLayoutUndoAction(SdDrawDocument* pTheDoc,
+    SdPresentationLayoutUndoAction(SdDrawDocument& rTheDoc,
                          const OUString& aTheOldLayoutName,
                          const OUString& aTheNewLayoutName,
                          AutoLayout      eTheOldAutoLayout,
diff --git a/sd/source/ui/sidebar/DocumentHelper.cxx 
b/sd/source/ui/sidebar/DocumentHelper.cxx
index 303ceb58850b..334c1372c407 100644
--- a/sd/source/ui/sidebar/DocumentHelper.cxx
+++ b/sd/source/ui/sidebar/DocumentHelper.cxx
@@ -270,7 +270,7 @@ void DocumentHelper::ProvideStyles (
         {
             pUndoManager->AddUndoAction (
                std::make_unique<SdMoveStyleSheetsUndoAction>(
-                   &rTargetDocument,
+                   rTargetDocument,
                    aCreatedStyles,
                    true));
         }
diff --git a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx 
b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
index f237b9d73227..8b83d8e9bd7a 100644
--- a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
@@ -999,7 +999,7 @@ bool SlotManager::RenameSlideFromDrawViewShell( sal_uInt16 
nPageId, const OUStri
             // (#67720#)
             pManager->AddUndoAction(
                 std::make_unique<ModifyPageUndoAction>(
-                    pDocument, pUndoPage, rName, pUndoPage->GetAutoLayout(),
+                    *pDocument, pUndoPage, rName, pUndoPage->GetAutoLayout(),
                     aVisibleLayers.IsSet( nBackground ),
                     aVisibleLayers.IsSet( nBgObj )));
 
@@ -1019,7 +1019,7 @@ bool SlotManager::RenameSlideFromDrawViewShell( 
sal_uInt16 nPageId, const OUStri
         if (pPageToRename != nullptr)
         {
             const OUString aOldLayoutName( pPageToRename->GetLayoutName() );
-            pManager->AddUndoAction( 
std::make_unique<RenameLayoutTemplateUndoAction>( pDocument, aOldLayoutName, 
rName ) );
+            pManager->AddUndoAction( 
std::make_unique<RenameLayoutTemplateUndoAction>( *pDocument, aOldLayoutName, 
rName ) );
             pDocument->RenameLayoutTemplate( aOldLayoutName, rName );
         }
     }
@@ -1172,7 +1172,7 @@ void SlotManager::ChangeSlideExclusionState (
             model::PageDescriptor::ST_Excluded,
             bExcludeSlide);
         
pManager->AddUndoAction(std::make_unique<ChangeSlideExclusionStateUndoAction>(
-            pDocument, rpDescriptor, model::PageDescriptor::ST_Excluded, 
!bExcludeSlide));
+            *pDocument, rpDescriptor, model::PageDescriptor::ST_Excluded, 
!bExcludeSlide));
     }
     else
     {
@@ -1180,7 +1180,7 @@ void SlotManager::ChangeSlideExclusionState (
             model::PageEnumerationProvider::CreateSelectedPagesEnumeration(
                 mrSlideSorter.GetModel()));
         std::unique_ptr<ChangeSlideExclusionStateUndoAction> 
pChangeSlideExclusionStateUndoAction(
-            new ChangeSlideExclusionStateUndoAction(pDocument, 
model::PageDescriptor::ST_Excluded,
+            new ChangeSlideExclusionStateUndoAction(*pDocument, 
model::PageDescriptor::ST_Excluded,
                                                     !bExcludeSlide));
         while (aSelectedPages.HasMoreElements())
         {
diff --git a/sd/source/ui/view/ViewShellImplementation.cxx 
b/sd/source/ui/view/ViewShellImplementation.cxx
index b84ff8643ffc..fb3ee159ac1a 100644
--- a/sd/source/ui/view/ViewShellImplementation.cxx
+++ b/sd/source/ui/view/ViewShellImplementation.cxx
@@ -167,7 +167,7 @@ void ViewShell::Implementation::ProcessModifyPageSlot (
             pUndoManager->EnterListAction(aComment, aComment, 0, 
mrViewShell.GetViewShellBase().GetViewShellId());
             pUndoManager->AddUndoAction(
                 std::make_unique<ModifyPageUndoAction>(
-                    pDocument, pUndoPage, aNewName, aNewAutoLayout, bBVisible, 
bBObjsVisible));
+                    *pDocument, pUndoPage, aNewName, aNewAutoLayout, 
bBVisible, bBObjsVisible));
 
             // Clear the selection because the selected object may be removed 
as
             // a result of the assignment of the layout.
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index 0bc3241415c7..a24c5aa049e7 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -2779,7 +2779,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
 
             SfxUndoManager* pManager = GetDoc()->GetDocSh()->GetUndoManager();
             std::unique_ptr<SdLayerModifyUndoAction> pAction( new 
SdLayerModifyUndoAction(
-                GetDoc(),
+                *GetDoc(),
                 pLayer,
                 // old values
                 aOldLayerName,
diff --git a/sd/source/ui/view/drviews3.cxx b/sd/source/ui/view/drviews3.cxx
index 72bc8c760cd6..09ec3e4acf7f 100644
--- a/sd/source/ui/view/drviews3.cxx
+++ b/sd/source/ui/view/drviews3.cxx
@@ -545,7 +545,7 @@ void  DrawViewShell::ExecRuler(SfxRequest& rReq)
         case SID_ATTR_LONG_LRSPACE:
             if (pArgs)
             {
-                std::unique_ptr<SdUndoGroup> pUndoGroup(new 
SdUndoGroup(GetDoc()));
+                std::unique_ptr<SdUndoGroup> pUndoGroup(new 
SdUndoGroup(*GetDoc()));
                 pUndoGroup->SetComment(SdResId(STR_UNDO_CHANGE_PAGEBORDER));
 
                 const SvxLongLRSpaceItem& rLRSpace =
@@ -576,7 +576,7 @@ void  DrawViewShell::ExecRuler(SfxRequest& rReq)
                     for ( i = 0; i < nPageCnt; i++)
                     {
                         SdPage* pPage = GetDoc()->GetSdPage(i, mePageKind);
-                        SdUndoAction* pUndo = new SdPageLRUndoAction(GetDoc(),
+                        SdUndoAction* pUndo = new SdPageLRUndoAction(*GetDoc(),
                                                 pPage,
                                                 pPage->GetLeftBorder(),
                                                 pPage->GetRightBorder(),
@@ -590,7 +590,7 @@ void  DrawViewShell::ExecRuler(SfxRequest& rReq)
                     for (i = 0; i < nPageCnt; i++)
                     {
                         SdPage* pPage = GetDoc()->GetMasterSdPage(i, 
mePageKind);
-                        SdUndoAction* pUndo = new SdPageLRUndoAction(GetDoc(),
+                        SdUndoAction* pUndo = new SdPageLRUndoAction(*GetDoc(),
                                                 pPage,
                                                 pPage->GetLeftBorder(),
                                                 pPage->GetRightBorder(),
@@ -610,7 +610,7 @@ void  DrawViewShell::ExecRuler(SfxRequest& rReq)
         case SID_ATTR_LONG_ULSPACE:
             if (pArgs)
             {
-                std::unique_ptr<SdUndoGroup> pUndoGroup(new 
SdUndoGroup(GetDoc()));
+                std::unique_ptr<SdUndoGroup> pUndoGroup(new 
SdUndoGroup(*GetDoc()));
                 pUndoGroup->SetComment(SdResId(STR_UNDO_CHANGE_PAGEBORDER));
 
                 const SvxLongULSpaceItem& rULSpace =
@@ -642,7 +642,7 @@ void  DrawViewShell::ExecRuler(SfxRequest& rReq)
                     for ( i = 0; i < nPageCnt; i++)
                     {
                         SdPage* pPage = GetDoc()->GetSdPage(i, mePageKind);
-                        SdUndoAction* pUndo = new SdPageULUndoAction(GetDoc(),
+                        SdUndoAction* pUndo = new SdPageULUndoAction(*GetDoc(),
                                                 pPage,
                                                 pPage->GetUpperBorder(),
                                                 pPage->GetLowerBorder(),
@@ -656,7 +656,7 @@ void  DrawViewShell::ExecRuler(SfxRequest& rReq)
                     for (i = 0; i < nPageCnt; i++)
                     {
                         SdPage* pPage = GetDoc()->GetMasterSdPage(i, 
mePageKind);
-                        SdUndoAction* pUndo = new SdPageULUndoAction(GetDoc(),
+                        SdUndoAction* pUndo = new SdPageULUndoAction(*GetDoc(),
                                                 pPage,
                                                 pPage->GetUpperBorder(),
                                                 pPage->GetLowerBorder(),
diff --git a/sd/source/ui/view/drviewsb.cxx b/sd/source/ui/view/drviewsb.cxx
index 0f6d46460153..fdb619733f7d 100644
--- a/sd/source/ui/view/drviewsb.cxx
+++ b/sd/source/ui/view/drviewsb.cxx
@@ -65,7 +65,7 @@ bool DrawViewShell::RenameSlide( sal_uInt16 nPageId, const 
OUString & rName  )
         SfxUndoManager* pManager = GetDoc()->GetDocSh()->GetUndoManager();
         pManager->AddUndoAction(
             std::make_unique<ModifyPageUndoAction>(
-                GetDoc(), pUndoPage, rName, pUndoPage->GetAutoLayout(),
+                *GetDoc(), pUndoPage, rName, pUndoPage->GetAutoLayout(),
                 aVisibleLayers.IsSet( nBackground ),
                 aVisibleLayers.IsSet( nBgObj )));
 
diff --git a/sd/source/ui/view/sdview2.cxx b/sd/source/ui/view/sdview2.cxx
index bb771e5c6149..81f2f5b2b966 100644
--- a/sd/source/ui/view/sdview2.cxx
+++ b/sd/source/ui/view/sdview2.cxx
@@ -760,7 +760,7 @@ sal_Int8 View::ExecuteDrop( const ExecuteDropEvent& rEvt,
                                 }
 
                                 // create undo action with old and new sizes
-                                std::unique_ptr<SdAnimationPrmsUndoAction> 
pAction(new SdAnimationPrmsUndoAction(&mrDoc, pPickObj, bCreated));
+                                std::unique_ptr<SdAnimationPrmsUndoAction> 
pAction(new SdAnimationPrmsUndoAction(mrDoc, pPickObj, bCreated));
                                 pAction->SetActive(pInfo->mbActive, 
pInfo->mbActive);
                                 pAction->SetEffect(pInfo->meEffect, 
pInfo->meEffect);
                                 pAction->SetTextEffect(pInfo->meTextEffect, 
pInfo->meTextEffect);
diff --git a/sd/source/ui/view/unmodpg.cxx b/sd/source/ui/view/unmodpg.cxx
index 8ed7837b79ec..6b7a339b36ba 100644
--- a/sd/source/ui/view/unmodpg.cxx
+++ b/sd/source/ui/view/unmodpg.cxx
@@ -44,13 +44,13 @@
 #include <view/SlideSorterView.hxx>
 
 ModifyPageUndoAction::ModifyPageUndoAction(
-    SdDrawDocument* pTheDoc,
+    SdDrawDocument& rTheDoc,
     SdPage* pThePage,
     const OUString& aTheNewName,
     AutoLayout  eTheNewAutoLayout,
     bool bTheNewBckgrndVisible,
     bool bTheNewBckgrndObjsVisible)
-:   SdUndoAction(pTheDoc)
+:   SdUndoAction(rTheDoc)
 {
     DBG_ASSERT(pThePage, "Undo without a page???");
 
@@ -65,7 +65,7 @@ ModifyPageUndoAction::ModifyPageUndoAction(
     if (!mpPage->IsMasterPage())
     {
         maOldName = mpPage->GetName();
-        SdrLayerAdmin& rLayerAdmin = mpDoc->GetLayerAdmin();
+        SdrLayerAdmin& rLayerAdmin = mrDoc.GetLayerAdmin();
         SdrLayerID aBckgrnd = 
rLayerAdmin.GetLayerID(sUNO_LayerName_background);
         SdrLayerID aBckgrndObj = 
rLayerAdmin.GetLayerID(sUNO_LayerName_background_objects);
         SdrLayerIDSet aVisibleLayers = 
mpPage->TRG_GetMasterPageVisibleLayers();
@@ -79,7 +79,7 @@ ModifyPageUndoAction::ModifyPageUndoAction(
         mbOldBckgrndObjsVisible = false;
     }
 
-    if (pTheDoc && pTheDoc->GetDocumentType() == DocumentType::Draw)
+    if (rTheDoc.GetDocumentType() == DocumentType::Draw)
         SetComment( SdResId(STR_UNDO_MODIFY_PAGE_DRAW) );
     else
         SetComment( SdResId(STR_UNDO_MODIFY_PAGE) );
@@ -106,12 +106,12 @@ void ModifyPageUndoAction::Undo()
 
             if (mpPage->GetPageKind() == PageKind::Standard)
             {
-                SdPage* pNotesPage = 
static_cast<SdPage*>(mpDoc->GetPage(mpPage->GetPageNum() + 1));
+                SdPage* pNotesPage = 
static_cast<SdPage*>(mrDoc.GetPage(mpPage->GetPageNum() + 1));
                 pNotesPage->SetName(maOldName);
             }
         }
 
-        SdrLayerAdmin& rLayerAdmin = mpDoc->GetLayerAdmin();
+        SdrLayerAdmin& rLayerAdmin = mrDoc.GetLayerAdmin();
         SdrLayerID aBckgrnd = 
rLayerAdmin.GetLayerID(sUNO_LayerName_background);
         SdrLayerID aBckgrndObj = 
rLayerAdmin.GetLayerID(sUNO_LayerName_background_objects);
         SdrLayerIDSet aVisibleLayers;
@@ -150,12 +150,12 @@ void ModifyPageUndoAction::Redo()
 
             if (mpPage->GetPageKind() == PageKind::Standard)
             {
-                SdPage* pNotesPage = 
static_cast<SdPage*>(mpDoc->GetPage(mpPage->GetPageNum() + 1));
+                SdPage* pNotesPage = 
static_cast<SdPage*>(mrDoc.GetPage(mpPage->GetPageNum() + 1));
                 pNotesPage->SetName(maNewName);
             }
         }
 
-        SdrLayerAdmin& rLayerAdmin = mpDoc->GetLayerAdmin();
+        SdrLayerAdmin& rLayerAdmin = mrDoc.GetLayerAdmin();
         SdrLayerID aBckgrnd = 
rLayerAdmin.GetLayerID(sUNO_LayerName_background);
         SdrLayerID aBckgrndObj = 
rLayerAdmin.GetLayerID(sUNO_LayerName_background_objects);
         SdrLayerIDSet aVisibleLayers;
@@ -178,9 +178,9 @@ ModifyPageUndoAction::~ModifyPageUndoAction()
 }
 
 ChangeSlideExclusionStateUndoAction::ChangeSlideExclusionStateUndoAction(
-    SdDrawDocument* pDocument, const 
sd::slidesorter::model::PageDescriptor::State eState,
+    SdDrawDocument& rDocument, const 
sd::slidesorter::model::PageDescriptor::State eState,
     const bool bOldStateValue)
-    : SdUndoAction(pDocument)
+    : SdUndoAction(rDocument)
     , meState(eState)
     , mbOldStateValue(bOldStateValue)
     , maComment(bOldStateValue ? SdResId(STR_UNDO_SHOW_SLIDE) : 
SdResId(STR_UNDO_HIDE_SLIDE))
@@ -188,9 +188,9 @@ 
ChangeSlideExclusionStateUndoAction::ChangeSlideExclusionStateUndoAction(
 }
 
 ChangeSlideExclusionStateUndoAction::ChangeSlideExclusionStateUndoAction(
-    SdDrawDocument* pDocument, const 
sd::slidesorter::model::SharedPageDescriptor& rpDescriptor,
+    SdDrawDocument& rDocument, const 
sd::slidesorter::model::SharedPageDescriptor& rpDescriptor,
     const sd::slidesorter::model::PageDescriptor::State eState, const bool 
bOldStateValue)
-    : ChangeSlideExclusionStateUndoAction(pDocument, eState, bOldStateValue)
+    : ChangeSlideExclusionStateUndoAction(rDocument, eState, bOldStateValue)
 {
     mrpDescriptors.push_back(rpDescriptor);
 }
@@ -203,7 +203,7 @@ void ChangeSlideExclusionStateUndoAction::AddPageDescriptor(
 
 void ChangeSlideExclusionStateUndoAction::Undo()
 {
-    sd::DrawDocShell* pDocShell = mpDoc ? mpDoc->GetDocSh() : nullptr;
+    sd::DrawDocShell* pDocShell = mrDoc.GetDocSh();
     sd::ViewShell* pViewShell = pDocShell ? pDocShell->GetViewShell() : 
nullptr;
     if (pViewShell)
     {
@@ -220,7 +220,7 @@ void ChangeSlideExclusionStateUndoAction::Undo()
 
 void ChangeSlideExclusionStateUndoAction::Redo()
 {
-    sd::DrawDocShell* pDocShell = mpDoc ? mpDoc->GetDocSh() : nullptr;
+    sd::DrawDocShell* pDocShell = mrDoc.GetDocSh();
     sd::ViewShell* pViewShell = pDocShell ? pDocShell->GetViewShell() : 
nullptr;
     if (pViewShell)
     {
@@ -241,10 +241,10 @@ OUString 
ChangeSlideExclusionStateUndoAction::GetComment() const
 }
 
 RenameLayoutTemplateUndoAction::RenameLayoutTemplateUndoAction(
-    SdDrawDocument* pDocument,
+    SdDrawDocument& rDocument,
     OUString aOldLayoutName,
     OUString aNewLayoutName)
-    : SdUndoAction(pDocument)
+    : SdUndoAction(rDocument)
     , maOldName(std::move(aOldLayoutName))
     , maNewName(std::move(aNewLayoutName))
     , maComment(SdResId(STR_TITLE_RENAMESLIDE))
@@ -257,13 +257,13 @@ 
RenameLayoutTemplateUndoAction::RenameLayoutTemplateUndoAction(
 void RenameLayoutTemplateUndoAction::Undo()
 {
     OUString aLayoutName(maNewName + SD_LT_SEPARATOR + STR_LAYOUT_OUTLINE);
-    mpDoc->RenameLayoutTemplate( aLayoutName, maOldName );
+    mrDoc.RenameLayoutTemplate( aLayoutName, maOldName );
 }
 
 void RenameLayoutTemplateUndoAction::Redo()
 {
     OUString aLayoutName(maOldName + SD_LT_SEPARATOR + STR_LAYOUT_OUTLINE);
-    mpDoc->RenameLayoutTemplate( aLayoutName, maNewName );
+    mrDoc.RenameLayoutTemplate( aLayoutName, maNewName );
 }
 
 OUString RenameLayoutTemplateUndoAction::GetComment() const
diff --git a/sd/source/ui/view/viewshe2.cxx b/sd/source/ui/view/viewshe2.cxx
index 3c68f3ac20da..0017fa3eca60 100644
--- a/sd/source/ui/view/viewshe2.cxx
+++ b/sd/source/ui/view/viewshe2.cxx
@@ -530,7 +530,7 @@ void ViewShell::SetPageSizeAndBorder(PageKind ePageKind, 
const Size& rNewSize,
     SfxViewShell* pViewShell(GetViewShell());
     if (pViewShell)
     {
-        pUndoGroup.reset(new SdUndoGroup(GetDoc()));
+        pUndoGroup.reset(new SdUndoGroup(*GetDoc()));
         pUndoGroup->SetComment(SdResId(STR_UNDO_CHANGE_PAGEFORMAT));
     }
     Broadcast (ViewShellHint(ViewShellHint::HINT_PAGE_RESIZE_START));

Reply via email to