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 
22 #include <cppuhelper/queryinterface.hxx>
23 
24 using namespace ::com::sun::star;
25 
~DragAndDropClient()26 vcl::unohelper::DragAndDropClient::~DragAndDropClient() COVERITY_NOEXCEPT_FALSE {}
27 
dragGestureRecognized(const css::datatransfer::dnd::DragGestureEvent &)28 void vcl::unohelper::DragAndDropClient::dragGestureRecognized( const css::datatransfer::dnd::DragGestureEvent& /*dge*/ )
29 {
30 }
31 
dragDropEnd(const css::datatransfer::dnd::DragSourceDropEvent &)32 void vcl::unohelper::DragAndDropClient::dragDropEnd( const css::datatransfer::dnd::DragSourceDropEvent& /*dsde*/ )
33 {
34 }
35 
drop(const css::datatransfer::dnd::DropTargetDropEvent &)36 void vcl::unohelper::DragAndDropClient::drop( const css::datatransfer::dnd::DropTargetDropEvent& /*dtde*/ )
37 {
38 }
39 
dragEnter(const css::datatransfer::dnd::DropTargetDragEnterEvent &)40 void vcl::unohelper::DragAndDropClient::dragEnter( const css::datatransfer::dnd::DropTargetDragEnterEvent& /*dtdee*/ )
41 {
42 }
43 
dragExit(const css::datatransfer::dnd::DropTargetEvent &)44 void vcl::unohelper::DragAndDropClient::dragExit( const css::datatransfer::dnd::DropTargetEvent& /*dte*/ )
45 {
46 }
47 
dragOver(const css::datatransfer::dnd::DropTargetDragEvent &)48 void vcl::unohelper::DragAndDropClient::dragOver( const css::datatransfer::dnd::DropTargetDragEvent& /*dtde*/ )
49 {
50 }
51 
DragAndDropWrapper(DragAndDropClient * pClient)52 vcl::unohelper::DragAndDropWrapper::DragAndDropWrapper( DragAndDropClient* pClient )
53 {
54     mpClient = pClient;
55 }
56 
~DragAndDropWrapper()57 vcl::unohelper::DragAndDropWrapper::~DragAndDropWrapper()
58 {
59 }
60 
61 // uno::XInterface
queryInterface(const uno::Type & rType)62 uno::Any vcl::unohelper::DragAndDropWrapper::queryInterface( const uno::Type & rType )
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
disposing(const css::lang::EventObject & rEvent)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
dragGestureRecognized(const css::datatransfer::dnd::DragGestureEvent & rDGE)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
dragDropEnd(const css::datatransfer::dnd::DragSourceDropEvent & rDSDE)88 void vcl::unohelper::DragAndDropWrapper::dragDropEnd( const css::datatransfer::dnd::DragSourceDropEvent& rDSDE )
89 {
90     if ( mpClient )
91         mpClient->dragDropEnd( rDSDE );
92 }
93 
dragEnter(const css::datatransfer::dnd::DragSourceDragEvent &)94 void vcl::unohelper::DragAndDropWrapper::dragEnter( const css::datatransfer::dnd::DragSourceDragEvent& )
95 {
96 }
97 
dragExit(const css::datatransfer::dnd::DragSourceEvent &)98 void vcl::unohelper::DragAndDropWrapper::dragExit( const css::datatransfer::dnd::DragSourceEvent& )
99 {
100 }
101 
dragOver(const css::datatransfer::dnd::DragSourceDragEvent &)102 void vcl::unohelper::DragAndDropWrapper::dragOver( const css::datatransfer::dnd::DragSourceDragEvent& )
103 {
104 }
105 
dropActionChanged(const css::datatransfer::dnd::DragSourceDragEvent &)106 void vcl::unohelper::DragAndDropWrapper::dropActionChanged( const css::datatransfer::dnd::DragSourceDragEvent& )
107 {
108 }
109 
110 // css::datatransfer::dnd::XDropTargetListener
drop(const css::datatransfer::dnd::DropTargetDropEvent & rDTDE)111 void vcl::unohelper::DragAndDropWrapper::drop( const css::datatransfer::dnd::DropTargetDropEvent& rDTDE )
112 {
113     if ( mpClient )
114         mpClient->drop( rDTDE );
115 }
116 
dragEnter(const css::datatransfer::dnd::DropTargetDragEnterEvent & rDTDEE)117 void vcl::unohelper::DragAndDropWrapper::dragEnter( const css::datatransfer::dnd::DropTargetDragEnterEvent& rDTDEE )
118 {
119     if ( mpClient )
120         mpClient->dragEnter( rDTDEE );
121 }
122 
dragExit(const css::datatransfer::dnd::DropTargetEvent & dte)123 void vcl::unohelper::DragAndDropWrapper::dragExit( const css::datatransfer::dnd::DropTargetEvent& dte )
124 {
125     if ( mpClient )
126         mpClient->dragExit( dte );
127 }
128 
dragOver(const css::datatransfer::dnd::DropTargetDragEvent & rDTDE)129 void vcl::unohelper::DragAndDropWrapper::dragOver( const css::datatransfer::dnd::DropTargetDragEvent& rDTDE )
130 {
131     if ( mpClient )
132         mpClient->dragOver( rDTDE );
133 }
134 
dropActionChanged(const css::datatransfer::dnd::DropTargetDragEvent &)135 void vcl::unohelper::DragAndDropWrapper::dropActionChanged( const css::datatransfer::dnd::DropTargetDragEvent& )
136 {
137 }
138 
139 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
140