saleem145 wrote:Hello,
I would like to write a function which takes in four arguments. Each of the argument is a two dimensional range of cells. But they are optional. My question is what should my idl and xcu file look like. And the function prototype. I am developing a C++ add in.
Thanks,
Saleem
Optional arguments are specified as any in the idl file, and require no special consideration in the CalcAddin.xcu.
Here's the idl for one I happen to have.
Code: Select all
string cDraw( [in] sequence< sequence< any > > dims, [in] string ShapeName, [in] any FillSpecs, [in] any ShapeText, [in] ::com::sun::star::beans::XPropertySet docProps);
In the program then, FillSpecs and ShapeText are optional. In my example here, FillSpecs might typically be an array or a single value, and I check it in the code like
Code: Select all
if(FillSpecs.getValueTypeName() == OUString(RTL_CONSTASCII_USTRINGPARAM("[][]any"))) {
---- do array stuff
) else (FillSpecs.getValueTypeName() == OUString(RTL_CONSTASCII_USTRINGPARAM("double"))) {
... do single value stuff
}
One thing to note with this though is that if you pass a CellRange in this fashion, you only get the ranges dataArray , but if you specify it to be an XCellRange in the idl and the code, then you also have access to the cell formats and such, but then it can't be optional.
The ValueTypeName for an omitted optional argument is "void."