summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorHenry Castro <hcastro@collabora.com>2024-06-10 14:41:13 -0400
committerXisco Fauli <xiscofauli@libreoffice.org>2024-06-13 22:36:29 +0200
commit6f666713a823eec4d97087222813ba6262649263 (patch)
treee03727dcff0aff1fb1be8b455282caea17ece28a /sw
parentb3f503c5d88b2314fca9fc9124f918090c8c427b (diff)
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 <hcastro@collabora.com> Change-Id: I57b9ae1e80cb8aaaa78867ee215d7e80de990aff Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168646 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168746 Tested-by: Jenkins (cherry picked from commit c69b0d3b58523a1c981e973d1c9d3107257dd84c) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168729 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'sw')
-rw-r--r--sw/source/core/crsr/crsrsh.cxx16
-rw-r--r--sw/source/uibase/wrtsh/move.cxx9
2 files changed, 24 insertions, 1 deletions
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 );