27 #include <osl/diagnose.h>
29 #include <com/sun/star/container/XContentEnumerationAccess.hpp>
30 #include <com/sun/star/frame/XModel.hpp>
31 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
32 #include <com/sun/star/lang/XServiceInfo.hpp>
33 #include <com/sun/star/lang/XServiceName.hpp>
34 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
35 #include <com/sun/star/lang/XSingleComponentFactory.hpp>
36 #include <com/sun/star/reflection/XIdlClass.hpp>
37 #include <com/sun/star/beans/XIntrospectionAccess.hpp>
38 #include <com/sun/star/beans/theIntrospection.hpp>
39 #include <com/sun/star/beans/MethodConcept.hpp>
40 #include <com/sun/star/beans/XPropertySet.hpp>
41 #include <com/sun/star/beans/PropertyValue.hpp>
42 #include <com/sun/star/table/XCellRange.hpp>
43 #include <com/sun/star/lang/Locale.hpp>
44 #include <com/sun/star/sheet/XCompatibilityNames.hpp>
45 #include <com/sun/star/sheet/NoConvergenceException.hpp>
46 #include <com/sun/star/sheet/XAddIn.hpp>
47 #include <com/sun/star/sheet/XVolatileResult.hpp>
65 #define SC_CALLERPOS_NONE (-1)
68 const OUString& rDesc,
69 sal_uInt16 nCat,
const OString& sHelp,
70 const uno::Reference<reflection::XIdlMethod>& rFunc,
74 aOriginalName( rNam ),
78 aDescription( rDesc ),
85 bCompInitialized( false )
108 uno::Reference<sheet::XAddIn> xAddIn;
111 uno::Reference<sheet::XCompatibilityNames> xComp( xAddIn, uno::UNO_QUERY );
114 OUString aMethodName =
xFunction->getName();
115 const uno::Sequence< sheet::LocalizedName> aCompNames( xComp->getCompatibilityNames( aMethodName ));
117 for (
const sheet::LocalizedName& rCompName : aCompNames)
142 const ::std::vector<LocalizedName>& rCompNames =
GetCompNames();
143 if ( !rCompNames.empty() )
146 const OUString& aSearch( aLanguageTag.
getBcp47());
149 ::std::vector<LocalizedName>::const_iterator itNames = std::find_if(rCompNames.begin(), rCompNames.end(),
150 [&aSearch](
const LocalizedName& rName) {
return rName.maLocale == aSearch; });
151 if (itNames != rCompNames.end())
153 rRetExcelName = (*itNames).maName;
160 if (aSearch !=
"en-US")
162 aFallbackSearch.emplace_back(
"en-US");
165 aFallbackSearch.emplace_back(
"en");
168 for (
const auto& rSearch : aFallbackSearch)
170 for (
const auto& rCompName : rCompNames)
174 if (std::find(aFallbackLocales.begin(), aFallbackLocales.end(), rSearch) != aFallbackLocales.end())
176 rRetExcelName = rCompName.maName;
183 rRetExcelName = rCompNames[0].maName;
215 bInitialized( false )
239 uno::Reference<container::XContentEnumerationAccess> xEnAc( xManager, uno::UNO_QUERY );
242 uno::Reference<container::XEnumeration> xEnum =
243 xEnAc->createContentEnumeration(
"com.sun.star.sheet.AddIn" );
247 while ( xEnum->hasMoreElements() )
249 uno::Any aAddInAny = xEnum->nextElement();
253 uno::Reference<uno::XInterface> xIntFac;
254 aAddInAny >>= xIntFac;
260 uno::Reference<uno::XInterface> xInterface;
261 uno::Reference<uno::XComponentContext> xCtx(
263 uno::Reference<lang::XSingleComponentFactory> xCFac( xIntFac, uno::UNO_QUERY );
266 xInterface = xCFac->createInstanceWithContext(xCtx);
271 if (!xInterface.is())
273 uno::Reference<lang::XSingleServiceFactory> xFac( xIntFac, uno::UNO_QUERY );
276 xInterface = xFac->createInstance();
282 }
catch (
const uno::Exception& ) {
283 SAL_WARN (
"sc",
"Failed to initialize create instance of sheet.AddIn" );
316 if ( rName.equalsAscii( aFuncNames[
i] ) )
322 #define CFGPATH_ADDINS "Office.CalcAddIns/AddInInfo"
323 #define CFGSTR_ADDINFUNCTIONS "AddInFunctions"
325 #define CFG_FUNCPROP_DISPLAYNAME 0
326 #define CFG_FUNCPROP_DESCRIPTION 1
327 #define CFG_FUNCPROP_CATEGORY 2
328 #define CFG_FUNCPROP_COUNT 3
329 #define CFGSTR_DISPLAYNAME "DisplayName"
330 #define CFGSTR_DESCRIPTION "Description"
331 #define CFGSTR_CATEGORY "Category"
334 #define CFGSTR_COMPATIBILITYNAME "CompatibilityName"
335 #define CFGSTR_PARAMETERS "Parameters"
347 const OUString sSlash(
'/');
352 for (
const OUString& aServiceName : aServiceNames )
358 uno::Sequence<OUString> aFunctionNames = rAddInConfig.
GetNodeNames( aFunctionsPath );
359 sal_Int32 nNewCount = aFunctionNames.getLength();
367 std::unique_ptr<std::unique_ptr<ScUnoAddInFuncData>[]> ppNew(
new std::unique_ptr<ScUnoAddInFuncData>[
nFuncCount]);
385 const OUString* pFuncNameArray = aFunctionNames.getConstArray();
386 for ( sal_Int32 nFuncPos = 0; nFuncPos < nNewCount; nFuncPos++ )
391 OUString aFuncName = aServiceName +
"." + pFuncNameArray[nFuncPos];
398 OUString aDescription;
403 OUString aFuncPropPath = aFunctionsPath + sSlash + pFuncNameArray[nFuncPos] + sSlash;
405 uno::Sequence<OUString> aFuncPropNames{
410 uno::Sequence<uno::Any> aFuncProperties = rAddInConfig.
GetProperties( aFuncPropNames );
416 OUString aCategoryName;
423 ::std::vector<ScUnoAddInFuncData::LocalizedName> aCompNames;
426 uno::Sequence<OUString> aCompPropNames( &aCompPath, 1 );
428 uno::Sequence<uno::Any> aCompProperties = aAllLocalesConfig.
GetProperties( aCompPropNames );
429 if ( aCompProperties.getLength() == 1 )
431 uno::Sequence<beans::PropertyValue> aLocalEntries;
432 if ( aCompProperties[0] >>= aLocalEntries )
434 for (
const beans::PropertyValue& rConfig : std::as_const(aLocalEntries) )
441 rConfig.Value >>= aName;
442 aCompNames.emplace_back( aLocale, aName);
449 std::unique_ptr<ScAddInArgDesc[]> pVisibleArgs;
454 const uno::Sequence<OUString> aArgumentNames = rAddInConfig.
GetNodeNames( aArgumentsPath );
455 sal_Int32 nArgumentCount = aArgumentNames.getLength();
456 if ( nArgumentCount )
459 uno::Sequence<OUString> aArgPropNames( nArgumentCount * 2 );
460 OUString* pPropNameArray = aArgPropNames.getArray();
463 for (
const OUString& rArgName : aArgumentNames )
465 OUString aOneArgPath = aArgumentsPath + sSlash + rArgName + sSlash;
467 pPropNameArray[nIndex++] = aOneArgPath
469 pPropNameArray[nIndex++] = aOneArgPath
473 uno::Sequence<uno::Any> aArgProperties = rAddInConfig.
GetProperties( aArgPropNames );
474 if ( aArgProperties.getLength() == aArgPropNames.getLength() )
476 const OUString* pArgNameArray = aArgumentNames.getConstArray();
477 const uno::Any* pPropArray = aArgProperties.getConstArray();
479 OUString sDescription;
485 nVisibleCount = nArgumentCount;
489 for ( sal_Int32 nArgument = 0; nArgument < nArgumentCount; nArgument++ )
491 pPropArray[nIndex++] >>= sDisplayName;
492 pPropArray[nIndex++] >>= sDescription;
495 aDesc.
aName = sDisplayName;
498 pVisibleArgs[nArgument] = aDesc;
503 OString sHelpId = aHelpIdGenerator.
GetHelpId( pFuncNameArray[nFuncPos] );
505 uno::Reference<reflection::XIdlMethod> xFunc;
511 aFuncName, aLocalName, aDescription,
537 sal_Int32
nPos = aFullName.lastIndexOf(
'.' );
541 OUString aServiceName = aFullName.copy( 0, nPos );
546 uno::Reference<uno::XInterface> xInterface( xServiceFactory->createInstance( aServiceName ) );
551 catch (
const uno::Exception &)
553 SAL_WARN (
"sc",
"Failed to create addin component '"
554 << aServiceName <<
"'");
563 return pFuncData->
GetExcelName( eDestLang, rRetExcelName);
579 const ::std::vector<ScUnoAddInFuncData::LocalizedName>& rNames = pFuncData->
GetCompNames();
580 auto bFound = std::any_of(rNames.begin(), rNames.end(),
598 return rName == rType.getTypeName();
605 if ( !xClass.is() )
return false;
607 switch (xClass->getTypeClass())
609 case uno::TypeClass_ANY:
610 case uno::TypeClass_ENUM:
611 case uno::TypeClass_BOOLEAN:
612 case uno::TypeClass_CHAR:
613 case uno::TypeClass_BYTE:
614 case uno::TypeClass_SHORT:
615 case uno::TypeClass_UNSIGNED_SHORT:
616 case uno::TypeClass_LONG:
617 case uno::TypeClass_UNSIGNED_LONG:
618 case uno::TypeClass_FLOAT:
619 case uno::TypeClass_DOUBLE:
620 case uno::TypeClass_STRING:
623 case uno::TypeClass_INTERFACE:
628 OUString
sName = xClass->getName();
639 OUString
sName = xClass->getName();
654 uno::TypeClass
eType = xClass->getTypeClass();
656 if ( eType == uno::TypeClass_LONG )
659 if ( eType == uno::TypeClass_DOUBLE )
662 if ( eType == uno::TypeClass_STRING )
666 OUString
sName = xClass->getName();
697 uno::Reference<sheet::XAddIn> xAddIn( xInterface, uno::UNO_QUERY );
698 uno::Reference<lang::XServiceName> xName( xInterface, uno::UNO_QUERY );
699 if ( !(xAddIn.is() && xName.is()) )
704 if (
SC_MOD()->GetFormulaOptions().GetUseEnglishFuncName() )
705 xAddIn->setLocale( lang::Locale(
"en",
"US",
""));
709 OUString aServiceName( xName->getServiceName() );
716 uno::Reference<beans::XIntrospection> xIntro = beans::theIntrospection::get( xContext );
719 uno::Reference<beans::XIntrospectionAccess> xAcc = xIntro->inspect(aObject);
723 uno::Sequence< uno::Reference<reflection::XIdlMethod> >
aMethods =
724 xAcc->getMethods( beans::MethodConcept::ALL );
733 std::unique_ptr<std::unique_ptr<ScUnoAddInFuncData>[]> ppNew(
new std::unique_ptr<ScUnoAddInFuncData>[
nFuncCount]);
749 const uno::Reference<reflection::XIdlMethod>* pArray = aMethods.getConstArray();
750 for (
tools::Long nFuncPos=0; nFuncPos<nNewCount; nFuncPos++)
754 uno::Reference<reflection::XIdlMethod> xFunc = pArray[nFuncPos];
758 uno::Reference<reflection::XIdlClass> xClass =
759 xFunc->getDeclaringClass();
764 OUString
sName = xClass->getName();
777 uno::Reference<reflection::XIdlClass> xReturn =
778 xFunc->getReturnType();
784 OUString aFuncU = xFunc->getName();
787 OUString aFuncName = aServiceName +
"." + aFuncU;
793 uno::Sequence<reflection::ParamInfo> aParams =
794 xFunc->getParameterInfos();
796 const reflection::ParamInfo* pParArr = aParams.getConstArray();
798 for (nParamPos=0; nParamPos<
nParamCount; nParamPos++)
800 if ( pParArr[nParamPos].aMode != reflection::ParamMode_IN )
802 uno::Reference<reflection::XIdlClass> xParClass =
803 pParArr[nParamPos].aType;
808 nCallerPos = nParamPos;
815 xAddIn->getProgrammaticCategoryName( aFuncU ) );
817 OString sHelpId = aHelpIdGenerator.GetHelpId( aFuncU );
822 aLocalName = xAddIn->
823 getDisplayFunctionName( aFuncU );
825 catch(uno::Exception&)
830 OUString aDescription;
833 aDescription = xAddIn->
834 getFunctionDescription( aFuncU );
836 catch(uno::Exception&)
838 aDescription =
"###";
841 std::unique_ptr<ScAddInArgDesc[]> pVisibleArgs;
842 if ( nVisibleCount > 0 )
847 for (nParamPos=0; nParamPos<
nParamCount; nParamPos++)
849 uno::Reference<reflection::XIdlClass> xParClass =
850 pParArr[nParamPos].aType;
858 getDisplayArgumentName( aFuncU, nParamPos );
860 catch(uno::Exception&)
868 getArgumentDescription( aFuncU, nParamPos );
870 catch(uno::Exception&)
879 aDesc.
eType = eArgType;
880 aDesc.
aName = aArgName;
886 pVisibleArgs[nDestPos++] = aDesc;
889 OSL_ENSURE( nDestPos==nVisibleCount,
"wrong count" );
893 aFuncName, aLocalName, aDescription,
896 nVisibleCount, pVisibleArgs.get(), nCallerPos ) );
937 if ( pArguments[
nPos].aInternalName == rArgIntName )
938 return &pArguments[
nPos];
944 std::u16string_view rServiceName )
946 uno::Reference<lang::XLocalizable> xLoc( xInterface, uno::UNO_QUERY );
951 if (
SC_MOD()->GetFormulaOptions().GetUseEnglishFuncName() )
952 xLoc->setLocale( lang::Locale(
"en",
"US",
""));
967 uno::Reference<beans::XIntrospection> xIntro = beans::theIntrospection::get(xContext);
969 aObject <<= xInterface;
970 uno::Reference<beans::XIntrospectionAccess> xAcc = xIntro->inspect(aObject);
974 const uno::Sequence< uno::Reference<reflection::XIdlMethod> >
aMethods =
975 xAcc->getMethods( beans::MethodConcept::ALL );
976 for (
const uno::Reference<reflection::XIdlMethod>& xFunc : aMethods)
980 OUString aFuncU = xFunc->getName();
983 OUString aFuncName = OUString::Concat(rServiceName) +
"." + aFuncU;
998 const uno::Sequence<reflection::ParamInfo> aParams =
999 xFunc->getParameterInfos();
1001 const reflection::ParamInfo* pParArr = aParams.getConstArray();
1004 if ( pParArr[nParamPos].aMode != reflection::ParamMode_IN )
1006 uno::Reference<reflection::XIdlClass> xParClass =
1007 pParArr[nParamPos].aType;
1012 nCallerPos = nParamPos;
1018 std::unique_ptr<ScAddInArgDesc[]> pVisibleArgs;
1019 if ( nVisibleCount > 0 )
1024 for (
const auto& rParam : aParams)
1026 uno::Reference<reflection::XIdlClass> xParClass =
1045 aDesc.
eType = eArgType;
1050 pVisibleArgs[nDestPos++] = aDesc;
1053 OSL_ENSURE( nDestPos==nVisibleCount,
"wrong count" );
1057 pOldData->
SetArguments( nVisibleCount, pVisibleArgs.get() );
1060 if ( pFunctionList )
1080 ScAddInHashMap::const_iterator iLook(
pLocalHashMap->find( rUpperName ) );
1082 return iLook->second->GetOriginalName();
1089 ScAddInHashMap::const_iterator iLook(
pNameHashMap->find( rUpperName ) );
1091 return iLook->second->GetOriginalName();
1097 return iLook->second->GetOriginalName();
1110 ScAddInHashMap::const_iterator iLook(
pExactHashMap->find( rName ) );
1115 if ( bComplete && !pFuncData->
GetFunction().is() )
1141 ScAddInHashMap::const_iterator iLook(
pExactHashMap->find( rName ) );
1143 rName = iLook->second->GetUpperLocal();
1187 if (aDesc.isEmpty())
1193 rDesc.
nArgCount =
static_cast<sal_uInt16
>(nArgCount);
1196 bool bMultiple =
false;
1204 for (
tools::Long nArg=0; nArg<nArgCount; nArg++ )
1213 OUString aDefName =
"arg" + OUString::number( nArg+1 );
1233 bValidCount( false ),
1240 OSL_ENSURE(
pFuncData,
"Function Data missing" );
1248 if ( nParamCount >= nDescCount && nDescCount > 0 &&
1251 tools::Long nVarCount = nParamCount - ( nDescCount - 1 );
1255 else if ( nParamCount <= nDescCount )
1260 if ( !pArgs[
i].bOptional )
1266 aArgs.realloc( nDescCount );
1285 if ( nPos < nCount )
1286 return pArgs[nPos].
eType;
1305 uno::Reference<uno::XInterface> xInt( pObjSh->
GetBaseModel(), uno::UNO_QUERY );
1320 if ( nVarPos <
aVarArg.getLength() )
1321 aVarArg.getArray()[nVarPos] = rValue;
1324 OSL_FAIL(
"wrong argument number");
1327 else if ( nPos <
aArgs.getLength() )
1328 aArgs.getArray()[nPos] = rValue;
1331 OSL_FAIL(
"wrong argument number");
1347 OSL_ENSURE(
aArgs.getLength() == nCount,
"wrong argument count" );
1358 if (nCallPos>nUserLen)
1360 OSL_FAIL(
"wrong CallPos");
1361 nCallPos = nUserLen;
1365 uno::Sequence<uno::Any> aRealArgs( nDestLen );
1366 uno::Any* pDest = aRealArgs.getArray();
1368 pDest = std::copy_n(
aArgs.begin(), nCallPos, pDest);
1369 *pDest = aCallerAny;
1370 std::copy(std::next(
aArgs.begin(), nCallPos),
aArgs.end(), std::next(pDest));
1382 uno::Reference<reflection::XIdlMethod> xFunction;
1390 if ( !xFunction.is() )
1398 aAny = xFunction->invoke( aObject, rCallArgs );
1400 catch(lang::IllegalArgumentException&)
1402 nErrCode = FormulaError::IllegalArgument;
1404 catch(
const reflection::InvocationTargetException& rWrapped)
1406 if ( rWrapped.TargetException.getValueType().equals(
1408 nErrCode = FormulaError::IllegalArgument;
1409 else if ( rWrapped.TargetException.getValueType().equals(
1411 nErrCode = FormulaError::NoConvergence;
1415 catch(uno::Exception&)
1420 if (
nErrCode == FormulaError::NONE)
1424 template <
typename T>
1427 if (!pRowSeq->hasElements())
1430 auto pRow = std::max_element(pRowSeq->begin(), pRowSeq->end(),
1431 [](
const uno::Sequence<T>&
a,
const uno::Sequence<T>& b) {
1432 return a.getLength() < b.getLength(); });
1433 return pRow->getLength();
1443 uno::TypeClass eClass = rNewRes.getValueTypeClass();
1444 const uno::Type& aType = rNewRes.getValueType();
1447 case uno::TypeClass_VOID:
1448 nErrCode = FormulaError::NotAvailable;
1451 case uno::TypeClass_ENUM:
1452 case uno::TypeClass_BOOLEAN:
1453 case uno::TypeClass_CHAR:
1454 case uno::TypeClass_BYTE:
1455 case uno::TypeClass_SHORT:
1456 case uno::TypeClass_UNSIGNED_SHORT:
1457 case uno::TypeClass_LONG:
1458 case uno::TypeClass_UNSIGNED_LONG:
1459 case uno::TypeClass_FLOAT:
1460 case uno::TypeClass_DOUBLE:
1462 uno::TypeClass eMyClass;
1468 case uno::TypeClass_STRING:
1475 case uno::TypeClass_INTERFACE:
1478 uno::Reference<uno::XInterface> xInterface;
1479 rNewRes >>= xInterface;
1480 if ( xInterface.is() )
1481 xVarRes.set( xInterface, uno::UNO_QUERY );
1489 if ( aType.equals(
cppu::UnoType<uno::Sequence< uno::Sequence<sal_Int32> >>::
get() ) )
1491 const uno::Sequence< uno::Sequence<sal_Int32> >* pRowSeq =
nullptr;
1494 uno::Sequence< uno::Sequence<sal_Int32> > aSequence;
1495 if ( rNewRes >>= aSequence )
1496 pRowSeq = &aSequence;
1500 sal_Int32 nRowCount = pRowSeq->getLength();
1502 if ( nMaxColCount && nRowCount )
1504 const uno::Sequence<sal_Int32>* pRowArr = pRowSeq->getConstArray();
1506 static_cast<SCSIZE>(nMaxColCount),
1507 static_cast<SCSIZE>(nRowCount), 0.0);
1508 for (sal_Int32 nRow=0; nRow<nRowCount; nRow++)
1510 sal_Int32
nColCount = pRowArr[nRow].getLength();
1511 const sal_Int32* pColArr = pRowArr[nRow].getConstArray();
1512 for (sal_Int32 nCol=0; nCol<nColCount; nCol++)
1513 xMatrix->PutDouble( pColArr[nCol],
1514 static_cast<SCSIZE>(nCol),
1515 static_cast<SCSIZE>(nRow) );
1516 for (sal_Int32 nCol=nColCount; nCol<nMaxColCount; nCol++)
1518 static_cast<SCSIZE>(nCol),
1519 static_cast<SCSIZE>(nRow) );
1524 else if ( aType.equals(
cppu::UnoType<uno::Sequence< uno::Sequence<double> >>::
get() ) )
1526 const uno::Sequence< uno::Sequence<double> >* pRowSeq =
nullptr;
1529 uno::Sequence< uno::Sequence<double> > aSequence;
1530 if ( rNewRes >>= aSequence )
1531 pRowSeq = &aSequence;
1535 sal_Int32 nRowCount = pRowSeq->getLength();
1537 if ( nMaxColCount && nRowCount )
1539 const uno::Sequence<double>* pRowArr = pRowSeq->getConstArray();
1541 static_cast<SCSIZE>(nMaxColCount),
1542 static_cast<SCSIZE>(nRowCount), 0.0);
1543 for (sal_Int32 nRow=0; nRow<nRowCount; nRow++)
1545 sal_Int32
nColCount = pRowArr[nRow].getLength();
1546 const double* pColArr = pRowArr[nRow].getConstArray();
1547 for (sal_Int32 nCol=0; nCol<nColCount; nCol++)
1548 xMatrix->PutDouble( pColArr[nCol],
1549 static_cast<SCSIZE>(nCol),
1550 static_cast<SCSIZE>(nRow) );
1551 for (sal_Int32 nCol=nColCount; nCol<nMaxColCount; nCol++)
1553 static_cast<SCSIZE>(nCol),
1554 static_cast<SCSIZE>(nRow) );
1559 else if ( aType.equals(
cppu::UnoType<uno::Sequence< uno::Sequence<OUString> >>::
get() ) )
1561 const uno::Sequence< uno::Sequence<OUString> >* pRowSeq =
nullptr;
1564 uno::Sequence< uno::Sequence<OUString> > aSequence;
1565 if ( rNewRes >>= aSequence )
1566 pRowSeq = &aSequence;
1570 sal_Int32 nRowCount = pRowSeq->getLength();
1572 if ( nMaxColCount && nRowCount )
1574 const uno::Sequence<OUString>* pRowArr = pRowSeq->getConstArray();
1576 static_cast<SCSIZE>(nMaxColCount),
1577 static_cast<SCSIZE>(nRowCount), 0.0);
1578 for (sal_Int32 nRow=0; nRow<nRowCount; nRow++)
1580 sal_Int32
nColCount = pRowArr[nRow].getLength();
1581 const OUString* pColArr = pRowArr[nRow].getConstArray();
1582 for (sal_Int32 nCol=0; nCol<nColCount; nCol++)
1586 static_cast<SCSIZE>(nCol), static_cast<SCSIZE>(nRow));
1588 for (sal_Int32 nCol=nColCount; nCol<nMaxColCount; nCol++)
1592 static_cast<SCSIZE>(nCol), static_cast<SCSIZE>(nRow));
1598 else if ( aType.equals(
cppu::UnoType<uno::Sequence< uno::Sequence<uno::Any> >>::
get() ) )
Matrix data type that can store values of mixed types.
constexpr Method aMethods[]
#define ID_FUNCTION_GRP_ADDINS
List of spreadsheet functions.
const ::std::vector< LocalizedName > & GetCompNames() const
bool bOptional
Parameter is optional.
static bool IsTypeName(std::u16string_view rName, const uno::Type &rType)
std::unique_ptr< ContentProperties > pData
const ScUnoAddInFuncData * GetFuncData(const OUString &rName, bool bComplete=false)
Only if bComplete is set, the function reference and argument types are initialized (component may ha...
static OUString convertToBcp47(LanguageType nLangID)
Stores whether a parameter is optional or suppressed.
static const AllSettings & GetSettings()
const OUString & GetLocalName() const
const OUString & getBcp47(bool bResolveSystem=true) const
static bool ConvertAnyToDouble(double &o_fVal, css::uno::TypeClass &o_eClass, const css::uno::Any &rAny)
Convert a uno::Any to double if possible, including integer types.
void LoadComponent(const ScUnoAddInFuncData &rFuncData)
void SetCallerPos(tools::Long nNewPos)
Sequence< OUString > aServiceNames
std::unordered_map< OUString, const ScUnoAddInFuncData * > ScAddInHashMap
void SetParam(tools::Long nPos, const css::uno::Any &rValue)
const OUString & GetUpperName() const
OUString aUpperName
for entering formulas
const OUString & GetDescription() const
const css::uno::Any & GetObject() const
#define CFG_FUNCPROP_COUNT
OString GetHelpId(const OUString &rFuncName) const
#define SC_FUNCGROUP_COUNT
css::uno::Reference< css::sheet::XVolatileResult > xVarRes
void SetFunction(const css::uno::Reference< css::reflection::XIdlMethod > &rNewFunc, const css::uno::Any &rNewObj)
std::unique_ptr< ScAddInHashMap > pExactHashMap
exact internal name
bool GetExcelName(const OUString &rCalcName, LanguageType eDestLang, OUString &rRetExcelName)
leave rRetExcelName unchanged, if no matching name is found
void SetCaller(const css::uno::Reference< css::uno::XInterface > &rInterface)
ScAddInArgumentType eType
#define CFG_FUNCPROP_DISPLAYNAME
Generates help IDs for standard Calc AddIns.
ParameterFlags * pDefArgFlags
Flags for each parameter.
#define CFGSTR_DISPLAYNAME
ScAddInArgumentType GetArgType(tools::Long nPos)
css::uno::Reference< css::frame::XModel > GetBaseModel() const
void SetArguments(tools::Long nNewCount, const ScAddInArgDesc *pNewDescs)
const OUString & GetUpperLocal() const
css::uno::Reference< css::uno::XInterface > xCaller
css::uno::Sequence< css::uno::Any > GetProperties(const css::uno::Sequence< OUString > &rNames)
#define CFGSTR_ADDINFUNCTIONS
static sal_Int32 lcl_GetMaxColCount(const uno::Sequence< uno::Sequence< T > > *pRowSeq)
sal_uInt16 nCategory
Function category.
OUString aUpperLocal
for entering formulas
static bool lcl_ValidReturnType(const uno::Reference< reflection::XIdlClass > &xClass)
std::unique_ptr< ScAddInHashMap > pLocalHashMap
localized name upper
std::vector< OUString > maDefArgDescs
Description(s) of parameter(s)
mutable::std::vector< LocalizedName > maCompNames
const OUString & FindFunction(const OUString &rUpperName, bool bLocalFirst)
User entered name. rUpperName MUST already be upper case!
static bool FillFunctionDescFromData(const ScUnoAddInFuncData &rFuncData, ScFuncDesc &rDesc)
void LocalizeString(OUString &rName)
modify rName - input: exact name
OUString uppercase(const OUString &rStr, sal_Int32 nPos, sal_Int32 nCount) const
std::unique_ptr< ScAddInHashMap > pNameHashMap
internal name upper
std::optional< OUString > mxFuncDesc
Description of function.
sal_uInt16 GetCategory() const
void ReadFromAddIn(const css::uno::Reference< css::uno::XInterface > &xInterface)
::std::vector< OUString > getFallbackStrings(bool bIncludeFullBcp47) const
Reference< XComponentContext > getComponentContext(Reference< XMultiServiceFactory > const &factory)
const OUString & GetOriginalName() const
const ScFuncDesc * GetFunction(sal_uInt32 nIndex) const
OUString aInternalName
used to match configuration and reflection information
#define CFG_FUNCPROP_DESCRIPTION
const ScAddInArgDesc * GetArguments() const
static ScFunctionList * GetStarCalcFunctionList()
std::unique_ptr< ScAddInArgDesc[]> pArgDescs
#define CFGSTR_COMPATIBILITYNAME
static ScAddInArgumentType lcl_GetArgType(const uno::Reference< reflection::XIdlClass > &xClass)
const LanguageTag & getLocale()
static bool HasStarCalcFunctionList()
const css::uno::Reference< css::reflection::XIdlMethod > & GetFunction() const
css::uno::Sequence< css::uno::Any > aVarArg
Reference< XMultiServiceFactory > getProcessServiceFactory()
std::optional< OUString > mxFuncName
Function name.
#define CFGSTR_DESCRIPTION
void Clear()
Clears the object.
css::uno::Sequence< css::uno::Any > aArgs
static const ScAddInArgDesc * lcl_FindArgDesc(const ScUnoAddInFuncData &rFuncData, std::u16string_view rArgIntName)
void SetCallerFromObjectShell(const SfxObjectShell *pSh)
#define CFGSTR_PARAMETERS
static ScMatrixRef CreateMixedMatrix(const css::uno::Any &rAny)
Convert a sequence of mixed elements to ScMatrix.
tools::Long GetArgumentCount() const
ScUnoAddInFuncData(const OUString &rNam, const OUString &rLoc, const OUString &rDesc, sal_uInt16 nCat, const OString &, const css::uno::Reference< css::reflection::XIdlMethod > &rFunc, const css::uno::Any &rO, tools::Long nAC, const ScAddInArgDesc *pAD, tools::Long nCP)
const ScUnoAddInFuncData * pFuncData
std::unique_ptr< std::unique_ptr< ScUnoAddInFuncData >[]> ppFuncData
css::uno::Reference< css::reflection::XIdlMethod > xFunction
static SC_DLLPUBLIC const CharClass * getCharClassPtr()
tools::Long GetCallerPos() const
Reference< XComponentContext > getProcessComponentContext()
sal_uInt32 GetCount() const
#define CFG_FUNCPROP_CATEGORY
void SetCompNames(const ::std::vector< LocalizedName > &rNew)
void SetResult(const css::uno::Any &rNewRes)
OString sHelpId
HelpId of function.
css::uno::Sequence< OUString > GetNodeNames(const OUString &rNode)
#define SAL_WARN(area, stream)
static sal_uInt16 lcl_GetCategory(const OUString &rName)
const OString & GetHelpId() const
std::vector< OUString > maDefArgNames
Parameter name(s)
static void lcl_UpdateFunctionList(const ScFunctionList &rFunctionList, const ScUnoAddInFuncData &rFuncData)
bool GetExcelName(LanguageType eDestLang, OUString &rRetExcelName) const
bool FillFunctionDesc(tools::Long nFunc, ScFuncDesc &rDesc)
#define SC_CALLERPOS_NONE
void ExecuteCallWithArgs(css::uno::Sequence< css::uno::Any > &rCallArgs)
bool GetCalcName(const OUString &rExcelName, OUString &rRetCalcName)
leave rRetCalcName unchanged, if no matching name is found
bool bIncomplete
Incomplete argument info (set for add-in info from configuration)
css::uno::Sequence< css::uno::Any > GetProperties(const css::uno::Sequence< OUString > &rNames)
ScUnoAddInCall(ScUnoAddInCollection &rColl, const OUString &rName, tools::Long nParamCount)
Stores and generates human readable descriptions for spreadsheet-functions, e.g. functions used in fo...
sal_uInt16 nArgCount
All parameter count, suppressed and unsuppressed.
void UpdateFromAddIn(const css::uno::Reference< css::uno::XInterface > &xInterface, std::u16string_view rServiceName)
tools::Long GetFuncCount()