Bug 70949 - Please provide utility functions to get the current product (Office Suite) name, version, etc.
Summary: Please provide utility functions to get the current product (Office Suite) na...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
4.2.0.0.alpha0+ Master
Hardware: All All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 70947
  Show dependency treegraph
 
Reported: 2013-10-28 09:11 UTC by Lionel Elie Mamane
Modified: 2017-07-04 10:27 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lionel Elie Mamane 2013-10-28 09:11:10 UTC
Although it is possible from Basic script to get the version of LibrOffice it is running under, the way to do so is rather baroque and (worse!) undocumented. It should just be a call to a utility function, like e.g.

 getOfficeVersion
 getOfficeProductName
 ...

For reference, that's how one can do it now:

Sub Main
    Dim cfgProv As Object
    Set cfgProv = CreateUnoService("com.sun.star.configuration.ConfigurationProvider")
    Dim arg1 as new "com.sun.star.beans.PropertyValue"
    Dim args(1) as new "com.sun.star.beans.PropertyValue"
    arg1.Name = "nodepath"
    arg1.Value="/org.openoffice.Setup/Product"
    args(0) = arg1
    Dim cfgAccess As Object
    Set cfgAccess = cfgProv.createInstanceWithArguments("com.sun.star.configuration.ConfigurationAccess", args)
    MsgBox cfgAccess.ooName & " version " & cfgAccess.ooSetupVersion & ", provided by """ & cfgAccess.ooVendor & """"
End Sub

This provides a string; it would be better if the version were provided as a (set of) _number_s.
Comment 1 pierre-yves samyn 2013-10-31 07:28:25 UTC
Hello

I completely agree with this request.

Only slight attenuation: the current procedure for obtaining this information is a *little* documented (see GetRegistryKeyContent and GetProductname examples in the Misc module of Tools library).

I also agree with the "type" request for ooSetupxxx properties(Extension, Version, ooSetupVersionAboutBox...).

Could we not add to request a getBuildID utility function equivalent to:

sub GetBuildID
dim sID as string
   FA = createunoservice("com.sun.star.sheet.FunctionAccess")
     sID = FA.callFunction("INFO", array("Release")
     msgbox "Build ID: " & sID
end sub

Regards
Pierre-Yves
Comment 2 LibreOfficiant 2017-02-21 17:27:02 UTC
Hi,

While I also greatly support the above requests, I would to comment it further:

With regards to LibreOffice Basic coding consistency, I may object that Basic may end up with dozens of getThis() & getThat() functions all over the place. They may possibly collide with hundreds of existing Basic code modules already produced.

In order to limit the number of Basic language reserved statement to a reasonable amount, may I recommend we are provided with a class/service, named 'myLibreOffice' per se or anything else, that holds the requested attributes & that can be extended at will to any new properties/methods/.. of of future taste.

Furthermore, a built-in class/service paradigm would be distributable to Python, JavaScript & BeanShell all together.

Regards
Alain
Comment 3 Gerhard Weydt 2017-07-04 10:27:21 UTC
As Pierre-Yves remarked, LibreOffice Macros -> Tools -> Misc -> GetProductname provides the information called for, both the product name and the version. Starting from this you can write your own routine providing the information fitting to your taste in less than five minutes.
So why should someone bother to do this for you?