Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 :
20 :
21 : #include <rtl/logfile.hxx>
22 : #include <uiconfiguration/moduleimagemanager.hxx>
23 : #include <threadhelp/resetableguard.hxx>
24 : #include <xml/imagesconfiguration.hxx>
25 : #include <uiconfiguration/graphicnameaccess.hxx>
26 : #include <services.h>
27 : #include "imagemanagerimpl.hxx"
28 :
29 : #include "properties.h"
30 :
31 : #include <com/sun/star/ui/UIElementType.hpp>
32 : #include <com/sun/star/ui/ConfigurationEvent.hpp>
33 : #include <com/sun/star/lang/DisposedException.hpp>
34 : #include <com/sun/star/beans/XPropertySet.hpp>
35 : #include <com/sun/star/beans/PropertyValue.hpp>
36 : #include <com/sun/star/embed/ElementModes.hpp>
37 : #include <com/sun/star/io/XStream.hpp>
38 : #include <com/sun/star/ui/ImageType.hpp>
39 : #include <com/sun/star/uri/XUriReferenceFactory.hpp>
40 : #include <com/sun/star/uri/XUriReference.hpp>
41 : #include <com/sun/star/uno/XComponentContext.hpp>
42 :
43 : #include <vcl/svapp.hxx>
44 : #include <rtl/ustrbuf.hxx>
45 : #include <osl/mutex.hxx>
46 : #include <osl/file.hxx>
47 : #include <comphelper/sequence.hxx>
48 : #include <unotools/ucbstreamhelper.hxx>
49 : #include <vcl/pngread.hxx>
50 : #include <vcl/pngwrite.hxx>
51 : #include <rtl/logfile.hxx>
52 :
53 : //_________________________________________________________________________________________________________________
54 : // namespaces
55 : //_________________________________________________________________________________________________________________
56 :
57 : using ::rtl::OUString;
58 : using ::com::sun::star::uno::Sequence;
59 : using ::com::sun::star::uno::XInterface;
60 : using ::com::sun::star::uno::Exception;
61 : using ::com::sun::star::uno::RuntimeException;
62 : using ::com::sun::star::uno::UNO_QUERY;
63 : using ::com::sun::star::uno::Any;
64 : using ::com::sun::star::uno::makeAny;
65 : using ::com::sun::star::graphic::XGraphic;
66 : using namespace ::com::sun::star;
67 : using namespace ::com::sun::star::io;
68 : using namespace ::com::sun::star::embed;
69 : using namespace ::com::sun::star::lang;
70 : using namespace ::com::sun::star::container;
71 : using namespace ::com::sun::star::beans;
72 : using namespace ::com::sun::star::ui;
73 :
74 : namespace framework
75 : {
76 8 : ModuleImageManager::ModuleImageManager( uno::Reference< XMultiServiceFactory > xServiceManager ) :
77 8 : ThreadHelpBase( &Application::GetSolarMutex() )
78 8 : , m_pImpl( new ImageManagerImpl(comphelper::getComponentContext(xServiceManager),static_cast< OWeakObject* >(this),true) )
79 : {
80 8 : }
81 :
82 16 : ModuleImageManager::~ModuleImageManager()
83 : {
84 16 : }
85 :
86 : // XComponent
87 8 : void SAL_CALL ModuleImageManager::dispose() throw (::com::sun::star::uno::RuntimeException)
88 : {
89 8 : m_pImpl->dispose();
90 8 : }
91 :
92 0 : void SAL_CALL ModuleImageManager::addEventListener( const uno::Reference< XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException)
93 : {
94 0 : m_pImpl->addEventListener(xListener);
95 0 : }
96 :
97 0 : void SAL_CALL ModuleImageManager::removeEventListener( const uno::Reference< XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException)
98 : {
99 : /* SAFE AREA ----------------------------------------------------------------------------------------------- */
100 0 : m_pImpl->removeEventListener(xListener);
101 0 : }
102 :
103 : // XInitialization
104 8 : void SAL_CALL ModuleImageManager::initialize( const Sequence< Any >& aArguments ) throw ( Exception, RuntimeException )
105 : {
106 8 : m_pImpl->initialize(aArguments);
107 8 : }
108 :
109 : // XImageManager
110 0 : void SAL_CALL ModuleImageManager::reset()
111 : throw (::com::sun::star::uno::RuntimeException)
112 : {
113 0 : m_pImpl->reset();
114 0 : }
115 :
116 0 : Sequence< ::rtl::OUString > SAL_CALL ModuleImageManager::getAllImageNames( ::sal_Int16 nImageType )
117 : throw (::com::sun::star::uno::RuntimeException)
118 : {
119 0 : return m_pImpl->getAllImageNames( nImageType );
120 : }
121 :
122 0 : ::sal_Bool SAL_CALL ModuleImageManager::hasImage( ::sal_Int16 nImageType, const ::rtl::OUString& aCommandURL )
123 : throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
124 : {
125 0 : return m_pImpl->hasImage(nImageType,aCommandURL);
126 : }
127 :
128 0 : Sequence< uno::Reference< XGraphic > > SAL_CALL ModuleImageManager::getImages(
129 : ::sal_Int16 nImageType,
130 : const Sequence< ::rtl::OUString >& aCommandURLSequence )
131 : throw ( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException )
132 : {
133 : RTL_LOGFILE_CONTEXT( aLog, "framework: ModuleImageManager::getImages" );
134 0 : return m_pImpl->getImages(nImageType,aCommandURLSequence);
135 : }
136 :
137 0 : void SAL_CALL ModuleImageManager::replaceImages(
138 : ::sal_Int16 nImageType,
139 : const Sequence< ::rtl::OUString >& aCommandURLSequence,
140 : const Sequence< uno::Reference< XGraphic > >& aGraphicsSequence )
141 : throw ( ::com::sun::star::lang::IllegalArgumentException,
142 : ::com::sun::star::lang::IllegalAccessException,
143 : ::com::sun::star::uno::RuntimeException)
144 : {
145 0 : m_pImpl->replaceImages(nImageType,aCommandURLSequence,aGraphicsSequence);
146 0 : }
147 :
148 0 : void SAL_CALL ModuleImageManager::removeImages( ::sal_Int16 nImageType, const Sequence< ::rtl::OUString >& aCommandURLSequence )
149 : throw ( ::com::sun::star::lang::IllegalArgumentException,
150 : ::com::sun::star::lang::IllegalAccessException,
151 : ::com::sun::star::uno::RuntimeException)
152 : {
153 0 : m_pImpl->removeImages(nImageType,aCommandURLSequence);
154 0 : }
155 :
156 0 : void SAL_CALL ModuleImageManager::insertImages( ::sal_Int16 nImageType, const Sequence< ::rtl::OUString >& aCommandURLSequence, const Sequence< uno::Reference< XGraphic > >& aGraphicSequence )
157 : throw ( ::com::sun::star::container::ElementExistException,
158 : ::com::sun::star::lang::IllegalArgumentException,
159 : ::com::sun::star::lang::IllegalAccessException,
160 : ::com::sun::star::uno::RuntimeException)
161 : {
162 0 : m_pImpl->insertImages(nImageType,aCommandURLSequence,aGraphicSequence);
163 0 : }
164 :
165 : // XUIConfiguration
166 236 : void SAL_CALL ModuleImageManager::addConfigurationListener( const uno::Reference< ::com::sun::star::ui::XUIConfigurationListener >& xListener )
167 : throw (::com::sun::star::uno::RuntimeException)
168 : {
169 236 : m_pImpl->addConfigurationListener(xListener);
170 236 : }
171 :
172 63 : void SAL_CALL ModuleImageManager::removeConfigurationListener( const uno::Reference< ::com::sun::star::ui::XUIConfigurationListener >& xListener )
173 : throw (::com::sun::star::uno::RuntimeException)
174 : {
175 63 : m_pImpl->removeConfigurationListener(xListener);
176 63 : }
177 :
178 : // XUIConfigurationPersistence
179 0 : void SAL_CALL ModuleImageManager::reload()
180 : throw ( ::com::sun::star::uno::Exception,
181 : ::com::sun::star::uno::RuntimeException )
182 : {
183 0 : m_pImpl->reload();
184 0 : }
185 :
186 0 : void SAL_CALL ModuleImageManager::store()
187 : throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
188 : {
189 0 : m_pImpl->store();
190 0 : }
191 :
192 0 : void SAL_CALL ModuleImageManager::storeToStorage( const uno::Reference< XStorage >& Storage )
193 : throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
194 : {
195 0 : m_pImpl->storeToStorage(Storage);
196 0 : }
197 :
198 0 : sal_Bool SAL_CALL ModuleImageManager::isModified()
199 : throw (::com::sun::star::uno::RuntimeException)
200 : {
201 0 : return m_pImpl->isModified();
202 : }
203 :
204 0 : sal_Bool SAL_CALL ModuleImageManager::isReadOnly() throw (::com::sun::star::uno::RuntimeException)
205 : {
206 0 : return m_pImpl->isReadOnly();
207 : }
208 :
209 : } // namespace framework
210 :
211 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|