update dev300-m58
[ooovba.git] / dtrans / source / X11 / X11_clipboard.hxx
blob77b9e6c5f3d023eec6169af9444cbf5e0c159e76
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: X11_clipboard.hxx,v $
10 * $Revision: 1.9 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _DTRANS_X11_CLIPBOARD_HXX_
32 #define _DTRANS_X11_CLIPBOARD_HXX_
34 #include <X11_selection.hxx>
36 #ifndef _COM_SUN_STAR_DATATRANSFER_CLIPBAORD_XCLIPBOARDEX_HPP_
37 #include <com/sun/star/datatransfer/clipboard/XClipboardEx.hpp>
38 #endif
40 #ifndef _COM_SUN_STAR_DATATRANSFER_CLIPBAORD_XCLIPBOARDNOTIFIER_HPP_
41 #include <com/sun/star/datatransfer/clipboard/XClipboardNotifier.hpp>
42 #endif
43 #include <cppuhelper/compbase4.hxx>
45 // ------------------------------------------------------------------------
47 #define X11_CLIPBOARD_IMPLEMENTATION_NAME "com.sun.star.datatransfer.X11ClipboardSupport"
49 namespace x11 {
51 class X11Clipboard :
52 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
58 public SelectionAdaptor
60 Reference< ::com::sun::star::datatransfer::XTransferable > m_aContents;
61 Reference< ::com::sun::star::datatransfer::clipboard::XClipboardOwner > m_aOwner;
63 SelectionManager& m_rSelectionManager;
64 Reference< ::com::sun::star::lang::XInitialization > m_xSelectionManager;
65 ::std::list< Reference< ::com::sun::star::datatransfer::clipboard::XClipboardListener > > m_aListeners;
66 Atom m_aSelection;
68 protected:
71 friend class SelectionManager;
72 friend class X11_Transferable;
74 void fireChangedContentsEvent();
75 void clearContents();
77 public:
79 X11Clipboard( SelectionManager& rManager, Atom aSelection );
80 virtual ~X11Clipboard();
82 static X11Clipboard* get( const ::rtl::OUString& rDisplayName, Atom aSelection );
85 * XInitialization
87 virtual void SAL_CALL initialize( const Sequence< Any >& arguments ) throw( ::com::sun::star::uno::Exception );
90 * XServiceInfo
93 virtual ::rtl::OUString SAL_CALL getImplementationName( )
94 throw(RuntimeException);
96 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
97 throw(RuntimeException);
99 virtual Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( )
100 throw(RuntimeException);
103 * XClipboard
106 virtual Reference< ::com::sun::star::datatransfer::XTransferable > SAL_CALL getContents()
107 throw(RuntimeException);
109 virtual void SAL_CALL setContents(
110 const Reference< ::com::sun::star::datatransfer::XTransferable >& xTrans,
111 const Reference< ::com::sun::star::datatransfer::clipboard::XClipboardOwner >& xClipboardOwner )
112 throw(RuntimeException);
114 virtual ::rtl::OUString SAL_CALL getName()
115 throw(RuntimeException);
118 * XClipboardEx
121 virtual sal_Int8 SAL_CALL getRenderingCapabilities()
122 throw(RuntimeException);
125 * XClipboardNotifier
127 virtual void SAL_CALL addClipboardListener(
128 const Reference< ::com::sun::star::datatransfer::clipboard::XClipboardListener >& listener )
129 throw(RuntimeException);
131 virtual void SAL_CALL removeClipboardListener(
132 const Reference< ::com::sun::star::datatransfer::clipboard::XClipboardListener >& listener )
133 throw(RuntimeException);
136 * SelectionAdaptor
138 virtual Reference< ::com::sun::star::datatransfer::XTransferable > getTransferable();
139 virtual void clearTransferable();
140 virtual void fireContentsChanged();
141 virtual Reference< XInterface > getReference() throw();
144 // ------------------------------------------------------------------------
146 Sequence< ::rtl::OUString > SAL_CALL X11Clipboard_getSupportedServiceNames();
147 Reference< XInterface > SAL_CALL X11Clipboard_createInstance(
148 const Reference< ::com::sun::star::lang::XMultiServiceFactory > & xMultiServiceFactory);
150 // ------------------------------------------------------------------------
152 } // namepspace
154 #endif