code: @Nullable
    private XTextCursor getCursor(XComponentContext xContext) {
      try {
        XTextDocument curDoc = getCurrentDocument(xContext);
        if (curDoc == null) {
          return null;
        }
        XText xText = curDoc.getText();
        if (xText == null) {
          return null;
        }
        else return xText.createTextCursor();
      } catch (Throwable t) {
        MessageHandler.printException(t);     // all Exceptions thrown by UnoRuntime.queryInterface are caught
        return null;           // Return null as method failed
      }
    }
docs: Returns the text cursor (if any)
  Returns null if it fails