fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / framework / source / uiconfiguration / imagemanager.cxx
blob20cac0ff8d2aedd41ce2035eab7e2c5be33ff4f4
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include <uiconfiguration/imagemanager.hxx>
21 #include <xml/imagesconfiguration.hxx>
22 #include <uiconfiguration/graphicnameaccess.hxx>
23 #include "imagemanagerimpl.hxx"
25 #include "properties.h"
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>
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>
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;
57 namespace framework
60 ImageManager::ImageManager( const uno::Reference< uno::XComponentContext >& rxContext ) :
61 m_pImpl( new ImageManagerImpl(rxContext, this, false) )
65 ImageManager::~ImageManager()
67 m_pImpl->clear();
70 // XComponent
71 void SAL_CALL ImageManager::dispose() throw (::com::sun::star::uno::RuntimeException, std::exception)
73 m_pImpl->dispose();
76 void SAL_CALL ImageManager::addEventListener( const uno::Reference< XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException, std::exception)
78 m_pImpl->addEventListener(xListener);
81 void SAL_CALL ImageManager::removeEventListener( const uno::Reference< XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException, std::exception)
83 /* SAFE AREA ----------------------------------------------------------------------------------------------- */
84 m_pImpl->removeEventListener(xListener);
87 // Non-UNO methods
88 void ImageManager::setStorage( const uno::Reference< XStorage >& Storage )
89 throw (::com::sun::star::uno::RuntimeException)
91 SolarMutexGuard g;
93 m_pImpl->m_xUserConfigStorage = Storage;
94 m_pImpl->implts_initialize();
97 // XInitialization
98 void SAL_CALL ImageManager::initialize( const Sequence< Any >& aArguments ) throw ( Exception, RuntimeException, std::exception )
100 m_pImpl->initialize(aArguments);
103 // XImageManager
104 void SAL_CALL ImageManager::reset()
105 throw (css::lang::IllegalAccessException,
106 css::uno::RuntimeException,
107 std::exception)
109 /* SAFE AREA ----------------------------------------------------------------------------------------------- */
110 m_pImpl->reset();
113 Sequence< OUString > SAL_CALL ImageManager::getAllImageNames( ::sal_Int16 nImageType )
114 throw (::com::sun::star::uno::RuntimeException, std::exception)
116 return m_pImpl->getAllImageNames( nImageType );
119 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)
122 return m_pImpl->hasImage(nImageType,aCommandURL);
125 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 )
130 return m_pImpl->getImages(nImageType,aCommandURLSequence);
133 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)
141 m_pImpl->replaceImages(nImageType,aCommandURLSequence,aGraphicsSequence);
144 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)
149 m_pImpl->removeImages(nImageType,aCommandURLSequence);
152 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)
158 m_pImpl->insertImages(nImageType,aCommandURLSequence,aGraphicSequence);
161 // XUIConfiguration
162 void SAL_CALL ImageManager::addConfigurationListener( const uno::Reference< ::com::sun::star::ui::XUIConfigurationListener >& xListener )
163 throw (::com::sun::star::uno::RuntimeException, std::exception)
165 m_pImpl->addConfigurationListener(xListener);
168 void SAL_CALL ImageManager::removeConfigurationListener( const uno::Reference< ::com::sun::star::ui::XUIConfigurationListener >& xListener )
169 throw (::com::sun::star::uno::RuntimeException, std::exception)
171 /* SAFE AREA ----------------------------------------------------------------------------------------------- */
172 m_pImpl->removeConfigurationListener(xListener);
175 // XUIConfigurationPersistence
176 void SAL_CALL ImageManager::reload()
177 throw ( ::com::sun::star::uno::Exception,
178 ::com::sun::star::uno::RuntimeException, std::exception )
180 m_pImpl->reload();
183 void SAL_CALL ImageManager::store()
184 throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException, std::exception)
186 m_pImpl->store();
189 void SAL_CALL ImageManager::storeToStorage( const uno::Reference< XStorage >& Storage )
190 throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException, std::exception)
192 m_pImpl->storeToStorage(Storage);
195 sal_Bool SAL_CALL ImageManager::isModified()
196 throw (::com::sun::star::uno::RuntimeException, std::exception)
198 return m_pImpl->isModified();
201 sal_Bool SAL_CALL ImageManager::isReadOnly() throw (::com::sun::star::uno::RuntimeException, std::exception)
203 return m_pImpl->isReadOnly();
206 } // namespace framework
208 extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * SAL_CALL
209 com_sun_star_comp_framework_ImageManager_get_implementation(
210 css::uno::XComponentContext *context,
211 css::uno::Sequence<css::uno::Any> const &)
213 return cppu::acquire(new framework::ImageManager(context));
216 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */