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 <quikee@gmail.com>
This commit is contained in:
Miklos Vajna 2023-07-10 21:02:52 +02:00 committed by Tomaž Vajngerl
parent c2308be747
commit d27f3cdfae
2 changed files with 8 additions and 3 deletions

View file

@ -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 \

View file

@ -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);
}