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