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