1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef _CHART2_NAMECONTAINER_HXX 29 #define _CHART2_NAMECONTAINER_HXX 30 31 #include <com/sun/star/container/XNameContainer.hpp> 32 #include <com/sun/star/lang/XServiceInfo.hpp> 33 #include <com/sun/star/uno/XComponentContext.hpp> 34 #include <com/sun/star/util/XCloneable.hpp> 35 #include <cppuhelper/implbase3.hxx> 36 #include "charttoolsdllapi.hxx" 37 38 #include <map> 39 40 //............................................................................. 41 namespace chart 42 { 43 //............................................................................. 44 45 OOO_DLLPUBLIC_CHARTTOOLS ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > createNameContainer( 46 const ::com::sun::star::uno::Type& rType, const rtl::OUString& rServicename, const rtl::OUString& rImplementationName ); 47 48 namespace impl 49 { 50 typedef ::cppu::WeakImplHelper3< 51 ::com::sun::star::container::XNameContainer, 52 ::com::sun::star::lang::XServiceInfo, 53 ::com::sun::star::util::XCloneable > 54 NameContainer_Base; 55 } 56 57 class NameContainer : public impl::NameContainer_Base 58 { 59 public: 60 NameContainer( const ::com::sun::star::uno::Type& rType, const rtl::OUString& rServicename, const rtl::OUString& rImplementationName ); 61 explicit NameContainer( const NameContainer & rOther ); 62 virtual ~NameContainer(); 63 64 // XServiceInfo 65 virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException); 66 virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); 67 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException); 68 69 // XNameContainer 70 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); 71 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); 72 73 // XNameReplace 74 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); 75 76 // XNameAccess 77 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); 78 virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getElementNames( ) throw( com::sun::star::uno::RuntimeException); 79 virtual sal_Bool SAL_CALL hasByName( const rtl::OUString& aName ) throw( com::sun::star::uno::RuntimeException); 80 81 // XElementAccess 82 virtual sal_Bool SAL_CALL hasElements( ) throw( com::sun::star::uno::RuntimeException); 83 virtual com::sun::star::uno::Type SAL_CALL getElementType( ) throw( com::sun::star::uno::RuntimeException); 84 85 // XCloneable 86 virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone() throw (::com::sun::star::uno::RuntimeException); 87 88 private: //methods 89 NameContainer();//no default contructor 90 91 private: //member 92 const ::com::sun::star::uno::Type m_aType; 93 const rtl::OUString m_aServicename; 94 const rtl::OUString m_aImplementationName; 95 96 typedef ::std::map< ::rtl::OUString, com::sun::star::uno::Any > tContentMap; 97 98 tContentMap m_aMap; 99 }; 100 101 //............................................................................. 102 } //namespace chart 103 //............................................................................. 104 #endif 105