fdo#83141: also optimize ScTable::HasAttribSelection

applying same strategy than 1e721077b43de84edab2a3ed2f316ddcbec6e3ec

Change-Id: I8c226d5d66ba8371ea1baec73e72b3e50886bb4f
Reviewed-on: https://gerrit.libreoffice.org/11877
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>