sw/Library_sw.mk | 1 + sw/source/core/unocore/unotext.cxx | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-)
New commits: commit d27f3cdfaeede871fa66dd813a0eb9967e90a139 Author: Miklos Vajna <vmik...@collabora.com> AuthorDate: Mon Jul 10 21:02:52 2023 +0200 Commit: Tomaž Vajngerl <qui...@gmail.com> CommitDate: Sat Oct 19 20:39:11 2024 +0200 sw: use frozen in SwXText::convertToTable() Switch from linear search to a fast lookup. Change-Id: Ie10435895c9a096fe0ae4bdda0a1a1eecf3c1bc7 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154284 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk index fd0c261c1878..fe08797c4830 100644 --- a/sw/Library_sw.mk +++ b/sw/Library_sw.mk @@ -89,6 +89,7 @@ $(eval $(call gb_Library_use_libraries,sw,\ $(eval $(call gb_Library_use_externals,sw,\ boost_headers \ + frozen \ icui18n \ icuuc \ icu_headers \ diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx index fb229e586ca9..b78be39a98e9 100644 --- a/sw/source/core/unocore/unotext.cxx +++ b/sw/source/core/unocore/unotext.cxx @@ -22,6 +22,10 @@ #include <memory> #include <set> +#include <frozen/bits/defines.h> +#include <frozen/bits/elsa_std.h> +#include <frozen/unordered_set.h> + #include <com/sun/star/drawing/XDrawPageSupplier.hpp> #include <com/sun/star/text/ControlCharacter.hpp> #include <com/sun/star/text/TableColumnSeparator.hpp> @@ -2252,7 +2256,7 @@ SwXText::convertToSwTable( { try { - static const std::initializer_list<std::u16string_view> vDenylist = { + constexpr auto vDenylist = frozen::make_unordered_set<std::u16string_view>({ u"BottomBorder", u"CharAutoKerning", u"CharFontName", @@ -2289,8 +2293,8 @@ SwXText::convertToSwTable( u"ParaRightBorder", u"ParaRightBorderDistance", u"ParaRightBorderComplexColor", - }; - if (std::find(vDenylist.begin(), vDenylist.end(), rTableProperty.Name) == vDenylist.end()) + }); + if (vDenylist.find(rTableProperty.Name) == vDenylist.end()) { xRet->setPropertyValue(rTableProperty.Name, rTableProperty.Value); }