1 /*************************************************************************
2  *
3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4  *
5  * Copyright 2000, 2010 Oracle and/or its affiliates.
6  *
7  * OpenOffice.org - a multi-platform office productivity suite
8  *
9  * This file is part of OpenOffice.org.
10  *
11  * OpenOffice.org is free software: you can redistribute it and/or modify
12  * it under the terms of the GNU Lesser General Public License version 3
13  * only, as published by the Free Software Foundation.
14  *
15  * OpenOffice.org is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU Lesser General Public License version 3 for more details
19  * (a copy is included in the LICENSE file that accompanied this code).
20  *
21  * You should have received a copy of the GNU Lesser General Public License
22  * version 3 along with OpenOffice.org.  If not, see
23  * <http://www.openoffice.org/license.html>
24  * for a copy of the LGPLv3 License.
25  *
26  ************************************************************************/
27 
28 #ifndef _DTRANS_GENERIC_CLIPBOARD_HXX_
29 #define _DTRANS_GENERIC_CLIPBOARD_HXX_
30 
31 #include <cppuhelper/compbase4.hxx>
32 
33 #ifndef _COM_SUN_STAR_DATATRANSFER_CLIPBAORD_XCLIPBOARDEX_HPP_
34 #include <com/sun/star/datatransfer/clipboard/XClipboardEx.hpp>
35 #endif
36 
37 #ifndef _COM_SUN_STAR_DATATRANSFER_CLIPBAORD_XCLIPBOARDNOTIFIER_HPP_
38 #include <com/sun/star/datatransfer/clipboard/XClipboardNotifier.hpp>
39 #endif
40 #include <com/sun/star/lang/XServiceInfo.hpp>
41 #include <com/sun/star/lang/XInitialization.hpp>
42 
43 // ------------------------------------------------------------------------
44 
45 #define GENERIC_CLIPBOARD_IMPLEMENTATION_NAME "com.sun.star.comp.datatransfer.clipboard.GenericClipboard"
46 
47 // ------------------------------------------------------------------------
48 
49 namespace dtrans
50 {
51 
52     class GenericClipboard : public ::cppu::WeakComponentImplHelper4 < \
53     ::com::sun::star::datatransfer::clipboard::XClipboardEx, \
54     ::com::sun::star::datatransfer::clipboard::XClipboardNotifier, \
55     ::com::sun::star::lang::XServiceInfo, \
56     ::com::sun::star::lang::XInitialization >
57     {
58         ::osl::Mutex m_aMutex;
59         ::rtl::OUString m_aName;
60 
61         ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > m_aContents;
62         ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardOwner > m_aOwner;
63 
64 	    sal_Bool m_bInitialized;
65         virtual ~GenericClipboard();
66 
67     public:
68 
69 	    GenericClipboard();
70 
71 	    /*
72 	     * XInitialization
73 	     */
74 
75 	    virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
76 		    throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
77 
78 	    /*
79 	     * XServiceInfo
80 	     */
81 
82 	    virtual ::rtl::OUString SAL_CALL getImplementationName(	 )
83 		    throw(::com::sun::star::uno::RuntimeException);
84 
85 	    virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
86 		    throw(::com::sun::star::uno::RuntimeException);
87 
88 	    virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  )
89 		    throw(::com::sun::star::uno::RuntimeException);
90 
91         /*
92          * XClipboard
93          */
94 
95         virtual ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > SAL_CALL getContents()
96             throw(::com::sun::star::uno::RuntimeException);
97 
98         virtual void SAL_CALL setContents(
99             const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& xTrans,
100             const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardOwner >& xClipboardOwner )
101             throw(::com::sun::star::uno::RuntimeException);
102 
103         virtual ::rtl::OUString SAL_CALL getName()
104             throw(::com::sun::star::uno::RuntimeException);
105 
106         /*
107          * XClipboardEx
108          */
109 
110         virtual sal_Int8 SAL_CALL getRenderingCapabilities()
111             throw(::com::sun::star::uno::RuntimeException);
112 
113         /*
114          * XClipboardNotifier
115          */
116 
117         virtual void SAL_CALL addClipboardListener(
118             const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardListener >& listener )
119             throw(::com::sun::star::uno::RuntimeException);
120 
121         virtual void SAL_CALL removeClipboardListener(
122             const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardListener >& listener )
123             throw(::com::sun::star::uno::RuntimeException);
124 
125     };
126 
127 }
128 
129 // ------------------------------------------------------------------------
130 
131 ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL GenericClipboard_getSupportedServiceNames();
132 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL GenericClipboard_createInstance(
133 	const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & xMultiServiceFactory);
134 
135 #endif
136