bump product version to 7.2.5.1
[LibreOffice.git] / vcl / inc / qt5 / Qt5DragAndDrop.hxx
blobc88465ab3ba68d5c1548056f1f297428876fbafb
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 */
11 #pragma once
13 #include <com/sun/star/datatransfer/dnd/XDragSource.hpp>
14 #include <com/sun/star/datatransfer/dnd/XDropTarget.hpp>
15 #include <com/sun/star/lang/XInitialization.hpp>
16 #include <com/sun/star/lang/XServiceInfo.hpp>
17 #include <cppuhelper/compbase.hxx>
19 class Qt5Frame;
21 class Qt5DragSource final
22 : public cppu::WeakComponentImplHelper<css::datatransfer::dnd::XDragSource,
23 css::lang::XInitialization, css::lang::XServiceInfo>
25 osl::Mutex m_aMutex;
26 Qt5Frame* m_pFrame;
27 css::uno::Reference<css::datatransfer::dnd::XDragSourceListener> m_xListener;
29 public:
30 Qt5DragSource()
31 : WeakComponentImplHelper(m_aMutex)
32 , m_pFrame(nullptr)
36 virtual ~Qt5DragSource() override;
38 // XDragSource
39 virtual sal_Bool SAL_CALL isDragImageSupported() override;
40 virtual sal_Int32 SAL_CALL getDefaultCursor(sal_Int8 dragAction) override;
41 virtual void SAL_CALL startDrag(
42 const css::datatransfer::dnd::DragGestureEvent& trigger, sal_Int8 sourceActions,
43 sal_Int32 cursor, sal_Int32 image,
44 const css::uno::Reference<css::datatransfer::XTransferable>& transferable,
45 const css::uno::Reference<css::datatransfer::dnd::XDragSourceListener>& listener) override;
47 // XInitialization
48 virtual void SAL_CALL initialize(const css::uno::Sequence<css::uno::Any>& rArguments) override;
49 void deinitialize();
51 OUString SAL_CALL getImplementationName() override;
53 sal_Bool SAL_CALL supportsService(OUString const& ServiceName) override;
55 css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
57 void fire_dragEnd(sal_Int8 nAction, bool bSuccessful);
60 class Qt5DropTarget final
61 : public cppu::WeakComponentImplHelper<css::datatransfer::dnd::XDropTarget,
62 css::datatransfer::dnd::XDropTargetDragContext,
63 css::datatransfer::dnd::XDropTargetDropContext,
64 css::lang::XInitialization, css::lang::XServiceInfo>
66 osl::Mutex m_aMutex;
67 Qt5Frame* m_pFrame;
68 sal_Int8 m_nDropAction;
69 bool m_bActive;
70 sal_Int8 m_nDefaultActions;
71 std::vector<css::uno::Reference<css::datatransfer::dnd::XDropTargetListener>> m_aListeners;
72 bool m_bDropSuccessful;
74 public:
75 Qt5DropTarget();
76 virtual ~Qt5DropTarget() override;
78 // XInitialization
79 virtual void SAL_CALL initialize(const css::uno::Sequence<css::uno::Any>& rArgs) override;
80 void deinitialize();
82 // XDropTarget
83 virtual void SAL_CALL addDropTargetListener(
84 const css::uno::Reference<css::datatransfer::dnd::XDropTargetListener>&) override;
85 virtual void SAL_CALL removeDropTargetListener(
86 const css::uno::Reference<css::datatransfer::dnd::XDropTargetListener>&) override;
87 virtual sal_Bool SAL_CALL isActive() override;
88 virtual void SAL_CALL setActive(sal_Bool active) override;
89 virtual sal_Int8 SAL_CALL getDefaultActions() override;
90 virtual void SAL_CALL setDefaultActions(sal_Int8 actions) override;
92 // XDropTargetDragContext
93 virtual void SAL_CALL acceptDrag(sal_Int8 dragOperation) override;
94 virtual void SAL_CALL rejectDrag() override;
96 // XDropTargetDropContext
97 virtual void SAL_CALL acceptDrop(sal_Int8 dropOperation) override;
98 virtual void SAL_CALL rejectDrop() override;
99 virtual void SAL_CALL dropComplete(sal_Bool success) override;
101 // XServiceInfo
102 OUString SAL_CALL getImplementationName() override;
103 sal_Bool SAL_CALL supportsService(OUString const& ServiceName) override;
104 css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
106 void fire_dragEnter(const css::datatransfer::dnd::DropTargetDragEnterEvent& dtde);
107 void fire_dragExit(const css::datatransfer::dnd::DropTargetEvent& dte);
108 void fire_dragOver(const css::datatransfer::dnd::DropTargetDragEnterEvent& dtde);
109 void fire_drop(const css::datatransfer::dnd::DropTargetDropEvent& dtde);
111 sal_Int8 proposedDropAction() const { return m_nDropAction; }
112 bool dropSuccessful() const { return m_bDropSuccessful; }
115 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */