Branch libreoffice-5-0-4
[LibreOffice.git] / vcl / source / app / dndhelp.cxx
blobbba7452ca2ee990eac242aa1e552818bdfac903f
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 .
20 #include <vcl/dndhelp.hxx>
22 #include <cppuhelper/queryinterface.hxx>
24 using namespace ::com::sun::star;
26 vcl::unohelper::DragAndDropClient::~DragAndDropClient() {}
28 void vcl::unohelper::DragAndDropClient::dragGestureRecognized( const ::com::sun::star::datatransfer::dnd::DragGestureEvent& /*dge*/ )
29 throw (::com::sun::star::uno::RuntimeException,
30 std::exception)
34 void vcl::unohelper::DragAndDropClient::dragDropEnd( const ::com::sun::star::datatransfer::dnd::DragSourceDropEvent& /*dsde*/ )
35 throw (::com::sun::star::uno::RuntimeException,
36 std::exception)
40 void vcl::unohelper::DragAndDropClient::drop( const ::com::sun::star::datatransfer::dnd::DropTargetDropEvent& /*dtde*/ )
41 throw (::com::sun::star::uno::RuntimeException,
42 std::exception)
46 void vcl::unohelper::DragAndDropClient::dragEnter( const ::com::sun::star::datatransfer::dnd::DropTargetDragEnterEvent& /*dtdee*/ )
47 throw (::com::sun::star::uno::RuntimeException,
48 std::exception)
52 void vcl::unohelper::DragAndDropClient::dragExit( const ::com::sun::star::datatransfer::dnd::DropTargetEvent& /*dte*/ )
53 throw (::com::sun::star::uno::RuntimeException,
54 std::exception)
58 void vcl::unohelper::DragAndDropClient::dragOver( const ::com::sun::star::datatransfer::dnd::DropTargetDragEvent& /*dtde*/ )
59 throw (::com::sun::star::uno::RuntimeException,
60 std::exception)
64 vcl::unohelper::DragAndDropWrapper::DragAndDropWrapper( DragAndDropClient* pClient )
66 mpClient = pClient;
69 vcl::unohelper::DragAndDropWrapper::~DragAndDropWrapper()
73 // uno::XInterface
74 uno::Any vcl::unohelper::DragAndDropWrapper::queryInterface( const uno::Type & rType ) throw(uno::RuntimeException, std::exception)
76 uno::Any aRet = ::cppu::queryInterface( rType,
77 (static_cast< ::com::sun::star::lang::XEventListener* >( (::com::sun::star::datatransfer::dnd::XDragGestureListener*)this) ),
78 (static_cast< ::com::sun::star::datatransfer::dnd::XDragGestureListener* >(this)),
79 (static_cast< ::com::sun::star::datatransfer::dnd::XDragSourceListener* >(this)),
80 (static_cast< ::com::sun::star::datatransfer::dnd::XDropTargetListener* >(this)) );
81 return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ));
84 // ::com::sun::star::lang::XEventListener
85 void vcl::unohelper::DragAndDropWrapper::disposing( const ::com::sun::star::lang::EventObject& rEvent ) throw (::com::sun::star::uno::RuntimeException, std::exception)
87 // Empty Source means it's the client, because the client is not a XInterface
88 if ( !rEvent.Source.is() )
89 mpClient = NULL;
92 // ::com::sun::star::datatransfer::dnd::XDragGestureListener
93 void vcl::unohelper::DragAndDropWrapper::dragGestureRecognized( const ::com::sun::star::datatransfer::dnd::DragGestureEvent& rDGE ) throw (::com::sun::star::uno::RuntimeException, std::exception)
95 if ( mpClient )
96 mpClient->dragGestureRecognized( rDGE );
99 // ::com::sun::star::datatransfer::dnd::XDragSourceListener
100 void vcl::unohelper::DragAndDropWrapper::dragDropEnd( const ::com::sun::star::datatransfer::dnd::DragSourceDropEvent& rDSDE ) throw (::com::sun::star::uno::RuntimeException, std::exception)
102 if ( mpClient )
103 mpClient->dragDropEnd( rDSDE );
106 void vcl::unohelper::DragAndDropWrapper::dragEnter( const ::com::sun::star::datatransfer::dnd::DragSourceDragEvent& ) throw (::com::sun::star::uno::RuntimeException, std::exception)
110 void vcl::unohelper::DragAndDropWrapper::dragExit( const ::com::sun::star::datatransfer::dnd::DragSourceEvent& ) throw (::com::sun::star::uno::RuntimeException, std::exception)
114 void vcl::unohelper::DragAndDropWrapper::dragOver( const ::com::sun::star::datatransfer::dnd::DragSourceDragEvent& ) throw (::com::sun::star::uno::RuntimeException, std::exception)
118 void vcl::unohelper::DragAndDropWrapper::dropActionChanged( const ::com::sun::star::datatransfer::dnd::DragSourceDragEvent& ) throw (::com::sun::star::uno::RuntimeException, std::exception)
122 // ::com::sun::star::datatransfer::dnd::XDropTargetListener
123 void vcl::unohelper::DragAndDropWrapper::drop( const ::com::sun::star::datatransfer::dnd::DropTargetDropEvent& rDTDE ) throw (::com::sun::star::uno::RuntimeException, std::exception)
125 if ( mpClient )
126 mpClient->drop( rDTDE );
129 void vcl::unohelper::DragAndDropWrapper::dragEnter( const ::com::sun::star::datatransfer::dnd::DropTargetDragEnterEvent& rDTDEE ) throw (::com::sun::star::uno::RuntimeException, std::exception)
131 if ( mpClient )
132 mpClient->dragEnter( rDTDEE );
135 void vcl::unohelper::DragAndDropWrapper::dragExit( const ::com::sun::star::datatransfer::dnd::DropTargetEvent& dte ) throw (::com::sun::star::uno::RuntimeException, std::exception)
137 if ( mpClient )
138 mpClient->dragExit( dte );
141 void vcl::unohelper::DragAndDropWrapper::dragOver( const ::com::sun::star::datatransfer::dnd::DropTargetDragEvent& rDTDE ) throw (::com::sun::star::uno::RuntimeException, std::exception)
143 if ( mpClient )
144 mpClient->dragOver( rDTDE );
147 void vcl::unohelper::DragAndDropWrapper::dropActionChanged( const ::com::sun::star::datatransfer::dnd::DropTargetDragEvent& ) throw (::com::sun::star::uno::RuntimeException, std::exception)
151 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */