include/svx/svdpage.hxx         |    2 ++
 sd/inc/sdpage.hxx               |    2 +-
 sd/source/core/drawdoc3.cxx     |    7 ++++---
 sd/source/core/stlfamily.cxx    |   11 ++++++-----
 sd/source/ui/unoidl/unopage.cxx |    7 +------
 sd/source/ui/view/drviewsb.cxx  |    3 +--
 sd/source/ui/view/outlnvsh.cxx  |    2 +-
 svx/source/svdraw/svdpage.cxx   |    5 +++++
 8 files changed, 21 insertions(+), 18 deletions(-)

New commits:
commit 5137fcc47f8e40dcba991db1f57dc1b395bbf970
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Mon Mar 3 21:24:46 2025 +0000
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Wed Mar 5 21:08:04 2025 +0100

    tdf#165504 restore SdrPage::GetLayoutName virtual
    
    revert
    
    commit 235c230cd348600ce7385cc580c45a7be3572704
    CommitDate: Tue Oct 22 09:17:02 2024 +0200
    
        We don't need a virtual here
    
    and
    
    commit 960db01dbfe2f916b91782da03532fae1f836445
    CommitDate: Sat Dec 28 22:13:40 2024 +0100
    
        Resolves: tdf#164463 we need to pass a copy of the LayoutName
    
    Change-Id: Iecc486eca72e4d752527e77a9817dc4bed663cc2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182445
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Tested-by: Jenkins

diff --git a/include/svx/svdpage.hxx b/include/svx/svdpage.hxx
index 0ad088889206..2eeb30059b31 100644
--- a/include/svx/svdpage.hxx
+++ b/include/svx/svdpage.hxx
@@ -526,6 +526,8 @@ public:
     const SdrLayerAdmin& GetLayerAdmin() const;
     SdrLayerAdmin& GetLayerAdmin();
 
+    virtual OUString GetLayoutName() const;
+
     /// for snap-to-grid in Writer, also for AlignObjects if 1 object is marked
     /// if pRect != null, then the pages that are intersected by this Rect,
     /// otherwise the visible pages
diff --git a/sd/inc/sdpage.hxx b/sd/inc/sdpage.hxx
index a1121b68b18b..c93121922950 100644
--- a/sd/inc/sdpage.hxx
+++ b/sd/inc/sdpage.hxx
@@ -252,7 +252,7 @@ public:
                          const ::tools::Rectangle& rOldBoundRect) override;
 
     void             SetLayoutName(const OUString& aName);
-    const OUString& GetLayoutName() const { return maLayoutName; }
+    virtual OUString GetLayoutName() const override       { return 
maLayoutName; }
 
     void            SetFileName(const OUString& aName) { maFileName = aName; }
     const OUString& GetFileName() const       { return maFileName; }
diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx
index 3e8c088e1067..21b3c05ffb34 100644
--- a/sd/source/core/drawdoc3.cxx
+++ b/sd/source/core/drawdoc3.cxx
@@ -106,9 +106,10 @@ void 
InsertBookmarkAsPage_FindDuplicateLayouts::operator()( SdDrawDocument& rDoc
             // about this
             if( bRenameDuplicates && aTest != SdResId( STR_LAYOUT_DEFAULT_NAME 
) && !(pTestPage->Equals(*pBMMPage)) )
             {
-                OUString aOldPageLayoutName = pBMMPage->GetLayoutName();
-                pBookmarkDoc->RenameLayoutTemplate(aOldPageLayoutName, 
pBMMPage->GetName() + "_");
+                pBookmarkDoc->RenameLayoutTemplate(
+                    pBMMPage->GetLayoutName(), pBMMPage->GetName() + "_");
                 aLayout = pBMMPage->GetName();
+
                 break;
             }
             else
@@ -1389,7 +1390,7 @@ static bool isMasterPageLayoutNameUnique(const 
SdDrawDocument& rDoc, std::u16str
 
     for(sal_uInt16 a(0); a < nPageCount; a++)
     {
-        const SdPage* pCandidate = static_cast<const 
SdPage*>(rDoc.GetMasterPage(a));
+        const SdrPage* pCandidate = rDoc.GetMasterPage(a);
         OUString aPageLayoutName(pCandidate->GetLayoutName());
         sal_Int32 nIndex = aPageLayoutName.indexOf(SD_LT_SEPARATOR);
         if( nIndex != -1 )
diff --git a/sd/source/core/stlfamily.cxx b/sd/source/core/stlfamily.cxx
index 2262ef1203d2..9696668dc326 100644
--- a/sd/source/core/stlfamily.cxx
+++ b/sd/source/core/stlfamily.cxx
@@ -192,11 +192,12 @@ OUString SAL_CALL SdStyleFamily::getName()
         if( pPage == nullptr )
             throw DisposedException();
 
-        const OUString& rLayoutName = pPage->GetLayoutName();
-        sal_Int32 nIndex = rLayoutName.indexOf(SD_LT_SEPARATOR);
-        if (nIndex != -1)
-            return rLayoutName.copy(0, nIndex);
-        return rLayoutName;
+        OUString aLayoutName( pPage->GetLayoutName() );
+        sal_Int32 nIndex = aLayoutName.indexOf(SD_LT_SEPARATOR);
+        if( nIndex != -1 )
+            aLayoutName = aLayoutName.copy(0, nIndex);
+
+        return aLayoutName;
     }
     else
     {
diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx
index 8279858b20df..9b8450d085b8 100644
--- a/sd/source/ui/unoidl/unopage.cxx
+++ b/sd/source/ui/unoidl/unopage.cxx
@@ -2983,12 +2983,7 @@ void SAL_CALL SdMasterPage::setName( const OUString& 
rName )
     GetPage()->SetName( rName );
 
     if( pDoc )
-    {
-        // tdf#164463 we need to pass a copy of the LayoutName here, a
-        // reference means it can get updated to rName during the function.
-        OUString aOldPageLayoutName = GetPage()->GetLayoutName();
-        pDoc->RenameLayoutTemplate(aOldPageLayoutName, rName);
-    }
+        pDoc->RenameLayoutTemplate( GetPage()->GetLayoutName(), rName );
 
     // fake a mode change to repaint the page tab bar
     ::sd::DrawDocShell* pDocSh = GetModel()->GetDocShell();
diff --git a/sd/source/ui/view/drviewsb.cxx b/sd/source/ui/view/drviewsb.cxx
index 0f6d46460153..b585185c09d0 100644
--- a/sd/source/ui/view/drviewsb.cxx
+++ b/sd/source/ui/view/drviewsb.cxx
@@ -83,8 +83,7 @@ bool DrawViewShell::RenameSlide( sal_uInt16 nPageId, const 
OUString & rName  )
     {
         // rename MasterPage -> rename LayoutTemplate
         pPageToRename = GetDoc()->GetMasterSdPage( 
maTabControl->GetPagePos(nPageId), ePageKind );
-        OUString aOldPageLayoutName = pPageToRename->GetLayoutName();
-        GetDoc()->RenameLayoutTemplate(aOldPageLayoutName, rName);
+        GetDoc()->RenameLayoutTemplate( pPageToRename->GetLayoutName(), rName 
);
     }
 
     bool bSuccess = (rName == pPageToRename->GetName());
diff --git a/sd/source/ui/view/outlnvsh.cxx b/sd/source/ui/view/outlnvsh.cxx
index 87782fc5603d..a8131c653f21 100644
--- a/sd/source/ui/view/outlnvsh.cxx
+++ b/sd/source/ui/view/outlnvsh.cxx
@@ -1318,7 +1318,7 @@ void OutlineViewShell::GetStatusBarState(SfxItemSet& rSet)
         if( nPos >= GetDoc()->GetSdPageCount( PageKind::Standard ) )
             nPos = 0;
 
-        SdPage* pPage = GetDoc()->GetSdPage( static_cast<sal_uInt16>(nPos), 
PageKind::Standard );
+        SdrPage* pPage = GetDoc()->GetSdPage( static_cast<sal_uInt16>(nPos), 
PageKind::Standard );
 
         if (GetDoc()->GetDocumentType() == DocumentType::Draw)
             aPageStr = SdResId(STR_SD_PAGE_COUNT_DRAW);
diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx
index 3dc8464b6f21..8400b0e2a1c0 100644
--- a/svx/source/svdraw/svdpage.cxx
+++ b/svx/source/svdraw/svdpage.cxx
@@ -1743,6 +1743,11 @@ SdrLayerAdmin& SdrPage::GetLayerAdmin()
     return *mpLayerAdmin;
 }
 
+OUString SdrPage::GetLayoutName() const
+{
+    return OUString();
+}
+
 void SdrPage::SetInserted( bool bIns )
 {
     if( mbInserted == bIns )

Reply via email to