Just found a Basic library:

REM  *****  BASIC  *****
Option Explicit
Sub test_CurrentLocaleItem
Dim sVal$, srv, loc, oLI
GlobalScope.BasicLibraries.loadLibrary("myTools")
        sVal = getOOoSetupValue("/org.openoffice.Setup/L10N","ooLocale")
        srv = createUnoService("com.sun.star.i18n.LocaleData")
        loc = getLocaleFromString(sVal)
        oLI = srv.getLocaleItem(loc)
        print oLI.decimalSeparator, oLI.thousandSeparator
end sub
'##########################
function getLocaleFromString(s$)
dim a(),l as new com.sun.star.lang.Locale
        a() = split(s,"-")
        l.Language = a(0)
        l.Country = a(1)
        if uBound(a())>1 then l.Variant = a(2)
        getLocaleFromString = l
end Function

'############## Library myTools ##############
Function getOOoSetupNode(sNodePath$)
Dim aConfigProvider, oNode, args(0) As new com.sun.star.beans.PropertyValue
        aConfigProvider =
createUnoService("com.sun.star.configuration.ConfigurationProvider")
        args(0).Name = "nodepath"
        args(0).Value = sNodePath
        getOOoSetupNode =
aConfigProvider.createInstanceWithArguments("com.sun.star.configuration.ConfigurationAccess",
args())
End Function
'##########################
Function getOOoSetupValue(sNodePath$,sProperty$)
DIm oNode
        oNode = getOOoSetupNode(sNodePath)
        getOOoSetupValue = oNode.getbyname(sProperty)
End Function
'##########################
Function setOOoSetupValue(sNodePath$, sProperty$, sValue$) as boolean
on error goto exitErr
Dim bReturn as Boolean, xconfig, xAccess
dim aArgs(0) as  Object
dim aPropValue as new  com.sun.star.beans.PropertyValue
        xconfig =
createunoservice("com.sun.star.configuration.ConfigurationProvider")
        aPropValue.Name = "nodepath"
        aPropValue.Value = sNodePath
        aArgs(0) = aPropValue
        xAccess =
xconfig.createinstanceWithArguments("com.sun.star.configuration.ConfigurationUpdateAccess",aArgs())
        xAccess.setPropertyValue(sProperty, sValue)
        xAccess.commitchanges
        bReturn = True
exitErr:
        setOOoSetupValue = bReturn
End Function


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to