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 0 : ImageManager::ImageManager( const uno::Reference< uno::XComponentContext >& rxContext ) :
61 0 : m_pImpl( new ImageManagerImpl(rxContext, this, false) )
62 : {
63 0 : }
64 :
65 0 : ImageManager::~ImageManager()
66 : {
67 0 : m_pImpl->clear();
68 0 : }
69 :
70 : // XComponent
71 0 : void SAL_CALL ImageManager::dispose() throw (::com::sun::star::uno::RuntimeException, std::exception)
72 : {
73 0 : m_pImpl->dispose();
74 0 : }
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 0 : void ImageManager::setStorage( const uno::Reference< XStorage >& Storage )
89 : throw (::com::sun::star::uno::RuntimeException)
90 : {
91 0 : SolarMutexGuard g;
92 :
93 0 : m_pImpl->m_xUserConfigStorage = Storage;
94 0 : m_pImpl->implts_initialize();
95 0 : }
96 :
97 : // XInitialization
98 0 : void SAL_CALL ImageManager::initialize( const Sequence< Any >& aArguments ) throw ( Exception, RuntimeException, std::exception )
99 : {
100 0 : m_pImpl->initialize(aArguments);
101 0 : }
102 :
103 : // XImageManager
104 0 : void SAL_CALL ImageManager::reset()
105 : throw (::com::sun::star::uno::RuntimeException, std::exception)
106 : {
107 :
108 : /* SAFE AREA ----------------------------------------------------------------------------------------------- */
109 0 : m_pImpl->reset();
110 0 : }
111 :
112 0 : Sequence< OUString > SAL_CALL ImageManager::getAllImageNames( ::sal_Int16 nImageType )
113 : throw (::com::sun::star::uno::RuntimeException, std::exception)
114 : {
115 0 : return m_pImpl->getAllImageNames( nImageType );
116 : }
117 :
118 0 : sal_Bool SAL_CALL ImageManager::hasImage( ::sal_Int16 nImageType, const OUString& aCommandURL )
119 : throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception)
120 : {
121 0 : return m_pImpl->hasImage(nImageType,aCommandURL);
122 : }
123 :
124 0 : Sequence< uno::Reference< XGraphic > > SAL_CALL ImageManager::getImages(
125 : ::sal_Int16 nImageType,
126 : const Sequence< OUString >& aCommandURLSequence )
127 : throw ( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception )
128 : {
129 0 : return m_pImpl->getImages(nImageType,aCommandURLSequence);
130 : }
131 :
132 0 : void SAL_CALL ImageManager::replaceImages(
133 : ::sal_Int16 nImageType,
134 : const Sequence< OUString >& aCommandURLSequence,
135 : const Sequence< uno::Reference< XGraphic > >& aGraphicsSequence )
136 : throw ( ::com::sun::star::lang::IllegalArgumentException,
137 : ::com::sun::star::lang::IllegalAccessException,
138 : ::com::sun::star::uno::RuntimeException, std::exception)
139 : {
140 0 : m_pImpl->replaceImages(nImageType,aCommandURLSequence,aGraphicsSequence);
141 0 : }
142 :
143 0 : void SAL_CALL ImageManager::removeImages( ::sal_Int16 nImageType, const Sequence< OUString >& aCommandURLSequence )
144 : throw ( ::com::sun::star::lang::IllegalArgumentException,
145 : ::com::sun::star::lang::IllegalAccessException,
146 : ::com::sun::star::uno::RuntimeException, std::exception)
147 : {
148 0 : m_pImpl->removeImages(nImageType,aCommandURLSequence);
149 0 : }
150 :
151 0 : void SAL_CALL ImageManager::insertImages( ::sal_Int16 nImageType, const Sequence< OUString >& aCommandURLSequence, const Sequence< uno::Reference< XGraphic > >& aGraphicSequence )
152 : throw ( ::com::sun::star::container::ElementExistException,
153 : ::com::sun::star::lang::IllegalArgumentException,
154 : ::com::sun::star::lang::IllegalAccessException,
155 : ::com::sun::star::uno::RuntimeException, std::exception)
156 : {
157 0 : m_pImpl->insertImages(nImageType,aCommandURLSequence,aGraphicSequence);
158 0 : }
159 :
160 : // XUIConfiguration
161 0 : void SAL_CALL ImageManager::addConfigurationListener( const uno::Reference< ::com::sun::star::ui::XUIConfigurationListener >& xListener )
162 : throw (::com::sun::star::uno::RuntimeException, std::exception)
163 : {
164 0 : m_pImpl->addConfigurationListener(xListener);
165 0 : }
166 :
167 0 : void SAL_CALL ImageManager::removeConfigurationListener( const uno::Reference< ::com::sun::star::ui::XUIConfigurationListener >& xListener )
168 : throw (::com::sun::star::uno::RuntimeException, std::exception)
169 : {
170 : /* SAFE AREA ----------------------------------------------------------------------------------------------- */
171 0 : m_pImpl->removeConfigurationListener(xListener);
172 0 : }
173 :
174 : // XUIConfigurationPersistence
175 0 : void SAL_CALL ImageManager::reload()
176 : throw ( ::com::sun::star::uno::Exception,
177 : ::com::sun::star::uno::RuntimeException, std::exception )
178 : {
179 0 : m_pImpl->reload();
180 0 : }
181 :
182 0 : void SAL_CALL ImageManager::store()
183 : throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException, std::exception)
184 : {
185 0 : m_pImpl->store();
186 0 : }
187 :
188 0 : void SAL_CALL ImageManager::storeToStorage( const uno::Reference< XStorage >& Storage )
189 : throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException, std::exception)
190 : {
191 0 : m_pImpl->storeToStorage(Storage);
192 0 : }
193 :
194 0 : sal_Bool SAL_CALL ImageManager::isModified()
195 : throw (::com::sun::star::uno::RuntimeException, std::exception)
196 : {
197 0 : return m_pImpl->isModified();
198 : }
199 :
200 0 : sal_Bool SAL_CALL ImageManager::isReadOnly() throw (::com::sun::star::uno::RuntimeException, std::exception)
201 : {
202 0 : return m_pImpl->isReadOnly();
203 : }
204 :
205 : } // namespace framework
206 :
207 : extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
208 0 : com_sun_star_comp_framework_ImageManager_get_implementation(
209 : css::uno::XComponentContext *context,
210 : css::uno::Sequence<css::uno::Any> const &)
211 : {
212 0 : return cppu::acquire(new framework::ImageManager(context));
213 : }
214 :
215 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|