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