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_X11_CLIPBOARD_HXX_ 29 #define _DTRANS_X11_CLIPBOARD_HXX_ 30 31 #include <X11_selection.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 <cppuhelper/compbase4.hxx> 41 42 // ------------------------------------------------------------------------ 43 44 #define X11_CLIPBOARD_IMPLEMENTATION_NAME "com.sun.star.datatransfer.X11ClipboardSupport" 45 46 namespace x11 { 47 48 class X11Clipboard : 49 public ::cppu::WeakComponentImplHelper4 < 50 ::com::sun::star::datatransfer::clipboard::XClipboardEx, 51 ::com::sun::star::datatransfer::clipboard::XClipboardNotifier, 52 ::com::sun::star::lang::XServiceInfo, 53 ::com::sun::star::lang::XInitialization 54 >, 55 public SelectionAdaptor 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 SelectionManager& m_rSelectionManager; 61 com::sun::star::uno::Reference< ::com::sun::star::lang::XInitialization > m_xSelectionManager; 62 ::std::list< com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardListener > > m_aListeners; 63 Atom m_aSelection; 64 65 protected: 66 67 68 friend class SelectionManager; 69 friend class X11_Transferable; 70 71 void fireChangedContentsEvent(); 72 void clearContents(); 73 74 public: 75 76 X11Clipboard( SelectionManager& rManager, Atom aSelection ); 77 virtual ~X11Clipboard(); 78 79 static X11Clipboard* get( const ::rtl::OUString& rDisplayName, Atom aSelection ); 80 81 /* 82 * XInitialization 83 */ 84 virtual void SAL_CALL initialize( const Sequence< Any >& arguments ) throw( ::com::sun::star::uno::Exception ); 85 86 /* 87 * XServiceInfo 88 */ 89 90 virtual ::rtl::OUString SAL_CALL getImplementationName( ) 91 throw(RuntimeException); 92 93 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) 94 throw(RuntimeException); 95 96 virtual Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) 97 throw(RuntimeException); 98 99 /* 100 * XClipboard 101 */ 102 103 virtual com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > SAL_CALL getContents() 104 throw(RuntimeException); 105 106 virtual void SAL_CALL setContents( 107 const com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& xTrans, 108 const com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardOwner >& xClipboardOwner ) 109 throw(RuntimeException); 110 111 virtual ::rtl::OUString SAL_CALL getName() 112 throw(RuntimeException); 113 114 /* 115 * XClipboardEx 116 */ 117 118 virtual sal_Int8 SAL_CALL getRenderingCapabilities() 119 throw(RuntimeException); 120 121 /* 122 * XClipboardNotifier 123 */ 124 virtual void SAL_CALL addClipboardListener( 125 const com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardListener >& listener ) 126 throw(RuntimeException); 127 128 virtual void SAL_CALL removeClipboardListener( 129 const com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardListener >& listener ) 130 throw(RuntimeException); 131 132 /* 133 * SelectionAdaptor 134 */ 135 virtual com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > getTransferable(); 136 virtual void clearTransferable(); 137 virtual void fireContentsChanged(); 138 virtual com::sun::star::uno::Reference< XInterface > getReference() throw(); 139 }; 140 141 // ------------------------------------------------------------------------ 142 143 Sequence< ::rtl::OUString > SAL_CALL X11Clipboard_getSupportedServiceNames(); 144 com::sun::star::uno::Reference< XInterface > SAL_CALL X11Clipboard_createInstance( 145 const com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & xMultiServiceFactory); 146 147 // ------------------------------------------------------------------------ 148 149 } // namepspace 150 151 #endif 152