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

New commits:
commit ddb454bb80622a2fd625bc09af8a66b025b0739f
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 16:53:53 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>

diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index 51f675adc9dd..20e32e66c255 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;
 using namespace util;
@@ -1790,6 +1791,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 cda2b32112ce..7bdef4e7bed4 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,14 @@ bool SwWrtShell::PushCursor(SwTwips lOffset, bool bSelect)
     {
         Point aPt( aOldRect.Center() );
 
-        if( !IsCursorVisible() )
+        if( comphelper::LibreOfficeKit::isActive() )
+        {
+            SfxViewShell* pView = GetSfxViewShell();
+            SwRect aLOKVis(pView->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