[Libreoffice-commits] core.git: forms/source

Lionel Elie Mamane lionel at mamane.lu
Tue May 9 11:19:17 UTC 2017


 forms/source/component/FormComponent.cxx |   12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

New commits:
commit 24e05b48cb7ceb67c2566bbb212cbc1d752bb59e
Author: Lionel Elie Mamane <lionel at mamane.lu>
Date:   Tue May 9 12:53:25 2017 +0200

    tdf#107720 Bound Control initFromField: consider the case of the insert row
    
    Change-Id: If18e161c994c926fd86453ab5736df1e89bb61de

diff --git a/forms/source/component/FormComponent.cxx b/forms/source/component/FormComponent.cxx
index 97bea91aa8b9..db71eba8e285 100644
--- a/forms/source/component/FormComponent.cxx
+++ b/forms/source/component/FormComponent.cxx
@@ -1980,7 +1980,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 == false);
+                xPS->getPropertyValue("IsNew") >>= shouldTransfer;
+            }
+        }
+        if ( shouldTransfer )
             transferDbValueToControl();
         else
             // reset the field if the row set is empty


More information about the Libreoffice-commits mailing list