Branch libreoffice-5-0-4
[LibreOffice.git] / dtrans / source / win32 / clipb / WinClipboard.hxx
blob6efc60817cbaf7a0ec4a9eb08daeafe7201b64dc
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/compbase3.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 reasocciate 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 asured by an 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::WeakComponentImplHelper3<
64 ::com::sun::star::datatransfer::clipboard::XSystemClipboard,
65 ::com::sun::star::datatransfer::clipboard::XFlushableClipboard,
66 ::com::sun::star::lang::XServiceInfo >
68 public:
69 CWinClipboard( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& rxContext,
70 const OUString& aClipboardName );
72 // XClipboard
74 virtual ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > SAL_CALL getContents( )
75 throw( ::com::sun::star::uno::RuntimeException );
77 virtual void SAL_CALL setContents(
78 const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& xTransferable,
79 const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardOwner >& xClipboardOwner )
80 throw( ::com::sun::star::uno::RuntimeException );
82 virtual OUString SAL_CALL getName( )
83 throw( ::com::sun::star::uno::RuntimeException );
85 // XFlushableClipboard
87 virtual void SAL_CALL flushClipboard( ) throw( com::sun::star::uno::RuntimeException );
89 // XClipboardEx
91 virtual sal_Int8 SAL_CALL getRenderingCapabilities( ) throw( ::com::sun::star::uno::RuntimeException );
93 // XClipboardNotifier
95 virtual void SAL_CALL addClipboardListener(
96 const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardListener >& listener )
97 throw( ::com::sun::star::uno::RuntimeException );
99 virtual void SAL_CALL removeClipboardListener(
100 const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardListener >& listener )
101 throw( ::com::sun::star::uno::RuntimeException );
103 // overwrite base class method, which is called
104 // by base class dispose function
106 virtual void SAL_CALL disposing();
108 // XServiceInfo
110 virtual OUString SAL_CALL getImplementationName( )
111 throw(::com::sun::star::uno::RuntimeException);
113 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName )
114 throw(::com::sun::star::uno::RuntimeException);
116 virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( )
117 throw(::com::sun::star::uno::RuntimeException);
119 private:
120 void SAL_CALL notifyAllClipboardListener( );
122 private:
123 ::std::unique_ptr< CWinClipbImpl > m_pImpl;
124 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext;
126 friend class CWinClipbImpl;
129 #endif
131 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */