sw lok: simplify SwTransferable::isComplex()
commit70bc089fe9bec46ef4ca0417518ee06302c65f4c
authorMiklos Vajna <vmiklos@collabora.com>
Tue, 23 Feb 2021 09:04:03 +0000 (23 10:04 +0100)
committerMiklos Vajna <vmiklos@collabora.com>
Tue, 23 Feb 2021 11:28:21 +0000 (23 12:28 +0100)
tree5a3b1655a0dccfd8d33429a1ef96c75ef5200309
parent5f3fbb019bd79bd57eed94e01bd2202efd9a0c06
sw lok: simplify SwTransferable::isComplex()

Commit 169a87563a3940299811d874b4df0ad13591771c (LOK: Implement
getSelectionType, 2019-06-24) implemented detecting complex selections
by copying the selection to a new SwDoc, which probably had two
benefits: first, the created SwPaM instance didn't touch the document;
second, this means no bounds has to be set when scanning nodes: the
entire document is the selection.

Later commit 7fe30d1cb00c576469d6cbe5606268a9cdf35bd3 (LOK: detect
Graphics in isComplex for Writer, 2019-06-25) got rid of the SwPaM
(which would register itself into text nodes), so now it's possible to
not touch the document, even if we work on the original document.

Instead, solve the partial scanning by iterating over the list of
selections. This is meant to be faster, and also less likely to crash in
case some internal document model invariant is broken.

No testcase, testComplexSelection in CppunitTest_desktop_lib already
covers thie behavior.

(cherry picked from commit 7a8dc25defee31edbb75a2f8c35f92ee2d3f3a83)

Conflicts:
sw/source/uibase/dochdl/swdtflvr.cxx

Change-Id: Ia528c06a48defd06c5e34ed7d61621e5ce10bb06
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/111385
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
sw/source/uibase/dochdl/swdtflvr.cxx