1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 29 #ifndef _XNOTIFYINGDATAOBJECT_HXX_ 30 #define _XNOTIFYINGDATAOBJECT_HXX_ 31 32 33 //------------------------------------------------------------------------ 34 // includes 35 //------------------------------------------------------------------------ 36 37 #include <com/sun/star/datatransfer/XTransferable.hpp> 38 #include <com/sun/star/datatransfer/clipboard/XClipboardOwner.hpp> 39 40 #if defined _MSC_VER 41 #pragma warning(push,1) 42 #endif 43 #include <objidl.h> 44 #include <windows.h> 45 #if defined _MSC_VER 46 #pragma warning(pop) 47 #endif 48 49 #include <systools/win32/comtools.hxx> 50 51 /*-------------------------------------------------------------------------- 52 To implement the lostOwnership mechanism cleanly we need this wrapper 53 object 54 ----------------------------------------------------------------------------*/ 55 56 // forward 57 class CWinClipbImpl; 58 59 class CXNotifyingDataObject : public IDataObject 60 { 61 public: 62 CXNotifyingDataObject( 63 const IDataObjectPtr& aIDataObject, 64 const com::sun::star::uno::Reference< com::sun::star::datatransfer::XTransferable >& aXTransferable, 65 const com::sun::star::uno::Reference< com::sun::star::datatransfer::clipboard::XClipboardOwner >& aXClipOwner, 66 CWinClipbImpl* theWinClipImpl ); 67 68 virtual ~CXNotifyingDataObject() {} 69 70 //----------------------------------------------------------------- 71 // ole interface implementation 72 //----------------------------------------------------------------- 73 74 //IUnknown interface methods 75 STDMETHODIMP QueryInterface(REFIID iid, LPVOID* ppvObject); 76 STDMETHODIMP_( ULONG ) AddRef( ); 77 STDMETHODIMP_( ULONG ) Release( ); 78 79 // IDataObject interface methods 80 STDMETHODIMP GetData( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium ); 81 STDMETHODIMP GetDataHere( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium ); 82 STDMETHODIMP QueryGetData( LPFORMATETC pFormatetc ); 83 STDMETHODIMP GetCanonicalFormatEtc( LPFORMATETC pFormatectIn, LPFORMATETC pFormatetcOut ); 84 STDMETHODIMP SetData( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium, BOOL fRelease ); 85 STDMETHODIMP EnumFormatEtc( DWORD dwDirection, IEnumFORMATETC** ppenumFormatetc ); 86 STDMETHODIMP DAdvise( LPFORMATETC pFormatetc, DWORD advf, LPADVISESINK pAdvSink, DWORD* pdwConnection ); 87 STDMETHODIMP DUnadvise( DWORD dwConnection ); 88 STDMETHODIMP EnumDAdvise( LPENUMSTATDATA* ppenumAdvise ); 89 90 operator IDataObject*( ); 91 92 private: 93 void SAL_CALL lostOwnership( ); 94 95 private: 96 sal_Int32 m_nRefCnt; 97 IDataObjectPtr m_aIDataObject; 98 const com::sun::star::uno::Reference< com::sun::star::datatransfer::XTransferable > m_XTransferable; 99 const com::sun::star::uno::Reference< com::sun::star::datatransfer::clipboard::XClipboardOwner > m_XClipboardOwner; 100 CWinClipbImpl* m_pWinClipImpl; 101 102 friend class CWinClipbImpl; 103 }; 104 105 #endif 106