bump product version to 6.4.0.3
[LibreOffice.git] / vcl / inc / dndeventdispatcher.hxx
blobafd11ce07074a2276be2faaacbf7718bba31e818
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>
30 class DNDEventDispatcher: public ::cppu::WeakImplHelper<
31 css::datatransfer::dnd::XDropTargetListener,
32 css::datatransfer::dnd::XDropTargetDragContext,
33 css::datatransfer::dnd::XDragGestureListener >
35 VclPtr<vcl::Window> m_pTopWindow;
37 VclPtr<vcl::Window> m_pCurrentWindow;
38 void designate_currentwindow(vcl::Window *pWindow);
39 DECL_LINK(WindowEventListener, VclWindowEvent&, void);
41 ::osl::Mutex m_aMutex;
42 css::uno::Sequence< css::datatransfer::DataFlavor > m_aDataFlavorList;
44 vcl::Window* findTopLevelWindow(Point location);
46 * fire the events on the dnd listener container of the specified window
49 /// @throws css::uno::RuntimeException
50 static sal_Int32 fireDragEnterEvent( vcl::Window *pWindow, const css::uno::Reference< css::datatransfer::dnd::XDropTargetDragContext >& xContext,
51 const sal_Int8 nDropAction, const Point& rLocation, const sal_Int8 nSourceAction,
52 const css::uno::Sequence< css::datatransfer::DataFlavor >& aFlavorList );
54 /// @throws css::uno::RuntimeException
55 static sal_Int32 fireDragOverEvent( vcl::Window *pWindow, const css::uno::Reference< css::datatransfer::dnd::XDropTargetDragContext >& xContext,
56 const sal_Int8 nDropAction, const Point& rLocation, const sal_Int8 nSourceAction );
58 /// @throws css::uno::RuntimeException
59 static sal_Int32 fireDragExitEvent( vcl::Window *pWindow );
61 /// @throws css::uno::RuntimeException
62 static sal_Int32 fireDropActionChangedEvent( vcl::Window *pWindow, const css::uno::Reference< css::datatransfer::dnd::XDropTargetDragContext >& xContext,
63 const sal_Int8 nDropAction, const Point& rLocation, const sal_Int8 nSourceAction );
65 /// @throws css::uno::RuntimeException
66 static sal_Int32 fireDropEvent( vcl::Window *pWindow, const css::uno::Reference< css::datatransfer::dnd::XDropTargetDropContext >& xContext,
67 const sal_Int8 nDropAction, const Point& rLocation, const sal_Int8 nSourceAction,
68 const css::uno::Reference< css::datatransfer::XTransferable >& xTransferable );
70 /// @throws css::uno::RuntimeException
71 static sal_Int32 fireDragGestureEvent( vcl::Window *pWindow, const css::uno::Reference< css::datatransfer::dnd::XDragSource >& xSource,
72 const css::uno::Any& event, const Point& rOrigin, const sal_Int8 nDragAction );
74 public:
76 DNDEventDispatcher( vcl::Window * pTopWindow );
77 virtual ~DNDEventDispatcher() override;
80 * XDropTargetDragContext
83 virtual void SAL_CALL acceptDrag( sal_Int8 dropAction ) override;
84 virtual void SAL_CALL rejectDrag() override;
87 * XDropTargetListener
90 virtual void SAL_CALL drop( const css::datatransfer::dnd::DropTargetDropEvent& dtde ) override;
91 virtual void SAL_CALL dragEnter( const css::datatransfer::dnd::DropTargetDragEnterEvent& dtdee ) override;
92 virtual void SAL_CALL dragExit( const css::datatransfer::dnd::DropTargetEvent& dte ) override;
93 virtual void SAL_CALL dragOver( const css::datatransfer::dnd::DropTargetDragEvent& dtde ) override;
94 virtual void SAL_CALL dropActionChanged( const css::datatransfer::dnd::DropTargetDragEvent& dtde ) override;
97 * XDragGestureListener
100 virtual void SAL_CALL dragGestureRecognized( const css::datatransfer::dnd::DragGestureEvent& dge ) override;
103 * XEventListener
106 virtual void SAL_CALL disposing( const css::lang::EventObject& eo ) override;
109 #endif
111 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */