1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_vcl.hxx" 30 31 32 33 #include <vcl/dndhelp.hxx> 34 35 using namespace ::com::sun::star; 36 37 vcl::unohelper::DragAndDropClient::~DragAndDropClient() {} 38 39 void vcl::unohelper::DragAndDropClient::dragGestureRecognized( const ::com::sun::star::datatransfer::dnd::DragGestureEvent& /*dge*/ ) throw (::com::sun::star::uno::RuntimeException) 40 { 41 } 42 43 void vcl::unohelper::DragAndDropClient::dragDropEnd( const ::com::sun::star::datatransfer::dnd::DragSourceDropEvent& /*dsde*/ ) throw (::com::sun::star::uno::RuntimeException) 44 { 45 } 46 47 void vcl::unohelper::DragAndDropClient::dragEnter( const ::com::sun::star::datatransfer::dnd::DragSourceDragEvent& /*dsde*/ ) throw (::com::sun::star::uno::RuntimeException) 48 { 49 } 50 51 void vcl::unohelper::DragAndDropClient::dragExit( const ::com::sun::star::datatransfer::dnd::DragSourceEvent& /*dse*/ ) throw (::com::sun::star::uno::RuntimeException) 52 { 53 } 54 55 void vcl::unohelper::DragAndDropClient::dragOver( const ::com::sun::star::datatransfer::dnd::DragSourceDragEvent& /*dsde*/ ) throw (::com::sun::star::uno::RuntimeException) 56 { 57 } 58 59 void vcl::unohelper::DragAndDropClient::dropActionChanged( const ::com::sun::star::datatransfer::dnd::DragSourceDragEvent& /*dsde*/ ) throw (::com::sun::star::uno::RuntimeException) 60 { 61 } 62 63 void vcl::unohelper::DragAndDropClient::drop( const ::com::sun::star::datatransfer::dnd::DropTargetDropEvent& /*dtde*/ ) throw (::com::sun::star::uno::RuntimeException) 64 { 65 } 66 67 void vcl::unohelper::DragAndDropClient::dragEnter( const ::com::sun::star::datatransfer::dnd::DropTargetDragEnterEvent& /*dtdee*/ ) throw (::com::sun::star::uno::RuntimeException) 68 { 69 } 70 71 void vcl::unohelper::DragAndDropClient::dragExit( const ::com::sun::star::datatransfer::dnd::DropTargetEvent& /*dte*/ ) throw (::com::sun::star::uno::RuntimeException) 72 { 73 } 74 75 void vcl::unohelper::DragAndDropClient::dragOver( const ::com::sun::star::datatransfer::dnd::DropTargetDragEvent& /*dtde*/ ) throw (::com::sun::star::uno::RuntimeException) 76 { 77 } 78 79 void vcl::unohelper::DragAndDropClient::dropActionChanged( const ::com::sun::star::datatransfer::dnd::DropTargetDragEvent& /*dtde*/ ) throw (::com::sun::star::uno::RuntimeException) 80 { 81 } 82 83 // ======================================================================= 84 85 vcl::unohelper::DragAndDropWrapper::DragAndDropWrapper( DragAndDropClient* pClient ) 86 { 87 mpClient = pClient; 88 } 89 90 vcl::unohelper::DragAndDropWrapper::~DragAndDropWrapper() 91 { 92 } 93 94 // uno::XInterface 95 uno::Any vcl::unohelper::DragAndDropWrapper::queryInterface( const uno::Type & rType ) throw(uno::RuntimeException) 96 { 97 uno::Any aRet = ::cppu::queryInterface( rType, 98 SAL_STATIC_CAST( ::com::sun::star::lang::XEventListener*, (::com::sun::star::datatransfer::dnd::XDragGestureListener*)this ), 99 SAL_STATIC_CAST( ::com::sun::star::datatransfer::dnd::XDragGestureListener*, this ), 100 SAL_STATIC_CAST( ::com::sun::star::datatransfer::dnd::XDragSourceListener*, this ), 101 SAL_STATIC_CAST( ::com::sun::star::datatransfer::dnd::XDropTargetListener*, this ) ); 102 return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType )); 103 } 104 105 // ::com::sun::star::lang::XEventListener 106 void vcl::unohelper::DragAndDropWrapper::disposing( const ::com::sun::star::lang::EventObject& rEvent ) throw (::com::sun::star::uno::RuntimeException) 107 { 108 // Empty Source means it's the client, because the client is not a XInterface 109 if ( !rEvent.Source.is() ) 110 mpClient = NULL; 111 } 112 113 114 // ::com::sun::star::datatransfer::dnd::XDragGestureListener 115 void vcl::unohelper::DragAndDropWrapper::dragGestureRecognized( const ::com::sun::star::datatransfer::dnd::DragGestureEvent& rDGE ) throw (::com::sun::star::uno::RuntimeException) 116 { 117 if ( mpClient ) 118 mpClient->dragGestureRecognized( rDGE ); 119 } 120 121 // ::com::sun::star::datatransfer::dnd::XDragSourceListener 122 void vcl::unohelper::DragAndDropWrapper::dragDropEnd( const ::com::sun::star::datatransfer::dnd::DragSourceDropEvent& rDSDE ) throw (::com::sun::star::uno::RuntimeException) 123 { 124 if ( mpClient ) 125 mpClient->dragDropEnd( rDSDE ); 126 } 127 128 void vcl::unohelper::DragAndDropWrapper::dragEnter( const ::com::sun::star::datatransfer::dnd::DragSourceDragEvent& dsde ) throw (::com::sun::star::uno::RuntimeException) 129 { 130 if ( mpClient ) 131 mpClient->dragEnter( dsde ); 132 } 133 134 void vcl::unohelper::DragAndDropWrapper::dragExit( const ::com::sun::star::datatransfer::dnd::DragSourceEvent& dse ) throw (::com::sun::star::uno::RuntimeException) 135 { 136 if ( mpClient ) 137 mpClient->dragExit( dse ); 138 } 139 140 void vcl::unohelper::DragAndDropWrapper::dragOver( const ::com::sun::star::datatransfer::dnd::DragSourceDragEvent& dsde ) throw (::com::sun::star::uno::RuntimeException) 141 { 142 if ( mpClient ) 143 mpClient->dragOver( dsde ); 144 } 145 146 void vcl::unohelper::DragAndDropWrapper::dropActionChanged( const ::com::sun::star::datatransfer::dnd::DragSourceDragEvent& dsde ) throw (::com::sun::star::uno::RuntimeException) 147 { 148 if ( mpClient ) 149 mpClient->dropActionChanged( dsde ); 150 } 151 152 // ::com::sun::star::datatransfer::dnd::XDropTargetListener 153 void vcl::unohelper::DragAndDropWrapper::drop( const ::com::sun::star::datatransfer::dnd::DropTargetDropEvent& rDTDE ) throw (::com::sun::star::uno::RuntimeException) 154 { 155 if ( mpClient ) 156 mpClient->drop( rDTDE ); 157 } 158 159 void vcl::unohelper::DragAndDropWrapper::dragEnter( const ::com::sun::star::datatransfer::dnd::DropTargetDragEnterEvent& rDTDEE ) throw (::com::sun::star::uno::RuntimeException) 160 { 161 if ( mpClient ) 162 mpClient->dragEnter( rDTDEE ); 163 } 164 165 void vcl::unohelper::DragAndDropWrapper::dragExit( const ::com::sun::star::datatransfer::dnd::DropTargetEvent& dte ) throw (::com::sun::star::uno::RuntimeException) 166 { 167 if ( mpClient ) 168 mpClient->dragExit( dte ); 169 } 170 171 void vcl::unohelper::DragAndDropWrapper::dragOver( const ::com::sun::star::datatransfer::dnd::DropTargetDragEvent& rDTDE ) throw (::com::sun::star::uno::RuntimeException) 172 { 173 if ( mpClient ) 174 mpClient->dragOver( rDTDE ); 175 } 176 177 void vcl::unohelper::DragAndDropWrapper::dropActionChanged( const ::com::sun::star::datatransfer::dnd::DropTargetDragEvent& rDTDE ) throw (::com::sun::star::uno::RuntimeException) 178 { 179 if ( mpClient ) 180 mpClient->dropActionChanged( rDTDE ); 181 } 182 183