Note: Mailing lists are normally not accessible for me and the captcha at Nabble seems to be broken (as the code does never match while it is not difficult to read) so the only way to look for support I'm seeing is to post here. I'm looking for a complete official reference how BASIC in LibreOffice works. For example what the different files are for (.xba, .xlb, .xlc, etc.), how the XML is build in these files, how event handling works, what methods/members exists for objects (like ThisComponent for every possibility) and so on. Currently I have invested many hours to find these things to get a simple job done. I have made some progress due to fragmented informations on the internet and by analyzing some macro libraries from LibreOffice but now I'm stuck. Does anybody have a link to such a documentation?
I don't know if you'll find the answers to all your questions but there are: https://wiki.documentfoundation.org/Macros and also, you can search "macro" on this page: https://wiki.documentfoundation.org/Documentation/Publications Indeed, a complete and up-to-date doc on Macro is lacking.
(In reply to Julien Nabet from comment #1) > ... > Indeed, a complete and up-to-date doc on Macro is lacking. does anybody knows this one? http://www.pitonyak.org/oo.php it was last updated on June 12, 2015. anything you need to know about macros is there. RESOLVED WORKSFORME
I had already taken a quick look at it, it can be very useful but it doesn't seem structured at all. I mean, some docs are from 2007. Even if the whole language hasn't changed, it could be quite tedious to check if it still works. Moreover, I don't know if OOo and LO kept on the same path about macros.
I started using Pytoniak tutorials in the OOo era and I still use them on LibO and I haven't found yet something not working. Andrew Pytoniak can be considered the God of OOo/LibO BASIC
(In reply to tommy27 from comment #4) > I started using Pytoniak tutorials in the OOo era and I still use them on > LibO and I haven't found yet something not working. Ok > Andrew Pytoniak can be considered the God of OOo/LibO BASIC I agree this of course! :-) Still, it could be useful to rework all his documentation to structure it, order it, remove obsolete, etc. and have a doc in LO doc website (like we have for each apps of LO) Of course, it'd be a long and tedious work but "throwing" the Andrew's website, (even if it's indeed a very good one), might be particularly bad received from professional devs/companies. (No, I'm not volunteer for the rework :-))
let's out Andrew Pytoniak to CC list so it's aware of this.
(In reply to Julien Nabet from comment #5) > Still, it could be useful to rework all his documentation to structure it, > order it, remove obsolete, etc. and have a doc in LO doc website (like we > have for each apps of LO) > Of course, it'd be a long and tedious work but "throwing" the Andrew's > website, (even if it's indeed a very good one), might be particularly bad > received from professional devs/companies. This is what I thought. Currently I'm making a look at his documentation and from what I can tell now: - At least the filesystem structure of the XML files is described but I'm not seeing something documented about the XML internals itself. - There doesn't seem to be a reference for all internal objects. - I'm a little confused if there is a "For Each" loop to automatically iterate over arrays/objects (as I have seen it somewhere on the "fragmented" informations but can't find it listed in the documentation). Hm, I'm still stuck as I can't figure out how I can reference the object which triggered the macro. First I thought there will be simply an argument passed to the routine containing the reference but this hasn't leaded to success. And on experimenting with ThisComponent I'm not finding the path to this event object (if it should be there). Time to invest another few hours to find the related informations :)
(In reply to sworddragon2 from comment #7) > - There doesn't seem to be a reference for all internal objects. What's wrong with http://api.libreoffice.org/docs/idl/ref/index.html? You can also use a tool like XrayTool to inspect object properties and methods. > - I'm a little confused if there is a "For Each" loop to automatically > iterate over arrays/objects (as I have seen it somewhere on the "fragmented" > informations but can't find it listed in the documentation). There is a lot of information on the AOO wiki that you could look at, before hunting for "fragmented" information, for example: https://wiki.openoffice.org/wiki/Documentation/BASIC_Guide https://wiki.openoffice.org/wiki/Documentation/DevGuide/Basic/OpenOffice.org_Basic In particular it says that there are "for each" loops.
With my last points I was pointing to the post of Julien Nabet which pointed to Andrew Pytoniak's documentation (as from all the posted links I have made a first look at his site). But sure, in the next hours I will also make a look at the other documentation.
> the filesystem structure of the XML files is described > but I'm not seeing something documented about the XML internals itself. Which XML files? Did you want to manually change them? Do you mean the ones used to define the code? I don't think that this is documented specifically. I know that I never documented it. > - There doesn't seem to be a reference for all internal objects. The IDL is probably the closest you will get to that. > I'm a little confused if there is a "For Each" loop to automatically > iterate over arrays/objects > (as I have seen it somewhere on the "fragmented" informations > but can't find it listed in the documentation). Unclear what you mean by this. Do you mean the objects in a document or all objects known to the Service Manager? > Hm, I'm still stuck as I can't figure out how I can reference the object > which triggered the macro. Depends. In general, no. Some "events" will pass an event object. Ignoring Base documents, ThisComponent should be set to the document from which the macro was triggered. > First I thought there will be simply an argument passed to the routine > containing the reference but this hasn't leaded to success. And on > experimenting with ThisComponent I'm not finding the path to this event > object (if it should be there). > Time to invest another few hours to find the related informations :) I don't think that you will find a specific event object to tell you how it was triggered. > it could be useful to rework all his documentation to structure it, order it, > remove obsolete, etc. and have a doc in LO doc website (like we have for each > apps of LO) I considered doing this. One advantage is that it would encourage others to work on it and also make sure that if I keel over dead the work is continued. Hopefully if I do drop dead then someone will just take it and host it on the official site (or something).
(In reply to Andrew Pitonyak from comment #10) > Which XML files? Did you want to manually change them? Do you mean the ones > used to define the code? I don't think that this is documented specifically. > I know that I never documented it. I'm talking about the .xba, .xlb and .xlc files. For example I would like to split the BASIC code from the <script:module> tag of the .xba file. I would not be wondered if were would be an attribute to link to an external file but I couldn't find anything about it. (In reply to Andrew Pitonyak from comment #10) > Unclear what you mean by this. Do you mean the objects in a document or all > objects known to the Service Manager? Currently I don't know the exact technical details of the "For Each" loop but maybe somebody else can answer this question. (In reply to Andrew Pitonyak from comment #10) > Depends. In general, no. Some "events" will pass an event object. Ignoring > Base documents, ThisComponent should be set to the document from which the > macro was triggered. (In reply to Andrew Pitonyak from comment #10) > I don't think that you will find a specific event object to tell you how it > was triggered. I feared this already after I had no success today again. I'm trying to replace the path of an image and reload it if the original image fails to load but without a reference to the image if the macro gets triggered this could get tricky. But since it is the only image in the document maybe it can be get on other ways but I'm not sure if I want a "hacky" solution then.