sd/inc/sdabstdlg.hxx                                   |    8 +-
 sd/qa/unit/dialogs-test.cxx                            |    8 +-
 sd/source/ui/dlg/PhotoAlbumDialog.cxx                  |   14 +--
 sd/source/ui/dlg/PhotoAlbumDialog.hxx                  |    4 -
 sd/source/ui/dlg/headerfooterdlg.cxx                   |   60 ++++++++---------
 sd/source/ui/dlg/inspagob.cxx                          |   10 +-
 sd/source/ui/dlg/masterlayoutdlg.cxx                   |   10 +-
 sd/source/ui/dlg/sddlgfact.cxx                         |   16 ++--
 sd/source/ui/dlg/sddlgfact.hxx                         |    8 +-
 sd/source/ui/func/fuinsfil.cxx                         |    4 -
 sd/source/ui/inc/headerfooterdlg.hxx                   |    4 -
 sd/source/ui/inc/inspagob.hxx                          |    4 -
 sd/source/ui/inc/masterlayoutdlg.hxx                   |    4 -
 sd/source/ui/slidesorter/controller/SlsSlotManager.cxx |    2 
 sd/source/ui/view/NotesPanelViewShell.cxx              |    2 
 sd/source/ui/view/drviews2.cxx                         |    2 
 sd/source/ui/view/drviews3.cxx                         |    4 -
 sd/source/ui/view/outlnvs2.cxx                         |    2 
 18 files changed, 83 insertions(+), 83 deletions(-)

New commits:
commit 4814e4ead16053accc2e95cda6a6411c54c516c8
Author:     Xisco Fauli <[email protected]>
AuthorDate: Tue Jun 10 09:52:12 2025 +0200
Commit:     Xisco Fauli <[email protected]>
CommitDate: Tue Jun 10 12:10:08 2025 +0200

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

diff --git a/sd/inc/sdabstdlg.hxx b/sd/inc/sdabstdlg.hxx
index 2cb49786b027..086cc6ab438b 100644
--- a/sd/inc/sdabstdlg.hxx
+++ b/sd/inc/sdabstdlg.hxx
@@ -167,7 +167,7 @@ public:
     virtual VclPtr<AbstractSdModifyFieldDlg>   
CreateSdModifyFieldDlg(weld::Window* pWindow, const SvxFieldData* pInField, 
const SfxItemSet& rSet) = 0;
     virtual VclPtr<AbstractSdSnapLineDlg>      
CreateSdSnapLineDlg(weld::Window* pParent, const SfxItemSet& rInAttrs, 
::sd::View* pView) = 0;
     virtual VclPtr<AbstractSdInsertLayerDlg>   
CreateSdInsertLayerDlg(weld::Window* pParent, const SfxItemSet& rInAttrs, bool 
bDeletable, const OUString& rStr) = 0;
-    virtual VclPtr<AbstractSdInsertPagesObjsDlg> 
CreateSdInsertPagesObjsDlg(weld::Window* pParent, const SdDrawDocument* pDoc, 
SfxMedium* pSfxMedium, const OUString& rFileName) = 0;
+    virtual VclPtr<AbstractSdInsertPagesObjsDlg> 
CreateSdInsertPagesObjsDlg(weld::Window* pParent, const SdDrawDocument& rDoc, 
SfxMedium* pSfxMedium, const OUString& rFileName) = 0;
     virtual VclPtr<AbstractMorphDlg>           CreateMorphDlg(weld::Window* 
pParent, const SdrObject* pObj1, const SdrObject* pObj2) = 0;
     virtual VclPtr<SfxAbstractTabDialog>       
CreateSdOutlineBulletTabDlg(weld::Window* pParent, const SfxItemSet* pAttr, 
::sd::View* pView) = 0;
     virtual VclPtr<SfxAbstractTabDialog>       
CreateSdParagraphTabDlg(weld::Window* pWindow, const SfxItemSet* pAttr) = 0;
@@ -180,11 +180,11 @@ public:
     virtual VclPtr<SfxAbstractDialog>          
CreatSdActionDialog(weld::Window* pParent, const SfxItemSet& rAttr, ::sd::View* 
pView) = 0;
     virtual VclPtr<AbstractSdVectorizeDlg>     
CreateSdVectorizeDlg(weld::Window* pParent, const Bitmap& rBmp, 
::sd::DrawDocShell* pDocShell) = 0;
 
-    virtual VclPtr<VclAbstractDialog>          
CreateMasterLayoutDialog(weld::Window* pParent, SdDrawDocument* pDoc, SdPage*) 
= 0;
+    virtual VclPtr<VclAbstractDialog>          
CreateMasterLayoutDialog(weld::Window* pParent, SdDrawDocument& rDoc, SdPage*) 
= 0;
 
     virtual VclPtr<AbstractHeaderFooterDialog> 
CreateHeaderFooterDialog(sd::ViewShell& rViewShell,
                                                                         
weld::Window* pParent,
-                                                                        
SdDrawDocument* pDoc,
+                                                                        
SdDrawDocument& rDoc,
                                                                         
SdPage* pCurrentPage) = 0;
 
     virtual CreateTabPage               
GetSdOptionsContentsTabPageCreatorFunc() = 0;
@@ -192,7 +192,7 @@ public:
     virtual CreateTabPage               GetSdOptionsMiscTabPageCreatorFunc() = 
0;
     virtual CreateTabPage               GetSdOptionsSnapTabPageCreatorFunc() = 
0;
 
-    virtual VclPtr<VclAbstractDialog> CreateSdPhotoAlbumDialog(weld::Window* 
pWindow, SdDrawDocument* pDoc) = 0;
+    virtual VclPtr<VclAbstractDialog> CreateSdPhotoAlbumDialog(weld::Window* 
pWindow, SdDrawDocument& rDoc) = 0;
 
 protected:
     ~SdAbstractDialogFactory() {}
diff --git a/sd/qa/unit/dialogs-test.cxx b/sd/qa/unit/dialogs-test.cxx
index 26b88712bb88..de58b5bd63a7 100644
--- a/sd/qa/unit/dialogs-test.cxx
+++ b/sd/qa/unit/dialogs-test.cxx
@@ -349,7 +349,7 @@ VclPtr<VclAbstractDialog> 
SdDialogsTest::createDialogByID(sal_uInt32 nID)
             CPPUNIT_ASSERT(pDrawDoc);
             pRetval = getSdAbstractDialogFactory()->CreateSdInsertPagesObjsDlg(
                 getViewShell()->GetFrameWeld(),
-                pDrawDoc,
+                *pDrawDoc,
                 nullptr,
                 u"foo"_ustr);
             break;
@@ -517,7 +517,7 @@ VclPtr<VclAbstractDialog> 
SdDialogsTest::createDialogByID(sal_uInt32 nID)
             CPPUNIT_ASSERT(pDrawDoc);
             pRetval = getSdAbstractDialogFactory()->CreateSdPhotoAlbumDialog(
                 Application::GetDefDialogParent(),
-                pDrawDoc);
+                *pDrawDoc);
             break;
         }
         case 20:
@@ -529,7 +529,7 @@ VclPtr<VclAbstractDialog> 
SdDialogsTest::createDialogByID(sal_uInt32 nID)
             CPPUNIT_ASSERT(pSdPage);
             pRetval = getSdAbstractDialogFactory()->CreateMasterLayoutDialog(
                 Application::GetDefDialogParent(),
-                pDrawDoc,
+                *pDrawDoc,
                 pSdPage);
             break;
         }
@@ -549,7 +549,7 @@ VclPtr<VclAbstractDialog> 
SdDialogsTest::createDialogByID(sal_uInt32 nID)
             pRetval = getSdAbstractDialogFactory()->CreateHeaderFooterDialog(
                 *getViewShell(),
                 Application::GetDefDialogParent(),
-                pDrawDoc,
+                *pDrawDoc,
                 pSdPage);
             break;
         }
diff --git a/sd/source/ui/dlg/PhotoAlbumDialog.cxx 
b/sd/source/ui/dlg/PhotoAlbumDialog.cxx
index 870c6d64f56a..e15b8fc954b6 100644
--- a/sd/source/ui/dlg/PhotoAlbumDialog.cxx
+++ b/sd/source/ui/dlg/PhotoAlbumDialog.cxx
@@ -38,9 +38,9 @@
 namespace sd
 {
 
-SdPhotoAlbumDialog::SdPhotoAlbumDialog(weld::Window* pWindow, SdDrawDocument* 
pActDoc)
+SdPhotoAlbumDialog::SdPhotoAlbumDialog(weld::Window* pWindow, SdDrawDocument& 
rDoc)
     : GenericDialogController(pWindow, 
u"modules/simpress/ui/photoalbum.ui"_ustr, u"PhotoAlbumCreatorDialog"_ustr)
-    , m_pDoc(pActDoc)
+    , m_rDoc(rDoc)
     , m_aImg(m_xDialog.get())
     , m_xCancelBtn(m_xBuilder->weld_button(u"cancel"_ustr))
     , m_xCreateBtn(m_xBuilder->weld_button(u"ok"_ustr))
@@ -93,9 +93,9 @@ IMPL_LINK_NOARG(SdPhotoAlbumDialog, CreateHdl, weld::Button&, 
void)
     }
     else
     {
-        rtl::Reference< SdXImpressDocument > xDPS( m_pDoc->getUnoModel() );
+        rtl::Reference< SdXImpressDocument > xDPS( m_rDoc.getUnoModel() );
         Reference< drawing::XDrawPages > xDrawPages = xDPS->getDrawPages();
-        rtl::Reference< SdXImpressDocument > xShapeFactory( 
m_pDoc->getUnoModel() );
+        rtl::Reference< SdXImpressDocument > xShapeFactory( 
m_rDoc.getUnoModel() );
 
         const Reference< XComponentContext >& 
xContext(::comphelper::getProcessComponentContext());
         Reference< graphic::XGraphicProvider> 
xProvider(graphic::GraphicProvider::create(xContext));
@@ -639,7 +639,7 @@ Reference< drawing::XDrawPage > 
SdPhotoAlbumDialog::appendNewSlide(AutoLayout aL
 {
     // Create the slide
     Reference< drawing::XDrawPage > xSlide = xDrawPages->insertNewByIndex( 
xDrawPages->getCount() );
-    SdPage* pSlide = m_pDoc->GetSdPage( 
m_pDoc->GetSdPageCount(PageKind::Standard)-1, PageKind::Standard);
+    SdPage* pSlide = m_rDoc.GetSdPage( 
m_rDoc.GetSdPageCount(PageKind::Standard)-1, PageKind::Standard);
     pSlide->SetAutoLayout(aLayout, true); // Set the layout here
     return xSlide;
 }
@@ -714,7 +714,7 @@ void SdPhotoAlbumDialog::createCaption(const awt::Size& 
aPageSize )
     CapSize.setHeight( aPageSize.Height/6 );
     CapPos.setX( 0 );
     CapPos.setY( aPageSize.Height - CapSize.Height() );
-    SdPage* pSlide = m_pDoc->GetSdPage( 
m_pDoc->GetSdPageCount(PageKind::Standard)-1, PageKind::Standard );
+    SdPage* pSlide = m_rDoc.GetSdPage( 
m_rDoc.GetSdPageCount(PageKind::Standard)-1, PageKind::Standard );
 
     // try to get existing PresObj
     const ::tools::Rectangle rRect(CapPos,CapSize);
@@ -741,7 +741,7 @@ void SdPhotoAlbumDialog::createCaption(const awt::Size& 
aPageSize )
     if(pSdrObj)
     {
         // set color, style and some transparency
-        SfxItemSet aSet(m_pDoc->GetItemPool() );
+        SfxItemSet aSet(m_rDoc.GetItemPool() );
 
         aSet.Put( XFillStyleItem(drawing::FillStyle_SOLID) );
         aSet.Put( XFillColorItem( u""_ustr, COL_BLACK ) );
diff --git a/sd/source/ui/dlg/PhotoAlbumDialog.hxx 
b/sd/source/ui/dlg/PhotoAlbumDialog.hxx
index 8da601133c15..1691d3c7c0ef 100644
--- a/sd/source/ui/dlg/PhotoAlbumDialog.hxx
+++ b/sd/source/ui/dlg/PhotoAlbumDialog.hxx
@@ -33,11 +33,11 @@ namespace sd
 class SdPhotoAlbumDialog : public weld::GenericDialogController
 {
 public:
-    SdPhotoAlbumDialog(weld::Window* pWindow, SdDrawDocument* pActDoc);
+    SdPhotoAlbumDialog(weld::Window* pWindow, SdDrawDocument& rDoc);
     virtual ~SdPhotoAlbumDialog() override;
 
 private:
-    SdDrawDocument* m_pDoc;
+    SdDrawDocument& m_rDoc;
     std::unique_ptr<GraphicFilter> m_pGraphicFilter;
 
     GraphCtrl m_aImg;
diff --git a/sd/source/ui/dlg/headerfooterdlg.cxx 
b/sd/source/ui/dlg/headerfooterdlg.cxx
index 7a30848d3a51..f25bdbbd970b 100644
--- a/sd/source/ui/dlg/headerfooterdlg.cxx
+++ b/sd/source/ui/dlg/headerfooterdlg.cxx
@@ -118,7 +118,7 @@ DateAndTimeFormat const 
nDateTimeFormats[nDateTimeFormatsCount] =
 class HeaderFooterTabPage
 {
 private:
-    SdDrawDocument*     mpDoc;
+    SdDrawDocument&     mrDoc;
     LanguageType        meOldLanguage;
     bool                mbHandoutMode;
 
@@ -155,7 +155,7 @@ private:
     bool GetOrSetDateTimeLanguage(LanguageType& rLanguage, bool bSet, SdPage* 
pPage);
 
 public:
-    HeaderFooterTabPage(weld::Container* pParent, SdDrawDocument* pDoc, 
SdPage* pActualPage, bool bHandoutMode );
+    HeaderFooterTabPage(weld::Container* pParent, SdDrawDocument& rDoc, 
SdPage* pActualPage, bool bHandoutMode );
 
     void    init( const HeaderFooterSettings& rSettings, bool bNotOnTitle );
     void    getData( HeaderFooterSettings& rSettings, bool& rNotOnTitle );
@@ -166,9 +166,9 @@ public:
 
 using namespace ::sd;
 
-HeaderFooterDialog::HeaderFooterDialog(ViewShell& rViewShell, weld::Window* 
pParent, SdDrawDocument* pDoc, SdPage* pCurrentPage)
+HeaderFooterDialog::HeaderFooterDialog(ViewShell& rViewShell, weld::Window* 
pParent, SdDrawDocument& rDoc, SdPage* pCurrentPage)
     : GenericDialogController(pParent, 
u"modules/simpress/ui/headerfooterdialog.ui"_ustr, u"HeaderFooterDialog"_ustr)
-    , mpDoc( pDoc )
+    , mrDoc( rDoc )
     , mpCurrentPage( pCurrentPage )
     , mrViewShell( rViewShell )
     , mxTabCtrl(m_xBuilder->weld_notebook(u"tabcontrol"_ustr))
@@ -181,26 +181,26 @@ HeaderFooterDialog::HeaderFooterDialog(ViewShell& 
rViewShell, weld::Window* pPar
     if( pCurrentPage->GetPageKind() == PageKind::Standard )
     {
         pSlide = pCurrentPage;
-        pNotes = static_cast<SdPage*>(pDoc->GetPage( 
pCurrentPage->GetPageNum() + 1 ));
+        pNotes = static_cast<SdPage*>(rDoc.GetPage( pCurrentPage->GetPageNum() 
+ 1 ));
     }
     else if( pCurrentPage->GetPageKind() == PageKind::Notes )
     {
         pNotes = pCurrentPage;
-        pSlide = static_cast<SdPage*>(pDoc->GetPage( 
pCurrentPage->GetPageNum() -1 ));
+        pSlide = static_cast<SdPage*>(rDoc.GetPage( pCurrentPage->GetPageNum() 
-1 ));
         mpCurrentPage = pSlide;
     }
     else
     {
         // handout
-        pSlide = pDoc->GetSdPage( 0, PageKind::Standard );
-        pNotes = pDoc->GetSdPage( 0, PageKind::Notes );
+        pSlide = rDoc.GetSdPage( 0, PageKind::Standard );
+        pNotes = rDoc.GetSdPage( 0, PageKind::Notes );
         mpCurrentPage = nullptr;
     }
 
-    mxSlideTabPage.reset(new 
HeaderFooterTabPage(mxTabCtrl->get_page(u"slides"_ustr), pDoc, pSlide, false));
-    mxNotesHandoutsTabPage.reset(new 
HeaderFooterTabPage(mxTabCtrl->get_page(u"notes"_ustr), pDoc, pNotes, true));
+    mxSlideTabPage.reset(new 
HeaderFooterTabPage(mxTabCtrl->get_page(u"slides"_ustr), rDoc, pSlide, false));
+    mxNotesHandoutsTabPage.reset(new 
HeaderFooterTabPage(mxTabCtrl->get_page(u"notes"_ustr), rDoc, pNotes, true));
 
-    pDoc->StopWorkStartupDelay();
+    rDoc.StopWorkStartupDelay();
     mxTabCtrl->show();
 
     ActivatePageHdl(mxTabCtrl->get_current_page_ident());
@@ -213,7 +213,7 @@ HeaderFooterDialog::HeaderFooterDialog(ViewShell& 
rViewShell, weld::Window* pPar
 
     maSlideSettings = pSlide->getHeaderFooterSettings();
 
-    const HeaderFooterSettings& rTitleSettings = mpDoc->GetSdPage(0, 
PageKind::Standard)->getHeaderFooterSettings();
+    const HeaderFooterSettings& rTitleSettings = mrDoc.GetSdPage(0, 
PageKind::Standard)->getHeaderFooterSettings();
     bool bNotOnTitle = !rTitleSettings.mbFooterVisible && 
!rTitleSettings.mbSlideNumberVisible && !rTitleSettings.mbDateTimeVisible;
 
     mxSlideTabPage->init( maSlideSettings, bNotOnTitle );
@@ -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(mrDoc));
     OUString aComment( m_xDialog->get_title() );
     pUndoGroup->SetComment( aComment );
 
@@ -289,11 +289,11 @@ void HeaderFooterDialog::apply( bool bToAll, bool 
bForceSlides )
         // apply to all slides
         if( bToAll )
         {
-            int nPageCount = mpDoc->GetSdPageCount( PageKind::Standard );
+            int nPageCount = mrDoc.GetSdPageCount( PageKind::Standard );
             int nPage;
             for( nPage = 0; nPage < nPageCount; nPage++ )
             {
-                SdPage* pPage = mpDoc->GetSdPage( 
static_cast<sal_uInt16>(nPage), PageKind::Standard );
+                SdPage* pPage = mrDoc.GetSdPage( 
static_cast<sal_uInt16>(nPage), PageKind::Standard );
                 change( pUndoGroup.get(), pPage, aNewSettings );
             }
         }
@@ -312,13 +312,13 @@ void HeaderFooterDialog::apply( bool bToAll, bool 
bForceSlides )
     if( bNewNotOnTitle )
     {
         // just hide them, plain simple UI feature
-        HeaderFooterSettings aTempSettings = mpDoc->GetSdPage( 0, 
PageKind::Standard )->getHeaderFooterSettings();
+        HeaderFooterSettings aTempSettings = mrDoc.GetSdPage( 0, 
PageKind::Standard )->getHeaderFooterSettings();
 
         aTempSettings.mbFooterVisible = false;
         aTempSettings.mbSlideNumberVisible = false;
         aTempSettings.mbDateTimeVisible = false;
 
-        change( pUndoGroup.get(), mpDoc->GetSdPage( 0, PageKind::Standard ), 
aTempSettings );
+        change( pUndoGroup.get(), mrDoc.GetSdPage( 0, PageKind::Standard ), 
aTempSettings );
     }
 
     // now notes settings
@@ -330,17 +330,17 @@ void HeaderFooterDialog::apply( bool bToAll, bool 
bForceSlides )
     if( !bForceSlides || !(aNewSettings == maNotesHandoutSettings) )
     {
         // first set to all notes pages
-        int nPageCount = mpDoc->GetSdPageCount( PageKind::Notes );
+        int nPageCount = mrDoc.GetSdPageCount( PageKind::Notes );
         int nPage;
         for( nPage = 0; nPage < nPageCount; nPage++ )
         {
-            SdPage* pPage = mpDoc->GetSdPage( static_cast<sal_uInt16>(nPage), 
PageKind::Notes );
+            SdPage* pPage = mrDoc.GetSdPage( static_cast<sal_uInt16>(nPage), 
PageKind::Notes );
 
             change( pUndoGroup.get(), pPage, aNewSettings );
         }
 
         // and last but not least to the handout page
-        change( pUndoGroup.get(), mpDoc->GetMasterSdPage( 0, PageKind::Handout 
), aNewSettings );
+        change( pUndoGroup.get(), mrDoc.GetMasterSdPage( 0, PageKind::Handout 
), aNewSettings );
     }
 
     // give the undo group to the undo manager
@@ -349,12 +349,12 @@ 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(mrDoc, pPage, 
rNewSettings ));
     pPage->setHeaderFooterSettings( rNewSettings );
 }
 
-HeaderFooterTabPage::HeaderFooterTabPage(weld::Container* pParent, 
SdDrawDocument* pDoc, SdPage* pActualPage, bool bHandoutMode)
-    : mpDoc(pDoc)
+HeaderFooterTabPage::HeaderFooterTabPage(weld::Container* pParent, 
SdDrawDocument& rDoc, SdPage* pActualPage, bool bHandoutMode)
+    : mrDoc(rDoc)
     , mbHandoutMode(bHandoutMode)
     , mxBuilder(Application::CreateBuilder(pParent, 
u"modules/simpress/ui/headerfootertab.ui"_ustr))
     , mxContainer(mxBuilder->weld_container(u"HeaderFooterTab"_ustr))
@@ -381,7 +381,7 @@ HeaderFooterTabPage::HeaderFooterTabPage(weld::Container* 
pParent, SdDrawDocumen
 {
     mxCTPreview->init( pActualPage ?
             (pActualPage->IsMasterPage() ? pActualPage : 
static_cast<SdPage*>(&(pActualPage->TRG_GetMasterPage()))) :
-            (pDoc->GetMasterSdPage( 0, bHandoutMode ? PageKind::Notes : 
PageKind::Standard )) );
+            (rDoc.GetMasterSdPage( 0, bHandoutMode ? PageKind::Notes : 
PageKind::Standard )) );
 
     if( mbHandoutMode )
     {
@@ -523,24 +523,24 @@ void HeaderFooterTabPage::GetOrSetDateTimeLanguage( 
LanguageType &rLanguage, boo
         // if set, set it on all notes master pages
         if( bSet )
         {
-            sal_uInt16 nPageCount = mpDoc->GetMasterSdPageCount( 
PageKind::Notes );
+            sal_uInt16 nPageCount = mrDoc.GetMasterSdPageCount( 
PageKind::Notes );
             sal_uInt16 nPage;
             for( nPage = 0; nPage < nPageCount; nPage++ )
             {
-                GetOrSetDateTimeLanguage( rLanguage, bSet, 
mpDoc->GetMasterSdPage( nPage, PageKind::Notes ) );
+                GetOrSetDateTimeLanguage( rLanguage, bSet, 
mrDoc.GetMasterSdPage( nPage, PageKind::Notes ) );
             }
         }
 
         // #i119985# and set it, or just get it from the notes master page
-        GetOrSetDateTimeLanguage( rLanguage, bSet, mpDoc->GetMasterSdPage( 0, 
PageKind::Notes ) );
+        GetOrSetDateTimeLanguage( rLanguage, bSet, mrDoc.GetMasterSdPage( 0, 
PageKind::Notes ) );
     }
     else
     {
-        const sal_uInt16 nPageCount = 
mpDoc->GetMasterSdPageCount(PageKind::Standard);
+        const sal_uInt16 nPageCount = 
mrDoc.GetMasterSdPageCount(PageKind::Standard);
         sal_uInt16 nPage;
         for( nPage = 0; nPage < nPageCount; nPage++ )
         {
-            SdPage* pMasterSlide = mpDoc->GetMasterSdPage(nPage, 
PageKind::Standard);
+            SdPage* pMasterSlide = mrDoc.GetMasterSdPage(nPage, 
PageKind::Standard);
             bool bHasDateFieldItem = GetOrSetDateTimeLanguage(rLanguage, bSet, 
pMasterSlide);
 
             // All pages must use the same language. If getting the language, 
only need to find one.
@@ -560,7 +560,7 @@ bool 
HeaderFooterTabPage::GetOrSetDateTimeLanguage(LanguageType& rLanguage, bool
     if( !pObj )
         return false;
 
-    Outliner* pOutl = mpDoc->GetInternalOutliner();
+    Outliner* pOutl = mrDoc.GetInternalOutliner();
     pOutl->Init( OutlinerMode::TextObject );
     OutlinerMode nOutlMode = pOutl->GetOutlinerMode();
 
diff --git a/sd/source/ui/dlg/inspagob.cxx b/sd/source/ui/dlg/inspagob.cxx
index c246d4132394..caf00b73d384 100644
--- a/sd/source/ui/dlg/inspagob.cxx
+++ b/sd/source/ui/dlg/inspagob.cxx
@@ -29,11 +29,11 @@
 #include <ViewShell.hxx>
 
 SdInsertPagesObjsDlg::SdInsertPagesObjsDlg(
-    weld::Window* pWindow, const SdDrawDocument* pInDoc,
+    weld::Window* pWindow, const SdDrawDocument& rDoc,
     SfxMedium* pSfxMedium, const OUString& rFileName )
     : GenericDialogController(pWindow, 
u"modules/sdraw/ui/insertslidesdialog.ui"_ustr, u"InsertSlidesDialog"_ustr)
     , m_pMedium(pSfxMedium)
-    , m_pDoc(pInDoc)
+    , m_rDoc(rDoc)
     , m_rName(rFileName)
     , m_xLbTree(new SdPageObjsTLV(m_xBuilder->weld_tree_view(u"tree"_ustr)))
     , m_xCbxLink(m_xBuilder->weld_check_button(u"links"_ustr))
@@ -42,14 +42,14 @@ SdInsertPagesObjsDlg::SdInsertPagesObjsDlg(
     m_xLbTree->set_size_request(m_xLbTree->get_approximate_digit_width() * 48,
                                 m_xLbTree->get_height_rows(12));
 
-    m_xLbTree->SetViewFrame( 
pInDoc->GetDocSh()->GetViewShell()->GetViewFrame() );
+    m_xLbTree->SetViewFrame( rDoc.GetDocSh()->GetViewShell()->GetViewFrame() );
 
     m_xLbTree->connect_changed(LINK(this, SdInsertPagesObjsDlg, 
SelectObjectHdl));
 
     // insert text
     if (!m_pMedium)
         m_xDialog->set_title(SdResId(STR_INSERT_TEXT));
-    else if (m_pDoc && m_pDoc->GetDocumentType() == DocumentType::Draw)
+    else if (m_rDoc.GetDocumentType() == DocumentType::Draw)
         m_xDialog->set_title(SdResId(STR_INSERT_PAGES));
 
     Reset();
@@ -70,7 +70,7 @@ void SdInsertPagesObjsDlg::Reset()
         m_xLbTree->set_selection_mode(SelectionMode::Multiple);
 
         // transfer ownership of Medium
-        m_xLbTree->Fill( m_pDoc, m_pMedium, m_rName );
+        m_xLbTree->Fill( &m_rDoc, m_pMedium, m_rName );
     }
     else
     {
diff --git a/sd/source/ui/dlg/masterlayoutdlg.cxx 
b/sd/source/ui/dlg/masterlayoutdlg.cxx
index 5cf702cbd164..c03e84eb6601 100644
--- a/sd/source/ui/dlg/masterlayoutdlg.cxx
+++ b/sd/source/ui/dlg/masterlayoutdlg.cxx
@@ -24,9 +24,9 @@
 
 using namespace ::sd;
 
-MasterLayoutDialog::MasterLayoutDialog(weld::Window* pParent, SdDrawDocument* 
pDoc, SdPage* pCurrentPage)
+MasterLayoutDialog::MasterLayoutDialog(weld::Window* pParent, SdDrawDocument& 
rDoc, SdPage* pCurrentPage)
     : GenericDialogController(pParent, 
u"modules/simpress/ui/masterlayoutdlg.ui"_ustr, u"MasterLayoutDialog"_ustr)
-    , mpDoc(pDoc)
+    , mrDoc(rDoc)
     , mpCurrentPage(pCurrentPage)
     , mxCBDate(m_xBuilder->weld_check_button(u"datetime"_ustr))
     , mxCBPageNumber(m_xBuilder->weld_check_button(u"pagenumber"_ustr))
@@ -41,7 +41,7 @@ MasterLayoutDialog::MasterLayoutDialog(weld::Window* pParent, 
SdDrawDocument* pD
 
     if( mpCurrentPage == nullptr )
     {
-        mpCurrentPage = pDoc->GetMasterSdPage( 0, PageKind::Standard );
+        mpCurrentPage = rDoc.GetMasterSdPage( 0, PageKind::Standard );
         OSL_FAIL( "MasterLayoutDialog::MasterLayoutDialog() - no current 
page?" );
     }
 
@@ -83,7 +83,7 @@ short MasterLayoutDialog::run()
 
 void MasterLayoutDialog::applyChanges()
 {
-    mpDoc->BegUndo(m_xDialog->get_title());
+    mrDoc.BegUndo(m_xDialog->get_title());
 
     if( (mpCurrentPage->GetPageKind() != PageKind::Standard) && (mbOldHeader 
!= mxCBHeader->get_active() ) )
     {
@@ -117,7 +117,7 @@ void MasterLayoutDialog::applyChanges()
             create( PresObjKind::SlideNumber );
     }
 
-    mpDoc->EndUndo();
+    mrDoc.EndUndo();
 }
 
 void MasterLayoutDialog::create(PresObjKind eKind)
diff --git a/sd/source/ui/dlg/sddlgfact.cxx b/sd/source/ui/dlg/sddlgfact.cxx
index fa7e9c05036e..4bcefc652698 100644
--- a/sd/source/ui/dlg/sddlgfact.cxx
+++ b/sd/source/ui/dlg/sddlgfact.cxx
@@ -249,9 +249,9 @@ public:
 };
 }
 
-VclPtr<AbstractSdInsertPagesObjsDlg> 
SdAbstractDialogFactory_Impl::CreateSdInsertPagesObjsDlg(weld::Window* pParent, 
const SdDrawDocument* pDoc, SfxMedium* pSfxMedium, const OUString& rFileName)
+VclPtr<AbstractSdInsertPagesObjsDlg> 
SdAbstractDialogFactory_Impl::CreateSdInsertPagesObjsDlg(weld::Window* pParent, 
const SdDrawDocument& rDoc, SfxMedium* pSfxMedium, const OUString& rFileName)
 {
-    return VclPtr<AbstractSdInsertPagesObjsDlg_Impl>::Create(pParent, pDoc, 
pSfxMedium, rFileName);
+    return VclPtr<AbstractSdInsertPagesObjsDlg_Impl>::Create(pParent, rDoc, 
pSfxMedium, rFileName);
 }
 
 namespace
@@ -420,22 +420,22 @@ CreateTabPage 
SdAbstractDialogFactory_Impl::GetSdOptionsSnapTabPageCreatorFunc()
     return SdTpOptionsSnap::Create;
 }
 
-VclPtr<VclAbstractDialog> 
SdAbstractDialogFactory_Impl::CreateMasterLayoutDialog(weld::Window* pParent, 
SdDrawDocument* pDoc, SdPage* pCurrentPage)
+VclPtr<VclAbstractDialog> 
SdAbstractDialogFactory_Impl::CreateMasterLayoutDialog(weld::Window* pParent, 
SdDrawDocument& rDoc, SdPage* pCurrentPage)
 {
-    return 
VclPtr<SdAbstractGenericDialog_Impl<sd::MasterLayoutDialog>>::Create(pParent, 
pDoc, pCurrentPage);
+    return 
VclPtr<SdAbstractGenericDialog_Impl<sd::MasterLayoutDialog>>::Create(pParent, 
rDoc, pCurrentPage);
 }
 
 VclPtr<AbstractHeaderFooterDialog> 
SdAbstractDialogFactory_Impl::CreateHeaderFooterDialog(sd::ViewShell& 
rViewShell,
-    weld::Window* pParent, SdDrawDocument* pDoc, SdPage* pCurrentPage)
+    weld::Window* pParent, SdDrawDocument& rDoc, SdPage* pCurrentPage)
 {
     using AbstractHeaderFooterDialog_Impl
         = ScreenshottedDialog_Impl_Async<AbstractHeaderFooterDialog, 
sd::HeaderFooterDialog>;
-    return VclPtr<AbstractHeaderFooterDialog_Impl>::Create(rViewShell, 
pParent, pDoc, pCurrentPage);
+    return VclPtr<AbstractHeaderFooterDialog_Impl>::Create(rViewShell, 
pParent, rDoc, pCurrentPage);
 }
 
-VclPtr<VclAbstractDialog> 
SdAbstractDialogFactory_Impl::CreateSdPhotoAlbumDialog(weld::Window* pParent, 
SdDrawDocument* pDoc)
+VclPtr<VclAbstractDialog> 
SdAbstractDialogFactory_Impl::CreateSdPhotoAlbumDialog(weld::Window* pParent, 
SdDrawDocument& rDoc)
 {
-    return 
VclPtr<SdAbstractGenericDialog_Impl<sd::SdPhotoAlbumDialog>>::Create(pParent, 
pDoc);
+    return 
VclPtr<SdAbstractGenericDialog_Impl<sd::SdPhotoAlbumDialog>>::Create(pParent, 
rDoc);
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sd/source/ui/dlg/sddlgfact.hxx b/sd/source/ui/dlg/sddlgfact.hxx
index 7d52c2e584aa..6e2ebf50c584 100644
--- a/sd/source/ui/dlg/sddlgfact.hxx
+++ b/sd/source/ui/dlg/sddlgfact.hxx
@@ -36,7 +36,7 @@ public:
     virtual VclPtr<AbstractSdModifyFieldDlg>   
CreateSdModifyFieldDlg(weld::Window* pWindow, const SvxFieldData* pInField, 
const SfxItemSet& rSet) override;
     virtual VclPtr<AbstractSdSnapLineDlg>      
CreateSdSnapLineDlg(weld::Window* pParent, const SfxItemSet& rInAttrs, 
::sd::View* pView) override;
     virtual VclPtr<AbstractSdInsertLayerDlg>   
CreateSdInsertLayerDlg(weld::Window* pParent, const SfxItemSet& rInAttrs, bool 
bDeletable, const OUString& aStr) override;
-    virtual VclPtr<AbstractSdInsertPagesObjsDlg> 
CreateSdInsertPagesObjsDlg(weld::Window* pParent, const SdDrawDocument* pDoc, 
SfxMedium* pSfxMedium, const OUString& rFileName ) override;
+    virtual VclPtr<AbstractSdInsertPagesObjsDlg> 
CreateSdInsertPagesObjsDlg(weld::Window* pParent, const SdDrawDocument& rDoc, 
SfxMedium* pSfxMedium, const OUString& rFileName ) override;
     virtual VclPtr<AbstractMorphDlg>           CreateMorphDlg(weld::Window* 
pParent, const SdrObject* pObj1, const SdrObject* pObj2) override;
     virtual VclPtr<SfxAbstractTabDialog>       
CreateSdOutlineBulletTabDlg(weld::Window* pParent, const SfxItemSet* pAttr, 
::sd::View* pView) override;
     virtual VclPtr<SfxAbstractTabDialog>       
CreateSdParagraphTabDlg(weld::Window* pParent, const SfxItemSet* pAttr) 
override;
@@ -49,13 +49,13 @@ public:
     virtual VclPtr<SfxAbstractDialog>          
CreatSdActionDialog(weld::Window* pParent, const SfxItemSet& rAttr, ::sd::View* 
pView) override;
     virtual VclPtr<AbstractSdVectorizeDlg>     
CreateSdVectorizeDlg(weld::Window* pParent, const Bitmap& rBmp, 
::sd::DrawDocShell* pDocShell) override;
 
-    virtual VclPtr<VclAbstractDialog>          
CreateSdPhotoAlbumDialog(weld::Window* pWindow, SdDrawDocument* pDoc) override;
+    virtual VclPtr<VclAbstractDialog>          
CreateSdPhotoAlbumDialog(weld::Window* pWindow, SdDrawDocument& rDoc) override;
 
-    virtual VclPtr<VclAbstractDialog>          
CreateMasterLayoutDialog(weld::Window* pParent, SdDrawDocument* pDoc, SdPage*) 
override;
+    virtual VclPtr<VclAbstractDialog>          
CreateMasterLayoutDialog(weld::Window* pParent, SdDrawDocument& rDoc, SdPage*) 
override;
 
     virtual VclPtr<AbstractHeaderFooterDialog> 
CreateHeaderFooterDialog(sd::ViewShell& rViewShell,
                                                                         
weld::Window* pParent,
-                                                                        
SdDrawDocument* pDoc,
+                                                                        
SdDrawDocument& rDoc,
                                                                         
SdPage* pCurrentPage) override;
 
     // For TabPage
diff --git a/sd/source/ui/func/fuinsfil.cxx b/sd/source/ui/func/fuinsfil.cxx
index 7e8bd84aaf04..cafeca276f42 100644
--- a/sd/source/ui/func/fuinsfil.cxx
+++ b/sd/source/ui/func/fuinsfil.cxx
@@ -317,7 +317,7 @@ bool FuInsertFile::InsSDDinDrMode(SfxMedium* pMedium)
     mpDocSh->SetWaitCursor( false );
     SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
     weld::Window* pParent = mrViewShell.GetFrameWeld();
-    ScopedVclPtr<AbstractSdInsertPagesObjsDlg> pDlg( 
pFact->CreateSdInsertPagesObjsDlg(pParent, &mrDoc, pMedium, aFile) );
+    ScopedVclPtr<AbstractSdInsertPagesObjsDlg> pDlg( 
pFact->CreateSdInsertPagesObjsDlg(pParent, mrDoc, pMedium, aFile) );
 
     sal_uInt16 nRet = pDlg->Execute();
 
@@ -397,7 +397,7 @@ bool FuInsertFile::InsSDDinDrMode(SfxMedium* pMedium)
 void FuInsertFile::InsTextOrRTFinDrMode(SfxMedium* pMedium)
 {
     SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
-    ScopedVclPtr<AbstractSdInsertPagesObjsDlg> pDlg( 
pFact->CreateSdInsertPagesObjsDlg(mrViewShell.GetFrameWeld(), &mrDoc, nullptr, 
aFile) );
+    ScopedVclPtr<AbstractSdInsertPagesObjsDlg> pDlg( 
pFact->CreateSdInsertPagesObjsDlg(mrViewShell.GetFrameWeld(), mrDoc, nullptr, 
aFile) );
 
     mpDocSh->SetWaitCursor( false );
 
diff --git a/sd/source/ui/inc/headerfooterdlg.hxx 
b/sd/source/ui/inc/headerfooterdlg.hxx
index 7124e86be278..e79787e05a25 100644
--- a/sd/source/ui/inc/headerfooterdlg.hxx
+++ b/sd/source/ui/inc/headerfooterdlg.hxx
@@ -41,7 +41,7 @@ private:
     HeaderFooterSettings    maSlideSettings;
     HeaderFooterSettings    maNotesHandoutSettings;
 
-    SdDrawDocument*         mpDoc;
+    SdDrawDocument&         mrDoc;
     SdPage*                 mpCurrentPage;
     ViewShell&              mrViewShell;
 
@@ -56,7 +56,7 @@ private:
     void change( SdUndoGroup* pUndoGroup, SdPage* pPage, const 
HeaderFooterSettings& rNewSettings );
 
 public:
-    HeaderFooterDialog(ViewShell& rViewShell, weld::Window* pParent, 
SdDrawDocument* pDoc, SdPage* pCurrentPage);
+    HeaderFooterDialog(ViewShell& rViewShell, weld::Window* pParent, 
SdDrawDocument& rDoc, SdPage* pCurrentPage);
     virtual ~HeaderFooterDialog() override;
 
     void ApplyToAll();
diff --git a/sd/source/ui/inc/inspagob.hxx b/sd/source/ui/inc/inspagob.hxx
index d906a10f77c5..8c2212656ccc 100644
--- a/sd/source/ui/inc/inspagob.hxx
+++ b/sd/source/ui/inc/inspagob.hxx
@@ -29,7 +29,7 @@ class SdInsertPagesObjsDlg : public 
weld::GenericDialogController
 {
 private:
     SfxMedium*              m_pMedium;
-    const SdDrawDocument*   m_pDoc;
+    const SdDrawDocument&   m_rDoc;
     const OUString&         m_rName;
 
     std::unique_ptr<SdPageObjsTLV> m_xLbTree;
@@ -40,7 +40,7 @@ private:
     DECL_LINK(SelectObjectHdl, weld::TreeView&, void);
 
 public:
-    SdInsertPagesObjsDlg(weld::Window* pParent, const SdDrawDocument* pDoc,
+    SdInsertPagesObjsDlg(weld::Window* pParent, const SdDrawDocument& rDoc,
                          SfxMedium* pSfxMedium, const OUString& rFileName);
     virtual ~SdInsertPagesObjsDlg() override;
 
diff --git a/sd/source/ui/inc/masterlayoutdlg.hxx 
b/sd/source/ui/inc/masterlayoutdlg.hxx
index 0acbb18d7b47..a0e063bdfea8 100644
--- a/sd/source/ui/inc/masterlayoutdlg.hxx
+++ b/sd/source/ui/inc/masterlayoutdlg.hxx
@@ -31,7 +31,7 @@ namespace sd
 class MasterLayoutDialog : public weld::GenericDialogController
 {
 private:
-    SdDrawDocument* mpDoc;
+    SdDrawDocument& mrDoc;
     SdPage*         mpCurrentPage;
 
     std::unique_ptr<weld::CheckButton> mxCBDate;
@@ -50,7 +50,7 @@ private:
     void create( PresObjKind eKind );
 
 public:
-    MasterLayoutDialog(weld::Window* pParent, SdDrawDocument* pDoc, SdPage* 
pCurrentPage);
+    MasterLayoutDialog(weld::Window* pParent, SdDrawDocument& rDoc, SdPage* 
pCurrentPage);
     virtual ~MasterLayoutDialog() override;
 
     virtual short run() override;
diff --git a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx 
b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
index 8b83d8e9bd7a..c730ab9c5e59 100644
--- a/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
+++ b/sd/source/ui/slidesorter/controller/SlsSlotManager.cxx
@@ -279,7 +279,7 @@ void SlotManager::FuTemporary (SfxRequest& rRequest)
             vcl::Window* pWin = mrSlideSorter.GetContentWindow();
             ScopedVclPtr<VclAbstractDialog> 
pDlg(pFact->CreateSdPhotoAlbumDialog(
                 pWin ? pWin->GetFrameWeld() : nullptr,
-                pDocument));
+                *pDocument));
             pDlg->Execute();
             rRequest.Done ();
         }
diff --git a/sd/source/ui/view/NotesPanelViewShell.cxx 
b/sd/source/ui/view/NotesPanelViewShell.cxx
index 837ad64b678e..f2fe59290ba5 100644
--- a/sd/source/ui/view/NotesPanelViewShell.cxx
+++ b/sd/source/ui/view/NotesPanelViewShell.cxx
@@ -819,7 +819,7 @@ void NotesPanelViewShell::FuTemporary(SfxRequest& rReq)
             SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
             vcl::Window* pWin = GetActiveWindow();
             ScopedVclPtr<VclAbstractDialog> pDlg(
-                pFact->CreateSdPhotoAlbumDialog(pWin ? pWin->GetFrameWeld() : 
nullptr, GetDoc()));
+                pFact->CreateSdPhotoAlbumDialog(pWin ? pWin->GetFrameWeld() : 
nullptr, *GetDoc()));
 
             pDlg->Execute();
 
diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx
index c709ffdb4733..a2873323c7b2 100644
--- a/sd/source/ui/view/drviews2.cxx
+++ b/sd/source/ui/view/drviews2.cxx
@@ -4198,7 +4198,7 @@ void DrawViewShell::FuTemporary(SfxRequest& rReq)
             vcl::Window* pWin = GetActiveWindow();
             ScopedVclPtr<VclAbstractDialog> 
pDlg(pFact->CreateSdPhotoAlbumDialog(
                 pWin ? pWin->GetFrameWeld() : nullptr,
-                GetDoc()));
+                *GetDoc()));
 
             pDlg->Execute();
             Cancel();
diff --git a/sd/source/ui/view/drviews3.cxx b/sd/source/ui/view/drviews3.cxx
index 09ec3e4acf7f..ea3faf8738fe 100644
--- a/sd/source/ui/view/drviews3.cxx
+++ b/sd/source/ui/view/drviews3.cxx
@@ -308,7 +308,7 @@ void  DrawViewShell::ExecCtrl(SfxRequest& rReq)
         {
             SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
             vcl::Window* pWin = GetActiveWindow();
-            VclPtr<AbstractHeaderFooterDialog> 
pDlg(pFact->CreateHeaderFooterDialog(*this, pWin ? pWin->GetFrameWeld() : 
nullptr, GetDoc(), mpActualPage));
+            VclPtr<AbstractHeaderFooterDialog> 
pDlg(pFact->CreateHeaderFooterDialog(*this, pWin ? pWin->GetFrameWeld() : 
nullptr, *GetDoc(), mpActualPage));
             auto xRequest = std::make_shared<SfxRequest>(rReq);
             rReq.Ignore(); // the 'old' request is not relevant any more
             pDlg->StartExecuteAsync([this, pDlg, 
xRequest=std::move(xRequest)](sal_Int32 /*nResult*/){
@@ -332,7 +332,7 @@ void  DrawViewShell::ExecCtrl(SfxRequest& rReq)
 
             SdAbstractDialogFactory* pFact = SdAbstractDialogFactory::Create();
             vcl::Window* pWin = GetActiveWindow();
-            ScopedVclPtr<VclAbstractDialog> 
pDlg(pFact->CreateMasterLayoutDialog(pWin ? pWin->GetFrameWeld() : nullptr, 
GetDoc(), pPage));
+            ScopedVclPtr<VclAbstractDialog> 
pDlg(pFact->CreateMasterLayoutDialog(pWin ? pWin->GetFrameWeld() : nullptr, 
*GetDoc(), pPage));
             pDlg->Execute();
             Invalidate();
             rReq.Done ();
diff --git a/sd/source/ui/view/outlnvs2.cxx b/sd/source/ui/view/outlnvs2.cxx
index 675b58b87905..13861cd3ddc6 100644
--- a/sd/source/ui/view/outlnvs2.cxx
+++ b/sd/source/ui/view/outlnvs2.cxx
@@ -298,7 +298,7 @@ void OutlineViewShell::FuTemporary(SfxRequest &rReq)
             vcl::Window* pWin = GetActiveWindow();
             ScopedVclPtr<VclAbstractDialog> 
pDlg(pFact->CreateSdPhotoAlbumDialog(
                 pWin ? pWin->GetFrameWeld() : nullptr,
-                GetDoc()));
+                *GetDoc()));
 
             pDlg->Execute();
 

Reply via email to