[Libreoffice] LibreOffice / OpenOffice.org sniffing in extension
Laurent Godard
oooconv at free.fr
Mon May 16 07:53:05 PDT 2011
Hi Christophe
perharps not perfect (and in fact surely ;) )
here is how i quickly solved this using macros
can be implemented in java
btw, perharps not the right mailing list
HTH
laurent
'-----
function isLibreOffice
dim aSettings, nom
aSettings = getConfigSetting("/org.openoffice.Setup/Product", false)
nom = aSettings.ooName
isLibreOffice = (nom = "LibreOffice")
end function
function getConfigSetting(target as string, forUpdate as boolean)
dim service as String ' nom du service d'acces à la configuration
dim aSettings, aConfigProvider
dim aParams(0) As new com.sun.star.beans.PropertyValue
dim varEmpty
if forUpdate then
service = "com.sun.star.configuration.ConfigurationUpdateAccess"
else
service = "com.sun.star.configuration.ConfigurationAccess"
endif
aConfigProvider = createUnoService(
"com.sun.star.configuration.ConfigurationProvider" )
aParams(0).Name = "nodepath"
aParams(0).Value = target
aSettings = aConfigProvider.createInstanceWithArguments(service,
aParams() )
getConfigSetting = aSettings
end function
More information about the LibreOffice
mailing list