sw/source/core/crsr/crsrsh.cxx  |   16 ++++++++++++++++
 sw/source/uibase/wrtsh/move.cxx |    9 ++++++++-
 2 files changed, 24 insertions(+), 1 deletion(-)

New commits:
commit c69b0d3b58523a1c981e973d1c9d3107257dd84c
Author:     Henry Castro <hcas...@collabora.com>
AuthorDate: Mon Jun 10 14:41:13 2024 -0400
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Wed Jun 12 21:04:08 2024 +0200

    lok: sw: fix PageDown position when cursor is not visible
    
    If PageDown key is pressed and the cursor is not visible,
    in the PageDown increment the new cursor position will not update,
    cause the Visible area is the full document.
    
    Signed-off-by: Henry Castro <hcas...@collabora.com>
    Change-Id: I57b9ae1e80cb8aaaa78867ee215d7e80de990aff
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168646
    Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com>
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168746
    Tested-by: Jenkins

diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index db1e6cfd7e47..a092c19a6e68 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -78,6 +78,7 @@
 #include <hints.hxx>
 #include <tools/json_writer.hxx>
 #include <redline.hxx>
+#include <boost/property_tree/ptree.hpp>
 
 using namespace com::sun::star;
 
@@ -1792,6 +1793,21 @@ void SwCursorShell::VisPortChgd( const SwRect & rRect )
     if( m_bSVCursorVis && bVis ) // show SV cursor again
         m_pVisibleCursor->Show();
 
+    if( comphelper::LibreOfficeKit::isActive() && !rRect.Overlaps( m_aCharRect 
))
+    {
+        boost::property_tree::ptree aParams;
+        tools::Rectangle aRect(rRect.TopLeft(), Size(1, 1));
+
+        aParams.put("rectangle", aRect.toString());
+        aParams.put("scroll", true);
+        aParams.put("hyperlink", "");
+
+        SfxLokHelper::notifyOtherView(GetSfxViewShell(),
+                                      GetSfxViewShell(),
+                                      LOK_CALLBACK_INVALIDATE_VISIBLE_CURSOR,
+                                      aParams);
+    }
+
     if( m_nCursorMove )
         m_bInCMvVisportChgd = true;
 
diff --git a/sw/source/uibase/wrtsh/move.cxx b/sw/source/uibase/wrtsh/move.cxx
index 673a52091687..f68e08010f9a 100644
--- a/sw/source/uibase/wrtsh/move.cxx
+++ b/sw/source/uibase/wrtsh/move.cxx
@@ -27,6 +27,7 @@
 #include <drawdoc.hxx>
 #include <svx/svdpage.hxx>
 #include <svx/svdview.hxx>
+#include <comphelper/lok.hxx>
 
 /**
    Always:
@@ -454,7 +455,13 @@ bool SwWrtShell::PushCursor(SwTwips lOffset, bool bSelect)
     {
         Point aPt( aOldRect.Center() );
 
-        if( !IsCursorVisible() )
+        if (SfxViewShell* pKitView = comphelper::LibreOfficeKit::isActive() ? 
GetSfxViewShell() : nullptr)
+        {
+            SwRect aLOKVis(pKitView->getLOKVisibleArea());
+            if (!aLOKVis.Overlaps(aOldRect))
+                aPt.setY( aLOKVis.Top() + aLOKVis.Height() / 2 );
+        }
+        else if( !IsCursorVisible() )
             // set CursorPos to top-/bottom left pos. So the pagescroll is not
             // be dependent on the current cursor, but on the visarea.
             aPt.setY( aTmpArea.Top() + aTmpArea.Height() / 2 );

Reply via email to