Update ooo320-m1
[ooovba.git] / dtrans / source / os2 / clipb / Os2Clipboard.hxx
blob08bf811ea29da0554c38c34ca015cc9fd7a8b156
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: Os2Clipboard.hxx,v $
10 * $Revision: 1.5 $
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 ************************************************************************/
31 #ifndef _OS2CLIPBOARD_HXX_
32 #define _OS2CLIPBOARD_HXX_
34 #include <rtl/ustring.hxx>
35 #include <sal/types.h>
36 #include <cppuhelper/compbase4.hxx>
37 #include <com/sun/star/datatransfer/clipboard/XClipboardEx.hpp>
38 #include <com/sun/star/datatransfer/clipboard/XClipboardOwner.hpp>
39 #include <com/sun/star/datatransfer/clipboard/XClipboardListener.hpp>
40 #include <com/sun/star/datatransfer/clipboard/XClipboardNotifier.hpp>
41 #include <com/sun/star/lang/XServiceInfo.hpp>
42 #include <com/sun/star/lang/XInitialization.hpp>
43 #include <com/sun/star/datatransfer/clipboard/RenderingCapabilities.hpp>
44 #include "Os2Transferable.hxx"
46 // the service names
47 #define OS2_CLIPBOARD_SERVICE_NAME "com.sun.star.datatransfer.clipboard.SystemClipboard"
49 // the implementation names
50 #define OS2_CLIPBOARD_IMPL_NAME "com.sun.star.datatransfer.clipboard.Os2Clipboard"
52 // the registry key names
53 #define OS2_CLIPBOARD_REGKEY_NAME "/com.sun.star.datatransfer.clipboard.Os2Clipboard/UNO/SERVICES/com.sun.star.datatransfer.clipboard.SystemClipboard"
55 namespace os2 {
57 class Os2Clipboard :
58 //public cppu::WeakComponentImplHelper3< ::com::sun::star::datatransfer::clipboard::XClipboardEx, ::com::sun::star::datatransfer::clipboard::XClipboardNotifier, ::com::sun::star::lang::XServiceInfo >
59 public ::cppu::WeakComponentImplHelper4 < \
60 ::com::sun::star::datatransfer::clipboard::XClipboardEx, \
61 ::com::sun::star::datatransfer::clipboard::XClipboardNotifier, \
62 ::com::sun::star::lang::XServiceInfo, \
63 ::com::sun::star::lang::XInitialization >
66 public:
67 Os2Clipboard();
68 ~Os2Clipboard();
71 * XInitialization
73 virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
74 throw(::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
77 * XServiceInfo
79 virtual ::rtl::OUString SAL_CALL getImplementationName()
80 throw(::com::sun::star::uno::RuntimeException);
81 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
82 throw(::com::sun::star::uno::RuntimeException);
84 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames()
85 throw(::com::sun::star::uno::RuntimeException);
88 * XClipboard
90 virtual ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > SAL_CALL getContents()
91 throw( ::com::sun::star::uno::RuntimeException );
92 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 )
93 throw( ::com::sun::star::uno::RuntimeException );
94 virtual ::rtl::OUString SAL_CALL getName()
95 throw( ::com::sun::star::uno::RuntimeException );
98 * XClipboardEx
100 virtual sal_Int8 SAL_CALL getRenderingCapabilities()
101 throw( ::com::sun::star::uno::RuntimeException );
104 * XClipboardNotifier
106 virtual void SAL_CALL addClipboardListener( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardListener >& listener )
107 throw( ::com::sun::star::uno::RuntimeException );
108 virtual void SAL_CALL removeClipboardListener( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardListener >& listener )
109 throw( ::com::sun::star::uno::RuntimeException );
110 void SAL_CALL notifyAllClipboardListener( );
112 public:
113 sal_Bool m_bInSetClipboardData;
115 private:
116 HAB hAB;
117 HWND hObjWnd;
118 ULONG hText, hBitmap; // handles to previous clipboard data
120 ::osl::Mutex m_aMutex;
121 ::rtl::OUString m_aName;
123 ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable > m_aContents;
124 ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboardOwner > m_aOwner;
126 sal_Bool m_bInitialized;
130 } // namespace Os2
132 // ------------------------------------------------------------------------
134 ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL Os2Clipboard_getSupportedServiceNames();
135 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL Os2Clipboard_createInstance(
136 const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & xMultiServiceFactory);
138 #endif