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 _DNDLCON_HXX_ 25 #define _DNDLCON_HXX_ 26 27 #include <com/sun/star/datatransfer/dnd/XDragGestureRecognizer.hpp> 28 #include <com/sun/star/datatransfer/dnd/XDragSource.hpp> 29 #include <com/sun/star/datatransfer/dnd/XDropTarget.hpp> 30 #include <com/sun/star/datatransfer/dnd/XDropTargetDragContext.hpp> 31 #include <com/sun/star/datatransfer/dnd/XDropTargetDropContext.hpp> 32 #include <cppuhelper/compbase4.hxx> 33 34 #include <vcl/unohelp2.hxx> 35 36 class DNDListenerContainer : public ::vcl::unohelper::MutexHelper, 37 public ::cppu::WeakComponentImplHelper4< 38 ::com::sun::star::datatransfer::dnd::XDragGestureRecognizer, \ 39 ::com::sun::star::datatransfer::dnd::XDropTargetDragContext, 40 ::com::sun::star::datatransfer::dnd::XDropTargetDropContext, 41 ::com::sun::star::datatransfer::dnd::XDropTarget > 42 { 43 sal_Bool m_bActive; 44 sal_Int8 m_nDefaultActions; 45 46 ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTargetDragContext > m_xDropTargetDragContext; 47 ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTargetDropContext > m_xDropTargetDropContext; 48 49 public: 50 51 DNDListenerContainer( sal_Int8 nDefaultActions ); 52 virtual ~DNDListenerContainer(); 53 54 sal_uInt32 fireDropEvent( 55 const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTargetDropContext >& context, 56 sal_Int8 dropAction, sal_Int32 locationX, sal_Int32 locationY, sal_Int8 sourceActions, 57 const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& transferable ); 58 59 sal_uInt32 fireDragExitEvent(); 60 61 sal_uInt32 fireDragOverEvent( 62 const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTargetDragContext >& context, 63 sal_Int8 dropAction, sal_Int32 locationX, sal_Int32 locationY, sal_Int8 sourceActions ); 64 65 sal_uInt32 fireDragEnterEvent( 66 const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTargetDragContext >& context, 67 sal_Int8 dropAction, sal_Int32 locationX, sal_Int32 locationY, sal_Int8 sourceActions, 68 const ::com::sun::star::uno::Sequence< ::com::sun::star::datatransfer::DataFlavor >& dataFlavor ); 69 70 sal_uInt32 fireDropActionChangedEvent( 71 const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTargetDragContext >& context, 72 sal_Int8 dropAction, sal_Int32 locationX, sal_Int32 locationY, sal_Int8 sourceActions ); 73 74 sal_uInt32 fireDragGestureEvent( 75 sal_Int8 dragAction, sal_Int32 dragOriginX, sal_Int32 dragOriginY, 76 const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragSource >& dragSource, 77 const ::com::sun::star::uno::Any& triggerEvent ); 78 79 /* 80 * XDragGestureRecognizer 81 */ 82 83 virtual void SAL_CALL addDragGestureListener( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragGestureListener >& dgl ) throw(::com::sun::star::uno::RuntimeException); 84 virtual void SAL_CALL removeDragGestureListener( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDragGestureListener >& dgl ) throw(::com::sun::star::uno::RuntimeException); 85 virtual void SAL_CALL resetRecognizer( ) throw(::com::sun::star::uno::RuntimeException); 86 87 /* 88 * XDropTargetDragContext 89 */ 90 91 virtual void SAL_CALL acceptDrag( sal_Int8 dragOperation ) throw (::com::sun::star::uno::RuntimeException); 92 virtual void SAL_CALL rejectDrag( ) throw (::com::sun::star::uno::RuntimeException); 93 94 95 /* 96 * XDropTargetDropContext 97 */ 98 99 virtual void SAL_CALL acceptDrop( sal_Int8 dropOperation ) throw (::com::sun::star::uno::RuntimeException); 100 virtual void SAL_CALL rejectDrop( ) throw (::com::sun::star::uno::RuntimeException); 101 virtual void SAL_CALL dropComplete( sal_Bool success ) throw (::com::sun::star::uno::RuntimeException); 102 103 /* 104 * XDropTarget 105 */ 106 107 virtual void SAL_CALL addDropTargetListener( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTargetListener >& dtl ) throw(::com::sun::star::uno::RuntimeException); 108 virtual void SAL_CALL removeDropTargetListener( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::dnd::XDropTargetListener >& dtl ) throw(::com::sun::star::uno::RuntimeException); 109 virtual sal_Bool SAL_CALL isActive( ) throw(::com::sun::star::uno::RuntimeException); 110 virtual void SAL_CALL setActive( sal_Bool active ) throw(::com::sun::star::uno::RuntimeException); 111 virtual sal_Int8 SAL_CALL getDefaultActions( ) throw(::com::sun::star::uno::RuntimeException); 112 virtual void SAL_CALL setDefaultActions( sal_Int8 actions ) throw(::com::sun::star::uno::RuntimeException); 113 }; 114 115 116 //================================================================================================== 117 // 118 //================================================================================================== 119 120 #endif 121