From d3313148d9ceb6427ddfef32b26b9d87cbdb3e14 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Fri, 28 Aug 2020 15:51:50 +0100 Subject: should check if edit is editable for allowing paste MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I70d490467f288043089aa5f8e6e79764be6e419a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/101554 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- extensions/source/bibliography/framectr.cxx | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'extensions') diff --git a/extensions/source/bibliography/framectr.cxx b/extensions/source/bibliography/framectr.cxx index aa1b91e85a1f..6e70479e20d2 100644 --- a/extensions/source/bibliography/framectr.cxx +++ b/extensions/source/bibliography/framectr.cxx @@ -650,23 +650,22 @@ void BibFrameController_Impl::addStatusListener( { vcl::Window* pChild = lcl_GetFocusChild( VCLUnoHelper::GetWindow( xWindow ) ); Edit* pEdit = dynamic_cast( pChild ); - if( pEdit ) - aEvent.IsEnabled = !pEdit->IsReadOnly() && pEdit->GetSelection().Len(); + aEvent.IsEnabled = pEdit && !pEdit->IsReadOnly() && pEdit->GetSelection().Len(); } if(aURL.Path == "Copy") { vcl::Window* pChild = lcl_GetFocusChild( VCLUnoHelper::GetWindow( xWindow ) ); Edit* pEdit = dynamic_cast( pChild ); - if( pEdit ) - aEvent.IsEnabled = pEdit->GetSelection().Len() > 0; + aEvent.IsEnabled = pEdit && pEdit->GetSelection().Len(); } else if(aURL.Path == "Paste" ) { - aEvent.IsEnabled = false; + aEvent.IsEnabled = false; vcl::Window* pChild = lcl_GetFocusChild( VCLUnoHelper::GetWindow( xWindow ) ); - if(pChild) + Edit* pEdit = dynamic_cast( pChild ); + if (pEdit && !pEdit->IsReadOnly()) { - uno::Reference< datatransfer::clipboard::XClipboard > xClip = pChild->GetClipboard(); + uno::Reference< datatransfer::clipboard::XClipboard > xClip = pEdit->GetClipboard(); if(xClip.is()) { uno::Reference< datatransfer::XTransferable > xDataObj; -- cgit