Coverage Report

Created: 2025-12-31 10:39

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libreoffice/vcl/source/app/dndhelp.cxx
Line
Count
Source
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 <vcl/svapp.hxx>
23
#include <dndhelper.hxx>
24
25
#include <cppuhelper/queryinterface.hxx>
26
27
#include <com/sun/star/lang/XInitialization.hpp>
28
29
using namespace ::com::sun::star;
30
31
0
vcl::unohelper::DragAndDropClient::~DragAndDropClient() {}
32
33
void vcl::unohelper::DragAndDropClient::dragGestureRecognized( const css::datatransfer::dnd::DragGestureEvent& /*dge*/ )
34
0
{
35
0
}
36
37
void vcl::unohelper::DragAndDropClient::dragDropEnd( const css::datatransfer::dnd::DragSourceDropEvent& /*dsde*/ )
38
0
{
39
0
}
40
41
void vcl::unohelper::DragAndDropClient::drop( const css::datatransfer::dnd::DropTargetDropEvent& /*dtde*/ )
42
0
{
43
0
}
44
45
void vcl::unohelper::DragAndDropClient::dragEnter( const css::datatransfer::dnd::DropTargetDragEnterEvent& /*dtdee*/ )
46
0
{
47
0
}
48
49
void vcl::unohelper::DragAndDropClient::dragExit( const css::datatransfer::dnd::DropTargetEvent& /*dte*/ )
50
0
{
51
0
}
52
53
void vcl::unohelper::DragAndDropClient::dragOver( const css::datatransfer::dnd::DropTargetDragEvent& /*dtde*/ )
54
0
{
55
0
}
56
57
vcl::unohelper::DragAndDropWrapper::DragAndDropWrapper( DragAndDropClient* pClient )
58
0
{
59
0
    mpClient = pClient;
60
0
}
61
62
vcl::unohelper::DragAndDropWrapper::~DragAndDropWrapper()
63
0
{
64
0
}
65
66
// uno::XInterface
67
uno::Any vcl::unohelper::DragAndDropWrapper::queryInterface( const uno::Type & rType )
68
0
{
69
0
    uno::Any aRet = ::cppu::queryInterface( rType,
70
0
                            static_cast< css::lang::XEventListener* >( static_cast<css::datatransfer::dnd::XDragGestureListener*>(this) ),
71
0
                            static_cast< css::datatransfer::dnd::XDragGestureListener* >(this),
72
0
                            static_cast< css::datatransfer::dnd::XDragSourceListener* >(this),
73
0
                            static_cast< css::datatransfer::dnd::XDropTargetListener* >(this) );
74
0
    return (aRet.hasValue() ? aRet : OWeakObject::queryInterface( rType ));
75
0
}
76
77
// css::lang::XEventListener
78
void vcl::unohelper::DragAndDropWrapper::disposing( const css::lang::EventObject& rEvent )
79
0
{
80
    // Empty Source means it's the client, because the client is not a XInterface
81
0
    if ( !rEvent.Source.is() )
82
0
        mpClient = nullptr;
83
0
}
84
85
// css::datatransfer::dnd::XDragGestureListener
86
void vcl::unohelper::DragAndDropWrapper::dragGestureRecognized( const css::datatransfer::dnd::DragGestureEvent& rDGE )
87
0
{
88
0
    if ( mpClient )
89
0
        mpClient->dragGestureRecognized( rDGE );
90
0
}
91
92
// css::datatransfer::dnd::XDragSourceListener
93
void vcl::unohelper::DragAndDropWrapper::dragDropEnd( const css::datatransfer::dnd::DragSourceDropEvent& rDSDE )
94
0
{
95
0
    if ( mpClient )
96
0
        mpClient->dragDropEnd( rDSDE );
97
0
}
98
99
void vcl::unohelper::DragAndDropWrapper::dragEnter( const css::datatransfer::dnd::DragSourceDragEvent& )
100
0
{
101
0
}
102
103
void vcl::unohelper::DragAndDropWrapper::dragExit( const css::datatransfer::dnd::DragSourceEvent& )
104
0
{
105
0
}
106
107
void vcl::unohelper::DragAndDropWrapper::dragOver( const css::datatransfer::dnd::DragSourceDragEvent& )
108
0
{
109
0
}
110
111
void vcl::unohelper::DragAndDropWrapper::dropActionChanged( const css::datatransfer::dnd::DragSourceDragEvent& )
112
0
{
113
0
}
114
115
// css::datatransfer::dnd::XDropTargetListener
116
void vcl::unohelper::DragAndDropWrapper::drop( const css::datatransfer::dnd::DropTargetDropEvent& rDTDE )
117
0
{
118
0
    if ( mpClient )
119
0
        mpClient->drop( rDTDE );
120
0
}
121
122
void vcl::unohelper::DragAndDropWrapper::dragEnter( const css::datatransfer::dnd::DropTargetDragEnterEvent& rDTDEE )
123
0
{
124
0
    if ( mpClient )
125
0
        mpClient->dragEnter( rDTDEE );
126
0
}
127
128
void vcl::unohelper::DragAndDropWrapper::dragExit( const css::datatransfer::dnd::DropTargetEvent& dte )
129
0
{
130
0
    if ( mpClient )
131
0
        mpClient->dragExit( dte );
132
0
}
133
134
void vcl::unohelper::DragAndDropWrapper::dragOver( const css::datatransfer::dnd::DropTargetDragEvent& rDTDE )
135
0
{
136
0
    if ( mpClient )
137
0
        mpClient->dragOver( rDTDE );
138
0
}
139
140
void vcl::unohelper::DragAndDropWrapper::dropActionChanged( const css::datatransfer::dnd::DropTargetDragEvent& )
141
0
{
142
0
}
143
144
void
145
vcl::OleDnDHelper(const css::uno::Reference<css::lang::XInitialization>& xDnD, const sal_IntPtr pWin, DragOrDrop eDoD)
146
0
{
147
0
    if (pWin && xDnD)
148
0
    {
149
0
        if (eDoD == vcl::DragOrDrop::Drag)
150
0
            xDnD->initialize({ uno::Any(), uno::Any(static_cast<sal_uInt64>(pWin)) });
151
0
        else
152
0
            xDnD->initialize({ uno::Any(static_cast<sal_uInt64>(pWin)), uno::Any() });
153
0
    }
154
0
}
155
156
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */