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