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