Branch libreoffice-5-0-4
[LibreOffice.git] / vcl / inc / dndevdis.hxx
blobb542581efee13f1efd82896319893ca5afc05f28
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_DNDEVDIS_HXX
21 #define INCLUDED_VCL_INC_DNDEVDIS_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/XDragGestureRecognizer.hpp>
27 #include <cppuhelper/implbase3.hxx>
28 #include <vcl/window.hxx>
30 class DNDEventDispatcher: public ::cppu::WeakImplHelper3<
31 ::com::sun::star::datatransfer::dnd::XDropTargetListener,
32 ::com::sun::star::datatransfer::dnd::XDropTargetDragContext,
33 ::com::sun::star::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, VclSimpleEvent*);
41 ::osl::Mutex m_aMutex;
42 ::com::sun::star::uno::Sequence< ::com::sun::star::datatransfer::DataFlavor > m_aDataFlavorList;
44 vcl::Window* findTopLevelWindow(Point location);
46 * fire the events on the dnd listener container of the specified window
49 static sal_Int32 fireDragEnterEvent( vcl::Window *pWindow, const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTargetDragContext >& xContext,
50 const sal_Int8 nDropAction, const Point& rLocation, const sal_Int8 nSourceAction,
51 const ::com::sun::star::uno::Sequence< ::com::sun::star::datatransfer::DataFlavor >& aFlavorList ) throw(::com::sun::star::uno::RuntimeException);
53 static sal_Int32 fireDragOverEvent( vcl::Window *pWindow, const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTargetDragContext >& xContext,
54 const sal_Int8 nDropAction, const Point& rLocation, const sal_Int8 nSourceAction ) throw(::com::sun::star::uno::RuntimeException);
56 static sal_Int32 fireDragExitEvent( vcl::Window *pWindow ) throw(::com::sun::star::uno::RuntimeException);
58 static sal_Int32 fireDropActionChangedEvent( vcl::Window *pWindow, const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTargetDragContext >& xContext,
59 const sal_Int8 nDropAction, const Point& rLocation, const sal_Int8 nSourceAction ) throw(::com::sun::star::uno::RuntimeException);
61 static sal_Int32 fireDropEvent( vcl::Window *pWindow, const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTargetDropContext >& xContext,
62 const sal_Int8 nDropAction, const Point& rLocation, const sal_Int8 nSourceAction,
63 const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& xTransferable ) throw(::com::sun::star::uno::RuntimeException);
65 static sal_Int32 fireDragGestureEvent( vcl::Window *pWindow, const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragSource >& xSource,
66 const ::com::sun::star::uno::Any& event, const Point& rOrigin, const sal_Int8 nDragAction )throw(::com::sun::star::uno::RuntimeException);
68 public:
70 DNDEventDispatcher( vcl::Window * pTopWindow );
71 virtual ~DNDEventDispatcher();
74 * XDropTargetDragContext
77 virtual void SAL_CALL acceptDrag( sal_Int8 dropAction ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
78 virtual void SAL_CALL rejectDrag() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
81 * XDropTargetListener
84 virtual void SAL_CALL drop( const ::com::sun::star::datatransfer::dnd::DropTargetDropEvent& dtde ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
85 virtual void SAL_CALL dragEnter( const ::com::sun::star::datatransfer::dnd::DropTargetDragEnterEvent& dtdee ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
86 virtual void SAL_CALL dragExit( const ::com::sun::star::datatransfer::dnd::DropTargetEvent& dte ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
87 virtual void SAL_CALL dragOver( const ::com::sun::star::datatransfer::dnd::DropTargetDragEvent& dtde ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
88 virtual void SAL_CALL dropActionChanged( const ::com::sun::star::datatransfer::dnd::DropTargetDragEvent& dtde ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
91 * XDragGestureListener
94 virtual void SAL_CALL dragGestureRecognized( const ::com::sun::star::datatransfer::dnd::DragGestureEvent& dge ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
97 * XEventListener
100 virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& eo ) throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
103 #endif
105 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */