Example #1
0
    private AutoSaveListener(XMultiServiceFactory xSMGR, XDispatch xAutoSave, Protocol aLog) {
      m_aLog = aLog;
      m_aLog.log(Protocol.TYPE_SCOPE_OPEN, "create listener for AutoSave notifications ...");

      try {
        m_xAutoSave = xAutoSave;

        XURLTransformer xParser =
            UnoRuntime.queryInterface(
                XURLTransformer.class, xSMGR.createInstance("com.sun.star.util.URLTransformer"));
        URL[] aURL = new URL[1];
        aURL[0] = new URL();
        aURL[0].Complete = "vnd.sun.star.autorecovery:/doAutoSave";
        xParser.parseStrict(aURL);
        m_aRegistration = aURL[0];

        m_xAutoSave.addStatusListener(this, m_aRegistration);
        m_aLog.log(Protocol.TYPE_INFO, "successfully registered as AutoSave listener.");
      } catch (Throwable ex) {
        m_aLog.log(ex);
      }

      m_aLog.log(Protocol.TYPE_SCOPE_CLOSE, "");
    }
 /**
  * Adds new status listener.
  *
  * @param status listener to be added
  * @param url url of the command
  * @author Andreas Bröker
  * @date 09.07.2006
  */
 public void addStatusListener(XStatusListener statusListener, URL url) {
   if (xDispatch != null) xDispatch.addStatusListener(statusListener, url);
 }