[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - editeng/source
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Wed Mar 10 09:18:01 UTC 2021
editeng/source/editeng/editeng.cxx | 7 +++----
editeng/source/editeng/impedit.cxx | 21 +++++++++------------
2 files changed, 12 insertions(+), 16 deletions(-)
New commits:
commit af8b84e8143cadbdfdb5365d7a4455b84b985090
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Mar 8 09:35:49 2021 +0000
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Wed Mar 10 10:14:33 2021 +0100
tdf#140498 middle-button paste doesn't depend on a vcl::Window
Change-Id: I4f1f14994b35cec51761689875bf6b5135612f3c
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112085
Tested-by: Jenkins
Reviewed-by: Xisco Fauli <xiscofauli at libreoffice.org>
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx
index da9520aae81a..3c06cbf96f51 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -64,6 +64,7 @@
#include <rtl/strbuf.hxx>
#include <sal/log.hxx>
#include <vcl/help.hxx>
+#include <vcl/transfer.hxx>
#include <com/sun/star/datatransfer/clipboard/XClipboard.hpp>
#if OSL_DEBUG_LEVEL > 1
@@ -1112,10 +1113,8 @@ bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditView, v
aCurSel = pImpEditEngine->MoveCursor( rKeyEvent, pEditView );
if ( aCurSel.HasRange() ) {
- if (vcl::Window* pWindow = pEditView->GetWindow()) {
- Reference<css::datatransfer::clipboard::XClipboard> aSelection(pWindow->GetPrimarySelection());
- pEditView->pImpEditView->CutCopy( aSelection, false );
- }
+ Reference<css::datatransfer::clipboard::XClipboard> aSelection(GetSystemPrimarySelection());
+ pEditView->pImpEditView->CutCopy( aSelection, false );
}
bMoved = true;
diff --git a/editeng/source/editeng/impedit.cxx b/editeng/source/editeng/impedit.cxx
index 03615ca3e465..f226f983f593 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -1659,19 +1659,16 @@ bool ImpEditView::MouseButtonUp( const MouseEvent& rMouseEvent )
nExtraCursorFlags = GetCursorFlags::NONE;
bClickedInSelection = false;
- if (vcl::Window* pWindow = GetWindow())
+ if ( rMouseEvent.IsMiddle() && !bReadOnly &&
+ Application::GetSettings().GetMouseSettings().GetMiddleButtonAction() == MouseMiddleButtonAction::PasteSelection )
{
- if ( rMouseEvent.IsMiddle() && !bReadOnly &&
- ( pWindow->GetSettings().GetMouseSettings().GetMiddleButtonAction() == MouseMiddleButtonAction::PasteSelection ) )
- {
- Reference<css::datatransfer::clipboard::XClipboard> aClipBoard(GetSelection());
- Paste( aClipBoard );
- }
- else if ( rMouseEvent.IsLeft() && GetEditSelection().HasRange() )
- {
- Reference<css::datatransfer::clipboard::XClipboard> aClipBoard(GetSelection());
- CutCopy( aClipBoard, false );
- }
+ Reference<css::datatransfer::clipboard::XClipboard> aClipBoard(GetSelection());
+ Paste( aClipBoard );
+ }
+ else if ( rMouseEvent.IsLeft() && GetEditSelection().HasRange() )
+ {
+ Reference<css::datatransfer::clipboard::XClipboard> aClipBoard(GetSelection());
+ CutCopy( aClipBoard, false );
}
return pEditEngine->pImpEditEngine->MouseButtonUp( rMouseEvent, GetEditViewPtr() );
More information about the Libreoffice-commits
mailing list