tdf#150139 - Add a concrete name to the error message

Add a concrete name to the "Property or method not found: $(ARG1)" error message when creating a listener.

Change-Id: I76c904793a96082c49f8aa2d45c76c50a453d892
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/138061
Tested-by: Jenkins
Reviewed-by: Andreas Heinisch <andreas.heinisch@yahoo.de>
diff --git a/basic/inc/sbxbase.hxx b/basic/inc/sbxbase.hxx
index 80552c2..e06d761 100644
--- a/basic/inc/sbxbase.hxx
+++ b/basic/inc/sbxbase.hxx
@@ -36,6 +36,7 @@ class SbxBasicFormater;
struct SbxAppData
{
    ErrCode eErrCode; // Error code
    OUString aErrorMsg; // Error message for $ARG
    SbxVariableRef m_aGlobErr; // Global error object
    std::vector<SbxFactory*> m_Factories; // these are owned by fields in SbiGlobals
    tools::SvRef<SvRefBase> mrImplRepository;
diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx
index 8d87330..f1ab6dd 100644
--- a/basic/source/classes/sb.cxx
+++ b/basic/source/classes/sb.cxx
@@ -1325,11 +1325,11 @@ bool StarBASIC::Call( const OUString& rName, SbxArray* pParam )
    if( !bRes )
    {
        ErrCode eErr = SbxBase::GetError();
        SbxBase::ResetError();
        if( eErr != ERRCODE_NONE )
        {
            RTError( eErr, OUString(), 0, 0, 0 );
            RTError(eErr, SbxBase::GetErrorMsg(), 0, 0, 0);
        }
        SbxBase::ResetError();
    }
    return bRes;
}
diff --git a/basic/source/sbx/sbxbase.cxx b/basic/source/sbx/sbxbase.cxx
index 3b70307..9d2129e 100644
--- a/basic/source/sbx/sbxbase.cxx
+++ b/basic/source/sbx/sbxbase.cxx
@@ -37,6 +37,7 @@

SbxAppData::SbxAppData()
    : eErrCode(ERRCODE_NONE)
    , aErrorMsg(OUString())
    , eBasicFormaterLangType(LANGUAGE_DONTKNOW)
{
}
@@ -96,6 +97,21 @@ ErrCode const & SbxBase::GetError()
    return GetSbxData_Impl().eErrCode;
}

OUString const & SbxBase::GetErrorMsg()
{
    return GetSbxData_Impl().aErrorMsg;
}

void SbxBase::SetError(ErrCode e, const OUString& rMsg)
{
    SbxAppData& r = GetSbxData_Impl();
    if (e && r.eErrCode == ERRCODE_NONE)
    {
        r.eErrCode = e;
        r.aErrorMsg = rMsg;
    }
}

void SbxBase::SetError( ErrCode e )
{
    SbxAppData& r = GetSbxData_Impl();
@@ -111,6 +127,7 @@ bool SbxBase::IsError()
void SbxBase::ResetError()
{
    GetSbxData_Impl().eErrCode = ERRCODE_NONE;
    GetSbxData_Impl().aErrorMsg = OUString();
}

void SbxBase::AddFactory( SbxFactory* pFac )
diff --git a/basic/source/sbx/sbxexec.cxx b/basic/source/sbx/sbxexec.cxx
index d830061..f3abca7 100644
--- a/basic/source/sbx/sbxexec.cxx
+++ b/basic/source/sbx/sbxexec.cxx
@@ -323,7 +323,7 @@ static SbxVariableRef Element
            }
        }
        else
            SbxBase::SetError( ERRCODE_BASIC_NO_METHOD );
            SbxBase::SetError( ERRCODE_BASIC_NO_METHOD, aSym );
    }
    *ppBuf = p;
    return refVar;
diff --git a/basic/source/sbx/sbxobj.cxx b/basic/source/sbx/sbxobj.cxx
index f83324a..4dd0549 100644
--- a/basic/source/sbx/sbxobj.cxx
+++ b/basic/source/sbx/sbxobj.cxx
@@ -275,7 +275,7 @@ bool SbxObject::Call( const OUString& rName, SbxArray* pParam )
        pMeth->SetParameters( nullptr );
        return true;
    }
    SetError( ERRCODE_BASIC_NO_METHOD );
    SetError( ERRCODE_BASIC_NO_METHOD, rName );
    return false;
}

diff --git a/include/basic/sbxcore.hxx b/include/basic/sbxcore.hxx
index e5f726e..477858d 100644
--- a/include/basic/sbxcore.hxx
+++ b/include/basic/sbxcore.hxx
@@ -85,7 +85,9 @@ public:
    virtual bool    LoadCompleted();

    static ErrCode const & GetError();
    static OUString const& GetErrorMsg();
    static void SetError( ErrCode );
    static void SetError(ErrCode, const OUString&);
    static bool IsError();
    static void ResetError();