1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
21 #ifndef _WINCLIPBOARD_HXX_
22 #define _WINCLIPBOARD_HXX_
24 #include <rtl/ustring.hxx>
25 #include <sal/types.h>
26 #include <cppuhelper/compbase4.hxx>
27 #include <com/sun/star/datatransfer/XTransferable.hpp>
28 #include <com/sun/star/datatransfer/clipboard/XClipboardEx.hpp>
29 #include <com/sun/star/datatransfer/clipboard/XClipboardOwner.hpp>
30 #include <com/sun/star/datatransfer/clipboard/XClipboardListener.hpp>
31 #include <com/sun/star/datatransfer/clipboard/XClipboardNotifier.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>
42 //------------------------------------------------------------------------
43 // implements the XClipboard[Ex] ... interfaces
44 // for the clipboard viewer mechanism we need a static callback function
45 // and a static member to reasocciate from this static function to the
47 // watch out: we are using only one static member variable and not a list
48 // because we assume to be instanciated only once
49 // this will be asured by an OneInstanceFactory of the service and not
51 //------------------------------------------------------------------------
53 // helper class, so that the mutex is constructed
54 // before the constructor of WeakComponentImplHelper
55 // will be called and initialized with this mutex
56 class CWinClipboardDummy
60 osl::Mutex m_aCbListenerMutex
;
64 public CWinClipboardDummy
,
65 public cppu::WeakComponentImplHelper4
<
66 ::com::sun::star::datatransfer::clipboard::XClipboardEx
, \
67 ::com::sun::star::datatransfer::clipboard::XFlushableClipboard
,
68 ::com::sun::star::datatransfer::clipboard::XClipboardNotifier
,
69 ::com::sun::star::lang::XServiceInfo
>
72 CWinClipboard( const ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
>& rxContext
,
73 const OUString
& aClipboardName
);
75 //------------------------------------------------
77 //------------------------------------------------
79 virtual ::com::sun::star::uno::Reference
< ::com::sun::star::datatransfer::XTransferable
> SAL_CALL
getContents( )
80 throw( ::com::sun::star::uno::RuntimeException
);
82 virtual void SAL_CALL
setContents(
83 const ::com::sun::star::uno::Reference
< ::com::sun::star::datatransfer::XTransferable
>& xTransferable
,
84 const ::com::sun::star::uno::Reference
< ::com::sun::star::datatransfer::clipboard::XClipboardOwner
>& xClipboardOwner
)
85 throw( ::com::sun::star::uno::RuntimeException
);
87 virtual OUString SAL_CALL
getName( )
88 throw( ::com::sun::star::uno::RuntimeException
);
90 //------------------------------------------------
91 // XFlushableClipboard
92 //------------------------------------------------
94 virtual void SAL_CALL
flushClipboard( ) throw( com::sun::star::uno::RuntimeException
);
96 //------------------------------------------------
98 //------------------------------------------------
100 virtual sal_Int8 SAL_CALL
getRenderingCapabilities( ) throw( ::com::sun::star::uno::RuntimeException
);
102 //------------------------------------------------
103 // XClipboardNotifier
104 //------------------------------------------------
106 virtual void SAL_CALL
addClipboardListener(
107 const ::com::sun::star::uno::Reference
< ::com::sun::star::datatransfer::clipboard::XClipboardListener
>& listener
)
108 throw( ::com::sun::star::uno::RuntimeException
);
110 virtual void SAL_CALL
removeClipboardListener(
111 const ::com::sun::star::uno::Reference
< ::com::sun::star::datatransfer::clipboard::XClipboardListener
>& listener
)
112 throw( ::com::sun::star::uno::RuntimeException
);
114 //------------------------------------------------
115 // overwrite base class method, which is called
116 // by base class dispose function
117 //------------------------------------------------
119 virtual void SAL_CALL
disposing();
121 //------------------------------------------------
123 //------------------------------------------------
125 virtual OUString SAL_CALL
getImplementationName( )
126 throw(::com::sun::star::uno::RuntimeException
);
128 virtual sal_Bool SAL_CALL
supportsService( const OUString
& ServiceName
)
129 throw(::com::sun::star::uno::RuntimeException
);
131 virtual ::com::sun::star::uno::Sequence
< OUString
> SAL_CALL
getSupportedServiceNames( )
132 throw(::com::sun::star::uno::RuntimeException
);
135 void SAL_CALL
notifyAllClipboardListener( );
138 ::std::auto_ptr
< CWinClipbImpl
> m_pImpl
;
139 ::com::sun::star::uno::Reference
< ::com::sun::star::uno::XComponentContext
> m_xContext
;
141 friend class CWinClipbImpl
;
147 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */