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 #include "sal/config.h" 25 #include "xmloff/dllapi.h" 26 #include "sal/types.h" 27 #include <com/sun/star/lang/XMultiServiceFactory.hpp> 28 #include <com/sun/star/container/XNameContainer.hpp> 29 #include <com/sun/star/lang/XServiceInfo.hpp> 30 #include <com/sun/star/lang/XUnoTunnel.hpp> 31 32 #ifndef _CPPUHELPER_IMPLBASE1_HXX_ 33 #include <cppuhelper/implbase3.hxx> 34 #endif 35 36 extern ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SvUnoAttributeContainer_CreateInstance(); 37 38 class SvXMLAttrContainerData; 39 40 class XMLOFF_DLLPUBLIC SvUnoAttributeContainer: 41 public ::cppu::WeakAggImplHelper3< 42 ::com::sun::star::lang::XServiceInfo, 43 ::com::sun::star::lang::XUnoTunnel, 44 ::com::sun::star::container::XNameContainer > 45 { 46 private: 47 SvXMLAttrContainerData* mpContainer; 48 49 SAL_DLLPRIVATE sal_uInt16 getIndexByName(const ::rtl::OUString& aName ) 50 const; 51 52 public: 53 SvUnoAttributeContainer( SvXMLAttrContainerData* pContainer = NULL ); 54 virtual ~SvUnoAttributeContainer(); 55 GetContainerImpl() const56 SvXMLAttrContainerData* GetContainerImpl() const { return mpContainer; } 57 58 static const ::com::sun::star::uno::Sequence< sal_Int8 > & getUnoTunnelId() throw(); 59 static SvUnoAttributeContainer* getImplementation( ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > xInt ) throw(); 60 virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException); 61 62 // ::com::sun::star::container::XElementAccess 63 virtual ::com::sun::star::uno::Type SAL_CALL getElementType(void) throw( ::com::sun::star::uno::RuntimeException ); 64 virtual sal_Bool SAL_CALL hasElements(void) throw( ::com::sun::star::uno::RuntimeException ); 65 66 // ::com::sun::star::container::XNameAccess 67 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 ); 68 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getElementNames(void) throw( ::com::sun::star::uno::RuntimeException ); 69 virtual sal_Bool SAL_CALL hasByName(const ::rtl::OUString& aName) throw( ::com::sun::star::uno::RuntimeException ); 70 71 // ::com::sun::star::container::XNameReplace 72 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 ); 73 74 // ::com::sun::star::container::XNameContainer 75 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 ); 76 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 ); 77 78 // ::com::sun::star::lang::XServiceInfo 79 virtual ::rtl::OUString SAL_CALL getImplementationName(void) throw( ::com::sun::star::uno::RuntimeException ); 80 virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames(void) throw( ::com::sun::star::uno::RuntimeException ); 81 virtual sal_Bool SAL_CALL supportsService(const ::rtl::OUString& ServiceName) throw( ::com::sun::star::uno::RuntimeException ); 82 83 friend ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SvUnoAttributeContainer_CreateInstance( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > & rSMgr ) throw( ::com::sun::star::uno::Exception ); 84 }; 85 86