28 #include <osl/diagnose.h>
30 #include <com/sun/star/container/XContentEnumerationAccess.hpp>
31 #include <com/sun/star/frame/XModel.hpp>
32 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
33 #include <com/sun/star/lang/XServiceInfo.hpp>
34 #include <com/sun/star/lang/XServiceName.hpp>
35 #include <com/sun/star/lang/XSingleServiceFactory.hpp>
36 #include <com/sun/star/lang/XSingleComponentFactory.hpp>
37 #include <com/sun/star/reflection/XIdlClass.hpp>
38 #include <com/sun/star/beans/XIntrospectionAccess.hpp>
39 #include <com/sun/star/beans/theIntrospection.hpp>
40 #include <com/sun/star/beans/MethodConcept.hpp>
41 #include <com/sun/star/beans/XPropertySet.hpp>
42 #include <com/sun/star/beans/PropertyValue.hpp>
43 #include <com/sun/star/table/XCellRange.hpp>
44 #include <com/sun/star/lang/Locale.hpp>
45 #include <com/sun/star/sheet/XCompatibilityNames.hpp>
46 #include <com/sun/star/sheet/NoConvergenceException.hpp>
47 #include <com/sun/star/sheet/XAddIn.hpp>
48 #include <com/sun/star/sheet/XVolatileResult.hpp>
66 #define SC_CALLERPOS_NONE (-1)
69 const OUString& rDesc,
70 sal_uInt16 nCat,
const OString& sHelp,
71 const uno::Reference<reflection::XIdlMethod>& rFunc,
75 aOriginalName( rNam ),
79 aDescription( rDesc ),
86 bCompInitialized(
false )
109 uno::Reference<sheet::XAddIn> xAddIn;
112 uno::Reference<sheet::XCompatibilityNames> xComp( xAddIn, uno::UNO_QUERY );
115 OUString aMethodName =
xFunction->getName();
116 const uno::Sequence< sheet::LocalizedName> aCompNames( xComp->getCompatibilityNames( aMethodName ));
118 for (
const sheet::LocalizedName& rCompName : aCompNames)
143 const ::std::vector<LocalizedName>& rCompNames =
GetCompNames();
144 if ( !rCompNames.empty() )
147 const OUString& aSearch( aLanguageTag.
getBcp47());
150 ::std::vector<LocalizedName>::const_iterator itNames = std::find_if(rCompNames.begin(), rCompNames.end(),
151 [&aSearch](
const LocalizedName& rName) {
return rName.maLocale == aSearch; });
152 if (itNames != rCompNames.end())
154 rRetExcelName = (*itNames).maName;
161 if (aSearch !=
"en-US")
163 aFallbackSearch.emplace_back(
"en-US");
166 aFallbackSearch.emplace_back(
"en");
169 for (
const auto& rSearch : aFallbackSearch)
171 for (
const auto& rCompName : rCompNames)
175 if (std::find(aFallbackLocales.begin(), aFallbackLocales.end(), rSearch) != aFallbackLocales.end())
177 rRetExcelName = rCompName.maName;
184 rRetExcelName = rCompNames[0].maName;
216 bInitialized(
false )
240 uno::Reference<container::XContentEnumerationAccess> xEnAc( xManager, uno::UNO_QUERY );
243 uno::Reference<container::XEnumeration> xEnum =
244 xEnAc->createContentEnumeration(
"com.sun.star.sheet.AddIn" );
248 while ( xEnum->hasMoreElements() )
250 uno::Any aAddInAny = xEnum->nextElement();
254 uno::Reference<uno::XInterface> xIntFac;
255 aAddInAny >>= xIntFac;
261 uno::Reference<uno::XInterface> xInterface;
262 uno::Reference<uno::XComponentContext> xCtx(
264 uno::Reference<lang::XSingleComponentFactory> xCFac( xIntFac, uno::UNO_QUERY );
267 xInterface = xCFac->createInstanceWithContext(xCtx);
272 if (!xInterface.is())
274 uno::Reference<lang::XSingleServiceFactory> xFac( xIntFac, uno::UNO_QUERY );
277 xInterface = xFac->createInstance();
283 }
catch (
const uno::Exception& ) {
284 SAL_WARN (
"sc",
"Failed to initialize create instance of sheet.AddIn" );
326 #define CFG_FUNCPROP_DISPLAYNAME 0
327 #define CFG_FUNCPROP_DESCRIPTION 1
328 #define CFG_FUNCPROP_CATEGORY 2
329 #define CFG_FUNCPROP_COUNT 3
348 const OUString sSlash(
'/');
353 for (
const OUString& aServiceName : aServiceNames )
359 uno::Sequence<OUString> aFunctionNames = rAddInConfig.
GetNodeNames( aFunctionsPath );
360 sal_Int32 nNewCount = aFunctionNames.getLength();
368 std::unique_ptr<std::unique_ptr<ScUnoAddInFuncData>[]> ppNew(
new std::unique_ptr<ScUnoAddInFuncData>[
nFuncCount]);
386 const OUString* pFuncNameArray = aFunctionNames.getConstArray();
387 for ( sal_Int32 nFuncPos = 0; nFuncPos < nNewCount; nFuncPos++ )
392 OUString aFuncName = aServiceName +
"." + pFuncNameArray[nFuncPos];
399 OUString aDescription;
404 OUString aFuncPropPath = aFunctionsPath + sSlash + pFuncNameArray[nFuncPos] + sSlash;
406 uno::Sequence<OUString> aFuncPropNames{
411 uno::Sequence<uno::Any> aFuncProperties = rAddInConfig.
GetProperties( aFuncPropNames );
417 OUString aCategoryName;
424 ::std::vector<ScUnoAddInFuncData::LocalizedName> aCompNames;
427 uno::Sequence<OUString> aCompPropNames( &aCompPath, 1 );
429 uno::Sequence<uno::Any> aCompProperties = aAllLocalesConfig.
GetProperties( aCompPropNames );
430 if ( aCompProperties.getLength() == 1 )
432 uno::Sequence<beans::PropertyValue> aLocalEntries;
433 if ( aCompProperties[0] >>= aLocalEntries )
435 for (
const beans::PropertyValue& rConfig : std::as_const(aLocalEntries) )
442 rConfig.Value >>= aName;
443 aCompNames.emplace_back( aLocale, aName);
450 std::unique_ptr<ScAddInArgDesc[]> pVisibleArgs;
455 const uno::Sequence<OUString> aArgumentNames = rAddInConfig.
GetNodeNames( aArgumentsPath );
456 sal_Int32 nArgumentCount = aArgumentNames.getLength();
457 if ( nArgumentCount )
460 uno::Sequence<OUString> aArgPropNames( nArgumentCount * 2 );
461 OUString* pPropNameArray = aArgPropNames.getArray();
464 for (
const OUString& rArgName : aArgumentNames )
466 OUString aOneArgPath = aArgumentsPath + sSlash + rArgName + sSlash;
468 pPropNameArray[nIndex++] = aOneArgPath
470 pPropNameArray[nIndex++] = aOneArgPath
474 uno::Sequence<uno::Any> aArgProperties = rAddInConfig.
GetProperties( aArgPropNames );
475 if ( aArgProperties.getLength() == aArgPropNames.getLength() )
477 const OUString* pArgNameArray = aArgumentNames.getConstArray();
478 const uno::Any* pPropArray = aArgProperties.getConstArray();
480 OUString sDescription;
486 nVisibleCount = nArgumentCount;
490 for ( sal_Int32 nArgument = 0; nArgument < nArgumentCount; nArgument++ )
492 pPropArray[nIndex++] >>= sDisplayName;
493 pPropArray[nIndex++] >>= sDescription;
496 aDesc.
aName = sDisplayName;
499 pVisibleArgs[nArgument] = aDesc;
504 OString sHelpId = aHelpIdGenerator.
GetHelpId( pFuncNameArray[nFuncPos] );
506 uno::Reference<reflection::XIdlMethod> xFunc;
512 aFuncName, aLocalName, aDescription,
538 sal_Int32
nPos = aFullName.lastIndexOf(
'.' );
542 OUString aServiceName = aFullName.copy( 0, nPos );
547 uno::Reference<uno::XInterface> xInterface( xServiceFactory->createInstance( aServiceName ) );
552 catch (
const uno::Exception &)
554 SAL_WARN (
"sc",
"Failed to create addin component '"
555 << aServiceName <<
"'");
564 return pFuncData->
GetExcelName( eDestLang, rRetExcelName);
580 const ::std::vector<ScUnoAddInFuncData::LocalizedName>& rNames = pFuncData->
GetCompNames();
581 auto bFound = std::any_of(rNames.begin(), rNames.end(),
599 return rName == rType.getTypeName();
606 if ( !xClass.is() )
return false;
608 switch (xClass->getTypeClass())
610 case uno::TypeClass_ANY:
611 case uno::TypeClass_ENUM:
612 case uno::TypeClass_BOOLEAN:
613 case uno::TypeClass_CHAR:
614 case uno::TypeClass_BYTE:
615 case uno::TypeClass_SHORT:
616 case uno::TypeClass_UNSIGNED_SHORT:
617 case uno::TypeClass_LONG:
618 case uno::TypeClass_UNSIGNED_LONG:
619 case uno::TypeClass_FLOAT:
620 case uno::TypeClass_DOUBLE:
621 case uno::TypeClass_STRING:
624 case uno::TypeClass_INTERFACE:
629 OUString
sName = xClass->getName();
640 OUString
sName = xClass->getName();
655 uno::TypeClass
eType = xClass->getTypeClass();
657 if ( eType == uno::TypeClass_LONG )
660 if ( eType == uno::TypeClass_DOUBLE )
663 if ( eType == uno::TypeClass_STRING )
667 OUString
sName = xClass->getName();
698 uno::Reference<sheet::XAddIn> xAddIn( xInterface, uno::UNO_QUERY );
699 uno::Reference<lang::XServiceName> xName( xInterface, uno::UNO_QUERY );
700 if ( !(xAddIn.is() && xName.is()) )
705 if (
SC_MOD()->GetFormulaOptions().GetUseEnglishFuncName() )
706 xAddIn->setLocale( lang::Locale(
"en",
"US",
""));
710 OUString aServiceName( xName->getServiceName() );
717 uno::Reference<beans::XIntrospection> xIntro = beans::theIntrospection::get( xContext );
720 uno::Reference<beans::XIntrospectionAccess> xAcc = xIntro->inspect(aObject);
724 uno::Sequence< uno::Reference<reflection::XIdlMethod> >
aMethods =
725 xAcc->getMethods( beans::MethodConcept::ALL );
734 std::unique_ptr<std::unique_ptr<ScUnoAddInFuncData>[]> ppNew(
new std::unique_ptr<ScUnoAddInFuncData>[
nFuncCount]);
750 const uno::Reference<reflection::XIdlMethod>* pArray = aMethods.getConstArray();
751 for (
tools::Long nFuncPos=0; nFuncPos<nNewCount; nFuncPos++)
755 uno::Reference<reflection::XIdlMethod> xFunc = pArray[nFuncPos];
759 uno::Reference<reflection::XIdlClass> xClass =
760 xFunc->getDeclaringClass();
765 OUString
sName = xClass->getName();
778 uno::Reference<reflection::XIdlClass> xReturn =
779 xFunc->getReturnType();
785 OUString aFuncU = xFunc->getName();
788 OUString aFuncName = aServiceName +
"." + aFuncU;
794 uno::Sequence<reflection::ParamInfo> aParams =
795 xFunc->getParameterInfos();
797 const reflection::ParamInfo* pParArr = aParams.getConstArray();
799 for (nParamPos=0; nParamPos<
nParamCount; nParamPos++)
801 if ( pParArr[nParamPos].aMode != reflection::ParamMode_IN )
803 uno::Reference<reflection::XIdlClass> xParClass =
804 pParArr[nParamPos].aType;
809 nCallerPos = nParamPos;
816 xAddIn->getProgrammaticCategoryName( aFuncU ) );
818 OString sHelpId = aHelpIdGenerator.GetHelpId( aFuncU );
823 aLocalName = xAddIn->
824 getDisplayFunctionName( aFuncU );
826 catch(uno::Exception&)
831 OUString aDescription;
834 aDescription = xAddIn->
835 getFunctionDescription( aFuncU );
837 catch(uno::Exception&)
839 aDescription =
"###";
842 std::unique_ptr<ScAddInArgDesc[]> pVisibleArgs;
843 if ( nVisibleCount > 0 )
848 for (nParamPos=0; nParamPos<
nParamCount; nParamPos++)
850 uno::Reference<reflection::XIdlClass> xParClass =
851 pParArr[nParamPos].aType;
859 getDisplayArgumentName( aFuncU, nParamPos );
861 catch(uno::Exception&)
869 getArgumentDescription( aFuncU, nParamPos );
871 catch(uno::Exception&)
880 aDesc.
eType = eArgType;
881 aDesc.
aName = aArgName;
887 pVisibleArgs[nDestPos++] = aDesc;
890 OSL_ENSURE( nDestPos==nVisibleCount,
"wrong count" );
894 aFuncName, aLocalName, aDescription,
897 nVisibleCount, pVisibleArgs.get(), nCallerPos ) );
938 if ( pArguments[
nPos].aInternalName == rArgIntName )
939 return &pArguments[
nPos];
945 std::u16string_view rServiceName )
947 uno::Reference<lang::XLocalizable> xLoc( xInterface, uno::UNO_QUERY );
952 if (
SC_MOD()->GetFormulaOptions().GetUseEnglishFuncName() )
953 xLoc->setLocale( lang::Locale(
"en",
"US",
""));
968 uno::Reference<beans::XIntrospection> xIntro = beans::theIntrospection::get(xContext);
970 aObject <<= xInterface;
971 uno::Reference<beans::XIntrospectionAccess> xAcc = xIntro->inspect(aObject);
975 const uno::Sequence< uno::Reference<reflection::XIdlMethod> >
aMethods =
976 xAcc->getMethods( beans::MethodConcept::ALL );
977 for (
const uno::Reference<reflection::XIdlMethod>& xFunc : aMethods)
981 OUString aFuncU = xFunc->getName();
984 OUString aFuncName = OUString::Concat(rServiceName) +
"." + aFuncU;
999 const uno::Sequence<reflection::ParamInfo> aParams =
1000 xFunc->getParameterInfos();
1002 const reflection::ParamInfo* pParArr = aParams.getConstArray();
1005 if ( pParArr[nParamPos].aMode != reflection::ParamMode_IN )
1007 uno::Reference<reflection::XIdlClass> xParClass =
1008 pParArr[nParamPos].aType;
1013 nCallerPos = nParamPos;
1019 std::unique_ptr<ScAddInArgDesc[]> pVisibleArgs;
1020 if ( nVisibleCount > 0 )
1025 for (
const auto& rParam : aParams)
1027 uno::Reference<reflection::XIdlClass> xParClass =
1046 aDesc.
eType = eArgType;
1051 pVisibleArgs[nDestPos++] = aDesc;
1054 OSL_ENSURE( nDestPos==nVisibleCount,
"wrong count" );
1058 pOldData->
SetArguments( nVisibleCount, pVisibleArgs.get() );
1061 if ( pFunctionList )
1081 ScAddInHashMap::const_iterator iLook(
pLocalHashMap->find( rUpperName ) );
1083 return iLook->second->GetOriginalName();
1090 ScAddInHashMap::const_iterator iLook(
pNameHashMap->find( rUpperName ) );
1092 return iLook->second->GetOriginalName();
1098 return iLook->second->GetOriginalName();
1111 ScAddInHashMap::const_iterator iLook(
pExactHashMap->find( rName ) );
1116 if ( bComplete && !pFuncData->
GetFunction().is() )
1142 ScAddInHashMap::const_iterator iLook(
pExactHashMap->find( rName ) );
1144 rName = iLook->second->GetUpperLocal();
1188 if (aDesc.isEmpty())
1194 rDesc.
nArgCount =
static_cast<sal_uInt16
>(nArgCount);
1197 bool bMultiple =
false;
1205 for (
tools::Long nArg=0; nArg<nArgCount; nArg++ )
1214 OUString aDefName =
"arg" + OUString::number( nArg+1 );
1234 bValidCount(
false ),
1241 OSL_ENSURE(
pFuncData,
"Function Data missing" );
1249 if ( nParamCount >= nDescCount && nDescCount > 0 &&
1252 tools::Long nVarCount = nParamCount - ( nDescCount - 1 );
1256 else if ( nParamCount <= nDescCount )
1261 if ( !pArgs[
i].bOptional )
1267 aArgs.realloc( nDescCount );
1286 if ( nPos < nCount )
1287 return pArgs[nPos].
eType;
1306 uno::Reference<uno::XInterface> xInt( pObjSh->
GetBaseModel(), uno::UNO_QUERY );
1321 if ( nVarPos <
aVarArg.getLength() )
1322 aVarArg.getArray()[nVarPos] = rValue;
1325 OSL_FAIL(
"wrong argument number");
1328 else if ( nPos <
aArgs.getLength() )
1329 aArgs.getArray()[nPos] = rValue;
1332 OSL_FAIL(
"wrong argument number");
1348 OSL_ENSURE(
aArgs.getLength() == nCount,
"wrong argument count" );
1359 if (nCallPos>nUserLen)
1361 OSL_FAIL(
"wrong CallPos");
1362 nCallPos = nUserLen;
1366 uno::Sequence<uno::Any> aRealArgs( nDestLen );
1367 uno::Any* pDest = aRealArgs.getArray();
1369 pDest = std::copy_n(std::cbegin(
aArgs), nCallPos, pDest);
1370 *pDest = aCallerAny;
1371 std::copy(std::next(std::cbegin(
aArgs), nCallPos), std::cend(
aArgs), std::next(pDest));
1383 uno::Reference<reflection::XIdlMethod> xFunction;
1391 if ( !xFunction.is() )
1399 aAny = xFunction->invoke( aObject, rCallArgs );
1401 catch(lang::IllegalArgumentException&)
1403 nErrCode = FormulaError::IllegalArgument;
1405 catch(
const reflection::InvocationTargetException& rWrapped)
1407 if ( rWrapped.TargetException.getValueType().equals(
1409 nErrCode = FormulaError::IllegalArgument;
1410 else if ( rWrapped.TargetException.getValueType().equals(
1412 nErrCode = FormulaError::NoConvergence;
1416 catch(uno::Exception&)
1421 if (
nErrCode == FormulaError::NONE)
1425 template <
typename T>
1428 if (!pRowSeq->hasElements())
1431 auto pRow = std::max_element(pRowSeq->begin(), pRowSeq->end(),
1432 [](
const uno::Sequence<T>&
a,
const uno::Sequence<T>& b) {
1433 return a.getLength() < b.getLength(); });
1434 return pRow->getLength();
1444 uno::TypeClass eClass = rNewRes.getValueTypeClass();
1445 const uno::Type& aType = rNewRes.getValueType();
1448 case uno::TypeClass_VOID:
1449 nErrCode = FormulaError::NotAvailable;
1452 case uno::TypeClass_ENUM:
1453 case uno::TypeClass_BOOLEAN:
1454 case uno::TypeClass_CHAR:
1455 case uno::TypeClass_BYTE:
1456 case uno::TypeClass_SHORT:
1457 case uno::TypeClass_UNSIGNED_SHORT:
1458 case uno::TypeClass_LONG:
1459 case uno::TypeClass_UNSIGNED_LONG:
1460 case uno::TypeClass_FLOAT:
1461 case uno::TypeClass_DOUBLE:
1463 uno::TypeClass eMyClass;
1469 case uno::TypeClass_STRING:
1476 case uno::TypeClass_INTERFACE:
1479 uno::Reference<uno::XInterface> xInterface;
1480 rNewRes >>= xInterface;
1481 if ( xInterface.is() )
1482 xVarRes.set( xInterface, uno::UNO_QUERY );
1490 if ( aType.equals(
cppu::UnoType<uno::Sequence< uno::Sequence<sal_Int32> >>::
get() ) )
1492 const uno::Sequence< uno::Sequence<sal_Int32> >* pRowSeq =
nullptr;
1495 uno::Sequence< uno::Sequence<sal_Int32> > aSequence;
1496 if ( rNewRes >>= aSequence )
1497 pRowSeq = &aSequence;
1501 sal_Int32 nRowCount = pRowSeq->getLength();
1503 if ( nMaxColCount && nRowCount )
1505 const uno::Sequence<sal_Int32>* pRowArr = pRowSeq->getConstArray();
1507 static_cast<SCSIZE>(nMaxColCount),
1508 static_cast<SCSIZE>(nRowCount), 0.0);
1509 for (sal_Int32 nRow=0; nRow<nRowCount; nRow++)
1511 sal_Int32 nColCount = pRowArr[nRow].getLength();
1512 const sal_Int32* pColArr = pRowArr[nRow].getConstArray();
1513 for (sal_Int32 nCol=0; nCol<nColCount; nCol++)
1514 xMatrix->PutDouble( pColArr[nCol],
1515 static_cast<SCSIZE>(nCol),
1516 static_cast<SCSIZE>(nRow) );
1517 for (sal_Int32 nCol=nColCount; nCol<nMaxColCount; nCol++)
1519 static_cast<SCSIZE>(nCol),
1520 static_cast<SCSIZE>(nRow) );
1525 else if ( aType.equals(
cppu::UnoType<uno::Sequence< uno::Sequence<double> >>::
get() ) )
1527 const uno::Sequence< uno::Sequence<double> >* pRowSeq =
nullptr;
1530 uno::Sequence< uno::Sequence<double> > aSequence;
1531 if ( rNewRes >>= aSequence )
1532 pRowSeq = &aSequence;
1536 sal_Int32 nRowCount = pRowSeq->getLength();
1538 if ( nMaxColCount && nRowCount )
1540 const uno::Sequence<double>* pRowArr = pRowSeq->getConstArray();
1542 static_cast<SCSIZE>(nMaxColCount),
1543 static_cast<SCSIZE>(nRowCount), 0.0);
1544 for (sal_Int32 nRow=0; nRow<nRowCount; nRow++)
1546 sal_Int32 nColCount = pRowArr[nRow].getLength();
1547 const double* pColArr = pRowArr[nRow].getConstArray();
1548 for (sal_Int32 nCol=0; nCol<nColCount; nCol++)
1549 xMatrix->PutDouble( pColArr[nCol],
1550 static_cast<SCSIZE>(nCol),
1551 static_cast<SCSIZE>(nRow) );
1552 for (sal_Int32 nCol=nColCount; nCol<nMaxColCount; nCol++)
1554 static_cast<SCSIZE>(nCol),
1555 static_cast<SCSIZE>(nRow) );
1560 else if ( aType.equals(
cppu::UnoType<uno::Sequence< uno::Sequence<OUString> >>::
get() ) )
1562 const uno::Sequence< uno::Sequence<OUString> >* pRowSeq =
nullptr;
1565 uno::Sequence< uno::Sequence<OUString> > aSequence;
1566 if ( rNewRes >>= aSequence )
1567 pRowSeq = &aSequence;
1571 sal_Int32 nRowCount = pRowSeq->getLength();
1573 if ( nMaxColCount && nRowCount )
1575 const uno::Sequence<OUString>* pRowArr = pRowSeq->getConstArray();
1577 static_cast<SCSIZE>(nMaxColCount),
1578 static_cast<SCSIZE>(nRowCount), 0.0);
1579 for (sal_Int32 nRow=0; nRow<nRowCount; nRow++)
1581 sal_Int32 nColCount = pRowArr[nRow].getLength();
1582 const OUString* pColArr = pRowArr[nRow].getConstArray();
1583 for (sal_Int32 nCol=0; nCol<nColCount; nCol++)
1587 static_cast<SCSIZE>(nCol), static_cast<SCSIZE>(nRow));
1589 for (sal_Int32 nCol=nColCount; nCol<nMaxColCount; nCol++)
1593 static_cast<SCSIZE>(nCol), static_cast<SCSIZE>(nRow));
1599 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
static css::uno::Sequence< OUString > GetNodeNames(css::uno::Reference< css::container::XHierarchicalNameAccess > const &xHierarchyAccess, const OUString &rNode, ConfigNameFormat eFormat)
constexpr OUStringLiteral CFGSTR_CATEGORY
bool bOptional
Parameter is optional.
static bool IsTypeName(std::u16string_view rName, const uno::Type &rType)
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...
std::unique_ptr< sal_Int32[]> pData
constexpr OUStringLiteral CFGSTR_ADDINFUNCTIONS
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
bool equalsAscii(std::u16string_view s1, const char *s2)
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
constexpr OUStringLiteral CFGSTR_COMPATIBILITYNAME
void SetCaller(const css::uno::Reference< css::uno::XInterface > &rInterface)
ScAddInArgumentType eType
#define CFG_FUNCPROP_DISPLAYNAME
constexpr OUStringLiteral CFGPATH_ADDINS
Generates help IDs for standard Calc AddIns.
ParameterFlags * pDefArgFlags
Flags for each parameter.
ScAddInArgumentType GetArgType(tools::Long nPos)
constexpr OUStringLiteral CFGSTR_DESCRIPTION
void SetArguments(tools::Long nNewCount, const ScAddInArgDesc *pNewDescs)
const OUString & GetUpperLocal() const
css::uno::Reference< css::uno::XInterface > xCaller
constexpr OUStringLiteral CFGSTR_DISPLAYNAME
css::uno::Sequence< css::uno::Any > GetProperties(const css::uno::Sequence< OUString > &rNames)
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
static SC_DLLPUBLIC const CharClass & getCharClass()
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
css::uno::Reference< css::frame::XModel3 > GetBaseModel() const
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
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.
void Clear()
Clears the object.
css::uno::Sequence< css::uno::Any > aArgs
OUString FindFunction(const OUString &rUpperName, bool bLocalFirst)
User entered name. rUpperName MUST already be upper case!
static const ScAddInArgDesc * lcl_FindArgDesc(const ScUnoAddInFuncData &rFuncData, std::u16string_view rArgIntName)
void SetCallerFromObjectShell(const SfxObjectShell *pSh)
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
tools::Long GetCallerPos() const
Reference< XComponentContext > getProcessComponentContext()
sal_uInt32 GetCount() const
#define CFG_FUNCPROP_CATEGORY
void SetResult(const css::uno::Any &rNewRes)
OString sHelpId
HelpId of function.
constexpr OUStringLiteral CFGSTR_PARAMETERS
#define SAL_WARN(area, stream)
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
static sal_uInt16 lcl_GetCategory(std::u16string_view rName)
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()
bool m_bDetectedRangeSegmentation false
void SetCompNames(::std::vector< LocalizedName > &&rNew)