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 _STOC_TDMGR_TDENUMERATION_HXX 29 #define _STOC_TDMGR_TDENUMERATION_HXX 30 31 #include <stack> 32 #include <osl/mutex.hxx> 33 #include <com/sun/star/reflection/XTypeDescriptionEnumeration.hpp> 34 #include <com/sun/star/reflection/XTypeDescriptionEnumerationAccess.hpp> 35 #include <cppuhelper/implbase1.hxx> 36 37 namespace stoc_tdmgr 38 { 39 40 typedef std::stack< com::sun::star::uno::Reference< 41 com::sun::star::reflection::XTypeDescriptionEnumerationAccess > > 42 TDEnumerationAccessStack; 43 44 class TypeDescriptionEnumerationImpl 45 : public cppu::WeakImplHelper1< 46 com::sun::star::reflection::XTypeDescriptionEnumeration > 47 { 48 public: 49 TypeDescriptionEnumerationImpl( 50 const rtl::OUString & rModuleName, 51 const com::sun::star::uno::Sequence< 52 com::sun::star::uno::TypeClass > & rTypes, 53 com::sun::star::reflection::TypeDescriptionSearchDepth eDepth, 54 const TDEnumerationAccessStack & rTDEAS ); 55 virtual ~TypeDescriptionEnumerationImpl(); 56 57 // XEnumeration (base of XTypeDescriptionEnumeration) 58 virtual sal_Bool SAL_CALL hasMoreElements() 59 throw ( ::com::sun::star::uno::RuntimeException ); 60 virtual ::com::sun::star::uno::Any SAL_CALL nextElement() 61 throw ( ::com::sun::star::container::NoSuchElementException, 62 ::com::sun::star::lang::WrappedTargetException, 63 ::com::sun::star::uno::RuntimeException ); 64 65 // XTypeDescriptionEnumeration 66 virtual ::com::sun::star::uno::Reference< 67 ::com::sun::star::reflection::XTypeDescription > SAL_CALL 68 nextTypeDescription() 69 throw ( ::com::sun::star::container::NoSuchElementException, 70 ::com::sun::star::uno::RuntimeException ); 71 72 private: 73 com::sun::star::uno::Reference< 74 com::sun::star::reflection::XTypeDescriptionEnumeration > 75 queryCurrentChildEnumeration(); 76 77 osl::Mutex m_aMutex; 78 rtl::OUString m_aModuleName; 79 com::sun::star::uno::Sequence< com::sun::star::uno::TypeClass > m_aTypes; 80 com::sun::star::reflection::TypeDescriptionSearchDepth m_eDepth; 81 TDEnumerationAccessStack m_aChildren; 82 com::sun::star::uno::Reference< 83 com::sun::star::reflection::XTypeDescriptionEnumeration > m_xEnum; 84 }; 85 86 } // namespace stoc_tdmgr 87 88 #endif /* _STOC_TDMGR_TDENUMERATION_HXX */ 89 90