Handling Presentation Document Files

From Apache OpenOffice Wiki
Jump to: navigation, search



Creating and Loading Presentation Documents

The URL that must be used with loadComponentFromURL() for new presentation documents is "private:factory/simpress".

To avoid the initial dialog in new presentation documents, set the property Silent defined in com.sun.star.document.MediaDescriptor to true. This property has to be used with the sequence of PropertyValue structs that is passed to loadComponentFromURL().

The snippet below loads a new presentation document in silent mode:

  // the method getRemoteServiceManager is described in the chapter First Steps
  mxRemoteServiceManager = this.getRemoteServiceManager();
 
  // retrieve the Desktop object, we need its XComponentLoader
  Object desktop = mxRemoteServiceManager.createInstanceWithContext(
      "com.sun.star.frame.Desktop", mxRemoteContext);
 
  // query the XComponentLoader interface from the Desktop service
  XComponentLoader xComponentLoader = (XComponentLoader)UnoRuntime.queryInterface(
      XComponentLoader.class, desktop);
 
  // define load properties according to com.sun.star.document.MediaDescriptor
  // the boolean property Silent tells the office to suppress the impress startup wizard
  PropertyValue[] loadProps = new PropertyValue[1];
  loadProps[0] = new PropertyValue();
  loadProps[0].Name = "Silent";
  loadProps[0].Value = new Boolean(true); 
 
  // load
  com.sun.star.uno.XComponent xComponentLoader.loadComponentFromURL(
      "private:factory/simpress", "_blank", 0, loadProps);
Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages