From d581ef6ee2d448ff30b77236006b6355f41f7449 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Fri, 21 Apr 2017 11:15:39 +0100 Subject: restore copy/paste menu entries Change-Id: Ie1dab6857dd6efdb816a11997ef32f0cc3497047 --- svx/source/gallery2/galbrws2.cxx | 32 ++++++++++++++++++++++++++++++++ svx/source/gallery2/galtheme.cxx | 6 ++++++ svx/uiconfig/ui/gallerymenu2.ui | 22 ++++++++++++++++++++++ 3 files changed, 60 insertions(+) (limited to 'svx') diff --git a/svx/source/gallery2/galbrws2.cxx b/svx/source/gallery2/galbrws2.cxx index 2cce206440f8..a09b0436d9be 100644 --- a/svx/source/gallery2/galbrws2.cxx +++ b/svx/source/gallery2/galbrws2.cxx @@ -247,11 +247,18 @@ void GalleryThemePopup::ExecutePopup( vcl::Window *pWindow, const ::Point &aPos { mpPopupMenu->EnableItem(mpPopupMenu->GetItemId("delete"), false); mpPopupMenu->EnableItem(mpPopupMenu->GetItemId("title"), false); + if (mpTheme->IsReadOnly()) + mpPopupMenu->EnableItem(mpPopupMenu->GetItemId("paste"), false); + + if (!mpTheme->GetObjectCount()) + mpPopupMenu->EnableItem(mpPopupMenu->GetItemId("copy"), false); } else { mpPopupMenu->EnableItem(mpPopupMenu->GetItemId("delete"), !mbPreview); mpPopupMenu->EnableItem(mpPopupMenu->GetItemId("title")); + mpPopupMenu->EnableItem(mpPopupMenu->GetItemId("copy")); + mpPopupMenu->EnableItem(mpPopupMenu->GetItemId("paste")); } // update status @@ -1131,6 +1138,31 @@ void GalleryBrowser2::Execute(const OString &rIdent) } } } + else if (rIdent == "copy") + { + vcl::Window* pWindow; + + switch( GetMode() ) + { + case GALLERYBROWSERMODE_ICON: pWindow = static_cast(mpIconView); break; + case GALLERYBROWSERMODE_LIST: pWindow = static_cast(mpListView); break; + case GALLERYBROWSERMODE_PREVIEW: pWindow = static_cast(mpPreview); break; + + default: + pWindow = nullptr; + break; + } + + mpCurTheme->CopyToClipboard( pWindow, mnCurActionPos ); + } + else if (rIdent == "paste") + { + if( !mpCurTheme->IsReadOnly() ) + { + TransferableDataHelper aDataHelper( TransferableDataHelper::CreateFromSystemClipboard( this ) ); + mpCurTheme->InsertTransferable( aDataHelper.GetTransferable(), mnCurActionPos ); + } + } } } diff --git a/svx/source/gallery2/galtheme.cxx b/svx/source/gallery2/galtheme.cxx index 0139756651d2..9ec3adf6333f 100644 --- a/svx/source/gallery2/galtheme.cxx +++ b/svx/source/gallery2/galtheme.cxx @@ -1264,6 +1264,12 @@ bool GalleryTheme::InsertTransferable( const uno::Reference< datatransfer::XTran return bRet; } +void GalleryTheme::CopyToClipboard( vcl::Window* pWindow, sal_uIntPtr nPos ) +{ + GalleryTransferable* pTransferable = new GalleryTransferable( this, nPos, false ); + pTransferable->CopyToClipboard( pWindow ); +} + void GalleryTheme::StartDrag( vcl::Window* pWindow, sal_uIntPtr nPos ) { GalleryTransferable* pTransferable = new GalleryTransferable( this, nPos, true ); diff --git a/svx/uiconfig/ui/gallerymenu2.ui b/svx/uiconfig/ui/gallerymenu2.ui index 3fda767be80b..6b389617e54a 100644 --- a/svx/uiconfig/ui/gallerymenu2.ui +++ b/svx/uiconfig/ui/gallerymenu2.ui @@ -61,5 +61,27 @@ _Delete + + + True + False + + + + + True + False + _Copy + True + + + + + True + False + _Insert + True + + -- cgit