Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / dtrans / source / win32 / dnd / source.hxx
blob52d4bab1982fae4bcc4cf00a9eee7cab982a4634
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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"
30 #include <oleidl.h>
32 #include <systools/win32/comtools.hxx>
34 namespace com { namespace sun { namespace star { namespace uno {
35 class XComponentContext;
36 } } } }
38 using namespace ::com::sun::star::lang;
39 using namespace ::com::sun::star::uno;
40 using namespace cppu;
41 using namespace osl;
42 using namespace ::com::sun::star::datatransfer;
43 using namespace ::com::sun::star::datatransfer::dnd;
45 class SourceContext;
46 // RIGHT MOUSE BUTTON drag and drop not supported currently.
47 // ALT modifier is considered to effect a user selection of effects
48 class DragSource:
49 public MutexDummy,
50 public WeakComponentImplHelper<XDragSource, XInitialization, XServiceInfo>,
51 public IDropSource
54 Reference<XComponentContext> m_xContext;
55 HWND m_hAppWindow;
57 // The mouse button that set off the drag and drop operation
58 short m_MouseButton;
60 // First starting a new drag and drop thread if
61 // the last one has finished
62 void StartDragImpl(
63 const DragGestureEvent& trigger,
64 sal_Int8 sourceActions,
65 sal_Int32 cursor,
66 sal_Int32 image,
67 const Reference<XTransferable >& trans,
68 const Reference<XDragSourceListener >& listener);
70 public:
71 long m_RunningDndOperationCount;
73 public:
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;
85 public:
86 explicit DragSource(const Reference<XComponentContext>& rxContext);
87 virtual ~DragSource() override;
88 DragSource(const DragSource&) = delete;
89 DragSource &operator= ( const DragSource&) = delete;
91 // XInitialization
92 virtual void SAL_CALL initialize( const Sequence< Any >& aArguments ) override;
94 // XDragSource
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,
99 sal_Int32 cursor,
100 sal_Int32 image,
101 const Reference<XTransferable >& trans,
102 const Reference<XDragSourceListener >& listener ) override;
104 // XServiceInfo
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;
117 // IDropSource
118 virtual HRESULT STDMETHODCALLTYPE QueryContinueDrag(
119 /* [in] */ BOOL fEscapePressed,
120 /* [in] */ DWORD grfKeyState) override;
122 virtual HRESULT STDMETHODCALLTYPE GiveFeedback(
123 /* [in] */ DWORD dwEffect) override;
127 #endif
129 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */