fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / dtrans / source / win32 / dtobj / XTDataObject.hxx
blob9577cb5143c533817b97c26cc04a54ae9c5f2ab3
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_DTRANS_SOURCE_WIN32_DTOBJ_XTDATAOBJECT_HXX
21 #define INCLUDED_DTRANS_SOURCE_WIN32_DTOBJ_XTDATAOBJECT_HXX
23 #include <com/sun/star/datatransfer/XTransferable.hpp>
24 #include <com/sun/star/datatransfer/clipboard/XClipboardOwner.hpp>
26 #include "DataFmtTransl.hxx"
28 #include "FetcList.hxx"
30 #if defined _MSC_VER
31 #pragma warning(push,1)
32 #endif
33 #include <windows.h>
34 #include <ole2.h>
35 #include <objidl.h>
36 #if defined _MSC_VER
37 #pragma warning(pop)
38 #endif
40 /*--------------------------------------------------------------------------
41 - the function principle of the windows clipboard:
42 a data provider offers all formats he can deliver on the clipboard
43 a clipboard client ask for the available formats on the clipboard
44 and decides if there is a format he can use
45 if there is one, he requests the data in this format
47 - This class inherits from IDataObject an so can be placed on the
48 OleClipboard. The class wrapps a transferable object which is the
49 original DataSource
50 - DataFlavors offerd by this transferable will be translated into
51 appropriate clipboard formats
52 - if the transferable contains text data always text and unicodetext
53 will be offered or vice versa
54 - text data will be automatically converted between text und unicode text
55 - although the transferable may support text in different charsets
56 (codepages) only text in one codepage can be offered by the clipboard
58 ----------------------------------------------------------------------------*/
60 class CStgTransferHelper;
62 class CXTDataObject : public IDataObject
64 public:
65 CXTDataObject( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
66 const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& aXTransferable );
67 virtual ~CXTDataObject() {}
69 // ole interface implementation
71 //IUnknown interface methods
72 STDMETHODIMP QueryInterface(REFIID iid, LPVOID* ppvObject);
73 STDMETHODIMP_( ULONG ) AddRef( );
74 STDMETHODIMP_( ULONG ) Release( );
76 // IDataObject interface methods
77 STDMETHODIMP GetData( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium );
78 STDMETHODIMP GetDataHere( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium );
79 STDMETHODIMP QueryGetData( LPFORMATETC pFormatetc );
80 STDMETHODIMP GetCanonicalFormatEtc( LPFORMATETC pFormatectIn, LPFORMATETC pFormatetcOut );
81 STDMETHODIMP SetData( LPFORMATETC pFormatetc, LPSTGMEDIUM pmedium, BOOL fRelease );
82 STDMETHODIMP EnumFormatEtc( DWORD dwDirection, IEnumFORMATETC** ppenumFormatetc );
83 STDMETHODIMP DAdvise( LPFORMATETC pFormatetc, DWORD advf, LPADVISESINK pAdvSink, DWORD* pdwConnection );
84 STDMETHODIMP DUnadvise( DWORD dwConnection );
85 STDMETHODIMP EnumDAdvise( LPENUMSTATDATA* ppenumAdvise );
87 operator IDataObject*( );
89 private:
90 com::sun::star::datatransfer::DataFlavor SAL_CALL formatEtcToDataFlavor( const FORMATETC& aFormatEtc ) const;
92 void SAL_CALL renderDataAndSetupStgMedium( const sal_Int8* lpStorage,
93 const FORMATETC& fetc,
94 sal_uInt32 nInitStgSize,
95 sal_uInt32 nBytesToTransfer,
96 STGMEDIUM& stgmedium );
98 void SAL_CALL renderLocaleAndSetupStgMedium( FORMATETC& fetc, STGMEDIUM& stgmedium );
99 void SAL_CALL renderUnicodeAndSetupStgMedium( FORMATETC& fetc, STGMEDIUM& stgmedium );
100 void SAL_CALL renderAnyDataAndSetupStgMedium( FORMATETC& fetc, STGMEDIUM& stgmedium );
102 HRESULT SAL_CALL renderSynthesizedFormatAndSetupStgMedium( FORMATETC& fetc, STGMEDIUM& stgmedium );
103 void SAL_CALL renderSynthesizedUnicodeAndSetupStgMedium( FORMATETC& fetc, STGMEDIUM& stgmedium );
104 void SAL_CALL renderSynthesizedTextAndSetupStgMedium( FORMATETC& fetc, STGMEDIUM& stgmedium );
105 void SAL_CALL renderSynthesizedHtmlAndSetupStgMedium( FORMATETC& fetc, STGMEDIUM& stgmedium );
107 void SAL_CALL setupStgMedium( const FORMATETC& fetc,
108 CStgTransferHelper& stgTransHlp,
109 STGMEDIUM& stgmedium );
111 void validateFormatEtc( LPFORMATETC lpFormatEtc ) const;
112 void SAL_CALL invalidateStgMedium( STGMEDIUM& stgmedium ) const;
114 HRESULT SAL_CALL translateStgExceptionCode( HRESULT hr ) const;
116 inline void SAL_CALL InitializeFormatEtcContainer( );
118 private:
119 LONG m_nRefCnt;
120 ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > m_XTransferable;
121 CFormatEtcContainer m_FormatEtcContainer;
122 sal_Bool m_bFormatEtcContainerInitialized;
123 CDataFormatTranslator m_DataFormatTranslator;
124 CFormatRegistrar m_FormatRegistrar;
127 class CEnumFormatEtc : public IEnumFORMATETC
129 public:
130 CEnumFormatEtc( LPUNKNOWN lpUnkOuter, const CFormatEtcContainer& aFormatEtcContainer );
131 virtual ~CEnumFormatEtc() {}
133 // IUnknown
134 STDMETHODIMP QueryInterface( REFIID iid, LPVOID* ppvObject );
135 STDMETHODIMP_( ULONG ) AddRef( );
136 STDMETHODIMP_( ULONG ) Release( );
138 //IEnumFORMATETC
139 STDMETHODIMP Next( ULONG nRequested, LPFORMATETC lpDest, ULONG* lpFetched );
140 STDMETHODIMP Skip( ULONG celt );
141 STDMETHODIMP Reset( );
142 STDMETHODIMP Clone( IEnumFORMATETC** ppenum );
144 private:
145 LONG m_nRefCnt;
146 LPUNKNOWN m_lpUnkOuter;
147 CFormatEtcContainer m_FormatEtcContainer;
150 typedef CEnumFormatEtc *PCEnumFormatEtc;
152 #endif
154 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */