1*fbcf0fe9SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 3*fbcf0fe9SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 4*fbcf0fe9SAndrew Rist * or more contributor license agreements. See the NOTICE file 5*fbcf0fe9SAndrew Rist * distributed with this work for additional information 6*fbcf0fe9SAndrew Rist * regarding copyright ownership. The ASF licenses this file 7*fbcf0fe9SAndrew Rist * to you under the Apache License, Version 2.0 (the 8*fbcf0fe9SAndrew Rist * "License"); you may not use this file except in compliance 9*fbcf0fe9SAndrew Rist * with the License. You may obtain a copy of the License at 10cdf0e10cSrcweir * 11*fbcf0fe9SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 12cdf0e10cSrcweir * 13*fbcf0fe9SAndrew Rist * Unless required by applicable law or agreed to in writing, 14*fbcf0fe9SAndrew Rist * software distributed under the License is distributed on an 15*fbcf0fe9SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16*fbcf0fe9SAndrew Rist * KIND, either express or implied. See the License for the 17*fbcf0fe9SAndrew Rist * specific language governing permissions and limitations 18*fbcf0fe9SAndrew Rist * under the License. 19cdf0e10cSrcweir * 20*fbcf0fe9SAndrew Rist *************************************************************/ 21*fbcf0fe9SAndrew Rist 22*fbcf0fe9SAndrew Rist 23cdf0e10cSrcweir #ifndef _SOURCECONTEXT_HXX_ 24cdf0e10cSrcweir #define _SOURCECONTEXT_HXX_ 25cdf0e10cSrcweir 26cdf0e10cSrcweir #include <cppuhelper/implbase1.hxx> 27cdf0e10cSrcweir #include <com/sun/star/datatransfer/dnd/XDragSourceContext.hpp> 28cdf0e10cSrcweir #include <cppuhelper/compbase1.hxx> 29cdf0e10cSrcweir 30cdf0e10cSrcweir 31cdf0e10cSrcweir #include "source.hxx" 32cdf0e10cSrcweir 33cdf0e10cSrcweir using namespace ::com::sun::star::datatransfer; 34cdf0e10cSrcweir using namespace ::com::sun::star::datatransfer::dnd; 35cdf0e10cSrcweir using namespace ::cppu; 36cdf0e10cSrcweir using namespace ::com::sun::star::uno; 37cdf0e10cSrcweir using namespace ::com::sun::star::lang; 38cdf0e10cSrcweir 39cdf0e10cSrcweir 40cdf0e10cSrcweir // This class fires events to XDragSourceListener implementations. 41cdf0e10cSrcweir // Of that interface only dragDropEnd and dropActionChanged are called. 42cdf0e10cSrcweir // The functions dragEnter, dragExit and dragOver are not supported 43cdf0e10cSrcweir // currently. 44cdf0e10cSrcweir // An instance of SourceContext only lives as long as the drag and drop 45cdf0e10cSrcweir // operation lasts. 46cdf0e10cSrcweir class SourceContext: public MutexDummy, 47cdf0e10cSrcweir public WeakComponentImplHelper1<XDragSourceContext> 48cdf0e10cSrcweir { 49cdf0e10cSrcweir DragSource* m_pDragSource; 50cdf0e10cSrcweir Reference<XDragSource> m_dragSource; 51cdf0e10cSrcweir // the action ( copy, move etc) 52cdf0e10cSrcweir sal_Int8 m_currentAction; 53cdf0e10cSrcweir 54cdf0e10cSrcweir SourceContext(); 55cdf0e10cSrcweir SourceContext( const SourceContext&); 56cdf0e10cSrcweir SourceContext &operator= (const SourceContext& ); 57cdf0e10cSrcweir 58cdf0e10cSrcweir public: 59cdf0e10cSrcweir SourceContext( DragSource* pSource, const Reference<XDragSourceListener>& listener); 60cdf0e10cSrcweir ~SourceContext(); 61cdf0e10cSrcweir 62cdf0e10cSrcweir virtual void SAL_CALL addDragSourceListener( const Reference<XDragSourceListener >& dsl ) 63cdf0e10cSrcweir throw( RuntimeException); 64cdf0e10cSrcweir virtual void SAL_CALL removeDragSourceListener( const Reference<XDragSourceListener >& dsl ) 65cdf0e10cSrcweir throw( RuntimeException); 66cdf0e10cSrcweir virtual sal_Int32 SAL_CALL getCurrentCursor( ) 67cdf0e10cSrcweir throw( RuntimeException); 68cdf0e10cSrcweir virtual void SAL_CALL setCursor( sal_Int32 cursorId ) 69cdf0e10cSrcweir throw( RuntimeException); 70cdf0e10cSrcweir virtual void SAL_CALL setImage( sal_Int32 imageId ) 71cdf0e10cSrcweir throw( RuntimeException); 72cdf0e10cSrcweir virtual void SAL_CALL transferablesFlavorsChanged( ) 73cdf0e10cSrcweir throw( RuntimeException); 74cdf0e10cSrcweir 75cdf0e10cSrcweir 76cdf0e10cSrcweir 77cdf0e10cSrcweir // non - interface functions 78cdf0e10cSrcweir void fire_dragDropEnd( sal_Bool success, sal_Int8 byte); 79cdf0e10cSrcweir void fire_dropActionChanged( sal_Int8 dropAction, sal_Int8 userAction); 80cdf0e10cSrcweir 81cdf0e10cSrcweir }; 82cdf0e10cSrcweir 83cdf0e10cSrcweir 84cdf0e10cSrcweir 85cdf0e10cSrcweir #endif 86