Page 1 of 1

Branch name and version with all digits

Posted: Thu Jun 08, 2023 1:54 pm
by Lupp
This is old stuff, and the code is next to completely taken from Andrew Pitonyaks famous "Useful Macro Information". Already there the credits went to Laurent Godard.

However that text didn't even mention the branching between OO.o/AOO and LibreOffice, and users needing to make distinctions concerning the branches and the versions still ask for a solution. Sometimes they develop rather specialized code then themselves.

Therefore I now post an updated version of the mentioned old solution.
As mostly in such cases I ask you, to also download the example if you consider to actually use the code. This helps me gauge the usefulness of my contributions.

Code: Select all

Function ooSetupAllDigitVersion(Optional pNumbersOnly As Boolean) As String
If IsMissing(pNumbersOnly) Then pNumbersOnly = False
REM Functionally the code below is is completely from Laurent Godard as published in "Useful Macro Information" by Andrew Pitonyak. It's only adapted to my personal style and to the current situation.
Dim structNode, providerSrv
Dim arguments(0) As New com.sun.star.beans.PropertyValue
Const providerSrvN = "com.sun.star.configuration.ConfigurationProvider"
Const structNodeN  = "com.sun.star.configuration.ConfigurationAccess"
providerSrv        = createUnoService(providerSrvN)
arguments(0).Name  = "nodepath"
arguments(0).Value = "/org.openoffice.Setup/Product"
structNode         = providerSrv.createInstanceWithArguments(structNodeN, arguments())
Dim out As String
out                = structNode.ooSetupVersionAboutBox
If NOT pNumbersOnly Then
 out                = structNode.ooName & " V" & out
EndIf
ooSetupAllDigitVersion = out
End Function
ooSetupAllDigitsVersionSnippet.ods
(14.41 KiB) Downloaded 242 times