Package com.sun.star.lang

Examples of com.sun.star.lang.XMultiComponentFactory


        }
       
        private String resolvePath(String path) {
            try {
                if( xPathSubstService == null || xUriTranslator == null ) {
                    XMultiComponentFactory theServiceManager = xComponentContext.getServiceManager();
                    if( xPathSubstService == null ) {
                        Object o = theServiceManager.createInstanceWithContext(
                            "com.sun.star.util.PathSubstitution",
                            xComponentContext );
                        xPathSubstService = (XStringSubstitution)
                            UnoRuntime.queryInterface(XStringSubstitution.class, o);
                    }
                   
                    if( xUriTranslator == null ) {
                        Object o = theServiceManager.createInstanceWithContext(
                            "com.sun.star.uri.ExternalUriReferenceTranslator",
                            xComponentContext );
                        xUriTranslator =  (XExternalUriReferenceTranslator)
                            UnoRuntime.queryInterface(XExternalUriReferenceTranslator.class, o);
                    }
View Full Code Here


            }
        }
       
        private void openBrowser(String url) {
            try {
                XMultiComponentFactory theServiceManager = xComponentContext.getServiceManager();
           
                Object o = theServiceManager.createInstanceWithContext(
                    "com.sun.star.system.SystemShellExecute",
                    xComponentContext );
           
                XSystemShellExecute xShellExecuteService = (XSystemShellExecute)
                    UnoRuntime.queryInterface(XSystemShellExecute.class, o);
View Full Code Here

public final class JavaClient {
    public static void main(String[] arguments) throws Exception {
        XComponentContext context = Bootstrap.createInitialComponentContext(
            null);
        XMultiComponentFactory manager = context.getServiceManager();
        if (manager == null) {
            throw new NullPointerException("no service manager");
        }
        XBridgeFactory factory = (XBridgeFactory) UnoRuntime.queryInterface(
            XBridgeFactory.class,
            manager.createInstanceWithContext(
                "com.sun.star.bridge.BridgeFactory", context));
        if (factory == null) {
            throw new NullPointerException("no bridge factory");
        }
        UnoUrl url = UnoUrl.parseUnoUrl(arguments[0]);
View Full Code Here

       * First step: create local component context, get local servicemanager and
       * ask it to create a UnoUrlResolver object with an XUnoUrlResolver interface
       */
      XComponentContext xLocalContext =
        com.sun.star.comp.helper.Bootstrap.createInitialComponentContext(null);
      XMultiComponentFactory xLocalServiceManager = xLocalContext.getServiceManager();
      Object urlResolver = xLocalServiceManager.createInstanceWithContext(
        UNOURLRESOLVER, xLocalContext );
      /*
       * query XUnoUrlResolver interface from urlResolver object
       */
      XUnoUrlResolver xUnoUrlResolver = (XUnoUrlResolver) UnoRuntime.queryInterface(
View Full Code Here

        */
       private XToolkit queryAWTToolkit()
               throws com.sun.star.uno.Exception
       {
      // Create a UNO toolkit.
      XMultiComponentFactory  compfactory;
      XComponentContext xContext = mConnection.getComponentContext();
      if ( xContext != null )
      {
        compfactory     = mConnection.getComponentContext().getServiceManager();
        XMultiServiceFactory    factory;
View Full Code Here

        this.name = name;
        this.parent = parent;
        ScriptMetaData data = null;
        XSimpleFileAccess xSFA = null;
        XComponentContext xCtx = provider.getScriptingContext().getComponentContext();
        XMultiComponentFactory xFac = xCtx.getServiceManager();
        try
        {
            data = (ScriptMetaData)parent.getByName( name );
            xSFA = ( XSimpleFileAccess)
                UnoRuntime.queryInterface( XSimpleFileAccess.class,
                    xFac.createInstanceWithContext(
                        "com.sun.star.ucb.SimpleFileAccess",
                        xCtx ) );           
        }

        // TODO fix exception types to be caught here, should we rethrow?
View Full Code Here

        registerProperty("Creatable", new Type(boolean.class),
            (short)0, "creatable");
        registerProperty("Editable", new Type(boolean.class),
            (short)0, "editable");
        XSimpleFileAccess xSFA = null;
        XMultiComponentFactory xFac = m_xCtx.getServiceManager();
        try
        {
            xSFA = ( XSimpleFileAccess)
                UnoRuntime.queryInterface( XSimpleFileAccess.class,
                    xFac.createInstanceWithContext(
                        "com.sun.star.ucb.SimpleFileAccess",
                        xCtx ) );
            if container.isUnoPkg() || xSFA.isReadOnly( container.getParcelContainerDir() ) )
            {
                deletable = false;
View Full Code Here

            this.creatable = true;
        }

        String parcelDirUrl = parcel.getPathToParcel();
        XComponentContext xCtx = provider.getScriptingContext().getComponentContext();
        XMultiComponentFactory xFac = xCtx.getServiceManager();
        try
        {
            XSimpleFileAccess xSFA = ( XSimpleFileAccess)
                UnoRuntime.queryInterface( XSimpleFileAccess.class,
                    xFac.createInstanceWithContext(
                        "com.sun.star.ucb.SimpleFileAccess",
                        xCtx ) );
            if ( xSFA != null && ( xSFA.isReadOnly( parcelDirUrl ) ||
                container.isUnoPkg() ) )
            {
View Full Code Here

        {
            prompt = "Enter name";
        }

        // get the service manager from the component context
        XMultiComponentFactory xMultiComponentFactory =
            xComponentContext.getServiceManager();
       
        // create the dialog model and set the properties
        Object dialogModel = xMultiComponentFactory.createInstanceWithContext(
            "com.sun.star.awt.UnoControlDialogModel", xComponentContext);

        XPropertySet props = (XPropertySet) UnoRuntime.queryInterface(
            XPropertySet.class, dialogModel);     

        props.setPropertyValue("Title", title);
        setDimensions(dialogModel, 100, 100, 157, 37);

        // get the service manager from the dialog model
        XMultiServiceFactory xMultiServiceFactory =
            (XMultiServiceFactory) UnoRuntime.queryInterface(
                XMultiServiceFactory.class, dialogModel);
     
        // create the label model and set the properties
        Object label = xMultiServiceFactory.createInstance(
            "com.sun.star.awt.UnoControlFixedTextModel");

        setDimensions(label, 15, 5, 134, 12);

        XPropertySet labelProps = (XPropertySet) UnoRuntime.queryInterface(
            XPropertySet.class, label);
        labelProps.setPropertyValue("Name", "PromptLabel");
        labelProps.setPropertyValue("Label", prompt);

        // create the Run Macro button model and set the properties
        Object okButtonModel = xMultiServiceFactory.createInstance(
            "com.sun.star.awt.UnoControlButtonModel");

        setDimensions(okButtonModel, 40, 18, 38, 15);

        XPropertySet buttonProps = (XPropertySet) UnoRuntime.queryInterface(
            XPropertySet.class, okButtonModel);
        buttonProps.setPropertyValue("Name", "Ok");
        buttonProps.setPropertyValue("Label", "Ok");
     
        // create the Dont Run Macro button model and set the properties
        Object cancelButtonModel = xMultiServiceFactory.createInstance(
            "com.sun.star.awt.UnoControlButtonModel");

        setDimensions(cancelButtonModel, 83, 18, 38, 15);

        buttonProps = (XPropertySet) UnoRuntime.queryInterface(
            XPropertySet.class, cancelButtonModel);
        buttonProps.setPropertyValue("Name", "Cancel");
        buttonProps.setPropertyValue("Label", "Cancel");
     
        // insert the control models into the dialog model
        XNameContainer xNameCont = (XNameContainer) UnoRuntime.queryInterface(
            XNameContainer.class, dialogModel);

        xNameCont.insertByName("PromptLabel", label);
        xNameCont.insertByName("Ok", okButtonModel);
        xNameCont.insertByName("Cancel", cancelButtonModel);

        // create the dialog control and set the model
        Object dialog = xMultiComponentFactory.createInstanceWithContext(
            "com.sun.star.awt.UnoControlDialog", xComponentContext);
        XControl xControl = (XControl) UnoRuntime.queryInterface(
            XControl.class, dialog);

        XControlModel xControlModel = (XControlModel)
            UnoRuntime.queryInterface(XControlModel.class, dialogModel);     
        xControl.setModel(xControlModel);
     
        // create a peer
        Object toolkit = xMultiComponentFactory.createInstanceWithContext(
            "com.sun.star.awt.ExtToolkit", xComponentContext);     
        XToolkit xToolkit = (XToolkit) UnoRuntime.queryInterface(
            XToolkit.class, toolkit);
        XWindow xWindow = (XWindow) UnoRuntime.queryInterface(
            XWindow.class, xControl);
View Full Code Here

        {
            prompt = "Enter name";
        }

        // get the service manager from the component context
        XMultiComponentFactory xMultiComponentFactory =
            xComponentContext.getServiceManager();
       
        // create the dialog model and set the properties
        Object dialogModel = xMultiComponentFactory.createInstanceWithContext(
            "com.sun.star.awt.UnoControlDialogModel", xComponentContext);

        setDimensions(dialogModel, 100, 100, 157, 58);

        XPropertySet props = (XPropertySet) UnoRuntime.queryInterface(
            XPropertySet.class, dialogModel);     
        props.setPropertyValue("Title", title);

        // get the service manager from the dialog model
        XMultiServiceFactory xMultiServiceFactory =
            (XMultiServiceFactory) UnoRuntime.queryInterface(
                XMultiServiceFactory.class, dialogModel);
     
        // create the label model and set the properties
        Object label = xMultiServiceFactory.createInstance(
            "com.sun.star.awt.UnoControlFixedTextModel");

        setDimensions(label, 15, 5, 134, 12);

        XPropertySet labelProps = (XPropertySet) UnoRuntime.queryInterface(
            XPropertySet.class, label);
        labelProps.setPropertyValue("Name", "PromptLabel");
        labelProps.setPropertyValue("Label", prompt);

        // create the text field
        Object edit = xMultiServiceFactory.createInstance(
            "com.sun.star.awt.UnoControlEditModel");

        setDimensions(edit, 15, 18, 134, 12);

        XPropertySet editProps = (XPropertySet) UnoRuntime.queryInterface(
            XPropertySet.class, edit);
        editProps.setPropertyValue("Name", "NameField");

        // create the OK button
        Object okButtonModel = xMultiServiceFactory.createInstance(
            "com.sun.star.awt.UnoControlButtonModel");

        setDimensions(okButtonModel, 40, 39, 38, 15);

        XPropertySet buttonProps = (XPropertySet) UnoRuntime.queryInterface(
            XPropertySet.class, okButtonModel);
        buttonProps.setPropertyValue("Name", "Ok");
        buttonProps.setPropertyValue("Label", "Ok");
     
        // create the Cancel button
        Object cancelButtonModel = xMultiServiceFactory.createInstance(
            "com.sun.star.awt.UnoControlButtonModel");

        setDimensions(cancelButtonModel, 83, 39, 38, 15);

        buttonProps = (XPropertySet) UnoRuntime.queryInterface(
            XPropertySet.class, cancelButtonModel);
        buttonProps.setPropertyValue("Name", "Cancel");
        buttonProps.setPropertyValue("Label", "Cancel");
     
        // insert the control models into the dialog model
        XNameContainer xNameCont = (XNameContainer)
            UnoRuntime.queryInterface(XNameContainer.class, dialogModel);

        xNameCont.insertByName("PromptLabel", label);
        xNameCont.insertByName("NameField", edit);
        xNameCont.insertByName("Ok", okButtonModel);
        xNameCont.insertByName("Cancel", cancelButtonModel);

        // create the dialog control and set the model
        Object dialog = xMultiComponentFactory.createInstanceWithContext(
            "com.sun.star.awt.UnoControlDialog", xComponentContext);
        XControl xControl = (XControl) UnoRuntime.queryInterface(
            XControl.class, dialog);

        XControlModel xControlModel = (XControlModel)
            UnoRuntime.queryInterface(XControlModel.class, dialogModel);     
        xControl.setModel(xControlModel);
     
        // create a peer
        Object toolkit = xMultiComponentFactory.createInstanceWithContext(
            "com.sun.star.awt.ExtToolkit", xComponentContext);     
        XToolkit xToolkit = (XToolkit) UnoRuntime.queryInterface(
            XToolkit.class, toolkit);
        XWindow xWindow = (XWindow) UnoRuntime.queryInterface(
            XWindow.class, xControl);
View Full Code Here

TOP

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

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.