summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-03-08 14:13:16 +0000
committerCaolán McNamara <caolanm@redhat.com>2021-03-09 16:57:56 +0100
commit55b305e21f103b74669a31b6dbed8596ecc3ca09 (patch)
tree884a5b657425a1161edf93e4ca04d98dfc9d52f8 /vcl
parent3edfc84c7a1df53ccea921e2dc4e42088bafcb0c (diff)
fetch/set/clear primary selection without intermediate vcl::Window
the intermediate layer doesn't do anything useful Change-Id: I00564f43db8914445ea4013c6f387c7d7c783427 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/112170 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/control/edit.cxx5
-rw-r--r--vcl/source/edit/textview.cxx7
-rw-r--r--vcl/source/treelist/transfer.cxx20
-rw-r--r--vcl/source/window/window.cxx9
4 files changed, 12 insertions, 29 deletions
diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx
index d1322a4dcc65..82e650e88b63 100644
--- a/vcl/source/control/edit.cxx
+++ b/vcl/source/control/edit.cxx
@@ -26,6 +26,7 @@
#include <vcl/specialchars.hxx>
#include <vcl/svapp.hxx>
#include <vcl/settings.hxx>
+#include <vcl/transfer.hxx>
#include <vcl/uitest/uiobject.hxx>
#include <vcl/ptrstyle.hxx>
@@ -1265,7 +1266,7 @@ void Edit::ImplCopyToSelectionClipboard()
{
if ( GetSelection().Len() )
{
- css::uno::Reference<css::datatransfer::clipboard::XClipboard> aSelection(GetPrimarySelection());
+ css::uno::Reference<css::datatransfer::clipboard::XClipboard> aSelection(GetSystemPrimarySelection());
ImplCopy( aSelection );
}
}
@@ -1366,7 +1367,7 @@ void Edit::MouseButtonUp( const MouseEvent& rMEvt )
else if ( rMEvt.IsMiddle() && !mbReadOnly &&
( GetSettings().GetMouseSettings().GetMiddleButtonAction() == MouseMiddleButtonAction::PasteSelection ) )
{
- css::uno::Reference<css::datatransfer::clipboard::XClipboard> aSelection(Window::GetPrimarySelection());
+ css::uno::Reference<css::datatransfer::clipboard::XClipboard> aSelection(GetSystemPrimarySelection());
ImplPaste( aSelection );
Modify();
}
diff --git a/vcl/source/edit/textview.cxx b/vcl/source/edit/textview.cxx
index 9d37d83827f5..aef67e174cfb 100644
--- a/vcl/source/edit/textview.cxx
+++ b/vcl/source/edit/textview.cxx
@@ -25,6 +25,7 @@
#include <vcl/settings.hxx>
#include "textdoc.hxx"
#include <vcl/textdata.hxx>
+#include <vcl/transfer.hxx>
#include <vcl/xtextedt.hxx>
#include "textdat2.hxx"
#include <vcl/commandevent.hxx>
@@ -442,7 +443,7 @@ bool TextView::KeyInput( const KeyEvent& rKeyEvent )
{
aCurSel = ImpMoveCursor( rKeyEvent );
if ( aCurSel.HasRange() ) {
- css::uno::Reference<css::datatransfer::clipboard::XClipboard> aSelection(GetWindow()->GetPrimarySelection());
+ css::uno::Reference<css::datatransfer::clipboard::XClipboard> aSelection(GetSystemPrimarySelection());
Copy( aSelection );
}
bMoved = true;
@@ -599,14 +600,14 @@ void TextView::MouseButtonUp( const MouseEvent& rMouseEvent )
if ( rMouseEvent.IsMiddle() && !IsReadOnly() &&
( GetWindow()->GetSettings().GetMouseSettings().GetMiddleButtonAction() == MouseMiddleButtonAction::PasteSelection ) )
{
- css::uno::Reference<css::datatransfer::clipboard::XClipboard> aSelection(GetWindow()->GetPrimarySelection());
+ css::uno::Reference<css::datatransfer::clipboard::XClipboard> aSelection(GetSystemPrimarySelection());
Paste( aSelection );
if ( mpImpl->mpTextEngine->IsModified() )
mpImpl->mpTextEngine->Broadcast( TextHint( SfxHintId::TextModified ) );
}
else if ( rMouseEvent.IsLeft() && GetSelection().HasRange() )
{
- css::uno::Reference<css::datatransfer::clipboard::XClipboard> aSelection(GetWindow()->GetPrimarySelection());
+ css::uno::Reference<css::datatransfer::clipboard::XClipboard> aSelection(GetSystemPrimarySelection());
Copy( aSelection );
}
}
diff --git a/vcl/source/treelist/transfer.cxx b/vcl/source/treelist/transfer.cxx
index 0c639cd60fa0..56c38019ab3b 100644
--- a/vcl/source/treelist/transfer.cxx
+++ b/vcl/source/treelist/transfer.cxx
@@ -981,15 +981,9 @@ void TransferableHelper::CopyToSelection(const Reference<XClipboard>& rSelection
}
}
-void TransferableHelper::CopyToSelection( vcl::Window *pWindow ) const
+void TransferableHelper::CopyToPrimarySelection() const
{
- DBG_ASSERT( pWindow, "Window pointer is NULL" );
- Reference< XClipboard > xSelection;
-
- if( pWindow )
- xSelection = pWindow->GetPrimarySelection();
-
- CopyToSelection(xSelection);
+ CopyToSelection(GetSystemPrimarySelection());
}
void TransferableHelper::StartDrag( vcl::Window* pWindow, sal_Int8 nDnDSourceActions )
@@ -1033,10 +1027,9 @@ void TransferableHelper::StartDrag( vcl::Window* pWindow, sal_Int8 nDnDSourceAct
}
}
-void TransferableHelper::ClearSelection( vcl::Window *pWindow )
+void TransferableHelper::ClearPrimarySelection()
{
- DBG_ASSERT( pWindow, "Window pointer is NULL" );
- Reference< XClipboard > xSelection( pWindow->GetPrimarySelection() );
+ Reference< XClipboard > xSelection(GetSystemPrimarySelection());
if( xSelection.is() )
xSelection->setContents( nullptr, nullptr );
@@ -2182,12 +2175,9 @@ TransferableDataHelper TransferableDataHelper::CreateFromSelection( vcl::Window*
{
DBG_ASSERT( pWindow, "Window pointer is NULL" );
- Reference< XClipboard > xSelection;
+ Reference< XClipboard > xSelection(GetSystemPrimarySelection());
TransferableDataHelper aRet;
- if( pWindow )
- xSelection = pWindow->GetPrimarySelection();
-
if( xSelection.is() )
{
SolarMutexReleaser aReleaser;
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index 308d1c6b5b55..9c874c1487b8 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -3424,15 +3424,6 @@ Reference< XClipboard > Window::GetClipboard()
return mpWindowImpl->mpFrameData->mxClipboard;
}
-Reference< XClipboard > Window::GetPrimarySelection()
-{
- if (!mpWindowImpl->mpFrameData)
- return static_cast<XClipboard*>(nullptr);
- if (!mpWindowImpl->mpFrameData->mxSelection.is())
- mpWindowImpl->mpFrameData->mxSelection = GetSystemPrimarySelection();
- return mpWindowImpl->mpFrameData->mxSelection;
-}
-
void Window::RecordLayoutData( vcl::ControlLayoutData* pLayout, const tools::Rectangle& rRect )
{
assert(mpOutDevData);