LibreOffice Module chart2 (master) 1
NameContainer.cxx
Go to the documentation of this file.
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 <NameContainer.hxx>
21
22#include <com/sun/star/uno/Any.hxx>
23
26
27using namespace ::com::sun::star;
28using ::com::sun::star::uno::Sequence;
29using ::com::sun::star::uno::Any;
30
31namespace chart
32{
33
34
36{
37}
38
40 : impl::NameContainer_Base(rOther)
41 , m_aMap( rOther.m_aMap )
42{
43}
44
46{
47}
48
49//XServiceInfo
51{
52 return "com.sun.star.comp.chart.XMLNameSpaceMap";
53}
54
55sal_Bool SAL_CALL NameContainer::supportsService( const OUString& ServiceName )
56{
58}
59
61{
62 return { "com.sun.star.xml.NamespaceMap" };
63}
64
65// XNameContainer
66void SAL_CALL NameContainer::insertByName( const OUString& rName, const Any& rElement )
67{
68 if( m_aMap.find( rName ) != m_aMap.end() )
69 throw container::ElementExistException();
70 m_aMap.emplace( rName, rElement );
71}
72
73void SAL_CALL NameContainer::removeByName( const OUString& Name )
74{
75 tContentMap::iterator aIt( m_aMap.find( Name ));
76 if( aIt == m_aMap.end())
77 throw container::NoSuchElementException();
78 m_aMap.erase( aIt );
79}
80
81// XNameReplace
82void SAL_CALL NameContainer::replaceByName( const OUString& rName, const Any& rElement )
83{
84 tContentMap::iterator aIt( m_aMap.find( rName ));
85 if( aIt == m_aMap.end() )
86 throw container::NoSuchElementException();
87 aIt->second = rElement;
88}
89
90// XNameAccess
91Any SAL_CALL NameContainer::getByName( const OUString& rName )
92{
93 tContentMap::iterator aIter( m_aMap.find( rName ) );
94 if( aIter == m_aMap.end() )
95 throw container::NoSuchElementException();
96 return aIter->second;
97}
98
100{
102}
103
104sal_Bool SAL_CALL NameContainer::hasByName( const OUString& rName )
105{
106 return ( m_aMap.find( rName ) != m_aMap.end() );
107}
108
109// XElementAccess
111{
112 return ! m_aMap.empty();
113}
114
116{
117 return ::cppu::UnoType<OUString>::get();
118}
119
120// XCloneable
122{
124}
125
126} //namespace chart
127
128/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Contains the XML namespaces map.
virtual css::uno::Sequence< OUString > SAL_CALL getElementNames() override
virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone() override
virtual css::uno::Any SAL_CALL getByName(const OUString &aName) override
virtual css::uno::Type SAL_CALL getElementType() override
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
virtual OUString SAL_CALL getImplementationName() override
virtual ~NameContainer() override
virtual void SAL_CALL removeByName(const OUString &Name) override
virtual void SAL_CALL replaceByName(const OUString &aName, const css::uno::Any &aElement) override
virtual sal_Bool SAL_CALL hasElements() override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual sal_Bool SAL_CALL hasByName(const OUString &aName) override
virtual void SAL_CALL insertByName(const OUString &aName, const css::uno::Any &aElement) override
::cppu::WeakImplHelper< css::container::XNameContainer, css::lang::XServiceInfo, css::util::XCloneable > NameContainer_Base
css::uno::Sequence< typename M::key_type > mapKeysToSequence(M const &map)
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
OUString Name
unsigned char sal_Bool