LibreOffice Module dtrans (master)  1
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 #ifndef INCLUDED_DTRANS_SOURCE_WIN32_DND_SOURCE_HXX
21 #define INCLUDED_DTRANS_SOURCE_WIN32_DND_SOURCE_HXX
22 
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>
31 
32 #include <systools/win32/comtools.hxx>
33 
34 namespace com { namespace sun { namespace star { namespace uno {
35  class XComponentContext;
36 } } } }
37 
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;
44 
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
52 
53 {
56 
57  // The mouse button that set off the drag and drop operation
59 
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);
69 
70 public:
72 
73 public:
74  // only valid for one dnd operation
75  // the thread ID of the thread which created the window
77  // The context notifies the XDragSourceListener s
78  Reference<XDragSourceContext> m_currentContext;
79 
80  // the wrapper for the Transferable ( startDrag)
81  IDataObjectPtr m_spDataObject;
82 
84 
85 public:
86  explicit DragSource(const Reference<XComponentContext>& rxContext);
87  virtual ~DragSource() override;
88  DragSource(const DragSource&) = delete;
89  DragSource &operator= ( const DragSource&) = delete;
90 
91  // XInitialization
92  virtual void SAL_CALL initialize( const Sequence< Any >& aArguments ) override;
93 
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;
103 
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;
108 
109  virtual HRESULT STDMETHODCALLTYPE QueryInterface(
110  /* [in] */ REFIID riid,
111  /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject) override;
112 
113  virtual ULONG STDMETHODCALLTYPE AddRef( ) override;
114 
115  virtual ULONG STDMETHODCALLTYPE Release( ) override;
116 
117  // IDropSource
118  virtual HRESULT STDMETHODCALLTYPE QueryContinueDrag(
119  /* [in] */ BOOL fEscapePressed,
120  /* [in] */ DWORD grfKeyState) override;
121 
122  virtual HRESULT STDMETHODCALLTYPE GiveFeedback(
123  /* [in] */ DWORD dwEffect) override;
124 
125 };
126 
127 #endif
128 
129 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
DWORD m_threadIdWindow
Definition: source.hxx:76
signed char sal_Int8
IDataObjectPtr m_spDataObject
Definition: source.hxx:81
OUString getImplementationName()
long m_RunningDndOperationCount
Definition: source.hxx:71
const wchar_t *typedef BOOL
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
sal_Int8 m_sourceActions
Definition: source.hxx:83
Reference< XDragSourceContext > m_currentContext
Definition: source.hxx:78
css::uno::Sequence< OUString > getSupportedServiceNames()
unsigned char sal_Bool
Reference< XComponentContext > m_xContext
Definition: source.hxx:54
HWND m_hAppWindow
Definition: source.hxx:55
short m_MouseButton
Definition: source.hxx:58