Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
4eea9f21
Kaydet (Commit)
4eea9f21
authored
Ara 17, 2015
tarafından
Eike Rathke
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
handle varargs with first required and subsequent optional, tdf#71459 related
Change-Id: I56c66f516ba2a2e12cab4848c8c352315f27b3bb
üst
db1e34ae
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
97 additions
and
24 deletions
+97
-24
FormulaHelper.cxx
formula/source/ui/dlg/FormulaHelper.cxx
+1
-0
parawin.cxx
formula/source/ui/dlg/parawin.cxx
+12
-8
IFunctionDescription.hxx
include/formula/IFunctionDescription.hxx
+1
-0
FunctionHelper.hxx
reportdesign/source/ui/inc/FunctionHelper.hxx
+1
-0
FunctionHelper.cxx
reportdesign/source/ui/misc/FunctionHelper.cxx
+18
-0
funcdesc.hxx
sc/inc/funcdesc.hxx
+9
-1
funcdesc.cxx
sc/source/core/data/funcdesc.cxx
+44
-12
scfuncs.src
sc/source/ui/src/scfuncs.src
+11
-3
No files found.
formula/source/ui/dlg/FormulaHelper.cxx
Dosyayı görüntüle @
4eea9f21
...
...
@@ -45,6 +45,7 @@ namespace formula
virtual
OUString
getSignature
()
const
override
{
return
OUString
();
}
virtual
OString
getHelpId
()
const
override
{
return
""
;
}
virtual
sal_uInt32
getParameterCount
()
const
override
{
return
0
;
}
virtual
sal_uInt32
getVarArgsStart
()
const
override
{
return
0
;
}
virtual
OUString
getParameterName
(
sal_uInt32
)
const
override
{
return
OUString
();
}
virtual
OUString
getParameterDescription
(
sal_uInt32
)
const
override
{
return
OUString
();
}
virtual
bool
isParameterOptional
(
sal_uInt32
)
const
override
{
return
false
;
}
...
...
formula/source/ui/dlg/parawin.cxx
Dosyayı görüntüle @
4eea9f21
...
...
@@ -136,8 +136,9 @@ void ParaWin::UpdateArgDesc( sal_uInt16 nArg )
aVisibleArgMapping
[
nPos
]
:
aVisibleArgMapping
.
back
());
aArgDesc
=
pFuncDesc
->
getParameterDescription
(
nRealArg
);
aArgName
=
pFuncDesc
->
getParameterName
(
nRealArg
);
if
(
nArg
>=
nFix
)
aArgName
+=
OUString
::
number
(
nArg
-
nFix
+
1
);
sal_uInt16
nVarArgsStart
=
pFuncDesc
->
getVarArgsStart
();
if
(
nArg
>=
nVarArgsStart
)
aArgName
+=
OUString
::
number
(
nArg
-
nVarArgsStart
+
1
);
aArgName
+=
" "
;
aArgName
+=
(
nArg
>
nFix
||
pFuncDesc
->
isParameterOptional
(
nRealArg
))
?
m_sOptional
:
m_sRequired
;
...
...
@@ -154,8 +155,9 @@ void ParaWin::UpdateArgDesc( sal_uInt16 nArg )
aVisibleArgMapping
[
nPos
]
:
aVisibleArgMapping
.
back
());
aArgDesc
=
pFuncDesc
->
getParameterDescription
(
nRealArg
);
aArgName
=
pFuncDesc
->
getParameterName
(
nRealArg
);
if
(
nArg
>=
nFix
)
aArgName
+=
OUString
::
number
(
(
nArg
-
nFix
)
/
2
+
1
);
sal_uInt16
nVarArgsStart
=
pFuncDesc
->
getVarArgsStart
();
if
(
nArg
>=
nVarArgsStart
)
aArgName
+=
OUString
::
number
(
(
nArg
-
nVarArgsStart
)
/
2
+
1
);
aArgName
+=
" "
;
aArgName
+=
(
nArg
>
(
nFix
+
1
)
||
pFuncDesc
->
isParameterOptional
(
nRealArg
))
?
m_sOptional
:
m_sRequired
;
...
...
@@ -188,10 +190,11 @@ void ParaWin::UpdateArgInput( sal_uInt16 nOffset, sal_uInt16 i )
SetArgNameFont
(
i
,
(
nArg
>
nFix
||
pFuncDesc
->
isParameterOptional
(
nRealArg
))
?
aFntLight
:
aFntBold
);
if
(
nArg
>=
nFix
)
sal_uInt16
nVarArgsStart
=
pFuncDesc
->
getVarArgsStart
();
if
(
nArg
>=
nVarArgsStart
)
{
OUString
aArgName
(
pFuncDesc
->
getParameterName
(
nRealArg
)
);
aArgName
+=
OUString
::
number
(
nArg
-
n
Fix
+
1
);
aArgName
+=
OUString
::
number
(
nArg
-
n
VarArgsStart
+
1
);
SetArgName
(
i
,
aArgName
);
}
else
...
...
@@ -210,10 +213,11 @@ void ParaWin::UpdateArgInput( sal_uInt16 nOffset, sal_uInt16 i )
SetArgNameFont
(
i
,
(
nArg
>
(
nFix
+
1
)
||
pFuncDesc
->
isParameterOptional
(
nRealArg
))
?
aFntLight
:
aFntBold
);
if
(
nArg
>=
nFix
)
sal_uInt16
nVarArgsStart
=
pFuncDesc
->
getVarArgsStart
();
if
(
nArg
>=
nVarArgsStart
)
{
OUString
aArgName
(
pFuncDesc
->
getParameterName
(
nRealArg
)
);
aArgName
+=
OUString
::
number
(
(
nArg
-
n
Fix
)
/
2
+
1
);
aArgName
+=
OUString
::
number
(
(
nArg
-
n
VarArgsStart
)
/
2
+
1
);
SetArgName
(
i
,
aArgName
);
}
else
...
...
include/formula/IFunctionDescription.hxx
Dosyayı görüntüle @
4eea9f21
...
...
@@ -91,6 +91,7 @@ namespace formula
// parameter
virtual
sal_uInt32
getParameterCount
()
const
=
0
;
virtual
sal_uInt32
getVarArgsStart
()
const
=
0
;
virtual
OUString
getParameterName
(
sal_uInt32
_nPos
)
const
=
0
;
virtual
OUString
getParameterDescription
(
sal_uInt32
_nPos
)
const
=
0
;
virtual
bool
isParameterOptional
(
sal_uInt32
_nPos
)
const
=
0
;
...
...
reportdesign/source/ui/inc/FunctionHelper.hxx
Dosyayı görüntüle @
4eea9f21
...
...
@@ -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
;
...
...
reportdesign/source/ui/misc/FunctionHelper.cxx
Dosyayı görüntüle @
4eea9f21
...
...
@@ -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
())
)
...
...
sc/inc/funcdesc.hxx
Dosyayı görüntüle @
4eea9f21
...
...
@@ -105,10 +105,17 @@ public:
/**
Returns number of arguments
@return
help id of the function
@return
number of arguments
*/
virtual
sal_uInt32
getParameterCount
()
const
override
;
/**
Returns start of variable arguments
@return start of variable arguments
*/
virtual
sal_uInt32
getVarArgsStart
()
const
override
;
/**
Returns description of parameter at given position
...
...
@@ -205,6 +212,7 @@ public:
sal_uInt16
nFIndex
;
/**< Unique function index */
sal_uInt16
nCategory
;
/**< Function category */
sal_uInt16
nArgCount
;
/**< All parameter count, suppressed and unsuppressed */
sal_uInt16
nVarArgsStart
;
/**< Start of variable arguments, for numbering */
OString
sHelpId
;
/**< HelpId of function */
bool
bIncomplete
:
1
;
/**< Incomplete argument info (set for add-in info from configuration) */
bool
bHasSuppressedArgs
:
1
;
/**< Whether there is any suppressed parameter. */
...
...
sc/source/core/data/funcdesc.cxx
Dosyayı görüntüle @
4eea9f21
...
...
@@ -67,6 +67,7 @@ ScFuncDesc::ScFuncDesc() :
nFIndex
(
0
),
nCategory
(
0
),
nArgCount
(
0
),
nVarArgsStart
(
0
),
bIncomplete
(
false
),
bHasSuppressedArgs
(
false
)
{}
...
...
@@ -88,6 +89,7 @@ void ScFuncDesc::Clear()
delete
[]
pDefArgFlags
;
}
nArgCount
=
0
;
nVarArgsStart
=
0
;
maDefArgNames
.
clear
();
maDefArgDescs
.
clear
();
pDefArgFlags
=
nullptr
;
...
...
@@ -140,8 +142,7 @@ OUString ScFuncDesc::GetParamList() const
}
else
if
(
nArgCount
<
PAIRED_VAR_ARGS
)
{
sal_uInt16
nFix
=
nArgCount
-
VAR_ARGS
;
for
(
sal_uInt16
nArg
=
0
;
nArg
<
nFix
;
nArg
++
)
for
(
sal_uInt16
nArg
=
0
;
nArg
<
nVarArgsStart
;
nArg
++
)
{
if
(
!
pDefArgFlags
[
nArg
].
bSuppress
)
{
...
...
@@ -154,19 +155,18 @@ OUString ScFuncDesc::GetParamList() const
* there were, we'd have to cope with it here and above for the fix
* parameters. For now parameters are always added, so no special
* treatment of a trailing "; " necessary. */
aSig
.
append
(
maDefArgNames
[
n
Fix
]);
aSig
.
append
(
maDefArgNames
[
n
VarArgsStart
]);
aSig
.
append
(
'1'
);
aSig
.
append
(
sep
);
aSig
.
append
(
' '
);
aSig
.
append
(
maDefArgNames
[
n
Fix
]);
aSig
.
append
(
maDefArgNames
[
n
VarArgsStart
]);
aSig
.
append
(
'2'
);
aSig
.
append
(
sep
);
aSig
.
append
(
" ... "
);
}
else
{
sal_uInt16
nFix
=
nArgCount
-
PAIRED_VAR_ARGS
;
for
(
sal_uInt16
nArg
=
0
;
nArg
<
nFix
;
nArg
++
)
for
(
sal_uInt16
nArg
=
0
;
nArg
<
nVarArgsStart
;
nArg
++
)
{
if
(
!
pDefArgFlags
[
nArg
].
bSuppress
)
{
...
...
@@ -176,17 +176,17 @@ OUString ScFuncDesc::GetParamList() const
}
}
aSig
.
append
(
maDefArgNames
[
n
Fix
]);
aSig
.
append
(
maDefArgNames
[
n
VarArgsStart
]);
aSig
.
append
(
'1'
);
aSig
.
append
(
sep
);
aSig
.
append
(
maDefArgNames
[
n
Fix
+
1
]);
aSig
.
append
(
maDefArgNames
[
n
VarArgsStart
+
1
]);
aSig
.
append
(
'1'
);
aSig
.
append
(
sep
);
aSig
.
append
(
" "
);
aSig
.
append
(
maDefArgNames
[
n
Fix
]);
aSig
.
append
(
maDefArgNames
[
n
VarArgsStart
]);
aSig
.
append
(
'2'
);
aSig
.
append
(
sep
);
aSig
.
append
(
maDefArgNames
[
n
Fix
+
1
]);
aSig
.
append
(
maDefArgNames
[
n
VarArgsStart
+
1
]);
aSig
.
append
(
'2'
);
aSig
.
append
(
sep
);
aSig
.
append
(
" ... "
);
...
...
@@ -359,6 +359,11 @@ sal_uInt32 ScFuncDesc::getParameterCount() const
return
nArgCount
;
}
sal_uInt32
ScFuncDesc
::
getVarArgsStart
()
const
{
return
nVarArgsStart
;
}
OUString
ScFuncDesc
::
getParameterName
(
sal_uInt32
_nPos
)
const
{
return
maDefArgNames
[
_nPos
];
...
...
@@ -799,12 +804,20 @@ ScFuncRes::ScFuncRes( ResId &aRes, ScFuncDesc* pDesc, bool & rbSuppressed )
pDesc
->
sHelpId
=
ReadByteStringRes
();
pDesc
->
nArgCount
=
GetNum
();
sal_uInt16
nArgs
=
pDesc
->
nArgCount
;
sal_uInt16
nVarArgsSet
=
0
;
if
(
nArgs
>=
PAIRED_VAR_ARGS
)
nArgs
-=
PAIRED_VAR_ARGS
-
2
;
{
nVarArgsSet
=
2
;
nArgs
-=
PAIRED_VAR_ARGS
-
nVarArgsSet
;
}
else
if
(
nArgs
>=
VAR_ARGS
)
nArgs
-=
VAR_ARGS
-
1
;
{
nVarArgsSet
=
1
;
nArgs
-=
VAR_ARGS
-
nVarArgsSet
;
}
if
(
nArgs
)
{
pDesc
->
nVarArgsStart
=
nArgs
-
nVarArgsSet
;
pDesc
->
pDefArgFlags
=
new
ScFuncDesc
::
ParameterFlags
[
nArgs
];
for
(
sal_uInt16
i
=
0
;
i
<
nArgs
;
++
i
)
{
...
...
@@ -864,6 +877,25 @@ ScFuncRes::ScFuncRes( ResId &aRes, ScFuncDesc* pDesc, bool & rbSuppressed )
{
pDesc
->
maDefArgNames
[
i
]
=
SC_RESSTR
(
2
*
(
i
+
1
)
);
pDesc
->
maDefArgDescs
[
i
]
=
SC_RESSTR
(
2
*
(
i
+
1
)
+
1
);
// If empty and variable number of arguments and last parameter and
// parameter is optional and the previous is not optional, repeat
// previous parameter name and description.
if
((
pDesc
->
maDefArgNames
[
i
].
isEmpty
()
||
pDesc
->
maDefArgDescs
[
i
].
isEmpty
())
&&
nVarArgsSet
>
0
&&
i
>
nVarArgsSet
&&
(
i
==
nArgs
-
1
||
i
==
nArgs
-
2
)
&&
pDesc
->
pDefArgFlags
[
i
].
bOptional
)
{
sal_uInt16
nPrev
=
i
-
nVarArgsSet
;
if
(
!
pDesc
->
pDefArgFlags
[
nPrev
].
bOptional
)
{
if
(
pDesc
->
maDefArgNames
[
i
].
isEmpty
())
pDesc
->
maDefArgNames
[
i
]
=
pDesc
->
maDefArgNames
[
nPrev
];
if
(
pDesc
->
maDefArgDescs
[
i
].
isEmpty
())
pDesc
->
maDefArgDescs
[
i
]
=
pDesc
->
maDefArgDescs
[
nPrev
];
// This also means that variable arguments start one
// parameter set earlier.
pDesc
->
nVarArgsStart
-=
nVarArgsSet
;
}
}
}
}
...
...
sc/source/ui/src/scfuncs.src
Dosyayı görüntüle @
4eea9f21
...
...
@@ -12392,7 +12392,7 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2
};
String 2 // Name of Parameter 1
{
Text [ en-US ] = "
number
" ;
Text [ en-US ] = "
minuend
" ;
};
String 3 // Description of Parameter 1
{
...
...
@@ -12400,11 +12400,19 @@ Resource RID_SC_FUNCTION_DESCRIPTIONS2
};
String 4 // Name of Parameter 2
{
Text [ en-US ] = "
number
" ;
Text [ en-US ] = "
subtrahend
" ;
};
String 5 // Description of Parameter 2
{
Text [ en-US ] = "Number 2, number 3, ... are arguments subtracted from first number." ;
Text [ en-US ] = "Subtrahend 1, subtrahend 2, ... are numerical arguments subtracted from the minuend." ;
};
String 6 // Name of Parameter 3, empty dummy to repeat Parameter 2, now optional
{
Text = "" ;
};
String 7 // Description of Parameter 3, empty dummy to repeat Parameter 2, now optional
{
Text = "" ;
};
};
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment