Kaydet (Commit) 7272b9f7 authored tarafından Eike Rathke's avatar Eike Rathke

Resolves: tdf#101473 handle volatile Add-In results without formula cell

... while temporarily interpreting from within the Function Wizard.

Change-Id: I88e7e062989ed395accd50ed9bfe1b76b3b297ea
Reviewed-on: https://gerrit.libreoffice.org/73290Reviewed-by: 's avatarEike Rathke <erack@redhat.com>
Tested-by: Jenkins
üst e9395f87
......@@ -3023,12 +3023,21 @@ void ScInterpreter::ScExternal()
rArr.AddRecalcMode( ScRecalcMode::ONLOAD_LENIENT );
uno::Reference<sheet::XVolatileResult> xRes = aCall.GetVarRes();
ScAddInListener* pLis = ScAddInListener::Get( xRes );
// In case there is no pMyFormulaCell, i.e. while interpreting
// temporarily from within the Function Wizard, try to obtain a
// valid result from an existing listener for that volatile, or
// create a new and hope for an immediate result. If none
// available that should lead to a void result and thus #N/A.
bool bTemporaryListener = false;
if ( !pLis )
{
pLis = ScAddInListener::CreateListener( xRes, pDok );
pMyFormulaCell->StartListening( *pLis );
if (pMyFormulaCell)
pMyFormulaCell->StartListening( *pLis );
else
bTemporaryListener = true;
}
else
else if (pMyFormulaCell)
{
pMyFormulaCell->StartListening( *pLis );
if ( !pLis->HasDocument( pDok ) )
......@@ -3038,6 +3047,20 @@ void ScInterpreter::ScExternal()
}
aCall.SetResult( pLis->GetResult() ); // use result from async
if (bTemporaryListener)
{
try
{
// EventObject can be any, not evaluated by
// ScAddInListener::disposing()
css::lang::EventObject aEvent;
pLis->disposing(aEvent); // pLis is dead hereafter
}
catch (const uno::Exception&)
{
}
}
}
if ( aCall.GetErrCode() != FormulaError::NONE )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment