Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / dtrans / source / win32 / clipb / WinClipboard.hxx
blobdb3f1ab188edf5878fe88672e9dea821c059fc31
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_WINCLIPBOARD_HXX
21 #define INCLUDED_DTRANS_SOURCE_WIN32_CLIPB_WINCLIPBOARD_HXX
23 #include <rtl/ustring.hxx>
24 #include <sal/types.h>
25 #include <cppuhelper/compbase.hxx>
26 #include <com/sun/star/datatransfer/XTransferable.hpp>
27 #include <com/sun/star/datatransfer/clipboard/XClipboardEx.hpp>
28 #include <com/sun/star/datatransfer/clipboard/XClipboardOwner.hpp>
29 #include <com/sun/star/datatransfer/clipboard/XClipboardListener.hpp>
30 #include <com/sun/star/datatransfer/clipboard/XClipboardNotifier.hpp>
31 #include <com/sun/star/datatransfer/clipboard/XSystemClipboard.hpp>
32 #include <com/sun/star/datatransfer/clipboard/XFlushableClipboard.hpp>
33 #include <com/sun/star/lang/XServiceInfo.hpp>
34 #include <com/sun/star/uno/XComponentContext.hpp>
35 #include <osl/conditn.hxx>
37 #include <memory>
39 // forward
40 class CWinClipbImpl;
42 // implements the XClipboard[Ex] ... interfaces
43 // for the clipboard viewer mechanism we need a static callback function
44 // and a static member to reassociate from this static function to the
45 // class instance
46 // watch out: we are using only one static member variable and not a list
47 // because we assume to be instantiated only once
48 // this will be assured by a OneInstanceFactory of the service and not
49 // by this class!
51 // helper class, so that the mutex is constructed
52 // before the constructor of WeakComponentImplHelper
53 // will be called and initialized with this mutex
54 class CWinClipboardDummy
56 protected:
57 osl::Mutex m_aMutex;
58 osl::Mutex m_aCbListenerMutex;
61 class CWinClipboard :
62 public CWinClipboardDummy,
63 public cppu::WeakComponentImplHelper<
64 css::datatransfer::clipboard::XSystemClipboard,
65 css::datatransfer::clipboard::XFlushableClipboard,
66 css::lang::XServiceInfo >
68 public:
69 CWinClipboard( const css::uno::Reference< css::uno::XComponentContext >& rxContext,
70 const OUString& aClipboardName );
72 // XClipboard
74 virtual css::uno::Reference< css::datatransfer::XTransferable > SAL_CALL getContents( ) override;
76 virtual void SAL_CALL setContents(
77 const css::uno::Reference< css::datatransfer::XTransferable >& xTransferable,
78 const css::uno::Reference< css::datatransfer::clipboard::XClipboardOwner >& xClipboardOwner ) override;
80 virtual OUString SAL_CALL getName( ) override;
82 // XFlushableClipboard
84 virtual void SAL_CALL flushClipboard( ) override;
86 // XClipboardEx
88 virtual sal_Int8 SAL_CALL getRenderingCapabilities( ) override;
90 // XClipboardNotifier
92 virtual void SAL_CALL addClipboardListener(
93 const css::uno::Reference< css::datatransfer::clipboard::XClipboardListener >& listener ) override;
95 virtual void SAL_CALL removeClipboardListener(
96 const css::uno::Reference< css::datatransfer::clipboard::XClipboardListener >& listener ) override;
98 // overwrite base class method, which is called
99 // by base class dispose function
101 virtual void SAL_CALL disposing() override;
103 // XServiceInfo
105 virtual OUString SAL_CALL getImplementationName( ) override;
107 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
109 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
111 private:
112 void notifyAllClipboardListener( );
114 private:
115 std::unique_ptr< CWinClipbImpl > m_pImpl;
116 css::uno::Reference< css::uno::XComponentContext > m_xContext;
118 friend class CWinClipbImpl;
121 #endif
123 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */