LibreOffice Module dtrans (master)  1
XNotifyingDataObject.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_DTOBJ_XNOTIFYINGDATAOBJECT_HXX
21 #define INCLUDED_DTRANS_SOURCE_WIN32_DTOBJ_XNOTIFYINGDATAOBJECT_HXX
22 
23 #include <com/sun/star/datatransfer/XTransferable.hpp>
24 #include <com/sun/star/datatransfer/clipboard/XClipboardOwner.hpp>
25 
26 #if !defined WIN32_LEAN_AND_MEAN
27 # define WIN32_LEAN_AND_MEAN
28 #endif
29 #include <windows.h>
30 #include <objidl.h>
31 
32 #include <systools/win32/comtools.hxx>
33 
34 /*--------------------------------------------------------------------------
35  To implement the lostOwnership mechanism cleanly we need this wrapper
36  object
37 ----------------------------------------------------------------------------*/
38 
39 // forward
40 class CWinClipbImpl;
41 
42 class CXNotifyingDataObject : public IDataObject
43 {
44 public:
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 );
50 
52 
53  // ole interface implementation
54 
55  //IUnknown interface methods
56  STDMETHODIMP QueryInterface(REFIID iid, void** ppvObject) override;
57  STDMETHODIMP_( ULONG ) AddRef( ) override;
58  STDMETHODIMP_( ULONG ) Release( ) override;
59 
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;
70 
71  operator IDataObject*( );
72 
73 private:
74  void lostOwnership( );
75 
76 private:
77  sal_Int32 m_nRefCnt;
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;
82 
83  friend class CWinClipbImpl;
84 };
85 
86 #endif
87 
88 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
STDMETHODIMP EnumDAdvise(IEnumSTATDATA **ppenumAdvise) override
const css::uno::Reference< css::datatransfer::XTransferable > m_XTransferable
STDMETHODIMP QueryGetData(FORMATETC *pFormatetc) override
const css::uno::Reference< css::datatransfer::clipboard::XClipboardOwner > m_XClipboardOwner
STDMETHODIMP QueryInterface(REFIID iid, void **ppvObject) override
const wchar_t *typedef BOOL
STDMETHODIMP DUnadvise(DWORD dwConnection) override
STDMETHODIMP DAdvise(FORMATETC *pFormatetc, DWORD advf, IAdviseSink *pAdvSink, DWORD *pdwConnection) override
STDMETHODIMP GetData(FORMATETC *pFormatetc, STGMEDIUM *pmedium) override
STDMETHODIMP GetDataHere(FORMATETC *pFormatetc, STGMEDIUM *pmedium) override
STDMETHODIMP SetData(FORMATETC *pFormatetc, STGMEDIUM *pmedium, BOOL fRelease) override
STDMETHODIMP GetCanonicalFormatEtc(FORMATETC *pFormatectIn, FORMATETC *pFormatetcOut) override
CXNotifyingDataObject(const IDataObjectPtr &aIDataObject, const css::uno::Reference< css::datatransfer::XTransferable > &aXTransferable, const css::uno::Reference< css::datatransfer::clipboard::XClipboardOwner > &aXClipOwner, CWinClipbImpl *theWinClipImpl)
STDMETHODIMP_(ULONG) AddRef() override
STDMETHODIMP EnumFormatEtc(DWORD dwDirection, IEnumFORMATETC **ppenumFormatetc) override