summaryrefslogtreecommitdiff
path: root/stoc
diff options
context:
space:
mode:
authorKai Sommerfeld <kso@openoffice.org>2002-11-11 07:35:49 +0000
committerKai Sommerfeld <kso@openoffice.org>2002-11-11 07:35:49 +0000
commit970e23ab9d50ebdf82351c959d1daaaf36065ff2 (patch)
treee77ca196d773292b68440e645a6967ee8578a55d /stoc
parentf14c1f894317f7e814780e9eade40c929e04b26d (diff)
#104677# - Introduced/modified for Type Description Manager/Provider Enumeration
Interface.
Diffstat (limited to 'stoc')
-rw-r--r--stoc/source/registry_tdprovider/base.hxx117
-rw-r--r--stoc/source/registry_tdprovider/makefile.mk9
-rw-r--r--stoc/source/registry_tdprovider/rdbtdp_tdenumeration.cxx572
-rw-r--r--stoc/source/registry_tdprovider/rdbtdp_tdenumeration.hxx173
-rw-r--r--stoc/source/registry_tdprovider/td.cxx89
-rw-r--r--stoc/source/registry_tdprovider/tdcomp.cxx6
-rw-r--r--stoc/source/registry_tdprovider/tdef.cxx6
-rw-r--r--stoc/source/registry_tdprovider/tdenum.cxx6
-rw-r--r--stoc/source/registry_tdprovider/tdiface.cxx7
-rw-r--r--stoc/source/registry_tdprovider/tdprovider.cxx306
-rw-r--r--stoc/source/registry_tdprovider/tdservice.cxx406
-rw-r--r--stoc/source/tdmanager/makefile.mk7
-rw-r--r--stoc/source/tdmanager/tdmgr.cxx118
-rw-r--r--stoc/source/tdmanager/tdmgr_common.hxx75
-rw-r--r--stoc/source/tdmanager/tdmgr_tdenumeration.cxx223
-rw-r--r--stoc/source/tdmanager/tdmgr_tdenumeration.hxx132
16 files changed, 2082 insertions, 170 deletions
diff --git a/stoc/source/registry_tdprovider/base.hxx b/stoc/source/registry_tdprovider/base.hxx
index f4a88ca7f936..aa9cb31d0dea 100644
--- a/stoc/source/registry_tdprovider/base.hxx
+++ b/stoc/source/registry_tdprovider/base.hxx
@@ -2,9 +2,9 @@
*
* $RCSfile: base.hxx,v $
*
- * $Revision: 1.8 $
+ * $Revision: 1.9 $
*
- * last change: $Author: dbo $ $Date: 2002-03-07 15:02:35 $
+ * last change: $Author: kso $ $Date: 2002-11-11 08:35:47 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -59,6 +59,9 @@
*
************************************************************************/
+#ifndef _STOC_RDBTDP_BASE_HXX
+#define _STOC_RDBTDP_BASE_HXX
+
#ifndef _OSL_DIAGNOSE_H_
#include <osl/diagnose.h>
#endif
@@ -79,6 +82,7 @@
#include <cppuhelper/implementationentry.hxx>
#endif
+#include <list>
#include <vector>
#include <com/sun/star/reflection/XTypeDescription.hpp>
@@ -86,9 +90,13 @@
#include <com/sun/star/reflection/XCompoundTypeDescription.hpp>
#include <com/sun/star/reflection/XEnumTypeDescription.hpp>
#include <com/sun/star/reflection/XIndirectTypeDescription.hpp>
+#include <com/sun/star/reflection/XServiceTypeDescription.hpp>
#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#ifndef _COM_SUN_STAR_REGISTRY_XREGISTRYKEY_HPP_
+#include <com/sun/star/registry/XRegistryKey.hpp>
+#endif
using namespace std;
using namespace rtl;
@@ -102,7 +110,45 @@ using namespace com::sun::star::reflection;
namespace stoc_rdbtdp
{
+//--------------------------------------------------------------------------------------------------
+
+typedef ::std::list< ::com::sun::star::uno::Reference<
+ ::com::sun::star::registry::XRegistryKey > > RegistryKeyList;
+
+//--------------------------------------------------------------------------------------------------
+
+class RegistryKeyCloser
+{
+public:
+ RegistryKeyCloser( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::registry::XRegistryKey > & xKey )
+ : m_xKey( xKey ) {}
+ ~RegistryKeyCloser()
+ { if ( m_xKey.is() ) { try { if ( m_xKey->isValid() ) m_xKey->closeKey(); } catch (...) {} } }
+
+ void reset() { m_xKey.clear(); }
+private:
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::registry::XRegistryKey > m_xKey;
+};
+
+//--------------------------------------------------------------------------------------------------
+
+// helper to create XTypeDescription instances using RegistryTypeReader
+// (used from Type Provider and Type Description Enumeration implementation)
+::com::sun::star::uno::Reference<
+ ::com::sun::star::reflection::XTypeDescription >
+createTypeDescription(
+ const RegistryTypeReaderLoader & rLoader,
+ const ::com::sun::star::uno::Sequence< sal_Int8 > & rData,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XHierarchicalNameAccess > & xNameAccess,
+ bool bReturnEmptyRefForUnknownType );
+
+//--------------------------------------------------------------------------------------------------
+
extern rtl_StandardModuleCount g_moduleCount;
+
//--------------------------------------------------------------------------------------------------
inline sal_Int32 getRTValueAsInt32( const RTConstValue & rVal )
{
@@ -337,6 +383,71 @@ public:
virtual Reference< XTypeDescription > SAL_CALL getReferencedType() throw(::com::sun::star::uno::RuntimeException);
};
-}
+//==================================================================================================
+class ServiceTypeDescriptionImpl : public WeakImplHelper1< XServiceTypeDescription >
+{
+ Mutex _aMutex;
+ OUString _aName;
+ Sequence< sal_Int8 > _aBytes;
+ Reference< XHierarchicalNameAccess > _xTDMgr;
+
+ Sequence< Reference< XServiceTypeDescription > > * _pMandatoryServices;
+ Sequence< Reference< XServiceTypeDescription > > * _pOptionalServices;
+ Sequence< Reference< XInterfaceTypeDescription > > * _pMandatoryInterfaces;
+ Sequence< Reference< XInterfaceTypeDescription > > * _pOptionalInterfaces;
+
+ Sequence< PropertyDescription > * _pProps;
+public:
+ ServiceTypeDescriptionImpl( const Reference< XHierarchicalNameAccess > & xTDMgr,
+ const OUString & rName,
+ const Sequence< sal_Int8 > & rBytes)
+ : _aName( rName ), _aBytes( rBytes ), _xTDMgr( xTDMgr ),
+ _pMandatoryServices( 0 ), _pOptionalServices( 0 ),
+ _pMandatoryInterfaces ( 0 ), _pOptionalInterfaces( 0 ), _pProps( 0 )
+ {
+ g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt );
+ }
+ virtual ~ServiceTypeDescriptionImpl();
+
+ // XTypeDescription
+ virtual TypeClass SAL_CALL
+ getTypeClass()
+ throw(::com::sun::star::uno::RuntimeException);
+ virtual OUString SAL_CALL
+ getName()
+ throw(::com::sun::star::uno::RuntimeException);
+
+ // XServiceTypeDescription
+ virtual ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::reflection::XServiceTypeDescription > > SAL_CALL
+ getMandatoryServices()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::reflection::XServiceTypeDescription > > SAL_CALL
+ getOptionalServices()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::reflection::XInterfaceTypeDescription > > SAL_CALL
+ getMandatoryInterfaces()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::reflection::XInterfaceTypeDescription > > SAL_CALL
+ getOptionalInterfaces()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence<
+ ::com::sun::star::reflection::PropertyDescription > SAL_CALL
+ getProperties()
+ throw (::com::sun::star::uno::RuntimeException);
+
+private:
+ void getReferences();
+};
+
+}
+#endif /* _STOC_RDBTDP_BASE_HXX */
diff --git a/stoc/source/registry_tdprovider/makefile.mk b/stoc/source/registry_tdprovider/makefile.mk
index ac566cb71bea..c2550d0d5f0b 100644
--- a/stoc/source/registry_tdprovider/makefile.mk
+++ b/stoc/source/registry_tdprovider/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.8 $
+# $Revision: 1.9 $
#
-# last change: $Author: jbu $ $Date: 2001-06-29 16:41:48 $
+# last change: $Author: kso $ $Date: 2002-11-11 08:35:47 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -79,10 +79,13 @@ COMP1TYPELIST=$(TARGET)
SLOFILES= \
$(SLO)$/tdprovider.obj \
+ $(SLO)$/td.obj \
$(SLO)$/tdef.obj \
$(SLO)$/tdenum.obj \
$(SLO)$/tdcomp.obj \
- $(SLO)$/tdiface.obj
+ $(SLO)$/tdiface.obj \
+ $(SLO)$/tdservice.obj \
+ $(SLO)$/rdbtdp_tdenumeration.obj
SHL1TARGET= $(TARGET)
diff --git a/stoc/source/registry_tdprovider/rdbtdp_tdenumeration.cxx b/stoc/source/registry_tdprovider/rdbtdp_tdenumeration.cxx
new file mode 100644
index 000000000000..a12f21cd47b0
--- /dev/null
+++ b/stoc/source/registry_tdprovider/rdbtdp_tdenumeration.cxx
@@ -0,0 +1,572 @@
+/*************************************************************************
+ *
+ * $RCSfile: rdbtdp_tdenumeration.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: kso $ $Date: 2002-11-11 08:35:46 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+//=========================================================================
+// Todo:
+//
+// - closeKey() calls (according to JSC not really needed because XRegistry
+// implementation closes key in it's dtor.
+//
+//=========================================================================
+
+#ifndef _OSL_DIAGNOSE_H_
+#include <osl/diagnose.h>
+#endif
+#ifndef _REGISTRY_REFLREAD_HXX_
+#include <registry/reflread.hxx>
+#endif
+
+#ifndef _STOC_RDBTDP_BASE_HXX
+#include "base.hxx"
+#endif
+#ifndef _STOC_RDBTDP_TDENUMERATION_HXX
+#include "rdbtdp_tdenumeration.hxx"
+#endif
+
+using namespace com::sun::star;
+
+namespace stoc_rdbtdp
+{
+
+//=========================================================================
+//=========================================================================
+//
+// TypeDescriptionEnumerationImpl Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+// static
+rtl::Reference< TypeDescriptionEnumerationImpl >
+TypeDescriptionEnumerationImpl::createInstance(
+ const uno::Reference< uno::XComponentContext > & xContext,
+ const rtl::OUString & rModuleName,
+ const uno::Sequence< uno::TypeClass > & rTypes,
+ reflection::TypeDescriptionSearchDepth eDepth,
+ const RegistryTypeReaderLoader & rLoader,
+ const RegistryKeyList & rBaseKeys )
+ throw ( reflection::NoSuchTypeNameException,
+ reflection::InvalidTypeNameException,
+ uno::RuntimeException )
+{
+ if ( rModuleName.getLength() == 0 )
+ {
+ // Enumeration for root requested.
+ return rtl::Reference< TypeDescriptionEnumerationImpl >(
+ new TypeDescriptionEnumerationImpl(
+ xContext, rBaseKeys, rTypes, eDepth, rLoader ) );
+ }
+
+ RegistryKeyList aModuleKeys;
+
+ if ( rLoader.isLoaded() )
+ {
+ rtl::OUString aKey( rModuleName.replace( '.', '/' ) );
+
+ bool bOpenKeySucceeded = false;
+
+ const RegistryKeyList::const_iterator end = rBaseKeys.end();
+ RegistryKeyList::const_iterator it = rBaseKeys.begin();
+
+ while ( it != end )
+ {
+ uno::Reference< registry::XRegistryKey > xKey;
+ try
+ {
+ xKey = (*it)->openKey( aKey );
+ if ( xKey.is() )
+ {
+ // closes key in it's dtor (which is
+ // called even in case of exceptions).
+ RegistryKeyCloser aCloser( xKey );
+
+ if ( xKey->isValid() )
+ {
+ bOpenKeySucceeded = true;
+
+ if ( xKey->getValueType()
+ == registry::RegistryValueType_BINARY )
+ {
+ uno::Sequence< sal_Int8 > aBytes(
+ xKey->getBinaryValue() );
+
+ RegistryTypeReader aReader(
+ rLoader,
+ (const sal_uInt8 *)aBytes.getConstArray(),
+ aBytes.getLength(),
+ sal_False );
+
+ rtl::OUString aName(
+ aReader.getTypeName().replace( '/', '.' ) );
+
+ if ( aReader.getTypeClass() == RT_TYPE_MODULE )
+ {
+ // Do not close xKey!
+ aCloser.reset();
+
+ aModuleKeys.push_back( xKey );
+ }
+ }
+ }
+ else
+ {
+ OSL_ENSURE( sal_False,
+ "TypeDescriptionEnumerationImpl::createInstance "
+ "- Invalid registry key!" );
+ }
+ }
+ }
+ catch ( registry::InvalidRegistryException const & )
+ {
+ // openKey, getValueType, getBinaryValue
+
+ OSL_ENSURE( sal_False,
+ "TypeDescriptionEnumerationImpl::createInstance "
+ "- Caught InvalidRegistryException!" );
+ }
+
+ it++;
+ }
+
+ if ( !bOpenKeySucceeded )
+ throw reflection::NoSuchTypeNameException();
+
+ if ( aModuleKeys.size() == 0 )
+ throw reflection::InvalidTypeNameException();
+ }
+
+ return rtl::Reference< TypeDescriptionEnumerationImpl >(
+ new TypeDescriptionEnumerationImpl(
+ xContext, aModuleKeys, rTypes, eDepth, rLoader ) );
+}
+
+//=========================================================================
+TypeDescriptionEnumerationImpl::TypeDescriptionEnumerationImpl(
+ const uno::Reference<
+ uno::XComponentContext > & xContext,
+ const RegistryKeyList & rModuleKeys,
+ const uno::Sequence< uno::TypeClass > & rTypes,
+ reflection::TypeDescriptionSearchDepth eDepth,
+ const RegistryTypeReaderLoader & rLoader )
+: m_aModuleKeys( rModuleKeys ),
+ m_aTypes( rTypes ),
+ m_eDepth( eDepth ),
+ m_aLoader( rLoader ),
+ m_xContext( xContext )
+{
+ g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt );
+}
+
+//=========================================================================
+// virtual
+TypeDescriptionEnumerationImpl::~TypeDescriptionEnumerationImpl()
+{
+ RegistryKeyList::const_iterator it = m_aModuleKeys.begin();
+ RegistryKeyList::const_iterator end = m_aModuleKeys.end();
+/*
+ @@@ in case we enumerate root and queryMore was never called, then
+ m_aModuleKeys contains open root keys which where passed from
+ tdprov and must not be closed by us.
+
+ while ( it != end )
+ {
+ try
+ {
+ if ( (*it)->isValid() )
+ (*it)->closeKey();
+ }
+ catch (...)
+ {
+ // No exceptions from dtors, please!
+ OSL_ENSURE( sal_False,
+ "TypeDescriptionEnumerationImpl::~TypeDescriptionEnumerationImpl "
+ "- Caught exception!" );
+ }
+
+ it++;
+ }
+*/
+ it = m_aCurrentModuleSubKeys.begin();
+ end = m_aCurrentModuleSubKeys.end();
+ while ( it != end )
+ {
+ try
+ {
+ if ( (*it)->isValid() )
+ (*it)->closeKey();
+ }
+ catch (...)
+ {
+ // No exceptions from dtors, please!
+ OSL_ENSURE( sal_False,
+ "TypeDescriptionEnumerationImpl::~TypeDescriptionEnumerationImpl "
+ "- Caught exception!" );
+ }
+
+ it++;
+ }
+
+ g_moduleCount.modCnt.release( &g_moduleCount.modCnt );
+}
+
+//=========================================================================
+//
+// XEnumeration (base of XTypeDescriptionEnumeration) methods
+//
+//=========================================================================
+
+// virtual
+sal_Bool SAL_CALL TypeDescriptionEnumerationImpl::hasMoreElements()
+ throw ( uno::RuntimeException )
+{
+ return queryMore();
+}
+
+//=========================================================================
+// virtual
+uno::Any SAL_CALL TypeDescriptionEnumerationImpl::nextElement()
+ throw ( container::NoSuchElementException,
+ lang::WrappedTargetException,
+ uno::RuntimeException )
+{
+ return uno::Any( uno::makeAny( nextTypeDescription() ) );
+}
+
+//=========================================================================
+//
+// XTypeDescriptionEnumeration methods
+//
+//=========================================================================
+
+// virtual
+uno::Reference< reflection::XTypeDescription > SAL_CALL
+TypeDescriptionEnumerationImpl::nextTypeDescription()
+ throw ( container::NoSuchElementException,
+ uno::RuntimeException )
+{
+ uno::Reference< reflection::XTypeDescription > xTD( queryNext() );
+
+ if ( xTD.is() )
+ return xTD;
+
+ throw container::NoSuchElementException(
+ rtl::OUString::createFromAscii(
+ "No further elements in enumeration!" ),
+ static_cast< cppu::OWeakObject * >( this ) );
+}
+
+//=========================================================================
+bool TypeDescriptionEnumerationImpl::queryMore()
+{
+ osl::MutexGuard aGuard( m_aMutex );
+
+ for (;;)
+ {
+ if ( !m_aCurrentModuleSubKeys.empty() )
+ {
+ // Okay, there is at least one more element.
+ return true;
+ }
+
+ if ( m_aModuleKeys.empty() )
+ {
+ // No module keys (therefore no elements) left.
+ return false;
+ }
+
+ // Note: m_aCurrentModuleSubKeys is always empty AND m_aModuleKeys is
+ // never empty when ariving here.
+ // ==> select new module key, fill m_aCurrentModuleSubKeys
+
+ uno::Sequence< uno::Reference< registry::XRegistryKey > > aKeys;
+ try
+ {
+ aKeys = m_aModuleKeys.front()->openKeys();
+ for ( sal_Int32 n = 0; n < aKeys.getLength(); ++n )
+ {
+ uno::Reference< registry::XRegistryKey > xKey = aKeys[ n ];
+
+ // closes key in it's dtor (which is
+ // called even in case of exceptions).
+ RegistryKeyCloser aCloser( xKey );
+
+ try
+ {
+ if ( xKey->isValid() )
+ {
+ if ( xKey->getValueType()
+ == registry::RegistryValueType_BINARY )
+ {
+ bool bIncludeIt = (m_aTypes.getLength() == 0);
+ bool bNeedTypeClass =
+ ((m_aTypes.getLength() > 0) ||
+ (m_eDepth
+ == reflection::TypeDescriptionSearchDepth_INFINITE));
+ if ( bNeedTypeClass )
+ {
+ uno::Sequence< sal_Int8 > aBytes(
+ xKey->getBinaryValue() );
+
+ RegistryTypeReader aReader(
+ m_aLoader,
+ (const sal_uInt8 *)aBytes.getConstArray(),
+ aBytes.getLength(),
+ sal_False );
+
+ RTTypeClass eTypeClass = aReader.getTypeClass();
+
+ // Does key match requested types? Empty
+ // sequence means include all.
+ if ( m_aTypes.getLength() > 0 )
+ {
+ for ( sal_Int32 m = 0;
+ m < m_aTypes.getLength();
+ ++m )
+ {
+ if ( m_aTypes[ m ] == eTypeClass )
+ {
+ bIncludeIt = true;
+ break;
+ }
+ }
+ }
+
+ if ( m_eDepth ==
+ reflection::TypeDescriptionSearchDepth_INFINITE )
+ {
+ if ( eTypeClass == RT_TYPE_MODULE )
+ {
+ // Do not close xKey!
+ aCloser.reset();
+
+ // Remember new module key.
+ m_aModuleKeys.push_back( xKey );
+ }
+ }
+ }
+
+ if ( bIncludeIt )
+ {
+ // Do not close xKey!
+ aCloser.reset();
+
+ m_aCurrentModuleSubKeys.push_back( xKey );
+ }
+ }
+ }
+ else
+ {
+ OSL_ENSURE( sal_False,
+ "TypeDescriptionEnumerationImpl::queryMore "
+ "- Invalid registry key!" );
+ }
+
+ }
+ catch ( registry::InvalidRegistryException const & )
+ {
+ // getValueType, getBinaryValue
+
+ OSL_ENSURE( sal_False,
+ "TypeDescriptionEnumerationImpl::queryMore "
+ "- Caught InvalidRegistryException!" );
+
+ // Don't stop iterating!
+ }
+ }
+ }
+ catch ( registry::InvalidRegistryException const & )
+ {
+ // openKeys
+
+ for ( sal_Int32 n = 0; n < aKeys.getLength(); ++n )
+ {
+ try
+ {
+ aKeys[ n ]->closeKey();
+ }
+ catch ( registry::InvalidRegistryException const & )
+ {
+ OSL_ENSURE( sal_False,
+ "TypeDescriptionEnumerationImpl::queryMore "
+ "- Caught InvalidRegistryException!" );
+ }
+ }
+ }
+/*
+ @@@ m_aModuleKeys.front() may have open sub keys (may be contained in
+ both m_aModuleKeys and m_aCurrentModuleSubKeys)!
+
+ try
+ {
+ m_aModuleKeys.front()->closeKey();
+ }
+ catch ( registry::InvalidRegistryException const & )
+ {
+ OSL_ENSURE( sal_False,
+ "TypeDescriptionEnumerationImpl::queryMore "
+ "- Caught InvalidRegistryException!" );
+ }
+*/
+ // We're done with this module key, even if there were errors.
+ m_aModuleKeys.pop_front();
+ }
+
+ // unreachable
+}
+
+//=========================================================================
+uno::Reference< reflection::XTypeDescription >
+TypeDescriptionEnumerationImpl::queryNext()
+{
+ osl::MutexGuard aGuard( m_aMutex );
+
+ for (;;)
+ {
+ if ( !queryMore() )
+ return uno::Reference< reflection::XTypeDescription >();
+
+ // Note: xKey is already opened.
+ uno::Reference< registry::XRegistryKey >
+ xKey( m_aCurrentModuleSubKeys.front() );
+/*
+ @@@ xKey may still be contained in m_aModuleKeys, too
+
+ // closes key in it's dtor (which is
+ // called even in case of exceptions).
+ RegistryKeyCloser aCloser( xKey );
+*/
+ uno::Reference< reflection::XTypeDescription > xTD;
+ try
+ {
+ {
+ if ( xKey->isValid() )
+ {
+ if ( xKey->getValueType()
+ == registry::RegistryValueType_BINARY )
+ {
+ uno::Sequence< sal_Int8 > aBytes(
+ xKey->getBinaryValue() );
+
+ xTD = createTypeDescription( m_aLoader,
+ aBytes,
+ getTDMgr(),
+ false );
+ OSL_ENSURE( xTD.is(),
+ "TypeDescriptionEnumerationImpl::queryNext "
+ "- No XTypeDescription created!" );
+ }
+ }
+ else
+ {
+ OSL_ENSURE( sal_False,
+ "TypeDescriptionEnumerationImpl::queryNext "
+ "- Invalid registry key!" );
+ }
+ }
+ }
+ catch ( registry::InvalidRegistryException const & )
+ {
+ // getValueType, getBinaryValue
+
+ OSL_ENSURE( sal_False,
+ "TypeDescriptionEnumerationImpl::queryNext "
+ "- Caught InvalidRegistryException!" );
+ }
+
+ // We're done with this key, even if there were errors.
+ m_aCurrentModuleSubKeys.pop_front();
+
+ if ( xTD.is() )
+ return xTD;
+
+ // next try...
+
+ } // for (;;)
+
+ return uno::Reference< reflection::XTypeDescription >();
+}
+
+//=========================================================================
+uno::Reference< container::XHierarchicalNameAccess >
+TypeDescriptionEnumerationImpl::getTDMgr()
+{
+ if ( !m_xTDMgr.is() )
+ {
+ uno::Reference< container::XHierarchicalNameAccess > xTDMgr;
+ m_xContext->getValueByName(
+ rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
+ "/singletons/com.sun.star.reflection.theTypeDescriptionManager" ) ) )
+ >>= xTDMgr;
+
+ OSL_ENSURE( xTDMgr.is(),
+ "TypeDescriptionEnumerationImpl::getTDMgr "
+ "Cannot get singleton \"TypeDescriptionManager\" from context!" );
+ {
+ MutexGuard guard( m_aMutex );
+ if ( !m_xTDMgr.is() )
+ m_xTDMgr = xTDMgr;
+ }
+ }
+ return m_xTDMgr;
+}
+
+} // namespace stoc_rdbtdp
+
diff --git a/stoc/source/registry_tdprovider/rdbtdp_tdenumeration.hxx b/stoc/source/registry_tdprovider/rdbtdp_tdenumeration.hxx
new file mode 100644
index 000000000000..8cc85aa99bbb
--- /dev/null
+++ b/stoc/source/registry_tdprovider/rdbtdp_tdenumeration.hxx
@@ -0,0 +1,173 @@
+/*************************************************************************
+ *
+ * $RCSfile: rdbtdp_tdenumeration.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: kso $ $Date: 2002-11-11 08:35:46 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _STOC_RDBTDP_TDENUMERATION_HXX
+#define _STOC_RDBTDP_TDENUMERATION_HXX
+
+#ifndef _OSL_MUTEX_HXX_
+#include <osl/mutex.hxx>
+#endif
+#ifndef _RTL_REF_HXX_
+#include <rtl/ref.hxx>
+#endif
+#ifndef _COM_SUN_STAR_CONTAINER_XHIERARCHICALNAMEACCESS_HPP_
+#include <com/sun/star/container/XHierarchicalNameAccess.hpp>
+#endif
+#ifndef _COM_SUN_STAR_REFLECTION_INVALIDTYPENAMEEXCEPTION_HPP_
+#include <com/sun/star/reflection/InvalidTypeNameException.hpp>
+#endif
+#ifndef _COM_SUN_STAR_REFLECTION_NOSUCHTYPENAMEEXCEPTION_HPP_
+#include <com/sun/star/reflection/NoSuchTypeNameException.hpp>
+#endif
+#ifndef _COM_SUN_STAR_REFLECTION_TYPEDESCRIPTIONSEARCHDEPTH_HPP_
+#include <com/sun/star/reflection/TypeDescriptionSearchDepth.hpp>
+#endif
+#ifndef _COM_SUN_STAR_REFLECTION_XTYPEDESCRIPTIONENUMERATION_HPP_
+#include <com/sun/star/reflection/XTypeDescriptionEnumeration.hpp>
+#endif
+#ifndef _COM_SUN_STAR_UNO_SEQUENCE_HXX_
+#include <com/sun/star/uno/Sequence.hxx>
+#endif
+#ifndef _COM_SUN_STAR_UNO_TYPECLASS_HPP_
+#include <com/sun/star/uno/TypeClass.hpp>
+#endif
+#ifndef _CPPUHELPER_IMPLBASE1_HXX_
+#include <cppuhelper/implbase1.hxx>
+#endif
+
+#ifndef _STOC_RDBTDP_BASE_HXX
+#include "base.hxx"
+#endif
+
+class RegistryTypeReaderLoader;
+
+namespace stoc_rdbtdp
+{
+class TypeDescriptionEnumerationImpl
+ : public cppu::WeakImplHelper1<
+ com::sun::star::reflection::XTypeDescriptionEnumeration >
+{
+public:
+ static rtl::Reference< TypeDescriptionEnumerationImpl > createInstance(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext,
+ const rtl::OUString & rModuleName,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::TypeClass > & rTypes,
+ ::com::sun::star::reflection::TypeDescriptionSearchDepth eDepth,
+ const RegistryTypeReaderLoader & rLoader,
+ const RegistryKeyList & rBaseKeys )
+ throw ( ::com::sun::star::reflection::NoSuchTypeNameException,
+ ::com::sun::star::reflection::InvalidTypeNameException,
+ ::com::sun::star::uno::RuntimeException );
+
+ virtual ~TypeDescriptionEnumerationImpl();
+
+ // XEnumeration (base of XTypeDescriptionEnumeration)
+ virtual sal_Bool SAL_CALL hasMoreElements()
+ throw ( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Any SAL_CALL nextElement()
+ throw ( ::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException );
+
+ // XTypeDescriptionEnumeration
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::reflection::XTypeDescription > SAL_CALL
+ nextTypeDescription()
+ throw ( ::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::uno::RuntimeException );
+
+private:
+ // Note: keys must be open (XRegistryKey->openKey(...)).
+ TypeDescriptionEnumerationImpl(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext > & xContext,
+ const RegistryKeyList & rModuleKeys,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::TypeClass > & rTypes,
+ ::com::sun::star::reflection::TypeDescriptionSearchDepth eDepth,
+ const RegistryTypeReaderLoader & rLoader );
+
+ bool queryMore();
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::reflection::XTypeDescription > queryNext();
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XHierarchicalNameAccess > getTDMgr();
+
+ // members
+ osl::Mutex m_aMutex;
+ RegistryKeyList m_aModuleKeys;
+ RegistryKeyList m_aCurrentModuleSubKeys;
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::TypeClass > m_aTypes;
+ ::com::sun::star::reflection::TypeDescriptionSearchDepth m_eDepth;
+ RegistryTypeReaderLoader m_aLoader;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >
+ m_xContext;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::container::XHierarchicalNameAccess > m_xTDMgr;
+};
+
+} // namespace stoc_rdbtdp
+
+#endif /* _STOC_RDBTDP_TDENUMERATION_HXX */
+
diff --git a/stoc/source/registry_tdprovider/td.cxx b/stoc/source/registry_tdprovider/td.cxx
new file mode 100644
index 000000000000..c86848b13a8d
--- /dev/null
+++ b/stoc/source/registry_tdprovider/td.cxx
@@ -0,0 +1,89 @@
+/*************************************************************************
+ *
+ * $RCSfile: td.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: kso $ $Date: 2002-11-11 08:35:46 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _STOC_RDBTDP_BASE_HXX
+#include "base.hxx"
+#endif
+
+namespace stoc_rdbtdp
+{
+TypeDescriptionImpl::~TypeDescriptionImpl()
+{
+ g_moduleCount.modCnt.release( &g_moduleCount.modCnt );
+}
+
+// XTypeDescription
+//__________________________________________________________________________________________________
+TypeClass TypeDescriptionImpl::getTypeClass()
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ return _eTypeClass;
+}
+//__________________________________________________________________________________________________
+OUString TypeDescriptionImpl::getName()
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ return _aName;
+}
+
+}
+
+
diff --git a/stoc/source/registry_tdprovider/tdcomp.cxx b/stoc/source/registry_tdprovider/tdcomp.cxx
index f250d335e7c5..58cc3c92b50b 100644
--- a/stoc/source/registry_tdprovider/tdcomp.cxx
+++ b/stoc/source/registry_tdprovider/tdcomp.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: tdcomp.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: jbu $ $Date: 2001-06-22 16:21:00 $
+ * last change: $Author: kso $ $Date: 2002-11-11 08:35:47 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -59,7 +59,9 @@
*
************************************************************************/
+#ifndef _STOC_RDBTDP_BASE_HXX
#include "base.hxx"
+#endif
namespace stoc_rdbtdp
{
diff --git a/stoc/source/registry_tdprovider/tdef.cxx b/stoc/source/registry_tdprovider/tdef.cxx
index 74b664efb26c..35f25eb3e778 100644
--- a/stoc/source/registry_tdprovider/tdef.cxx
+++ b/stoc/source/registry_tdprovider/tdef.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: tdef.cxx,v $
*
- * $Revision: 1.4 $
+ * $Revision: 1.5 $
*
- * last change: $Author: jbu $ $Date: 2001-06-22 16:21:00 $
+ * last change: $Author: kso $ $Date: 2002-11-11 08:35:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -59,7 +59,9 @@
*
************************************************************************/
+#ifndef _STOC_RDBTDP_BASE_HXX
#include "base.hxx"
+#endif
namespace stoc_rdbtdp
{
diff --git a/stoc/source/registry_tdprovider/tdenum.cxx b/stoc/source/registry_tdprovider/tdenum.cxx
index d1ed504fd9ee..fbd96e772641 100644
--- a/stoc/source/registry_tdprovider/tdenum.cxx
+++ b/stoc/source/registry_tdprovider/tdenum.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: tdenum.cxx,v $
*
- * $Revision: 1.3 $
+ * $Revision: 1.4 $
*
- * last change: $Author: jbu $ $Date: 2001-06-22 16:21:00 $
+ * last change: $Author: kso $ $Date: 2002-11-11 08:35:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -59,7 +59,9 @@
*
************************************************************************/
+#ifndef _STOC_RDBTDP_BASE_HXX
#include "base.hxx"
+#endif
namespace stoc_rdbtdp
{
diff --git a/stoc/source/registry_tdprovider/tdiface.cxx b/stoc/source/registry_tdprovider/tdiface.cxx
index e67087ee7b8b..bb1aed6bf55a 100644
--- a/stoc/source/registry_tdprovider/tdiface.cxx
+++ b/stoc/source/registry_tdprovider/tdiface.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: tdiface.cxx,v $
*
- * $Revision: 1.5 $
+ * $Revision: 1.6 $
*
- * last change: $Author: jbu $ $Date: 2001-06-22 16:21:00 $
+ * last change: $Author: kso $ $Date: 2002-11-11 08:35:48 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -71,8 +71,9 @@
#include <com/sun/star/reflection/XInterfaceMethodTypeDescription.hpp>
#include <com/sun/star/reflection/XMethodParameter.hpp>
+#ifndef _STOC_RDBTDP_BASE_HXX
#include "base.hxx"
-
+#endif
namespace stoc_rdbtdp
{
diff --git a/stoc/source/registry_tdprovider/tdprovider.cxx b/stoc/source/registry_tdprovider/tdprovider.cxx
index 654c83927674..110741a626c9 100644
--- a/stoc/source/registry_tdprovider/tdprovider.cxx
+++ b/stoc/source/registry_tdprovider/tdprovider.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: tdprovider.cxx,v $
*
- * $Revision: 1.8 $
+ * $Revision: 1.9 $
*
- * last change: $Author: dbo $ $Date: 2001-10-11 14:53:51 $
+ * last change: $Author: kso $ $Date: 2002-11-11 08:35:49 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -76,8 +76,8 @@
#ifndef _CPPUHELPER_FACTORY_HXX_
#include <cppuhelper/factory.hxx>
#endif
-#ifndef _CPPUHELPER_COMPBASE3_HXX_
-#include <cppuhelper/compbase3.hxx>
+#ifndef _CPPUHELPER_COMPBASE4_HXX_
+#include <cppuhelper/compbase4.hxx>
#endif
#ifndef _CPPUHELPER_TYPEPROVIDER_HXX_
#include <cppuhelper/typeprovider.hxx>
@@ -90,10 +90,14 @@
#include <com/sun/star/registry/XSimpleRegistry.hpp>
#include <com/sun/star/registry/XRegistryKey.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/reflection/XTypeDescriptionEnumerationAccess.hpp>
-#include <list>
-
+#ifndef _STOC_RDBTDP_BASE_HXX
#include "base.hxx"
+#endif
+#ifndef _STOC_RDBTDP_TDENUMERATION_HXX
+#include "rdbtdp_tdenumeration.hxx"
+#endif
#define SERVICENAME "com.sun.star.reflection.TypeDescriptionProvider"
#define IMPLNAME "com.sun.star.comp.stoc.RegistryTypeDescriptionProvider"
@@ -136,8 +140,6 @@ static OUString rdbtdp_getImplementationName()
return *pImplName;
}
-typedef ::std::list< Reference< XRegistryKey > > RegistryKeyList;
-
struct MutexHolder
{
Mutex _aComponentMutex;
@@ -145,7 +147,10 @@ struct MutexHolder
//==================================================================================================
class ProviderImpl
: public MutexHolder
- , public WeakComponentImplHelper3< XServiceInfo, XHierarchicalNameAccess, XInitialization >
+ , public WeakComponentImplHelper4< XServiceInfo,
+ XHierarchicalNameAccess,
+ XTypeDescriptionEnumerationAccess,
+ XInitialization >
{
Reference< XComponentContext > _xContext;
Reference< XHierarchicalNameAccess > _xTDMgr;
@@ -172,11 +177,24 @@ public:
// XHierarchicalNameAccess
virtual Any SAL_CALL getByHierarchicalName( const OUString & rName ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
virtual sal_Bool SAL_CALL hasByHierarchicalName( const OUString & rName ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XTypeDescriptionEnumerationAccess
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::reflection::XTypeDescriptionEnumeration > SAL_CALL
+ createTypeDescriptionEnumeration(
+ const ::rtl::OUString& moduleName,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::TypeClass >& types,
+ ::com::sun::star::reflection::TypeDescriptionSearchDepth depth )
+ throw ( ::com::sun::star::reflection::NoSuchTypeNameException,
+ ::com::sun::star::reflection::InvalidTypeNameException,
+ ::com::sun::star::uno::RuntimeException );
};
//__________________________________________________________________________________________________
ProviderImpl::ProviderImpl( const Reference< XComponentContext > & xContext )
- : WeakComponentImplHelper3<
- XServiceInfo, XHierarchicalNameAccess, XInitialization >( _aComponentMutex )
+ : WeakComponentImplHelper4<
+ XServiceInfo, XHierarchicalNameAccess,
+ XTypeDescriptionEnumerationAccess, XInitialization >( _aComponentMutex )
, _xContext( xContext )
{
g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt );
@@ -286,121 +304,93 @@ Any SAL_CALL ProviderImpl::getByHierarchicalName( const OUString & rName )
for ( RegistryKeyList::const_iterator iPos( _aBaseKeys.begin() );
!aRet.hasValue() && iPos != _aBaseKeys.end(); ++iPos )
{
- Reference< XRegistryKey > xBaseKey( *iPos );
- Reference< XRegistryKey > xKey( xBaseKey->openKey( aKey ) );
- if (xKey.is())
+ try
{
- if (xKey->getValueType() == RegistryValueType_BINARY)
+ Reference< XRegistryKey > xBaseKey( *iPos );
+ Reference< XRegistryKey > xKey( xBaseKey->openKey( aKey ) );
+ if (xKey.is())
{
- Sequence< sal_Int8 > aBytes( xKey->getBinaryValue() );
- RegistryTypeReader aReader(
- _aLoader, (const sal_uInt8 *)aBytes.getConstArray(), aBytes.getLength(), sal_False );
-
- OUString aName( aReader.getTypeName().replace( '/', '.' ) );
+ // closes key in it's dtor (which is
+ // called even in case of exceptions).
+ RegistryKeyCloser aCloser( xKey );
- switch (aReader.getTypeClass())
+ if ( xKey->isValid() )
{
- case RT_TYPE_INTERFACE:
- {
- RTUik aUik;
- aReader.getUik( aUik );
- aRet <<= Reference< XTypeDescription >( new InterfaceTypeDescriptionImpl(
- getTDMgr(), aName,
- aReader.getSuperTypeName().replace( '/', '.' ),
- aUik, aBytes ) );
- break;
- }
- case RT_TYPE_EXCEPTION:
- aRet <<= Reference< XTypeDescription >( new CompoundTypeDescriptionImpl(
- getTDMgr(), TypeClass_EXCEPTION, aName,
- aReader.getSuperTypeName().replace( '/', '.' ),
- aBytes ) );
- break;
- case RT_TYPE_STRUCT:
- aRet <<= Reference< XTypeDescription >( new CompoundTypeDescriptionImpl(
- getTDMgr(), TypeClass_STRUCT, aName,
- aReader.getSuperTypeName().replace( '/', '.' ),
- aBytes ) );
- break;
- case RT_TYPE_ENUM:
- aRet <<= Reference< XTypeDescription >( new EnumTypeDescriptionImpl(
- getTDMgr(), aName,
- getRTValueAsInt32( aReader.getFieldConstValue( 0 ) ),
- aBytes ) );
- break;
- case RT_TYPE_TYPEDEF:
- aRet <<= Reference< XTypeDescription >( new TypedefTypeDescriptionImpl(
- getTDMgr(), aName,
- aReader.getSuperTypeName().replace( '/', '.' ) ) );
- break;
-
-/* // these following are in question
- case RT_TYPE_MODULE:
- aRet <<= Reference< XTypeDescription >( new TypeDescriptionImpl(
- TypeClass_MODULE, aName ) );
- break;
- case RT_TYPE_SERVICE:
- aRet <<= Reference< XTypeDescription >( new TypeDescriptionImpl(
- TypeClass_SERVICE, aName ) );
- break;
-// case RT_TYPE_INVALID:
-// case RT_TYPE_CONSTANTS:
-// case RT_TYPE_OBJECT:
- default: // existing registry node
- aRet <<= Reference< XTypeDescription >( new TypeDescriptionImpl(
- TypeClass_UNKNOWN, aName ) );
- break;
-*/
+ if (xKey->getValueType() == RegistryValueType_BINARY)
+ {
+ Sequence< sal_Int8 > aBytes( xKey->getBinaryValue() );
+ Reference< XTypeDescription > xTD(
+ createTypeDescription( _aLoader,
+ aBytes,
+ getTDMgr(),
+ true ) );
+ if ( xTD.is() )
+ aRet <<= xTD;
+ }
}
}
- xKey->closeKey();
- }
- else // might be a constant
- {
- sal_Int32 nIndex = aKey.lastIndexOf( '/' );
- if (nIndex > 0)
+ else // might be a constant
{
- // open module
- Reference< XRegistryKey > xKey( xBaseKey->openKey( aKey.copy( 0, nIndex ) ) );
- if (xKey.is())
+ sal_Int32 nIndex = aKey.lastIndexOf( '/' );
+ if (nIndex > 0)
{
- if (xKey->getValueType() == RegistryValueType_BINARY)
+ // open module
+ Reference< XRegistryKey > xKey( xBaseKey->openKey( aKey.copy( 0, nIndex ) ) );
+ if (xKey.is())
{
- Sequence< sal_Int8 > aBytes( xKey->getBinaryValue() );
- RegistryTypeReader aReader(
- _aLoader, (const sal_uInt8 *)aBytes.getConstArray(),
- aBytes.getLength(), sal_False );
+ // closes key in it's dtor (which is
+ // called even in case of exceptions).
+ RegistryKeyCloser aCloser( xKey );
- if (aReader.getTypeClass() == RT_TYPE_MODULE ||
- aReader.getTypeClass() == RT_TYPE_CONSTANTS ||
- aReader.getTypeClass() == RT_TYPE_ENUM)
+ if ( xKey->isValid() )
{
- OUString aFieldName( aKey.copy( nIndex+1, aKey.getLength() - nIndex -1 ) );
- sal_Int32 nPos = aReader.getFieldCount();
- while (nPos--)
+ if (xKey->getValueType() == RegistryValueType_BINARY)
{
- if ( aFieldName.equals( aReader.getFieldName( (sal_uInt16)nPos )) )
- break;
+ Sequence< sal_Int8 > aBytes( xKey->getBinaryValue() );
+ RegistryTypeReader aReader(
+ _aLoader, (const sal_uInt8 *)aBytes.getConstArray(),
+ aBytes.getLength(), sal_False );
+
+ if (aReader.getTypeClass() == RT_TYPE_MODULE ||
+ aReader.getTypeClass() == RT_TYPE_CONSTANTS ||
+ aReader.getTypeClass() == RT_TYPE_ENUM)
+ {
+ OUString aFieldName( aKey.copy( nIndex+1, aKey.getLength() - nIndex -1 ) );
+ sal_Int32 nPos = aReader.getFieldCount();
+ while (nPos--)
+ {
+ if ( aFieldName.equals( aReader.getFieldName( (sal_uInt16)nPos )) )
+ break;
+ }
+ if (nPos >= 0)
+ aRet = getRTValue( aReader.getFieldConstValue( (sal_uInt16)nPos ) );
+ }
}
- if (nPos >= 0)
- aRet = getRTValue( aReader.getFieldConstValue( (sal_uInt16)nPos ) );
}
}
- xKey->closeKey();
}
}
}
+ catch ( InvalidRegistryException const & )
+ {
+ OSL_ENSURE( sal_False,
+ "ProviderImpl::getByHierarchicalName "
+ "- Caught InvalidRegistryException!" );
+
+ // openKey, closeKey, getValueType, getBinaryValue, isValid
+
+ // Don't stop iteration in this case.
+ }
}
}
- if (! aRet.hasValue())
- {
- NoSuchElementException aExc;
- aExc.Message = rName;
- throw aExc;
- }
+ if ( !aRet.hasValue() )
+ throw NoSuchElementException(
+ rName, static_cast< cppu::OWeakObject * >( this ) );
+
return aRet;
}
+
//__________________________________________________________________________________________________
sal_Bool ProviderImpl::hasByHierarchicalName( const OUString & rName )
throw(::com::sun::star::uno::RuntimeException)
@@ -415,6 +405,27 @@ sal_Bool ProviderImpl::hasByHierarchicalName( const OUString & rName )
return sal_False;
}
+// XTypeDescriptionEnumerationAccess
+//__________________________________________________________________________________________________
+// virtual
+Reference< XTypeDescriptionEnumeration > SAL_CALL
+ProviderImpl::createTypeDescriptionEnumeration(
+ const OUString & moduleName,
+ const Sequence< TypeClass > & types,
+ TypeDescriptionSearchDepth depth )
+ throw ( NoSuchTypeNameException,
+ InvalidTypeNameException,
+ RuntimeException )
+{
+ return Reference< XTypeDescriptionEnumeration >(
+ TypeDescriptionEnumerationImpl::createInstance( _xContext,
+ moduleName,
+ types,
+ depth,
+ _aLoader,
+ _aBaseKeys ).get() );
+}
+
//==================================================================================================
static Reference< XInterface > SAL_CALL ProviderImpl_create(
Reference< XComponentContext > const & xContext )
@@ -423,6 +434,95 @@ static Reference< XInterface > SAL_CALL ProviderImpl_create(
return Reference< XInterface >( *new ProviderImpl( xContext ) );
}
+//__________________________________________________________________________________________________
+// global helper function
+Reference< XTypeDescription > createTypeDescription(
+ const RegistryTypeReaderLoader & rLoader,
+ const Sequence< sal_Int8 > & rData,
+ const Reference< XHierarchicalNameAccess > & xNameAccess,
+ bool bReturnEmptyRefForUnknownType )
+{
+ RegistryTypeReader aReader( rLoader,
+ (const sal_uInt8 *)rData.getConstArray(),
+ rData.getLength(),
+ sal_False );
+
+ OUString aName( aReader.getTypeName().replace( '/', '.' ) );
+
+ switch (aReader.getTypeClass())
+ {
+ case RT_TYPE_INTERFACE:
+ {
+ RTUik aUik;
+ aReader.getUik( aUik );
+ return Reference< XTypeDescription >(
+ new InterfaceTypeDescriptionImpl( xNameAccess,
+ aName,
+ aReader.getSuperTypeName()
+ .replace( '/', '.' ),
+ aUik,
+ rData ) );
+ }
+
+ case RT_TYPE_MODULE:
+ // @@@ not quite correct, XModuleTypeDescription missing.
+ return Reference< XTypeDescription >(
+ new TypeDescriptionImpl( TypeClass_MODULE, aName ) );
+
+ case RT_TYPE_STRUCT:
+ return Reference< XTypeDescription >(
+ new CompoundTypeDescriptionImpl( xNameAccess,
+ TypeClass_STRUCT,
+ aName,
+ aReader.getSuperTypeName()
+ .replace( '/', '.' ),
+ rData ) );
+ case RT_TYPE_ENUM:
+ return Reference< XTypeDescription >(
+ new EnumTypeDescriptionImpl( xNameAccess,
+ aName,
+ getRTValueAsInt32(
+ aReader.getFieldConstValue(
+ 0 ) ),
+ rData ) );
+ case RT_TYPE_EXCEPTION:
+ return Reference< XTypeDescription >(
+ new CompoundTypeDescriptionImpl( xNameAccess,
+ TypeClass_EXCEPTION,
+ aName,
+ aReader.getSuperTypeName()
+ .replace( '/', '.' ),
+ rData ) );
+ case RT_TYPE_TYPEDEF:
+ return Reference< XTypeDescription >(
+ new TypedefTypeDescriptionImpl( xNameAccess,
+ aName,
+ aReader.getSuperTypeName()
+ .replace( '/', '.' ) ) );
+ case RT_TYPE_SERVICE:
+ return Reference< XTypeDescription >(
+ new ServiceTypeDescriptionImpl( xNameAccess, aName, rData ) );
+
+// @@@ X...Typedescription + TypeClass missing
+// case RT_TYPE_CONSTANTS:
+// case RT_TYPE_SINGLETON:
+
+// case RT_TYPE_INVALID:
+// case RT_TYPE_OBJECT: // deprecated and not used
+// case RT_TYPE_UNION: // deprecated and not used
+ default: // existing registry node
+ break;
+ }
+
+ // Unknown type.
+
+ if ( bReturnEmptyRefForUnknownType )
+ return Reference< XTypeDescription >();
+
+ return Reference< XTypeDescription >(
+ new TypeDescriptionImpl( TypeClass_UNKNOWN, aName ) );
+}
+
}
diff --git a/stoc/source/registry_tdprovider/tdservice.cxx b/stoc/source/registry_tdprovider/tdservice.cxx
new file mode 100644
index 000000000000..a6ae508c3782
--- /dev/null
+++ b/stoc/source/registry_tdprovider/tdservice.cxx
@@ -0,0 +1,406 @@
+/*************************************************************************
+ *
+ * $RCSfile: tdservice.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: kso $ $Date: 2002-11-11 08:35:47 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _OSL_DIAGNOSE_H_
+#include <osl/diagnose.h>
+#endif
+
+#ifndef _COM_SUN_STAR_BEANS_PROPERTYATTRIBUTE_HPP_
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#endif
+
+#ifndef _STOC_RDBTDP_BASE_HXX
+#include "base.hxx"
+#endif
+
+using namespace com::sun::star;
+
+namespace stoc_rdbtdp
+{
+
+//__________________________________________________________________________________________________
+// virtual
+ServiceTypeDescriptionImpl::~ServiceTypeDescriptionImpl()
+{
+ delete _pMandatoryServices;
+ delete _pOptionalServices;
+ delete _pMandatoryInterfaces;
+ delete _pOptionalInterfaces;
+ delete _pProps;
+
+ g_moduleCount.modCnt.release( &g_moduleCount.modCnt );
+}
+
+// XTypeDescription
+//__________________________________________________________________________________________________
+// virtual
+TypeClass ServiceTypeDescriptionImpl::getTypeClass()
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ return TypeClass_SERVICE;
+}
+//__________________________________________________________________________________________________
+// virtual
+OUString ServiceTypeDescriptionImpl::getName()
+ throw(::com::sun::star::uno::RuntimeException)
+{
+ return _aName;
+}
+
+// XServiceTypeDescription
+//__________________________________________________________________________________________________
+// virtual
+Sequence< Reference< XServiceTypeDescription > > SAL_CALL
+ServiceTypeDescriptionImpl::getMandatoryServices()
+ throw ( RuntimeException )
+{
+ getReferences();
+ return *_pMandatoryServices;
+}
+
+//__________________________________________________________________________________________________
+// virtual
+Sequence< Reference< XServiceTypeDescription > > SAL_CALL
+ServiceTypeDescriptionImpl::getOptionalServices()
+ throw ( RuntimeException )
+{
+ getReferences();
+ return *_pOptionalServices;
+}
+
+//__________________________________________________________________________________________________
+// virtual
+Sequence< Reference< XInterfaceTypeDescription > > SAL_CALL
+ServiceTypeDescriptionImpl::getMandatoryInterfaces()
+ throw ( RuntimeException )
+{
+ getReferences();
+ return *_pMandatoryInterfaces;
+}
+
+//__________________________________________________________________________________________________
+// virtual
+Sequence< Reference< XInterfaceTypeDescription > > SAL_CALL
+ServiceTypeDescriptionImpl::getOptionalInterfaces()
+ throw ( RuntimeException )
+{
+ getReferences();
+ return *_pOptionalInterfaces;
+}
+
+//__________________________________________________________________________________________________
+// virtual
+Sequence< PropertyDescription > SAL_CALL
+ServiceTypeDescriptionImpl::getProperties()
+{
+ if ( !_pProps )
+ {
+ RegistryTypeReaderLoader aLoader;
+ RegistryTypeReader aReader(
+ aLoader, (const sal_uInt8 *)_aBytes.getConstArray(),
+ _aBytes.getLength(), sal_False );
+
+ sal_uInt16 nFields = (sal_uInt16)aReader.getFieldCount();
+ Sequence< PropertyDescription > * pTempProps =
+ new Sequence< PropertyDescription >( nFields );
+ PropertyDescription * pProps = pTempProps->getArray();
+
+ while ( nFields-- )
+ {
+ // PropertyDescription.Name
+ pProps[ nFields ].Name = aReader.getFieldName( nFields );
+
+ // PropertyDescription.TypeDescription
+ try
+ {
+ _xTDMgr->getByHierarchicalName(
+ aReader.getFieldType( nFields ).replace( '/', '.' ) )
+ >>= pProps[ nFields ].TypeDescription;
+ }
+ catch ( NoSuchElementException const & )
+ {
+ }
+ OSL_ENSURE( pProps[ nFields ].TypeDescription.is(),
+ "### no type description for property!" );
+
+ // PropertyDescription.Flags
+ RTFieldAccess nFlags = aReader.getFieldAccess( nFields );
+
+ sal_Int16 nAttribs = 0;
+ if ( nFlags & RT_ACCESS_READONLY )
+ nAttribs |= beans::PropertyAttribute::READONLY;
+ if ( nFlags & RT_ACCESS_OPTIONAL )
+ nAttribs |= beans::PropertyAttribute::OPTIONAL;
+ if ( nFlags & RT_ACCESS_MAYBEVOID )
+ nAttribs |= beans::PropertyAttribute::MAYBEVOID;
+ if ( nFlags & RT_ACCESS_BOUND )
+ nAttribs |= beans::PropertyAttribute::BOUND;
+ if ( nFlags & RT_ACCESS_CONSTRAINED )
+ nAttribs |= beans::PropertyAttribute::CONSTRAINED;
+ if ( nFlags & RT_ACCESS_TRANSIENT )
+ nAttribs |= beans::PropertyAttribute::TRANSIENT;
+ if ( nFlags & RT_ACCESS_MAYBEAMBIGUOUS )
+ nAttribs |= beans::PropertyAttribute::MAYBEAMBIGUOUS;
+ if ( nFlags & RT_ACCESS_MAYBEDEFAULT )
+ nAttribs |= beans::PropertyAttribute::MAYBEDEFAULT;
+ if ( nFlags & RT_ACCESS_REMOVEABLE )
+ nAttribs |= beans::PropertyAttribute::REMOVEABLE;
+
+ OSL_ENSURE( !(nFlags & RT_ACCESS_PROPERTY),
+ "### RT_ACCESS_PROPERTY is unexpected here!" );
+ OSL_ENSURE( !(nFlags & RT_ACCESS_ATTRIBUTE),
+ "### RT_ACCESS_ATTRIBUTE is unexpected here!" );
+ OSL_ENSURE( !(nFlags & RT_ACCESS_CONST),
+ "### RT_ACCESS_CONST is unexpected here!" );
+ // always set, unless RT_ACCESS_READONLY is set.
+ //OSL_ENSURE( !(nFlags & RT_ACCESS_READWRITE),
+ // "### RT_ACCESS_READWRITE is unexpected here" );
+ OSL_ENSURE( !(nFlags & RT_ACCESS_DEFAULT),
+ "### RT_ACCESS_DEAFAULT is unexpected here" );
+
+ pProps[ nFields ].Flags = nAttribs;
+ }
+
+ ClearableMutexGuard aGuard( _aMutex );
+ if ( _pProps )
+ {
+ aGuard.clear();
+ delete pTempProps;
+ }
+ else
+ {
+ _pProps = pTempProps;
+ }
+ }
+
+ return *_pProps;
+}
+
+//__________________________________________________________________________________________________
+void ServiceTypeDescriptionImpl::getReferences()
+ throw ( RuntimeException )
+{
+ if ( !_pMandatoryServices || !_pOptionalServices ||
+ !_pMandatoryInterfaces || !_pOptionalInterfaces )
+ {
+ RegistryTypeReaderLoader aLoader;
+ RegistryTypeReader aReader(
+ aLoader, (const sal_uInt8 *)_aBytes.getConstArray(),
+ _aBytes.getLength(), sal_False );
+
+ sal_uInt32 nRefs = aReader.getReferenceCount();
+ Sequence< Reference < XServiceTypeDescription > > * pTempMS
+ = new Sequence< Reference < XServiceTypeDescription > >( nRefs );
+ Sequence< Reference < XServiceTypeDescription > > * pTempOS
+ = new Sequence< Reference < XServiceTypeDescription > >( nRefs );
+ Sequence< Reference < XInterfaceTypeDescription > > * pTempMI
+ = new Sequence< Reference < XInterfaceTypeDescription > >( nRefs );
+ Sequence< Reference < XInterfaceTypeDescription > > * pTempOI
+ = new Sequence< Reference < XInterfaceTypeDescription > >( nRefs );
+ sal_uInt32 nMS = 0;
+ sal_uInt32 nOS = 0;
+ sal_uInt32 nMI = 0;
+ sal_uInt32 nOI = 0;
+
+ while ( nRefs-- )
+ {
+ RTReferenceType eType = aReader.getReferenceType( nRefs );
+ switch ( eType )
+ {
+ case RT_REF_EXPORTS: // service
+ {
+ uno::Any aTypeDesc;
+ try
+ {
+ aTypeDesc = _xTDMgr->getByHierarchicalName(
+ aReader.getReferenceName( nRefs )
+ .replace( '/', '.' ) );
+ }
+ catch ( NoSuchElementException const & )
+ {
+ }
+ OSL_ENSURE( aTypeDesc.hasValue(),
+ "### no type description!" );
+
+ RTFieldAccess nAccess = aReader.getReferenceAccess( nRefs );
+ if ( nAccess & RT_ACCESS_OPTIONAL )
+ {
+ // optional service
+ aTypeDesc >>= (*pTempOS)[ nOS ];
+ OSL_ENSURE( (*pTempOS)[ nOS ].is(),
+ "### wrong type description type!" );
+ nOS++;
+ }
+ else
+ {
+ // mandatory service
+ aTypeDesc >>= (*pTempMS)[ nMS ];
+ OSL_ENSURE( (*pTempMS)[ nMS ].is(),
+ "### wrong type description type!" );
+ nMS++;
+ }
+ break;
+ }
+ case RT_REF_SUPPORTS: // interface
+ {
+ uno::Any aTypeDesc;
+ try
+ {
+ aTypeDesc = _xTDMgr->getByHierarchicalName(
+ aReader.getReferenceName( nRefs )
+ .replace( '/', '.' ) );
+ }
+ catch ( NoSuchElementException const & )
+ {
+ }
+ OSL_ENSURE( aTypeDesc.hasValue(),
+ "### no type description!" );
+
+ RTFieldAccess nAccess = aReader.getReferenceAccess( nRefs );
+ if ( nAccess & RT_ACCESS_OPTIONAL )
+ {
+ // optional interface
+ aTypeDesc >>= (*pTempOI)[ nOI ];
+ OSL_ENSURE( (*pTempOI)[ nOI ].is(),
+ "### wrong type description type!" );
+ nOI++;
+ }
+ else
+ {
+ // mandatory interface
+ aTypeDesc >>= (*pTempMI)[ nMI ];
+ OSL_ENSURE( (*pTempMI)[ nMI ].is(),
+ "### wrong type description type!" );
+ nMI++;
+ }
+ break;
+ }
+ case RT_REF_INVALID:
+ case RT_REF_OBSERVES:
+ case RT_REF_NEEDS:
+ default:
+ OSL_ENSURE( sal_False,
+ "### unsupported reference type!" );
+ break;
+ }
+ }
+
+ {
+ ClearableMutexGuard aGuard( _aMutex );
+ if ( _pMandatoryServices )
+ {
+ aGuard.clear();
+ delete pTempMS;
+ }
+ else
+ {
+ pTempMS->realloc( nMS );
+ _pMandatoryServices = pTempMS;
+ }
+ }
+
+ {
+ ClearableMutexGuard aGuard( _aMutex );
+ if ( _pOptionalServices )
+ {
+ aGuard.clear();
+ delete pTempOS;
+ }
+ else
+ {
+ pTempOS->realloc( nOS );
+ _pOptionalServices = pTempOS;
+ }
+ }
+
+ {
+ ClearableMutexGuard aGuard( _aMutex );
+ if ( _pMandatoryInterfaces )
+ {
+ aGuard.clear();
+ delete pTempMI;
+ }
+ else
+ {
+ pTempMI->realloc( nMI );
+ _pMandatoryInterfaces = pTempMI;
+ }
+ }
+
+ {
+ ClearableMutexGuard aGuard( _aMutex );
+ if ( _pOptionalInterfaces )
+ {
+ aGuard.clear();
+ delete pTempOI;
+ }
+ else
+ {
+ pTempOI->realloc( nOI );
+ _pOptionalInterfaces = pTempOI;
+ }
+ }
+ }
+}
+
+}
+
+
diff --git a/stoc/source/tdmanager/makefile.mk b/stoc/source/tdmanager/makefile.mk
index 7a8331e1588c..e49c63cd2903 100644
--- a/stoc/source/tdmanager/makefile.mk
+++ b/stoc/source/tdmanager/makefile.mk
@@ -2,9 +2,9 @@
#
# $RCSfile: makefile.mk,v $
#
-# $Revision: 1.7 $
+# $Revision: 1.8 $
#
-# last change: $Author: jbu $ $Date: 2001-06-22 16:21:01 $
+# last change: $Author: kso $ $Date: 2002-11-11 08:33:38 $
#
# The Contents of this file are made available subject to the terms of
# either of the following licenses
@@ -78,7 +78,8 @@ COMP1TYPELIST=$(TARGET)
.INCLUDE : ..$/cppumaker.mk
SLOFILES= \
- $(SLO)$/tdmgr.obj
+ $(SLO)$/tdmgr.obj \
+ $(SLO)$/tdmgr_tdenumeration.obj
SHL1TARGET= $(TARGET)
diff --git a/stoc/source/tdmanager/tdmgr.cxx b/stoc/source/tdmanager/tdmgr.cxx
index a08a4a0007c2..a929fbc4d848 100644
--- a/stoc/source/tdmanager/tdmgr.cxx
+++ b/stoc/source/tdmanager/tdmgr.cxx
@@ -2,9 +2,9 @@
*
* $RCSfile: tdmgr.cxx,v $
*
- * $Revision: 1.12 $
+ * $Revision: 1.13 $
*
- * last change: $Author: dbo $ $Date: 2001-10-11 14:53:51 $
+ * last change: $Author: kso $ $Date: 2002-11-11 08:33:38 $
*
* The Contents of this file are made available subject to the terms of
* either of the following licenses
@@ -69,8 +69,8 @@
#ifndef _CPPUHELPER_FACTORY_HXX_
#include <cppuhelper/factory.hxx>
#endif
-#ifndef _CPPUHELPER_IMPLBASE4_HXX_
-#include <cppuhelper/compbase4.hxx>
+#ifndef _CPPUHELPER_IMPLBASE5_HXX_
+#include <cppuhelper/compbase5.hxx>
#endif
#ifndef _CPPUHELPER_IMPLBASE1_HXX_
#include <cppuhelper/implbase1.hxx>
@@ -79,6 +79,12 @@
#include <cppuhelper/implementationentry.hxx>
#endif
+#ifndef _STOC_TDMGR_COMMON_HXX
+#include "tdmgr_common.hxx"
+#endif
+#ifndef _STOC_TDMGR_TDENUMERATION_HXX
+#include "tdmgr_tdenumeration.hxx"
+#endif
#include "lrucache.hxx"
#include <com/sun/star/lang/XServiceInfo.hpp>
@@ -94,6 +100,7 @@
#include <com/sun/star/reflection/XArrayTypeDescription.hpp>
#include <com/sun/star/reflection/XIndirectTypeDescription.hpp>
#include <com/sun/star/reflection/XInterfaceTypeDescription.hpp>
+#include <com/sun/star/reflection/XTypeDescriptionEnumerationAccess.hpp>
#include <com/sun/star/registry/XRegistryKey.hpp>
#include <algorithm>
@@ -119,7 +126,8 @@ static const sal_Int32 CACHE_SIZE = 512;
#define IMPLNAME "com.sun.star.comp.stoc.TypeDescriptionManager"
//--------------------------------------------------------------------------------------------------
-static rtl_StandardModuleCount g_moduleCount = MODULE_COUNT_INIT;
+// exported via tdmgr_common.hxx
+rtl_StandardModuleCount g_moduleCount = MODULE_COUNT_INIT;
static Sequence< OUString > tdmgr_getSupportedServiceNames()
{
@@ -185,7 +193,11 @@ EventListenerImpl::~EventListenerImpl()
//==================================================================================================
class ManagerImpl
- : public WeakComponentImplHelper4< XServiceInfo, XSet, XHierarchicalNameAccess, XInitialization >
+ : public WeakComponentImplHelper5< XServiceInfo,
+ XSet,
+ XHierarchicalNameAccess,
+ XTypeDescriptionEnumerationAccess,
+ XInitialization >
{
friend EnumerationImpl;
friend EventListenerImpl;
@@ -199,9 +211,7 @@ class ManagerImpl
LRU_CacheAnyByOUString _aElements;
// provider chain
ProviderVector _aProviders;
- sal_Bool _bProviderInit;
- inline void initProviders();
inline Any getSimpleType( const OUString & rName );
protected:
@@ -234,6 +244,18 @@ public:
// XHierarchicalNameAccess
virtual Any SAL_CALL getByHierarchicalName( const OUString & rName ) throw(::com::sun::star::container::NoSuchElementException, ::com::sun::star::uno::RuntimeException);
virtual sal_Bool SAL_CALL hasByHierarchicalName( const OUString & rName ) throw(::com::sun::star::uno::RuntimeException);
+
+ // XTypeDescriptionEnumerationAccess
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::reflection::XTypeDescriptionEnumeration > SAL_CALL
+ createTypeDescriptionEnumeration(
+ const ::rtl::OUString& moduleName,
+ const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::TypeClass >& types,
+ ::com::sun::star::reflection::TypeDescriptionSearchDepth depth )
+ throw ( ::com::sun::star::reflection::NoSuchTypeNameException,
+ ::com::sun::star::reflection::InvalidTypeNameException,
+ ::com::sun::star::uno::RuntimeException );
};
//==================================================================================================
@@ -316,13 +338,13 @@ Any EnumerationImpl::nextElement()
//__________________________________________________________________________________________________
ManagerImpl::ManagerImpl(
Reference< XComponentContext > const & xContext, sal_Int32 nCacheSize )
- : WeakComponentImplHelper4<
- XServiceInfo, XSet, XHierarchicalNameAccess, XInitialization >( _aComponentMutex )
+ : WeakComponentImplHelper5<
+ XServiceInfo, XSet, XHierarchicalNameAccess,
+ XTypeDescriptionEnumerationAccess, XInitialization >( _aComponentMutex )
, _xContext( xContext )
, _aEventListener( this )
, _bCaching( sal_True )
, _aElements( nCacheSize )
- , _bProviderInit( sal_False )
{
g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt );
}
@@ -342,38 +364,6 @@ void ManagerImpl::disposing()
_xContext.clear();
_aProviders.clear();
}
-//__________________________________________________________________________________________________
-inline void ManagerImpl::initProviders()
-{
- // looking up context for additional providers
- Sequence< OUString > add_providers;
- if (_xContext->getValueByName( OUString(
- RTL_CONSTASCII_USTRINGPARAM("/services/" SERVICENAME "/providers") ) ) >>= add_providers)
- {
- Reference< XMultiComponentFactory > xMgr( _xContext->getServiceManager() );
- OUString const * pNames = add_providers.getConstArray();
- for ( sal_Int32 nPos = add_providers.getLength(); nPos--; )
- {
- Reference< XHierarchicalNameAccess > xHA(
- xMgr->createInstanceWithContext( pNames[ nPos ], _xContext ), UNO_QUERY );
- OSL_ENSURE( xHA.is(), "### no td provider!" );
-
- if (xHA.is())
- {
- try
- {
- insert( makeAny( xHA ) );
- }
- catch (IllegalArgumentException &)
- {
- }
- catch (ElementExistException &)
- {
- }
- }
- }
- }
-}
// XInitialization
//__________________________________________________________________________________________________
@@ -521,6 +511,42 @@ void SAL_CALL ManagerImpl::remove( const Any & rElement )
xComp->removeEventListener( &_aEventListener );
}
+// XTypeDescriptionEnumerationAccess
+//__________________________________________________________________________________________________
+// virtual
+Reference< XTypeDescriptionEnumeration > SAL_CALL
+ManagerImpl::createTypeDescriptionEnumeration(
+ const OUString & moduleName,
+ const Sequence< TypeClass > & types,
+ TypeDescriptionSearchDepth depth )
+ throw ( NoSuchTypeNameException,
+ InvalidTypeNameException,
+ RuntimeException )
+{
+ MutexGuard aGuard( _aComponentMutex );
+
+ TDEnumerationAccessStack aStack;
+ ProviderVector::const_iterator it = _aProviders.begin();
+ const ProviderVector::const_iterator end = _aProviders.end();
+ while ( it != end )
+ {
+ Reference< XTypeDescriptionEnumerationAccess >xEnumAccess(
+ (*it), UNO_QUERY );
+ OSL_ENSURE( xEnumAccess.is(),
+ "### no XTypeDescriptionEnumerationAccess!" );
+ if ( xEnumAccess.is() )
+ aStack.push( xEnumAccess );
+
+ it++;
+ }
+
+ return Reference< XTypeDescriptionEnumeration >(
+ new TypeDescriptionEnumerationImpl( moduleName,
+ types,
+ depth,
+ aStack ) );
+}
+
//##################################################################################################
//##################################################################################################
@@ -830,12 +856,6 @@ Any ManagerImpl::getByHierarchicalName( const OUString & rName )
if (! aRet.hasValue())
{
// last, try callback chain
- MutexGuard aGuard( _aComponentMutex );
- if (! _bProviderInit)
- {
- initProviders();
- _bProviderInit = sal_True;
- }
for ( ProviderVector::const_iterator iPos( _aProviders.begin() );
iPos != _aProviders.end(); ++iPos )
{
diff --git a/stoc/source/tdmanager/tdmgr_common.hxx b/stoc/source/tdmanager/tdmgr_common.hxx
new file mode 100644
index 000000000000..5df27080011b
--- /dev/null
+++ b/stoc/source/tdmanager/tdmgr_common.hxx
@@ -0,0 +1,75 @@
+/*************************************************************************
+ *
+ * $RCSfile: tdmgr_common.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: kso $ $Date: 2002-11-11 08:33:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _STOC_TDMGR_COMMON_HXX
+#define _STOC_TDMGR_COMMON_HXX
+
+#ifndef _RTL_UNLOAD_H_
+#include <rtl/unload.h>
+#endif
+
+namespace stoc_tdmgr
+{
+ extern rtl_StandardModuleCount g_moduleCount;
+
+} // namespace stoc_tdmgr
+
+#endif /* _STOC_TDMGR_COMMON_HXX */
diff --git a/stoc/source/tdmanager/tdmgr_tdenumeration.cxx b/stoc/source/tdmanager/tdmgr_tdenumeration.cxx
new file mode 100644
index 000000000000..f1c6f2657425
--- /dev/null
+++ b/stoc/source/tdmanager/tdmgr_tdenumeration.cxx
@@ -0,0 +1,223 @@
+/*************************************************************************
+ *
+ * $RCSfile: tdmgr_tdenumeration.cxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: kso $ $Date: 2002-11-11 08:33:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _OSL_DIAGNOSE_H_
+#include <osl/diagnose.h>
+#endif
+#ifndef _STOC_TDMGR_COMMON_HXX
+#include "tdmgr_common.hxx"
+#endif
+#ifndef _STOC_TDMGR_TDENUMERATION_HXX
+#include "tdmgr_tdenumeration.hxx"
+#endif
+
+using namespace com::sun::star;
+
+namespace stoc_tdmgr
+{
+
+//=========================================================================
+//=========================================================================
+//
+// TypeDescriptionEnumerationImpl Implementation.
+//
+//=========================================================================
+//=========================================================================
+
+TypeDescriptionEnumerationImpl::TypeDescriptionEnumerationImpl(
+ const rtl::OUString & rModuleName,
+ const com::sun::star::uno::Sequence<
+ com::sun::star::uno::TypeClass > & rTypes,
+ com::sun::star::reflection::TypeDescriptionSearchDepth eDepth,
+ const TDEnumerationAccessStack & rTDEAS )
+: m_aModuleName( rModuleName ),
+ m_aTypes( rTypes ),
+ m_eDepth( eDepth ),
+ m_aChildren( rTDEAS )
+{
+ g_moduleCount.modCnt.acquire( &g_moduleCount.modCnt );
+}
+
+//=========================================================================
+// virtual
+TypeDescriptionEnumerationImpl::~TypeDescriptionEnumerationImpl()
+{
+ g_moduleCount.modCnt.release( &g_moduleCount.modCnt );
+}
+
+//=========================================================================
+//
+// XEnumeration (base of XTypeDescriptionEnumeration) methods
+//
+//=========================================================================
+
+// virtual
+sal_Bool SAL_CALL TypeDescriptionEnumerationImpl::hasMoreElements()
+ throw ( uno::RuntimeException )
+{
+ uno::Reference< reflection::XTypeDescriptionEnumeration > xEnum
+ = queryCurrentChildEnumeration();
+ if ( xEnum.is() )
+ return xEnum->hasMoreElements();
+
+ return sal_False;
+}
+
+//=========================================================================
+// virtual
+uno::Any SAL_CALL TypeDescriptionEnumerationImpl::nextElement()
+ throw ( container::NoSuchElementException,
+ lang::WrappedTargetException,
+ uno::RuntimeException )
+{
+ uno::Reference< reflection::XTypeDescriptionEnumeration > xEnum
+ = queryCurrentChildEnumeration();
+ if ( xEnum.is() )
+ return xEnum->nextElement();
+
+ throw container::NoSuchElementException(
+ rtl::OUString::createFromAscii(
+ "No further elements in enumeration!" ),
+ static_cast< cppu::OWeakObject * >( this ) );
+}
+
+//=========================================================================
+//
+// XTypeDescriptionEnumeration methods
+//
+//=========================================================================
+
+// virtual
+uno::Reference< reflection::XTypeDescription > SAL_CALL
+TypeDescriptionEnumerationImpl::nextTypeDescription()
+ throw ( container::NoSuchElementException,
+ uno::RuntimeException )
+{
+ uno::Reference< reflection::XTypeDescriptionEnumeration > xEnum
+ = queryCurrentChildEnumeration();
+ if ( xEnum.is() )
+ return xEnum->nextTypeDescription();
+
+ throw container::NoSuchElementException(
+ rtl::OUString::createFromAscii(
+ "No further elements in enumeration!" ),
+ static_cast< cppu::OWeakObject * >( this ) );
+}
+
+//=========================================================================
+uno::Reference< reflection::XTypeDescriptionEnumeration >
+TypeDescriptionEnumerationImpl::queryCurrentChildEnumeration()
+{
+ osl::MutexGuard aGuard( m_aMutex );
+
+ for (;;)
+ {
+ if ( m_xEnum.is() )
+ {
+ if ( m_xEnum->hasMoreElements() )
+ {
+ return m_xEnum;
+ }
+ else
+ {
+ // Forget about enumeration without further elements. Try next.
+ m_xEnum.clear();
+ }
+ }
+
+ // Note: m_xEnum is always null here.
+
+ if ( m_aChildren.empty() )
+ {
+ // No child enumerations left.
+ return m_xEnum;
+ }
+
+ try
+ {
+ m_xEnum =
+ m_aChildren.top()->createTypeDescriptionEnumeration(
+ m_aModuleName, m_aTypes, m_eDepth );
+ }
+ catch ( reflection::NoSuchTypeNameException const & )
+ {
+ OSL_ENSURE( sal_False,
+ "TypeDescriptionEnumerationImpl::queryCurrentChildEnumeration "
+ "- Caught NoSuchTypeNameException!" );
+ }
+ catch ( reflection::InvalidTypeNameException const & )
+ {
+ OSL_ENSURE( sal_False,
+ "TypeDescriptionEnumerationImpl::queryCurrentChildEnumeration "
+ "- Caught InvalidTypeNameException!" );
+ }
+
+ // We're done with this enumeration access in any case (Either
+ // enumeration was successfully created or creation failed for some
+ // reason).
+ m_aChildren.pop();
+ }
+
+ // unreachable
+}
+
+} // namespace stoc_tdmgr
+
diff --git a/stoc/source/tdmanager/tdmgr_tdenumeration.hxx b/stoc/source/tdmanager/tdmgr_tdenumeration.hxx
new file mode 100644
index 000000000000..cff0eabc8902
--- /dev/null
+++ b/stoc/source/tdmanager/tdmgr_tdenumeration.hxx
@@ -0,0 +1,132 @@
+/*************************************************************************
+ *
+ * $RCSfile: tdmgr_tdenumeration.hxx,v $
+ *
+ * $Revision: 1.1 $
+ *
+ * last change: $Author: kso $ $Date: 2002-11-11 08:33:37 $
+ *
+ * The Contents of this file are made available subject to the terms of
+ * either of the following licenses
+ *
+ * - GNU Lesser General Public License Version 2.1
+ * - Sun Industry Standards Source License Version 1.1
+ *
+ * Sun Microsystems Inc., October, 2000
+ *
+ * GNU Lesser General Public License Version 2.1
+ * =============================================
+ * Copyright 2000 by Sun Microsystems, Inc.
+ * 901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License version 2.1, as published by the Free Software Foundation.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ *
+ *
+ * Sun Industry Standards Source License Version 1.1
+ * =================================================
+ * The contents of this file are subject to the Sun Industry Standards
+ * Source License Version 1.1 (the "License"); You may not use this file
+ * except in compliance with the License. You may obtain a copy of the
+ * License at http://www.openoffice.org/license.html.
+ *
+ * Software provided under this License is provided on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
+ * WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
+ * MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
+ * See the License for the specific provisions governing your rights and
+ * obligations concerning the Software.
+ *
+ * The Initial Developer of the Original Code is: Sun Microsystems, Inc.
+ *
+ * Copyright: 2000 by Sun Microsystems, Inc.
+ *
+ * All Rights Reserved.
+ *
+ * Contributor(s): _______________________________________
+ *
+ *
+ ************************************************************************/
+
+#ifndef _STOC_TDMGR_TDENUMERATION_HXX
+#define _STOC_TDMGR_TDENUMERATION_HXX
+
+#include <stack>
+
+#ifndef _OSL_MUTEX_HXX_
+#include <osl/mutex.hxx>
+#endif
+#ifndef _COM_SUN_STAR_REFLECTION_XTYPEDESCRIPTIONENUMERATION_HPP_
+#include <com/sun/star/reflection/XTypeDescriptionEnumeration.hpp>
+#endif
+#ifndef _COM_SUN_STAR_REFLECTION_XTYPEDESCRIPTIONENUMERATIONACCESS_HPP_
+#include <com/sun/star/reflection/XTypeDescriptionEnumerationAccess.hpp>
+#endif
+#ifndef _CPPUHELPER_IMPLBASE1_HXX_
+#include <cppuhelper/implbase1.hxx>
+#endif
+
+namespace stoc_tdmgr
+{
+
+typedef std::stack< com::sun::star::uno::Reference<
+ com::sun::star::reflection::XTypeDescriptionEnumerationAccess > >
+ TDEnumerationAccessStack;
+
+class TypeDescriptionEnumerationImpl
+ : public cppu::WeakImplHelper1<
+ com::sun::star::reflection::XTypeDescriptionEnumeration >
+{
+public:
+ TypeDescriptionEnumerationImpl(
+ const rtl::OUString & rModuleName,
+ const com::sun::star::uno::Sequence<
+ com::sun::star::uno::TypeClass > & rTypes,
+ com::sun::star::reflection::TypeDescriptionSearchDepth eDepth,
+ const TDEnumerationAccessStack & rTDEAS );
+ virtual ~TypeDescriptionEnumerationImpl();
+
+ // XEnumeration (base of XTypeDescriptionEnumeration)
+ virtual sal_Bool SAL_CALL hasMoreElements()
+ throw ( ::com::sun::star::uno::RuntimeException );
+ virtual ::com::sun::star::uno::Any SAL_CALL nextElement()
+ throw ( ::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::lang::WrappedTargetException,
+ ::com::sun::star::uno::RuntimeException );
+
+ // XTypeDescriptionEnumeration
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::reflection::XTypeDescription > SAL_CALL
+ nextTypeDescription()
+ throw ( ::com::sun::star::container::NoSuchElementException,
+ ::com::sun::star::uno::RuntimeException );
+
+private:
+ com::sun::star::uno::Reference<
+ com::sun::star::reflection::XTypeDescriptionEnumeration >
+ queryCurrentChildEnumeration();
+
+ osl::Mutex m_aMutex;
+ rtl::OUString m_aModuleName;
+ com::sun::star::uno::Sequence< com::sun::star::uno::TypeClass > m_aTypes;
+ com::sun::star::reflection::TypeDescriptionSearchDepth m_eDepth;
+ TDEnumerationAccessStack m_aChildren;
+ com::sun::star::uno::Reference<
+ com::sun::star::reflection::XTypeDescriptionEnumeration > m_xEnum;
+};
+
+} // namespace stoc_tdmgr
+
+#endif /* _STOC_TDMGR_TDENUMERATION_HXX */
+