sw/source/core/crsr/swcrsr.cxx |   40 +++++++++++++++++++---------------------
 1 file changed, 19 insertions(+), 21 deletions(-)

New commits:
commit 880b4eafcf667f3182559701da0ce24de612d330
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Sat May 10 12:23:14 2025 +0100
Commit:     Miklos Vajna <vmik...@collabora.com>
CommitDate: Mon May 12 08:59:14 2025 +0200

    merge these two hunks to a standalone function
    
    Change-Id: I02273c656c285428a3f3c797f53758d3e6f79819
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/185132
    Reviewed-by: Miklos Vajna <vmik...@collabora.com>
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>

diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx
index a195759f452c..aa4756e303b6 100644
--- a/sw/source/core/crsr/swcrsr.cxx
+++ b/sw/source/core/crsr/swcrsr.cxx
@@ -1734,6 +1734,23 @@ SwCursor::DoSetBidiLevelLeftRight(
     return pSttFrame;
 }
 
+static const SwTextFrame* GetTextFrame(const SwNode& rNode, SwRootFrame 
const*const pLayout)
+{
+    SwTextFrame const* pFrame(nullptr);
+    if (pLayout)
+    {
+        pFrame = static_cast<SwTextFrame const 
*>(rNode.GetContentNode()->getLayoutFrame(pLayout));
+        if (pFrame)
+        {
+            while (pFrame->GetPrecede())
+            {
+                pFrame = static_cast<SwTextFrame const*>(pFrame->GetPrecede());
+            }
+        }
+    }
+    return pFrame;
+}
+
 bool SwCursor::LeftRight( bool bLeft, sal_uInt16 nCnt, SwCursorSkipMode nMode,
                           bool bVisualAllowed,bool bSkipHidden, bool 
bInsertCursor,
                           SwRootFrame const*const pLayout, bool isFieldNames)
@@ -1753,18 +1770,7 @@ bool SwCursor::LeftRight( bool bLeft, sal_uInt16 nCnt, 
SwCursorSkipMode nMode,
     else
         fnGo = SwCursorSkipMode::Cells == nMode ? GoInContentCells : 
GoInContent;
 
-    SwTextFrame const* pFrame(nullptr);
-    if (pLayout)
-    {
-        pFrame = 
static_cast<SwTextFrame*>(rNode.GetContentNode()->getLayoutFrame(pLayout));
-        if (pFrame)
-        {
-            while (pFrame->GetPrecede())
-            {
-                pFrame = static_cast<SwTextFrame const*>(pFrame->GetPrecede());
-            }
-        }
-    }
+    SwTextFrame const* pFrame = GetTextFrame(rNode, pLayout);
 
     while( nCnt )
     {
@@ -1809,15 +1815,7 @@ bool SwCursor::LeftRight( bool bLeft, sal_uInt16 nCnt, 
SwCursorSkipMode nMode,
 
         if (pFrame)
         {
-            SwTextFrame const* pNewFrame(static_cast<SwTextFrame const*>(
-                
GetPoint()->GetNode().GetContentNode()->getLayoutFrame(pLayout)));
-            if (pNewFrame)
-            {
-                while (pNewFrame->GetPrecede())
-                {
-                    pNewFrame = static_cast<SwTextFrame 
const*>(pNewFrame->GetPrecede());
-                }
-            }
+            SwTextFrame const* pNewFrame = GetTextFrame(GetPoint()->GetNode(), 
pLayout);
             // sw_redlinehide: fully redline-deleted nodes don't have frames...
             if (pFrame == pNewFrame || !pNewFrame)
             {

Reply via email to