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_RDBTDP_TDENUMERATION_HXX 25 #define _STOC_RDBTDP_TDENUMERATION_HXX 26 27 #include <list> 28 #include <osl/mutex.hxx> 29 #include <rtl/ref.hxx> 30 #include <registry/refltype.hxx> 31 #include <com/sun/star/container/XHierarchicalNameAccess.hpp> 32 #include <com/sun/star/reflection/InvalidTypeNameException.hpp> 33 #include <com/sun/star/reflection/NoSuchTypeNameException.hpp> 34 #include <com/sun/star/reflection/TypeDescriptionSearchDepth.hpp> 35 #include <com/sun/star/reflection/XTypeDescriptionEnumeration.hpp> 36 #include <com/sun/star/uno/Sequence.hxx> 37 #include <com/sun/star/uno/TypeClass.hpp> 38 #include <cppuhelper/implbase1.hxx> 39 #include "base.hxx" 40 41 namespace stoc_rdbtdp 42 { 43 44 typedef ::std::list< ::com::sun::star::uno::Reference< 45 ::com::sun::star::reflection::XTypeDescription > > TypeDescriptionList; 46 47 class TypeDescriptionEnumerationImpl 48 : public cppu::WeakImplHelper1< 49 com::sun::star::reflection::XTypeDescriptionEnumeration > 50 { 51 public: 52 static rtl::Reference< TypeDescriptionEnumerationImpl > createInstance( 53 const ::com::sun::star::uno::Reference< 54 ::com::sun::star::container::XHierarchicalNameAccess > & xTDMgr, 55 const rtl::OUString & rModuleName, 56 const ::com::sun::star::uno::Sequence< 57 ::com::sun::star::uno::TypeClass > & rTypes, 58 ::com::sun::star::reflection::TypeDescriptionSearchDepth eDepth, 59 const RegistryKeyList & rBaseKeys ); 60 61 virtual ~TypeDescriptionEnumerationImpl(); 62 63 // XEnumeration (base of XTypeDescriptionEnumeration) 64 virtual sal_Bool SAL_CALL hasMoreElements(); 65 virtual ::com::sun::star::uno::Any SAL_CALL nextElement(); 66 67 // XTypeDescriptionEnumeration 68 virtual ::com::sun::star::uno::Reference< 69 ::com::sun::star::reflection::XTypeDescription > SAL_CALL 70 nextTypeDescription(); 71 72 private: 73 // Note: keys must be open (XRegistryKey->openKey(...)). 74 TypeDescriptionEnumerationImpl( 75 const ::com::sun::star::uno::Reference< 76 ::com::sun::star::container::XHierarchicalNameAccess > & xTDMgr, 77 const RegistryKeyList & rModuleKeys, 78 const ::com::sun::star::uno::Sequence< 79 ::com::sun::star::uno::TypeClass > & rTypes, 80 ::com::sun::star::reflection::TypeDescriptionSearchDepth eDepth ); 81 82 static bool match( ::RTTypeClass eType1, 83 ::com::sun::star::uno::TypeClass eType2 ); 84 bool queryMore(); 85 ::com::sun::star::uno::Reference< 86 ::com::sun::star::reflection::XTypeDescription > queryNext(); 87 88 // members 89 osl::Mutex m_aMutex; 90 RegistryKeyList m_aModuleKeys; 91 RegistryKeyList m_aCurrentModuleSubKeys; 92 TypeDescriptionList m_aTypeDescs; 93 ::com::sun::star::uno::Sequence< 94 ::com::sun::star::uno::TypeClass > m_aTypes; 95 ::com::sun::star::reflection::TypeDescriptionSearchDepth m_eDepth; 96 ::com::sun::star::uno::Reference< 97 ::com::sun::star::container::XHierarchicalNameAccess > m_xTDMgr; 98 }; 99 100 } // namespace stoc_rdbtdp 101 102 #endif /* _STOC_RDBTDP_TDENUMERATION_HXX */ 103