1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef _STOC_RDBTDP_TDENUMERATION_HXX
21 #define _STOC_RDBTDP_TDENUMERATION_HXX
24 #include <osl/mutex.hxx>
25 #include <rtl/ref.hxx>
26 #include <registry/refltype.hxx>
27 #include <com/sun/star/container/XHierarchicalNameAccess.hpp>
28 #include <com/sun/star/reflection/InvalidTypeNameException.hpp>
29 #include <com/sun/star/reflection/NoSuchTypeNameException.hpp>
30 #include <com/sun/star/reflection/TypeDescriptionSearchDepth.hpp>
31 #include <com/sun/star/reflection/XTypeDescriptionEnumeration.hpp>
32 #include <com/sun/star/uno/Sequence.hxx>
33 #include <com/sun/star/uno/TypeClass.hpp>
34 #include <cppuhelper/implbase1.hxx>
40 typedef ::std::list
< ::com::sun::star::uno::Reference
<
41 ::com::sun::star::reflection::XTypeDescription
> > TypeDescriptionList
;
43 class TypeDescriptionEnumerationImpl
44 : public cppu::WeakImplHelper1
<
45 com::sun::star::reflection::XTypeDescriptionEnumeration
>
48 static rtl::Reference
< TypeDescriptionEnumerationImpl
> createInstance(
49 const ::com::sun::star::uno::Reference
<
50 ::com::sun::star::container::XHierarchicalNameAccess
> & xTDMgr
,
51 const OUString
& rModuleName
,
52 const ::com::sun::star::uno::Sequence
<
53 ::com::sun::star::uno::TypeClass
> & rTypes
,
54 ::com::sun::star::reflection::TypeDescriptionSearchDepth eDepth
,
55 const RegistryKeyList
& rBaseKeys
)
56 throw ( ::com::sun::star::reflection::NoSuchTypeNameException
,
57 ::com::sun::star::reflection::InvalidTypeNameException
,
58 ::com::sun::star::uno::RuntimeException
);
60 virtual ~TypeDescriptionEnumerationImpl();
62 // XEnumeration (base of XTypeDescriptionEnumeration)
63 virtual sal_Bool SAL_CALL
hasMoreElements()
64 throw ( ::com::sun::star::uno::RuntimeException
);
65 virtual ::com::sun::star::uno::Any SAL_CALL
nextElement()
66 throw ( ::com::sun::star::container::NoSuchElementException
,
67 ::com::sun::star::lang::WrappedTargetException
,
68 ::com::sun::star::uno::RuntimeException
);
70 // XTypeDescriptionEnumeration
71 virtual ::com::sun::star::uno::Reference
<
72 ::com::sun::star::reflection::XTypeDescription
> SAL_CALL
74 throw ( ::com::sun::star::container::NoSuchElementException
,
75 ::com::sun::star::uno::RuntimeException
);
78 // Note: keys must be open (XRegistryKey->openKey(...)).
79 TypeDescriptionEnumerationImpl(
80 const ::com::sun::star::uno::Reference
<
81 ::com::sun::star::container::XHierarchicalNameAccess
> & xTDMgr
,
82 const RegistryKeyList
& rModuleKeys
,
83 const ::com::sun::star::uno::Sequence
<
84 ::com::sun::star::uno::TypeClass
> & rTypes
,
85 ::com::sun::star::reflection::TypeDescriptionSearchDepth eDepth
);
87 static bool match( ::RTTypeClass eType1
,
88 ::com::sun::star::uno::TypeClass eType2
);
90 ::com::sun::star::uno::Reference
<
91 ::com::sun::star::reflection::XTypeDescription
> queryNext();
95 RegistryKeyList m_aModuleKeys
;
96 RegistryKeyList m_aCurrentModuleSubKeys
;
97 TypeDescriptionList m_aTypeDescs
;
98 ::com::sun::star::uno::Sequence
<
99 ::com::sun::star::uno::TypeClass
> m_aTypes
;
100 ::com::sun::star::reflection::TypeDescriptionSearchDepth m_eDepth
;
101 ::com::sun::star::uno::Reference
<
102 ::com::sun::star::container::XHierarchicalNameAccess
> m_xTDMgr
;
105 } // namespace stoc_rdbtdp
107 #endif /* _STOC_RDBTDP_TDENUMERATION_HXX */
109 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */