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 0 : ModuleImageManager::ModuleImageManager( const uno::Reference< uno::XComponentContext >& xContext ) :
70 0 : m_pImpl( new ImageManagerImpl(xContext,static_cast< OWeakObject* >(this),true) )
71 : {
72 0 : }
73 :
74 0 : ModuleImageManager::~ModuleImageManager()
75 : {
76 0 : }
77 :
78 : // XComponent
79 0 : void SAL_CALL ModuleImageManager::dispose() throw (::com::sun::star::uno::RuntimeException, std::exception)
80 : {
81 0 : m_pImpl->dispose();
82 0 : }
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 0 : void SAL_CALL ModuleImageManager::initialize( const Sequence< Any >& aArguments ) throw ( Exception, RuntimeException, std::exception )
97 : {
98 0 : m_pImpl->initialize(aArguments);
99 0 : }
100 :
101 : // XImageManager
102 0 : void SAL_CALL ModuleImageManager::reset()
103 : throw (::com::sun::star::uno::RuntimeException, std::exception)
104 : {
105 0 : m_pImpl->reset();
106 0 : }
107 :
108 0 : Sequence< OUString > SAL_CALL ModuleImageManager::getAllImageNames( ::sal_Int16 nImageType )
109 : throw (::com::sun::star::uno::RuntimeException, std::exception)
110 : {
111 0 : return m_pImpl->getAllImageNames( nImageType );
112 : }
113 :
114 0 : sal_Bool SAL_CALL ModuleImageManager::hasImage( ::sal_Int16 nImageType, const OUString& aCommandURL )
115 : throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception)
116 : {
117 0 : return m_pImpl->hasImage(nImageType,aCommandURL);
118 : }
119 :
120 0 : Sequence< uno::Reference< XGraphic > > SAL_CALL ModuleImageManager::getImages(
121 : ::sal_Int16 nImageType,
122 : const Sequence< OUString >& aCommandURLSequence )
123 : throw ( ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::uno::RuntimeException, std::exception )
124 : {
125 : SAL_INFO( "fwk", "framework: ModuleImageManager::getImages" );
126 0 : return m_pImpl->getImages(nImageType,aCommandURLSequence);
127 : }
128 :
129 0 : void SAL_CALL ModuleImageManager::replaceImages(
130 : ::sal_Int16 nImageType,
131 : const Sequence< OUString >& aCommandURLSequence,
132 : const Sequence< uno::Reference< XGraphic > >& aGraphicsSequence )
133 : throw ( ::com::sun::star::lang::IllegalArgumentException,
134 : ::com::sun::star::lang::IllegalAccessException,
135 : ::com::sun::star::uno::RuntimeException, std::exception)
136 : {
137 0 : m_pImpl->replaceImages(nImageType,aCommandURLSequence,aGraphicsSequence);
138 0 : }
139 :
140 0 : void SAL_CALL ModuleImageManager::removeImages( ::sal_Int16 nImageType, const Sequence< OUString >& aCommandURLSequence )
141 : throw ( ::com::sun::star::lang::IllegalArgumentException,
142 : ::com::sun::star::lang::IllegalAccessException,
143 : ::com::sun::star::uno::RuntimeException, std::exception)
144 : {
145 0 : m_pImpl->removeImages(nImageType,aCommandURLSequence);
146 0 : }
147 :
148 0 : void SAL_CALL ModuleImageManager::insertImages( ::sal_Int16 nImageType, const Sequence< OUString >& aCommandURLSequence, const Sequence< uno::Reference< XGraphic > >& aGraphicSequence )
149 : throw ( ::com::sun::star::container::ElementExistException,
150 : ::com::sun::star::lang::IllegalArgumentException,
151 : ::com::sun::star::lang::IllegalAccessException,
152 : ::com::sun::star::uno::RuntimeException, std::exception)
153 : {
154 0 : m_pImpl->insertImages(nImageType,aCommandURLSequence,aGraphicSequence);
155 0 : }
156 :
157 : // XUIConfiguration
158 0 : void SAL_CALL ModuleImageManager::addConfigurationListener( const uno::Reference< ::com::sun::star::ui::XUIConfigurationListener >& xListener )
159 : throw (::com::sun::star::uno::RuntimeException, std::exception)
160 : {
161 0 : m_pImpl->addConfigurationListener(xListener);
162 0 : }
163 :
164 0 : void SAL_CALL ModuleImageManager::removeConfigurationListener( const uno::Reference< ::com::sun::star::ui::XUIConfigurationListener >& xListener )
165 : throw (::com::sun::star::uno::RuntimeException, std::exception)
166 : {
167 0 : m_pImpl->removeConfigurationListener(xListener);
168 0 : }
169 :
170 : // XUIConfigurationPersistence
171 0 : void SAL_CALL ModuleImageManager::reload()
172 : throw ( ::com::sun::star::uno::Exception,
173 : ::com::sun::star::uno::RuntimeException, std::exception )
174 : {
175 0 : m_pImpl->reload();
176 0 : }
177 :
178 0 : void SAL_CALL ModuleImageManager::store()
179 : throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException, std::exception)
180 : {
181 0 : m_pImpl->store();
182 0 : }
183 :
184 0 : void SAL_CALL ModuleImageManager::storeToStorage( const uno::Reference< XStorage >& Storage )
185 : throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException, std::exception)
186 : {
187 0 : m_pImpl->storeToStorage(Storage);
188 0 : }
189 :
190 0 : sal_Bool SAL_CALL ModuleImageManager::isModified()
191 : throw (::com::sun::star::uno::RuntimeException, std::exception)
192 : {
193 0 : return m_pImpl->isModified();
194 : }
195 :
196 0 : sal_Bool SAL_CALL ModuleImageManager::isReadOnly() throw (::com::sun::star::uno::RuntimeException, std::exception)
197 : {
198 0 : return m_pImpl->isReadOnly();
199 : }
200 :
201 : } // namespace framework
202 :
203 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|