LibreOffice Module vcl (master) 1
dnd_source.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#pragma once
21
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>
28#include <com/sun/star/lang/XServiceInfo.hpp>
29#include <oleidl.h>
30
31#include <systools/win32/comtools.hxx>
32
33namespace com::sun::star::uno { class XComponentContext; }
34
35using namespace ::com::sun::star::lang;
36using namespace ::com::sun::star::uno;
37using namespace cppu;
38using namespace osl;
39using namespace ::com::sun::star::datatransfer;
40using namespace ::com::sun::star::datatransfer::dnd;
41
42class SourceContext;
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>,
48 public IDropSource
49
50{
51 Reference<XComponentContext> m_xContext;
53
54 // The mouse button that set off the drag and drop operation
56
57 // First starting a new drag and drop thread if
58 // the last one has finished
60 const DragGestureEvent& trigger,
61 sal_Int8 sourceActions,
62 sal_Int32 cursor,
63 sal_Int32 image,
64 const Reference<XTransferable >& trans,
65 const Reference<XDragSourceListener >& listener);
66
67public:
69
70public:
71 // only valid for one dnd operation
72 // the thread ID of the thread which created the window
74 // The context notifies the XDragSourceListener s
75 Reference<XDragSourceContext> m_currentContext;
76
77 // the wrapper for the Transferable ( startDrag)
78 IDataObjectPtr m_spDataObject;
79
81
82public:
83 explicit DragSource(const Reference<XComponentContext>& rxContext);
84 virtual ~DragSource() override;
85 DragSource(const DragSource&) = delete;
86 DragSource &operator= ( const DragSource&) = delete;
87
88 // XInitialization
89 virtual void SAL_CALL initialize( const Sequence< Any >& aArguments ) override;
90
91 // XDragSource
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,
96 sal_Int32 cursor,
97 sal_Int32 image,
98 const Reference<XTransferable >& trans,
99 const Reference<XDragSourceListener >& listener ) override;
100
101 // XServiceInfo
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;
105
106 virtual HRESULT STDMETHODCALLTYPE QueryInterface(
107 /* [in] */ REFIID riid,
108 /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject) override;
109
110 virtual ULONG STDMETHODCALLTYPE AddRef( ) override;
111
112 virtual ULONG STDMETHODCALLTYPE Release( ) override;
113
114 // IDropSource
115 virtual HRESULT STDMETHODCALLTYPE QueryContinueDrag(
116 /* [in] */ BOOL fEscapePressed,
117 /* [in] */ DWORD grfKeyState) override;
118
119 virtual HRESULT STDMETHODCALLTYPE GiveFeedback(
120 /* [in] */ DWORD dwEffect) override;
121
122};
123
124/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Reference< XDragSourceContext > m_currentContext
Definition: dnd_source.hxx:75
HWND m_hAppWindow
Definition: dnd_source.hxx:52
virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() override
DWORD m_threadIdWindow
Definition: dnd_source.hxx:73
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
void StartDragImpl(const DragGestureEvent &trigger, sal_Int8 sourceActions, sal_Int32 cursor, sal_Int32 image, const Reference< XTransferable > &trans, const Reference< XDragSourceListener > &listener)
sal_Int8 m_sourceActions
Definition: dnd_source.hxx:80
short m_MouseButton
Definition: dnd_source.hxx:55
virtual void SAL_CALL initialize(const Sequence< Any > &aArguments) override
LONG m_RunningDndOperationCount
Definition: dnd_source.hxx:68
Reference< XComponentContext > m_xContext
Definition: dnd_source.hxx:51
DragSource(const DragSource &)=delete
DragSource(const Reference< XComponentContext > &rxContext)
virtual sal_Bool SAL_CALL isDragImageSupported() override
DragSource & operator=(const DragSource &)=delete
virtual sal_Int32 SAL_CALL getDefaultCursor(sal_Int8 dragAction) override
virtual ULONG STDMETHODCALLTYPE AddRef() override
virtual HRESULT STDMETHODCALLTYPE GiveFeedback(DWORD dwEffect) override
virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void __RPC_FAR *__RPC_FAR *ppvObject) override
virtual void SAL_CALL startDrag(const DragGestureEvent &trigger, sal_Int8 sourceActions, sal_Int32 cursor, sal_Int32 image, const Reference< XTransferable > &trans, const Reference< XDragSourceListener > &listener) override
virtual ~DragSource() override
virtual HRESULT STDMETHODCALLTYPE QueryContinueDrag(BOOL fEscapePressed, DWORD grfKeyState) override
virtual OUString SAL_CALL getImplementationName() override
virtual ULONG STDMETHODCALLTYPE Release() override
IDataObjectPtr m_spDataObject
Definition: dnd_source.hxx:78
const wchar_t *typedef BOOL
LONG
unsigned char sal_Bool
signed char sal_Int8