diff options
author | Lionel Elie Mamane <lionel@mamane.lu> | 2017-05-09 12:53:25 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2017-05-30 10:19:46 +0200 |
commit | ad612ab62a2bc1cfd07aadc56b576daf3445bf24 (patch) | |
tree | 578e1a0c4c82796609cb17692a0ec38ee40bfb5e /forms | |
parent | ba54eb5f01a84ffb4dc72d11d7a8dd6572dd5a5f (diff) |
tdf#107720 Bound Control initFromField: consider the case of the insert row
loplugin: simplifybool
(cherry picked from commit 95b25532d24bfb08c4846b991451a36475dd439f)
Change-Id: If18e161c994c926fd86453ab5736df1e89bb61de
Reviewed-on: https://gerrit.libreoffice.org/37427
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Stahl <mstahl@redhat.com>
(cherry picked from commit bb50f9d66540a87065f30da8fd8cadde8e730704)
Diffstat (limited to 'forms')
-rw-r--r-- | forms/source/component/FormComponent.cxx | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/forms/source/component/FormComponent.cxx b/forms/source/component/FormComponent.cxx index 80e85758801c..743f4d47986b 100644 --- a/forms/source/component/FormComponent.cxx +++ b/forms/source/component/FormComponent.cxx @@ -1981,7 +1981,17 @@ void OBoundControlModel::initFromField( const Reference< XRowSet >& _rxRowSet ) // but only if the rowset is positioned on a valid record if ( hasField() && _rxRowSet.is() ) { - if ( !_rxRowSet->isBeforeFirst() && !_rxRowSet->isAfterLast() ) + bool shouldTransfer(!_rxRowSet->isBeforeFirst() && !_rxRowSet->isAfterLast()); + if (!shouldTransfer) + { + const Reference< XPropertySet > xPS(_rxRowSet, UNO_QUERY); + if (xPS.is()) + { + assert(!shouldTransfer); + xPS->getPropertyValue("IsNew") >>= shouldTransfer; + } + } + if ( shouldTransfer ) transferDbValueToControl(); else // reset the field if the row set is empty |