summaryrefslogtreecommitdiff
path: root/vcl/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2020-07-08 17:08:51 +0100
committerCaolán McNamara <caolanm@redhat.com>2020-07-08 22:06:05 +0200
commit253d4c15e73b0a22320dbebb4bdf17f8fdb03649 (patch)
treea96a542924a3d02c5607fa05fd7156e3bf017a67 /vcl/source
parent94f4bdb910a9db49016ea23cd0086f70a1468363 (diff)
query if the cursor can be moved up or down
Change-Id: I47c09ff5f76c873cf30e608a134f90b42040a0c3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/98387 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/source')
-rw-r--r--vcl/source/app/salvtables.cxx12
-rw-r--r--vcl/source/edit/vclmedit.cxx16
2 files changed, 28 insertions, 0 deletions
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 893a7f4f0b49..e30bbd057c71 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -5500,6 +5500,18 @@ public:
weld::TextView::connect_cursor_position(rLink);
}
+ virtual bool can_move_cursor_with_up() const override
+ {
+ bool bNoSelection = !m_xTextView->GetSelection();
+ return !bNoSelection || m_xTextView->CanUp();
+ }
+
+ virtual bool can_move_cursor_with_down() const override
+ {
+ bool bNoSelection = !m_xTextView->GetSelection();
+ return !bNoSelection || m_xTextView->CanDown();
+ }
+
virtual void cut_clipboard() override
{
m_xTextView->Cut();
diff --git a/vcl/source/edit/vclmedit.cxx b/vcl/source/edit/vclmedit.cxx
index 021ef7658837..fe459ba59a0d 100644
--- a/vcl/source/edit/vclmedit.cxx
+++ b/vcl/source/edit/vclmedit.cxx
@@ -1515,6 +1515,22 @@ void VclMultiLineEdit::EnableCursor( bool bEnable )
GetTextView()->EnableCursor( bEnable );
}
+bool VclMultiLineEdit::CanUp() const
+{
+ TextView* pTextView = GetTextView();
+ const TextSelection& rTextSelection = pTextView->GetSelection();
+ TextPaM aPaM(rTextSelection.GetEnd());
+ return aPaM != pTextView->CursorUp(aPaM);
+}
+
+bool VclMultiLineEdit::CanDown() const
+{
+ TextView* pTextView = GetTextView();
+ const TextSelection& rTextSelection = pTextView->GetSelection();
+ TextPaM aPaM(rTextSelection.GetEnd());
+ return aPaM != pTextView->CursorDown(aPaM);
+}
+
TextWindow* VclMultiLineEdit::GetTextWindow()
{
return pImpVclMEdit->GetTextWindow();