sw/source/uibase/utlui/content.cxx |   13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

New commits:
commit bb3a60cfdbed880e482229e0eed08b5e2e7e311b
Author:     Jim Raykowski <rayk...@gmail.com>
AuthorDate: Wed Sep 20 22:26:36 2023 -0800
Commit:     Jim Raykowski <rayk...@gmail.com>
CommitDate: Fri Sep 22 11:07:51 2023 +0200

    tdf#152029 Fix bringing a heading to attention brings a section to
    
    attention when the heading is the first content node in the section
    
    Change-Id: I37a8e03fc4aa7c59d82449d467279587c494b416
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157163
    Tested-by: Jenkins
    Reviewed-by: Jim Raykowski <rayk...@gmail.com>

diff --git a/sw/source/uibase/utlui/content.cxx 
b/sw/source/uibase/utlui/content.cxx
index 44a6413072f6..d8a6e71daa04 100644
--- a/sw/source/uibase/utlui/content.cxx
+++ b/sw/source/uibase/utlui/content.cxx
@@ -6040,8 +6040,15 @@ void 
SwContentTree::BringTypesWithFlowFramesToAttention(const std::vector<const
     {
         if (!pNode)
             continue;
-        SwNode2Layout aTmp(*pNode, pNode->GetIndex() - 1);
-        SwFrame* pFrame = aTmp.NextFrame();
+        const SwFrame* pFrame;
+        if (pNode->IsContentNode())
+            pFrame = 
pNode->GetContentNode()->getLayoutFrame(m_pActiveShell->GetLayout());
+        else
+        {
+            // section and table nodes
+            SwNode2Layout aTmp(*pNode, pNode->GetIndex() - 1);
+            pFrame = aTmp.NextFrame();
+        }
         while (pFrame)
         {
             const SwRect& rFrameRect = pFrame->getFrameArea();
@@ -6052,7 +6059,7 @@ void 
SwContentTree::BringTypesWithFlowFramesToAttention(const std::vector<const
                                      rFrameRect.Right(), rFrameRect.Bottom());
             if (!pFrame->IsFlowFrame())
                 break;
-            SwFlowFrame *pFollow = 
SwFlowFrame::CastFlowFrame(pFrame)->GetFollow();
+            const SwFlowFrame *pFollow = 
SwFlowFrame::CastFlowFrame(pFrame)->GetFollow();
             if (!pFollow)
                 break;
             pFrame = &pFollow->GetFrame();

Reply via email to