sw lok: simplify SwTransferable::isComplex()
commit7a8dc25defee31edbb75a2f8c35f92ee2d3f3a83
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 09:48:01 +0000 (23 10:48 +0100)
treee336c7b52624c6938572e047c9f74b1c92b1058b
parent137a93776c91765176867157669b1f95cffb8ae8
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.

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