Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : :
30 : : #include <rtl/logfile.hxx>
31 : : #include <uiconfiguration/moduleimagemanager.hxx>
32 : : #include <threadhelp/resetableguard.hxx>
33 : : #include <xml/imagesconfiguration.hxx>
34 : : #include <uiconfiguration/graphicnameaccess.hxx>
35 : : #include <services.h>
36 : : #include "imagemanagerimpl.hxx"
37 : :
38 : : #include "properties.h"
39 : :
40 : : #include <com/sun/star/ui/UIElementType.hpp>
41 : : #include <com/sun/star/ui/ConfigurationEvent.hpp>
42 : : #include <com/sun/star/lang/DisposedException.hpp>
43 : : #include <com/sun/star/beans/XPropertySet.hpp>
44 : : #include <com/sun/star/beans/PropertyValue.hpp>
45 : : #include <com/sun/star/embed/ElementModes.hpp>
46 : : #include <com/sun/star/io/XStream.hpp>
47 : : #include <com/sun/star/ui/ImageType.hpp>
48 : : #include <com/sun/star/uri/XUriReferenceFactory.hpp>
49 : : #include <com/sun/star/uri/XUriReference.hpp>
50 : : #include <com/sun/star/uno/XComponentContext.hpp>
51 : :
52 : : #include <vcl/svapp.hxx>
53 : : #include <rtl/ustrbuf.hxx>
54 : : #include <osl/mutex.hxx>
55 : : #include <osl/file.hxx>
56 : : #include <comphelper/sequence.hxx>
57 : : #include <unotools/ucbstreamhelper.hxx>
58 : : #include <vcl/pngread.hxx>
59 : : #include <vcl/pngwrite.hxx>
60 : : #include <rtl/logfile.hxx>
61 : :
62 : : //_________________________________________________________________________________________________________________
63 : : // namespaces
64 : : //_________________________________________________________________________________________________________________
65 : :
66 : : using ::rtl::OUString;
67 : : using ::com::sun::star::uno::Sequence;
68 : : using ::com::sun::star::uno::XInterface;
69 : : using ::com::sun::star::uno::Exception;
70 : : using ::com::sun::star::uno::RuntimeException;
71 : : using ::com::sun::star::uno::UNO_QUERY;
72 : : using ::com::sun::star::uno::Any;
73 : : using ::com::sun::star::uno::makeAny;
74 : : using ::com::sun::star::graphic::XGraphic;
75 : : using namespace ::com::sun::star;
76 : : using namespace ::com::sun::star::io;
77 : : using namespace ::com::sun::star::embed;
78 : : using namespace ::com::sun::star::lang;
79 : : using namespace ::com::sun::star::container;
80 : : using namespace ::com::sun::star::beans;
81 : : using namespace ::com::sun::star::ui;
82 : :
83 : : namespace framework
84 : : {
85 : 145 : ModuleImageManager::ModuleImageManager( uno::Reference< XMultiServiceFactory > xServiceManager ) :
86 : 145 : ThreadHelpBase( &Application::GetSolarMutex() )
87 [ + - ][ + - ]: 145 : , m_pImpl( new ImageManagerImpl(xServiceManager,true) )
[ + - ]
88 : : {
89 : 145 : }
90 : :
91 [ + - ][ + - ]: 145 : ModuleImageManager::~ModuleImageManager()
92 : : {
93 [ - + ]: 290 : }
94 : :
95 : : // XComponent
96 : 145 : void SAL_CALL ModuleImageManager::dispose() throw (::com::sun::star::uno::RuntimeException)
97 : : {
98 [ + - ]: 145 : m_pImpl->dispose(static_cast< OWeakObject* >(this));
99 : 145 : }
100 : :
101 : 0 : void SAL_CALL ModuleImageManager::addEventListener( const uno::Reference< XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException)
102 : : {
103 : 0 : m_pImpl->addEventListener(xListener);
104 : 0 : }
105 : :
106 : 0 : void SAL_CALL ModuleImageManager::removeEventListener( const uno::Reference< XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException)
107 : : {
108 : : /* SAFE AREA ----------------------------------------------------------------------------------------------- */
109 : 0 : m_pImpl->removeEventListener(xListener);
110 : 0 : }
111 : :
112 : : // XInitialization
113 : 145 : void SAL_CALL ModuleImageManager::initialize( const Sequence< Any >& aArguments ) throw ( Exception, RuntimeException )
114 : : {
115 : 145 : m_pImpl->initialize(aArguments);
116 : 145 : }
117 : :
118 : : // XImageManager
119 : 0 : void SAL_CALL ModuleImageManager::reset()
120 : : throw (::com::sun::star::uno::RuntimeException)
121 : : {
122 [ # # ]: 0 : m_pImpl->reset(static_cast< OWeakObject* >(this));
123 : 0 : }
124 : :
125 : 0 : Sequence< ::rtl::OUString > SAL_CALL ModuleImageManager::getAllImageNames( ::sal_Int16 nImageType )
126 : : throw (::com::sun::star::uno::RuntimeException)
127 : : {
128 : 0 : return m_pImpl->getAllImageNames( nImageType );
129 : : }
130 : :
131 : 0 : ::sal_Bool SAL_CALL ModuleImageManager::hasImage( ::sal_Int16 nImageType, const ::rtl::OUString& aCommandURL )
132 : : throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
133 : : {
134 : 0 : return m_pImpl->hasImage(nImageType,aCommandURL);
135 : : }
136 : :
137 : 17934 : Sequence< uno::Reference< XGraphic > > SAL_CALL ModuleImageManager::getImages(
138 : : ::sal_Int16 nImageType,
139 : : const Sequence< ::rtl::OUString >& aCommandURLSequence )
140 : : throw ( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException )
141 : : {
142 : : RTL_LOGFILE_CONTEXT( aLog, "framework: ModuleImageManager::getImages" );
143 : 17934 : return m_pImpl->getImages(nImageType,aCommandURLSequence);
144 : : }
145 : :
146 : 0 : void SAL_CALL ModuleImageManager::replaceImages(
147 : : ::sal_Int16 nImageType,
148 : : const Sequence< ::rtl::OUString >& aCommandURLSequence,
149 : : const Sequence< uno::Reference< XGraphic > >& aGraphicsSequence )
150 : : throw ( ::com::sun::star::lang::IllegalArgumentException,
151 : : ::com::sun::star::lang::IllegalAccessException,
152 : : ::com::sun::star::uno::RuntimeException)
153 : : {
154 [ # # ]: 0 : m_pImpl->replaceImages(static_cast< OWeakObject* >(this),nImageType,aCommandURLSequence,aGraphicsSequence);
155 : 0 : }
156 : :
157 : 0 : void SAL_CALL ModuleImageManager::removeImages( ::sal_Int16 nImageType, const Sequence< ::rtl::OUString >& aCommandURLSequence )
158 : : throw ( ::com::sun::star::lang::IllegalArgumentException,
159 : : ::com::sun::star::lang::IllegalAccessException,
160 : : ::com::sun::star::uno::RuntimeException)
161 : : {
162 [ # # ]: 0 : m_pImpl->removeImages(static_cast< OWeakObject* >(this),nImageType,aCommandURLSequence);
163 : 0 : }
164 : :
165 : 0 : void SAL_CALL ModuleImageManager::insertImages( ::sal_Int16 nImageType, const Sequence< ::rtl::OUString >& aCommandURLSequence, const Sequence< uno::Reference< XGraphic > >& aGraphicSequence )
166 : : throw ( ::com::sun::star::container::ElementExistException,
167 : : ::com::sun::star::lang::IllegalArgumentException,
168 : : ::com::sun::star::lang::IllegalAccessException,
169 : : ::com::sun::star::uno::RuntimeException)
170 : : {
171 [ # # ]: 0 : m_pImpl->insertImages(static_cast< OWeakObject* >(this),nImageType,aCommandURLSequence,aGraphicSequence);
172 : 0 : }
173 : :
174 : : // XUIConfiguration
175 : 45935 : void SAL_CALL ModuleImageManager::addConfigurationListener( const uno::Reference< ::com::sun::star::ui::XUIConfigurationListener >& xListener )
176 : : throw (::com::sun::star::uno::RuntimeException)
177 : : {
178 : 45935 : m_pImpl->addConfigurationListener(xListener);
179 : 45935 : }
180 : :
181 : 45844 : void SAL_CALL ModuleImageManager::removeConfigurationListener( const uno::Reference< ::com::sun::star::ui::XUIConfigurationListener >& xListener )
182 : : throw (::com::sun::star::uno::RuntimeException)
183 : : {
184 : 45844 : m_pImpl->removeConfigurationListener(xListener);
185 : 45844 : }
186 : :
187 : : // XUIConfigurationPersistence
188 : 0 : void SAL_CALL ModuleImageManager::reload()
189 : : throw ( ::com::sun::star::uno::Exception,
190 : : ::com::sun::star::uno::RuntimeException )
191 : : {
192 [ # # ]: 0 : m_pImpl->reload(static_cast< OWeakObject* >(this));
193 : 0 : }
194 : :
195 : 0 : void SAL_CALL ModuleImageManager::store()
196 : : throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
197 : : {
198 : 0 : m_pImpl->store();
199 : 0 : }
200 : :
201 : 0 : void SAL_CALL ModuleImageManager::storeToStorage( const uno::Reference< XStorage >& Storage )
202 : : throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
203 : : {
204 : 0 : m_pImpl->storeToStorage(Storage);
205 : 0 : }
206 : :
207 : 0 : sal_Bool SAL_CALL ModuleImageManager::isModified()
208 : : throw (::com::sun::star::uno::RuntimeException)
209 : : {
210 : 0 : return m_pImpl->isModified();
211 : : }
212 : :
213 : 0 : sal_Bool SAL_CALL ModuleImageManager::isReadOnly() throw (::com::sun::star::uno::RuntimeException)
214 : : {
215 : 0 : return m_pImpl->isReadOnly();
216 : : }
217 : :
218 : : } // namespace framework
219 : :
220 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|