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 _DTRANS_CLIPBOARDMANAGER_HXX_
29 #define _DTRANS_CLIPBOARDMANAGER_HXX_
30 
31 #include <cppuhelper/compbase3.hxx>
32 
33 #ifndef _COM_SUN_STAR_DATATRANSFER_CLIPBAORD_XCLIPBOARDMANAGER_HPP_
34 #include <com/sun/star/datatransfer/clipboard/XClipboardManager.hpp>
35 #endif
36 #include <com/sun/star/lang/XServiceInfo.hpp>
37 
38 #include <map>
39 
40 // ------------------------------------------------------------------------
41 
42 #define CLIPBOARDMANAGER_IMPLEMENTATION_NAME "com.sun.star.comp.datatransfer.ClipboardManager"
43 
44 // ------------------------------------------------------------------------
45 
46 typedef ::std::map< ::rtl::OUString, ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard > > ClipboardMap;
47 
48 // ------------------------------------------------------------------------
49 
50 namespace dtrans
51 {
52 
53     class ClipboardManager : public ::cppu::WeakComponentImplHelper3 < \
54     ::com::sun::star::datatransfer::clipboard::XClipboardManager, \
55     ::com::sun::star::lang::XEventListener, \
56     ::com::sun::star::lang::XServiceInfo >
57     {
58         ClipboardMap m_aClipboardMap;
59         ::osl::Mutex m_aMutex;
60 
61         const ::rtl::OUString m_aDefaultName;
62 
63         virtual ~ClipboardManager();
64     protected:
65         using WeakComponentImplHelperBase::disposing;
66     public:
67 
68         ClipboardManager();
69 
70         /*
71          * XServiceInfo
72          */
73 
74         virtual ::rtl::OUString SAL_CALL getImplementationName(  )
75             throw(::com::sun::star::uno::RuntimeException);
76 
77         virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName )
78             throw(::com::sun::star::uno::RuntimeException);
79 
80         virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(  )
81             throw(::com::sun::star::uno::RuntimeException);
82 
83         /*
84          * XComponent
85          */
86 
87         virtual void SAL_CALL dispose()
88             throw(::com::sun::star::uno::RuntimeException);
89 
90         /*
91          * XEventListener
92          */
93 
94         virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source )
95             throw(::com::sun::star::uno::RuntimeException);
96 
97         /*
98          * XClipboardManager
99          */
100 
101         virtual ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard > SAL_CALL getClipboard( const ::rtl::OUString& aName )
102             throw(::com::sun::star::container::NoSuchElementException,
103                   ::com::sun::star::uno::RuntimeException);
104 
105         virtual void SAL_CALL addClipboard( const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::clipboard::XClipboard >& xClipboard )
106             throw(::com::sun::star::lang::IllegalArgumentException,
107                   ::com::sun::star::container::ElementExistException,
108                   ::com::sun::star::uno::RuntimeException);
109 
110         virtual void SAL_CALL removeClipboard( const ::rtl::OUString& aName )
111             throw(::com::sun::star::uno::RuntimeException);
112 
113         virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL listClipboardNames(  )
114             throw(::com::sun::star::uno::RuntimeException);
115 
116 
117     };
118 
119 }
120 
121 // ------------------------------------------------------------------------
122 
123 ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL ClipboardManager_getSupportedServiceNames();
124 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL ClipboardManager_createInstance(
125 	const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & xMultiServiceFactory);
126 
127 #endif
128