1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: rdbtdp_tdenumeration.hxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef _STOC_RDBTDP_TDENUMERATION_HXX
32 #define _STOC_RDBTDP_TDENUMERATION_HXX
35 #include <osl/mutex.hxx>
36 #include <rtl/ref.hxx>
37 #include <registry/refltype.hxx>
38 #include <com/sun/star/container/XHierarchicalNameAccess.hpp>
39 #include <com/sun/star/reflection/InvalidTypeNameException.hpp>
40 #include <com/sun/star/reflection/NoSuchTypeNameException.hpp>
41 #include <com/sun/star/reflection/TypeDescriptionSearchDepth.hpp>
42 #include <com/sun/star/reflection/XTypeDescriptionEnumeration.hpp>
43 #include <com/sun/star/uno/Sequence.hxx>
44 #include <com/sun/star/uno/TypeClass.hpp>
45 #include <cppuhelper/implbase1.hxx>
51 typedef ::std::list
< ::com::sun::star::uno::Reference
<
52 ::com::sun::star::reflection::XTypeDescription
> > TypeDescriptionList
;
54 class TypeDescriptionEnumerationImpl
55 : public cppu::WeakImplHelper1
<
56 com::sun::star::reflection::XTypeDescriptionEnumeration
>
59 static rtl::Reference
< TypeDescriptionEnumerationImpl
> createInstance(
60 const ::com::sun::star::uno::Reference
<
61 ::com::sun::star::container::XHierarchicalNameAccess
> & xTDMgr
,
62 const rtl::OUString
& rModuleName
,
63 const ::com::sun::star::uno::Sequence
<
64 ::com::sun::star::uno::TypeClass
> & rTypes
,
65 ::com::sun::star::reflection::TypeDescriptionSearchDepth eDepth
,
66 const RegistryKeyList
& rBaseKeys
)
67 throw ( ::com::sun::star::reflection::NoSuchTypeNameException
,
68 ::com::sun::star::reflection::InvalidTypeNameException
,
69 ::com::sun::star::uno::RuntimeException
);
71 virtual ~TypeDescriptionEnumerationImpl();
73 // XEnumeration (base of XTypeDescriptionEnumeration)
74 virtual sal_Bool SAL_CALL
hasMoreElements()
75 throw ( ::com::sun::star::uno::RuntimeException
);
76 virtual ::com::sun::star::uno::Any SAL_CALL
nextElement()
77 throw ( ::com::sun::star::container::NoSuchElementException
,
78 ::com::sun::star::lang::WrappedTargetException
,
79 ::com::sun::star::uno::RuntimeException
);
81 // XTypeDescriptionEnumeration
82 virtual ::com::sun::star::uno::Reference
<
83 ::com::sun::star::reflection::XTypeDescription
> SAL_CALL
85 throw ( ::com::sun::star::container::NoSuchElementException
,
86 ::com::sun::star::uno::RuntimeException
);
89 // Note: keys must be open (XRegistryKey->openKey(...)).
90 TypeDescriptionEnumerationImpl(
91 const ::com::sun::star::uno::Reference
<
92 ::com::sun::star::container::XHierarchicalNameAccess
> & xTDMgr
,
93 const RegistryKeyList
& rModuleKeys
,
94 const ::com::sun::star::uno::Sequence
<
95 ::com::sun::star::uno::TypeClass
> & rTypes
,
96 ::com::sun::star::reflection::TypeDescriptionSearchDepth eDepth
);
98 static bool match( ::RTTypeClass eType1
,
99 ::com::sun::star::uno::TypeClass eType2
);
101 ::com::sun::star::uno::Reference
<
102 ::com::sun::star::reflection::XTypeDescription
> queryNext();
106 RegistryKeyList m_aModuleKeys
;
107 RegistryKeyList m_aCurrentModuleSubKeys
;
108 TypeDescriptionList m_aTypeDescs
;
109 ::com::sun::star::uno::Sequence
<
110 ::com::sun::star::uno::TypeClass
> m_aTypes
;
111 ::com::sun::star::reflection::TypeDescriptionSearchDepth m_eDepth
;
112 ::com::sun::star::uno::Reference
<
113 ::com::sun::star::container::XHierarchicalNameAccess
> m_xTDMgr
;
116 } // namespace stoc_rdbtdp
118 #endif /* _STOC_RDBTDP_TDENUMERATION_HXX */