Resolves: tdf#151919 mark blanked fields as requiring a reformat

the next time a format is requested, even if the value of the
Formatter is the same, otherwise if the value is the same it
will remain blank.

Change-Id: Iec77e6d9f792b51a83a9e289cbdb197605ab1a21
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157267
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
diff --git a/include/vcl/formatter.hxx b/include/vcl/formatter.hxx
index 4aa81ea..54d6745 100644
--- a/include/vcl/formatter.hxx
+++ b/include/vcl/formatter.hxx
@@ -186,6 +186,12 @@ public:
    // If the current String is invalid, GetValue() returns this value
    double  GetDefaultValue() const             { return m_dDefaultValue; }

    // Make the formatter recreate the output text from the value on the next
    // format attempt even if the value is the same as the current value.
    // Needed if the associated widget had its text changed by something other
    // that this Formatter (typically blanked out) since the last formatting
    void    InvalidateValueState()    { m_ValueState = valueDirty; }

    void SetLastSelection(const Selection& rSelection) { m_aLastSelection = rSelection; }

    // Settings for the format
diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx
index 2bf339a..cb8ccf9 100644
--- a/svx/source/fmcomp/gridcell.cxx
+++ b/svx/source/fmcomp/gridcell.cxx
@@ -2067,15 +2067,16 @@ void DbNumericField::updateFromModel( Reference< XPropertySet > _rxModel )
    OSL_ENSURE( _rxModel.is() && m_pWindow, "DbNumericField::updateFromModel: invalid call!" );

    FormattedControlBase* pControl = static_cast<FormattedControlBase*>(m_pWindow.get());
    Formatter& rFormatter = pControl->get_formatter();

    double dValue = 0;
    if ( _rxModel->getPropertyValue( FM_PROP_VALUE ) >>= dValue )
    {
        Formatter& rFormatter = pControl->get_formatter();
        rFormatter.SetValue(dValue);
    }
    else
    {
        pControl->get_widget().set_text(OUString());
        rFormatter.InvalidateValueState();
    }
}

bool DbNumericField::commitControl()
@@ -2187,15 +2188,16 @@ void DbCurrencyField::updateFromModel( Reference< XPropertySet > _rxModel )
    OSL_ENSURE( _rxModel.is() && m_pWindow, "DbCurrencyField::updateFromModel: invalid call!" );

    FormattedControlBase* pControl = static_cast<FormattedControlBase*>(m_pWindow.get());
    Formatter& rFormatter = pControl->get_formatter();

    double dValue = 0;
    if ( _rxModel->getPropertyValue( FM_PROP_VALUE ) >>= dValue )
    {
        Formatter& rFormatter = pControl->get_formatter();
        rFormatter.SetValue(dValue);
    }
    else
    {
        pControl->get_widget().set_text(OUString());
        rFormatter.InvalidateValueState();
    }
}

bool DbCurrencyField::commitControl()