fdo#72470: Correctly calculate the first edit cell row position.

Else it could go into an infinite loop.

Change-Id: I269cd118dcb3ab83ea8a2243576a360d3d4bc142
(cherry picked from commit 3e2ffb053f9749c6f6990c5ce8f47dc63ea7c148)
Reviewed-on: https://gerrit.libreoffice.org/7831
Reviewed-by: Fridrich Strba <fridrich@documentfoundation.org>
Tested-by: Fridrich Strba <fridrich@documentfoundation.org>