Resolves: #i124179# trigger update User Fields...

and related Input Fields when user directly edits a User Field Input Field

- assure that no recursive updates occur

(cherry picked from commit 3c2b5242e81575ec4b6c110afd88894670bd2283)

Conflicts:
	sw/inc/txtfld.hxx
	sw/source/core/fields/expfld.cxx
	sw/source/core/fields/usrfld.cxx

Change-Id: I36af4d5e8008f16737e3ec14c1ec737a5f43d3b1
diff --git a/sw/inc/expfld.hxx b/sw/inc/expfld.hxx
index af25a11..c9fbebd 100644
--- a/sw/inc/expfld.hxx
+++ b/sw/inc/expfld.hxx
@@ -308,6 +308,9 @@
    // Accessing Input Field's content
    const OUString& getContent() const;

    void LockNotifyContentChange();
    void UnlockNotifyContentChange();

public:
    /// Direct input via dialog; delete old value.
    SwInputField(
diff --git a/sw/inc/txtfld.hxx b/sw/inc/txtfld.hxx
index cfab932..b973aaa 100644
--- a/sw/inc/txtfld.hxx
+++ b/sw/inc/txtfld.hxx
@@ -83,6 +83,8 @@

    virtual sal_Int32* GetEnd();

    void LockNotifyContentChange();
    void UnlockNotifyContentChange();
    virtual void NotifyContentChange( SwFmtFld& rFmtFld );

    void UpdateTextNodeContent( const OUString& rNewContent );
@@ -92,6 +94,8 @@

private:
    sal_Int32 m_nEnd;

    bool m_bLockNotifyContentChange;
};

#endif
diff --git a/sw/source/core/fields/expfld.cxx b/sw/source/core/fields/expfld.cxx
index c7d2507..07a3ee8 100644
--- a/sw/source/core/fields/expfld.cxx
+++ b/sw/source/core/fields/expfld.cxx
@@ -1145,12 +1145,35 @@
    return mpFmtFld;
}


const OUString& SwInputField::getContent() const
{
    return aContent;
}

void SwInputField::LockNotifyContentChange()
{
    if ( GetFmtFld() != NULL )
    {
        SwTxtInputFld* pTxtInputFld = dynamic_cast< SwTxtInputFld* >(GetFmtFld()->GetTxtFld());
        if ( pTxtInputFld != NULL )
        {
            pTxtInputFld->LockNotifyContentChange();
        }
    }
}

void SwInputField::UnlockNotifyContentChange()
{
    if ( GetFmtFld() != NULL )
    {
        SwTxtInputFld* pTxtInputFld = dynamic_cast< SwTxtInputFld* >(GetFmtFld()->GetTxtFld());
        if ( pTxtInputFld != NULL )
        {
            pTxtInputFld->UnlockNotifyContentChange();
        }
    }
}

void SwInputField::applyFieldContent( const OUString& rNewFieldContent )
{
    if ( (nSubType & 0x00ff) == INP_TXT )
@@ -1164,6 +1187,13 @@
        if( pUserTyp )
        {
            pUserTyp->SetContent( rNewFieldContent );

            // trigger update of the corresponding User Fields and other related Input Fields
            {
                LockNotifyContentChange();
                pUserTyp->UpdateFlds();
                UnlockNotifyContentChange();
            }
        }
    }
}
diff --git a/sw/source/core/fields/usrfld.cxx b/sw/source/core/fields/usrfld.cxx
index 453db79..008035e 100644
--- a/sw/source/core/fields/usrfld.cxx
+++ b/sw/source/core/fields/usrfld.cxx
@@ -202,8 +202,14 @@
        ChgValid( false );

    NotifyClients( pOld, pNew );

    // update input fields that might be connected to the user field
    GetDoc()->GetSysFldType( RES_INPUTFLD )->UpdateFlds();
    if ( !IsModifyLocked() )
    {
        LockModify();
        GetDoc()->GetSysFldType( RES_INPUTFLD )->UpdateFlds();
        UnlockModify();
    }
}

double SwUserFieldType::GetValue( SwCalc& rCalc )
diff --git a/sw/source/core/txtnode/atrfld.cxx b/sw/source/core/txtnode/atrfld.cxx
index 32e400d..eb5833e 100644
--- a/sw/source/core/txtnode/atrfld.cxx
+++ b/sw/source/core/txtnode/atrfld.cxx
@@ -453,6 +453,7 @@

    : SwTxtFld( rAttr, nStart, bInClipboard )
    , m_nEnd( nEnd )
    , m_bLockNotifyContentChange( false )
{
    SetHasDummyChar( false );
    SetHasContent( true );
@@ -473,11 +474,30 @@
    return &m_nEnd;
}


void SwTxtInputFld::LockNotifyContentChange()
{
    m_bLockNotifyContentChange = true;
}


void SwTxtInputFld::UnlockNotifyContentChange()
{
    m_bLockNotifyContentChange = false;
}


void SwTxtInputFld::NotifyContentChange( SwFmtFld& rFmtFld )
{
    SwTxtFld::NotifyContentChange( rFmtFld );
    if ( !m_bLockNotifyContentChange )
    {
        LockNotifyContentChange();

    UpdateTextNodeContent( GetFieldContent() );
        SwTxtFld::NotifyContentChange( rFmtFld );
        UpdateTextNodeContent( GetFieldContent() );

        UnlockNotifyContentChange();
    }
}

const OUString SwTxtInputFld::GetFieldContent() const