sw/source/ui/fldui/fldpage.cxx |   15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

New commits:
commit e0ad8b708fbecc27ff3674f2d518edfedc73a55f
Author:     Noel Grandin <[email protected]>
AuthorDate: Thu Oct 9 11:01:52 2025 +0200
Commit:     Noel Grandin <[email protected]>
CommitDate: Thu Oct 9 12:45:01 2025 +0200

    revert some changes to SwFieldPage::InsertField
    
    where I had no idea of the mess I was stepping into.
    And add some comments for anyone else looking at this.
    
    This reverts parts of
        commit da024246e6ead07f678ab17e42fdb9b071a65c1a
        Author: Noel Grandin <[email protected]>
        Date:   Sun Jul 6 13:10:03 2025 +0200
        convert SwInputFieldSubType to scoped enum
    and
        commit 2d7883aba225305f7d9acd213c7e21c0012e6c0c
        Author: Noel Grandin <[email protected]>
        Date:   Tue Oct 7 16:11:37 2025 +0200
        tdf#168744 editting format of writer input field asserts
    
    i.e. I am returning this specific chunk of logic to the effective
    state it was in before those two commits.
    I say effective, because the original code was using the "wrong"
    define constant in the if statement, so I used the constant that
    would result in the same comparison.
    
    Change-Id: I5164e72cbbf823fee4278e0fad2ad7216be47882
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192095
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <[email protected]>

diff --git a/sw/source/ui/fldui/fldpage.cxx b/sw/source/ui/fldui/fldpage.cxx
index 9c8a2074ce3d..3e408a3d4159 100644
--- a/sw/source/ui/fldui/fldpage.cxx
+++ b/sw/source/ui/fldui/fldpage.cxx
@@ -234,13 +234,18 @@ void SwFieldPage::InsertField(SwFieldTypesEnum nTypeId, 
sal_uInt16 nSubType, con
             break;
 
         case SwFieldTypesEnum::Input:
-            {
-                // User- or SetExp- Field ?
+           {
+                // This could actually be SwFieldTypesEnum::SetInput,
+                // because of the remapping we do in SwFieldVarPage::Reset().
+                // Which is why we cast to SwSetExpField instead of casting to 
SwInputField.
+                assert(dynamic_cast<SwSetExpField*>(pTmpField.get()));
+                SwSetExpField* pField = 
static_cast<SwSetExpField*>(pTmpField.get());
+                // User- or SetField ?
                 if (m_aMgr.GetFieldType(SwFieldIds::User, sPar1) == nullptr &&
-                    SwFieldIds::SetExp != pTmpField->Which()) // SETEXPFLD
+                    !(pField->GetSubType() & SwGetSetExpType::String)) // 
SETEXPFLD
                 {
-                    SwInputField* pField = 
static_cast<SwInputField*>(pTmpField.get());
-                    pField->SetPar2(sPar2); // Par2 is prompt for SwInputField
+                    pField->SetPromptText(sPar2);
+                    sPar2 = pField->GetPar2();
                 }
             }
             break;

Reply via email to