1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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_XNOTIFYINGDATAOBJECT_HXX
21 #define INCLUDED_DTRANS_SOURCE_WIN32_DTOBJ_XNOTIFYINGDATAOBJECT_HXX
23 #include <com/sun/star/datatransfer/XTransferable.hpp>
24 #include <com/sun/star/datatransfer/clipboard/XClipboardOwner.hpp>
26 #if !defined WIN32_LEAN_AND_MEAN
27 # define WIN32_LEAN_AND_MEAN
32 #include <systools/win32/comtools.hxx>
34 /*--------------------------------------------------------------------------
35 To implement the lostOwnership mechanism cleanly we need this wrapper
37 ----------------------------------------------------------------------------*/
42 class CXNotifyingDataObject
: public IDataObject
45 CXNotifyingDataObject(
46 const IDataObjectPtr
& aIDataObject
,
47 const css::uno::Reference
< css::datatransfer::XTransferable
>& aXTransferable
,
48 const css::uno::Reference
< css::datatransfer::clipboard::XClipboardOwner
>& aXClipOwner
,
49 CWinClipbImpl
* theWinClipImpl
);
51 virtual ~CXNotifyingDataObject() {}
53 // ole interface implementation
55 //IUnknown interface methods
56 STDMETHODIMP
QueryInterface(REFIID iid
, void** ppvObject
) override
;
57 STDMETHODIMP_( ULONG
) AddRef( ) override
;
58 STDMETHODIMP_( ULONG
) Release( ) override
;
60 // IDataObject interface methods
61 STDMETHODIMP
GetData( FORMATETC
* pFormatetc
, STGMEDIUM
* pmedium
) override
;
62 STDMETHODIMP
GetDataHere( FORMATETC
* pFormatetc
, STGMEDIUM
* pmedium
) override
;
63 STDMETHODIMP
QueryGetData( FORMATETC
* pFormatetc
) override
;
64 STDMETHODIMP
GetCanonicalFormatEtc( FORMATETC
* pFormatectIn
, FORMATETC
* pFormatetcOut
) override
;
65 STDMETHODIMP
SetData( FORMATETC
* pFormatetc
, STGMEDIUM
* pmedium
, BOOL fRelease
) override
;
66 STDMETHODIMP
EnumFormatEtc( DWORD dwDirection
, IEnumFORMATETC
** ppenumFormatetc
) override
;
67 STDMETHODIMP
DAdvise( FORMATETC
* pFormatetc
, DWORD advf
, IAdviseSink
* pAdvSink
, DWORD
* pdwConnection
) override
;
68 STDMETHODIMP
DUnadvise( DWORD dwConnection
) override
;
69 STDMETHODIMP
EnumDAdvise( IEnumSTATDATA
** ppenumAdvise
) override
;
71 operator IDataObject
*( );
74 void lostOwnership( );
78 IDataObjectPtr m_aIDataObject
;
79 const css::uno::Reference
< css::datatransfer::XTransferable
> m_XTransferable
;
80 const css::uno::Reference
< css::datatransfer::clipboard::XClipboardOwner
> m_XClipboardOwner
;
81 CWinClipbImpl
* m_pWinClipImpl
;
83 friend class CWinClipbImpl
;
88 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */