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 __FRAMEWORK_UICONFIGURATION_IMAGEMANAGER_HXX_
29 #define __FRAMEWORK_UICONFIGURATION_IMAGEMANAGER_HXX_
30 
31 
32 /** Attention: stl headers must(!) be included at first. Otherwhise it can make trouble
33                with solaris headers ...
34 */
35 #include <vector>
36 #include <list>
37 #include <hash_map>
38 #include <memory>
39 
40 //_________________________________________________________________________________________________________________
41 //	my own includes
42 //_________________________________________________________________________________________________________________
43 #include <threadhelp/threadhelpbase.hxx>
44 #include <macros/generic.hxx>
45 #include <macros/xinterface.hxx>
46 #include <macros/xtypeprovider.hxx>
47 #include <macros/xserviceinfo.hxx>
48 #include <stdtypes.h>
49 #include <uiconfiguration/imagetype.hxx>
50 
51 //_________________________________________________________________________________________________________________
52 //	interface includes
53 //_________________________________________________________________________________________________________________
54 #include <com/sun/star/lang/XServiceInfo.hpp>
55 #include <com/sun/star/lang/XTypeProvider.hpp>
56 #include <com/sun/star/lang/XComponent.hpp>
57 #include <com/sun/star/ui/XUIConfigurationPersistence.hpp>
58 #include <com/sun/star/ui/XUIConfigurationStorage.hpp>
59 #include <com/sun/star/ui/XUIConfiguration.hpp>
60 #include <com/sun/star/ui/XImageManager.hpp>
61 #include <com/sun/star/lang/XInitialization.hpp>
62 #include <com/sun/star/ui/ConfigurationEvent.hpp>
63 #include <com/sun/star/embed/XTransactedObject.hpp>
64 #include <com/sun/star/ui/XImageManager.hpp>
65 
66 //_________________________________________________________________________________________________________________
67 //	other includes
68 //_________________________________________________________________________________________________________________
69 #include <cppuhelper/implbase2.hxx>
70 #include <cppuhelper/interfacecontainer.hxx>
71 #include <rtl/ustring.hxx>
72 
73 #include <vcl/image.hxx>
74 #include <tools/color.hxx>
75 #include <rtl/ref.hxx>
76 
77 #include <vector>
78 
79 namespace framework
80 {
81     class ImageManagerImpl;
82     class ImageManager :    private ThreadHelpBase						                  ,	// Struct for right initalization of mutex member! Must be first of baseclasses.
83 							public ::cppu::WeakImplHelper2< ::com::sun::star::ui::XImageManager, css::lang::XServiceInfo>
84     {
85         public:
86             //  XInterface, XTypeProvider, XServiceInfo
87             DECLARE_XSERVICEINFO
88 
89             ImageManager( com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > xServiceManager );
90             virtual ~ImageManager();
91 
92             // XComponent
93             virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException);
94             virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
95             virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException);
96 
97             // XInitialization
98             virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
99 
100             // XImageManager
101             virtual void SAL_CALL reset() throw (::com::sun::star::uno::RuntimeException);
102             virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getAllImageNames( ::sal_Int16 nImageType ) throw (::com::sun::star::uno::RuntimeException);
103             virtual ::sal_Bool SAL_CALL hasImage( ::sal_Int16 nImageType, const ::rtl::OUString& aCommandURL ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
104             virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > > SAL_CALL getImages( ::sal_Int16 nImageType, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aCommandURLSequence ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException);
105             virtual void SAL_CALL replaceImages( ::sal_Int16 nImageType, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aCommandURLSequence, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > >& aGraphicsSequence ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IllegalAccessException, ::com::sun::star::uno::RuntimeException);
106             virtual void SAL_CALL removeImages( ::sal_Int16 nImageType, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aResourceURLSequence ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IllegalAccessException, ::com::sun::star::uno::RuntimeException);
107             virtual void SAL_CALL insertImages( ::sal_Int16 nImageType, const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aCommandURLSequence, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > >& aGraphicSequence ) throw (::com::sun::star::container::ElementExistException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::IllegalAccessException, ::com::sun::star::uno::RuntimeException);
108 
109             // XUIConfiguration
110             virtual void SAL_CALL addConfigurationListener( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIConfigurationListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
111             virtual void SAL_CALL removeConfigurationListener( const ::com::sun::star::uno::Reference< ::com::sun::star::ui::XUIConfigurationListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
112 
113             // XUIConfigurationPersistence
114             virtual void SAL_CALL reload() throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
115             virtual void SAL_CALL store() throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
116             virtual void SAL_CALL storeToStorage( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& Storage ) throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
117             virtual sal_Bool SAL_CALL isModified() throw (::com::sun::star::uno::RuntimeException);
118             virtual sal_Bool SAL_CALL isReadOnly() throw (::com::sun::star::uno::RuntimeException);
119 
120             // Non-UNO methods
121             void setStorage( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& Storage ) throw (::com::sun::star::uno::RuntimeException);
122 
123         private:
124             ::std::auto_ptr<ImageManagerImpl> m_pImpl;
125    };
126 }
127 
128 #endif // __FRAMEWORK_UICONFIGURATION_IMAGEMANAGER_HXX_
129