1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef _DTRANS_GENERIC_CLIPBOARD_HXX_
25 #define _DTRANS_GENERIC_CLIPBOARD_HXX_
26 
27 #include <cppuhelper/compbase4.hxx>
28 
29 #ifndef _COM_SUN_STAR_DATATRANSFER_CLIPBAORD_XCLIPBOARDEX_HPP_
30 #include <com/sun/star/datatransfer/clipboard/XClipboardEx.hpp>
31 #endif
32 
33 #ifndef _COM_SUN_STAR_DATATRANSFER_CLIPBAORD_XCLIPBOARDNOTIFIER_HPP_
34 #include <com/sun/star/datatransfer/clipboard/XClipboardNotifier.hpp>
35 #endif
36 #include <com/sun/star/lang/XServiceInfo.hpp>
37 #include <com/sun/star/lang/XInitialization.hpp>
38 
39 // ------------------------------------------------------------------------
40 
41 #define GENERIC_CLIPBOARD_IMPLEMENTATION_NAME "com.sun.star.comp.datatransfer.clipboard.GenericClipboard"
42 
43 // ------------------------------------------------------------------------
44 
45 namespace dtrans
46 {
47 
48     class GenericClipboard : public ::cppu::WeakComponentImplHelper4 < \
49     ::com::sun::star::datatransfer::clipboard::XClipboardEx, \
50     ::com::sun::star::datatransfer::clipboard::XClipboardNotifier, \
51     ::com::sun::star::lang::XServiceInfo, \
52     ::com::sun::star::lang::XInitialization >
53     {
54         ::osl::Mutex m_aMutex;
55         ::rtl::OUString m_aName;
56 
57         ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > m_aContents;
58         ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardOwner > m_aOwner;
59 
60 	    sal_Bool m_bInitialized;
61         virtual ~GenericClipboard();
62 
63     public:
64 
65 	    GenericClipboard();
66 
67 	    /*
68 	     * XInitialization
69 	     */
70 
71 	    virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
72 		    throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
73 
74 	    /*
75 	     * XServiceInfo
76 	     */
77 
78 	    virtual ::rtl::OUString SAL_CALL getImplementationName(	 )
79 		    throw(::com::sun::star::uno::RuntimeException);
80 
81 	    virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
82 		    throw(::com::sun::star::uno::RuntimeException);
83 
84 	    virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  )
85 		    throw(::com::sun::star::uno::RuntimeException);
86 
87         /*
88          * XClipboard
89          */
90 
91         virtual ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > SAL_CALL getContents()
92             throw(::com::sun::star::uno::RuntimeException);
93 
94         virtual void SAL_CALL setContents(
95             const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& xTrans,
96             const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardOwner >& xClipboardOwner )
97             throw(::com::sun::star::uno::RuntimeException);
98 
99         virtual ::rtl::OUString SAL_CALL getName()
100             throw(::com::sun::star::uno::RuntimeException);
101 
102         /*
103          * XClipboardEx
104          */
105 
106         virtual sal_Int8 SAL_CALL getRenderingCapabilities()
107             throw(::com::sun::star::uno::RuntimeException);
108 
109         /*
110          * XClipboardNotifier
111          */
112 
113         virtual void SAL_CALL addClipboardListener(
114             const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardListener >& listener )
115             throw(::com::sun::star::uno::RuntimeException);
116 
117         virtual void SAL_CALL removeClipboardListener(
118             const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardListener >& listener )
119             throw(::com::sun::star::uno::RuntimeException);
120 
121     };
122 
123 }
124 
125 // ------------------------------------------------------------------------
126 
127 ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL GenericClipboard_getSupportedServiceNames();
128 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL GenericClipboard_createInstance(
129 	const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & xMultiServiceFactory);
130 
131 #endif
132