From 5a7157d319477830426797532e02ac39d3b859f4 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 15 Apr 2024 11:29:03 +0200 Subject: Merging upstream version 4:24.2.1. Signed-off-by: Daniel Baumann --- sw/source/core/fields/expfld.cxx | 20 +++++++++++++++----- sw/source/core/fields/postithelper.cxx | 4 ++-- 2 files changed, 17 insertions(+), 7 deletions(-) (limited to 'sw/source/core/fields') diff --git a/sw/source/core/fields/expfld.cxx b/sw/source/core/fields/expfld.cxx index 434f676729..6ed4cdb7c1 100644 --- a/sw/source/core/fields/expfld.cxx +++ b/sw/source/core/fields/expfld.cxx @@ -881,10 +881,9 @@ std::unique_ptr SwSetExpField::Copy() const void SwSetExpField::SetSubType(sal_uInt16 nSub) { + assert((nSub & 0xff) != (nsSwGetSetExpType::GSE_STRING|nsSwGetSetExpType::GSE_EXPR) && "SubType is illegal!"); static_cast(GetTyp())->SetType(nSub & 0xff); mnSubType = nSub & 0xff00; - - OSL_ENSURE( (nSub & 0xff) != 3, "SubType is illegal!" ); } sal_uInt16 SwSetExpField::GetSubType() const @@ -1100,8 +1099,19 @@ bool SwSetExpField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId ) break; case FIELD_PROP_SUBTYPE: nTmp32 = lcl_APIToSubType(rAny); - if(nTmp32 >= 0) - SetSubType(o3tl::narrowing((GetSubType() & 0xff00) | nTmp32)); + if (0 <= nTmp32 && nTmp32 != (GetSubType() & 0xff)) + { + auto const subType(o3tl::narrowing((GetSubType() & 0xff00) | nTmp32)); + if (((nTmp32 & nsSwGetSetExpType::GSE_STRING) != (GetSubType() & nsSwGetSetExpType::GSE_STRING)) + && GetInputFlag()) + { + SwXTextField::TransmuteLeadToInputField(*this, &subType); + } + else + { + SetSubType(subType); + } + } break; case FIELD_PROP_PAR3: rAny >>= maPText; @@ -1120,7 +1130,7 @@ bool SwSetExpField::PutValue( const uno::Any& rAny, sal_uInt16 nWhichId ) if (static_cast(GetTyp())->GetType() & nsSwGetSetExpType::GSE_STRING) { - SwXTextField::TransmuteLeadToInputField(*this); + SwXTextField::TransmuteLeadToInputField(*this, nullptr); } else { diff --git a/sw/source/core/fields/postithelper.cxx b/sw/source/core/fields/postithelper.cxx index a3f27be6f5..06fb3db7ef 100644 --- a/sw/source/core/fields/postithelper.cxx +++ b/sw/source/core/fields/postithelper.cxx @@ -97,8 +97,8 @@ SwAnchoredObject* GetAnchoredObjectOfAnnotationMark(const sw::mark::IMark& rAnno for (SwAnchoredObject* pObject : *pAnchored) { - SwFrameFormat& rFrameFormat = pObject->GetFrameFormat(); - const SwPosition* pFrameAnchor = rFrameFormat.GetAnchor().GetContentAnchor(); + SwFrameFormat* pFrameFormat = pObject->GetFrameFormat(); + const SwPosition* pFrameAnchor = pFrameFormat->GetAnchor().GetContentAnchor(); if (!pFrameAnchor) { continue; -- cgit v1.2.3