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 _VCL_DNDHELP_HXX 25 #define _VCL_DNDHELP_HXX 26 27 #include <vcl/dllapi.h> 28 #include <cppuhelper/weak.hxx> 29 #include <com/sun/star/datatransfer/dnd/XDragGestureListener.hpp> 30 #include <com/sun/star/datatransfer/dnd/XDragSourceListener.hpp> 31 #include <com/sun/star/datatransfer/dnd/XDropTargetListener.hpp> 32 33 namespace com { 34 namespace sun { 35 namespace star { 36 37 namespace datatransfer { 38 namespace dnd { 39 struct DragGestureEvent; 40 struct DragSourceDragEvent; 41 struct DragSourceDropEvent; 42 struct DragSourceEvent; 43 struct DropTargetDragEvent; 44 struct DropTargetDragEnterEvent; 45 struct DropTargetDropEvent; 46 struct DropTargetEvent; 47 }} 48 49 }}} 50 51 namespace vcl 52 { 53 54 namespace unohelper 55 { 56 57 class VCL_DLLPUBLIC DragAndDropClient 58 { 59 public: 60 virtual ~DragAndDropClient(); 61 62 // ::com::sun::star::datatransfer::dnd::XDragGestureListener 63 virtual void dragGestureRecognized( const ::com::sun::star::datatransfer::dnd::DragGestureEvent& dge ) throw (::com::sun::star::uno::RuntimeException); 64 65 // ::com::sun::star::datatransfer::dnd::XDragSourceListener 66 virtual void dragDropEnd( const ::com::sun::star::datatransfer::dnd::DragSourceDropEvent& dsde ) throw (::com::sun::star::uno::RuntimeException); 67 virtual void dragEnter( const ::com::sun::star::datatransfer::dnd::DragSourceDragEvent& dsde ) throw (::com::sun::star::uno::RuntimeException); 68 virtual void dragExit( const ::com::sun::star::datatransfer::dnd::DragSourceEvent& dse ) throw (::com::sun::star::uno::RuntimeException); 69 virtual void dragOver( const ::com::sun::star::datatransfer::dnd::DragSourceDragEvent& dsde ) throw (::com::sun::star::uno::RuntimeException); 70 virtual void dropActionChanged( const ::com::sun::star::datatransfer::dnd::DragSourceDragEvent& dsde ) throw (::com::sun::star::uno::RuntimeException); 71 72 // ::com::sun::star::datatransfer::dnd::XDropTargetListener 73 virtual void drop( const ::com::sun::star::datatransfer::dnd::DropTargetDropEvent& dtde ) throw (::com::sun::star::uno::RuntimeException); 74 virtual void dragEnter( const ::com::sun::star::datatransfer::dnd::DropTargetDragEnterEvent& dtdee ) throw (::com::sun::star::uno::RuntimeException); 75 virtual void dragExit( const ::com::sun::star::datatransfer::dnd::DropTargetEvent& dte ) throw (::com::sun::star::uno::RuntimeException); 76 virtual void dragOver( const ::com::sun::star::datatransfer::dnd::DropTargetDragEvent& dtde ) throw (::com::sun::star::uno::RuntimeException); 77 virtual void dropActionChanged( const ::com::sun::star::datatransfer::dnd::DropTargetDragEvent& dtde ) throw (::com::sun::star::uno::RuntimeException); 78 }; 79 80 class VCL_DLLPUBLIC DragAndDropWrapper : 81 public ::com::sun::star::datatransfer::dnd::XDragGestureListener, 82 public ::com::sun::star::datatransfer::dnd::XDragSourceListener, 83 public ::com::sun::star::datatransfer::dnd::XDropTargetListener, 84 public ::cppu::OWeakObject 85 { 86 private: 87 DragAndDropClient* mpClient; 88 89 public: 90 DragAndDropWrapper( DragAndDropClient* pClient ); 91 ~DragAndDropWrapper(); 92 93 // ::com::sun::star::uno::XInterface 94 ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type & rType ) throw(::com::sun::star::uno::RuntimeException); acquire()95 void SAL_CALL acquire() throw() { OWeakObject::acquire(); } release()96 void SAL_CALL release() throw() { OWeakObject::release(); } 97 98 // ::com::sun::star::lang::XEventListener 99 void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException); 100 101 // ::com::sun::star::datatransfer::dnd::XDragGestureListener 102 void SAL_CALL dragGestureRecognized( const ::com::sun::star::datatransfer::dnd::DragGestureEvent& dge ) throw (::com::sun::star::uno::RuntimeException); 103 104 // ::com::sun::star::datatransfer::dnd::XDragSourceListener 105 void SAL_CALL dragDropEnd( const ::com::sun::star::datatransfer::dnd::DragSourceDropEvent& dsde ) throw (::com::sun::star::uno::RuntimeException); 106 void SAL_CALL dragEnter( const ::com::sun::star::datatransfer::dnd::DragSourceDragEvent& dsde ) throw (::com::sun::star::uno::RuntimeException); 107 void SAL_CALL dragExit( const ::com::sun::star::datatransfer::dnd::DragSourceEvent& dse ) throw (::com::sun::star::uno::RuntimeException); 108 void SAL_CALL dragOver( const ::com::sun::star::datatransfer::dnd::DragSourceDragEvent& dsde ) throw (::com::sun::star::uno::RuntimeException); 109 void SAL_CALL dropActionChanged( const ::com::sun::star::datatransfer::dnd::DragSourceDragEvent& dsde ) throw (::com::sun::star::uno::RuntimeException); 110 111 // ::com::sun::star::datatransfer::dnd::XDropTargetListener 112 void SAL_CALL drop( const ::com::sun::star::datatransfer::dnd::DropTargetDropEvent& dtde ) throw (::com::sun::star::uno::RuntimeException); 113 void SAL_CALL dragEnter( const ::com::sun::star::datatransfer::dnd::DropTargetDragEnterEvent& dtdee ) throw (::com::sun::star::uno::RuntimeException); 114 void SAL_CALL dragExit( const ::com::sun::star::datatransfer::dnd::DropTargetEvent& dte ) throw (::com::sun::star::uno::RuntimeException); 115 void SAL_CALL dragOver( const ::com::sun::star::datatransfer::dnd::DropTargetDragEvent& dtde ) throw (::com::sun::star::uno::RuntimeException); 116 void SAL_CALL dropActionChanged( const ::com::sun::star::datatransfer::dnd::DropTargetDragEvent& dtde ) throw (::com::sun::star::uno::RuntimeException); 117 }; 118 119 }} // namespace vcl::unohelper 120 121 #endif // _VCL_DNDHELP_HXX 122 123