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