Package com.sun.star.frame

Examples of com.sun.star.frame.XComponentLoader


      // Determine the document URL.
      if (url.equals(""))
        url = getDefaultDocumentURL();

      // get XComponentLoader (<= 6.0 => global, >= 6.1 => from frame)
      XComponentLoader xLoader = (XComponentLoader) UnoRuntime.queryInterface(
          XComponentLoader.class, mFrame );
      if ( xLoader == null )
      {
        xLoader = (XComponentLoader)UnoRuntime.queryInterface(
            XComponentLoader.class, mDesktop );
      }

      // Avoid Dialog 'Document changed' while reloading
      boolean bWasModified = isModified();
      XController xOldController = null;
      if ( mFrame != null && mFrame.getController() != null )
        xOldController = mFrame.getController();
      try {
        if ( mFrame != null && xOldController != null )
          xOldController.suspend(true);
        setModified(false);
      } catch (java.lang.IllegalStateException exp) {
      }

      // load the document.
      PropertyValue aArgs[] = new PropertyValue[1];
      aArgs[0] = new PropertyValue();
      aArgs[0].Name = "MacroExecutionMode";
      aArgs[0].Handle = -1;
      aArgs[0].Value = new Short( MacroExecMode.USE_CONFIG );
      XComponent xComponent = xLoader.loadComponentFromURL( url,
        mFrame.getName(), FrameSearchFlag.ALL, aArgs );

      // nothing loaded?
      if ( xComponent == null )
      {
View Full Code Here


    public static XSpreadsheetDocument openCalc(XMultiServiceFactory oMSF) {      
       
        //define variables
        XInterface oInterface;
        XDesktop oDesktop;
        XComponentLoader oCLoader;
        XSpreadsheetDocument oDoc = null;
        XComponent aDoc = null;
       
        try {
           
            oInterface = (XInterface) oMSF.createInstance( "com.sun.star.frame.Desktop" );
            oDesktop = ( XDesktop ) UnoRuntime.queryInterface( XDesktop.class, oInterface );
            oCLoader = ( XComponentLoader ) UnoRuntime.queryInterface( XComponentLoader.class, oDesktop );
            PropertyValue [] szEmptyArgs = new PropertyValue [0];
            String doc = "private:factory/scalc";
            aDoc = oCLoader.loadComponentFromURL(doc, "_blank", 0, szEmptyArgs );
            oDoc = (XSpreadsheetDocument) UnoRuntime.queryInterface(XSpreadsheetDocument.class, aDoc);
           
        } // end of try
       
        catch(Exception e){
View Full Code Here

  */
  protected void createSampleDocument() throws java.lang.Exception
  {
    // ��������������������������������������������������������������
    /* create and instantiate a new document component via XMultiServiceFactory */
    XComponentLoader aLoader = (XComponentLoader)UnoRuntime.queryInterface(
      XComponentLoader.class,
      m_xMSF.createInstance( "com.sun.star.frame.Desktop" ) );

    XComponent xDocument = UNO.queryComponent(
      aLoader.loadComponentFromURL( "private:factory/swriter", "_blank", 0, new PropertyValue[ 0 ] ) );
    xDocument.addEventListener( this );
    m_aDocument = new DocumentHelper( m_xMSF, xDocument );

    // ��������������������������������������������������������������
    /* create some shapes */
 
View Full Code Here

           
      /* A desktop environment contains tasks with one or more
         frames in which components can be loaded. Desktop is the
         environment for components which can instanciate within
         frames. */
            XComponentLoader xcomponentloader = ( XComponentLoader )
                UnoRuntime.queryInterface( XComponentLoader.class,
                                           xmulticomponentfactory.createInstanceWithContext(
                                               "com.sun.star.frame.Desktop", xcomponentcontext ) );
           
            // Load a Writer document, which will be automaticly displayed
            XComponent xcomponent = xcomponentloader.loadComponentFromURL(
            "file:///" + stringFileName, "_blank", 0,
            new PropertyValue[0] );
           
            // Query for the interface XSpreadsheetDocument
            XSpreadsheetDocument xspreadsheetdocument = ( XSpreadsheetDocument )
View Full Code Here

            xcomponentcontext.getServiceManager();
      /* A desktop environment contains tasks with one or more
         frames in which components can be loaded. Desktop is the
         environment for components which can instanciate within
         frames. */
            XComponentLoader xcomponentloader = ( XComponentLoader )
                UnoRuntime.queryInterface( XComponentLoader.class,
                                           xmulticomponentfactory.createInstanceWithContext(
                                               "com.sun.star.frame.Desktop", xcomponentcontext ) );
           
            // Create an empty calc document, which will be automaticly displayed
            XComponent xcomponent = xcomponentloader.loadComponentFromURL(
            "private:factory/scalc", "_blank", 0,
            new PropertyValue[0] );
           
            // Query for the interface XSpreadsheetDocument
            XSpreadsheetDocument xspreadsheetdocument = ( XSpreadsheetDocument )
View Full Code Here

                    showProperty(ReadOnly);
                   
                    GlobalLogWriter.println(DateHelper.getDateTimeForHumanreadableLog() + " Load document");
                    // GlobalLogWriter.flush();
                   
                    XComponentLoader aCompLoader = UnoRuntime.queryInterface( XComponentLoader.class, aDesktop);
                   
                    // XComponent aDoc = null;

                    _aGTA.getPerformance().startTime(PerformanceContainer.Load);
                    aDoc = aCompLoader.loadComponentFromURL(_sInputURL, "_blank", FrameSearchFlag.ALL, PropertyHelper.createPropertyValueArrayFormArrayList(aPropertyList) );
                    _aGTA.getPerformance().stopTime(PerformanceContainer.Load);
                    if (aDoc != null)
                    {
                        GlobalLogWriter.println(DateHelper.getDateTimeForHumanreadableLog() + " Load document done.");
                        showDocumentType(aDoc);
View Full Code Here

        }
   
    private XComponent loadComponent(String _sName, Object _xComponent, ArrayList _aPropertyList)
        {
            XComponent xDocComponent = null;
            XComponentLoader xComponentLoader = (XComponentLoader) UnoRuntime.queryInterface( XComponentLoader.class, _xComponent );

            try
            {
                PropertyValue[] aLoadProperties = PropertyHelper.createPropertyValueArrayFormArrayList(_aPropertyList);
                log.println("Load component: '" + _sName + "'");
                xDocComponent = xComponentLoader.loadComponentFromURL(_sName, "_blank", 0, aLoadProperties);
                log.println("Load component: '" + _sName + "' done");
            }
            catch (com.sun.star.io.IOException e)
            {
                log.println("ERROR: Exception caught");
View Full Code Here

                    }

                    GlobalLogWriter.get().println(DateHelper.getDateTimeForHumanreadableLog() + " Load document");
                    // GlobalLogWriter.get().flush();
                   
                    XComponentLoader aCompLoader = UnoRuntime.queryInterface( XComponentLoader.class, aDesktop);
                   
                    // XComponent aDoc = null;

                    _aGTA.getPerformance().startTime(PerformanceContainer.Load);
                    aDoc = aCompLoader.loadComponentFromURL(_sInputURL, "_blank", 0, PropertyHelper.createPropertyValueArrayFormArrayList(aPropertyList) );
                    _aGTA.getPerformance().stopTime(PerformanceContainer.Load);
                    if (aDoc != null)
                    {
                        GlobalLogWriter.get().println(DateHelper.getDateTimeForHumanreadableLog() + " Load document done.");
                        showDocumentType(aDoc);
View Full Code Here

    public static XComponentLoader getCLoader(XMultiServiceFactory xMSF)
    {
        XDesktop oDesktop = (XDesktop) UnoRuntime.queryInterface(
                XDesktop.class, createDesktop(xMSF));

        XComponentLoader oCLoader = (XComponentLoader) UnoRuntime.queryInterface(
                XComponentLoader.class, oDesktop);

        return oCLoader;
    } // finish getCLoader
View Full Code Here

           
            /* A desktop environment contains tasks with one or more
               frames in which components can be loaded. Desktop is the
               environment for components which can instanciate within
               frames. */
            XComponentLoader xcomponentloader = ( XComponentLoader )
                UnoRuntime.queryInterface( XComponentLoader.class,
                                           xmulticomponentfactory.createInstanceWithContext(
                                               "com.sun.star.frame.Desktop", xcomponentcontext ) );
           
            // Preparing properties for loading the document
            PropertyValue propertyvalue[] = new PropertyValue[ 1 ];
            // Setting the flag for hidding the open document
            propertyvalue[ 0 ] = new PropertyValue();
            propertyvalue[ 0 ].Name = "Hidden";
            propertyvalue[ 0 ].Value = new Boolean(true);
           
            // Loading the wanted document
            Object objectDocumentToStore =
                xcomponentloader.loadComponentFromURL(
                    stringUrl, "_blank", 0, propertyvalue );
           
            // Getting an object that will offer a simple way to store a document to a URL.
            XStorable xstorable =
                ( XStorable ) UnoRuntime.queryInterface( XStorable.class,
View Full Code Here

TOP

Related Classes of com.sun.star.frame.XComponentLoader

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.