LibreOffice Module dtrans (master)  1
sourcecontext.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 #ifndef INCLUDED_DTRANS_SOURCE_WIN32_DND_SOURCECONTEXT_HXX
20 #define INCLUDED_DTRANS_SOURCE_WIN32_DND_SOURCECONTEXT_HXX
21 
22 #include <com/sun/star/datatransfer/dnd/XDragSourceContext.hpp>
23 #include <cppuhelper/compbase.hxx>
24 
25 #include "source.hxx"
26 
27 using namespace ::com::sun::star::datatransfer;
28 using namespace ::com::sun::star::datatransfer::dnd;
29 using namespace ::cppu;
30 using namespace ::com::sun::star::uno;
31 using namespace ::com::sun::star::lang;
32 
33 // This class fires events to XDragSourceListener implementations.
34 // Of that interface only dragDropEnd and dropActionChanged are called.
35 // The functions dragEnter, dragExit and dragOver are not supported
36 // currently.
37 // An instance of SourceContext only lives as long as the drag and drop
38 // operation lasts.
39 class SourceContext: public MutexDummy,
40  public WeakComponentImplHelper<XDragSourceContext>
41 {
43  Reference<XDragSource> m_dragSource;
44  // the action ( copy, move etc)
46 
47 public:
48  SourceContext( DragSource* pSource, const Reference<XDragSourceListener>& listener);
49  ~SourceContext() override;
50  SourceContext(const SourceContext&) = delete;
51  SourceContext &operator= (const SourceContext&) = delete;
52 
54  virtual void addDragSourceListener( const Reference<XDragSourceListener >& dsl );
56  virtual void removeDragSourceListener( const Reference<XDragSourceListener >& dsl );
57  virtual sal_Int32 SAL_CALL getCurrentCursor( ) override;
58  virtual void SAL_CALL setCursor( sal_Int32 cursorId ) override;
59  virtual void SAL_CALL setImage( sal_Int32 imageId ) override;
60  virtual void SAL_CALL transferablesFlavorsChanged( ) override;
61 
62  // non - interface functions
63  void fire_dragDropEnd( bool success, sal_Int8 byte);
64  void fire_dropActionChanged( sal_Int8 dropAction, sal_Int8 userAction);
65 
66 };
67 
68 #endif
69 
70 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void SAL_CALL setImage(sal_Int32 imageId) override
DragSource * m_pDragSource
signed char sal_Int8
SourceContext & operator=(const SourceContext &)=delete
void fire_dragDropEnd(bool success, sal_Int8 byte)
virtual void addDragSourceListener(const Reference< XDragSourceListener > &dsl)
SourceContext(DragSource *pSource, const Reference< XDragSourceListener > &listener)
Reference< XDragSource > m_dragSource
virtual sal_Int32 SAL_CALL getCurrentCursor() override
virtual void SAL_CALL transferablesFlavorsChanged() override
~SourceContext() override
unsigned char byte
virtual void removeDragSourceListener(const Reference< XDragSourceListener > &dsl)
void fire_dropActionChanged(sal_Int8 dropAction, sal_Int8 userAction)
virtual void SAL_CALL setCursor(sal_Int32 cursorId) override
sal_Int8 m_currentAction