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