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.stahl@allotropia.de>
(cherry picked from commit ba99cc9d9cf781d9b3888e1cf5becd95bb9fc6d2)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154622
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx
index 45a02bf..c045aa5 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);