LibreOffice Module dtrans (master)  1
clipb/APNDataObject.hxx
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 #ifndef INCLUDED_DTRANS_SOURCE_WIN32_CLIPB_APNDATAOBJECT_HXX
21 #define INCLUDED_DTRANS_SOURCE_WIN32_CLIPB_APNDATAOBJECT_HXX
22 
23 /*
24  an APartment Neutral dataobject wrapper; this wrapper of an IDataObject
25  pointer can be used from any apartment without RPC_E_WRONG_THREAD
26  which normally occurs if an apartment tries to use an interface
27  pointer of another apartment; we use containment to hold the original
28  DataObject
29 */
30 class CAPNDataObject : public IDataObject
31 {
32 public:
33  CAPNDataObject( IDataObjectPtr rIDataObject );
34  ~CAPNDataObject( );
35 
36  //IUnknown interface methods
37 
38  STDMETHODIMP QueryInterface(REFIID iid, LPVOID* ppvObject);
39  STDMETHODIMP_( ULONG ) AddRef( );
40  STDMETHODIMP_( ULONG ) Release( );
41 
42  // IDataObject interface methods
43 
44  STDMETHODIMP GetData( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium );
45  STDMETHODIMP GetDataHere( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium );
46  STDMETHODIMP QueryGetData( LPFORMATETC pFormatetc );
47  STDMETHODIMP GetCanonicalFormatEtc( LPFORMATETC pFormatectIn, LPFORMATETC pFormatetcOut );
48  STDMETHODIMP SetData( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium, BOOL fRelease );
49  STDMETHODIMP EnumFormatEtc( DWORD dwDirection, IEnumFORMATETC** ppenumFormatetc );
50  STDMETHODIMP DAdvise( LPFORMATETC pFormatetc, DWORD advf, LPADVISESINK pAdvSink, DWORD* pdwConnection );
51  STDMETHODIMP DUnadvise( DWORD dwConnection );
52  STDMETHODIMP EnumDAdvise( LPENUMSTATDATA* ppenumAdvise );
53 
54  operator IDataObject*( );
55 
56 private:
57  HRESULT MarshalIDataObjectIntoCurrentApartment( IDataObject** ppIDataObj );
58 
59 private:
60  IDataObjectPtr m_rIDataObjectOrg;
61  HGLOBAL m_hGlobal;
63 
64 // prevent copy and assignment
65 private:
66  CAPNDataObject( const CAPNDataObject& theOther );
67  CAPNDataObject& operator=( const CAPNDataObject& theOther );
68 };
69 
70 #endif
71 
72 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
STDMETHODIMP SetData(LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium, BOOL fRelease)
CAPNDataObject(IDataObjectPtr rIDataObject)
CAPNDataObject & operator=(const CAPNDataObject &theOther)
STDMETHODIMP GetData(LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium)
LONG
STDMETHODIMP QueryInterface(REFIID iid, LPVOID *ppvObject)
STDMETHODIMP DAdvise(LPFORMATETC pFormatetc, DWORD advf, LPADVISESINK pAdvSink, DWORD *pdwConnection)
const wchar_t *typedef BOOL
IDataObjectPtr m_rIDataObjectOrg
STDMETHODIMP DUnadvise(DWORD dwConnection)
STDMETHODIMP GetCanonicalFormatEtc(LPFORMATETC pFormatectIn, LPFORMATETC pFormatetcOut)
STDMETHODIMP EnumFormatEtc(DWORD dwDirection, IEnumFORMATETC **ppenumFormatetc)
STDMETHODIMP EnumDAdvise(LPENUMSTATDATA *ppenumAdvise)
STDMETHODIMP QueryGetData(LPFORMATETC pFormatetc)
STDMETHODIMP_(ULONG) AddRef()
STDMETHODIMP GetDataHere(LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium)
HRESULT MarshalIDataObjectIntoCurrentApartment(IDataObject **ppIDataObj)