sw/source/core/layout/trvlfrm.cxx |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 7a49318fd929901b4814d23d6ff763d099c35234
Author:     Justin Luth <jl...@mail.com>
AuthorDate: Wed Sep 3 15:40:41 2025 -0400
Commit:     Justin Luth <jl...@mail.com>
CommitDate: Thu Sep 4 10:13:58 2025 +0200

    tdf#131132 SwFrame::OnFirstPage: replace GetPageDesc w/ FindPageDesc
    
    SwFormat::GetPageDesc might be obsolete.
    It certainly is when wsfrm.cxx's SwContentFrame::UpdateAttr_
    calls pagechg.cxx SwFrame::CheckPageDesc for a RES_PAGEDESC change.
    In that case bFirst was set true every time
    because SwFrame::CheckPageDescs's
       SwPageDesc *pDesc = pPage->FindPageDesc();
    used FindPageDesc to get real, new PageDesc
    while SwFrame::OnFirstPage's
       const SwPageDesc* pDesc = pPage-GetPageDesc();
    was just getting the layout's cached attribute.
    
    A code read suggests there was no situation
    that requires the old logic in order to function properly.
    
    In some test documents, CheckPageDesc was soon called a second time,
    and in that case the PageDesc has already been refreshed,
    so bFirst gets set appropriately
    and the wrong layout caused by the first run is not noticed.
    
    Change-Id: I7c13cd7ee47d5d5eeb4c524c4e514b4bb964d36b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/190570
    Tested-by: Jenkins
    Reviewed-by: Justin Luth <jl...@mail.com>

diff --git a/sw/source/core/layout/trvlfrm.cxx 
b/sw/source/core/layout/trvlfrm.cxx
index 86cd2c1c0ca4..bc6db0fffd79 100644
--- a/sw/source/core/layout/trvlfrm.cxx
+++ b/sw/source/core/layout/trvlfrm.cxx
@@ -1842,8 +1842,8 @@ bool SwFrame::OnFirstPage() const
         if (pPrevFrame)
         {
             // first page of layout may be empty page, but only if it starts 
with "Left Page" style
-            const SwPageDesc* pDesc = pPage->GetPageDesc();
-            bRet = pPrevFrame->GetPageDesc() != pDesc;
+            const SwPageDesc* pDesc = 
const_cast<SwPageFrame*>(pPage)->FindPageDesc();
+            bRet = const_cast<SwPageFrame*>(pPrevFrame)->FindPageDesc() != 
pDesc;
         }
         else
             bRet = true;

Reply via email to