1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/moduleimagemanager.hxx>
21 #include <xml/imagesconfiguration.hxx>
22 #include <uiconfiguration/graphicnameaccess.hxx>
24 #include "imagemanagerimpl.hxx"
26 #include "properties.h"
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>
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>
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
;
69 ModuleImageManager::ModuleImageManager( const uno::Reference
< uno::XComponentContext
>& xContext
) :
70 m_pImpl( new ImageManagerImpl(xContext
,static_cast< OWeakObject
* >(this),true) )
74 ModuleImageManager::~ModuleImageManager()
79 void SAL_CALL
ModuleImageManager::dispose() throw (::com::sun::star::uno::RuntimeException
, std::exception
)
84 void SAL_CALL
ModuleImageManager::addEventListener( const uno::Reference
< XEventListener
>& xListener
) throw (::com::sun::star::uno::RuntimeException
, std::exception
)
86 m_pImpl
->addEventListener(xListener
);
89 void SAL_CALL
ModuleImageManager::removeEventListener( const uno::Reference
< XEventListener
>& xListener
) throw (::com::sun::star::uno::RuntimeException
, std::exception
)
91 /* SAFE AREA ----------------------------------------------------------------------------------------------- */
92 m_pImpl
->removeEventListener(xListener
);
96 void SAL_CALL
ModuleImageManager::initialize( const Sequence
< Any
>& aArguments
) throw ( Exception
, RuntimeException
, std::exception
)
98 m_pImpl
->initialize(aArguments
);
102 void SAL_CALL
ModuleImageManager::reset()
103 throw (css::lang::IllegalAccessException
,
104 css::uno::RuntimeException
,
110 Sequence
< OUString
> SAL_CALL
ModuleImageManager::getAllImageNames( ::sal_Int16 nImageType
)
111 throw (::com::sun::star::uno::RuntimeException
, std::exception
)
113 return m_pImpl
->getAllImageNames( nImageType
);
116 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
)
119 return m_pImpl
->hasImage(nImageType
,aCommandURL
);
122 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
)
127 SAL_INFO( "fwk", "framework: ModuleImageManager::getImages" );
128 return m_pImpl
->getImages(nImageType
,aCommandURLSequence
);
131 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
)
139 m_pImpl
->replaceImages(nImageType
,aCommandURLSequence
,aGraphicsSequence
);
142 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
)
147 m_pImpl
->removeImages(nImageType
,aCommandURLSequence
);
150 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
)
156 m_pImpl
->insertImages(nImageType
,aCommandURLSequence
,aGraphicSequence
);
160 void SAL_CALL
ModuleImageManager::addConfigurationListener( const uno::Reference
< ::com::sun::star::ui::XUIConfigurationListener
>& xListener
)
161 throw (::com::sun::star::uno::RuntimeException
, std::exception
)
163 m_pImpl
->addConfigurationListener(xListener
);
166 void SAL_CALL
ModuleImageManager::removeConfigurationListener( const uno::Reference
< ::com::sun::star::ui::XUIConfigurationListener
>& xListener
)
167 throw (::com::sun::star::uno::RuntimeException
, std::exception
)
169 m_pImpl
->removeConfigurationListener(xListener
);
172 // XUIConfigurationPersistence
173 void SAL_CALL
ModuleImageManager::reload()
174 throw ( ::com::sun::star::uno::Exception
,
175 ::com::sun::star::uno::RuntimeException
, std::exception
)
180 void SAL_CALL
ModuleImageManager::store()
181 throw (::com::sun::star::uno::Exception
, ::com::sun::star::uno::RuntimeException
, std::exception
)
186 void SAL_CALL
ModuleImageManager::storeToStorage( const uno::Reference
< XStorage
>& Storage
)
187 throw (::com::sun::star::uno::Exception
, ::com::sun::star::uno::RuntimeException
, std::exception
)
189 m_pImpl
->storeToStorage(Storage
);
192 sal_Bool SAL_CALL
ModuleImageManager::isModified()
193 throw (::com::sun::star::uno::RuntimeException
, std::exception
)
195 return m_pImpl
->isModified();
198 sal_Bool SAL_CALL
ModuleImageManager::isReadOnly() throw (::com::sun::star::uno::RuntimeException
, std::exception
)
200 return m_pImpl
->isReadOnly();
203 } // namespace framework
205 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */