diff options
author | Frank Schönheit <fs@openoffice.org> | 2001-04-11 13:21:58 +0000 |
---|---|---|
committer | Frank Schönheit <fs@openoffice.org> | 2001-04-11 13:21:58 +0000 |
commit | 8cccbcec21ca957ce820b8eba0d6582d608a5d53 (patch) | |
tree | 3eeec262b2d9b31527f0ef48633d53cdaafefaf8 /forms/source/component/FormattedFieldWrapper.cxx | |
parent | dc69d85309bbe3d8db32def9e1b319ad7dda320d (diff) |
#84995# implement an own xServiceInfo, forward all (except getImplementationName) to the aggregate)
Diffstat (limited to 'forms/source/component/FormattedFieldWrapper.cxx')
-rw-r--r-- | forms/source/component/FormattedFieldWrapper.cxx | 47 |
1 files changed, 43 insertions, 4 deletions
diff --git a/forms/source/component/FormattedFieldWrapper.cxx b/forms/source/component/FormattedFieldWrapper.cxx index c5ff407f42cb..3ca8a74d3cbf 100644 --- a/forms/source/component/FormattedFieldWrapper.cxx +++ b/forms/source/component/FormattedFieldWrapper.cxx @@ -2,9 +2,9 @@ * * $RCSfile: FormattedFieldWrapper.cxx,v $ * - * $Revision: 1.3 $ + * $Revision: 1.4 $ * - * last change: $Author: oj $ $Date: 2000-11-23 08:48:15 $ + * last change: $Author: fs $ $Date: 2001-04-11 14:21:52 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -170,7 +170,7 @@ Any SAL_CALL OFormattedFieldWrapper::queryAggregation(const Type& _rType) throw if (_rType.equals( ::getCppuType( static_cast< Reference< XTypeProvider >* >(NULL) ) ) ) { // a XTypeProvider interface needs a working aggregate - we don't want to give the type provider - // of our base class (OWeakAggObject) to the caller as it supplies nearly nothing + // of our base class (OFormattedFieldWrapper_Base) to the caller as it supplies nearly nothing ensureAggregate(); if (m_xAggregate.is()) aReturn = m_xAggregate->queryAggregation(_rType); @@ -178,7 +178,13 @@ Any SAL_CALL OFormattedFieldWrapper::queryAggregation(const Type& _rType) throw if (!aReturn.hasValue()) { - aReturn = OWeakAggObject::queryAggregation(_rType); + aReturn = OFormattedFieldWrapper_Base::queryAggregation(_rType); + + if ((_rType.equals( ::getCppuType( static_cast< Reference< XServiceInfo >* >(NULL) ) ) ) && aReturn.hasValue()) + { // somebody requested an XServiceInfo interface and our base class provided it + // check our aggregate if it has one, too + ensureAggregate(); + } if (!aReturn.hasValue()) { @@ -206,6 +212,30 @@ Any SAL_CALL OFormattedFieldWrapper::queryAggregation(const Type& _rType) throw } //------------------------------------------------------------------ +::rtl::OUString SAL_CALL OFormattedFieldWrapper::getImplementationName( ) throw (RuntimeException) +{ + return ::rtl::OUString::createFromAscii("com.sun.star.comp.forms.OFormattedFieldWrapper"); +} + +//------------------------------------------------------------------ +sal_Bool SAL_CALL OFormattedFieldWrapper::supportsService( const ::rtl::OUString& _rServiceName ) throw (RuntimeException) +{ + DBG_ASSERT(m_xAggregate.is(), "OFormattedFieldWrapper::supportsService: should never have made it 'til here without an aggregate!"); + Reference< XServiceInfo > xSI; + m_xAggregate->queryAggregation(::getCppuType(static_cast< Reference< XServiceInfo >* >(NULL))) >>= xSI; + return xSI->supportsService(_rServiceName); +} + +//------------------------------------------------------------------ +Sequence< ::rtl::OUString > SAL_CALL OFormattedFieldWrapper::getSupportedServiceNames( ) throw (RuntimeException) +{ + DBG_ASSERT(m_xAggregate.is(), "OFormattedFieldWrapper::getSupportedServiceNames: should never have made it 'til here without an aggregate!"); + Reference< XServiceInfo > xSI; + m_xAggregate->queryAggregation(::getCppuType(static_cast< Reference< XServiceInfo >* >(NULL))) >>= xSI; + return xSI->getSupportedServiceNames(); +} + +//------------------------------------------------------------------ void SAL_CALL OFormattedFieldWrapper::write(const Reference<XObjectOutputStream>& _rxOutStream) throw( IOException, RuntimeException ) { // can't write myself @@ -348,6 +378,15 @@ void OFormattedFieldWrapper::ensureAggregate() m_xAggregate = Reference<XAggregation> (xEditModel, UNO_QUERY); DBG_ASSERT(m_xAggregate.is(), "OFormattedFieldWrapper::ensureAggregate : the OEditModel didn't have an XAggregation interface !"); + + { + Reference< XServiceInfo > xSI(m_xAggregate, UNO_QUERY); + if (!xSI.is()) + { + DBG_ERROR("OFormattedFieldWrapper::ensureAggregate: the aggregate has nbo XServiceInfo!"); + m_xAggregate.clear(); + } + } } if (m_xAggregate.is()) { // has to be in it's own block because of the temporary variable created by *this |