sw/inc/usrfld.hxx                |    5 +++--
 sw/source/core/fields/usrfld.cxx |   13 +++++++++++++
 2 files changed, 16 insertions(+), 2 deletions(-)

New commits:
commit 3d26a384539e6e67a6e7ed0e08a29fd2a69b6ed6
Author:     Bjoern Michaelsen <bjoern.michael...@libreoffice.org>
AuthorDate: Sat Jul 27 18:03:53 2024 +0200
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Wed Aug 21 10:36:07 2024 +0200

    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.michael...@libreoffice.org>
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>
    (cherry picked from commit b4ddc6e9514ddd82259d49dbae70a7e7185bf011)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/172131

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)

Reply via email to