I’ve finally found a solution inspired from an answer to an other question mixed with a recorded macro.
Probably ugly for programmers but it works (and it’s hidden under the button
Function UsedRange(oSheet As Variant) As Variant
Dim oCursor As Variant
oCursor = oSheet.createCursor()
oCursor.gotoEndOfUsedArea(False)
oCursor.gotoStartOfUsedArea(True)
UsedRange = oCursor
End Function
Function LastRow(oRange As Variant) As Long
LastRow = oRange.getRangeAddress().EndRow
End Function
sub AddRow
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
Dim oRange As Variant, sMessage As String
oRange = UsedRange(ThisComponent.getCurrentController().getActiveSheet())
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dim args1(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "ToPoint"
args1(0).Value = "$B"+ CStr(LastRow(oRange)+1)
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args1())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:Copy", "", 0, Array())
rem ----------------------------------------------------------------------
dim args3(0) as new com.sun.star.beans.PropertyValue
args3(0).Name = "ToPoint"
args3(0).Value = "$B" + CStr(LastRow(oRange) + 2)
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args3())
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:Paste", "", 0, Array())
end sub