Skip to content

Commit

Permalink
tdf#152919: update UserFields
Browse files Browse the repository at this point in the history
- fixes regression from 86d1109
- 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 <[email protected]>
Tested-by: Jenkins
Reviewed-by: Michael Stahl <[email protected]>
  • Loading branch information
bjoernmichaelsen committed Jul 30, 2024
1 parent ccdf109 commit b4ddc6e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
5 changes: 3 additions & 2 deletions sw/inc/usrfld.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
13 changes: 13 additions & 0 deletions sw/source/core/fields/usrfld.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <svl/numformat.hxx>
#include <unotools/charclass.hxx>

#include <calbck.hxx>
#include <calc.hxx>
#include <usrfld.hxx>
#include <doc.hxx>
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit b4ddc6e

Please sign in to comment.