1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
22 #include <com/sun/star/datatransfer/dnd/XDragSource.hpp>
23 #include <com/sun/star/datatransfer/dnd/XDragSourceContext.hpp>
24 #include <com/sun/star/lang/XInitialization.hpp>
25 #include <osl/mutex.hxx>
26 #include <cppuhelper/basemutex.hxx>
27 #include <cppuhelper/compbase.hxx>
28 #include <com/sun/star/lang/XServiceInfo.hpp>
31 #include <systools/win32/comtools.hxx>
33 namespace com::sun::star::uno
{ class XComponentContext
; }
35 using namespace ::com::sun::star::lang
;
36 using namespace ::com::sun::star::uno
;
39 using namespace ::com::sun::star::datatransfer
;
40 using namespace ::com::sun::star::datatransfer::dnd
;
43 // RIGHT MOUSE BUTTON drag and drop not supported currently.
44 // ALT modifier is considered to effect a user selection of effects
46 public cppu::BaseMutex
,
47 public WeakComponentImplHelper
<XDragSource
, XInitialization
, XServiceInfo
>,
51 Reference
<XComponentContext
> m_xContext
;
54 // The mouse button that set off the drag and drop operation
57 // First starting a new drag and drop thread if
58 // the last one has finished
60 const DragGestureEvent
& trigger
,
61 sal_Int8 sourceActions
,
64 const Reference
<XTransferable
>& trans
,
65 const Reference
<XDragSourceListener
>& listener
);
68 LONG m_RunningDndOperationCount
;
71 // only valid for one dnd operation
72 // the thread ID of the thread which created the window
73 DWORD m_threadIdWindow
;
74 // The context notifies the XDragSourceListener s
75 Reference
<XDragSourceContext
> m_currentContext
;
77 // the wrapper for the Transferable ( startDrag)
78 IDataObjectPtr m_spDataObject
;
80 sal_Int8 m_sourceActions
;
83 explicit DragSource(const Reference
<XComponentContext
>& rxContext
);
84 virtual ~DragSource() override
;
85 DragSource(const DragSource
&) = delete;
86 DragSource
&operator= ( const DragSource
&) = delete;
89 virtual void SAL_CALL
initialize( const Sequence
< Any
>& aArguments
) override
;
92 virtual sal_Bool SAL_CALL
isDragImageSupported( ) override
;
93 virtual sal_Int32 SAL_CALL
getDefaultCursor( sal_Int8 dragAction
) override
;
94 virtual void SAL_CALL
startDrag( const DragGestureEvent
& trigger
,
95 sal_Int8 sourceActions
,
98 const Reference
<XTransferable
>& trans
,
99 const Reference
<XDragSourceListener
>& listener
) override
;
102 virtual OUString SAL_CALL
getImplementationName( ) override
;
103 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) override
;
104 virtual Sequence
< OUString
> SAL_CALL
getSupportedServiceNames( ) override
;
106 virtual HRESULT STDMETHODCALLTYPE
QueryInterface(
107 /* [in] */ REFIID riid
,
108 /* [iid_is][out] */ void __RPC_FAR
*__RPC_FAR
*ppvObject
) override
;
110 virtual ULONG STDMETHODCALLTYPE
AddRef( ) override
;
112 virtual ULONG STDMETHODCALLTYPE
Release( ) override
;
115 virtual HRESULT STDMETHODCALLTYPE
QueryContinueDrag(
116 /* [in] */ BOOL fEscapePressed
,
117 /* [in] */ DWORD grfKeyState
) override
;
119 virtual HRESULT STDMETHODCALLTYPE
GiveFeedback(
120 /* [in] */ DWORD dwEffect
) override
;
124 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */