Branch libreoffice-5-0-4
[LibreOffice.git] / dtrans / source / win32 / workbench / XTDo.hxx
blob336ba193567af838b9ca2716e059823fae4a0493
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_WORKBENCH_XTDO_HXX
21 #define INCLUDED_DTRANS_SOURCE_WIN32_WORKBENCH_XTDO_HXX
23 #if defined _MSC_VER
24 #pragma warning(push,1)
25 #endif
26 #include <windows.h>
27 #include <ole2.h>
28 #include <objidl.h>
29 #if defined _MSC_VER
30 #pragma warning(pop)
31 #endif
33 #include <vector>
35 class EnumFormatEtc;
37 /*--------------------------------------------------------------------------
38 - the function principle of the windows clipboard:
39 a data provider offers all formats he can deliver on the clipboard
40 a clipboard client ask for the available formats on the clipboard
41 and decides if there is a format he can use
42 if there is one, he requests the data in this format
44 - This class inherits from IDataObject an so can be placed on the
45 OleClipboard. The class wrapps a transferable object which is the
46 original DataSource
47 - DataFlavors offerd by this transferable will be translated into
48 appropriate clipboard formats
49 - if the transferable contains text data always text and unicodetext
50 will be offered or vice versa
51 - text data will be automatically converted between text und unicode text
52 - although the transferable may support text in different charsets
53 (codepages) only text in one codepage can be offered by the clipboard
55 ----------------------------------------------------------------------------*/
57 class CXTDataObject : public IDataObject
59 public:
60 CXTDataObject( );
62 // ole interface implementation
64 //IUnknown interface methods
65 STDMETHODIMP QueryInterface(REFIID iid, LPVOID* ppvObject);
66 STDMETHODIMP_( ULONG ) AddRef( );
67 STDMETHODIMP_( ULONG ) Release( );
69 // IDataObject interface methods
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 );
80 operator IDataObject*( );
82 private:
84 private:
85 LONG m_nRefCnt;
88 class CEnumFormatEtc : public IEnumFORMATETC
90 public:
91 CEnumFormatEtc( LPUNKNOWN pUnkDataObj );
93 // IUnknown
94 STDMETHODIMP QueryInterface( REFIID iid, LPVOID* ppvObject );
95 STDMETHODIMP_( ULONG ) AddRef( );
96 STDMETHODIMP_( ULONG ) Release( );
98 //IEnumFORMATETC
99 STDMETHODIMP Next( ULONG celt, LPFORMATETC rgelt, ULONG* pceltFetched );
100 STDMETHODIMP Skip( ULONG celt );
101 STDMETHODIMP Reset( );
102 STDMETHODIMP Clone( IEnumFORMATETC** ppenum );
104 private:
105 LONG m_nRefCnt;
106 LPUNKNOWN m_pUnkDataObj;
107 ULONG m_nCurrPos;
110 typedef CEnumFormatEtc *PCEnumFormatEtc;
112 #endif
114 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */