diff options
author | Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org> | 2024-07-27 18:03:53 +0200 |
---|---|---|
committer | Michael Stahl <michael.stahl@allotropia.de> | 2024-08-21 10:36:07 +0200 |
commit | 3d26a384539e6e67a6e7ed0e08a29fd2a69b6ed6 (patch) | |
tree | 3294b0544ba2e437135c3f2c1ba6f430d9be414b | |
parent | b4bac41138ab9358b1d79f0611ef46c5737957c4 (diff) |
tdf#152919: update UserFields
- fixes regression from 86d11097cd4a2ae4a6b4e6b35e28a6075376d67a
- Unfortunately SwUserFieldType::SWClientNotify has sideeffects that we
rely on
Change-Id: Ic0cbac0c584e28dd5f49405d116d78eab0e3083e
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171099
Reviewed-by: Bjoern Michaelsen <bjoern.michaelsen@libreoffice.org>
Tested-by: Jenkins
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
(cherry picked from commit b4ddc6e9514ddd82259d49dbae70a7e7185bf011)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172131
-rw-r--r-- | sw/inc/usrfld.hxx | 5 | ||||
-rw-r--r-- | sw/source/core/fields/usrfld.cxx | 13 |
2 files changed, 16 insertions, 2 deletions
diff --git a/sw/inc/usrfld.hxx b/sw/inc/usrfld.hxx index f7371ef52c6e..949d84f930cc 100644 --- a/sw/inc/usrfld.hxx +++ b/sw/inc/usrfld.hxx @@ -69,8 +69,9 @@ public: bool IsDeleted() const { return m_bDeleted; } void SetDeleted( bool b ) { m_bDeleted = b; } - virtual void QueryValue( css::uno::Any& rVal, sal_uInt16 nMId ) const override; - virtual void PutValue( const css::uno::Any& rVal, sal_uInt16 nMId ) override; + virtual void QueryValue( css::uno::Any& rVal, sal_uInt16 nMId ) const override; + virtual void PutValue( const css::uno::Any& rVal, sal_uInt16 nMId ) override; + virtual void UpdateFields() override; void EnsureValid(); void dumpAsXml(xmlTextWriterPtr pWriter) const override; diff --git a/sw/source/core/fields/usrfld.cxx b/sw/source/core/fields/usrfld.cxx index ebfe46fdb9e9..9e170b73b261 100644 --- a/sw/source/core/fields/usrfld.cxx +++ b/sw/source/core/fields/usrfld.cxx @@ -26,6 +26,7 @@ #include <svl/numformat.hxx> #include <unotools/charclass.hxx> +#include <calbck.hxx> #include <calc.hxx> #include <usrfld.hxx> #include <doc.hxx> @@ -233,6 +234,18 @@ void SwUserFieldType::SwClientNotify(const SwModify&, const SfxHint& rHint) } } +void SwUserFieldType::UpdateFields() +{ + m_bValidValue = false; + CallSwClientNotify(sw::LegacyModifyHint(nullptr, nullptr)); + if (!IsModifyLocked()) + { + LockModify(); + GetDoc()->getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::Input)->UpdateFields(); + UnlockModify(); + } +} + double SwUserFieldType::GetValue( SwCalc& rCalc ) { if(m_bValidValue) |