Update ooo320-m1
[ooovba.git] / dtrans / source / win32 / dnd / source.hxx
blobf3c342d3ce0e331ca764e8d1289d66781e0b71e1
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: source.hxx,v $
10 * $Revision: 1.14 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _SOURCE_HXX_
32 #define _SOURCE_HXX_
34 #include <com/sun/star/datatransfer/dnd/XDragSource.hpp>
35 #include <com/sun/star/datatransfer/dnd/XDragSourceContext.hpp>
36 #include <com/sun/star/lang/XInitialization.hpp>
37 #ifndef _OSL_MUTEX_H_
38 #include <osl/mutex.hxx>
39 #endif
40 #ifndef _CPPUHELPER_COMPBASE2_HXX_
41 #include <cppuhelper/compbase3.hxx>
42 #endif
43 #include <com/sun/star/lang/XServiceInfo.hpp>
44 #include "../../inc/DtObjFactory.hxx"
45 #include "globals.hxx"
46 #include <oleidl.h>
48 #include <systools/win32/comtools.hxx>
50 using namespace ::com::sun::star::lang;
51 using namespace ::com::sun::star::uno;
52 using namespace cppu;
53 using namespace osl;
54 using namespace rtl;
55 using namespace ::com::sun::star::datatransfer;
56 using namespace ::com::sun::star::datatransfer::dnd;
60 class SourceContext;
61 // RIGHT MOUSE BUTTON drag and drop not supportet currently.
62 // ALT modifier is considered to effect a user selection of effects
63 class DragSource:
64 public MutexDummy,
65 public WeakComponentImplHelper3<XDragSource, XInitialization, XServiceInfo>,
66 public IDropSource
69 Reference<XMultiServiceFactory> m_serviceFactory;
70 HWND m_hAppWindow;
72 // The mouse button that set off the drag and drop operation
73 short m_MouseButton;
74 // Converts XTransferable objects to IDataObject objects.
75 CDTransObjFactory m_aDataConverter;
77 DragSource();
78 DragSource(const DragSource&);
79 DragSource &operator= ( const DragSource&);
81 // First starting a new drag and drop thread if
82 // the last one has finished
83 void StartDragImpl(
84 const DragGestureEvent& trigger,
85 sal_Int8 sourceActions,
86 sal_Int32 cursor,
87 sal_Int32 image,
88 const Reference<XTransferable >& trans,
89 const Reference<XDragSourceListener >& listener);
91 public:
92 long m_RunningDndOperationCount;
94 public:
95 // only valid for one dnd operation
96 // the thread ID of the thread which created the window
97 DWORD m_threadIdWindow;
98 // The context notifies the XDragSourceListener s
99 Reference<XDragSourceContext> m_currentContext;
101 // the wrapper for the Transferable ( startDrag)
102 IDataObjectPtr m_spDataObject;
104 sal_Int8 m_sourceActions;
106 public:
107 DragSource(const Reference<XMultiServiceFactory>& sf);
108 virtual ~DragSource();
110 // XInitialization
111 virtual void SAL_CALL initialize( const Sequence< Any >& aArguments )
112 throw(Exception, RuntimeException);
115 // XDragSource
116 virtual sal_Bool SAL_CALL isDragImageSupported( ) throw(RuntimeException);
117 virtual sal_Int32 SAL_CALL getDefaultCursor( sal_Int8 dragAction )
118 throw( IllegalArgumentException, RuntimeException);
119 virtual void SAL_CALL startDrag( const DragGestureEvent& trigger,
120 sal_Int8 sourceActions,
121 sal_Int32 cursor,
122 sal_Int32 image,
123 const Reference<XTransferable >& trans,
124 const Reference<XDragSourceListener >& listener )
125 throw( RuntimeException);
127 // XServiceInfo
128 virtual OUString SAL_CALL getImplementationName( ) throw (RuntimeException);
129 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (RuntimeException);
130 virtual Sequence< OUString > SAL_CALL getSupportedServiceNames( ) throw (RuntimeException);
134 virtual HRESULT STDMETHODCALLTYPE QueryInterface(
135 /* [in] */ REFIID riid,
136 /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject);
138 virtual ULONG STDMETHODCALLTYPE AddRef( );
140 virtual ULONG STDMETHODCALLTYPE Release( );
143 // IDropSource
144 virtual HRESULT STDMETHODCALLTYPE QueryContinueDrag(
145 /* [in] */ BOOL fEscapePressed,
146 /* [in] */ DWORD grfKeyState);
148 virtual HRESULT STDMETHODCALLTYPE GiveFeedback(
149 /* [in] */ DWORD dwEffect);
154 #endif