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 29 #ifndef _WINCLIPBIMPL_HXX_ 30 #define _WINCLIPBIMPL_HXX_ 31 32 //------------------------------------------------------------------------ 33 // includes 34 //------------------------------------------------------------------------ 35 36 #include <sal/types.h> 37 #include <rtl/ustring.hxx> 38 #include <com/sun/star/datatransfer/XTransferable.hpp> 39 #include <com/sun/star/datatransfer/clipboard/XClipboardListener.hpp> 40 #include <com/sun/star/datatransfer/clipboard/XClipboardOwner.hpp> 41 #include "..\..\inc\MtaOleClipb.hxx" 42 43 #if defined _MSC_VER 44 #pragma warning(push,1) 45 #endif 46 #include <windows.h> 47 #if defined _MSC_VER 48 #pragma warning(pop) 49 #endif 50 51 class CWinClipboard; 52 class CXNotifyingDataObject; 53 54 //--------------------------------------------------- 55 // impl class to avoid deadlocks between XTDataObject 56 // and the clipboard implementation 57 //--------------------------------------------------- 58 59 class CWinClipbImpl 60 { 61 public: 62 ~CWinClipbImpl( ); 63 64 protected: 65 CWinClipbImpl( const ::rtl::OUString& aClipboardName, CWinClipboard* theWinClipboard ); 66 67 ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > SAL_CALL getContents( ) 68 throw( ::com::sun::star::uno::RuntimeException ); 69 70 void SAL_CALL setContents( 71 const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& xTransferable, 72 const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardOwner >& xClipboardOwner ) 73 throw( ::com::sun::star::uno::RuntimeException ); 74 75 ::rtl::OUString SAL_CALL getName( ) throw( ::com::sun::star::uno::RuntimeException ); 76 77 //------------------------------------------------ 78 // XClipboardEx 79 //------------------------------------------------ 80 81 sal_Int8 SAL_CALL getRenderingCapabilities( ) throw( ::com::sun::star::uno::RuntimeException ); 82 83 //------------------------------------------------ 84 // XFlushableClipboard 85 //------------------------------------------------ 86 87 void SAL_CALL flushClipboard( ) throw( com::sun::star::uno::RuntimeException ); 88 89 //------------------------------------------------ 90 // XComponent 91 //------------------------------------------------ 92 93 void SAL_CALL dispose( ) throw( ::com::sun::star::uno::RuntimeException ); 94 95 //------------------------------------------------ 96 // member functions 97 //------------------------------------------------ 98 99 void SAL_CALL registerClipboardViewer( ); 100 void SAL_CALL unregisterClipboardViewer( ); 101 102 static void WINAPI onClipboardContentChanged( void ); 103 104 private: 105 void SAL_CALL onReleaseDataObject( CXNotifyingDataObject* theCaller ); 106 107 private: 108 ::rtl::OUString m_itsName; 109 CMtaOleClipboard m_MtaOleClipboard; 110 CWinClipboard* m_pWinClipboard; 111 CXNotifyingDataObject* m_pCurrentClipContent; 112 osl::Mutex m_ClipContentMutex; 113 114 static osl::Mutex s_aMutex; 115 static CWinClipbImpl* s_pCWinClipbImpl; 116 117 private: 118 CWinClipbImpl( const CWinClipbImpl& ); 119 CWinClipbImpl& operator=( const CWinClipbImpl& ); 120 121 friend class CWinClipboard; 122 friend class CXNotifyingDataObject; 123 }; 124 125 #endif 126