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