Fix high memory usage when sorting cells in Calc. (fdo#81501)

Empty columns were being unnecessarily included in the sorting
range which caused extra allocation. This happens when you select
the entire sheet to sort. There was already code to skip empty
trailing cells in rows but not to skip empty columns.

Change-Id: Ieac22647bb13165cbf66cb1a93f567e5169fff6a
Reviewed-on: https://gerrit.libreoffice.org/13294
Reviewed-by: Eike Rathke <erack@redhat.com>
Tested-by: Eike Rathke <erack@redhat.com>