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_CLIPBOARDMANAGER_HXX_ 25 #define _DTRANS_CLIPBOARDMANAGER_HXX_ 26 27 #include <cppuhelper/compbase3.hxx> 28 29 #ifndef _COM_SUN_STAR_DATATRANSFER_CLIPBAORD_XCLIPBOARDMANAGER_HPP_ 30 #include <com/sun/star/datatransfer/clipboard/XClipboardManager.hpp> 31 #endif 32 #include <com/sun/star/lang/XServiceInfo.hpp> 33 34 #include <map> 35 36 // ------------------------------------------------------------------------ 37 38 #define CLIPBOARDMANAGER_IMPLEMENTATION_NAME "com.sun.star.comp.datatransfer.ClipboardManager" 39 40 // ------------------------------------------------------------------------ 41 42 typedef ::std::map< ::rtl::OUString, ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard > > ClipboardMap; 43 44 // ------------------------------------------------------------------------ 45 46 namespace dtrans 47 { 48 49 class ClipboardManager : public ::cppu::WeakComponentImplHelper3 < \ 50 ::com::sun::star::datatransfer::clipboard::XClipboardManager, \ 51 ::com::sun::star::lang::XEventListener, \ 52 ::com::sun::star::lang::XServiceInfo > 53 { 54 ClipboardMap m_aClipboardMap; 55 ::osl::Mutex m_aMutex; 56 57 const ::rtl::OUString m_aDefaultName; 58 59 virtual ~ClipboardManager(); 60 protected: 61 using WeakComponentImplHelperBase::disposing; 62 public: 63 64 ClipboardManager(); 65 66 /* 67 * XServiceInfo 68 */ 69 70 virtual ::rtl::OUString SAL_CALL getImplementationName( ) 71 throw(::com::sun::star::uno::RuntimeException); 72 73 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) 74 throw(::com::sun::star::uno::RuntimeException); 75 76 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) 77 throw(::com::sun::star::uno::RuntimeException); 78 79 /* 80 * XComponent 81 */ 82 83 virtual void SAL_CALL dispose() 84 throw(::com::sun::star::uno::RuntimeException); 85 86 /* 87 * XEventListener 88 */ 89 90 virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) 91 throw(::com::sun::star::uno::RuntimeException); 92 93 /* 94 * XClipboardManager 95 */ 96 97 virtual ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard > SAL_CALL getClipboard( const ::rtl::OUString& aName ) 98 throw(::com::sun::star::container::NoSuchElementException, 99 ::com::sun::star::uno::RuntimeException); 100 101 virtual void SAL_CALL addClipboard( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard >& xClipboard ) 102 throw(::com::sun::star::lang::IllegalArgumentException, 103 ::com::sun::star::container::ElementExistException, 104 ::com::sun::star::uno::RuntimeException); 105 106 virtual void SAL_CALL removeClipboard( const ::rtl::OUString& aName ) 107 throw(::com::sun::star::uno::RuntimeException); 108 109 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL listClipboardNames( ) 110 throw(::com::sun::star::uno::RuntimeException); 111 112 113 }; 114 115 } 116 117 // ------------------------------------------------------------------------ 118 119 ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL ClipboardManager_getSupportedServiceNames(); 120 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL ClipboardManager_createInstance( 121 const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & xMultiServiceFactory); 122 123 #endif 124