tdf#162786, tdf#161947: Add support for setuptools and pip
[LibreOffice.git] / vcl / win / dtrans / APNDataObject.hxx
blob5de8ccfcc8d182ef42c02ca47010a1b2d3c5d28c
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 #pragma once
22 #if !defined WIN32_LEAN_AND_MEAN
23 # define WIN32_LEAN_AND_MEAN
24 #endif
25 #include <objidl.h>
27 #include <systools/win32/comtools.hxx>
30 an APartment Neutral dataobject wrapper; this wrapper of an IDataObject
31 pointer can be used from any apartment without RPC_E_WRONG_THREAD
32 which normally occurs if an apartment tries to use an interface
33 pointer of another apartment; we use containment to hold the original
34 DataObject
36 class CAPNDataObject : public IDataObject
38 public:
39 explicit CAPNDataObject(IDataObjectPtr rIDataObject);
40 virtual ~CAPNDataObject();
42 //IUnknown interface methods
44 STDMETHODIMP QueryInterface(REFIID iid, void** ppvObject) override;
45 STDMETHODIMP_( ULONG ) AddRef( ) override;
46 STDMETHODIMP_( ULONG ) Release( ) override;
48 // IDataObject interface methods
50 STDMETHODIMP GetData( FORMATETC * pFormatetc, STGMEDIUM * pmedium ) override;
51 STDMETHODIMP GetDataHere( FORMATETC * pFormatetc, STGMEDIUM * pmedium ) override;
52 STDMETHODIMP QueryGetData( FORMATETC * pFormatetc ) override;
53 STDMETHODIMP GetCanonicalFormatEtc( FORMATETC * pFormatectIn, FORMATETC * pFormatetcOut ) override;
54 STDMETHODIMP SetData( FORMATETC * pFormatetc, STGMEDIUM * pmedium, BOOL fRelease ) override;
55 STDMETHODIMP EnumFormatEtc( DWORD dwDirection, IEnumFORMATETC** ppenumFormatetc ) override;
56 STDMETHODIMP DAdvise( FORMATETC * pFormatetc, DWORD advf, IAdviseSink * pAdvSink, DWORD* pdwConnection ) override;
57 STDMETHODIMP DUnadvise( DWORD dwConnection ) override;
58 STDMETHODIMP EnumDAdvise( IEnumSTATDATA** ppenumAdvise ) override;
60 private:
61 HRESULT MarshalIDataObjectIntoCurrentApartment( IDataObject** ppIDataObj );
63 private:
64 IDataObjectPtr m_rIDataObjectOrg;
65 HGLOBAL m_hGlobal;
66 LONG m_nRefCnt;
68 // prevent copy and assignment
69 private:
70 CAPNDataObject( const CAPNDataObject& theOther ) = delete;
71 CAPNDataObject& operator=( const CAPNDataObject& theOther ) = delete;
74 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */