diff options
-rw-r--r-- | include/svtools/fmtfield.hxx | 1 | ||||
-rw-r--r-- | svtools/source/control/fmtfield.cxx | 26 |
2 files changed, 20 insertions, 7 deletions
diff --git a/include/svtools/fmtfield.hxx b/include/svtools/fmtfield.hxx index 8486926e53a9..6fab7e4311af 100644 --- a/include/svtools/fmtfield.hxx +++ b/include/svtools/fmtfield.hxx @@ -236,6 +236,7 @@ public: protected: virtual long Notify(NotifyEvent& rNEvt); + void impl_Modify(bool makeValueDirty = true); virtual void Modify(); // CheckText ueberschreiben fuer Ueberpruefung zur Eingabezeit diff --git a/svtools/source/control/fmtfield.cxx b/svtools/source/control/fmtfield.cxx index 53ccc338e2a7..7e04e8ca54ec 100644 --- a/svtools/source/control/fmtfield.cxx +++ b/svtools/source/control/fmtfield.cxx @@ -487,13 +487,14 @@ void FormattedField::SetAutoColor(sal_Bool _bAutomatic) } //------------------------------------------------------------------------------ -void FormattedField::Modify() +void FormattedField::impl_Modify(bool makeValueDirty) { DBG_CHKTHIS(FormattedField, NULL); if (!IsStrictFormat()) { - m_bValueDirty = sal_True; + if(makeValueDirty) + m_bValueDirty = sal_True; SpinField::Modify(); return; } @@ -503,7 +504,8 @@ void FormattedField::Modify() { m_sLastValidText = sCheck; m_aLastSelection = GetSelection(); - m_bValueDirty = sal_True; + if(makeValueDirty) + m_bValueDirty = sal_True; } else { @@ -514,6 +516,14 @@ void FormattedField::Modify() } //------------------------------------------------------------------------------ +void FormattedField::Modify() +{ + DBG_CHKTHIS(FormattedField, NULL); + + impl_Modify(); +} + +//------------------------------------------------------------------------------ void FormattedField::ImplSetTextImpl(const OUString& rNew, Selection* pNewSel) { DBG_CHKTHIS(FormattedField, NULL); @@ -789,10 +799,12 @@ void FormattedField::Commit() // did the text change? if ( GetText() != sOld ) - { // consider the field as modified - Modify(); - // but we have the most recent value now - m_bValueDirty = sal_False; + { // consider the field as modified, + // but we already have the most recent value; + // don't reparse it from the text + // (can lead to data loss when the format is lossy, + // as is e.g. our default date format: 2-digit year!) + impl_Modify(false); } } |