summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/svx/galtheme.hxx3
-rw-r--r--svx/source/gallery2/galbrws2.cxx32
-rw-r--r--svx/source/gallery2/galtheme.cxx6
-rw-r--r--svx/uiconfig/ui/gallerymenu2.ui22
4 files changed, 63 insertions, 0 deletions
diff --git a/include/svx/galtheme.hxx b/include/svx/galtheme.hxx
index 3659e68b1d70..003c013fe365 100644
--- a/include/svx/galtheme.hxx
+++ b/include/svx/galtheme.hxx
@@ -198,8 +198,11 @@ public:
SAL_DLLPRIVATE bool InsertTransferable( const css::uno::Reference< css::datatransfer::XTransferable >& rxTransferable, sal_uIntPtr nInsertPos );
+ SAL_DLLPRIVATE void CopyToClipboard( vcl::Window* pWindow, sal_uIntPtr nPos );
SAL_DLLPRIVATE void StartDrag( vcl::Window* pWindow, sal_uIntPtr nPos );
+public:
+
SAL_DLLPRIVATE SvStream& WriteData( SvStream& rOut ) const;
SAL_DLLPRIVATE SvStream& ReadData( SvStream& rIn );
static void InsertAllThemes( ListBox& rListBox );
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>