LibreOffice Module svtools (master) 1
openfiledroptargetlistener.hxx
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#pragma once
21
22#include <config_options.h>
23#include <svtools/svtdllapi.h>
24
25#include <com/sun/star/datatransfer/dnd/XDropTargetListener.hpp>
26
29
30#include <sot/exchange.hxx>
31
32namespace com :: sun :: star :: frame { class XFrame; }
33
34namespace com::sun::star::uno {
35 class XComponentContext;
36}
37
40class UNLESS_MERGELIBS(SVT_DLLPUBLIC) OpenFileDropTargetListener final : public cppu::WeakImplHelper< css::datatransfer::dnd::XDropTargetListener >
41{
42 private:
44 css::uno::Reference< css::uno::XComponentContext > m_xContext;
45
47 css::uno::WeakReference< css::frame::XFrame > m_xTargetFrame;
48
50 DataFlavorExVector m_aFormats;
51
52 public:
53 OpenFileDropTargetListener( css::uno::Reference< css::uno::XComponentContext > xContext,
54 const css::uno::Reference< css::frame::XFrame >& xFrame );
55 virtual ~OpenFileDropTargetListener() override;
56
57 public:
58 // XEventListener
59 virtual void SAL_CALL disposing ( const css::lang::EventObject& Source ) override;
60
61 // XDropTargetListener
62 virtual void SAL_CALL drop ( const css::datatransfer::dnd::DropTargetDropEvent& dtde ) override;
63 virtual void SAL_CALL dragEnter ( const css::datatransfer::dnd::DropTargetDragEnterEvent& dtdee ) override;
64 virtual void SAL_CALL dragExit ( const css::datatransfer::dnd::DropTargetEvent& dte ) override;
65 virtual void SAL_CALL dragOver ( const css::datatransfer::dnd::DropTargetDragEvent& dtde ) override;
66 virtual void SAL_CALL dropActionChanged( const css::datatransfer::dnd::DropTargetDragEvent& dtde ) override;
67
68 private:
69 void implts_BeginDrag( const css::uno::Sequence< css::datatransfer::DataFlavor >& rSupportedDataFlavors );
70 void implts_EndDrag();
71 bool implts_IsDropFormatSupported( SotClipboardFormatId nFormat );
72 void implts_OpenFile( const OUString& rFilePath );
73};
74
75/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Reference< XComponentContext > m_xContext
::std::vector< DataFlavorEx > DataFlavorExVector
SotClipboardFormatId