update dev300-m58
[ooovba.git] / dtrans / source / win32 / clipb / WinClipboard.hxx
blobea0dd27da458c32e0321067c9ed9d944c3f98ec2
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: WinClipboard.hxx,v $
10 * $Revision: 1.11 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
32 #ifndef _WINCLIPBOARD_HXX_
33 #define _WINCLIPBOARD_HXX_
36 //------------------------------------------------------------------------
37 // includes
38 //------------------------------------------------------------------------
40 #include <rtl/ustring.hxx>
41 #include <sal/types.h>
42 #include <cppuhelper/compbase4.hxx>
43 #include <com/sun/star/datatransfer/XTransferable.hpp>
44 #include <com/sun/star/datatransfer/clipboard/XClipboardEx.hpp>
45 #include <com/sun/star/datatransfer/clipboard/XClipboardOwner.hpp>
46 #include <com/sun/star/datatransfer/clipboard/XClipboardListener.hpp>
47 #include <com/sun/star/datatransfer/clipboard/XClipboardNotifier.hpp>
48 #include <com/sun/star/datatransfer/clipboard/XFlushableClipboard.hpp>
49 #include <com/sun/star/lang/XServiceInfo.hpp>
50 #include <osl/conditn.hxx>
52 #include <memory>
54 // forward
55 class CWinClipbImpl;
57 //------------------------------------------------------------------------
58 // implements the XClipboard[Ex] ... interfaces
59 // for the clipboard viewer mechanism we need a static callback function
60 // and a static member to reasocciate from this static function to the
61 // class instance
62 // watch out: we are using only one static member variable and not a list
63 // because we assume to be instanciated only once
64 // this will be asured by an OneInstanceFactory of the service and not
65 // by this class!
66 //------------------------------------------------------------------------
68 // helper class, so that the mutex is constructed
69 // before the constructor of WeakComponentImplHelper
70 // will be called and initialized with this mutex
71 class CWinClipboardDummy
73 protected:
74 osl::Mutex m_aMutex;
75 osl::Mutex m_aCbListenerMutex;
78 class CWinClipboard :
79 public CWinClipboardDummy,
80 public cppu::WeakComponentImplHelper4<
81 ::com::sun::star::datatransfer::clipboard::XClipboardEx, \
82 ::com::sun::star::datatransfer::clipboard::XFlushableClipboard,
83 ::com::sun::star::datatransfer::clipboard::XClipboardNotifier,
84 ::com::sun::star::lang::XServiceInfo >
86 public:
87 CWinClipboard( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& rServiceManager,
88 const ::rtl::OUString& aClipboardName );
90 //------------------------------------------------
91 // XClipboard
92 //------------------------------------------------
94 virtual ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > SAL_CALL getContents( )
95 throw( ::com::sun::star::uno::RuntimeException );
97 virtual void SAL_CALL setContents(
98 const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& xTransferable,
99 const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardOwner >& xClipboardOwner )
100 throw( ::com::sun::star::uno::RuntimeException );
102 virtual ::rtl::OUString SAL_CALL getName( )
103 throw( ::com::sun::star::uno::RuntimeException );
105 //------------------------------------------------
106 // XFlushableClipboard
107 //------------------------------------------------
109 virtual void SAL_CALL flushClipboard( ) throw( com::sun::star::uno::RuntimeException );
111 //------------------------------------------------
112 // XClipboardEx
113 //------------------------------------------------
115 virtual sal_Int8 SAL_CALL getRenderingCapabilities( ) throw( ::com::sun::star::uno::RuntimeException );
117 //------------------------------------------------
118 // XClipboardNotifier
119 //------------------------------------------------
121 virtual void SAL_CALL addClipboardListener(
122 const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardListener >& listener )
123 throw( ::com::sun::star::uno::RuntimeException );
125 virtual void SAL_CALL removeClipboardListener(
126 const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardListener >& listener )
127 throw( ::com::sun::star::uno::RuntimeException );
129 //------------------------------------------------
130 // overwrite base class method, which is called
131 // by base class dispose function
132 //------------------------------------------------
134 virtual void SAL_CALL disposing();
136 //------------------------------------------------
137 // XServiceInfo
138 //------------------------------------------------
140 virtual ::rtl::OUString SAL_CALL getImplementationName( )
141 throw(::com::sun::star::uno::RuntimeException);
143 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
144 throw(::com::sun::star::uno::RuntimeException);
146 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( )
147 throw(::com::sun::star::uno::RuntimeException);
149 private:
150 void SAL_CALL notifyAllClipboardListener( );
152 private:
153 ::std::auto_ptr< CWinClipbImpl > m_pImpl;
154 ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_SrvMgr;
156 friend class CWinClipbImpl;
160 #endif