[Issue] Does LO really support StarBasic?

Help with installation and general system troubleshooting questions concerning the office suite LibreOffice.
Post Reply
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

[Issue] Does LO really support StarBasic?

Post by Villeroy »

Hierarchy of libraries, VBA containers and modules in an ODF document that happened to be an Excel workbook once upon a time.
Hierarchy of libraries, VBA containers and modules in an ODF document that happened to be an Excel workbook once upon a time.
LO_VBA_Hierarchy.png (12.62 KiB) Viewed 3717 times
Playing around with LO 4.4.2.

An ODF document that used to be a MS document in a former life, has a VBA hierarchy as shown in the screen shot. There are libraries having module groups which are completely meaningless outside the MS universe. All modules reside within these groups.
The macro organizer does not provide any method to build a flat hierarchy of StarBasic libraries. Any new library shows the VBA subcontainers.
On top of each module the editor show a yellow warning "You are editing a VBA macro. Changes can only be saved in Open Document Format.

Can I stop this without rebuilding the whole document?

https://bugs.documentfoundation.org/sho ... i?id=90580
Last edited by Villeroy on Sun Apr 12, 2015 9:43 pm, edited 1 time in total.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
B Marcelly
Volunteer
Posts: 1160
Joined: Mon Oct 08, 2007 1:26 am
Location: France, Paris area

Re: Does LO really support StarBasic?

Post by B Marcelly »

(Analysis done with LibreOffice 4.3.5 and Apache OpenOffice 4.1.1)

This Basic structure appears if the initial xls document was loaded by LibreOffice with VBA macros loading enabled.
The Basic organizer displays a level between the Library level and the Module level, e.g. level "Modules" and "Class Modules". These levels have predefined and localized names. Of course this is incompatible with OpenOffice Basic scripting structure.

With the Basic organizer we can delete the library of the VBA project (in your image : LibFilter). But the levels under Standard cannot be deleted by LibreOffice.

The levels under Standard are displayed if these items are present in the sub-document settings.xml:

Code: Select all

<config:config-item-map-named config:name="ScriptConfiguration"><config:config-item-map-entry config:name="*doc*"><config:config-item config:name="CodeName" config:type="string">ThisWorkbook</config:config-item></config:config-item-map-entry><config:config-item-map-entry config:name="devis"><config:config-item config:name="CodeName" config:type="string">Feuil1</config:config-item></config:config-item-map-entry><config:config-item-map-entry config:name="liste devis"><config:config-item config:name="CodeName" config:type="string">Feuil2</config:config-item></config:config-item-map-entry></config:config-item-map-named>
In fact the intermediary levels have no reality in the Basic script: they only appear in the Basic organizer of LibreOffice when the above xml items are present.

Now let us use Apache OpenOffice to load the xls document with VBA macros loading enabled, and save it as ods.
The Apache OpenOffice Basic organizer shows ordinary modules under library Standard; these modules can be deleted with the organizer. There is no other library. But even with all modules deleted, the sub-document settings.xml still contains the above items.
If we then load with LibreOffice the Apache OpenOffice ods document, we see again the intermediary levels in the Standard library.

Conclusion: both Apache OpenOffice and LibreOffice lack a means to really delete indications of VBA. This has no consequence in Apache OpenOffice, but it complexifies the usage of LibreOffice.
Bernard

OpenOffice.org 1.1.5 / Apache OpenOffice 4.1.1 / LibreOffice 5.0.5
MS-Windows 7 Home SP1
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Does LO really support StarBasic?

Post by Villeroy »

Thank you for the analysis and confirmation. Furthermore, it is not possible to get rid of the macro warning when using LO exclusively because you can not remove any object related modules.
In order to to get a clean document without warnings nor irritating extra objects, one needs to copy the document content into a new document. Any usable StarBasic code needs to be copied over into the same hierarchy of libs and modules using the same names.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Does LO really support StarBasic?

Post by Villeroy »

The macro in this document download/file.php?id=23880 from another topic does not work[*] as "VBA macro" with LO 4.4. It works with StarBasic macros in a recreated document.

[*] The filter hides all list records. After refreshing the list, the filtered result is OK. Adding oDBR.refresh() to the macro doesn't change anything.

Bug report: https://bugs.documentfoundation.org/sho ... i?id=90580
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Post Reply