diff options
author | Frank Schönheit <fs@openoffice.org> | 2002-03-19 12:45:30 +0000 |
---|---|---|
committer | Frank Schönheit <fs@openoffice.org> | 2002-03-19 12:45:30 +0000 |
commit | 02483a16a64f74365c8cd5b40ee57bcc680a7e79 (patch) | |
tree | 5b0325921474a55185d6f7a5031f465d8e970268 /forms | |
parent | 11e2acae2951b42e52d6dd42af4313182a51b2de (diff) |
#98045# when filling parameters in reset_impl, recognize inconsistent master-detail settings
Diffstat (limited to 'forms')
-rw-r--r-- | forms/source/component/DatabaseForm.cxx | 59 |
1 files changed, 31 insertions, 28 deletions
diff --git a/forms/source/component/DatabaseForm.cxx b/forms/source/component/DatabaseForm.cxx index 75fb8dbafad9..0ca124511e70 100644 --- a/forms/source/component/DatabaseForm.cxx +++ b/forms/source/component/DatabaseForm.cxx @@ -2,9 +2,9 @@ * * $RCSfile: DatabaseForm.cxx,v $ * - * $Revision: 1.43 $ + * $Revision: 1.44 $ * - * last change: $Author: fs $ $Date: 2002-03-04 14:01:11 $ + * last change: $Author: fs $ $Date: 2002-03-19 13:45:30 $ * * The Contents of this file are made available subject to the terms of * either of the following licenses @@ -2419,32 +2419,35 @@ void ODatabaseForm::reset_impl(bool _bAproveByListeners) if ( !m_pParameterInfo ) createParameterInfo(); - Reference<XNameAccess> xCols(xColsSuppl->getColumns(), UNO_QUERY); - - const ::rtl::OUString* pMasterFields = m_aMasterFields.getConstArray(); - const ::rtl::OUString* pDetailFields = m_aDetailFields.getConstArray(); - const ::rtl::OUString* pDetailFieldsEnd = pDetailFields + m_aDetailFields.getLength(); - for (pDetailFields; pDetailFields < pDetailFieldsEnd; ++pDetailFields, ++pMasterFields) + if ( m_pParameterInfo && m_pParameterInfo->nCount ) { - Reference<XPropertySet> xMasterField, xField; - if (m_pParameterInfo->xParamsAsNames->hasByName(*pDetailFields)) - { // we really have a parameter column with this name - Reference< XPropertySet > xParamColumn; - m_pParameterInfo->xParamsAsNames->getByName(*pDetailFields) >>= xParamColumn; - if (xParamColumn.is()) - { // we really really have it :) - ::rtl::OUString sParamColumnRealName; - xParamColumn->getPropertyValue(PROPERTY_REALNAME) >>= sParamColumnRealName; - if (xCols->hasByName(sParamColumnRealName)) - { // our own columns have a column which's name equals the real name of the param column - if (xParentCols->hasByName(*pMasterFields)) - { // and our parent's cols know the master field which is connected to the current detail field - - // -> transfer the value property - xParentCols->getByName(*pMasterFields) >>= xMasterField; - xCols->getByName(sParamColumnRealName) >>= xField; - if (xField.is() && xMasterField.is()) - xField->setPropertyValue(PROPERTY_VALUE, xMasterField->getPropertyValue(PROPERTY_VALUE)); + Reference<XNameAccess> xCols(xColsSuppl->getColumns(), UNO_QUERY); + + const ::rtl::OUString* pMasterFields = m_aMasterFields.getConstArray(); + const ::rtl::OUString* pDetailFields = m_aDetailFields.getConstArray(); + const ::rtl::OUString* pDetailFieldsEnd = pDetailFields + m_aDetailFields.getLength(); + for (pDetailFields; pDetailFields < pDetailFieldsEnd; ++pDetailFields, ++pMasterFields) + { + Reference<XPropertySet> xMasterField, xField; + if (m_pParameterInfo->xParamsAsNames->hasByName(*pDetailFields)) + { // we really have a parameter column with this name + Reference< XPropertySet > xParamColumn; + m_pParameterInfo->xParamsAsNames->getByName(*pDetailFields) >>= xParamColumn; + if (xParamColumn.is()) + { // we really really have it :) + ::rtl::OUString sParamColumnRealName; + xParamColumn->getPropertyValue(PROPERTY_REALNAME) >>= sParamColumnRealName; + if (xCols->hasByName(sParamColumnRealName)) + { // our own columns have a column which's name equals the real name of the param column + if (xParentCols->hasByName(*pMasterFields)) + { // and our parent's cols know the master field which is connected to the current detail field + + // -> transfer the value property + xParentCols->getByName(*pMasterFields) >>= xMasterField; + xCols->getByName(sParamColumnRealName) >>= xField; + if (xField.is() && xMasterField.is()) + xField->setPropertyValue(PROPERTY_VALUE, xMasterField->getPropertyValue(PROPERTY_VALUE)); + } } } } @@ -2453,7 +2456,7 @@ void ODatabaseForm::reset_impl(bool _bAproveByListeners) } catch(const Exception&) { - OSL_ENSURE(sal_False, "ODatabaseForm::reset_impl: could not initialize the mater-detail-driven parameters!"); + OSL_ENSURE(sal_False, "ODatabaseForm::reset_impl: could not initialize the master-detail-driven parameters!"); } } } |