sc: Pass XModel3 to ScUnoAddInCall::SetCaller

Switch the method param to the XModel3 interface
from the very basic XInterface type. This drops
the need to explicitly cast/query to avoid
ambiguity in the callers where the passed object
multi-inherits the XInterface interface/base class.

This also prepares for switching the return type
of SfxObjectShell::GetBaseModel to a reference of
the concrete SfxBaseModel in an upcoming commit (without
introducing ambiguity due to multi-inheritance from
XInterface in places using only an XInterface
reference).

Change-Id: I97e060136b02f3eb1e652cff4021e57a85677e19
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/211052
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
This commit is contained in:
Michael Weghorn
2026-09-17 14:51:23 +02:00
parent 83d27161f4
commit 2647004df6
3 changed files with 7 additions and 7 deletions
+2 -1
View File
@@ -20,6 +20,7 @@
#pragma once
#include <memory>
#include <com/sun/star/frame/XModel3.hpp>
#include <com/sun/star/uno/Any.h>
#include <com/sun/star/uno/Reference.h>
#include <com/sun/star/uno/Sequence.h>
@@ -218,7 +219,7 @@ public:
~ScUnoAddInCall();
bool NeedsCaller() const;
void SetCaller( const css::uno::Reference<css::uno::XInterface>& rInterface );
void SetCaller(const css::uno::Reference<css::frame::XModel3>& rModel);
void SetCallerFromObjectShell( const SfxObjectShell* pSh );
bool ValidParamCount() { return bValidCount;}
+4 -4
View File
@@ -23,6 +23,7 @@
#include <vcl/svapp.hxx>
#include <vcl/settings.hxx>
#include <sfx2/objsh.hxx>
#include <sfx2/sfxbasemodel.hxx>
#include <unotools/charclass.hxx>
#include <sal/log.hxx>
#include <o3tl/string_view.hxx>
@@ -1425,17 +1426,16 @@ bool ScUnoAddInCall::NeedsCaller() const
return pFuncData && pFuncData->GetCallerPos() != SC_CALLERPOS_NONE;
}
void ScUnoAddInCall::SetCaller( const uno::Reference<uno::XInterface>& rInterface )
void ScUnoAddInCall::SetCaller(const css::uno::Reference<css::frame::XModel3>& rModel)
{
xCaller = rInterface;
xCaller = rModel;
}
void ScUnoAddInCall::SetCallerFromObjectShell( const SfxObjectShell* pObjSh )
{
if (pObjSh)
{
uno::Reference<uno::XInterface> xInt( pObjSh->GetBaseModel(), uno::UNO_QUERY );
SetCaller( xInt );
SetCaller(pObjSh->GetBaseModel());
}
}
+1 -2
View File
@@ -3070,8 +3070,7 @@ void ScInterpreter::ScExternal()
else
{
// use temporary model object (without document) to supply options
aCall.SetCaller( static_cast<beans::XPropertySet*>(
new ScDocOptionsObj( mrDoc.GetDocOptions() ) ) );
aCall.SetCaller(new ScDocOptionsObj(mrDoc.GetDocOptions()));
}
}