xref: /trunk/main/dtrans/source/win32/workbench/XTDo.hxx (revision 914d351e5f5b84e4342a86d6ab8d4aca7308b9bd)
1fbcf0fe9SAndrew Rist /**************************************************************
2cdf0e10cSrcweir  *
3fbcf0fe9SAndrew Rist  * Licensed to the Apache Software Foundation (ASF) under one
4fbcf0fe9SAndrew Rist  * or more contributor license agreements.  See the NOTICE file
5fbcf0fe9SAndrew Rist  * distributed with this work for additional information
6fbcf0fe9SAndrew Rist  * regarding copyright ownership.  The ASF licenses this file
7fbcf0fe9SAndrew Rist  * to you under the Apache License, Version 2.0 (the
8fbcf0fe9SAndrew Rist  * "License"); you may not use this file except in compliance
9fbcf0fe9SAndrew Rist  * with the License.  You may obtain a copy of the License at
10cdf0e10cSrcweir  *
11fbcf0fe9SAndrew Rist  *   http://www.apache.org/licenses/LICENSE-2.0
12cdf0e10cSrcweir  *
13fbcf0fe9SAndrew Rist  * Unless required by applicable law or agreed to in writing,
14fbcf0fe9SAndrew Rist  * software distributed under the License is distributed on an
15fbcf0fe9SAndrew Rist  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16fbcf0fe9SAndrew Rist  * KIND, either express or implied.  See the License for the
17fbcf0fe9SAndrew Rist  * specific language governing permissions and limitations
18fbcf0fe9SAndrew Rist  * under the License.
19cdf0e10cSrcweir  *
20fbcf0fe9SAndrew Rist  *************************************************************/
21fbcf0fe9SAndrew Rist 
22fbcf0fe9SAndrew Rist 
23cdf0e10cSrcweir 
24cdf0e10cSrcweir 
25cdf0e10cSrcweir #ifndef _XTDATAOBJECT_HXX_
26cdf0e10cSrcweir #define _XTDATAOBJECT_HXX_
27cdf0e10cSrcweir 
28cdf0e10cSrcweir 
29cdf0e10cSrcweir //------------------------------------------------------------------------
30cdf0e10cSrcweir // includes
31cdf0e10cSrcweir //------------------------------------------------------------------------
32cdf0e10cSrcweir 
33cdf0e10cSrcweir #if defined _MSC_VER
34cdf0e10cSrcweir #pragma warning(push,1)
35cdf0e10cSrcweir #endif
36cdf0e10cSrcweir #include <windows.h>
37cdf0e10cSrcweir #include <ole2.h>
38cdf0e10cSrcweir #include <objidl.h>
39cdf0e10cSrcweir #if defined _MSC_VER
40cdf0e10cSrcweir #pragma warning(pop)
41cdf0e10cSrcweir #endif
42cdf0e10cSrcweir 
43cdf0e10cSrcweir #include <vector>
44cdf0e10cSrcweir 
45cdf0e10cSrcweir // forward declaration
46cdf0e10cSrcweir //class CWinClipbImpl;
47cdf0e10cSrcweir class EnumFormatEtc;
48cdf0e10cSrcweir 
49cdf0e10cSrcweir /*--------------------------------------------------------------------------
50cdf0e10cSrcweir     - the function principle of the windows clipboard:
51cdf0e10cSrcweir       a data provider offers all formats he can deliver on the clipboard
52cdf0e10cSrcweir       a clipboard client ask for the available formats on the clipboard
53cdf0e10cSrcweir       and decides if there is a format he can use
54cdf0e10cSrcweir       if there is one, he requests the data in this format
55cdf0e10cSrcweir 
56cdf0e10cSrcweir     - This class inherits from IDataObject an so can be placed on the
57*1c3951f9SJohn Bampton       OleClipboard. The class wraps a transferable object which is the
58cdf0e10cSrcweir       original DataSource
59*1c3951f9SJohn Bampton     - DataFlavors offered by this transferable will be translated into
60cdf0e10cSrcweir       appropriate clipboard formats
61cdf0e10cSrcweir     - if the transferable contains text data always text and unicodetext
62cdf0e10cSrcweir       will be offered or vice versa
63d41c82aeSJohn Bampton     - text data will be automatically converted between text und unicode text
64cdf0e10cSrcweir     - although the transferable may support text in different charsets
65cdf0e10cSrcweir       (codepages) only text in one codepage can be offered by the clipboard
66cdf0e10cSrcweir 
67cdf0e10cSrcweir ----------------------------------------------------------------------------*/
68cdf0e10cSrcweir 
69cdf0e10cSrcweir class CXTDataObject : public IDataObject
70cdf0e10cSrcweir {
71cdf0e10cSrcweir public:
72cdf0e10cSrcweir     CXTDataObject( );
73cdf0e10cSrcweir 
74cdf0e10cSrcweir     //-----------------------------------------------------------------
75cdf0e10cSrcweir     // ole interface implementation
76cdf0e10cSrcweir     //-----------------------------------------------------------------
77cdf0e10cSrcweir 
78cdf0e10cSrcweir     //IUnknown interface methods
79cdf0e10cSrcweir     STDMETHODIMP           QueryInterface(REFIID iid, LPVOID* ppvObject);
80cdf0e10cSrcweir     STDMETHODIMP_( ULONG ) AddRef( );
81cdf0e10cSrcweir     STDMETHODIMP_( ULONG ) Release( );
82cdf0e10cSrcweir 
83cdf0e10cSrcweir     // IDataObject interface methods
84cdf0e10cSrcweir     STDMETHODIMP GetData( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium );
85cdf0e10cSrcweir     STDMETHODIMP GetDataHere( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium );
86cdf0e10cSrcweir     STDMETHODIMP QueryGetData( LPFORMATETC pFormatetc );
87cdf0e10cSrcweir     STDMETHODIMP GetCanonicalFormatEtc( LPFORMATETC pFormatectIn, LPFORMATETC pFormatetcOut );
88cdf0e10cSrcweir     STDMETHODIMP SetData( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium, BOOL fRelease );
89cdf0e10cSrcweir     STDMETHODIMP EnumFormatEtc( DWORD dwDirection, IEnumFORMATETC** ppenumFormatetc );
90cdf0e10cSrcweir     STDMETHODIMP DAdvise( LPFORMATETC pFormatetc, DWORD advf, LPADVISESINK pAdvSink, DWORD* pdwConnection );
91cdf0e10cSrcweir     STDMETHODIMP DUnadvise( DWORD dwConnection );
92cdf0e10cSrcweir     STDMETHODIMP EnumDAdvise( LPENUMSTATDATA* ppenumAdvise );
93cdf0e10cSrcweir 
94cdf0e10cSrcweir     operator IDataObject*( );
95cdf0e10cSrcweir 
96cdf0e10cSrcweir private:
97cdf0e10cSrcweir 
98cdf0e10cSrcweir private:
99cdf0e10cSrcweir     LONG m_nRefCnt;
100cdf0e10cSrcweir };
101cdf0e10cSrcweir 
102cdf0e10cSrcweir //------------------------------------------------------------------------
103cdf0e10cSrcweir //
104cdf0e10cSrcweir //------------------------------------------------------------------------
105cdf0e10cSrcweir 
106cdf0e10cSrcweir class CEnumFormatEtc : public IEnumFORMATETC
107cdf0e10cSrcweir {
108cdf0e10cSrcweir public:
109cdf0e10cSrcweir     CEnumFormatEtc( LPUNKNOWN pUnkDataObj );
110cdf0e10cSrcweir 
111cdf0e10cSrcweir     // IUnknown
112cdf0e10cSrcweir     STDMETHODIMP           QueryInterface( REFIID iid, LPVOID* ppvObject );
113cdf0e10cSrcweir     STDMETHODIMP_( ULONG ) AddRef( );
114cdf0e10cSrcweir     STDMETHODIMP_( ULONG ) Release( );
115cdf0e10cSrcweir 
116cdf0e10cSrcweir     //IEnumFORMATETC
117cdf0e10cSrcweir     STDMETHODIMP Next( ULONG celt, LPFORMATETC rgelt, ULONG* pceltFetched );
118cdf0e10cSrcweir     STDMETHODIMP Skip( ULONG celt );
119cdf0e10cSrcweir     STDMETHODIMP Reset( );
120cdf0e10cSrcweir     STDMETHODIMP Clone( IEnumFORMATETC** ppenum );
121cdf0e10cSrcweir 
122cdf0e10cSrcweir private:
123cdf0e10cSrcweir     LONG                                m_nRefCnt;
124cdf0e10cSrcweir     LPUNKNOWN                           m_pUnkDataObj;
125cdf0e10cSrcweir     ULONG                               m_nCurrPos;
126cdf0e10cSrcweir };
127cdf0e10cSrcweir 
128cdf0e10cSrcweir typedef CEnumFormatEtc *PCEnumFormatEtc;
129cdf0e10cSrcweir 
130cdf0e10cSrcweir #endif
131