sw/source/core/docnode/nodes.cxx |   14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

New commits:
commit ba99cc9d9cf781d9b3888e1cf5becd95bb9fc6d2
Author:     Michael Stahl <michael.st...@allotropia.de>
AuthorDate: Wed Jul 19 15:54:07 2023 +0200
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Wed Jul 19 20:05:26 2023 +0200

    tdf#153115 sw: fix yet another FindPrvNxtFrameNode() issue
    
    In the SwUndoTextToTable for the middle cell it happens that there is no
    frame remaining in the cell frame and SwNodes::FindPrvNxtFrameNode()
    erroneously returns a frame from inside the preceding cell, so it
    creates the frame in the wrong cell.
    
    (regression from commit faf2d9e2cb13c3750ac359338f8f31fc1afce368)
    
    Change-Id: I2e4f460541e20dda23c1fafb6d63c023dae9b152
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154654
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx
index 45a02bf5d5a0..c045aa57023d 100644
--- a/sw/source/core/docnode/nodes.cxx
+++ b/sw/source/core/docnode/nodes.cxx
@@ -2239,7 +2239,8 @@ SwNode* SwNodes::FindPrvNxtFrameNode( const SwNode& 
rFrameNd,
                 pFrameNd = &aIdx.GetNode();
             }
         }
-        else
+        else if (pFrameNd->IsSectionNode()
+            || (pFrameNd->IsEndNode() && 
pFrameNd->StartOfSectionNode()->IsSectionNode()))
         {
             pFrameNd = GoPrevSection( &aIdx, true, false );
             // did we move *into* a table?
@@ -2272,6 +2273,10 @@ SwNode* SwNodes::FindPrvNxtFrameNode( const SwNode& 
rFrameNd,
                 pFrameNd = nullptr; // no preceding content node, stop search
             }
         }
+        else
+        {
+            pFrameNd = nullptr; // no preceding content node, stop search
+        }
     }
     while (pFrameNd != nullptr);
 
@@ -2312,7 +2317,8 @@ SwNode* SwNodes::FindPrvNxtFrameNode( const SwNode& 
rFrameNd,
                 pFrameNd = &aIdx.GetNode();
             }
         }
-        else
+        else if (pFrameNd->IsSectionNode()
+            || (pFrameNd->IsEndNode() && 
pFrameNd->StartOfSectionNode()->IsSectionNode()))
         {
             pFrameNd = GoNextSection( &aIdx, true, false );
             // did we move *into* a table?
@@ -2344,6 +2350,10 @@ SwNode* SwNodes::FindPrvNxtFrameNode( const SwNode& 
rFrameNd,
                 pFrameNd = nullptr; // no following content node, stop search
             }
         }
+        else
+        {
+            pFrameNd = nullptr; // no preceding content node, stop search
+        }
     }
     while (pFrameNd != nullptr);
 

Reply via email to