merge the formfield patch from ooo-build
[ooovba.git] / dtrans / source / win32 / workbench / XTDo.hxx
blobbe31c07642148a875bd9b4586d43ddb7dbf04268
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: XTDo.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 //------------------------------------------------------------------------
40 #if defined _MSC_VER
41 #pragma warning(push,1)
42 #endif
43 #include <windows.h>
44 #include <ole2.h>
45 #include <objidl.h>
46 #if defined _MSC_VER
47 #pragma warning(pop)
48 #endif
50 #include <vector>
52 // forward declaration
53 //class CWinClipbImpl;
54 class EnumFormatEtc;
56 /*--------------------------------------------------------------------------
57 - the function principle of the windows clipboard:
58 a data provider offers all formats he can deliver on the clipboard
59 a clipboard client ask for the available formats on the clipboard
60 and decides if there is a format he can use
61 if there is one, he requests the data in this format
63 - This class inherits from IDataObject an so can be placed on the
64 OleClipboard. The class wrapps a transferable object which is the
65 original DataSource
66 - DataFlavors offerd by this transferable will be translated into
67 appropriate clipboard formats
68 - if the transferable contains text data always text and unicodetext
69 will be offered or vice versa
70 - text data will be automaticaly converted between text und unicode text
71 - although the transferable may support text in different charsets
72 (codepages) only text in one codepage can be offered by the clipboard
74 ----------------------------------------------------------------------------*/
76 class CXTDataObject : public IDataObject
78 public:
79 CXTDataObject( );
81 //-----------------------------------------------------------------
82 // ole interface implementation
83 //-----------------------------------------------------------------
85 //IUnknown interface methods
86 STDMETHODIMP QueryInterface(REFIID iid, LPVOID* ppvObject);
87 STDMETHODIMP_( ULONG ) AddRef( );
88 STDMETHODIMP_( ULONG ) Release( );
90 // IDataObject interface methods
91 STDMETHODIMP GetData( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium );
92 STDMETHODIMP GetDataHere( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium );
93 STDMETHODIMP QueryGetData( LPFORMATETC pFormatetc );
94 STDMETHODIMP GetCanonicalFormatEtc( LPFORMATETC pFormatectIn, LPFORMATETC pFormatetcOut );
95 STDMETHODIMP SetData( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium, BOOL fRelease );
96 STDMETHODIMP EnumFormatEtc( DWORD dwDirection, IEnumFORMATETC** ppenumFormatetc );
97 STDMETHODIMP DAdvise( LPFORMATETC pFormatetc, DWORD advf, LPADVISESINK pAdvSink, DWORD* pdwConnection );
98 STDMETHODIMP DUnadvise( DWORD dwConnection );
99 STDMETHODIMP EnumDAdvise( LPENUMSTATDATA* ppenumAdvise );
101 operator IDataObject*( );
103 private:
105 private:
106 LONG m_nRefCnt;
109 //------------------------------------------------------------------------
111 //------------------------------------------------------------------------
113 class CEnumFormatEtc : public IEnumFORMATETC
115 public:
116 CEnumFormatEtc( LPUNKNOWN pUnkDataObj );
118 // IUnknown
119 STDMETHODIMP QueryInterface( REFIID iid, LPVOID* ppvObject );
120 STDMETHODIMP_( ULONG ) AddRef( );
121 STDMETHODIMP_( ULONG ) Release( );
123 //IEnumFORMATETC
124 STDMETHODIMP Next( ULONG celt, LPFORMATETC rgelt, ULONG* pceltFetched );
125 STDMETHODIMP Skip( ULONG celt );
126 STDMETHODIMP Reset( );
127 STDMETHODIMP Clone( IEnumFORMATETC** ppenum );
129 private:
130 LONG m_nRefCnt;
131 LPUNKNOWN m_pUnkDataObj;
132 ULONG m_nCurrPos;
135 typedef CEnumFormatEtc *PCEnumFormatEtc;
137 #endif