LibreOffice Module dtrans (master)  1
idroptarget.cxx
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 #include "idroptarget.hxx"
21 
22 IDropTargetImpl::IDropTargetImpl( DropTarget& pTarget): m_nRefCount( 0),
23  m_rDropTarget( pTarget)
24 {
25 }
26 
28 {
29 }
30 
31 //IDropTarget
32 HRESULT STDMETHODCALLTYPE IDropTargetImpl::QueryInterface( REFIID riid, void **ppvObject)
33 {
34  if( !ppvObject)
35  return E_POINTER;
36  *ppvObject= nullptr;
37 
38  if( riid == __uuidof( IUnknown))
39  *ppvObject= static_cast<IUnknown*>( this);
40  else if ( riid == __uuidof( IDropTarget))
41  *ppvObject= static_cast<IDropTarget*>( this);
42 
43  if(*ppvObject)
44  {
45  AddRef();
46  return S_OK;
47  }
48  else
49  return E_NOINTERFACE;
50 
51 }
52 
53 ULONG STDMETHODCALLTYPE IDropTargetImpl::AddRef()
54 {
55  return InterlockedIncrement( &m_nRefCount);
56 }
57 
58 ULONG STDMETHODCALLTYPE IDropTargetImpl::Release()
59 {
60  LONG count= InterlockedDecrement( &m_nRefCount);
61  if( m_nRefCount == 0 )
62  delete this;
63  return count;
64 }
65 
66 STDMETHODIMP IDropTargetImpl::DragEnter( IDataObject __RPC_FAR *pDataObj,
67  DWORD grfKeyState,
68  POINTL pt,
69  DWORD *pdwEffect)
70 {
71  return m_rDropTarget.DragEnter( pDataObj, grfKeyState,
72  pt, pdwEffect);
73 }
74 
75 STDMETHODIMP IDropTargetImpl::DragOver( DWORD grfKeyState,
76  POINTL pt,
77  DWORD *pdwEffect)
78 {
79  return m_rDropTarget.DragOver( grfKeyState, pt, pdwEffect);
80 }
81 
83 {
84  return m_rDropTarget.DragLeave();
85 }
86 
87 STDMETHODIMP IDropTargetImpl::Drop( IDataObject *pDataObj,
88  DWORD grfKeyState,
89  POINTL pt,
90  DWORD __RPC_FAR *pdwEffect)
91 {
92  return m_rDropTarget.Drop( pDataObj, grfKeyState,
93  pt, pdwEffect);
94 }
95 
96 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const size_t count(pCandidateA->getBorderLines().size())
IDropTargetImpl(const IDropTargetImpl &)
virtual HRESULT STDMETHODCALLTYPE Drop(IDataObject __RPC_FAR *pDataObj, DWORD grfKeyState, POINTL pt, DWORD __RPC_FAR *pdwEffect) override
Definition: idroptarget.cxx:87
LONG
virtual ULONG STDMETHODCALLTYPE Release() override
Definition: idroptarget.cxx:58
virtual ULONG STDMETHODCALLTYPE AddRef() override
Definition: idroptarget.cxx:53
virtual HRESULT DragEnter(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
Definition: target.cxx:297
DropTarget & m_rDropTarget
Definition: idroptarget.hxx:28
virtual ~IDropTargetImpl()
Definition: idroptarget.cxx:27
virtual HRESULT STDMETHODCALLTYPE Drop(IDataObject *pDataObj, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
Definition: target.cxx:438
virtual HRESULT STDMETHODCALLTYPE DragLeave()
Definition: target.cxx:414
virtual HRESULT STDMETHODCALLTYPE DragOver(DWORD grfKeyState, POINTL pt, DWORD __RPC_FAR *pdwEffect) override
Definition: idroptarget.cxx:75
virtual HRESULT STDMETHODCALLTYPE DragEnter(IDataObject __RPC_FAR *pDataObj, DWORD grfKeyState, POINTL pt, DWORD __RPC_FAR *pdwEffect) override
Definition: idroptarget.cxx:66
virtual HRESULT STDMETHODCALLTYPE DragLeave() override
Definition: idroptarget.cxx:82
virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void __RPC_FAR *__RPC_FAR *ppvObject) override
Definition: idroptarget.cxx:32
virtual HRESULT STDMETHODCALLTYPE DragOver(DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
Definition: target.cxx:362