vcl: Drop local var pointing to self in WindowData ctor
[LibreOffice.git] / vcl / inc / dndeventdispatcher.hxx
blob0b3f585602820d1c3c218d4feba9dee0795863e6
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 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_VCL_INC_DNDEVENTDISPATCHER_HXX
21 #define INCLUDED_VCL_INC_DNDEVENTDISPATCHER_HXX
23 #include <com/sun/star/datatransfer/dnd/XDropTargetListener.hpp>
24 #include <com/sun/star/datatransfer/dnd/XDropTargetDragContext.hpp>
26 #include <com/sun/star/datatransfer/dnd/XDragGestureListener.hpp>
27 #include <cppuhelper/implbase.hxx>
28 #include <vcl/window.hxx>
29 #include <mutex>
31 class DNDEventDispatcher final : public ::cppu::WeakImplHelper<
32 css::datatransfer::dnd::XDropTargetListener,
33 css::datatransfer::dnd::XDropTargetDragContext,
34 css::datatransfer::dnd::XDragGestureListener >
36 VclPtr<vcl::Window> m_pTopWindow;
38 VclPtr<vcl::Window> m_pCurrentWindow;
39 void designate_currentwindow(vcl::Window *pWindow);
40 DECL_LINK(WindowEventListener, VclWindowEvent&, void);
42 std::recursive_mutex m_aMutex;
43 css::uno::Sequence< css::datatransfer::DataFlavor > m_aDataFlavorList;
45 vcl::Window* findTopLevelWindow(Point& location);
47 * fire the events on the dnd listener container of the specified window
50 /// @throws css::uno::RuntimeException
51 static sal_Int32 fireDragEnterEvent( vcl::Window *pWindow, const css::uno::Reference< css::datatransfer::dnd::XDropTargetDragContext >& xContext,
52 const sal_Int8 nDropAction, const Point& rLocation, const sal_Int8 nSourceAction,
53 const css::uno::Sequence< css::datatransfer::DataFlavor >& aFlavorList );
55 /// @throws css::uno::RuntimeException
56 static sal_Int32 fireDragOverEvent( vcl::Window *pWindow, const css::uno::Reference< css::datatransfer::dnd::XDropTargetDragContext >& xContext,
57 const sal_Int8 nDropAction, const Point& rLocation, const sal_Int8 nSourceAction );
59 /// @throws css::uno::RuntimeException
60 static sal_Int32 fireDragExitEvent( vcl::Window *pWindow );
62 /// @throws css::uno::RuntimeException
63 static sal_Int32 fireDropActionChangedEvent( vcl::Window *pWindow, const css::uno::Reference< css::datatransfer::dnd::XDropTargetDragContext >& xContext,
64 const sal_Int8 nDropAction, const Point& rLocation, const sal_Int8 nSourceAction );
66 /// @throws css::uno::RuntimeException
67 static sal_Int32 fireDropEvent( vcl::Window *pWindow, const css::uno::Reference< css::datatransfer::dnd::XDropTargetDropContext >& xContext,
68 const sal_Int8 nDropAction, const Point& rLocation, const sal_Int8 nSourceAction,
69 const css::uno::Reference< css::datatransfer::XTransferable >& xTransferable );
71 /// @throws css::uno::RuntimeException
72 static sal_Int32 fireDragGestureEvent( vcl::Window *pWindow, const css::uno::Reference< css::datatransfer::dnd::XDragSource >& xSource,
73 const css::uno::Any& event, const Point& rOrigin, const sal_Int8 nDragAction );
75 public:
77 DNDEventDispatcher( vcl::Window * pTopWindow );
78 virtual ~DNDEventDispatcher() override;
81 * XDropTargetDragContext
84 virtual void SAL_CALL acceptDrag( sal_Int8 dropAction ) override;
85 virtual void SAL_CALL rejectDrag() override;
88 * XDropTargetListener
91 virtual void SAL_CALL drop( const css::datatransfer::dnd::DropTargetDropEvent& dtde ) override;
92 virtual void SAL_CALL dragEnter( const css::datatransfer::dnd::DropTargetDragEnterEvent& dtdee ) override;
93 virtual void SAL_CALL dragExit( const css::datatransfer::dnd::DropTargetEvent& dte ) override;
94 virtual void SAL_CALL dragOver( const css::datatransfer::dnd::DropTargetDragEvent& dtde ) override;
95 virtual void SAL_CALL dropActionChanged( const css::datatransfer::dnd::DropTargetDragEvent& dtde ) override;
98 * XDragGestureListener
101 virtual void SAL_CALL dragGestureRecognized( const css::datatransfer::dnd::DragGestureEvent& dge ) override;
104 * XEventListener
107 virtual void SAL_CALL disposing( const css::lang::EventObject& eo ) override;
110 #endif
112 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */