Joined: 02 Apr 2003
Location: Lawrence, Kansas, USA
|Posted: Wed Apr 02, 2003 9:14 am Post subject: Any way to define new classes in StarBasic?
|Is there any way to define new classes with methods in StarBasic? I don't think so, or I can't find any.
Lack of such a capability limits the sophistication of code that can be written in StarBasic.
Sure there are better programming languages, but StarBasic is in all OOo platforms and works <i>now</i>. I can build and distribute OOo documents containing live code and be assured that they work on all OOo platforms.
If StarBasic has and won't get any capability to define new classes, the next best question I would ask is: Is there some UNO object I can instantiate that I can add arbitrary state information to? Perhaps some kind of hash, where I could say...
o = createInstance( "some uno class" )
o.set( "Fred", "Blue" )
o.set( "Bill", "Purple" )
o2 = createInstance( "some uno class" )
o.set( "John", o2 )
At least this capability would at least allow building data structures, even if you had to pass your main data structure around amongst many global functions.
I have working Java code that connects by UNO. (A maze generator that creates Draw documents.) Default configurations of OOo don't accept UNO connections. This has to be turned on by hand editing an xml config file. I have other code in StarBasic that is live within the document. I cannot create more sophisticated applications in StarBasic, such as my maze generator, because of lack of sophisticated features in StarBasic.
The next direction I am going is a stand alone Java program that directly generates Draw document files on disk in correct format. Now you don't need a copy of OOo running, and it wouldn't have needed to be configured to accept remote UNO connections.