update dev300-m57
[ooovba.git] / sal / workben / clipboardwben / testcopy / XTDataObject.hxx
blobd70dc211bc6ef0e536c8a91b0244965ca616a2c5
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: XTDataObject.hxx,v $
10 * $Revision: 1.5 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
32 #ifndef _XTDATAOBJECT_HXX_
33 #define _XTDATAOBJECT_HXX_
36 //------------------------------------------------------------------------
37 // includes
38 //------------------------------------------------------------------------
41 #include <com/sun/star/datatransfer/XTransferable.hpp>
42 #include <com/sun/star/datatransfer/clipboard/XClipboardOwner.hpp>
43 #include "WinClipboard.hxx"
46 #include <windows.h>
47 #include <ole2.h>
48 #include <objidl.h>
51 //------------------------------------------------------------------------
52 //
53 //------------------------------------------------------------------------
55 class EnumFormatEtc;
57 class CXTDataObject : public IDataObject
59 public:
60 CXTDataObject( LONG nRefCntInitVal = 0);
61 ~CXTDataObject( );
63 //-----------------------------------------------------------------
64 // ole interface implementation
65 //-----------------------------------------------------------------
67 //IUnknown
68 STDMETHODIMP QueryInterface(REFIID iid, LPVOID* ppvObject);
69 STDMETHODIMP_( ULONG ) AddRef( );
70 STDMETHODIMP_( ULONG ) Release( );
72 //IDataObject
73 STDMETHODIMP GetData( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium );
74 STDMETHODIMP GetDataHere( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium );
75 STDMETHODIMP QueryGetData( LPFORMATETC pFormatetc );
76 STDMETHODIMP GetCanonicalFormatEtc( LPFORMATETC pFormatectIn, LPFORMATETC pFormatetcOut );
77 STDMETHODIMP SetData( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium, BOOL fRelease );
78 STDMETHODIMP EnumFormatEtc( DWORD dwDirection, IEnumFORMATETC** ppenumFormatetc );
79 STDMETHODIMP DAdvise( LPFORMATETC pFormatetc, DWORD advf, LPADVISESINK pAdvSink, DWORD* pdwConnection );
80 STDMETHODIMP DUnadvise( DWORD dwConnection );
81 STDMETHODIMP EnumDAdvise( LPENUMSTATDATA* ppenumAdvise );
83 operator IDataObject*( );
85 // notification handler
86 //void SAL_CALL LostOwnership( );
88 //sal_Int64 SAL_CALL QueryDataSize( );
90 // retrieve the data from the source
91 // necessary so that
92 //void SAL_CALL GetAllDataFromSource( );
94 private:
95 LONG m_nRefCnt;
96 //CWinClipboard& m_rCWinClipboard;
97 //const const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardOwner >& m_rXClipboardOwner;
98 //const const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& m_rXTDataSource;
100 //friend class CWinClipboard;
101 friend class CEnumFormatEtc;
104 //------------------------------------------------------------------------
106 //------------------------------------------------------------------------
108 class CEnumFormatEtc : public IEnumFORMATETC
110 public:
111 CEnumFormatEtc( LPUNKNOWN pUnkDataObj );
112 ~CEnumFormatEtc( );
114 // IUnknown
115 STDMETHODIMP QueryInterface( REFIID iid, LPVOID* ppvObject );
116 STDMETHODIMP_( ULONG ) AddRef( );
117 STDMETHODIMP_( ULONG ) Release( );
119 //IEnumFORMATETC
120 STDMETHODIMP Next( ULONG celt, LPFORMATETC rgelt, ULONG* pceltFetched );
121 STDMETHODIMP Skip( ULONG celt );
122 STDMETHODIMP Reset( );
123 STDMETHODIMP Clone( IEnumFORMATETC** ppenum );
125 private:
126 LONG m_nRefCnt;
127 LPUNKNOWN m_pUnkDataObj;
128 ULONG m_nCurrentPos;
129 CLIPFORMAT m_cfFormats[2];
133 typedef CEnumFormatEtc *PCEnumFormatEtc;
135 #endif