[Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register]

Author Message
Ninds
General User

Joined: 21 Oct 2006
Posts: 49

 Posted: Sat Dec 23, 2006 8:42 am    Post subject: Passing arrays from OOBasic to C++ Uno Components ..How can I pass an array from an OOBasic macro to an UNO component I have written in C++ ? Cheers
Ninds
General User

Joined: 21 Oct 2006
Posts: 49

 Posted: Sat Dec 23, 2006 8:55 am    Post subject: ..... ok so they are just UNO Sequences ..
SergeM
Super User

Joined: 09 Sep 2003
Posts: 3211
Location: Troyes France

 Posted: Sat Dec 23, 2006 9:16 am    Post subject: See : Complete AddIn http://wiki.services.openoffice.org/wiki/CompleteAddIn_________________Linux & Windows OOo3.0 UNO & C++ : WIKI http://wiki.services.openoffice.org/wiki/Using_Cpp_with_the_OOo_SDK In French http://wiki.services.openoffice.org/wiki/Documentation/FR/Cpp_Guide
Ninds
General User

Joined: 21 Oct 2006
Posts: 49

 Posted: Sat Dec 23, 2006 9:27 am    Post subject: The problem I am having is returning a Sequence > back to Basic fom C++ Sequence I have no problem with I have looked at Transforming an Array into Sequence of Sequence in that link .. but it doesn't seem to work for me
Ninds
General User

Joined: 21 Oct 2006
Posts: 49

Posted: Sat Dec 23, 2006 12:48 pm    Post subject:

YES !!!! Figured it out.
I wanted to pass back 2D double arrays FROM C++ to Basic (the other way was not a problem)

I first tried this code
 Code: Sequence > foo() {                           Sequence > theMatrix(2);                           theMatrix[0].realloc(2);                           theMatrix[1].realloc(2);                           theMatrix[0][0] = 0;                           theMatrix[0][1] = 1;                           theMatrix[1][0] = 2;                           theMatrix[1][1] = 3;                           return theMatrix; }

I just could not use the returned object in BASIC like a 2D array.

But with the following code I could .

 Code: Sequence foo() {                           Sequence theMatrix(2);                           Sequence row0(2);                           Sequence row1(2);                           row0[0] = 0;                           row0[1] = 1;                           row1[0] = 2;                           row1[1] = 3;                           theMatrix[0]=row1;                           theMatrix[1]=row2                           return theMatrix; }

Its not ideal by any means, but its works, the returned object behaves like a 2D array.

[/code]
SergeM
Super User

Joined: 09 Sep 2003
Posts: 3211
Location: Troyes France

 Posted: Mon Dec 25, 2006 6:58 am    Post subject: See also : Interfacing GSL with an add-in (C++) http://www.oooforum.org/forum/viewtopic.phtml?t=31232_________________Linux & Windows OOo3.0 UNO & C++ : WIKI http://wiki.services.openoffice.org/wiki/Using_Cpp_with_the_OOo_SDK In French http://wiki.services.openoffice.org/wiki/Documentation/FR/Cpp_Guide
Ninds
General User

Joined: 21 Oct 2006
Posts: 49

 Posted: Tue Dec 26, 2006 1:59 am    Post subject: I had already looked at the references you give, however they do not address my problem I am comfortable using Sequences and Sequences of Sequences for 2D arrays, but I cannot pass back a 2D array TO OOBAsic from a UNO component.
Ninds
General User

Joined: 21 Oct 2006
Posts: 49

 Posted: Tue Dec 26, 2006 3:23 am    Post subject: Does anyone know 1) what SbxArray is ? 2.) is it is the OOBasic Array how do use it in code ?
SergeM
Super User

Joined: 09 Sep 2003
Posts: 3211
Location: Troyes France

Posted: Tue Dec 26, 2006 6:38 am    Post subject:

 Quote: I had already looked at the references you give, however they do not address my problem

Yes, of course I never go further with using a add-in function with OOoBasic. Perhaps later ...
_________________
Linux & Windows OOo3.0
UNO & C++ : WIKI
http://wiki.services.openoffice.org/wiki/Using_Cpp_with_the_OOo_SDK
In French
http://wiki.services.openoffice.org/wiki/Documentation/FR/Cpp_Guide
Ninds
General User

Joined: 21 Oct 2006
Posts: 49

Posted: Tue Dec 26, 2006 7:13 am    Post subject:

sure ..... but what if you have an addin function that is also callable from Basic, and it returns a 2-dimensional array of double .. how do u do that .

For example

 Code: Sequence > Identity(sal_uInt size) {              Sequence > theIdentity(size);                            for (unsigned long i(0);i

I think its important to be able to call addin functions from Basic. I can do this in Excel, it allows the user of the addin to wrap the functions as she needs to , if she needs to .
SergeM
Super User

Joined: 09 Sep 2003
Posts: 3211
Location: Troyes France

Posted: Tue Dec 26, 2006 10:19 am    Post subject:

 Quote: I think its important to be able to call addin functions from Basic

I think too but I have not worked around addin for a long time. With a recent thread cannot createUnoService in OOBasic of Calc Addin http://www.oooforum.org/forum/viewtopic.phtml?t=50721 I fear it is not so easy as we can think at first. (I have no answer and no time to investigate)
_________________
Linux & Windows OOo3.0
UNO & C++ : WIKI
http://wiki.services.openoffice.org/wiki/Using_Cpp_with_the_OOo_SDK
In French
http://wiki.services.openoffice.org/wiki/Documentation/FR/Cpp_Guide
Ninds
General User

Joined: 21 Oct 2006
Posts: 49

SergeM
Super User

Joined: 09 Sep 2003
Posts: 3211
Location: Troyes France

Posted: Thu Dec 28, 2006 4:29 am    Post subject:

 Quote: I think I am going to HAVE TO give up on OOCalc soon, I just don't have the time to spend on developement that is not the core of my project.

If you have working code you can post it in "code snippets forum". Don't forget also that wiki can be edited by everybody (if registered). You can add an example and add also your name in the contributor page... It's for such evolution I take a long time to put my documentation in wiki.
_________________
Linux & Windows OOo3.0
UNO & C++ : WIKI
http://wiki.services.openoffice.org/wiki/Using_Cpp_with_the_OOo_SDK
In French
http://wiki.services.openoffice.org/wiki/Documentation/FR/Cpp_Guide
Ninds
General User

Joined: 21 Oct 2006
Posts: 49

Posted: Fri Dec 29, 2006 4:20 pm    Post subject:

 Code: Description Allows an UNO sequence that is passed between different language boundries to indicate it prefers to be represented as a multidimensional array with 0 or 1 based indices. UNO does not natively represent Multi-Dimensional arrays, instead a sequence can have elements that are themselves sequences (an array of arrays ). Some languages ( example BASIC ) can natively represent both Multi-Dimentional arrays and array of arrays. Those languages could represent a sequence of sequences as either a Multi-Dimentional array or array of arrays. This structure allows a preference for a Multi-Dimensional array representation to be specified.
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First
 All times are GMT - 8 Hours Page 1 of 1

 Jump to: Select a forum OpenOffice.org Forums----------------Setup and TroubleshootingOpenOffice.org WriterOpenOffice.org CalcOpenOffice.org ImpressOpenOffice.org DrawOpenOffice.org MathOpenOffice.org BaseOpenOffice.org Macros and APIOpenOffice.org Code Snippets Community Forums----------------General DiscussionSite Feedback
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum