diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-04-21 11:15:39 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-04-21 12:11:35 +0100 |
commit | d581ef6ee2d448ff30b77236006b6355f41f7449 (patch) | |
tree | 44a197fd9a335b446749b995ae69d6151345ce3e /svx | |
parent | 26930dfffe791de7d0c88d1a6dcb15498d6f6883 (diff) |
restore copy/paste menu entries
Change-Id: Ie1dab6857dd6efdb816a11997ef32f0cc3497047
Diffstat (limited to 'svx')
-rw-r--r-- | svx/source/gallery2/galbrws2.cxx | 32 | ||||
-rw-r--r-- | svx/source/gallery2/galtheme.cxx | 6 | ||||
-rw-r--r-- | svx/uiconfig/ui/gallerymenu2.ui | 22 |
3 files changed, 60 insertions, 0 deletions
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<vcl::Window*>(mpIconView); break; + case GALLERYBROWSERMODE_LIST: pWindow = static_cast<vcl::Window*>(mpListView); break; + case GALLERYBROWSERMODE_PREVIEW: pWindow = static_cast<vcl::Window*>(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 @@ <property name="label" translatable="yes">_Delete</property> </object> </child> + <child> + <object class="GtkSeparatorMenuItem" id="menuitem4"> + <property name="visible">True</property> + <property name="can_focus">False</property> + </object> + </child> + <child> + <object class="GtkMenuItem" id="copy"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">_Copy</property> + <property name="use_underline">True</property> + </object> + </child> + <child> + <object class="GtkMenuItem" id="paste"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes">_Insert</property> + <property name="use_underline">True</property> + </object> + </child> </object> </interface> |