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 <uiconfiguration/moduleimagemanager.hxx>
22 : #include <threadhelp/resetableguard.hxx>
23 : #include <xml/imagesconfiguration.hxx>
24 : #include <uiconfiguration/graphicnameaccess.hxx>
25 : #include <services.h>
26 : #include "imagemanagerimpl.hxx"
27 :
28 : #include "properties.h"
29 :
30 : #include <com/sun/star/ui/UIElementType.hpp>
31 : #include <com/sun/star/ui/ConfigurationEvent.hpp>
32 : #include <com/sun/star/lang/DisposedException.hpp>
33 : #include <com/sun/star/beans/XPropertySet.hpp>
34 : #include <com/sun/star/beans/PropertyValue.hpp>
35 : #include <com/sun/star/embed/ElementModes.hpp>
36 : #include <com/sun/star/io/XStream.hpp>
37 : #include <com/sun/star/ui/ImageType.hpp>
38 : #include <com/sun/star/uri/XUriReferenceFactory.hpp>
39 : #include <com/sun/star/uri/XUriReference.hpp>
40 : #include <com/sun/star/uno/XComponentContext.hpp>
41 :
42 : #include <vcl/svapp.hxx>
43 : #include <rtl/ustrbuf.hxx>
44 : #include <osl/mutex.hxx>
45 : #include <osl/file.hxx>
46 : #include <comphelper/sequence.hxx>
47 : #include <unotools/ucbstreamhelper.hxx>
48 : #include <vcl/pngread.hxx>
49 : #include <vcl/pngwrite.hxx>
50 :
51 : //_________________________________________________________________________________________________________________
52 : // namespaces
53 : //_________________________________________________________________________________________________________________
54 :
55 : using ::com::sun::star::uno::Sequence;
56 : using ::com::sun::star::uno::XInterface;
57 : using ::com::sun::star::uno::Exception;
58 : using ::com::sun::star::uno::RuntimeException;
59 : using ::com::sun::star::uno::UNO_QUERY;
60 : using ::com::sun::star::uno::Any;
61 : using ::com::sun::star::uno::makeAny;
62 : using ::com::sun::star::graphic::XGraphic;
63 : using namespace ::com::sun::star;
64 : using namespace ::com::sun::star::io;
65 : using namespace ::com::sun::star::embed;
66 : using namespace ::com::sun::star::lang;
67 : using namespace ::com::sun::star::container;
68 : using namespace ::com::sun::star::beans;
69 : using namespace ::com::sun::star::ui;
70 :
71 : namespace framework
72 : {
73 74 : ModuleImageManager::ModuleImageManager( const uno::Reference< uno::XComponentContext >& xContext ) :
74 74 : ThreadHelpBase( &Application::GetSolarMutex() )
75 74 : , m_pImpl( new ImageManagerImpl(xContext,static_cast< OWeakObject* >(this),true) )
76 : {
77 74 : }
78 :
79 148 : ModuleImageManager::~ModuleImageManager()
80 : {
81 148 : }
82 :
83 : // XComponent
84 74 : void SAL_CALL ModuleImageManager::dispose() throw (::com::sun::star::uno::RuntimeException)
85 : {
86 74 : m_pImpl->dispose();
87 74 : }
88 :
89 0 : void SAL_CALL ModuleImageManager::addEventListener( const uno::Reference< XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException)
90 : {
91 0 : m_pImpl->addEventListener(xListener);
92 0 : }
93 :
94 0 : void SAL_CALL ModuleImageManager::removeEventListener( const uno::Reference< XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException)
95 : {
96 : /* SAFE AREA ----------------------------------------------------------------------------------------------- */
97 0 : m_pImpl->removeEventListener(xListener);
98 0 : }
99 :
100 : // XInitialization
101 74 : void SAL_CALL ModuleImageManager::initialize( const Sequence< Any >& aArguments ) throw ( Exception, RuntimeException )
102 : {
103 74 : m_pImpl->initialize(aArguments);
104 74 : }
105 :
106 : // XImageManager
107 0 : void SAL_CALL ModuleImageManager::reset()
108 : throw (::com::sun::star::uno::RuntimeException)
109 : {
110 0 : m_pImpl->reset();
111 0 : }
112 :
113 0 : Sequence< OUString > SAL_CALL ModuleImageManager::getAllImageNames( ::sal_Int16 nImageType )
114 : throw (::com::sun::star::uno::RuntimeException)
115 : {
116 0 : return m_pImpl->getAllImageNames( nImageType );
117 : }
118 :
119 0 : ::sal_Bool SAL_CALL ModuleImageManager::hasImage( ::sal_Int16 nImageType, const OUString& aCommandURL )
120 : throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException)
121 : {
122 0 : return m_pImpl->hasImage(nImageType,aCommandURL);
123 : }
124 :
125 18532 : Sequence< uno::Reference< XGraphic > > SAL_CALL ModuleImageManager::getImages(
126 : ::sal_Int16 nImageType,
127 : const Sequence< OUString >& aCommandURLSequence )
128 : throw ( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException )
129 : {
130 : SAL_INFO( "fwk", "framework: ModuleImageManager::getImages" );
131 18532 : return m_pImpl->getImages(nImageType,aCommandURLSequence);
132 : }
133 :
134 0 : void SAL_CALL ModuleImageManager::replaceImages(
135 : ::sal_Int16 nImageType,
136 : const Sequence< OUString >& aCommandURLSequence,
137 : const Sequence< uno::Reference< XGraphic > >& aGraphicsSequence )
138 : throw ( ::com::sun::star::lang::IllegalArgumentException,
139 : ::com::sun::star::lang::IllegalAccessException,
140 : ::com::sun::star::uno::RuntimeException)
141 : {
142 0 : m_pImpl->replaceImages(nImageType,aCommandURLSequence,aGraphicsSequence);
143 0 : }
144 :
145 0 : void SAL_CALL ModuleImageManager::removeImages( ::sal_Int16 nImageType, const Sequence< OUString >& aCommandURLSequence )
146 : throw ( ::com::sun::star::lang::IllegalArgumentException,
147 : ::com::sun::star::lang::IllegalAccessException,
148 : ::com::sun::star::uno::RuntimeException)
149 : {
150 0 : m_pImpl->removeImages(nImageType,aCommandURLSequence);
151 0 : }
152 :
153 0 : void SAL_CALL ModuleImageManager::insertImages( ::sal_Int16 nImageType, const Sequence< OUString >& aCommandURLSequence, const Sequence< uno::Reference< XGraphic > >& aGraphicSequence )
154 : throw ( ::com::sun::star::container::ElementExistException,
155 : ::com::sun::star::lang::IllegalArgumentException,
156 : ::com::sun::star::lang::IllegalAccessException,
157 : ::com::sun::star::uno::RuntimeException)
158 : {
159 0 : m_pImpl->insertImages(nImageType,aCommandURLSequence,aGraphicSequence);
160 0 : }
161 :
162 : // XUIConfiguration
163 25239 : void SAL_CALL ModuleImageManager::addConfigurationListener( const uno::Reference< ::com::sun::star::ui::XUIConfigurationListener >& xListener )
164 : throw (::com::sun::star::uno::RuntimeException)
165 : {
166 25239 : m_pImpl->addConfigurationListener(xListener);
167 25239 : }
168 :
169 25237 : void SAL_CALL ModuleImageManager::removeConfigurationListener( const uno::Reference< ::com::sun::star::ui::XUIConfigurationListener >& xListener )
170 : throw (::com::sun::star::uno::RuntimeException)
171 : {
172 25237 : m_pImpl->removeConfigurationListener(xListener);
173 25237 : }
174 :
175 : // XUIConfigurationPersistence
176 0 : void SAL_CALL ModuleImageManager::reload()
177 : throw ( ::com::sun::star::uno::Exception,
178 : ::com::sun::star::uno::RuntimeException )
179 : {
180 0 : m_pImpl->reload();
181 0 : }
182 :
183 0 : void SAL_CALL ModuleImageManager::store()
184 : throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
185 : {
186 0 : m_pImpl->store();
187 0 : }
188 :
189 0 : void SAL_CALL ModuleImageManager::storeToStorage( const uno::Reference< XStorage >& Storage )
190 : throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException)
191 : {
192 0 : m_pImpl->storeToStorage(Storage);
193 0 : }
194 :
195 0 : sal_Bool SAL_CALL ModuleImageManager::isModified()
196 : throw (::com::sun::star::uno::RuntimeException)
197 : {
198 0 : return m_pImpl->isModified();
199 : }
200 :
201 0 : sal_Bool SAL_CALL ModuleImageManager::isReadOnly() throw (::com::sun::star::uno::RuntimeException)
202 : {
203 0 : return m_pImpl->isReadOnly();
204 : }
205 :
206 402 : } // namespace framework
207 :
208 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|