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 _XTDATAOBJECT_HXX_
30 #define _XTDATAOBJECT_HXX_
31 
32 
33 //------------------------------------------------------------------------
34 // includes
35 //------------------------------------------------------------------------
36 
37 /*
38 #include <com/sun/star/datatransfer/XTransferable.hpp>
39 #include <com/sun/star/datatransfer/clipboard/XClipboardOwner.hpp>
40 #include "WinClipboard.hxx"
41 */
42 
43 #include <windows.h>
44 #include <ole2.h>
45 #include <objidl.h>
46 
47 
48 //------------------------------------------------------------------------
49 //
50 //------------------------------------------------------------------------
51 
52 class EnumFormatEtc;
53 
54 class CXTDataObject : public IDataObject
55 {
56 public:
57 	CXTDataObject( LONG nRefCntInitVal = 0);
58     ~CXTDataObject( );
59 
60 	//-----------------------------------------------------------------
61 	// ole interface implementation
62 	//-----------------------------------------------------------------
63 
64     //IUnknown
65     STDMETHODIMP           QueryInterface(REFIID iid, LPVOID* ppvObject);
66     STDMETHODIMP_( ULONG ) AddRef( );
67     STDMETHODIMP_( ULONG ) Release( );
68 
69     //IDataObject
70     STDMETHODIMP GetData( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium );
71     STDMETHODIMP GetDataHere( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium );
72     STDMETHODIMP QueryGetData( LPFORMATETC pFormatetc );
73     STDMETHODIMP GetCanonicalFormatEtc( LPFORMATETC pFormatectIn, LPFORMATETC pFormatetcOut );
74     STDMETHODIMP SetData( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium, BOOL fRelease );
75     STDMETHODIMP EnumFormatEtc( DWORD dwDirection, IEnumFORMATETC** ppenumFormatetc );
76     STDMETHODIMP DAdvise( LPFORMATETC pFormatetc, DWORD advf, LPADVISESINK pAdvSink, DWORD* pdwConnection );
77     STDMETHODIMP DUnadvise( DWORD dwConnection );
78     STDMETHODIMP EnumDAdvise( LPENUMSTATDATA* ppenumAdvise );
79 
80 	operator IDataObject*( );
81 
82 	// notification handler
83 	//void SAL_CALL LostOwnership( );
84 
85 	//sal_Int64 SAL_CALL QueryDataSize( );
86 
87 	// retrieve the data from the source
88 	// necessary so that
89 	//void SAL_CALL GetAllDataFromSource( );
90 
91 private:
92 	LONG m_nRefCnt;
93 	//CWinClipboard& m_rCWinClipboard;
94 	//const const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardOwner >&  m_rXClipboardOwner;
95 	//const const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >&               m_rXTDataSource;
96 
97 	//friend class CWinClipboard;
98 	friend class CEnumFormatEtc;
99 };
100 
101 //------------------------------------------------------------------------
102 //
103 //------------------------------------------------------------------------
104 
105 class CEnumFormatEtc : public IEnumFORMATETC
106 {
107 public:
108 	CEnumFormatEtc( LPUNKNOWN pUnkDataObj );
109     ~CEnumFormatEtc( );
110 
111     // IUnknown
112     STDMETHODIMP           QueryInterface( REFIID iid, LPVOID* ppvObject );
113     STDMETHODIMP_( ULONG ) AddRef( );
114     STDMETHODIMP_( ULONG ) Release( );
115 
116     //IEnumFORMATETC
117     STDMETHODIMP Next( ULONG celt, LPFORMATETC rgelt, ULONG* pceltFetched );
118     STDMETHODIMP Skip( ULONG celt );
119     STDMETHODIMP Reset( );
120     STDMETHODIMP Clone( IEnumFORMATETC** ppenum );
121 
122 private:
123 	LONG		m_nRefCnt;
124 	LPUNKNOWN	m_pUnkDataObj;
125     ULONG		m_nCurrentPos;
126 	CLIPFORMAT  m_cfFormats[2];
127 };
128 
129 
130 typedef CEnumFormatEtc *PCEnumFormatEtc;
131 
132 #endif
133