10#include <com/sun/star/uno/XComponentContext.hpp>
11#include <com/sun/star/lang/XServiceInfo.hpp>
12#include <com/sun/star/graphic/XGraphicMapper.hpp>
13#include <com/sun/star/graphic/XGraphic.hpp>
19#include <unordered_map>
25class GraphicMapper :
public cppu::WeakImplHelper<graphic::XGraphicMapper, lang::XServiceInfo>
28 std::unordered_map<OUString, uno::Reference<graphic::XGraphic>> maGraphicMap;
31 GraphicMapper() =
default;
37 return "com.sun.star.comp.graphic.GraphicMapper";
45 return {
"com.sun.star.graphic.GraphicMapper" };
49 css::uno::Sequence<css::uno::Type> SAL_CALL getTypes()
override
51 static const uno::Sequence<uno::Type>
aTypes{
57 css::uno::Sequence<sal_Int8> SAL_CALL getImplementationId()
override
59 return css::uno::Sequence<sal_Int8>();
63 css::uno::Reference<css::graphic::XGraphic> SAL_CALL findGraphic(
const OUString& rId)
override
65 auto aIterator = maGraphicMap.find(rId);
67 if (aIterator == maGraphicMap.end())
68 return css::uno::Reference<css::graphic::XGraphic>();
70 return aIterator->second;
72 void SAL_CALL putGraphic(
const OUString& rId,
73 css::uno::Reference<css::graphic::XGraphic>
const& rGraphic)
override
75 maGraphicMap.emplace(rId, rGraphic);
80extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
82 css::uno::Sequence<css::uno::Any>
const&)
84 return cppu::acquire(
new GraphicMapper);
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * com_sun_star_comp_graphic_GraphicMapper_get_implementation(css::uno::XComponentContext *, css::uno::Sequence< css::uno::Any > const &)
css::uno::Type const & get()
css::uno::Sequence< OUString > getSupportedServiceNames()
OUString getImplementationName()
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)