diff options
author | Oliver Bolte <obo@openoffice.org> | 2005-01-05 11:02:29 +0000 |
---|---|---|
committer | Oliver Bolte <obo@openoffice.org> | 2005-01-05 11:02:29 +0000 |
commit | 4c92101af5a5b8ea14607dc13718ea1e932d6407 (patch) | |
tree | 0a6b56fa03525f057e6038acae5afee665d645d2 /forms/source | |
parent | e484a7a0f72a7069875dc7bee57c6ba51c73ea7d (diff) |
INTEGRATION: CWS dba20 (1.62.6); FILE MERGED
2004/12/13 12:22:24 oj 1.62.6.4: RESYNC: (1.64-1.65); FILE MERGED
2004/11/29 09:23:01 oj 1.62.6.3: RESYNC: (1.62-1.64); FILE MERGED
2004/11/19 13:27:00 fs 1.62.6.2: #i37433# no m_bInContext anymore - this is now dynamically determined on demand
2004/11/19 12:05:52 fs 1.62.6.1: #i37433# don't set the DataSourceName on the aggregate, if we're embedded in a database document - no real need for this, and just causing trouble
Diffstat (limited to 'forms/source')
-rw-r--r-- | forms/source/component/DatabaseForm.cxx | 88 |
1 files changed, 39 insertions, 49 deletions
diff --git a/forms/source/component/DatabaseForm.cxx b/forms/source/component/DatabaseForm.cxx index fb5ef57e751b..2a6083cafded 100644 --- a/forms/source/component/DatabaseForm.cxx +++ b/forms/source/component/DatabaseForm.cxx @@ -2,9 +2,9 @@ * * $RCSfile: DatabaseForm.cxx,v $ * - * $Revision: 1.65 $ + * $Revision: 1.66 $ * - * last change: $Author: hr $ $Date: 2004-11-27 13:00:31 $ + * last change: $Author: obo $ $Date: 2005-01-05 12:02:29 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -446,7 +446,6 @@ ODatabaseForm::ODatabaseForm(const Reference<XMultiServiceFactory>& _rxFactory) ,m_bForwardingConnection(sal_False) ,m_pAggregatePropertyMultiplexer(NULL) ,m_bSharingConnection( sal_False ) - ,m_bInContext(sal_False) ,m_bInsertOnly( sal_False ) { DBG_CTOR(ODatabaseForm,NULL); @@ -1452,7 +1451,7 @@ void ODatabaseForm::fillProperties( RemoveProperty( _rAggregateProps, PROPERTY_FILTER ); RemoveProperty( _rAggregateProps, PROPERTY_APPLYFILTER ); - DECL_IFACE_PROP4(ACTIVE_CONNECTION, XConnection, BOUND, TRANSIENT, MAYBEVOID, CONSTRAINED); + DECL_IFACE_PROP4(ACTIVE_CONNECTION, XConnection, BOUND, TRANSIENT, MAYBEVOID, CONSTRAINED); DECL_BOOL_PROP2 ( APPLYFILTER, BOUND, MAYBEDEFAULT ); DECL_PROP1 ( NAME, ::rtl::OUString, BOUND ); DECL_PROP1 ( MASTERFIELDS, Sequence< ::rtl::OUString >, BOUND ); @@ -1643,11 +1642,6 @@ sal_Bool ODatabaseForm::convertFastPropertyValue( Any& rConvertedValue, Any& rOl bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, aAggregateProperty, ::getCppuType(static_cast<const ::rtl::OUString*>(NULL))); } break; - case PROPERTY_ID_ACTIVE_CONNECTION: - if ( m_bInContext ) - throw PropertyVetoException(); - bModified = OPropertySetAggregationHelper::convertFastPropertyValue( rConvertedValue, rOldValue, nHandle, rValue ); - break; case PROPERTY_ID_TARGET_URL: bModified = tryPropertyValue(rConvertedValue, rOldValue, rValue, m_aTargetURL); break; @@ -1733,14 +1727,18 @@ void ODatabaseForm::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const A break; case PROPERTY_ID_DATASOURCE: - if ( m_bInContext ) + { + Reference< XConnection > xSomeConnection; + if ( ::dbtools::isEmbeddedInDatabase( getParent(), xSomeConnection ) ) throw PropertyVetoException(); + try { m_xAggregateSet->setPropertyValue(PROPERTY_DATASOURCE, rValue); } catch(Exception&) { } - break; + } + break; case PROPERTY_ID_TARGET_URL: rValue >>= m_aTargetURL; break; @@ -1791,6 +1789,15 @@ void ODatabaseForm::setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const A case PROPERTY_ID_CONTROL_BORDER_COLOR_INVALID: m_aControlBorderColorInvalid = rValue; break; + + case PROPERTY_ID_ACTIVE_CONNECTION: + { + Reference< XConnection > xSomeConnection; + if ( ::dbtools::isEmbeddedInDatabase( getParent(), xSomeConnection ) ) + throw PropertyVetoException(); + } + // NO break! + default: OPropertySetAggregationHelper::setFastPropertyValue_NoBroadcast( nHandle, rValue ); break; @@ -2415,47 +2422,22 @@ void SAL_CALL ODatabaseForm::setParent(const InterfaceRef& Parent) throw ( ::com xParentForm.set(getParent(), UNO_QUERY); if ( xParentForm.is() ) { - { - Reference<XRowSetApproveBroadcaster> xParentApprBroadcast(xParentForm, UNO_QUERY); - if (xParentApprBroadcast.is()) - xParentApprBroadcast->addRowSetApproveListener(this); - Reference<XLoadable> xParentLoadable(xParentForm, UNO_QUERY); - if (xParentLoadable.is()) - xParentLoadable->addLoadListener(this); - } + Reference<XRowSetApproveBroadcaster> xParentApprBroadcast(xParentForm, UNO_QUERY); + if (xParentApprBroadcast.is()) + xParentApprBroadcast->addRowSetApproveListener(this); + Reference<XLoadable> xParentLoadable(xParentForm, UNO_QUERY); + if (xParentLoadable.is()) + xParentLoadable->addLoadListener(this); } - Any aNewValue; - if ( Parent.is() ) - { - // do we have a connection in the hierarchy than take that connection - // this overwrites all the other connnections - Reference< XConnection> xConnection; - m_bInContext = ::dbtools::isEmbeddedInDatabase( Parent, xConnection ); - if ( m_bInContext ) - { - Reference<XChild> xChild(xConnection,UNO_QUERY); - if ( xChild.is() ) - { - Reference<XPropertySet> xProp(xChild->getParent(),UNO_QUERY); - if ( xProp.is() ) - m_xAggregateSet->setPropertyValue( PROPERTY_DATASOURCE ,xProp->getPropertyValue(PROPERTY_NAME)); - } - aNewValue <<= xConnection; - m_xAggregateSet->setPropertyValue( PROPERTY_ACTIVE_CONNECTION ,aNewValue); - } - } - else - { - m_bInContext = sal_False; - m_xAggregateSet->setPropertyValue( PROPERTY_ACTIVE_CONNECTION ,Any()); - m_xAggregateSet->setPropertyValue( PROPERTY_DATASOURCE, makeAny( ::rtl::OUString() ) ); - } - // clear the guard before notify + Reference< XConnection > xOuterConnection; + sal_Bool bIsEmbedded = ::dbtools::isEmbeddedInDatabase( Parent, xOuterConnection ); + + // clear the guard before setting property values, because of the notifications + // which are triggered there aGuard.clear(); - sal_Int32 nHandle = PROPERTY_ID_ACTIVE_CONNECTION; - Any aEmpty; - fire(&nHandle, &aNewValue, &aEmpty, 1, sal_False); + if ( bIsEmbedded ) + m_xAggregateSet->setPropertyValue( PROPERTY_DATASOURCE, makeAny( ::rtl::OUString() ) ); } //============================================================================== @@ -2823,6 +2805,14 @@ sal_Bool ODatabaseForm::implEnsureConnection() // if our aggregate already has a connection, nothing needs to be done about it return sal_True; + // see whether we're an embedded form + Reference< XConnection > xOuterConnection; + if ( ::dbtools::isEmbeddedInDatabase( getParent(), xOuterConnection ) ) + { + m_xAggregateSet->setPropertyValue( PROPERTY_ACTIVE_CONNECTION, makeAny( xOuterConnection ) ); + return xOuterConnection.is(); + } + m_bSharingConnection = sal_False; // if we're a sub form, we try to re-use the connection of our parent |