fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / dtrans / source / win32 / clipb / MtaOleClipb.hxx
bloba8458a1c3fec28e62fad890c08fa7936f05b8e9a
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_CLIPB_MTAOLECLIPB_HXX
21 #define INCLUDED_DTRANS_SOURCE_WIN32_CLIPB_MTAOLECLIPB_HXX
23 #include <sal/types.h>
24 #include <osl/mutex.hxx>
26 #if defined _MSC_VER
27 #pragma warning(push,1)
28 #endif
29 #include <objidl.h>
30 #if defined _MSC_VER
31 #pragma warning(pop)
32 #endif
34 // the Mta-Ole clipboard class is for internal use only!
35 // only one instance of this class should be created, the
36 // user has to ensure this!
37 // the class is not thread-safe because it will be used
38 // only from within the clipboard service and the methods
39 // of the clipboard service are already synchronized
41 class CMtaOleClipboard
43 public:
44 typedef void ( WINAPI *LPFNC_CLIPVIEWER_CALLBACK_t )( void );
46 public:
47 CMtaOleClipboard( );
48 ~CMtaOleClipboard( );
50 // clipboard functions
51 HRESULT setClipboard( IDataObject* pIDataObject );
52 HRESULT getClipboard( IDataObject** ppIDataObject );
53 HRESULT flushClipboard( );
55 // register/unregister a clipboard viewer; there can only
56 // be one at a time; parameter NULL means unregister
57 // a clipboard viewer
58 // returns true on success else false; use GetLastError( ) in
59 // false case
60 bool registerClipViewer( LPFNC_CLIPVIEWER_CALLBACK_t pfncClipViewerCallback );
62 private:
63 unsigned int run( );
65 // create a hidden window which serves as an request target; so we
66 // guarantee synchronization
67 void createMtaOleReqWnd( );
69 // message support
70 bool postMessage( UINT msg, WPARAM wParam = 0, LPARAM lParam = 0 );
71 LRESULT sendMessage( UINT msg, WPARAM wParam = 0, LPARAM lParam = 0 );
73 // message handler functions; remember these functions are called
74 // from a different thread context!
76 LRESULT onSetClipboard( IDataObject* pIDataObject );
77 LRESULT onGetClipboard( LPSTREAM* ppStream );
78 LRESULT onFlushClipboard( );
79 bool onRegisterClipViewer( LPFNC_CLIPVIEWER_CALLBACK_t pfncClipViewerCallback );
81 // win32 clipboard-viewer support
82 LRESULT onChangeCBChain( HWND hWndRemove, HWND hWndNext );
83 LRESULT onDrawClipboard( );
85 static LRESULT CALLBACK mtaOleReqWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
86 static unsigned int WINAPI oleThreadProc( LPVOID pParam );
88 static unsigned int WINAPI clipboardChangedNotifierThreadProc( LPVOID pParam );
90 bool WaitForThreadReady( ) const;
92 private:
93 HANDLE m_hOleThread;
94 unsigned m_uOleThreadId;
95 HANDLE m_hEvtThrdReady;
96 HWND m_hwndMtaOleReqWnd;
97 ATOM m_MtaOleReqWndClassAtom;
98 HWND m_hwndNextClipViewer;
99 LPFNC_CLIPVIEWER_CALLBACK_t m_pfncClipViewerCallback;
100 bool m_bInRegisterClipViewer;
102 bool m_bRunClipboardNotifierThread;
103 HANDLE m_hClipboardChangedNotifierThread;
104 HANDLE m_hClipboardChangedNotifierEvents[2];
105 HANDLE& m_hClipboardChangedEvent;
106 HANDLE& m_hTerminateClipboardChangedNotifierEvent;
107 osl::Mutex m_ClipboardChangedEventCountMutex;
108 sal_Int32 m_ClipboardChangedEventCount;
110 osl::Mutex m_pfncClipViewerCallbackMutex;
112 static CMtaOleClipboard* s_theMtaOleClipboardInst;
114 // not allowed
115 private:
116 CMtaOleClipboard( const CMtaOleClipboard& );
117 CMtaOleClipboard& operator=( const CMtaOleClipboard& );
119 friend LRESULT CALLBACK mtaOleReqWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
122 #endif
124 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */