OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Calc Function in a Macro as an Extension

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
milek_pl
General User
General User


Joined: 02 Jul 2006
Posts: 13

PostPosted: Tue Oct 02, 2007 9:59 am    Post subject: Calc Function in a Macro as an Extension Reply with quote

Hi,

I'm trying to export a useful function (that spells the amount in words, in Polish) as a macro. However, I found out that Calc cannot find the function if it's not in the Standard Library, and this library, is, of course, not available for export.

What should I do to make this function available for Calc from other macro Library that I could export later as an extension?

Thanks in advance,
Marcin
Back to top
View user's profile Send private message
Danad
OOo Advocate
OOo Advocate


Joined: 22 Feb 2004
Posts: 293
Location: Brasil

PostPosted: Tue Oct 02, 2007 12:14 pm    Post subject: Reply with quote

Hi,

You've two options:
1 - Install your macro (Basic) as a module of the Standard library. You'll find some code that automate this in: http://www.ooomacros.org

2- Write your function as an Add-in, but you can't use Basic. Here, in the Code Snippets topic, you'll find one Java add-in and The Developer's Guide cover this too.

HTH
Back to top
View user's profile Send private message
milek_pl
General User
General User


Joined: 02 Jul 2006
Posts: 13

PostPosted: Thu Oct 04, 2007 11:22 am    Post subject: Reply with quote

Thanks a lot. I only wanted to repackage an existing Calc add-on in Basic to the extension format, but as this seems not feasible, I won't dwelve into that.

I could translate this into Java some day, anyway.

Thanks for the info,
Marcin
Back to top
View user's profile Send private message
ms777
Super User
Super User


Joined: 07 Feb 2004
Posts: 1355

PostPosted: Thu Oct 04, 2007 11:52 am    Post subject: Reply with quote

Hi,

have a look at http://wiki.services.openoffice.org/wiki/Extensions_Packager . I never tried, but it seems that you can also put Basic libraries into an extension

ms777
Back to top
View user's profile Send private message
milek_pl
General User
General User


Joined: 02 Jul 2006
Posts: 13

PostPosted: Sat Oct 06, 2007 1:03 pm    Post subject: Reply with quote

Hi,

you can, but you cannot put the Standard library into it. The problem is that Calc doesn't see Basic functions outside of the Standard library...

oh well...

best,
Marcin
Back to top
View user's profile Send private message
Villeroy
Super User
Super User


Joined: 04 Oct 2004
Posts: 10065
Location: Germany

PostPosted: Sat Oct 06, 2007 1:19 pm    Post subject: Reply with quote

You can not write a Basic add-in (collection of Calc functions) since you can not write classes implementing special interfaces. This is required for integration in the function wizzard (localized names, descriptions, argument descriptions).
It should be possible to write an add-on (collection of anything) which installs some module in MyMacros, lib "Standard".
For simplicity I would copy the Basic functions to lib "Standard" of the document/template where they are needed.
Back to top
View user's profile Send private message
milek_pl
General User
General User


Joined: 02 Jul 2006
Posts: 13

PostPosted: Sat Oct 06, 2007 1:38 pm    Post subject: Reply with quote

Great, but an the add-on be put into an extension installable in oxt file? Any examples of that?
Back to top
View user's profile Send private message
Villeroy
Super User
Super User


Joined: 04 Oct 2004
Posts: 10065
Location: Germany

PostPosted: Sat Oct 06, 2007 2:01 pm    Post subject: Reply with quote

I just had a look at Tools>Macros>Organize>Basic... [Organize...], Tab "Libraries", [Export...].
This allows you to export an entire Basic library as extension.oxt, BUT library "Standard" seems to be excluded. The export button is disabled when you pick "Standard". This indicates that you can package entire libraries except for "Standard", which is not allowed to be overwritten. But I did not read the specs.
Back to top
View user's profile Send private message
milek_pl
General User
General User


Joined: 02 Jul 2006
Posts: 13

PostPosted: Sat Oct 06, 2007 2:15 pm    Post subject: Reply with quote

Well, the specs are a pain to read. Anyway, I also found this out in the GUI... There are good reasons not to allow overwriting the Standard library, so this should be in the specs.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group