LibreOffice Module vcl (master)  1
dndhelp.cxx
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 #include <vcl/dndhelp.hxx>
21 
23 
24 using namespace ::com::sun::star;
25 
27 
28 void vcl::unohelper::DragAndDropClient::dragGestureRecognized( const css::datatransfer::dnd::DragGestureEvent& /*dge*/ )
29 {
30 }
31 
32 void vcl::unohelper::DragAndDropClient::dragDropEnd( const css::datatransfer::dnd::DragSourceDropEvent& /*dsde*/ )
33 {
34 }
35 
36 void vcl::unohelper::DragAndDropClient::drop( const css::datatransfer::dnd::DropTargetDropEvent& /*dtde*/ )
37 {
38 }
39 
40 void vcl::unohelper::DragAndDropClient::dragEnter( const css::datatransfer::dnd::DropTargetDragEnterEvent& /*dtdee*/ )
41 {
42 }
43 
44 void vcl::unohelper::DragAndDropClient::dragExit( const css::datatransfer::dnd::DropTargetEvent& /*dte*/ )
45 {
46 }
47 
48 void vcl::unohelper::DragAndDropClient::dragOver( const css::datatransfer::dnd::DropTargetDragEvent& /*dtde*/ )
49 {
50 }
51 
53 {
54  mpClient = pClient;
55 }
56 
58 {
59 }
60 
61 // uno::XInterface
63 {
64  uno::Any aRet = ::cppu::queryInterface( rType,
65  static_cast< css::lang::XEventListener* >( static_cast<css::datatransfer::dnd::XDragGestureListener*>(this) ),
66  static_cast< css::datatransfer::dnd::XDragGestureListener* >(this),
67  static_cast< css::datatransfer::dnd::XDragSourceListener* >(this),
68  static_cast< css::datatransfer::dnd::XDropTargetListener* >(this) );
69  return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ));
70 }
71 
72 // css::lang::XEventListener
73 void vcl::unohelper::DragAndDropWrapper::disposing( const css::lang::EventObject& rEvent )
74 {
75  // Empty Source means it's the client, because the client is not a XInterface
76  if ( !rEvent.Source.is() )
77  mpClient = nullptr;
78 }
79 
80 // css::datatransfer::dnd::XDragGestureListener
81 void vcl::unohelper::DragAndDropWrapper::dragGestureRecognized( const css::datatransfer::dnd::DragGestureEvent& rDGE )
82 {
83  if ( mpClient )
84  mpClient->dragGestureRecognized( rDGE );
85 }
86 
87 // css::datatransfer::dnd::XDragSourceListener
88 void vcl::unohelper::DragAndDropWrapper::dragDropEnd( const css::datatransfer::dnd::DragSourceDropEvent& rDSDE )
89 {
90  if ( mpClient )
91  mpClient->dragDropEnd( rDSDE );
92 }
93 
94 void vcl::unohelper::DragAndDropWrapper::dragEnter( const css::datatransfer::dnd::DragSourceDragEvent& )
95 {
96 }
97 
98 void vcl::unohelper::DragAndDropWrapper::dragExit( const css::datatransfer::dnd::DragSourceEvent& )
99 {
100 }
101 
102 void vcl::unohelper::DragAndDropWrapper::dragOver( const css::datatransfer::dnd::DragSourceDragEvent& )
103 {
104 }
105 
106 void vcl::unohelper::DragAndDropWrapper::dropActionChanged( const css::datatransfer::dnd::DragSourceDragEvent& )
107 {
108 }
109 
110 // css::datatransfer::dnd::XDropTargetListener
111 void vcl::unohelper::DragAndDropWrapper::drop( const css::datatransfer::dnd::DropTargetDropEvent& rDTDE )
112 {
113  if ( mpClient )
114  mpClient->drop( rDTDE );
115 }
116 
117 void vcl::unohelper::DragAndDropWrapper::dragEnter( const css::datatransfer::dnd::DropTargetDragEnterEvent& rDTDEE )
118 {
119  if ( mpClient )
120  mpClient->dragEnter( rDTDEE );
121 }
122 
123 void vcl::unohelper::DragAndDropWrapper::dragExit( const css::datatransfer::dnd::DropTargetEvent& dte )
124 {
125  if ( mpClient )
126  mpClient->dragExit( dte );
127 }
128 
129 void vcl::unohelper::DragAndDropWrapper::dragOver( const css::datatransfer::dnd::DropTargetDragEvent& rDTDE )
130 {
131  if ( mpClient )
132  mpClient->dragOver( rDTDE );
133 }
134 
135 void vcl::unohelper::DragAndDropWrapper::dropActionChanged( const css::datatransfer::dnd::DropTargetDragEvent& )
136 {
137 }
138 
139 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual ~DragAndDropWrapper() override
Definition: dndhelp.cxx:57
virtual ~DragAndDropClient() COVERITY_NOEXCEPT_FALSE
Definition: dndhelp.cxx:26
bool hasValue()
void SAL_CALL dragExit(const css::datatransfer::dnd::DragSourceEvent &dse) override
Definition: dndhelp.cxx:98
virtual void dragExit(const css::datatransfer::dnd::DropTargetEvent &dte)
Definition: dndhelp.cxx:44
void SAL_CALL dropActionChanged(const css::datatransfer::dnd::DragSourceDragEvent &dsde) override
Definition: dndhelp.cxx:106
void SAL_CALL drop(const css::datatransfer::dnd::DropTargetDropEvent &dtde) override
Definition: dndhelp.cxx:111
virtual void dragOver(const css::datatransfer::dnd::DropTargetDragEvent &dtde)
Definition: dndhelp.cxx:48
void SAL_CALL dragDropEnd(const css::datatransfer::dnd::DragSourceDropEvent &dsde) override
Definition: dndhelp.cxx:88
void SAL_CALL dragGestureRecognized(const css::datatransfer::dnd::DragGestureEvent &dge) override
Definition: dndhelp.cxx:81
virtual void dragDropEnd(const css::datatransfer::dnd::DragSourceDropEvent &dsde)
Definition: dndhelp.cxx:32
void SAL_CALL disposing(const css::lang::EventObject &Source) override
Definition: dndhelp.cxx:73
css::uno::Any SAL_CALL queryInterface(const css::uno::Type &rType) override
Definition: dndhelp.cxx:62
void SAL_CALL dragEnter(const css::datatransfer::dnd::DragSourceDragEvent &dsde) override
Definition: dndhelp.cxx:94
void SAL_CALL dragOver(const css::datatransfer::dnd::DragSourceDragEvent &dsde) override
Definition: dndhelp.cxx:102
virtual void dragGestureRecognized(const css::datatransfer::dnd::DragGestureEvent &dge)
Definition: dndhelp.cxx:28
virtual void dragEnter(const css::datatransfer::dnd::DropTargetDragEnterEvent &dtdee)
Definition: dndhelp.cxx:40
virtual void drop(const css::datatransfer::dnd::DropTargetDropEvent &dtde)
Definition: dndhelp.cxx:36
DragAndDropWrapper(DragAndDropClient *pClient)
Definition: dndhelp.cxx:52