Branch libreoffice-5-0-4
[LibreOffice.git] / dtrans / source / win32 / dnd / idroptarget.cxx
blob0edc50ab4b04a6d6384f260f7bcf8a2877b4cae3
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 "idroptarget.hxx"
22 #ifdef __MINGW32__
23 #if defined __uuidof
24 #undef __uuidof
25 #endif
26 #define __uuidof(I) IID_##I
27 #endif
29 IDropTargetImpl::IDropTargetImpl( DropTarget& pTarget): m_nRefCount( 0),
30 m_rDropTarget( pTarget)
34 IDropTargetImpl::~IDropTargetImpl()
38 //IDropTarget
39 HRESULT STDMETHODCALLTYPE IDropTargetImpl::QueryInterface( REFIID riid, void **ppvObject)
41 if( !ppvObject)
42 return E_POINTER;
43 *ppvObject= NULL;
45 if( riid == __uuidof( IUnknown))
46 *ppvObject= static_cast<IUnknown*>( this);
47 else if ( riid == __uuidof( IDropTarget))
48 *ppvObject= static_cast<IDropTarget*>( this);
50 if(*ppvObject)
52 AddRef();
53 return S_OK;
55 else
56 return E_NOINTERFACE;
60 ULONG STDMETHODCALLTYPE IDropTargetImpl::AddRef()
62 return InterlockedIncrement( &m_nRefCount);
65 ULONG STDMETHODCALLTYPE IDropTargetImpl::Release()
67 LONG count= InterlockedDecrement( &m_nRefCount);
68 if( m_nRefCount == 0 )
69 delete this;
70 return count;
73 STDMETHODIMP IDropTargetImpl::DragEnter( IDataObject __RPC_FAR *pDataObj,
74 DWORD grfKeyState,
75 POINTL pt,
76 DWORD *pdwEffect)
78 return m_rDropTarget.DragEnter( pDataObj, grfKeyState,
79 pt, pdwEffect);
82 STDMETHODIMP IDropTargetImpl::DragOver( DWORD grfKeyState,
83 POINTL pt,
84 DWORD *pdwEffect)
86 return m_rDropTarget.DragOver( grfKeyState, pt, pdwEffect);
89 STDMETHODIMP IDropTargetImpl::DragLeave()
91 return m_rDropTarget.DragLeave();
94 STDMETHODIMP IDropTargetImpl::Drop( IDataObject *pDataObj,
95 DWORD grfKeyState,
96 POINTL pt,
97 DWORD __RPC_FAR *pdwEffect)
99 return m_rDropTarget.Drop( pDataObj, grfKeyState,
100 pt, pdwEffect);
103 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */