summaryrefslogtreecommitdiff
path: root/vcl/unx/gtk3/gtk3gtkinst.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/unx/gtk3/gtk3gtkinst.cxx')
-rw-r--r--vcl/unx/gtk3/gtk3gtkinst.cxx559
1 files changed, 390 insertions, 169 deletions
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index a3f30683cbdb..f914e4546f6a 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -20,8 +20,6 @@
#include "com/sun/star/datatransfer/clipboard/XClipboardListener.hpp"
#include "com/sun/star/datatransfer/clipboard/XFlushableClipboard.hpp"
#include "com/sun/star/datatransfer/clipboard/XSystemClipboard.hpp"
-#include "com/sun/star/datatransfer/dnd/XDragSource.hpp"
-#include "com/sun/star/datatransfer/dnd/XDropTarget.hpp"
#include "com/sun/star/datatransfer/dnd/DNDConstants.hpp"
#include <comphelper/processfactory.hxx>
#include <comphelper/sequence.hxx>
@@ -93,15 +91,87 @@ namespace
};
}
-class GtkTransferable : public ::cppu::WeakImplHelper <
- css::datatransfer::XTransferable >
+std::vector<css::datatransfer::DataFlavor> GtkTransferable::getTransferDataFlavorsAsVector(GdkAtom *targets, gint n_targets)
+{
+ std::vector<css::datatransfer::DataFlavor> aVector;
+
+ bool bHaveText = false, bHaveUTF16 = false;
+
+ for (gint i = 0; i < n_targets; ++i)
+ {
+ gchar* pName = gdk_atom_name(targets[i]);
+ const char* pFinalName = pName;
+ css::datatransfer::DataFlavor aFlavor;
+
+ for (size_t j = 0; j < SAL_N_ELEMENTS(aConversionTab); ++j)
+ {
+ if (rtl_str_compare(pName, aConversionTab[j].pNativeType) == 0)
+ {
+ pFinalName = aConversionTab[j].pType;
+ break;
+ }
+ }
+
+ aFlavor.MimeType = OUString(pFinalName,
+ rtl_str_getLength(pFinalName),
+ RTL_TEXTENCODING_UTF8);
+
+ m_aMimeTypeToAtom[aFlavor.MimeType] = targets[i];
+
+ aFlavor.DataType = cppu::UnoType<Sequence< sal_Int8 >>::get();
+
+ sal_Int32 nIndex(0);
+ if (aFlavor.MimeType.getToken(0, ';', nIndex) == "text/plain")
+ {
+ bHaveText = true;
+ OUString aToken(aFlavor.MimeType.getToken(0, ';', nIndex));
+ if (aToken == "charset=utf-16")
+ {
+ bHaveUTF16 = true;
+ aFlavor.DataType = cppu::UnoType<OUString>::get();
+ }
+ }
+ aVector.push_back(aFlavor);
+ g_free(pName);
+ }
+
+ //If we have text, but no UTF-16 format which is basically the only
+ //text-format LibreOffice supports for cnp then claim we do and we
+ //will convert on demand
+ if (bHaveText && !bHaveUTF16)
+ {
+ css::datatransfer::DataFlavor aFlavor;
+ aFlavor.MimeType = "text/plain;charset=utf-16";
+ aFlavor.DataType = cppu::UnoType<OUString>::get();
+ aVector.push_back(aFlavor);
+ }
+
+ return aVector;
+}
+
+
+css::uno::Sequence<css::datatransfer::DataFlavor> SAL_CALL GtkTransferable::getTransferDataFlavors()
+ throw(css::uno::RuntimeException, std::exception)
+{
+ return comphelper::containerToSequence(getTransferDataFlavorsAsVector());
+}
+
+sal_Bool SAL_CALL GtkTransferable::isDataFlavorSupported(const css::datatransfer::DataFlavor& rFlavor)
+ throw(css::uno::RuntimeException, std::exception)
+{
+ const std::vector<css::datatransfer::DataFlavor> aAll =
+ getTransferDataFlavorsAsVector();
+
+ return std::find_if(aAll.begin(), aAll.end(), DataFlavorEq(rFlavor)) != aAll.end();
+}
+
+class GtkClipboardTransferable : public GtkTransferable
{
private:
GdkAtom m_nSelection;
- std::map<OUString, GdkAtom> m_aMimeTypeToAtom;
public:
- explicit GtkTransferable(GdkAtom nSelection)
+ explicit GtkClipboardTransferable(GdkAtom nSelection)
: m_nSelection(nSelection)
{
}
@@ -146,6 +216,7 @@ public:
}
std::vector<css::datatransfer::DataFlavor> getTransferDataFlavorsAsVector()
+ override
{
std::vector<css::datatransfer::DataFlavor> aVector;
@@ -155,77 +226,12 @@ public:
gint n_targets;
if (gtk_clipboard_wait_for_targets(clipboard, &targets, &n_targets))
{
- bool bHaveText = false, bHaveUTF16 = false;
-
- for (gint i = 0; i < n_targets; ++i)
- {
- gchar* pName = gdk_atom_name(targets[i]);
- const char* pFinalName = pName;
- css::datatransfer::DataFlavor aFlavor;
-
- for (size_t j = 0; j < SAL_N_ELEMENTS(aConversionTab); ++j)
- {
- if (rtl_str_compare(pName, aConversionTab[j].pNativeType) == 0)
- {
- pFinalName = aConversionTab[j].pType;
- break;
- }
- }
-
- aFlavor.MimeType = OUString(pFinalName,
- rtl_str_getLength(pFinalName),
- RTL_TEXTENCODING_UTF8);
-
- m_aMimeTypeToAtom[aFlavor.MimeType] = targets[i];
-
- aFlavor.DataType = cppu::UnoType<Sequence< sal_Int8 >>::get();
-
- sal_Int32 nIndex(0);
- if (aFlavor.MimeType.getToken(0, ';', nIndex) == "text/plain")
- {
- bHaveText = true;
- OUString aToken(aFlavor.MimeType.getToken(0, ';', nIndex));
- if (aToken == "charset=utf-16")
- {
- bHaveUTF16 = true;
- aFlavor.DataType = cppu::UnoType<OUString>::get();
- }
- }
- aVector.push_back(aFlavor);
- g_free(pName);
- }
-
+ aVector = GtkTransferable::getTransferDataFlavorsAsVector(targets, n_targets);
g_free(targets);
-
- //If we have text, but no UTF-16 format which is basically the only
- //text-format LibreOffice supports for cnp then claim we do and we
- //will convert on demand
- if (bHaveText && !bHaveUTF16)
- {
- css::datatransfer::DataFlavor aFlavor;
- aFlavor.MimeType = "text/plain;charset=utf-16";
- aFlavor.DataType = cppu::UnoType<OUString>::get();
- aVector.push_back(aFlavor);
- }
}
return aVector;
}
-
- virtual css::uno::Sequence<css::datatransfer::DataFlavor> SAL_CALL getTransferDataFlavors()
- throw(css::uno::RuntimeException, std::exception) override
- {
- return comphelper::containerToSequence(getTransferDataFlavorsAsVector());
- }
-
- virtual sal_Bool SAL_CALL isDataFlavorSupported(const css::datatransfer::DataFlavor& rFlavor)
- throw(css::uno::RuntimeException, std::exception) override
- {
- const std::vector<css::datatransfer::DataFlavor> aAll =
- getTransferDataFlavorsAsVector();
-
- return std::find_if(aAll.begin(), aAll.end(), DataFlavorEq(rFlavor)) != aAll.end();
- }
};
//We want to use gtk_clipboard_get_owner own owner-change to distinguish between
@@ -286,7 +292,7 @@ class VclGtkClipboard :
Reference<css::datatransfer::clipboard::XClipboardOwner> m_aOwner;
std::list< Reference<css::datatransfer::clipboard::XClipboardListener> > m_aListeners;
std::vector<GtkTargetEntry> m_aGtkTargets;
- std::vector<css::datatransfer::DataFlavor> m_aInfoToFlavor;
+ VclToGtkHelper m_aConversionHelper;
public:
@@ -301,9 +307,6 @@ public:
virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw( RuntimeException, std::exception ) override;
virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() throw( RuntimeException, std::exception ) override;
- static OUString getImplementationName_static();
- static Sequence< OUString > getSupportedServiceNames_static();
-
/*
* XClipboard
*/
@@ -346,29 +349,17 @@ public:
void ClipboardGet(GtkClipboard *clipboard, GtkSelectionData *selection_data, guint info);
void ClipboardClear(GtkClipboard *clipboard);
void OwnerChanged(GtkClipboard *clipboard, GdkEvent *event);
-private:
- GtkTargetEntry makeGtkTargetEntry(const css::datatransfer::DataFlavor& rFlavor);
};
-OUString VclGtkClipboard::getImplementationName_static()
-{
- return OUString( "com.sun.star.datatransfer.VclGtkClipboard" );
-}
-
-Sequence< OUString > VclGtkClipboard::getSupportedServiceNames_static()
-{
- Sequence< OUString > aRet { "com.sun.star.datatransfer.clipboard.SystemClipboard" };
- return aRet;
-}
-
OUString VclGtkClipboard::getImplementationName() throw( RuntimeException, std::exception )
{
- return getImplementationName_static();
+ return OUString("com.sun.star.datatransfer.VclGtkClipboard");
}
Sequence< OUString > VclGtkClipboard::getSupportedServiceNames() throw( RuntimeException, std::exception )
{
- return getSupportedServiceNames_static();
+ Sequence<OUString> aRet { "com.sun.star.datatransfer.clipboard.SystemClipboard" };
+ return aRet;
}
sal_Bool VclGtkClipboard::supportsService( const OUString& ServiceName ) throw( RuntimeException, std::exception )
@@ -383,7 +374,7 @@ Reference< css::datatransfer::XTransferable > VclGtkClipboard::getContents() thr
{
//tdf#93887 This is the system clipboard/selection. We fetch it when we are not
//the owner of the clipboard and have not already fetched it.
- m_aContents = new GtkTransferable(m_nSelection);
+ m_aContents = new GtkClipboardTransferable(m_nSelection);
}
return m_aContents;
}
@@ -393,12 +384,53 @@ void VclGtkClipboard::ClipboardGet(GtkClipboard* /*clipboard*/, GtkSelectionData
{
if (!m_aContents.is())
return;
+ m_aConversionHelper.setSelectionData(m_aContents, selection_data, info);
+}
- GdkAtom type(gdk_atom_intern(OUStringToOString(m_aInfoToFlavor[info].MimeType,
+void VclGtkClipboard::OwnerChanged(GtkClipboard* clipboard, GdkEvent* /*event*/)
+{
+ if (G_OBJECT(m_pOwner) != gtk_clipboard_get_owner(clipboard))
+ {
+ //null out m_aContents to return control to the system-one which
+ //will be retrieved if getContents is called again
+ setContents(Reference<css::datatransfer::XTransferable>(),
+ Reference<css::datatransfer::clipboard::XClipboardOwner>());
+ }
+}
+
+void VclGtkClipboard::ClipboardClear(GtkClipboard * /*clipboard*/)
+{
+ for (auto &a : m_aGtkTargets)
+ g_free(a.target);
+ m_aGtkTargets.clear();
+}
+
+GtkTargetEntry VclToGtkHelper::makeGtkTargetEntry(const css::datatransfer::DataFlavor& rFlavor)
+{
+ GtkTargetEntry aEntry;
+ aEntry.target =
+ g_strdup(OUStringToOString(rFlavor.MimeType, RTL_TEXTENCODING_UTF8).getStr());
+ aEntry.flags = 0;
+ auto it = std::find_if(aInfoToFlavor.begin(), aInfoToFlavor.end(),
+ DataFlavorEq(rFlavor));
+ if (it != aInfoToFlavor.end())
+ aEntry.info = std::distance(aInfoToFlavor.begin(), it);
+ else
+ {
+ aEntry.info = aInfoToFlavor.size();
+ aInfoToFlavor.push_back(rFlavor);
+ }
+ return aEntry;
+}
+
+void VclToGtkHelper::setSelectionData(const Reference<css::datatransfer::XTransferable> &rTrans,
+ GtkSelectionData *selection_data, guint info)
+{
+ GdkAtom type(gdk_atom_intern(OUStringToOString(aInfoToFlavor[info].MimeType,
RTL_TEXTENCODING_UTF8).getStr(),
false));
- css::datatransfer::DataFlavor aFlavor(m_aInfoToFlavor[info]);
+ css::datatransfer::DataFlavor aFlavor(aInfoToFlavor[info]);
if (aFlavor.MimeType == "UTF8_STRING" || aFlavor.MimeType == "STRING")
aFlavor.MimeType = "text/plain;charset=utf-8";
@@ -407,9 +439,9 @@ void VclGtkClipboard::ClipboardGet(GtkClipboard* /*clipboard*/, GtkSelectionData
try
{
- aValue = m_aContents->getTransferData(aFlavor);
+ aValue = rTrans->getTransferData(aFlavor);
}
- catch(...)
+ catch (...)
{
}
@@ -430,9 +462,9 @@ void VclGtkClipboard::ClipboardGet(GtkClipboard* /*clipboard*/, GtkSelectionData
aFlavor.DataType = cppu::UnoType<OUString>::get();
try
{
- aValue = m_aContents->getTransferData(aFlavor);
+ aValue = rTrans->getTransferData(aFlavor);
}
- catch(...)
+ catch (...)
{
}
OUString aString;
@@ -449,42 +481,6 @@ void VclGtkClipboard::ClipboardGet(GtkClipboard* /*clipboard*/, GtkSelectionData
aData.getLength());
}
-void VclGtkClipboard::OwnerChanged(GtkClipboard* clipboard, GdkEvent* /*event*/)
-{
- if (G_OBJECT(m_pOwner) != gtk_clipboard_get_owner(clipboard))
- {
- //null out m_aContents to return control to the system-one which
- //will be retrieved if getContents is called again
- setContents(Reference<css::datatransfer::XTransferable>(),
- Reference<css::datatransfer::clipboard::XClipboardOwner>());
- }
-}
-
-void VclGtkClipboard::ClipboardClear(GtkClipboard * /*clipboard*/)
-{
- for (auto &a : m_aGtkTargets)
- g_free(a.target);
- m_aGtkTargets.clear();
-}
-
-GtkTargetEntry VclGtkClipboard::makeGtkTargetEntry(const css::datatransfer::DataFlavor& rFlavor)
-{
- GtkTargetEntry aEntry;
- aEntry.target =
- g_strdup(OUStringToOString(rFlavor.MimeType, RTL_TEXTENCODING_UTF8).getStr());
- aEntry.flags = 0;
- auto it = std::find_if(m_aInfoToFlavor.begin(), m_aInfoToFlavor.end(),
- DataFlavorEq(rFlavor));
- if (it != m_aInfoToFlavor.end())
- aEntry.info = std::distance(m_aInfoToFlavor.begin(), it);
- else
- {
- aEntry.info = m_aInfoToFlavor.size();
- m_aInfoToFlavor.push_back(rFlavor);
- }
- return aEntry;
-}
-
namespace
{
void ClipboardGetFunc(GtkClipboard *clipboard, GtkSelectionData *selection_data,
@@ -539,6 +535,47 @@ VclGtkClipboard::~VclGtkClipboard()
ClipboardClear(nullptr);
}
+std::vector<GtkTargetEntry> VclToGtkHelper::FormatsToGtk(const css::uno::Sequence<css::datatransfer::DataFlavor> &rFormats)
+{
+ std::vector<GtkTargetEntry> aGtkTargets;
+
+ bool bHaveText(false), bHaveUTF8(false);
+ for (int i = 0; i < rFormats.getLength(); ++i)
+ {
+ const css::datatransfer::DataFlavor& rFlavor = rFormats[i];
+
+ sal_Int32 nIndex(0);
+ if (rFlavor.MimeType.getToken(0, ';', nIndex) == "text/plain")
+ {
+ bHaveText = true;
+ OUString aToken(rFlavor.MimeType.getToken(0, ';', nIndex));
+ if (aToken == "charset=utf-8")
+ {
+ bHaveUTF8 = true;
+ }
+ }
+ GtkTargetEntry aEntry(makeGtkTargetEntry(rFlavor));
+ aGtkTargets.push_back(aEntry);
+ }
+
+ if (bHaveText)
+ {
+ css::datatransfer::DataFlavor aFlavor;
+ aFlavor.DataType = cppu::UnoType<Sequence< sal_Int8 >>::get();
+ if (!bHaveUTF8)
+ {
+ aFlavor.MimeType = "text/plain;charset=utf-8";
+ aGtkTargets.push_back(makeGtkTargetEntry(aFlavor));
+ }
+ aFlavor.MimeType = "UTF8_STRING";
+ aGtkTargets.push_back(makeGtkTargetEntry(aFlavor));
+ aFlavor.MimeType = "STRING";
+ aGtkTargets.push_back(makeGtkTargetEntry(aFlavor));
+ }
+
+ return aGtkTargets;
+}
+
void VclGtkClipboard::setContents(
const Reference< css::datatransfer::XTransferable >& xTrans,
const Reference< css::datatransfer::clipboard::XClipboardOwner >& xClipboardOwner )
@@ -556,41 +593,7 @@ void VclGtkClipboard::setContents(
if (m_aContents.is())
{
css::uno::Sequence<css::datatransfer::DataFlavor> aFormats = xTrans->getTransferDataFlavors();
- std::vector<GtkTargetEntry> aGtkTargets;
- bool bHaveText(false), bHaveUTF8(false);
- for (int i = 0; i < aFormats.getLength(); ++i)
- {
- const css::datatransfer::DataFlavor& rFlavor = aFormats[i];
-
- sal_Int32 nIndex(0);
- if (rFlavor.MimeType.getToken(0, ';', nIndex) == "text/plain")
- {
- bHaveText = true;
- OUString aToken(rFlavor.MimeType.getToken(0, ';', nIndex));
- if (aToken == "charset=utf-8")
- {
- bHaveUTF8 = true;
- }
- }
- GtkTargetEntry aEntry(makeGtkTargetEntry(rFlavor));
- aGtkTargets.push_back(aEntry);
- }
-
- if (bHaveText)
- {
- css::datatransfer::DataFlavor aFlavor;
- aFlavor.DataType = cppu::UnoType<Sequence< sal_Int8 >>::get();
- if (!bHaveUTF8)
- {
- aFlavor.MimeType = "text/plain;charset=utf-8";
- aGtkTargets.push_back(makeGtkTargetEntry(aFlavor));
- }
- aFlavor.MimeType = "UTF8_STRING";
- aGtkTargets.push_back(makeGtkTargetEntry(aFlavor));
- aFlavor.MimeType = "STRING";
- aGtkTargets.push_back(makeGtkTargetEntry(aFlavor));
- }
-
+ std::vector<GtkTargetEntry> aGtkTargets(m_aConversionHelper.FormatsToGtk(aFormats));
if (!aGtkTargets.empty())
{
//if there was a previous gtk_clipboard_set_with_data call then
@@ -604,6 +607,10 @@ void VclGtkClipboard::setContents(
ClipboardGetFunc, ClipboardClearFunc, G_OBJECT(m_pOwner));
gtk_clipboard_set_can_store(clipboard, aGtkTargets.data(), aGtkTargets.size());
}
+
+ for (auto &a : m_aGtkTargets)
+ g_free(a.target);
+
m_aGtkTargets = aGtkTargets;
}
@@ -662,4 +669,218 @@ Reference< XInterface > GtkInstance::CreateClipboard(const Sequence< Any >& argu
return Reference< XInterface >( static_cast<cppu::OWeakObject *>(new VclGtkClipboard(nSelection)) );
}
+GtkDropTarget::GtkDropTarget()
+ : WeakComponentImplHelper(m_aMutex)
+ , m_pFrame(nullptr)
+ , m_bActive(false)
+ , m_nDefaultActions(0)
+{
+}
+
+OUString SAL_CALL GtkDropTarget::getImplementationName()
+ throw (css::uno::RuntimeException, std::exception)
+{
+ return OUString("com.sun.star.datatransfer.dnd.VclGtkDropTarget");
+}
+
+sal_Bool SAL_CALL GtkDropTarget::supportsService(OUString const & ServiceName)
+ throw (css::uno::RuntimeException, std::exception)
+{
+ return cppu::supportsService(this, ServiceName);
+}
+
+css::uno::Sequence<OUString> SAL_CALL GtkDropTarget::getSupportedServiceNames()
+ throw (css::uno::RuntimeException, std::exception)
+{
+ Sequence<OUString> aRet { "com.sun.star.datatransfer.dnd.GtkDropTarget" };
+ return aRet;
+}
+
+GtkDropTarget::~GtkDropTarget()
+{
+ if (m_pFrame)
+ m_pFrame->deregisterDropTarget(this);
+}
+
+void GtkDropTarget::deinitialize()
+{
+ m_pFrame = nullptr;
+ m_bActive = false;
+}
+
+void GtkDropTarget::initialize(const Sequence<Any>& rArguments) throw( Exception, std::exception )
+{
+ if (rArguments.getLength() < 2)
+ {
+ throw RuntimeException("DropTarget::initialize: Cannot install window event handler",
+ static_cast<OWeakObject*>(this));
+ }
+
+ sal_Size nFrame = 0;
+ rArguments.getConstArray()[1] >>= nFrame;
+
+ if (!nFrame)
+ {
+ throw RuntimeException("DropTarget::initialize: missing SalFrame",
+ static_cast<OWeakObject*>(this));
+ }
+
+ m_pFrame = reinterpret_cast<GtkSalFrame*>(nFrame);
+ m_pFrame->registerDropTarget(this);
+ m_bActive = true;
+}
+
+void GtkDropTarget::addDropTargetListener( const Reference< css::datatransfer::dnd::XDropTargetListener >& xListener) throw(std::exception)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( m_aMutex );
+
+ m_aListeners.push_back( xListener );
+}
+
+void GtkDropTarget::removeDropTargetListener( const Reference< css::datatransfer::dnd::XDropTargetListener >& xListener) throw(std::exception)
+{
+ ::osl::Guard< ::osl::Mutex > aGuard( m_aMutex );
+
+ m_aListeners.remove( xListener );
+}
+
+void GtkDropTarget::fire_drop(const css::datatransfer::dnd::DropTargetDropEvent& dtde)
+{
+ osl::ClearableGuard<osl::Mutex> aGuard( m_aMutex );
+ std::list<css::uno::Reference<css::datatransfer::dnd::XDropTargetListener>> aListeners(m_aListeners);
+ aGuard.clear();
+
+ for (auto it = aListeners.begin(); it != aListeners.end(); ++it)
+ {
+ (*it)->drop( dtde );
+ }
+}
+
+void GtkDropTarget::fire_dragEnter(const css::datatransfer::dnd::DropTargetDragEnterEvent& dtde)
+{
+ osl::ClearableGuard< ::osl::Mutex > aGuard( m_aMutex );
+ std::list<css::uno::Reference<css::datatransfer::dnd::XDropTargetListener>> aListeners(m_aListeners);
+ aGuard.clear();
+
+ for (auto it = aListeners.begin(); it != aListeners.end(); ++it)
+ {
+ (*it)->dragEnter( dtde );
+ }
+}
+
+void GtkDropTarget::fire_dragOver(const css::datatransfer::dnd::DropTargetDragEvent& dtde)
+{
+ osl::ClearableGuard< ::osl::Mutex > aGuard( m_aMutex );
+ std::list<css::uno::Reference<css::datatransfer::dnd::XDropTargetListener>> aListeners(m_aListeners);
+ aGuard.clear();
+
+ for (auto it = aListeners.begin(); it != aListeners.end(); ++it)
+ {
+ (*it)->dragOver( dtde );
+ }
+}
+
+void GtkDropTarget::fire_dragExit(const css::datatransfer::dnd::DropTargetEvent& dte)
+{
+ osl::ClearableGuard< ::osl::Mutex > aGuard( m_aMutex );
+ std::list<css::uno::Reference<css::datatransfer::dnd::XDropTargetListener>> aListeners(m_aListeners);
+ aGuard.clear();
+
+ for (auto it = aListeners.begin(); it != aListeners.end(); ++it)
+ {
+ (*it)->dragExit( dte );
+ }
+}
+
+sal_Bool GtkDropTarget::isActive() throw(std::exception)
+{
+ return m_bActive;
+}
+
+void GtkDropTarget::setActive(sal_Bool bActive) throw(std::exception)
+{
+ m_bActive = bActive;
+}
+
+sal_Int8 GtkDropTarget::getDefaultActions() throw(std::exception)
+{
+ return m_nDefaultActions;
+}
+
+void GtkDropTarget::setDefaultActions(sal_Int8 nDefaultActions) throw(std::exception)
+{
+ m_nDefaultActions = nDefaultActions;
+}
+
+Reference< XInterface > GtkInstance::CreateDropTarget()
+{
+ return Reference< XInterface >( static_cast<cppu::OWeakObject *>(new GtkDropTarget()) );
+}
+
+GtkDragSource::~GtkDragSource()
+{
+ if (m_pFrame)
+ m_pFrame->deregisterDragSource(this);
+}
+
+void GtkDragSource::deinitialize()
+{
+ m_pFrame = nullptr;
+}
+
+sal_Bool GtkDragSource::isDragImageSupported() throw(std::exception)
+{
+ return true;
+}
+
+sal_Int32 GtkDragSource::getDefaultCursor( sal_Int8 ) throw(std::exception)
+{
+ return 0;
+}
+
+void GtkDragSource::initialize(const css::uno::Sequence<css::uno::Any >& rArguments) throw(Exception, std::exception)
+{
+ if (rArguments.getLength() < 2)
+ {
+ throw RuntimeException("DragSource::initialize: Cannot install window event handler",
+ static_cast<OWeakObject*>(this));
+ }
+
+ sal_Size nFrame = 0;
+ rArguments.getConstArray()[1] >>= nFrame;
+
+ if (!nFrame)
+ {
+ throw RuntimeException("DragSource::initialize: missing SalFrame",
+ static_cast<OWeakObject*>(this));
+ }
+
+ m_pFrame = reinterpret_cast<GtkSalFrame*>(nFrame);
+ m_pFrame->registerDragSource(this);
+}
+
+OUString SAL_CALL GtkDragSource::getImplementationName()
+ throw (css::uno::RuntimeException, std::exception)
+{
+ return OUString("com.sun.star.datatransfer.dnd.VclGtkDragSource");
+}
+
+sal_Bool SAL_CALL GtkDragSource::supportsService(OUString const & ServiceName)
+ throw (css::uno::RuntimeException, std::exception)
+{
+ return cppu::supportsService(this, ServiceName);
+}
+
+css::uno::Sequence<OUString> SAL_CALL GtkDragSource::getSupportedServiceNames()
+ throw (css::uno::RuntimeException, std::exception)
+{
+ Sequence<OUString> aRet { "com.sun.star.datatransfer.dnd.GtkDragSource" };
+ return aRet;
+}
+
+Reference< XInterface > GtkInstance::CreateDragSource()
+{
+ return Reference< XInterface >( static_cast<cppu::OWeakObject *>(new GtkDragSource()) );
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */