1*48123e16SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3*48123e16SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4*48123e16SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5*48123e16SAndrew Rist  * distributed with this work for additional information
6*48123e16SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7*48123e16SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8*48123e16SAndrew Rist  * "License"); you may not use this file except in compliance
9*48123e16SAndrew Rist  * with the License.  You may obtain a copy of the License at
10*48123e16SAndrew Rist  *
11*48123e16SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12*48123e16SAndrew Rist  *
13*48123e16SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14*48123e16SAndrew Rist  * software distributed under the License is distributed on an
15*48123e16SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*48123e16SAndrew Rist  * KIND, either express or implied.  See the License for the
17*48123e16SAndrew Rist  * specific language governing permissions and limitations
18*48123e16SAndrew Rist  * under the License.
19*48123e16SAndrew Rist  *
20*48123e16SAndrew Rist  *************************************************************/
21*48123e16SAndrew Rist 
22*48123e16SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove
25cdf0e10cSrcweir #include "precompiled_dtrans.hxx"
26cdf0e10cSrcweir #include "idroptarget.hxx"
27cdf0e10cSrcweir #include <rtl/unload.h>
28cdf0e10cSrcweir 
29cdf0e10cSrcweir #ifdef __MINGW32__
30cdf0e10cSrcweir #define __uuidof(I) IID_##I
31cdf0e10cSrcweir #endif
32cdf0e10cSrcweir 
33cdf0e10cSrcweir extern rtl_StandardModuleCount g_moduleCount;
34cdf0e10cSrcweir 
IDropTargetImpl(DropTarget & pTarget)35cdf0e10cSrcweir IDropTargetImpl::IDropTargetImpl( DropTarget& pTarget): m_nRefCount( 0),
36cdf0e10cSrcweir                                     m_rDropTarget( pTarget)
37cdf0e10cSrcweir {
38cdf0e10cSrcweir 	g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt );
39cdf0e10cSrcweir }
40cdf0e10cSrcweir 
~IDropTargetImpl()41cdf0e10cSrcweir IDropTargetImpl::~IDropTargetImpl()
42cdf0e10cSrcweir {
43cdf0e10cSrcweir 	g_moduleCount.modCnt.release( &g_moduleCount.modCnt );
44cdf0e10cSrcweir }
45cdf0e10cSrcweir 
46cdf0e10cSrcweir 
47cdf0e10cSrcweir //IDropTarget
QueryInterface(REFIID riid,void ** ppvObject)48cdf0e10cSrcweir HRESULT STDMETHODCALLTYPE IDropTargetImpl::QueryInterface( REFIID riid, void  **ppvObject)
49cdf0e10cSrcweir {
50cdf0e10cSrcweir 	if( !ppvObject)
51cdf0e10cSrcweir 		return E_POINTER;
52cdf0e10cSrcweir 	*ppvObject= NULL;
53cdf0e10cSrcweir 
54cdf0e10cSrcweir 	if( riid == __uuidof( IUnknown))
55cdf0e10cSrcweir 		*ppvObject= static_cast<IUnknown*>( this);
56cdf0e10cSrcweir 	else if (  riid == __uuidof( IDropTarget))
57cdf0e10cSrcweir 		*ppvObject= static_cast<IDropTarget*>( this);
58cdf0e10cSrcweir 
59cdf0e10cSrcweir 	if(*ppvObject)
60cdf0e10cSrcweir 	{
61cdf0e10cSrcweir 		AddRef();
62cdf0e10cSrcweir 		return S_OK;
63cdf0e10cSrcweir 	}
64cdf0e10cSrcweir 	else
65cdf0e10cSrcweir 		return E_NOINTERFACE;
66cdf0e10cSrcweir 
67cdf0e10cSrcweir }
68cdf0e10cSrcweir 
AddRef(void)69cdf0e10cSrcweir ULONG STDMETHODCALLTYPE IDropTargetImpl::AddRef( void)
70cdf0e10cSrcweir {
71cdf0e10cSrcweir     return InterlockedIncrement( &m_nRefCount);
72cdf0e10cSrcweir }
73cdf0e10cSrcweir 
Release(void)74cdf0e10cSrcweir ULONG STDMETHODCALLTYPE IDropTargetImpl::Release( void)
75cdf0e10cSrcweir {
76cdf0e10cSrcweir     LONG count= InterlockedDecrement( &m_nRefCount);
77cdf0e10cSrcweir     if( m_nRefCount == 0 )
78cdf0e10cSrcweir         delete this;
79cdf0e10cSrcweir 	return count;
80cdf0e10cSrcweir }
81cdf0e10cSrcweir 
DragEnter(IDataObject __RPC_FAR * pDataObj,DWORD grfKeyState,POINTL pt,DWORD * pdwEffect)82cdf0e10cSrcweir STDMETHODIMP IDropTargetImpl::DragEnter( IDataObject __RPC_FAR *pDataObj,
83cdf0e10cSrcweir 									DWORD grfKeyState,
84cdf0e10cSrcweir 									POINTL pt,
85cdf0e10cSrcweir 									DWORD  *pdwEffect)
86cdf0e10cSrcweir {
87cdf0e10cSrcweir     return m_rDropTarget.DragEnter( pDataObj, grfKeyState,
88cdf0e10cSrcweir                                   pt, pdwEffect);
89cdf0e10cSrcweir }
90cdf0e10cSrcweir 
DragOver(DWORD grfKeyState,POINTL pt,DWORD * pdwEffect)91cdf0e10cSrcweir STDMETHODIMP IDropTargetImpl::DragOver( DWORD grfKeyState,
92cdf0e10cSrcweir 								   POINTL pt,
93cdf0e10cSrcweir 								   DWORD  *pdwEffect)
94cdf0e10cSrcweir {
95cdf0e10cSrcweir     return m_rDropTarget.DragOver( grfKeyState, pt, pdwEffect);
96cdf0e10cSrcweir }
97cdf0e10cSrcweir 
DragLeave(void)98cdf0e10cSrcweir STDMETHODIMP IDropTargetImpl::DragLeave( void)
99cdf0e10cSrcweir {
100cdf0e10cSrcweir     return m_rDropTarget.DragLeave();
101cdf0e10cSrcweir }
102cdf0e10cSrcweir 
Drop(IDataObject * pDataObj,DWORD grfKeyState,POINTL pt,DWORD __RPC_FAR * pdwEffect)103cdf0e10cSrcweir STDMETHODIMP IDropTargetImpl::Drop( IDataObject  *pDataObj,
104cdf0e10cSrcweir 				   DWORD grfKeyState,
105cdf0e10cSrcweir 				   POINTL pt,
106cdf0e10cSrcweir 				   DWORD __RPC_FAR *pdwEffect)
107cdf0e10cSrcweir {
108cdf0e10cSrcweir     return m_rDropTarget.Drop( pDataObj, grfKeyState,
109cdf0e10cSrcweir                                    pt, pdwEffect);
110cdf0e10cSrcweir }
111