コード例 #1
0
ファイル: AutoSave.java プロジェクト: zzz99977/core
  private void saveDoc(XInterface xDoc, String sURL) {
    m_aLog.log(Protocol.TYPE_SCOPE_OPEN, "saveDoc('" + sURL + "') started ...");
    try {
      URL[] aURL = new URL[1];
      aURL[0] = new URL();
      aURL[0].Complete = ".uno:SaveAs";
      m_xURLParser.parseStrict(aURL);

      XModel xModel = UnoRuntime.queryInterface(XModel.class, xDoc);
      XDispatchProvider xProvider =
          UnoRuntime.queryInterface(XDispatchProvider.class, xModel.getCurrentController());
      XDispatch xDispatch = xProvider.queryDispatch(aURL[0], "_self", 0);

      PropertyValue[] lArgs = new PropertyValue[3];
      lArgs[0] = new PropertyValue();
      lArgs[0].Name = "URL";
      lArgs[0].Value = sURL;
      lArgs[1] = new PropertyValue();
      lArgs[1].Name = "Overwrite";
      lArgs[1].Value = Boolean.TRUE;
      lArgs[2] = new PropertyValue();
      lArgs[2].Name = "StoreTo";
      lArgs[2].Value = Boolean.TRUE;

      xDispatch.dispatch(aURL[0], lArgs);

      m_aLog.log(Protocol.TYPE_OK, "saveDoc('" + sURL + "') = OK.");
    } catch (Throwable ex) {
      m_aLog.log(ex);
    }
    m_aLog.log(Protocol.TYPE_SCOPE_CLOSE, "saveDoc('" + sURL + "') finished.");
  }
コード例 #2
0
ファイル: FormControlTest.java プロジェクト: nick-93/core
  /** simulates pressing a toolbox button with the given URL */
  private void executeSlot(String slotURL) throws java.lang.Exception {
    XDispatch xDispatch = m_document.getCurrentView().getDispatcher(slotURL);

    URL[] url = new URL[] {new URL()};
    url[0].Complete = slotURL;
    XURLTransformer xTransformer =
        UnoRuntime.queryInterface(
            XURLTransformer.class, m_orb.createInstance("com.sun.star.util.URLTransformer"));
    xTransformer.parseStrict(url);

    PropertyValue[] aArgs = new PropertyValue[0];
    xDispatch.dispatch(url[0], aArgs);
  }
コード例 #3
0
  /**
   * Called to create an instance of <code>TestEnvironment</code> with an object to test and related
   * objects. Subclasses should implement this method to provide the implementation and related
   * objects. The method is called from <code>getTestEnvironment()</code>.
   *
   * @param tParam test parameters
   * @param log writer to log information while testing
   * @see TestEnvironment
   * @see #getTestEnvironment
   */
  @Override
  protected TestEnvironment createTestEnvironment(TestParameters tParam, PrintWriter log)
      throws Exception {

    log.println("creating a test environment");

    if (xTextDoc != null) {
      xTextDoc.dispose(); // get a soffice factory object
    }
    SOfficeFactory SOF = SOfficeFactory.getFactory(tParam.getMSF());

    log.println("creating a text document");
    xTextDoc = SOF.createTextDoc(null);

    util.utils.waitForEventIdle(tParam.getMSF());

    XModel aModel1 = UnoRuntime.queryInterface(XModel.class, xTextDoc);

    XController secondController = aModel1.getCurrentController();

    XDispatchProvider aProv = UnoRuntime.queryInterface(XDispatchProvider.class, secondController);

    XDispatch getting = null;

    log.println("opening DatasourceBrowser");
    URL the_url = new URL();
    the_url.Complete = ".component:DB/DataSourceBrowser";
    getting = aProv.queryDispatch(the_url, "_beamer", 12);
    PropertyValue[] noArgs = new PropertyValue[0];
    getting.dispatch(the_url, noArgs);

    util.utils.waitForEventIdle(tParam.getMSF());

    XFrame the_frame1 = the_Desk.getCurrentFrame();

    if (the_frame1 == null) {
      log.println("Current frame was not found !!!");
    }

    XFrame the_frame2 = the_frame1.findFrame("_beamer", 4);

    the_frame2.setName("DatasourceBrowser");

    XInterface oObj = null;

    final XSelectionSupplier xSelect =
        UnoRuntime.queryInterface(XSelectionSupplier.class, the_frame2.getController());

    PropertyValue[] params =
        new PropertyValue[] {new PropertyValue(), new PropertyValue(), new PropertyValue()};
    params[0].Name = "DataSourceName";
    params[0].Value = "Bibliography";
    params[1].Name = "CommandType";
    params[1].Value = Integer.valueOf(com.sun.star.sdb.CommandType.TABLE);
    params[2].Name = "Command";
    params[2].Value = "biblio";

    final PropertyValue[] fParams = params;

    util.utils.waitForEventIdle(tParam.getMSF());

    XWindow xWindow = secondController.getFrame().getContainerWindow();

    XAccessible xRoot = AccessibilityTools.getAccessibleObject(xWindow);

    AccessibilityTools.printAccessibleTree(
        log, xRoot, tParam.getBool(util.PropertyName.DEBUG_IS_ACTIVE));

    oObj =
        AccessibilityTools.getAccessibleObjectForRole(
            xRoot, AccessibleRole.PANEL, "", "AccessibleBrowseBox");

    log.println("ImplementationName: " + util.utils.getImplName(oObj));

    TestEnvironment tEnv = new TestEnvironment(oObj);

    tEnv.addObjRelation(
        "EventProducer",
        new ifc.accessibility._XAccessibleEventBroadcaster.EventProducer() {

          public void fireEvent() {
            try {
              xSelect.select(fParams);
            } catch (com.sun.star.lang.IllegalArgumentException e) {
              e.printStackTrace();
            }
          }
        });

    return tEnv;
  }