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 .
20 #ifndef INCLUDED_DTRANS_SOURCE_WIN32_DND_SOURCE_HXX
21 #define INCLUDED_DTRANS_SOURCE_WIN32_DND_SOURCE_HXX
23 #include <com/sun/star/datatransfer/dnd/XDragSource.hpp>
24 #include <com/sun/star/datatransfer/dnd/XDragSourceContext.hpp>
25 #include <com/sun/star/lang/XInitialization.hpp>
26 #include <osl/mutex.hxx>
27 #include <cppuhelper/compbase.hxx>
28 #include <com/sun/star/lang/XServiceInfo.hpp>
29 #include "globals.hxx"
32 #include <systools/win32/comtools.hxx>
34 namespace com
{ namespace sun
{ namespace star
{ namespace uno
{
35 class XComponentContext
;
38 using namespace ::com::sun::star::lang
;
39 using namespace ::com::sun::star::uno
;
42 using namespace ::com::sun::star::datatransfer
;
43 using namespace ::com::sun::star::datatransfer::dnd
;
46 // RIGHT MOUSE BUTTON drag and drop not supported currently.
47 // ALT modifier is considered to effect a user selection of effects
50 public WeakComponentImplHelper
<XDragSource
, XInitialization
, XServiceInfo
>,
54 Reference
<XComponentContext
> m_xContext
;
57 // The mouse button that set off the drag and drop operation
60 // First starting a new drag and drop thread if
61 // the last one has finished
63 const DragGestureEvent
& trigger
,
64 sal_Int8 sourceActions
,
67 const Reference
<XTransferable
>& trans
,
68 const Reference
<XDragSourceListener
>& listener
);
71 long m_RunningDndOperationCount
;
74 // only valid for one dnd operation
75 // the thread ID of the thread which created the window
76 DWORD m_threadIdWindow
;
77 // The context notifies the XDragSourceListener s
78 Reference
<XDragSourceContext
> m_currentContext
;
80 // the wrapper for the Transferable ( startDrag)
81 IDataObjectPtr m_spDataObject
;
83 sal_Int8 m_sourceActions
;
86 explicit DragSource(const Reference
<XComponentContext
>& rxContext
);
87 virtual ~DragSource() override
;
88 DragSource(const DragSource
&) = delete;
89 DragSource
&operator= ( const DragSource
&) = delete;
92 virtual void SAL_CALL
initialize( const Sequence
< Any
>& aArguments
) override
;
95 virtual sal_Bool SAL_CALL
isDragImageSupported( ) override
;
96 virtual sal_Int32 SAL_CALL
getDefaultCursor( sal_Int8 dragAction
) override
;
97 virtual void SAL_CALL
startDrag( const DragGestureEvent
& trigger
,
98 sal_Int8 sourceActions
,
101 const Reference
<XTransferable
>& trans
,
102 const Reference
<XDragSourceListener
>& listener
) override
;
105 virtual OUString SAL_CALL
getImplementationName( ) override
;
106 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
) override
;
107 virtual Sequence
< OUString
> SAL_CALL
getSupportedServiceNames( ) override
;
109 virtual HRESULT STDMETHODCALLTYPE
QueryInterface(
110 /* [in] */ REFIID riid
,
111 /* [iid_is][out] */ void __RPC_FAR
*__RPC_FAR
*ppvObject
) override
;
113 virtual ULONG STDMETHODCALLTYPE
AddRef( ) override
;
115 virtual ULONG STDMETHODCALLTYPE
Release( ) override
;
118 virtual HRESULT STDMETHODCALLTYPE
QueryContinueDrag(
119 /* [in] */ BOOL fEscapePressed
,
120 /* [in] */ DWORD grfKeyState
) override
;
122 virtual HRESULT STDMETHODCALLTYPE
GiveFeedback(
123 /* [in] */ DWORD dwEffect
) override
;
129 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */