Package com.sun.star.lang

Examples of com.sun.star.lang.XSingleServiceFactory


      for(int j = 0; j < keys.length; ++ j) {
        String implName = keys[j].substring(1);
        implName = implName.substring(0, implName.length() - "/UNO/SERVICES".length());

        Object factory = loader.activate(implName, null, componentName, xRegistryKey);
        XSingleServiceFactory xSingleServiceFactory = (XSingleServiceFactory)UnoRuntime.queryInterface(XSingleServiceFactory.class,
                                                         factory);
         
        if (xSingleServiceFactory == null)
          throw new com.sun.star.loader.CannotActivateFactoryException("Can not get factory for " +  implName);
         
View Full Code Here


        XSet xSet = (XSet) UnoRuntime.queryInterface(XSet.class, compContext._xMultiServiceFactory);

      for(int i = 0; i < comps.size(); ++ i) {
        Object object = new CompContext((String)comps.elementAt(i)).getObject();

        XSingleServiceFactory xSingleServiceFactory = (XSingleServiceFactory)UnoRuntime.queryInterface(XSingleServiceFactory.class,
                                                         object);
        if(xSingleServiceFactory == null) {
          XMultiServiceFactory xMultiServiceFactory = (XMultiServiceFactory)UnoRuntime.queryInterface(XMultiServiceFactory.class,
                                                           object);
View Full Code Here

     */
    public static XSingleServiceFactory __getServiceFactory(String implName,
    XMultiServiceFactory multiFactory,
    XRegistryKey regKey) {
  xMSF= multiFactory;
        XSingleServiceFactory xSingleServiceFactory = null;
        if (implName.equals(_XMergeBridge.class.getName()) ) {
            xSingleServiceFactory = FactoryHelper.getServiceFactory(_XMergeBridge.class,
            _XMergeBridge.__serviceName,
            multiFactory,               
            regKey);
View Full Code Here

     * @param name The name of the value.
     * @param value The value itself.
     */
    private void insertOrUpdate(XNameContainer xCont, String name, XInterface value) {
        boolean update = false;
        XSingleServiceFactory xFac = (XSingleServiceFactory) UnoRuntime.queryInterface(
                                                XSingleServiceFactory.class,
                                                value);
       
        try {
            xCont.insertByName(name, xFac.createInstance());
        }
        catch(com.sun.star.lang.IllegalArgumentException e) {
            log.println("ERROR: " + e.toString());
            // ignore: bug will be found with the interface test
        }
        catch(com.sun.star.lang.WrappedTargetException e) {
            log.println("ERROR: " + e.toString());
            // ignore: bug will be found with the interface test
        }
        catch(com.sun.star.container.ElementExistException e) {
            update = true;
        }
        catch(com.sun.star.uno.Exception e) {
            log.println("could not create Instance: " + e.toString());
        }
        
        try {
            if (update)
                xCont.replaceByName(name, xFac.createInstance());
        }
        catch(com.sun.star.lang.IllegalArgumentException e) {
            // ignore: bug will be found with the interface test
        }
        catch(com.sun.star.container.NoSuchElementException e) {
View Full Code Here

                                                            "com.sun.star.configuration.ConfigurationUpdateAccess",
                                                            nodeArgs));

            oObj = (XInterface) xHierachNameAccess.getByHierarchicalName("Labels['Avery A4']");

            XSingleServiceFactory jobsFac = (XSingleServiceFactory) UnoRuntime.queryInterface(
                                                    XSingleServiceFactory.class,
                                                    oObj);
            instance = jobsFac.createInstance();
            instance1 = jobsFac.createInstance();
            instance2 = jobsFac.createInstance();
        } catch (com.sun.star.uno.Exception e) {
            e.printStackTrace();
        }

        log.println("ImplementationName: " + utils.getImplName(oObj));
View Full Code Here

                                                    pMSF.createInstanceWithArguments(
                                                            "com.sun.star.configuration.ConfigurationUpdateAccess",
                                                            nodeArgs));
            oObj = (XInterface) names.getByHierarchicalName("Jobs");

            XSingleServiceFactory jobsFac = (XSingleServiceFactory) UnoRuntime.queryInterface(
                                                    XSingleServiceFactory.class,
                                                    oObj);
            instance = jobsFac.createInstance();
            instance1 = jobsFac.createInstance();
            instance2 = jobsFac.createInstance();
        } catch (com.sun.star.uno.Exception e) {
            e.printStackTrace();
        }

        log.println("ImplementationName: " + utils.getImplName(oObj));
View Full Code Here

            // create a changeable view on the element for XContainer interface
            XNameAccess access = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class, pMSF.createInstanceWithArguments(
                                "com.sun.star.configuration.ConfigurationUpdateAccess", nodeArgs));
            updateAccess = (XNameReplace) UnoRuntime.queryInterface(XNameReplace.class, access.getByName("Jobs"));
           
            XSingleServiceFactory jobsFac = (XSingleServiceFactory) UnoRuntime.queryInterface(
                                                    XSingleServiceFactory.class,
                                                    updateAccess);
            instance = jobsFac.createInstance();
        } catch (com.sun.star.uno.Exception e) {
            e.printStackTrace();
        }

View Full Code Here

   
    // Get the factory for the ServiceManager
    Object loaderobj = xImpLoader.activate("com.sun.star.comp.servicemanager.ServiceManager", null, null, null);
       
    // Ensure that we have got a factory
    XSingleServiceFactory xManagerFac =  (XSingleServiceFactory) UnoRuntime.queryInterface(XSingleServiceFactory.class, loaderobj);
    // Create an instance of the ServiceManager
    XMultiServiceFactory xMultiFac = (XMultiServiceFactory) UnoRuntime.queryInterface(XMultiServiceFactory.class,
                                              xManagerFac.createInstance());

    // set the ServiceManager at the JavaLoader with the XInitialization interface
    XInitialization xInit = (XInitialization) UnoRuntime.queryInterface(XInitialization.class, xImpLoader);
    Object[] iniargs = { xMultiFac };  
    xInit.initialize( iniargs );
   

    // now use the XSet interface at the ServiceManager to add the factory of the loader
    XSet xSet = (XSet) UnoRuntime.queryInterface(XSet.class, xMultiFac);

    // Get the factory of the loader       
    XSingleServiceFactory xSingleServiceFactory = (XSingleServiceFactory) UnoRuntime.queryInterface(XSingleServiceFactory.class,
                                                    xImpLoader.activate("com.sun.star.comp.loader.JavaLoader", null, null, null));

    // add the javaloader
    xSet.insert(xSingleServiceFactory);
   
View Full Code Here

            XHierarchicalNameAccess changeableNames = (XHierarchicalNameAccess) UnoRuntime.queryInterface(XHierarchicalNameAccess.class,
                        pMSF.createInstanceWithArguments("com.sun.star.configuration.ConfigurationUpdateAccess", nodeArgs));

            XInterface xInt = (XInterface) changeableNames.getByHierarchicalName(hierarchicalElementName);
            xChangeView = (XNameReplace)UnoRuntime.queryInterface(XNameReplace.class, xInt);
            XSingleServiceFactory jobsFac = (XSingleServiceFactory) UnoRuntime.queryInterface(
                                                    XSingleServiceFactory.class, xChangeView);
            instance1 = jobsFac.createInstance();

        } catch (com.sun.star.uno.Exception e) {
            e.printStackTrace();
        }
View Full Code Here

            oObj = (XNameAccess) UnoRuntime.queryInterface(XNameAccess.class,
                                                           pMSF.createInstanceWithArguments(
                                                                   "com.sun.star.configuration.ConfigurationUpdateAccess",
                                                                   nodeArgs));
           
            XSingleServiceFactory jobsFac = (XSingleServiceFactory) UnoRuntime.queryInterface(
                                                    XSingleServiceFactory.class,
                                                    oObj);
            instance = jobsFac.createInstance();
            instance1 = jobsFac.createInstance();
           
        } catch (com.sun.star.uno.Exception e) {
            e.printStackTrace();
        }
View Full Code Here

TOP

Related Classes of com.sun.star.lang.XSingleServiceFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.