Hi Jan,
I have a plugin with an C++ addin code of the following form
************************
....
static Reference< XInterface >
SAL_CALL create_CalcAddins_impl(Reference<XComponentContext> const & xContext)
SAL_THROW( () ) {
return static_cast< ::cppu::OWeakObject * > ( new CalcAddins_impl );
}
static struct ::cppu::ImplementationEntry s_component_entries[] = {
{ create_CalcAddins_impl, getImplementationName_CalcAddins_impl,
getSupportedServiceNames_CalcAddins_impl,
::cppu::createSingleComponentFactory, 0, 0 },
{ 0, 0, 0, 0, 0, 0 }
};
extern "C" {
SAL_DLLPUBLIC_EXPORT void SAL_CALL component_getImplementationEnvironment(
sal_Char const ** ppEnvTypeName,
uno_Environment ** ppEnv) {
*ppEnvTypeName = CPPU_CURRENT_LANGUAGE_BINDING_NAME;
}
SAL_DLLPUBLIC_EXPORT sal_Bool SAL_CALL component_writeInfo(lang::XMultiServiceFactory *
xMgr,
registry::XRegistryKey * xRegistry) {
return ::cppu::component_writeInfoHelper( xMgr, xRegistry,
s_component_entries );
}
SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( sal_Char const * implName,
lang::XMultiServiceFactory * xMgr, registry::XRegistryKey * xRegistry) {
return ::cppu::component_getFactoryHelper(implName, xMgr, xRegistry,
s_component_entries );
}
}
************************
The following function is an example:
************************
...
SEQSEQ(ANY) SAL_CALL CalcAddins_impl::qlInterpolationInterpolate(
const STRING &ObjectId,
const SEQSEQ(ANY) &XValues,
const ANY &AllowExtrapolation,
const ANY &Trigger) throw(RuntimeException) {
try {
....
SEQSEQ(ANY) returnValue;
QuantLibAddin::qlInterpolationInterpolateBind bindObject =
boost::bind((QuantLibAddin::qlInterpolationInterpolateSignature)
&QuantLibAddin::Interpolation::operator(), ObjectIdObjPtr,
_1,
AllowExtrapolationCpp);
{
returnValue.realloc(XValuesLib.size());
for (unsigned int i=0; i<XValuesLib.size(); ++i) {
SEQ(ANY) s(1);
scalarToCalc(s[0], bindObject( XValuesLib[i] ) );
returnValue[i] = s;
}
}
return returnValue;
} catch (const std::exception &e) {
OH_LOG_MESSAGE("ERROR: qlInterpolationInterpolate: " << e.what());
THROW_RTE;
}
}
************************
The code for this function works fine if I use Cntr-F2 to define the
function as a Matrix function the first time - but only the first time.
The first time the function name appears in capital letters and the return
values are valid.
Whenever I try to change the Matrix result array in Calc (e.g. change return
values from A1:A4 to A1:A5) an error occurs - the name of the addin function
changes from capital to small letters (indication that the addin function is
not known) and #value errors appear. If I delete the Matrix result and use
Cntr-F2 to define a new Matrix function for A1:A5 everything works fine again
(but only for the first time).
This error occurs not only for this addin function but also for others with
vector return types. It seems to be not possible to change an Matrix result
after an initial definition using the defined C++ addins.
Are there other C++ functions that need to be included in the defintion of the
addin? Something seems to be missing ...
Regards,
Lars
-------- Original-Nachricht --------
Datum: Mon, 10 Sep 2012 09:45:01 +0200
Von: Jan Holesovsky <kendy@suse.cz>
An: Lars Callenbach <lars.callenbach@gmx.de>
CC: libreoffice@lists.freedesktop.org
Betreff: Re: Adjusting an Array Range in Calc
Hi Lars,
Lars Callenbach píše v Ne 02. 09. 2012 v 11:15 +0200:
I have a working plugin for Quantlib. Scalar results of the library
(single numbers) are working fine.
If I have a Matrix result (array range formula) than it is not possible
to change the size of the array.
What happens if I try to change the array range: the name of the formula
changes from upper-case to lower-case (this is simply an indication that
the function is not known) and an error message appears (error 508).
Help appreciated.
I am sorry, but it seems that the information you've provided is too
terse :-( Can you please write more? Ideally small snippets of code
you have now, and exactly what are you trying to achieve with it?
Thank you,
Kendy
Context
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.