xref: /aoo42x/main/vcl/inc/dndevdis.hxx (revision 161f4cd1)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _DNDEVDIS_HXX_
25 #define _DNDEVDIS_HXX_
26 
27 #include <com/sun/star/datatransfer/dnd/XDropTargetListener.hpp>
28 #include <com/sun/star/datatransfer/dnd/XDropTargetDragContext.hpp>
29 
30 #ifndef _COM_SUN_STAR_DATATRANSFER_DND_XDRAGESTURERECOGNIZER_HPP_
31 #include <com/sun/star/datatransfer/dnd/XDragGestureRecognizer.hpp>
32 #endif
33 #include <cppuhelper/implbase3.hxx>
34 #include <vcl/window.hxx>
35 
36 class DNDEventDispatcher: public ::cppu::WeakImplHelper3<
37 	::com::sun::star::datatransfer::dnd::XDropTargetListener,
38 	::com::sun::star::datatransfer::dnd::XDropTargetDragContext,
39 	::com::sun::star::datatransfer::dnd::XDragGestureListener >
40 {
41 	Window * m_pTopWindow;
42 	Window * m_pCurrentWindow;
43 
44 	::osl::Mutex m_aMutex;
45 	::com::sun::star::uno::Sequence< ::com::sun::star::datatransfer::DataFlavor > m_aDataFlavorList;
46 
47 	/*
48 	 * fire the events on the dnd listener container of the specified window
49 	 */
50 
51 	sal_Int32 fireDragEnterEvent( Window *pWindow, const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTargetDragContext >& xContext,
52 		const sal_Int8 nDropAction,	const Point& rLocation, const sal_Int8 nSourceAction,
53 		const ::com::sun::star::uno::Sequence< ::com::sun::star::datatransfer::DataFlavor >& aFlavorList ) throw(::com::sun::star::uno::RuntimeException);
54 
55 	sal_Int32 fireDragOverEvent( 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);
57 
58 	sal_Int32 fireDragExitEvent( Window *pWindow ) throw(::com::sun::star::uno::RuntimeException);
59 
60 	sal_Int32 fireDropActionChangedEvent( Window *pWindow, const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTargetDragContext >& xContext,
61 		const sal_Int8 nDropAction,	const Point& rLocation, const sal_Int8 nSourceAction ) throw(::com::sun::star::uno::RuntimeException);
62 
63 	sal_Int32 fireDropEvent( Window *pWindow, const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTargetDropContext >& xContext,
64 		const sal_Int8 nDropAction,	const Point& rLocation, const sal_Int8 nSourceAction,
65 		const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& xTransferable ) throw(::com::sun::star::uno::RuntimeException);
66 
67 	sal_Int32 fireDragGestureEvent( Window *pWindow, const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragSource >& xSource,
68 		const ::com::sun::star::uno::Any event, const Point& rOrigin, const sal_Int8 nDragAction )throw(::com::sun::star::uno::RuntimeException);
69 
70 public:
71 
72 	DNDEventDispatcher( Window * pTopWindow );
73 	virtual ~DNDEventDispatcher();
74 
75 	/*
76 	 * XDropTargetDragContext
77 	 */
78 
79 	virtual void SAL_CALL acceptDrag( sal_Int8 dropAction ) throw(::com::sun::star::uno::RuntimeException);
80 	virtual void SAL_CALL rejectDrag() throw(::com::sun::star::uno::RuntimeException);
81 
82 	/*
83 	 * XDropTargetListener
84 	 */
85 
86 	virtual void SAL_CALL drop( const ::com::sun::star::datatransfer::dnd::DropTargetDropEvent& dtde ) throw(::com::sun::star::uno::RuntimeException);
87 	virtual void SAL_CALL dragEnter( const ::com::sun::star::datatransfer::dnd::DropTargetDragEnterEvent& dtdee ) throw(::com::sun::star::uno::RuntimeException);
88 	virtual void SAL_CALL dragExit( const ::com::sun::star::datatransfer::dnd::DropTargetEvent& dte ) throw(::com::sun::star::uno::RuntimeException);
89 	virtual void SAL_CALL dragOver( const ::com::sun::star::datatransfer::dnd::DropTargetDragEvent& dtde ) throw(::com::sun::star::uno::RuntimeException);
90 	virtual void SAL_CALL dropActionChanged( const ::com::sun::star::datatransfer::dnd::DropTargetDragEvent& dtde ) throw(::com::sun::star::uno::RuntimeException);
91 
92 	/*
93 	 * XDragGestureListener
94 	 */
95 
96     virtual void SAL_CALL dragGestureRecognized( const ::com::sun::star::datatransfer::dnd::DragGestureEvent& dge ) throw(::com::sun::star::uno::RuntimeException);
97 
98 
99 	/*
100 	 * XEventListener
101 	 */
102 
103 	virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& eo ) throw(::com::sun::star::uno::RuntimeException);
104 };
105 
106 //==================================================================================================
107 //
108 //==================================================================================================
109 
110 #endif
111