1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: source.hxx,v $
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 ************************************************************************/
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>
38 #include <osl/mutex.hxx>
40 #ifndef _CPPUHELPER_COMPBASE2_HXX_
41 #include <cppuhelper/compbase3.hxx>
43 #include <com/sun/star/lang/XServiceInfo.hpp>
44 #include "../../inc/DtObjFactory.hxx"
45 #include "globals.hxx"
48 #include <systools/win32/comtools.hxx>
50 using namespace ::com::sun::star::lang
;
51 using namespace ::com::sun::star::uno
;
55 using namespace ::com::sun::star::datatransfer
;
56 using namespace ::com::sun::star::datatransfer::dnd
;
61 // RIGHT MOUSE BUTTON drag and drop not supportet currently.
62 // ALT modifier is considered to effect a user selection of effects
65 public WeakComponentImplHelper3
<XDragSource
, XInitialization
, XServiceInfo
>,
69 Reference
<XMultiServiceFactory
> m_serviceFactory
;
72 // The mouse button that set off the drag and drop operation
74 // Converts XTransferable objects to IDataObject objects.
75 CDTransObjFactory m_aDataConverter
;
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
84 const DragGestureEvent
& trigger
,
85 sal_Int8 sourceActions
,
88 const Reference
<XTransferable
>& trans
,
89 const Reference
<XDragSourceListener
>& listener
);
92 long m_RunningDndOperationCount
;
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
;
107 DragSource(const Reference
<XMultiServiceFactory
>& sf
);
108 virtual ~DragSource();
111 virtual void SAL_CALL
initialize( const Sequence
< Any
>& aArguments
)
112 throw(Exception
, RuntimeException
);
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
,
123 const Reference
<XTransferable
>& trans
,
124 const Reference
<XDragSourceListener
>& listener
)
125 throw( RuntimeException
);
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( );
144 virtual HRESULT STDMETHODCALLTYPE
QueryContinueDrag(
145 /* [in] */ BOOL fEscapePressed
,
146 /* [in] */ DWORD grfKeyState
);
148 virtual HRESULT STDMETHODCALLTYPE
GiveFeedback(
149 /* [in] */ DWORD dwEffect
);