1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 25 #ifndef _XTDATAOBJECT_HXX_ 26 #define _XTDATAOBJECT_HXX_ 27 28 29 //------------------------------------------------------------------------ 30 // includes 31 //------------------------------------------------------------------------ 32 33 /* 34 #include <com/sun/star/datatransfer/XTransferable.hpp> 35 #include <com/sun/star/datatransfer/clipboard/XClipboardOwner.hpp> 36 #include "WinClipboard.hxx" 37 */ 38 39 #include <windows.h> 40 #include <ole2.h> 41 #include <objidl.h> 42 43 44 //------------------------------------------------------------------------ 45 // 46 //------------------------------------------------------------------------ 47 48 class EnumFormatEtc; 49 50 class CXTDataObject : public IDataObject 51 { 52 public: 53 CXTDataObject( LONG nRefCntInitVal = 0); 54 ~CXTDataObject( ); 55 56 //----------------------------------------------------------------- 57 // ole interface implementation 58 //----------------------------------------------------------------- 59 60 //IUnknown 61 STDMETHODIMP QueryInterface(REFIID iid, LPVOID* ppvObject); 62 STDMETHODIMP_( ULONG ) AddRef( ); 63 STDMETHODIMP_( ULONG ) Release( ); 64 65 //IDataObject 66 STDMETHODIMP GetData( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium ); 67 STDMETHODIMP GetDataHere( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium ); 68 STDMETHODIMP QueryGetData( LPFORMATETC pFormatetc ); 69 STDMETHODIMP GetCanonicalFormatEtc( LPFORMATETC pFormatectIn, LPFORMATETC pFormatetcOut ); 70 STDMETHODIMP SetData( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium, BOOL fRelease ); 71 STDMETHODIMP EnumFormatEtc( DWORD dwDirection, IEnumFORMATETC** ppenumFormatetc ); 72 STDMETHODIMP DAdvise( LPFORMATETC pFormatetc, DWORD advf, LPADVISESINK pAdvSink, DWORD* pdwConnection ); 73 STDMETHODIMP DUnadvise( DWORD dwConnection ); 74 STDMETHODIMP EnumDAdvise( LPENUMSTATDATA* ppenumAdvise ); 75 76 operator IDataObject*( ); 77 78 // notification handler 79 //void SAL_CALL LostOwnership( ); 80 81 //sal_Int64 SAL_CALL QueryDataSize( ); 82 83 // retrieve the data from the source 84 // necessary so that 85 //void SAL_CALL GetAllDataFromSource( ); 86 87 private: 88 LONG m_nRefCnt; 89 //CWinClipboard& m_rCWinClipboard; 90 //const const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardOwner >& m_rXClipboardOwner; 91 //const const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& m_rXTDataSource; 92 93 //friend class CWinClipboard; 94 friend class CEnumFormatEtc; 95 }; 96 97 //------------------------------------------------------------------------ 98 // 99 //------------------------------------------------------------------------ 100 101 class CEnumFormatEtc : public IEnumFORMATETC 102 { 103 public: 104 CEnumFormatEtc( LPUNKNOWN pUnkDataObj ); 105 ~CEnumFormatEtc( ); 106 107 // IUnknown 108 STDMETHODIMP QueryInterface( REFIID iid, LPVOID* ppvObject ); 109 STDMETHODIMP_( ULONG ) AddRef( ); 110 STDMETHODIMP_( ULONG ) Release( ); 111 112 //IEnumFORMATETC 113 STDMETHODIMP Next( ULONG celt, LPFORMATETC rgelt, ULONG* pceltFetched ); 114 STDMETHODIMP Skip( ULONG celt ); 115 STDMETHODIMP Reset( ); 116 STDMETHODIMP Clone( IEnumFORMATETC** ppenum ); 117 118 private: 119 LONG m_nRefCnt; 120 LPUNKNOWN m_pUnkDataObj; 121 ULONG m_nCurrentPos; 122 CLIPFORMAT m_cfFormats[2]; 123 }; 124 125 126 typedef CEnumFormatEtc *PCEnumFormatEtc; 127 128 #endif 129