sw/source/core/crsr/crsrsh.cxx | 16 ++++++++++++++++ sw/source/uibase/wrtsh/move.cxx | 9 ++++++++- 2 files changed, 24 insertions(+), 1 deletion(-)
New commits: commit f23e8a8cb8d3828f38f0495dad5149082d2dece3 Author: Henry Castro <[email protected]> AuthorDate: Mon Jun 10 14:41:13 2024 -0400 Commit: Henry Castro <[email protected]> CommitDate: Mon Jun 24 15:20:03 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 <[email protected]> Change-Id: I57b9ae1e80cb8aaaa78867ee215d7e80de990aff Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168646 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Caolán McNamara <[email protected]> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168746 Tested-by: Jenkins Reviewed-on: https://gerrit.libreoffice.org/c/core/+/169464 diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx index 0a7468620842..b4fbb7fb9672 100644 --- a/sw/source/core/crsr/crsrsh.cxx +++ b/sw/source/core/crsr/crsrsh.cxx @@ -77,6 +77,7 @@ #include <view.hxx> #include <hints.hxx> #include <tools/json_writer.hxx> +#include <boost/property_tree/ptree.hpp> using namespace com::sun::star; using namespace util; @@ -1762,6 +1763,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 fd30e1a3ca3b..af4dc028ab25 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 );
