fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / dtrans / test / win32 / dnd / targetlistener.cxx
blob0a93d394560a9eaaef4347d75a84391a6e44b60d
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 "targetlistener.hxx"
21 #include <com/sun/star/datatransfer/dnd/DNDConstants.hpp>
22 #include <com/sun/star/datatransfer/DataFlavor.hpp>
24 using namespace com::sun::star::datatransfer::dnd::DNDConstants;
25 using namespace com::sun::star::datatransfer;
27 DropTargetListener::DropTargetListener(HWND hEdit):m_hEdit( hEdit)
30 DropTargetListener::~DropTargetListener()
34 void SAL_CALL DropTargetListener::disposing( const EventObject& Source )
35 throw(RuntimeException)
40 void SAL_CALL DropTargetListener::drop( const DropTargetDropEvent& e )
41 throw(RuntimeException)
43 e.Context->rejectDrop();
45 DataFlavor flavor( OUString(OUString("text/plain;charset=windows-1252")),
46 OUString(L"Text plain"), cppu::UnoType<Sequence<sal_Int8>>::get() );
48 Any anyData= e.Transferable->getTransferData( flavor);
49 Sequence<sal_Int8> seq= *( Sequence<sal_Int8>*)anyData.getValue();
50 SendMessage( m_hEdit, WM_SETTEXT, 0, (LPARAM) seq.getConstArray() );
53 void SAL_CALL DropTargetListener::dragEnter( const DropTargetDragEnterEvent& dtde )
54 throw(RuntimeException)
56 //If one drags something that is not moveable
57 if( !(dtde.SourceActions & dtde.DropAction) )
58 dtde.Context->acceptDrag( ACTION_COPY);
61 void SAL_CALL DropTargetListener::dragExit( const DropTargetEvent& dte )
62 throw(RuntimeException)
66 void SAL_CALL DropTargetListener::dragOver( const DropTargetDragEvent& dtde )
67 throw(RuntimeException)
69 if( !(dtde.SourceActions & dtde.DropAction) )
70 dtde.Context->acceptDrag( ACTION_COPY);
73 void SAL_CALL DropTargetListener::dropActionChanged( const DropTargetDragEvent& dtde )
74 throw(RuntimeException)
78 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */