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 3988dc348020c94679238d7f8f0afd930f02b8a5 Author: Caolán McNamara <[email protected]> AuthorDate: Mon Mar 3 21:24:46 2025 +0000 Commit: Michael Stahl <[email protected]> CommitDate: Thu Mar 6 10:20:00 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 <[email protected]> Tested-by: Jenkins (cherry picked from commit 5137fcc47f8e40dcba991db1f57dc1b395bbf970) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182546 Reviewed-by: Michael Stahl <[email protected]> diff --git a/include/svx/svdpage.hxx b/include/svx/svdpage.hxx index 8371d080cbe2..f64af22e1353 100644 --- a/include/svx/svdpage.hxx +++ b/include/svx/svdpage.hxx @@ -528,6 +528,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 69c7e422af0d..bdb3e6e89790 100644 --- a/sd/inc/sdpage.hxx +++ b/sd/inc/sdpage.hxx @@ -248,7 +248,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 19745fb47add..ba8e64f986c9 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 f55ad226fa4e..e6e66c77558d 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 e26a48fe039e..9b6322367654 100644 --- a/svx/source/svdraw/svdpage.cxx +++ b/svx/source/svdraw/svdpage.cxx @@ -1742,6 +1742,11 @@ SdrLayerAdmin& SdrPage::GetLayerAdmin() return *mpLayerAdmin; } +OUString SdrPage::GetLayoutName() const +{ + return OUString(); +} + void SdrPage::SetInserted( bool bIns ) { if( mbInserted == bIns )
