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 #ifndef _SOURCECONTEXT_HXX_ 28 #define _SOURCECONTEXT_HXX_ 29 30 #include <cppuhelper/implbase1.hxx> 31 #include <com/sun/star/datatransfer/dnd/XDragSourceContext.hpp> 32 #include <cppuhelper/compbase1.hxx> 33 34 35 #include "source.hxx" 36 37 using namespace ::com::sun::star::datatransfer; 38 using namespace ::com::sun::star::datatransfer::dnd; 39 using namespace ::cppu; 40 using namespace ::com::sun::star::uno; 41 using namespace ::com::sun::star::lang; 42 43 44 // This class fires events to XDragSourceListener implementations. 45 // Of that interface only dragDropEnd and dropActionChanged are called. 46 // The functions dragEnter, dragExit and dragOver are not supported 47 // currently. 48 // An instance of SourceContext only lives as long as the drag and drop 49 // operation lasts. 50 class SourceContext: public MutexDummy, 51 public WeakComponentImplHelper1<XDragSourceContext> 52 { 53 DragSource* m_pDragSource; 54 Reference<XDragSource> m_dragSource; 55 // the action ( copy, move etc) 56 sal_Int8 m_currentAction; 57 58 SourceContext(); 59 SourceContext( const SourceContext&); 60 SourceContext &operator= (const SourceContext& ); 61 62 public: 63 SourceContext( DragSource* pSource, const Reference<XDragSourceListener>& listener); 64 ~SourceContext(); 65 66 virtual void SAL_CALL addDragSourceListener( const Reference<XDragSourceListener >& dsl ) 67 throw( RuntimeException); 68 virtual void SAL_CALL removeDragSourceListener( const Reference<XDragSourceListener >& dsl ) 69 throw( RuntimeException); 70 virtual sal_Int32 SAL_CALL getCurrentCursor( ) 71 throw( RuntimeException); 72 virtual void SAL_CALL setCursor( sal_Int32 cursorId ) 73 throw( RuntimeException); 74 virtual void SAL_CALL setImage( sal_Int32 imageId ) 75 throw( RuntimeException); 76 virtual void SAL_CALL transferablesFlavorsChanged( ) 77 throw( RuntimeException); 78 79 80 81 // non - interface functions 82 void fire_dragDropEnd( sal_Bool success, sal_Int8 byte); 83 void fire_dropActionChanged( sal_Int8 dropAction, sal_Int8 userAction); 84 85 }; 86 87 88 89 #endif 90