1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef _CHART2_NAMECONTAINER_HXX 25 #define _CHART2_NAMECONTAINER_HXX 26 27 #include <com/sun/star/container/XNameContainer.hpp> 28 #include <com/sun/star/lang/XServiceInfo.hpp> 29 #include <com/sun/star/uno/XComponentContext.hpp> 30 #include <com/sun/star/util/XCloneable.hpp> 31 #include <cppuhelper/implbase3.hxx> 32 #include "charttoolsdllapi.hxx" 33 34 #include <map> 35 36 //............................................................................. 37 namespace chart 38 { 39 //............................................................................. 40 41 OOO_DLLPUBLIC_CHARTTOOLS ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > createNameContainer( 42 const ::com::sun::star::uno::Type& rType, const rtl::OUString& rServicename, const rtl::OUString& rImplementationName ); 43 44 namespace impl 45 { 46 typedef ::cppu::WeakImplHelper3< 47 ::com::sun::star::container::XNameContainer, 48 ::com::sun::star::lang::XServiceInfo, 49 ::com::sun::star::util::XCloneable > 50 NameContainer_Base; 51 } 52 53 class NameContainer : public impl::NameContainer_Base 54 { 55 public: 56 NameContainer( const ::com::sun::star::uno::Type& rType, const rtl::OUString& rServicename, const rtl::OUString& rImplementationName ); 57 explicit NameContainer( const NameContainer & rOther ); 58 virtual ~NameContainer(); 59 60 // XServiceInfo 61 virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException); 62 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); 63 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException); 64 65 // XNameContainer 66 virtual void SAL_CALL insertByName( const rtl::OUString& aName, const com::sun::star::uno::Any& aElement ) throw( com::sun::star::lang::IllegalArgumentException, com::sun::star::container::ElementExistException, com::sun::star::lang::WrappedTargetException, com::sun::star::uno::RuntimeException); 67 virtual void SAL_CALL removeByName( const rtl::OUString& Name ) throw( com::sun::star::container::NoSuchElementException, com::sun::star::lang::WrappedTargetException, com::sun::star::uno::RuntimeException); 68 69 // XNameReplace 70 virtual void SAL_CALL replaceByName( const rtl::OUString& aName, const com::sun::star::uno::Any& aElement ) throw( com::sun::star::lang::IllegalArgumentException, com::sun::star::container::NoSuchElementException, com::sun::star::lang::WrappedTargetException, com::sun::star::uno::RuntimeException); 71 72 // XNameAccess 73 virtual com::sun::star::uno::Any SAL_CALL getByName( const rtl::OUString& aName ) throw( com::sun::star::container::NoSuchElementException, com::sun::star::lang::WrappedTargetException, com::sun::star::uno::RuntimeException); 74 virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getElementNames( ) throw( com::sun::star::uno::RuntimeException); 75 virtual sal_Bool SAL_CALL hasByName( const rtl::OUString& aName ) throw( com::sun::star::uno::RuntimeException); 76 77 // XElementAccess 78 virtual sal_Bool SAL_CALL hasElements( ) throw( com::sun::star::uno::RuntimeException); 79 virtual com::sun::star::uno::Type SAL_CALL getElementType( ) throw( com::sun::star::uno::RuntimeException); 80 81 // XCloneable 82 virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone() throw (::com::sun::star::uno::RuntimeException); 83 84 private: //methods 85 NameContainer();//no default contructor 86 87 private: //member 88 const ::com::sun::star::uno::Type m_aType; 89 const rtl::OUString m_aServicename; 90 const rtl::OUString m_aImplementationName; 91 92 typedef ::std::map< ::rtl::OUString, com::sun::star::uno::Any > tContentMap; 93 94 tContentMap m_aMap; 95 }; 96 97 //............................................................................. 98 } //namespace chart 99 //............................................................................. 100 #endif 101