Hi Fernand,

> BTW any idea how i can get the running OO-version ?

here a Java code example - we had this on the list already:
-----%<-----
        /**
         * Getting the OpenOffice version.
         * @return String containing the version, e.g. "2.3" or "2.2.1"
         */
        public static String getOpenOfficeVersion() {
        return
getOpenOfficeProperty("org.openoffice.Setup/Product","ooSetupVersion");
    }
        
        /**
         * Getting the current used OpenOffice locale.
         * @return String containing the locale, e.g. "de" or "en"
         */
        public static String getOpenOfficeLocale() {
        return
getOpenOfficeProperty("org.openoffice.Setup/L10N","ooLocale");          
        }

        /**
         * Reading the OpenOffice Configuration Provider for different values.
         * @param nodePath Node path of the config to read.
         * @param node Node of the node path.
         * @return String with the property.
         */
    private static String getOpenOfficeProperty(String nodePath, String
node){
        if (!nodePath.startsWith("/")){
            nodePath = "/" + nodePath;
        }
        String property = "";
        // create the provider and remember it as a XMultiServiceFactory
        try {
            Object configProvider =
                        OOWorkbench.getXMCF().createInstanceWithContext(
                "com.sun.star.configuration.ConfigurationProvider",
                OOWorkbench.getXComponentContext());
                
            XMultiServiceFactory  xConfigProvider =
(XMultiServiceFactory) UnoRuntime.queryInterface(
                    com.sun.star.lang.XMultiServiceFactory.class,
configProvider);

            // The service name: Need only read access:
            final String sReadOnlyView =
"com.sun.star.configuration.ConfigurationAccess";
            // creation arguments: nodepath
            PropertyValue aPathArgument = new PropertyValue();
                    aPathArgument.Name = "nodepath";
                    aPathArgument.Value = nodePath;
            Object[] aArguments = new Object[1];
                aArguments[0] = aPathArgument;

            // create the view
            XInterface xElement = (XInterface)
xConfigProvider.createInstanceWithArguments(sReadOnlyView, aArguments);
            XNameAccess xChildAccess =
                (XNameAccess)
UnoRuntime.queryInterface(XNameAccess.class, xElement);

            // get the value
            property = (String) xChildAccess.getByName(node);
        } catch (Exception e){
            System.out.println(e);
        }
        return property;
    }
-----%<-----

Greetings, Tobias

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

Reply via email to