fdo#83141: optimize slow performance after when using replaceall or searchall

- problem was hang after replaceall or searchall function
- fix slow performance by looping only selected cols.

Change-Id: Ic0178af33bf381e52584bd4366bff9e128891b64
Reviewed-on: https://gerrit.libreoffice.org/11829
Tested-by: LibreOffice gerrit bot <gerrit@libreoffice.org>
Reviewed-by: Matthew Francis <mjay.francis@gmail.com>
Tested-by: Matthew Francis <mjay.francis@gmail.com>
Reviewed-by: Kohei Yoshida <libreoffice@kohei.us>
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>