Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / dtrans / source / win32 / dtobj / APNDataObject.hxx
blob2c1d9718ec2f835c3f6840dfeab340e9f69e0ed7
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 #ifndef INCLUDED_DTRANS_SOURCE_WIN32_DTOBJ_APNDATAOBJECT_HXX
21 #define INCLUDED_DTRANS_SOURCE_WIN32_DTOBJ_APNDATAOBJECT_HXX
23 #include <systools/win32/comtools.hxx>
26 an APartment Neutral dataobject wrapper; this wrapper of an IDataObject
27 pointer can be used from any apartment without RPC_E_WRONG_THREAD
28 which normally occurs if an apartment tries to use an interface
29 pointer of another apartment; we use containment to hold the original
30 DataObject
32 class CAPNDataObject : public IDataObject
34 public:
35 explicit CAPNDataObject(IDataObjectPtr rIDataObject);
36 virtual ~CAPNDataObject();
38 //IUnknown interface methods
40 STDMETHODIMP QueryInterface(REFIID iid, void** ppvObject) override;
41 STDMETHODIMP_( ULONG ) AddRef( ) override;
42 STDMETHODIMP_( ULONG ) Release( ) override;
44 // IDataObject interface methods
46 STDMETHODIMP GetData( FORMATETC * pFormatetc, STGMEDIUM * pmedium ) override;
47 STDMETHODIMP GetDataHere( FORMATETC * pFormatetc, STGMEDIUM * pmedium ) override;
48 STDMETHODIMP QueryGetData( FORMATETC * pFormatetc ) override;
49 STDMETHODIMP GetCanonicalFormatEtc( FORMATETC * pFormatectIn, FORMATETC * pFormatetcOut ) override;
50 STDMETHODIMP SetData( FORMATETC * pFormatetc, STGMEDIUM * pmedium, BOOL fRelease ) override;
51 STDMETHODIMP EnumFormatEtc( DWORD dwDirection, IEnumFORMATETC** ppenumFormatetc ) override;
52 STDMETHODIMP DAdvise( FORMATETC * pFormatetc, DWORD advf, IAdviseSink * pAdvSink, DWORD* pdwConnection ) override;
53 STDMETHODIMP DUnadvise( DWORD dwConnection ) override;
54 STDMETHODIMP EnumDAdvise( IEnumSTATDATA** ppenumAdvise ) override;
56 operator IDataObject*( );
58 private:
59 HRESULT MarshalIDataObjectIntoCurrentApartment( IDataObject** ppIDataObj );
61 private:
62 IDataObjectPtr m_rIDataObjectOrg;
63 HGLOBAL m_hGlobal;
64 LONG m_nRefCnt;
66 // prevent copy and assignment
67 private:
68 CAPNDataObject( const CAPNDataObject& theOther );
69 CAPNDataObject& operator=( const CAPNDataObject& theOther );
72 #endif
74 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */