diff options
author | Eike Rathke <erack@redhat.com> | 2015-12-17 15:12:06 +0100 |
---|---|---|
committer | Eike Rathke <erack@redhat.com> | 2015-12-17 15:14:43 +0100 |
commit | 4eea9f214682008052424479a4b1f8cf90a79132 (patch) | |
tree | dc22d6d9e765da9072cb60ed01f8a9b9ec4b8064 /reportdesign/source/ui | |
parent | db1e34aecd4290623a74b9bbeb602e072b1a49ec (diff) |
handle varargs with first required and subsequent optional, tdf#71459 related
Change-Id: I56c66f516ba2a2e12cab4848c8c352315f27b3bb
Diffstat (limited to 'reportdesign/source/ui')
-rw-r--r-- | reportdesign/source/ui/inc/FunctionHelper.hxx | 1 | ||||
-rw-r--r-- | reportdesign/source/ui/misc/FunctionHelper.cxx | 18 |
2 files changed, 19 insertions, 0 deletions
diff --git a/reportdesign/source/ui/inc/FunctionHelper.hxx b/reportdesign/source/ui/inc/FunctionHelper.hxx index 73142dd8f48f..2302d757779b 100644 --- a/reportdesign/source/ui/inc/FunctionHelper.hxx +++ b/reportdesign/source/ui/inc/FunctionHelper.hxx @@ -72,6 +72,7 @@ public: virtual OUString getSignature() const override ; virtual OString getHelpId() const override ; virtual sal_uInt32 getParameterCount() const override ; + virtual sal_uInt32 getVarArgsStart() const override; virtual OUString getParameterName(sal_uInt32 _nPos) const override ; virtual OUString getParameterDescription(sal_uInt32 _nPos) const override ; virtual bool isParameterOptional(sal_uInt32 _nPos) const override ; diff --git a/reportdesign/source/ui/misc/FunctionHelper.cxx b/reportdesign/source/ui/misc/FunctionHelper.cxx index d14ee0aa43ba..a92fc499928c 100644 --- a/reportdesign/source/ui/misc/FunctionHelper.cxx +++ b/reportdesign/source/ui/misc/FunctionHelper.cxx @@ -198,6 +198,24 @@ sal_uInt32 FunctionDescription::getParameterCount() const return m_aParameter.getLength(); } +sal_uInt32 FunctionDescription::getVarArgsStart() const +{ + /* XXX there are no variable number of arguments, are there? Nevertheless + * consider the varargs handling of the Function Wizard and return a value + * within the bounds of parameters. */ + // Don't use defines/constants that could change in future, parameter count + // could be part of an implicit stable API. + // offapi/com/sun/star/report/meta/XFunctionDescription.idl doesn't tell. + const sal_uInt32 nVarArgs = 30; // ugly hard coded VAR_ARGS of formula::ParaWin + const sal_uInt32 nPairedVarArgs = 60; // ugly hard coded PAIRED_VAR_ARGS of formula::ParaWin + sal_uInt32 nLen = m_aParameter.getLength(); + if (nLen >= nPairedVarArgs) + nLen -= nPairedVarArgs; + else if (nLen >= nVarArgs) + nLen -= nVarArgs; + return nLen ? nLen - 1 : 0; +} + OUString FunctionDescription::getParameterName(sal_uInt32 _nPos) const { if ( _nPos < static_cast<sal_uInt32>(m_aParameter.getLength()) ) |