fdo#81617: Split formula groups at sort range boundaries.

Otherwise, partially sorting a range may crash, or at best incorrectly
update formula references.

Change-Id: Iefcb86d205d83ccc5b684048bfd9aadabf6e13eb
(cherry picked from commit a3fc7f20089062afa4f778e70ba8be84032a30a7)
Reviewed-on: https://gerrit.libreoffice.org/10581
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>