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 _OS2CLIPBOARD_HXX_ 29 #define _OS2CLIPBOARD_HXX_ 30 31 #include <rtl/ustring.hxx> 32 #include <sal/types.h> 33 #include <cppuhelper/compbase4.hxx> 34 #include <com/sun/star/datatransfer/clipboard/XClipboardEx.hpp> 35 #include <com/sun/star/datatransfer/clipboard/XClipboardOwner.hpp> 36 #include <com/sun/star/datatransfer/clipboard/XClipboardListener.hpp> 37 #include <com/sun/star/datatransfer/clipboard/XClipboardNotifier.hpp> 38 #include <com/sun/star/lang/XServiceInfo.hpp> 39 #include <com/sun/star/lang/XInitialization.hpp> 40 #include <com/sun/star/datatransfer/clipboard/RenderingCapabilities.hpp> 41 #include "Os2Transferable.hxx" 42 43 // the service names 44 #define OS2_CLIPBOARD_SERVICE_NAME "com.sun.star.datatransfer.clipboard.SystemClipboard" 45 46 // the implementation names 47 #define OS2_CLIPBOARD_IMPL_NAME "com.sun.star.datatransfer.clipboard.Os2Clipboard" 48 49 // the registry key names 50 #define OS2_CLIPBOARD_REGKEY_NAME "/com.sun.star.datatransfer.clipboard.Os2Clipboard/UNO/SERVICES/com.sun.star.datatransfer.clipboard.SystemClipboard" 51 52 namespace os2 { 53 54 class Os2Clipboard : 55 //public cppu::WeakComponentImplHelper3< ::com::sun::star::datatransfer::clipboard::XClipboardEx, ::com::sun::star::datatransfer::clipboard::XClipboardNotifier, ::com::sun::star::lang::XServiceInfo > 56 public ::cppu::WeakComponentImplHelper4 < \ 57 ::com::sun::star::datatransfer::clipboard::XClipboardEx, \ 58 ::com::sun::star::datatransfer::clipboard::XClipboardNotifier, \ 59 ::com::sun::star::lang::XServiceInfo, \ 60 ::com::sun::star::lang::XInitialization > 61 { 62 63 public: 64 Os2Clipboard(); 65 ~Os2Clipboard(); 66 67 /* 68 * XInitialization 69 */ 70 virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) 71 throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException); 72 73 /* 74 * XServiceInfo 75 */ 76 virtual ::rtl::OUString SAL_CALL getImplementationName() 77 throw(::com::sun::star::uno::RuntimeException); 78 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) 79 throw(::com::sun::star::uno::RuntimeException); 80 81 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() 82 throw(::com::sun::star::uno::RuntimeException); 83 84 /* 85 * XClipboard 86 */ 87 virtual ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > SAL_CALL getContents() 88 throw( ::com::sun::star::uno::RuntimeException ); 89 virtual void SAL_CALL setContents( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& xTransferable, const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardOwner >& xClipboardOwner ) 90 throw( ::com::sun::star::uno::RuntimeException ); 91 virtual ::rtl::OUString SAL_CALL getName() 92 throw( ::com::sun::star::uno::RuntimeException ); 93 94 /* 95 * XClipboardEx 96 */ 97 virtual sal_Int8 SAL_CALL getRenderingCapabilities() 98 throw( ::com::sun::star::uno::RuntimeException ); 99 100 /* 101 * XClipboardNotifier 102 */ 103 virtual void SAL_CALL addClipboardListener( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardListener >& listener ) 104 throw( ::com::sun::star::uno::RuntimeException ); 105 virtual void SAL_CALL removeClipboardListener( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardListener >& listener ) 106 throw( ::com::sun::star::uno::RuntimeException ); 107 void SAL_CALL notifyAllClipboardListener( ); 108 109 public: 110 sal_Bool m_bInSetClipboardData; 111 112 private: 113 HAB hAB; 114 HWND hObjWnd; 115 ULONG hText, hBitmap; // handles to previous clipboard data 116 117 ::osl::Mutex m_aMutex; 118 ::rtl::OUString m_aName; 119 120 ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > m_aContents; 121 ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardOwner > m_aOwner; 122 123 sal_Bool m_bInitialized; 124 125 }; 126 127 } // namespace Os2 128 129 // ------------------------------------------------------------------------ 130 131 ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL Os2Clipboard_getSupportedServiceNames(); 132 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL Os2Clipboard_createInstance( 133 const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & xMultiServiceFactory); 134 135 #endif 136 137