1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 Window
* m_pTopWindow
;
36 Window
* m_pCurrentWindow
;
38 ::osl::Mutex m_aMutex
;
39 ::com::sun::star::uno::Sequence
< ::com::sun::star::datatransfer::DataFlavor
> m_aDataFlavorList
;
41 Window
* findTopLevelWindow(Point location
);
43 * fire the events on the dnd listener container of the specified window
46 sal_Int32
fireDragEnterEvent( Window
*pWindow
, const ::com::sun::star::uno::Reference
< ::com::sun::star::datatransfer::dnd::XDropTargetDragContext
>& xContext
,
47 const sal_Int8 nDropAction
, const Point
& rLocation
, const sal_Int8 nSourceAction
,
48 const ::com::sun::star::uno::Sequence
< ::com::sun::star::datatransfer::DataFlavor
>& aFlavorList
) throw(::com::sun::star::uno::RuntimeException
);
50 sal_Int32
fireDragOverEvent( Window
*pWindow
, const ::com::sun::star::uno::Reference
< ::com::sun::star::datatransfer::dnd::XDropTargetDragContext
>& xContext
,
51 const sal_Int8 nDropAction
, const Point
& rLocation
, const sal_Int8 nSourceAction
) throw(::com::sun::star::uno::RuntimeException
);
53 sal_Int32
fireDragExitEvent( Window
*pWindow
) throw(::com::sun::star::uno::RuntimeException
);
55 sal_Int32
fireDropActionChangedEvent( Window
*pWindow
, const ::com::sun::star::uno::Reference
< ::com::sun::star::datatransfer::dnd::XDropTargetDragContext
>& xContext
,
56 const sal_Int8 nDropAction
, const Point
& rLocation
, const sal_Int8 nSourceAction
) throw(::com::sun::star::uno::RuntimeException
);
58 sal_Int32
fireDropEvent( Window
*pWindow
, const ::com::sun::star::uno::Reference
< ::com::sun::star::datatransfer::dnd::XDropTargetDropContext
>& xContext
,
59 const sal_Int8 nDropAction
, const Point
& rLocation
, const sal_Int8 nSourceAction
,
60 const ::com::sun::star::uno::Reference
< ::com::sun::star::datatransfer::XTransferable
>& xTransferable
) throw(::com::sun::star::uno::RuntimeException
);
62 sal_Int32
fireDragGestureEvent( Window
*pWindow
, const ::com::sun::star::uno::Reference
< ::com::sun::star::datatransfer::dnd::XDragSource
>& xSource
,
63 const ::com::sun::star::uno::Any event
, const Point
& rOrigin
, const sal_Int8 nDragAction
)throw(::com::sun::star::uno::RuntimeException
);
67 DNDEventDispatcher( Window
* pTopWindow
);
68 virtual ~DNDEventDispatcher();
71 * XDropTargetDragContext
74 virtual void SAL_CALL
acceptDrag( sal_Int8 dropAction
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
75 virtual void SAL_CALL
rejectDrag() throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
81 virtual void SAL_CALL
drop( const ::com::sun::star::datatransfer::dnd::DropTargetDropEvent
& dtde
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
82 virtual void SAL_CALL
dragEnter( const ::com::sun::star::datatransfer::dnd::DropTargetDragEnterEvent
& dtdee
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
83 virtual void SAL_CALL
dragExit( const ::com::sun::star::datatransfer::dnd::DropTargetEvent
& dte
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
84 virtual void SAL_CALL
dragOver( const ::com::sun::star::datatransfer::dnd::DropTargetDragEvent
& dtde
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
85 virtual void SAL_CALL
dropActionChanged( const ::com::sun::star::datatransfer::dnd::DropTargetDragEvent
& dtde
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
88 * XDragGestureListener
91 virtual void SAL_CALL
dragGestureRecognized( const ::com::sun::star::datatransfer::dnd::DragGestureEvent
& dge
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
97 virtual void SAL_CALL
disposing( const ::com::sun::star::lang::EventObject
& eo
) throw(::com::sun::star::uno::RuntimeException
, std::exception
) SAL_OVERRIDE
;
102 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */