1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_dtrans.hxx" 30 #include "idroptarget.hxx" 31 #include <rtl/unload.h> 32 33 #ifdef __MINGW32__ 34 #define __uuidof(I) IID_##I 35 #endif 36 37 extern rtl_StandardModuleCount g_moduleCount; 38 39 IDropTargetImpl::IDropTargetImpl( DropTarget& pTarget): m_nRefCount( 0), 40 m_rDropTarget( pTarget) 41 { 42 g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt ); 43 } 44 45 IDropTargetImpl::~IDropTargetImpl() 46 { 47 g_moduleCount.modCnt.release( &g_moduleCount.modCnt ); 48 } 49 50 51 //IDropTarget 52 HRESULT STDMETHODCALLTYPE IDropTargetImpl::QueryInterface( REFIID riid, void **ppvObject) 53 { 54 if( !ppvObject) 55 return E_POINTER; 56 *ppvObject= NULL; 57 58 if( riid == __uuidof( IUnknown)) 59 *ppvObject= static_cast<IUnknown*>( this); 60 else if ( riid == __uuidof( IDropTarget)) 61 *ppvObject= static_cast<IDropTarget*>( this); 62 63 if(*ppvObject) 64 { 65 AddRef(); 66 return S_OK; 67 } 68 else 69 return E_NOINTERFACE; 70 71 } 72 73 ULONG STDMETHODCALLTYPE IDropTargetImpl::AddRef( void) 74 { 75 return InterlockedIncrement( &m_nRefCount); 76 } 77 78 ULONG STDMETHODCALLTYPE IDropTargetImpl::Release( void) 79 { 80 LONG count= InterlockedDecrement( &m_nRefCount); 81 if( m_nRefCount == 0 ) 82 delete this; 83 return count; 84 } 85 86 STDMETHODIMP IDropTargetImpl::DragEnter( IDataObject __RPC_FAR *pDataObj, 87 DWORD grfKeyState, 88 POINTL pt, 89 DWORD *pdwEffect) 90 { 91 return m_rDropTarget.DragEnter( pDataObj, grfKeyState, 92 pt, pdwEffect); 93 } 94 95 STDMETHODIMP IDropTargetImpl::DragOver( DWORD grfKeyState, 96 POINTL pt, 97 DWORD *pdwEffect) 98 { 99 return m_rDropTarget.DragOver( grfKeyState, pt, pdwEffect); 100 } 101 102 STDMETHODIMP IDropTargetImpl::DragLeave( void) 103 { 104 return m_rDropTarget.DragLeave(); 105 } 106 107 STDMETHODIMP IDropTargetImpl::Drop( IDataObject *pDataObj, 108 DWORD grfKeyState, 109 POINTL pt, 110 DWORD __RPC_FAR *pdwEffect) 111 { 112 return m_rDropTarget.Drop( pDataObj, grfKeyState, 113 pt, pdwEffect); 114 } 115