diff options
Diffstat (limited to 'forms/source/component/FormComponent.cxx')
-rw-r--r-- | forms/source/component/FormComponent.cxx | 54 |
1 files changed, 24 insertions, 30 deletions
diff --git a/forms/source/component/FormComponent.cxx b/forms/source/component/FormComponent.cxx index 902f853c9..8c6a33d94 100644 --- a/forms/source/component/FormComponent.cxx +++ b/forms/source/component/FormComponent.cxx @@ -296,11 +296,11 @@ Sequence< ::rtl::OUString > SAL_CALL OControl::getSupportedServiceNames_Static() //------------------------------------------------------------------------------ void SAL_CALL OControl::disposing(const com::sun::star::lang::EventObject& _rEvent) throw (RuntimeException) { - InterfaceRef xAggAsIface; + Reference< XInterface > xAggAsIface; query_aggregation(m_xAggregate, xAggAsIface); // does the disposing come from the aggregate ? - if (xAggAsIface != InterfaceRef(_rEvent.Source, UNO_QUERY)) + if (xAggAsIface != Reference< XInterface >(_rEvent.Source, UNO_QUERY)) { // no -> forward it Reference<com::sun::star::lang::XEventListener> xListener; if (query_aggregation(m_xAggregate, xListener)) @@ -310,16 +310,16 @@ void SAL_CALL OControl::disposing(const com::sun::star::lang::EventObject& _rEve // XControl //------------------------------------------------------------------------------ -void SAL_CALL OControl::setContext(const InterfaceRef& Context) throw (RuntimeException) +void SAL_CALL OControl::setContext(const Reference< XInterface >& Context) throw (RuntimeException) { if (m_xControl.is()) m_xControl->setContext(Context); } //------------------------------------------------------------------------------ -InterfaceRef SAL_CALL OControl::getContext() throw (RuntimeException) +Reference< XInterface > SAL_CALL OControl::getContext() throw (RuntimeException) { - return m_xControl.is() ? m_xControl->getContext() : InterfaceRef(); + return m_xControl.is() ? m_xControl->getContext() : Reference< XInterface >(); } //------------------------------------------------------------------------------ @@ -711,13 +711,13 @@ void OControlModel::doSetDelegator() // XChild //------------------------------------------------------------------------------ -InterfaceRef SAL_CALL OControlModel::getParent() throw(RuntimeException) +Reference< XInterface > SAL_CALL OControlModel::getParent() throw(RuntimeException) { return m_xParent; } //------------------------------------------------------------------------------ -void SAL_CALL OControlModel::setParent(const InterfaceRef& _rxParent) throw(com::sun::star::lang::NoSupportException, RuntimeException) +void SAL_CALL OControlModel::setParent(const Reference< XInterface >& _rxParent) throw(com::sun::star::lang::NoSupportException, RuntimeException) { osl::MutexGuard aGuard(m_aMutex); @@ -1867,30 +1867,24 @@ void OBoundControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, co throw com::sun::star::lang::IllegalArgumentException(); case PROPERTY_ID_CONTROLLABEL: { - DBG_ASSERT(!rValue.hasValue() || (rValue.getValueType().getTypeClass() == TypeClass_INTERFACE), - "OBoundControlModel::setFastPropertyValue_NoBroadcast : invalid argument !"); - if (!rValue.hasValue()) + if ( rValue.hasValue() && ( rValue.getValueTypeClass() != TypeClass_INTERFACE ) ) + throw com::sun::star::lang::IllegalArgumentException(); + + Reference< XInterface > xNewValue( rValue, UNO_QUERY ); + if ( !xNewValue.is() ) { // set property to "void" - Reference<com::sun::star::lang::XComponent> xComp(m_xLabelControl, UNO_QUERY); - if (xComp.is()) - xComp->removeEventListener(static_cast<com::sun::star::lang::XEventListener*>(static_cast<XPropertyChangeListener*>(this))); + Reference< XComponent > xComp( m_xLabelControl, UNO_QUERY ); + if ( xComp.is() ) + xComp->removeEventListener( static_cast< XPropertyChangeListener* >( this ) ); m_xLabelControl = NULL; break; } - InterfaceRef xNewValue; - rValue >>= xNewValue; - - Reference<XControlModel> xAsModel(xNewValue, UNO_QUERY); - Reference<com::sun::star::lang::XServiceInfo> xAsServiceInfo(xNewValue, UNO_QUERY); - Reference<XPropertySet> xAsPropSet(xNewValue, UNO_QUERY); - Reference<XChild> xAsChild(xNewValue, UNO_QUERY); - if (!xAsModel.is() || !xAsServiceInfo.is() || !xAsPropSet.is() || !xAsChild.is()) - { - throw com::sun::star::lang::IllegalArgumentException(); - } - - if (!xAsServiceInfo->supportsService(m_aLabelServiceName)) + Reference< XControlModel > xAsModel ( xNewValue, UNO_QUERY ); + Reference< XServiceInfo > xAsServiceInfo ( xAsModel, UNO_QUERY ); + Reference< XPropertySet > xAsPropSet ( xAsServiceInfo, UNO_QUERY ); + Reference< XChild > xAsChild ( xAsPropSet, UNO_QUERY ); + if ( !xAsChild.is() || !xAsServiceInfo->supportsService( m_aLabelServiceName ) ) { throw com::sun::star::lang::IllegalArgumentException(); } @@ -1898,7 +1892,7 @@ void OBoundControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, co // check if weself and the given model have a common anchestor (up to the forms collection) Reference<XChild> xCont; query_interface(static_cast<XWeak*>(this), xCont); - InterfaceRef xMyTopLevel = xCont->getParent(); + Reference< XInterface > xMyTopLevel = xCont->getParent(); while (xMyTopLevel.is()) { Reference<XForm> xAsForm(xMyTopLevel, UNO_QUERY); @@ -1907,9 +1901,9 @@ void OBoundControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, co break; Reference<XChild> xLoopAsChild(xMyTopLevel, UNO_QUERY); - xMyTopLevel = xLoopAsChild.is() ? xLoopAsChild->getParent() : InterfaceRef(); + xMyTopLevel = xLoopAsChild.is() ? xLoopAsChild->getParent() : Reference< XInterface >(); } - InterfaceRef xNewTopLevel = xAsChild->getParent(); + Reference< XInterface > xNewTopLevel = xAsChild->getParent(); while (xNewTopLevel.is()) { Reference<XForm> xAsForm(xNewTopLevel, UNO_QUERY); @@ -1917,7 +1911,7 @@ void OBoundControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, co break; Reference<XChild> xLoopAsChild(xNewTopLevel, UNO_QUERY); - xNewTopLevel = xLoopAsChild.is() ? xLoopAsChild->getParent() : InterfaceRef(); + xNewTopLevel = xLoopAsChild.is() ? xLoopAsChild->getParent() : Reference< XInterface >(); } if (xNewTopLevel != xMyTopLevel) { |