code: int getViewCursorParagraph() {
      try {
        if (xVCursor == null) {
          return -4;
        }
        XText xDocumentText = xVCursor.getText();
        if (xDocumentText == null) {
          return -3;
        }
        XTextCursor xModelCursor = xDocumentText.createTextCursorByRange(xVCursor.getStart());
        if (xModelCursor == null) {
          return -2;
        }
        XParagraphCursor xParagraphCursor = UnoRuntime.queryInterface(
            XParagraphCursor.class, xModelCursor);
        if (xParagraphCursor == null) {
          return -1;
        }
        int pos = 0;
        while (xParagraphCursor.gotoPreviousParagraph(false)) pos++;
        return pos;
      } catch (Throwable t) {
        MessageHandler.printException(t);     // all Exceptions thrown by UnoRuntime.queryInterface are caught
        return -5;             // Return negative value as method failed
      }
    }
docs: Returns Paragraph number under ViewCursor
  Returns a negative value if it fails