20#ifndef INCLUDED_VCL_INC_UNX_GTK_GTKINST_HXX
21#define INCLUDED_VCL_INC_UNX_GTK_GTKINST_HXX
30#include <com/sun/star/datatransfer/DataFlavor.hpp>
31#include <com/sun/star/datatransfer/dnd/XDragSource.hpp>
32#include <com/sun/star/datatransfer/dnd/XDropTarget.hpp>
33#include <com/sun/star/lang/XInitialization.hpp>
34#include <com/sun/star/lang/XServiceInfo.hpp>
35#include <com/sun/star/awt/XWindow.hpp>
56#if GTK_CHECK_VERSION(4, 0, 0)
57gint gtk_dialog_run(GtkDialog *dialog);
59struct read_transfer_result
61 enum { BlockSize = 8192 };
65 std::vector<sal_Int8> aVector;
67 static void read_block_async_completed(GObject* source, GAsyncResult* res, gpointer user_data);
69 OUString get_as_string()
const;
70 css::uno::Sequence<sal_Int8> get_as_sequence()
const;
78#if GTK_CHECK_VERSION(4, 0, 0)
79 std::vector<OString>
FormatsToGtk(
const css::uno::Sequence<css::datatransfer::DataFlavor> &rFormats);
81 std::vector<GtkTargetEntry>
FormatsToGtk(
const css::uno::Sequence<css::datatransfer::DataFlavor> &rFormats);
83#if GTK_CHECK_VERSION(4, 0, 0)
84 void setSelectionData(
const css::uno::Reference<css::datatransfer::XTransferable> &rTrans,
85 GdkContentProvider* provider,
86 const char* mime_type,
87 GOutputStream* stream,
90 GAsyncReadyCallback callback,
93 void setSelectionData(
const css::uno::Reference<css::datatransfer::XTransferable> &rTrans,
94 GtkSelectionData *selection_data, guint info);
97#if GTK_CHECK_VERSION(4, 0, 0)
107#if GTK_CHECK_VERSION(4, 0, 0)
113#if GTK_CHECK_VERSION(4, 0, 0)
120 virtual css::uno::Any SAL_CALL
getTransferData(
const css::datatransfer::DataFlavor& rFlavor)
override = 0;
126class GtkDnDTransferable;
128class GtkInstDropTarget final :
public cppu::WeakComponentImplHelper<css::datatransfer::dnd::XDropTarget,
129 css::lang::XInitialization,
130 css::lang::XServiceInfo>
138 std::vector<css::uno::Reference<css::datatransfer::dnd::XDropTargetListener>>
m_aListeners;
144 virtual void SAL_CALL
initialize(
const css::uno::Sequence<css::uno::Any>& rArgs)
override;
148 virtual void SAL_CALL
addDropTargetListener(
const css::uno::Reference<css::datatransfer::dnd::XDropTargetListener>&)
override;
161 void fire_dragEnter(
const css::datatransfer::dnd::DropTargetDragEnterEvent& dtdee);
162 void fire_dragOver(
const css::datatransfer::dnd::DropTargetDragEvent& dtde);
163 void fire_drop(
const css::datatransfer::dnd::DropTargetDropEvent& dtde);
171#if !GTK_CHECK_VERSION(4, 0, 0)
175 GdkDragAction
signalDragMotion(GtkDropTargetAsync *context, GdkDrop *drop,
double x,
double y);
176 gboolean
signalDragDrop(GtkDropTargetAsync *context, GdkDrop *drop,
double x,
double y);
181#if !GTK_CHECK_VERSION(4, 0, 0)
186class GtkInstDragSource final :
public cppu::WeakComponentImplHelper<css::datatransfer::dnd::XDragSource,
187 css::lang::XInitialization,
188 css::lang::XServiceInfo>
192 css::uno::Reference<css::datatransfer::dnd::XDragSourceListener>
m_xListener;
193 css::uno::Reference<css::datatransfer::XTransferable>
m_xTrans;
203 const css::uno::Reference<css::datatransfer::dnd::XDragSourceListener>& rListener);
205#if !GTK_CHECK_VERSION(4, 0, 0)
206 std::vector<GtkTargetEntry>
FormatsToGtk(
const css::uno::Sequence<css::datatransfer::DataFlavor> &rFormats);
217 const css::datatransfer::dnd::DragGestureEvent& trigger,
sal_Int8 sourceActions, sal_Int32 cursor, sal_Int32 image,
218 const css::uno::Reference< css::datatransfer::XTransferable >& transferable,
219 const css::uno::Reference< css::datatransfer::dnd::XDragSourceListener >& listener)
override;
222 virtual void SAL_CALL
initialize(
const css::uno::Sequence<css::uno::Any >& rArguments)
override;
233#if GTK_CHECK_VERSION(4, 0, 0)
266 virtual void AddToRecentDocumentList(
const OUString& rFileUrl,
const OUString& rMimeType,
const OUString& rDocumentService)
override;
267 virtual std::unique_ptr<SalVirtualDevice>
274 virtual bool DoYield(
bool bWait,
bool bHandleAllCurrentEvents)
override;
283 virtual css::uno::Reference< css::ui::dialogs::XFilePicker2 >
285 virtual css::uno::Reference< css::ui::dialogs::XFolderPicker2 >
288 virtual css::uno::Reference< css::uno::XInterface >
CreateClipboard(
const css::uno::Sequence< css::uno::Any >& i_rArguments )
override;
294 bool bAllowCycleFocusOut, sal_uInt64 nLOKWindowId = 0)
override;
334 TransportAsXWindow::clear();
virtual void SAL_CALL startDrag(const css::datatransfer::dnd::DragGestureEvent &trigger, sal_Int8 sourceActions, sal_Int32 cursor, sal_Int32 image, const css::uno::Reference< css::datatransfer::XTransferable > &transferable, const css::uno::Reference< css::datatransfer::dnd::XDragSourceListener > &listener) override
void dragDataGet(GtkSelectionData *data, guint info)
css::uno::Reference< css::datatransfer::XTransferable > const & GetTransferable() const
virtual sal_Int32 SAL_CALL getDefaultCursor(sal_Int8 dragAction) override
css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
css::uno::Reference< css::datatransfer::XTransferable > m_xTrans
VclToGtkHelper m_aConversionHelper
virtual sal_Bool SAL_CALL isDragImageSupported() override
OUString SAL_CALL getImplementationName() override
void set_datatransfer(const css::uno::Reference< css::datatransfer::XTransferable > &rTrans, const css::uno::Reference< css::datatransfer::dnd::XDragSourceListener > &rListener)
void dragEnd(GdkDragContext *context)
std::vector< GtkTargetEntry > FormatsToGtk(const css::uno::Sequence< css::datatransfer::DataFlavor > &rFormats)
css::uno::Reference< css::datatransfer::dnd::XDragSourceListener > m_xListener
sal_Bool SAL_CALL supportsService(OUString const &ServiceName) override
virtual ~GtkInstDragSource() override
void setActiveDragSource()
static GtkInstDragSource * g_ActiveDragSource
virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &rArguments) override
virtual sal_Bool SAL_CALL isActive() override
void signalDragDropReceived(GtkWidget *pWidget, GdkDragContext *context, gint x, gint y, GtkSelectionData *data, guint ttype, guint time)
css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual void SAL_CALL setActive(sal_Bool active) override
virtual void SAL_CALL removeDropTargetListener(const css::uno::Reference< css::datatransfer::dnd::XDropTargetListener > &) override
virtual void SAL_CALL addDropTargetListener(const css::uno::Reference< css::datatransfer::dnd::XDropTargetListener > &) override
virtual void SAL_CALL setDefaultActions(sal_Int8 actions) override
gboolean signalDragMotion(GtkWidget *pWidget, GdkDragContext *context, gint x, gint y, guint time)
void signalDragLeave(GtkWidget *pWidget)
void SetFormatConversionRequest(GtkDnDTransferable *pRequest)
void fire_dragOver(const css::datatransfer::dnd::DropTargetDragEvent &dtde)
virtual sal_Int8 SAL_CALL getDefaultActions() override
void fire_drop(const css::datatransfer::dnd::DropTargetDropEvent &dtde)
sal_Int8 m_nDefaultActions
virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &rArgs) override
OUString SAL_CALL getImplementationName() override
void fire_dragEnter(const css::datatransfer::dnd::DropTargetDragEnterEvent &dtdee)
GtkDnDTransferable * m_pFormatConversionRequest
virtual ~GtkInstDropTarget() override
void fire_dragExit(const css::datatransfer::dnd::DropTargetEvent &dte)
gboolean signalDragDrop(GtkWidget *pWidget, GdkDragContext *context, gint x, gint y, guint time)
std::vector< css::uno::Reference< css::datatransfer::dnd::XDropTargetListener > > m_aListeners
sal_Bool SAL_CALL supportsService(OUString const &ServiceName) override
virtual css::uno::Reference< css::uno::XInterface > CreateClipboard(const css::uno::Sequence< css::uno::Any > &i_rArguments) override
virtual std::unique_ptr< SalPrinter > CreatePrinter(SalInfoPrinter *pInfoPrinter) override
virtual bool IsMainThread() const override
virtual bool hasNativeFileSelection() const override
virtual std::unique_ptr< GenPspGraphics > CreatePrintGraphics() override
virtual SalFrame * CreateChildFrame(SystemParentData *pParent, SalFrameStyleFlags nStyle) override
css::uno::Reference< css::uno::XInterface > m_aClipboards[2]
virtual OpenGLContext * CreateOpenGLContext() override
virtual css::uno::Reference< css::uno::XInterface > ImplCreateDragSource(const SystemEnvData *) override
virtual SalFrame * CreateFrame(SalFrame *pParent, SalFrameStyleFlags nStyle) override
virtual std::unique_ptr< weld::Builder > CreateBuilder(weld::Widget *pParent, const OUString &rUIRoot, const OUString &rUIFile) override
virtual std::unique_ptr< SalMenu > CreateMenu(bool, Menu *) override
virtual css::uno::Reference< css::uno::XInterface > ImplCreateDropTarget(const SystemEnvData *) override
virtual css::uno::Reference< css::ui::dialogs::XFilePicker2 > createFilePicker(const css::uno::Reference< css::uno::XComponentContext > &) override
virtual css::uno::Reference< css::ui::dialogs::XFolderPicker2 > createFolderPicker(const css::uno::Reference< css::uno::XComponentContext > &) override
GtkInstance(std::unique_ptr< SalYieldMutex > pMutex)
virtual SalObject * CreateObject(SalFrame *pParent, SystemWindowData *pWindowData, bool bShow) override
virtual weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage) override
virtual std::unique_ptr< SalMenuItem > CreateMenuItem(const SalItemParams &) override
virtual void AfterAppInit() override
virtual std::unique_ptr< SalVirtualDevice > CreateVirtualDevice(SalGraphics &, tools::Long &nDX, tools::Long &nDY, DeviceFormat eFormat, const SystemGraphicsData *=nullptr) override
cairo_font_options_t * m_pLastCairoFontOptions
virtual bool DoYield(bool bWait, bool bHandleAllCurrentEvents) override
Wait for the next event (if bWait) and dispatch it, includes posted events, and timers.
virtual SalTimer * CreateSalTimer() override
void * CreateGStreamerSink(const SystemChildWindow *) override
virtual SalInfoPrinter * CreateInfoPrinter(SalPrinterQueueInfo *pPrinterQueueInfo, ImplJobSetup *pJobSetup) override
void ResetLastSeenCairoFontOptions(const cairo_font_options_t *pOptions)
virtual SalSystem * CreateSalSystem() override
virtual bool AnyInput(VclInputFlags nType) override
virtual void AddToRecentDocumentList(const OUString &rFileUrl, const OUString &rMimeType, const OUString &rDocumentService) override
virtual const cairo_font_options_t * GetCairoFontOptions() override
virtual weld::Window * GetFrameWeld(const css::uno::Reference< css::awt::XWindow > &rWindow) override
virtual std::unique_ptr< weld::Builder > CreateInterimBuilder(vcl::Window *pParent, const OUString &rUIRoot, const OUString &rUIFile, bool bAllowCycleFocusOut, sal_uInt64 nLOKWindowId=0) override
const cairo_font_options_t * GetLastSeenCairoFontOptions() const
virtual std::shared_ptr< SalBitmap > CreateSalBitmap() override
virtual ~GtkInstance() override
virtual css::uno::Any SAL_CALL getTransferData(const css::datatransfer::DataFlavor &rFlavor) override=0
std::map< OUString, GdkAtom > m_aMimeTypeToGtkType
virtual sal_Bool SAL_CALL isDataFlavorSupported(const css::datatransfer::DataFlavor &rFlavor) override
std::vector< css::datatransfer::DataFlavor > getTransferDataFlavorsAsVector(GdkAtom *targets, gint n_targets)
virtual std::vector< css::datatransfer::DataFlavor > getTransferDataFlavorsAsVector()=0
virtual css::uno::Sequence< css::datatransfer::DataFlavor > SAL_CALL getTransferDataFlavors() override
static thread_local std::stack< sal_uInt32 > yieldCounts
A SalFrame is a system window (e.g. an X11 window).
SalGtkXWindow(weld::Window *pWeldWidget, GtkWidget *pWidget)
GtkWidget * getGtkWidget() const
weld::Window * m_pWeldWidget
virtual void clear() override
weld::Window * getFrameWeld() const
TransportAsXWindow(weld::Widget *pWeldWidget, weld::Builder *pWeldWidgetBuilder=nullptr)
vcl::Font pango_to_vcl(const PangoFontDescription *font, const css::lang::Locale &rLocale)
GtkInstance * GetGtkInstance()
GdkPixbuf * load_icon_by_name(const OUString &rIconName)
struct _GtkWidget GtkWidget
struct _cairo_font_options cairo_font_options_t
std::vector< GtkTargetEntry > FormatsToGtk(const css::uno::Sequence< css::datatransfer::DataFlavor > &rFormats)
void setSelectionData(const css::uno::Reference< css::datatransfer::XTransferable > &rTrans, GtkSelectionData *selection_data, guint info)
std::vector< css::datatransfer::DataFlavor > aInfoToFlavor
GtkTargetEntry makeGtkTargetEntry(const css::datatransfer::DataFlavor &rFlavor)
SalInstance * GetSalInstance()