LibreOffice Module dtrans (master)  1
XTDo.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 #ifndef INCLUDED_DTRANS_SOURCE_WIN32_WORKBENCH_XTDO_HXX
21 #define INCLUDED_DTRANS_SOURCE_WIN32_WORKBENCH_XTDO_HXX
22 
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
32 
33 #include <vector>
34 
35 class EnumFormatEtc;
36 
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
43 
44  - This class inherits from IDataObject and so can be placed on the
45  OleClipboard. The class wraps a transferable object which is the
46  original DataSource
47  - DataFlavors offered 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 and 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
54 
55 ----------------------------------------------------------------------------*/
56 
57 class CXTDataObject : public IDataObject
58 {
59 public:
60  CXTDataObject( );
61 
62  // ole interface implementation
63 
64  //IUnknown interface methods
65  STDMETHODIMP QueryInterface(REFIID iid, LPVOID* ppvObject);
66  STDMETHODIMP_( ULONG ) AddRef( );
67  STDMETHODIMP_( ULONG ) Release( );
68 
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 );
79 
80  operator IDataObject*( );
81 
82 private:
83 
84 private:
85  LONG m_nRefCnt;
86 };
87 
88 class CEnumFormatEtc : public IEnumFORMATETC
89 {
90 public:
91  explicit CEnumFormatEtc( LPUNKNOWN pUnkDataObj );
92 
93  // IUnknown
94  STDMETHODIMP QueryInterface( REFIID iid, LPVOID* ppvObject );
95  STDMETHODIMP_( ULONG ) AddRef( );
96  STDMETHODIMP_( ULONG ) Release( );
97 
98  //IEnumFORMATETC
99  STDMETHODIMP Next( ULONG celt, LPFORMATETC rgelt, ULONG* pceltFetched );
100  STDMETHODIMP Skip( ULONG celt );
101  STDMETHODIMP Reset( );
102  STDMETHODIMP Clone( IEnumFORMATETC** ppenum );
103 
104 private:
105  LONG m_nRefCnt;
106  LPUNKNOWN m_pUnkDataObj;
107  ULONG m_nCurrPos;
108 };
109 
111 
112 #endif
113 
114 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
STDMETHODIMP GetCanonicalFormatEtc(FORMATETC *pFormatectIn, FORMATETC *pFormatetcOut) override
STDMETHODIMP DAdvise(FORMATETC *pFormatetc, DWORD advf, IAdviseSink *pAdvSink, DWORD *pdwConnection) override
STDMETHODIMP GetDataHere(FORMATETC *pFormatetc, STGMEDIUM *pmedium) override
STDMETHODIMP GetData(FORMATETC *pFormatetc, STGMEDIUM *pmedium) override
const wchar_t *typedef BOOL
STDMETHODIMP QueryInterface(REFIID iid, void **ppvObject) override
STDMETHODIMP QueryGetData(FORMATETC *pFormatetc) override
STDMETHODIMP EnumFormatEtc(DWORD dwDirection, IEnumFORMATETC **ppenumFormatetc) override
STDMETHODIMP DUnadvise(DWORD dwConnection) override
STDMETHODIMP SetData(FORMATETC *pFormatetc, STGMEDIUM *pmedium, BOOL fRelease) override
STDMETHODIMP EnumDAdvise(IEnumSTATDATA **ppenumAdvise) override
CXTDataObject()
Definition: XTDo.cxx:51
STDMETHODIMP_(ULONG) AddRef() override