CopyToClip() copies named database ranges into the clipboard document through CopyDBsToClip(), which decided whether to carry a table by testing it against the bounding box of the copied area. For a non-contiguous selection the bounding box also covers the gaps between the selected ranges, so a table sitting in such a gap was carried even though none of its cells were copied. Test the table against the actually copied ranges instead of their bounding box, so a table that lies entirely in a gap is left out. Signed-off-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> Change-Id: I1c8663e5190247dae0edf3878efe37186a7f6a4d Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/5095 Reviewed-by: Balázs Varga <balazs.varga@collabora.com> Tested-by: Tomaž Vajngerl <tomaz.vajngerl@collabora.com> (cherry picked from commit 37543af628671f723c9a661e2add91d6bc641591) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/207944 Tested-by: Jenkins Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>