xref: /trunk/main/vcl/source/app/dndhelp.cxx (revision 9f62ea84)
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 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_vcl.hxx"
26 
27 
28 
29 #include <vcl/dndhelp.hxx>
30 
31 using namespace ::com::sun::star;
32 
~DragAndDropClient()33 vcl::unohelper::DragAndDropClient::~DragAndDropClient() {}
34 
dragGestureRecognized(const::com::sun::star::datatransfer::dnd::DragGestureEvent &)35 void vcl::unohelper::DragAndDropClient::dragGestureRecognized( const ::com::sun::star::datatransfer::dnd::DragGestureEvent& /*dge*/ ) throw (::com::sun::star::uno::RuntimeException)
36 {
37 }
38 
dragDropEnd(const::com::sun::star::datatransfer::dnd::DragSourceDropEvent &)39 void vcl::unohelper::DragAndDropClient::dragDropEnd( const ::com::sun::star::datatransfer::dnd::DragSourceDropEvent& /*dsde*/ ) throw (::com::sun::star::uno::RuntimeException)
40 {
41 }
42 
dragEnter(const::com::sun::star::datatransfer::dnd::DragSourceDragEvent &)43 void vcl::unohelper::DragAndDropClient::dragEnter( const ::com::sun::star::datatransfer::dnd::DragSourceDragEvent& /*dsde*/ ) throw (::com::sun::star::uno::RuntimeException)
44 {
45 }
46 
dragExit(const::com::sun::star::datatransfer::dnd::DragSourceEvent &)47 void vcl::unohelper::DragAndDropClient::dragExit( const ::com::sun::star::datatransfer::dnd::DragSourceEvent& /*dse*/ ) throw (::com::sun::star::uno::RuntimeException)
48 {
49 }
50 
dragOver(const::com::sun::star::datatransfer::dnd::DragSourceDragEvent &)51 void vcl::unohelper::DragAndDropClient::dragOver( const ::com::sun::star::datatransfer::dnd::DragSourceDragEvent& /*dsde*/ ) throw (::com::sun::star::uno::RuntimeException)
52 {
53 }
54 
dropActionChanged(const::com::sun::star::datatransfer::dnd::DragSourceDragEvent &)55 void vcl::unohelper::DragAndDropClient::dropActionChanged( const ::com::sun::star::datatransfer::dnd::DragSourceDragEvent& /*dsde*/ ) throw (::com::sun::star::uno::RuntimeException)
56 {
57 }
58 
drop(const::com::sun::star::datatransfer::dnd::DropTargetDropEvent &)59 void vcl::unohelper::DragAndDropClient::drop( const ::com::sun::star::datatransfer::dnd::DropTargetDropEvent& /*dtde*/ ) throw (::com::sun::star::uno::RuntimeException)
60 {
61 }
62 
dragEnter(const::com::sun::star::datatransfer::dnd::DropTargetDragEnterEvent &)63 void vcl::unohelper::DragAndDropClient::dragEnter( const ::com::sun::star::datatransfer::dnd::DropTargetDragEnterEvent& /*dtdee*/ ) throw (::com::sun::star::uno::RuntimeException)
64 {
65 }
66 
dragExit(const::com::sun::star::datatransfer::dnd::DropTargetEvent &)67 void vcl::unohelper::DragAndDropClient::dragExit( const ::com::sun::star::datatransfer::dnd::DropTargetEvent& /*dte*/ ) throw (::com::sun::star::uno::RuntimeException)
68 {
69 }
70 
dragOver(const::com::sun::star::datatransfer::dnd::DropTargetDragEvent &)71 void vcl::unohelper::DragAndDropClient::dragOver( const ::com::sun::star::datatransfer::dnd::DropTargetDragEvent& /*dtde*/ ) throw (::com::sun::star::uno::RuntimeException)
72 {
73 }
74 
dropActionChanged(const::com::sun::star::datatransfer::dnd::DropTargetDragEvent &)75 void vcl::unohelper::DragAndDropClient::dropActionChanged( const ::com::sun::star::datatransfer::dnd::DropTargetDragEvent& /*dtde*/ ) throw (::com::sun::star::uno::RuntimeException)
76 {
77 }
78 
79 // =======================================================================
80 
DragAndDropWrapper(DragAndDropClient * pClient)81 vcl::unohelper::DragAndDropWrapper::DragAndDropWrapper( DragAndDropClient* pClient )
82 {
83     mpClient = pClient;
84 }
85 
~DragAndDropWrapper()86 vcl::unohelper::DragAndDropWrapper::~DragAndDropWrapper()
87 {
88 }
89 
90 // uno::XInterface
queryInterface(const uno::Type & rType)91 uno::Any vcl::unohelper::DragAndDropWrapper::queryInterface( const uno::Type & rType ) throw(uno::RuntimeException)
92 {
93 	uno::Any aRet = ::cppu::queryInterface( rType,
94 							SAL_STATIC_CAST( ::com::sun::star::lang::XEventListener*, (::com::sun::star::datatransfer::dnd::XDragGestureListener*)this ),
95 							SAL_STATIC_CAST( ::com::sun::star::datatransfer::dnd::XDragGestureListener*, this ),
96 							SAL_STATIC_CAST( ::com::sun::star::datatransfer::dnd::XDragSourceListener*, this ),
97 							SAL_STATIC_CAST( ::com::sun::star::datatransfer::dnd::XDropTargetListener*, this ) );
98 	return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ));
99 }
100 
101 // ::com::sun::star::lang::XEventListener
disposing(const::com::sun::star::lang::EventObject & rEvent)102 void vcl::unohelper::DragAndDropWrapper::disposing( const ::com::sun::star::lang::EventObject& rEvent ) throw (::com::sun::star::uno::RuntimeException)
103 {
104     // Empty Source means it's the client, because the client is not a XInterface
105     if ( !rEvent.Source.is() )
106         mpClient = NULL;
107 }
108 
109 
110 // ::com::sun::star::datatransfer::dnd::XDragGestureListener
dragGestureRecognized(const::com::sun::star::datatransfer::dnd::DragGestureEvent & rDGE)111 void vcl::unohelper::DragAndDropWrapper::dragGestureRecognized( const ::com::sun::star::datatransfer::dnd::DragGestureEvent& rDGE ) throw (::com::sun::star::uno::RuntimeException)
112 {
113     if ( mpClient )
114         mpClient->dragGestureRecognized( rDGE );
115 }
116 
117 // ::com::sun::star::datatransfer::dnd::XDragSourceListener
dragDropEnd(const::com::sun::star::datatransfer::dnd::DragSourceDropEvent & rDSDE)118 void vcl::unohelper::DragAndDropWrapper::dragDropEnd( const ::com::sun::star::datatransfer::dnd::DragSourceDropEvent& rDSDE ) throw (::com::sun::star::uno::RuntimeException)
119 {
120     if ( mpClient )
121         mpClient->dragDropEnd( rDSDE );
122 }
123 
dragEnter(const::com::sun::star::datatransfer::dnd::DragSourceDragEvent & dsde)124 void vcl::unohelper::DragAndDropWrapper::dragEnter( const ::com::sun::star::datatransfer::dnd::DragSourceDragEvent& dsde ) throw (::com::sun::star::uno::RuntimeException)
125 {
126     if ( mpClient )
127         mpClient->dragEnter( dsde );
128 }
129 
dragExit(const::com::sun::star::datatransfer::dnd::DragSourceEvent & dse)130 void vcl::unohelper::DragAndDropWrapper::dragExit( const ::com::sun::star::datatransfer::dnd::DragSourceEvent& dse ) throw (::com::sun::star::uno::RuntimeException)
131 {
132     if ( mpClient )
133         mpClient->dragExit( dse );
134 }
135 
dragOver(const::com::sun::star::datatransfer::dnd::DragSourceDragEvent & dsde)136 void vcl::unohelper::DragAndDropWrapper::dragOver( const ::com::sun::star::datatransfer::dnd::DragSourceDragEvent& dsde ) throw (::com::sun::star::uno::RuntimeException)
137 {
138     if ( mpClient )
139         mpClient->dragOver( dsde );
140 }
141 
dropActionChanged(const::com::sun::star::datatransfer::dnd::DragSourceDragEvent & dsde)142 void vcl::unohelper::DragAndDropWrapper::dropActionChanged( const ::com::sun::star::datatransfer::dnd::DragSourceDragEvent& dsde ) throw (::com::sun::star::uno::RuntimeException)
143 {
144     if ( mpClient )
145         mpClient->dropActionChanged( dsde );
146 }
147 
148 // ::com::sun::star::datatransfer::dnd::XDropTargetListener
drop(const::com::sun::star::datatransfer::dnd::DropTargetDropEvent & rDTDE)149 void vcl::unohelper::DragAndDropWrapper::drop( const ::com::sun::star::datatransfer::dnd::DropTargetDropEvent& rDTDE ) throw (::com::sun::star::uno::RuntimeException)
150 {
151     if ( mpClient )
152         mpClient->drop( rDTDE );
153 }
154 
dragEnter(const::com::sun::star::datatransfer::dnd::DropTargetDragEnterEvent & rDTDEE)155 void vcl::unohelper::DragAndDropWrapper::dragEnter( const ::com::sun::star::datatransfer::dnd::DropTargetDragEnterEvent& rDTDEE ) throw (::com::sun::star::uno::RuntimeException)
156 {
157     if ( mpClient )
158         mpClient->dragEnter( rDTDEE );
159 }
160 
dragExit(const::com::sun::star::datatransfer::dnd::DropTargetEvent & dte)161 void vcl::unohelper::DragAndDropWrapper::dragExit( const ::com::sun::star::datatransfer::dnd::DropTargetEvent& dte ) throw (::com::sun::star::uno::RuntimeException)
162 {
163     if ( mpClient )
164         mpClient->dragExit( dte );
165 }
166 
dragOver(const::com::sun::star::datatransfer::dnd::DropTargetDragEvent & rDTDE)167 void vcl::unohelper::DragAndDropWrapper::dragOver( const ::com::sun::star::datatransfer::dnd::DropTargetDragEvent& rDTDE ) throw (::com::sun::star::uno::RuntimeException)
168 {
169     if ( mpClient )
170         mpClient->dragOver( rDTDE );
171 }
172 
dropActionChanged(const::com::sun::star::datatransfer::dnd::DropTargetDragEvent & rDTDE)173 void vcl::unohelper::DragAndDropWrapper::dropActionChanged( const ::com::sun::star::datatransfer::dnd::DropTargetDragEvent& rDTDE ) throw (::com::sun::star::uno::RuntimeException)
174 {
175     if ( mpClient )
176         mpClient->dropActionChanged( rDTDE );
177 }
178 
179