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 .
21 #include <com/sun/star/datatransfer/dnd/XDragSourceContext.hpp>
22 #include <cppuhelper/compbase.hxx>
26 using namespace ::com::sun::star::datatransfer
;
27 using namespace ::com::sun::star::datatransfer::dnd
;
28 using namespace ::cppu
;
29 using namespace ::com::sun::star::uno
;
30 using namespace ::com::sun::star::lang
;
32 // This class fires events to XDragSourceListener implementations.
33 // Of that interface only dragDropEnd and dropActionChanged are called.
34 // The functions dragEnter, dragExit and dragOver are not supported
36 // An instance of SourceContext only lives as long as the drag and drop
38 class SourceContext
: public MutexDummy
, public WeakComponentImplHelper
<XDragSourceContext
>
40 DragSource
* m_pDragSource
;
41 Reference
<XDragSource
> m_dragSource
;
42 // the action ( copy, move etc)
43 sal_Int8 m_currentAction
;
46 SourceContext(DragSource
* pSource
, const Reference
<XDragSourceListener
>& listener
);
47 ~SourceContext() override
;
48 SourceContext(const SourceContext
&) = delete;
49 SourceContext
& operator=(const SourceContext
&) = delete;
51 /// @throws RuntimeException
52 virtual void addDragSourceListener(const Reference
<XDragSourceListener
>& dsl
);
53 /// @throws RuntimeException
54 virtual void removeDragSourceListener(const Reference
<XDragSourceListener
>& dsl
);
55 virtual sal_Int32 SAL_CALL
getCurrentCursor() override
;
56 virtual void SAL_CALL
setCursor(sal_Int32 cursorId
) override
;
57 virtual void SAL_CALL
setImage(sal_Int32 imageId
) override
;
58 virtual void SAL_CALL
transferablesFlavorsChanged() override
;
60 // non - interface functions
61 void fire_dragDropEnd(bool success
, sal_Int8 byte
);
62 void fire_dropActionChanged(sal_Int8 dropAction
, sal_Int8 userAction
);
65 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */