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