Rebased ref, commits from common ancestor:
commit 31699dc711942bde9d1fb9b64aa9c87217967f81
Author: Tomaž Vajngerl <[email protected]>
AuthorDate: Wed Jun 14 11:48:51 2023 +0900
Commit: Tomaž Vajngerl <[email protected]>
CommitDate: Thu Jun 15 20:12:15 2023 +0900
oox, writerfilter, xmloff: use frozen unordered_map for static data
Change-Id: I4a53fa57f52900104d249c84cde36c9d3b9e1300
diff --git a/oox/Library_oox.mk b/oox/Library_oox.mk
index b878089027b1..3bf2d607918c 100644
--- a/oox/Library_oox.mk
+++ b/oox/Library_oox.mk
@@ -65,6 +65,7 @@ $(eval $(call gb_Library_use_libraries,oox,\
$(eval $(call gb_Library_use_externals,oox,\
boost_headers \
+ frozen \
))
ifeq ($(TLS),OPENSSL)
diff --git a/oox/source/drawingml/color.cxx b/oox/source/drawingml/color.cxx
index ad0b5ca7835e..6660c6bd2660 100644
--- a/oox/source/drawingml/color.cxx
+++ b/oox/source/drawingml/color.cxx
@@ -19,7 +19,9 @@
#include <oox/drawingml/color.hxx>
#include <algorithm>
-#include <unordered_map>
+#include <frozen/bits/defines.h>
+#include <frozen/bits/elsa_std.h>
+#include <frozen/unordered_map.h>
#include <math.h>
#include <osl/diagnose.h>
#include <sal/log.hxx>
@@ -214,39 +216,40 @@ void lclOffValue( sal_Int32& ornValue, sal_Int32 nOff,
sal_Int32 nMax = MAX_PERC
ornValue = getLimitedValue< sal_Int32, sal_Int32 >( ornValue + nOff, 0,
nMax );
}
+static constexpr frozen::unordered_map<std::u16string_view,
model::ThemeColorType, 26> aSchemeColorNameToIndex
+{
+ { u"dk1", model::ThemeColorType::Dark1 },
+ { u"lt1", model::ThemeColorType::Light1 },
+ { u"dk2", model::ThemeColorType::Dark2 },
+ { u"lt2", model::ThemeColorType::Light2 },
+ { u"accent1", model::ThemeColorType::Accent1 },
+ { u"accent2", model::ThemeColorType::Accent2 },
+ { u"accent3", model::ThemeColorType::Accent3 },
+ { u"accent4", model::ThemeColorType::Accent4 },
+ { u"accent5", model::ThemeColorType::Accent5 },
+ { u"accent6", model::ThemeColorType::Accent6 },
+ { u"hlink", model::ThemeColorType::Hyperlink },
+ { u"folHlink", model::ThemeColorType::FollowedHyperlink },
+ { u"tx1", model::ThemeColorType::Dark1 },
+ { u"bg1", model::ThemeColorType::Light1 },
+ { u"tx2", model::ThemeColorType::Dark2 },
+ { u"bg2", model::ThemeColorType::Light2 },
+ { u"dark1", model::ThemeColorType::Dark1},
+ { u"light1", model::ThemeColorType::Light1},
+ { u"dark2", model::ThemeColorType::Dark2 },
+ { u"light2", model::ThemeColorType::Light2 },
+ { u"text1", model::ThemeColorType::Dark1 },
+ { u"background1", model::ThemeColorType::Light1 },
+ { u"text2", model::ThemeColorType::Dark2 },
+ { u"background2", model::ThemeColorType::Light2 },
+ { u"hyperlink", model::ThemeColorType::Hyperlink },
+ { u"followedHyperlink", model::ThemeColorType::FollowedHyperlink }
+};
+
} // namespace
model::ThemeColorType schemeNameToThemeColorType(OUString const& rSchemeName)
{
- static std::unordered_map<OUString, model::ThemeColorType> const
aSchemeColorNameToIndex{
- { u"dk1", model::ThemeColorType::Dark1 },
- { u"lt1", model::ThemeColorType::Light1 },
- { u"dk2", model::ThemeColorType::Dark2 },
- { u"lt2", model::ThemeColorType::Light2 },
- { u"accent1", model::ThemeColorType::Accent1 },
- { u"accent2", model::ThemeColorType::Accent2 },
- { u"accent3", model::ThemeColorType::Accent3 },
- { u"accent4", model::ThemeColorType::Accent4 },
- { u"accent5", model::ThemeColorType::Accent5 },
- { u"accent6", model::ThemeColorType::Accent6 },
- { u"hlink", model::ThemeColorType::Hyperlink },
- { u"folHlink", model::ThemeColorType::FollowedHyperlink },
- { u"tx1", model::ThemeColorType::Dark1 },
- { u"bg1", model::ThemeColorType::Light1 },
- { u"tx2", model::ThemeColorType::Dark2 },
- { u"bg2", model::ThemeColorType::Light2 },
- { u"dark1", model::ThemeColorType::Dark1},
- { u"light1", model::ThemeColorType::Light1},
- { u"dark2", model::ThemeColorType::Dark2 },
- { u"light2", model::ThemeColorType::Light2 },
- { u"text1", model::ThemeColorType::Dark1 },
- { u"background1", model::ThemeColorType::Light1 },
- { u"text2", model::ThemeColorType::Dark2 },
- { u"background2", model::ThemeColorType::Light2 },
- { u"hyperlink", model::ThemeColorType::Hyperlink },
- { u"followedHyperlink", model::ThemeColorType::FollowedHyperlink}
- };
-
auto aIterator = aSchemeColorNameToIndex.find(rSchemeName);
if (aIterator == aSchemeColorNameToIndex.end())
return model::ThemeColorType::Unknown;
diff --git a/oox/source/drawingml/colorchoicecontext.cxx
b/oox/source/drawingml/colorchoicecontext.cxx
index b0977c5e003c..04b9f996d8d5 100644
--- a/oox/source/drawingml/colorchoicecontext.cxx
+++ b/oox/source/drawingml/colorchoicecontext.cxx
@@ -24,13 +24,16 @@
#include <oox/token/namespaces.hxx>
#include <oox/token/tokens.hxx>
#include <unordered_map>
+#include <frozen/bits/defines.h>
+#include <frozen/bits/elsa_std.h>
+#include <frozen/unordered_map.h>
namespace oox::drawingml {
namespace
{
-const std::unordered_map<sal_Int32, model::SystemColorType>
constSystemColorMap =
+static constexpr frozen::unordered_map<sal_Int32, model::SystemColorType, 30>
constSystemColorMap
{
{ XML_scrollBar, model::SystemColorType::ScrollBar },
{ XML_background, model::SystemColorType::Background },
@@ -64,7 +67,7 @@ const std::unordered_map<sal_Int32, model::SystemColorType>
constSystemColorMap
{ XML_menuBar, model::SystemColorType::MenuBar }
};
-const std::unordered_map<sal_Int32, model::TransformationType>
constTransformTypeMap =
+static constexpr frozen::unordered_map<sal_Int32, model::TransformationType,
28> constTransformTypeMap
{
{ XML_alpha, model::TransformationType::Alpha },
{ XML_alphaMod, model::TransformationType::AlphaMod },
diff --git a/oox/source/drawingml/fontworkhelpers.cxx
b/oox/source/drawingml/fontworkhelpers.cxx
index 3c8d28d634c6..0a68e4844a9b 100644
--- a/oox/source/drawingml/fontworkhelpers.cxx
+++ b/oox/source/drawingml/fontworkhelpers.cxx
@@ -905,6 +905,18 @@ void FontworkHelpers::applyPropsToRuns(const
std::vector<beans::PropertyValue>&
}
}
}
+namespace
+{
+constexpr const std::array<std::u16string_view, 5> aCharPropNames{
+ u"CharColorLumMod", u"CharColorLumOff", u"CharColorTheme",
u"CharComplexColor",
+ u"CharTransparence"
+};
+
+constexpr const std::array<std::u16string_view, 5> aShapePropNames{
+ u"FillColorLumMod", u"FillColorLumOff", u"FillColorTheme",
u"FillComplexColor",
+ u"FillTransparence"
+};
+}
void FontworkHelpers::createCharFillPropsFromShape(
const uno::Reference<beans::XPropertySet>& rXPropSet,
@@ -930,17 +942,12 @@ void FontworkHelpers::createCharFillPropsFromShape(
rCharPropVec.push_back(comphelper::makePropertyValue(u"CharColor",
sal_Int32(aColor)));
}
- const std::array<OUString, 5> aCharPropNames
- = { u"CharColorLumMod", u"CharColorLumOff", u"CharColorTheme",
u"CharComplexColor",
- u"CharTransparence" };
- const std::array<OUString, 5> aShapePropNames
- = { u"FillColorLumMod", u"FillColorLumOff", u"FillColorTheme",
u"FillComplexColor",
- u"FillTransparence" };
for (size_t i = 0; i < 5; i++)
{
- if (xPropSetInfo->hasPropertyByName(aShapePropNames[i]))
+ OUString aPropertyName(aShapePropNames[i]);
+ if (xPropSetInfo->hasPropertyByName(aPropertyName))
rCharPropVec.push_back(comphelper::makePropertyValue(
- aCharPropNames[i],
rXPropSet->getPropertyValue(aShapePropNames[i])));
+ OUString(aCharPropNames[i]),
rXPropSet->getPropertyValue(aPropertyName)));
}
}
@@ -1039,29 +1046,32 @@ typedef std::multimap<sal_Int32, GradientStopColor>
ColorMapType;
namespace
{
+constexpr const std::array<std::u16string_view, 12> W14ColorNames{
+ u"tx1", u"bg1", u"tx2", u"bg2", u"accent1", u"accent2",
+ u"accent3", u"accent4", u"accent5", u"accent6", u"hlink", u"folHlink"
+};
+
+constexpr const std::array<std::u16string_view, 12> WColorNames{
+ u"text1", u"background1", u"text2", u"background2", u"accent1",
u"accent2",
+ u"accent3", u"accent4", u"accent5", u"accent6", u"hyperlink",
u"followedHyperlink"
+};
+
// Returns the string to be used in w14:schemeClr in case of w14:textOutline
or w14:textFill
OUString lcl_getW14MarkupStringForThemeColor(const model::ComplexColor&
rComplexColor)
{
- const std::array<OUString, 12> W14ColorNames
- = { u"tx1", u"bg1", u"tx2", u"bg2", u"accent1",
u"accent2",
- u"accent3", u"accent4", u"accent5", u"accent6", u"hlink",
u"folHlink" };
const sal_uInt8 nClrNameIndex = std::clamp<sal_uInt8>(
sal_Int32(rComplexColor.getSchemeType()),
sal_Int32(model::ThemeColorType::Dark1),
sal_Int32(model::ThemeColorType::FollowedHyperlink));
- return W14ColorNames[nClrNameIndex];
+ return OUString(W14ColorNames[nClrNameIndex]);
}
// Returns the string to be used in w:themeColor. It is exported via
CharThemeColor.
OUString lcl_getWMarkupStringForThemeColor(const model::ComplexColor&
rComplexColor)
{
- const std::array<OUString, 12> WColorNames
- = { u"text1", u"background1", u"text2", u"background2",
- u"accent1", u"accent2", u"accent3", u"accent4",
- u"accent5", u"accent6", u"hyperlink", u"followedHyperlink" };
const sal_uInt8 nClrNameIndex = std::clamp<sal_uInt8>(
sal_Int32(rComplexColor.getSchemeType()),
sal_Int32(model::ThemeColorType::Dark1),
sal_Int32(model::ThemeColorType::FollowedHyperlink));
- return WColorNames[nClrNameIndex];
+ return OUString(WColorNames[nClrNameIndex]);
}
// Puts the value of the first occurrence of rType in rComplexColor into
rValue and returns true.
diff --git a/oox/source/drawingml/misccontexts.cxx
b/oox/source/drawingml/misccontexts.cxx
index 25058d392600..3de0538925b4 100644
--- a/oox/source/drawingml/misccontexts.cxx
+++ b/oox/source/drawingml/misccontexts.cxx
@@ -28,6 +28,9 @@
#include <vcl/GraphicExternalLink.hxx>
#include <vcl/graph.hxx>
#include <unordered_map>
+#include <frozen/bits/defines.h>
+#include <frozen/bits/elsa_std.h>
+#include <frozen/unordered_map.h>
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
@@ -143,7 +146,7 @@ ContextHandlerRef GradientFillContext::onCreateContext(
namespace
{
-std::unordered_map<sal_Int32, model::PatternPreset> constPatternPresetMap =
+static constexpr frozen::unordered_map<sal_Int32, model::PatternPreset, 54>
constPatternPresetMap
{
{ XML_pct5, model::PatternPreset::Percent_5 },
{ XML_pct10, model::PatternPreset::Percent_10 },
diff --git a/oox/source/drawingml/table/predefined-table-styles.cxx
b/oox/source/drawingml/table/predefined-table-styles.cxx
index 531e20b14512..f3f9082f2501 100644
--- a/oox/source/drawingml/table/predefined-table-styles.cxx
+++ b/oox/source/drawingml/table/predefined-table-styles.cxx
@@ -8,6 +8,9 @@
*/
#include <oox/token/tokens.hxx>
#include <drawingml/table/tablestyle.hxx>
+#include <frozen/bits/defines.h>
+#include <frozen/bits/elsa_std.h>
+#include <frozen/unordered_map.h>
using namespace oox;
using namespace oox::drawingml::table;
@@ -194,13 +197,18 @@ static void createStyleIdMap()
= std::make_pair(OUString("Dark-Style-2"), OUString("Accent5"));
}
-static std::map<OUString, sal_Int32> tokens = { { "", XML_dk1 },
- { "Accent1", XML_accent1 },
- { "Accent2", XML_accent2 },
- { "Accent3", XML_accent3 },
- { "Accent4", XML_accent4 },
- { "Accent5", XML_accent5 },
- { "Accent6", XML_accent6 } };
+static constexpr frozen::unordered_map<std::u16string_view, sal_Int32, 6>
tokens{
+ { u"Accent1", XML_accent1 }, { u"Accent2", XML_accent2 }, { u"Accent3",
XML_accent3 },
+ { u"Accent4", XML_accent4 }, { u"Accent5", XML_accent5 }, { u"Accent6",
XML_accent6 }
+};
+
+sal_Int32 resolveToken(OUString const& rString)
+{
+ auto interator = tokens.find(rString);
+ if (interator != tokens.end())
+ return interator->second;
+ return XML_dk1;
+}
void setBorderLineType(const oox::drawingml::LinePropertiesPtr& pLineProp,
sal_Int32 nToken)
{
@@ -444,7 +452,7 @@ std::unique_ptr<TableStyle> CreateTableStyle(const
OUString& styleId)
setBorderLineType(pLastColBottomBorder, XML_solidFill);
setBorderLineType(pLastColInsideHBorder, XML_solidFill);
- sal_Int32 accent_val = tokens[mStyleIdMap[styleId].second];
+ sal_Int32 accent_val = resolveToken(mStyleIdMap[styleId].second);
wholeTblTextColor.setSchemeClr(XML_dk1);
firstRowTextColor.setSchemeClr(XML_lt1);
@@ -509,7 +517,7 @@ std::unique_ptr<TableStyle> CreateTableStyle(const
OUString& styleId)
wholeTblTextColor.setSchemeClr(XML_lt1);
firstRowTextColor.setSchemeClr(XML_lt1);
- accent_val = tokens[mStyleIdMap[styleId].second];
+ accent_val = resolveToken(mStyleIdMap[styleId].second);
pTblBgFillProperties->maFillColor.setSchemeClr(accent_val);
pFirstRowBottomBorder->maLineFill.maFillColor.setSchemeClr(XML_lt1);
@@ -554,7 +562,7 @@ std::unique_ptr<TableStyle> CreateTableStyle(const
OUString& styleId)
sal_Int32 accent_val;
if (!accent_name.isEmpty())
- accent_val = tokens[mStyleIdMap[styleId].second];
+ accent_val = resolveToken(mStyleIdMap[styleId].second);
else
accent_val = XML_tx1;
@@ -591,7 +599,7 @@ std::unique_ptr<TableStyle> CreateTableStyle(const
OUString& styleId)
sal_Int32 accent_val;
if (!accent_name.isEmpty())
- accent_val = tokens[mStyleIdMap[styleId].second];
+ accent_val = resolveToken(mStyleIdMap[styleId].second);
else
accent_val = XML_tx1;
@@ -628,7 +636,7 @@ std::unique_ptr<TableStyle> CreateTableStyle(const
OUString& styleId)
sal_Int32 accent_val;
if (!accent_name.isEmpty())
- accent_val = tokens[mStyleIdMap[styleId].second];
+ accent_val = resolveToken(mStyleIdMap[styleId].second);
else
accent_val = XML_tx1;
@@ -665,7 +673,7 @@ std::unique_ptr<TableStyle> CreateTableStyle(const
OUString& styleId)
sal_Int32 accent_val;
if (!accent_name.isEmpty())
- accent_val = tokens[mStyleIdMap[styleId].second];
+ accent_val = resolveToken(mStyleIdMap[styleId].second);
else
accent_val = XML_dk1;
@@ -713,7 +721,7 @@ std::unique_ptr<TableStyle> CreateTableStyle(const
OUString& styleId)
sal_Int32 accent_val;
if (!accent_name.isEmpty())
- accent_val = tokens[mStyleIdMap[styleId].second];
+ accent_val = resolveToken(mStyleIdMap[styleId].second);
else
accent_val = XML_dk1;
@@ -753,7 +761,7 @@ std::unique_ptr<TableStyle> CreateTableStyle(const
OUString& styleId)
sal_Int32 accent_val;
if (!accent_name.isEmpty())
- accent_val = tokens[mStyleIdMap[styleId].second];
+ accent_val = resolveToken(mStyleIdMap[styleId].second);
else
accent_val = XML_dk1;
@@ -780,7 +788,7 @@ std::unique_ptr<TableStyle> CreateTableStyle(const
OUString& styleId)
sal_Int32 accent_val;
if (!accent_name.isEmpty())
- accent_val = tokens[mStyleIdMap[styleId].second];
+ accent_val = resolveToken(mStyleIdMap[styleId].second);
else
accent_val = XML_dk1;
@@ -823,7 +831,7 @@ std::unique_ptr<TableStyle> CreateTableStyle(const
OUString& styleId)
if (!accent_name.isEmpty())
{
- accent_val = tokens[mStyleIdMap[styleId].second];
+ accent_val = resolveToken(mStyleIdMap[styleId].second);
transform_val = XML_shade;
}
else
@@ -866,7 +874,7 @@ std::unique_ptr<TableStyle> CreateTableStyle(const
OUString& styleId)
sal_Int32 accent_val;
if (!accent_name.isEmpty())
- accent_val = tokens[mStyleIdMap[styleId].second];
+ accent_val = resolveToken(mStyleIdMap[styleId].second);
else
accent_val = XML_dk1;
diff --git a/oox/source/export/ThemeExport.cxx
b/oox/source/export/ThemeExport.cxx
index f09f9012e246..f60304155d9e 100644
--- a/oox/source/export/ThemeExport.cxx
+++ b/oox/source/export/ThemeExport.cxx
@@ -19,6 +19,9 @@
#include <sax/fastattribs.hxx>
#include <unordered_map>
#include <oox/export/drawingml.hxx>
+#include <frozen/bits/defines.h>
+#include <frozen/bits/elsa_std.h>
+#include <frozen/unordered_map.h>
namespace oox
{
@@ -142,16 +145,84 @@ bool ThemeExport::writeFontScheme(model::FontScheme
const& rFontScheme)
return true;
}
-void ThemeExport::writeColorTransformations(
- std::vector<model::Transformation> const& rTransformations)
+namespace
{
- static std::unordered_map<model::TransformationType, sal_Int32>
constTransformTypeTokenMap = {
+static constexpr frozen::unordered_map<model::TransformationType, sal_Int32, 4>
+ constTransformTypeTokenMap{
{ model::TransformationType::Tint, XML_tint },
{ model::TransformationType::Shade, XML_shade },
{ model::TransformationType::LumMod, XML_lumMod },
{ model::TransformationType::LumOff, XML_lumOff },
};
+static constexpr frozen::unordered_map<model::ThemeColorType, const char*, 12>
+ constThemeColorTypeTokenMap{ { model::ThemeColorType::Dark1, "dk1" },
+ { model::ThemeColorType::Light1, "lt1" },
+ { model::ThemeColorType::Dark2, "dk2" },
+ { model::ThemeColorType::Light2, "lt2" },
+ { model::ThemeColorType::Accent1, "accent1" },
+ { model::ThemeColorType::Accent2, "accent2" },
+ { model::ThemeColorType::Accent3, "accent3" },
+ { model::ThemeColorType::Accent4, "accent4" },
+ { model::ThemeColorType::Accent5, "accent5" },
+ { model::ThemeColorType::Accent6, "accent6" },
+ { model::ThemeColorType::Hyperlink, "hlink" },
+ { model::ThemeColorType::FollowedHyperlink,
"folHlink" } };
+
+static constexpr frozen::unordered_map<model::SystemColorType, const char*, 30>
+ constSystemColorTypeTokenMap{
+ { model::SystemColorType::DarkShadow3D, "3dDkShadow" },
+ { model::SystemColorType::Light3D, "3dLight" },
+ { model::SystemColorType::ActiveBorder, "activeBorder" },
+ { model::SystemColorType::ActiveCaption, "activeCaption" },
+ { model::SystemColorType::AppWorkspace, "appWorkspace" },
+ { model::SystemColorType::Background, "background" },
+ { model::SystemColorType::ButtonFace, "btnFace" },
+ { model::SystemColorType::ButtonHighlight, "btnHighlight" },
+ { model::SystemColorType::ButtonShadow, "btnShadow" },
+ { model::SystemColorType::ButtonText, "btnText" },
+ { model::SystemColorType::CaptionText, "captionText" },
+ { model::SystemColorType::GradientActiveCaption,
"gradientActiveCaption" },
+ { model::SystemColorType::GradientInactiveCaption,
"gradientInactiveCaption" },
+ { model::SystemColorType::GrayText, "grayText" },
+ { model::SystemColorType::Highlight, "highlight" },
+ { model::SystemColorType::HighlightText, "highlightText" },
+ { model::SystemColorType::HotLight, "hotLight" },
+ { model::SystemColorType::InactiveBorder, "inactiveBorder" },
+ { model::SystemColorType::InactiveCaption, "inactiveCaption" },
+ { model::SystemColorType::InactiveCaptionText, "inactiveCaptionText" },
+ { model::SystemColorType::InfoBack, "infoBk" },
+ { model::SystemColorType::InfoText, "infoText" },
+ { model::SystemColorType::Menu, "menu" },
+ { model::SystemColorType::MenuBar, "menuBar" },
+ { model::SystemColorType::MenuHighlight, "menuHighlight" },
+ { model::SystemColorType::MenuText, "menuText" },
+ { model::SystemColorType::ScrollBar, "scrollBar" },
+ { model::SystemColorType::Window, "window" },
+ { model::SystemColorType::WindowFrame, "windowFrame" },
+ { model::SystemColorType::WindowText, "windowText" }
+ };
+
+static constexpr frozen::unordered_map<sal_Int32, model::ThemeColorType, 12>
constTokenMap{
+ { XML_dk1, model::ThemeColorType::Dark1 },
+ { XML_lt1, model::ThemeColorType::Light1 },
+ { XML_dk2, model::ThemeColorType::Dark2 },
+ { XML_lt2, model::ThemeColorType::Light2 },
+ { XML_accent1, model::ThemeColorType::Accent1 },
+ { XML_accent2, model::ThemeColorType::Accent2 },
+ { XML_accent3, model::ThemeColorType::Accent3 },
+ { XML_accent4, model::ThemeColorType::Accent4 },
+ { XML_accent5, model::ThemeColorType::Accent5 },
+ { XML_accent6, model::ThemeColorType::Accent6 },
+ { XML_hlink, model::ThemeColorType::Hyperlink },
+ { XML_folHlink, model::ThemeColorType::FollowedHyperlink }
+};
+
+} // end anonymous ns
+
+void ThemeExport::writeColorTransformations(
+ std::vector<model::Transformation> const& rTransformations)
+{
for (model::Transformation const& rTransformation : rTransformations)
{
auto iterator =
constTransformTypeTokenMap.find(rTransformation.meType);
@@ -191,19 +262,6 @@ void ThemeExport::writeColorHSL(model::ComplexColor const&
rComplexColor)
void ThemeExport::writeColorScheme(model::ComplexColor const& rComplexColor)
{
- static std::unordered_map<model::ThemeColorType, const char*>
constThemeColorTypeTokenMap
- = { { model::ThemeColorType::Dark1, "dk1" },
- { model::ThemeColorType::Light1, "lt1" },
- { model::ThemeColorType::Dark2, "dk2" },
- { model::ThemeColorType::Light2, "lt2" },
- { model::ThemeColorType::Accent1, "accent1" },
- { model::ThemeColorType::Accent2, "accent2" },
- { model::ThemeColorType::Accent3, "accent3" },
- { model::ThemeColorType::Accent4, "accent4" },
- { model::ThemeColorType::Accent5, "accent5" },
- { model::ThemeColorType::Accent6, "accent6" },
- { model::ThemeColorType::Hyperlink, "hlink" },
- { model::ThemeColorType::FollowedHyperlink, "folHlink" } };
auto iterator =
constThemeColorTypeTokenMap.find(rComplexColor.meSchemeType);
if (iterator != constThemeColorTypeTokenMap.end())
{
@@ -216,40 +274,8 @@ void ThemeExport::writeColorScheme(model::ComplexColor
const& rComplexColor)
void ThemeExport::writeColorSystem(model::ComplexColor const& rComplexColor)
{
- static std::unordered_map<model::SystemColorType, const char*>
constThemeColorTypeTokenMap = {
- { model::SystemColorType::DarkShadow3D, "3dDkShadow" },
- { model::SystemColorType::Light3D, "3dLight" },
- { model::SystemColorType::ActiveBorder, "activeBorder" },
- { model::SystemColorType::ActiveCaption, "activeCaption" },
- { model::SystemColorType::AppWorkspace, "appWorkspace" },
- { model::SystemColorType::Background, "background" },
- { model::SystemColorType::ButtonFace, "btnFace" },
- { model::SystemColorType::ButtonHighlight, "btnHighlight" },
- { model::SystemColorType::ButtonShadow, "btnShadow" },
- { model::SystemColorType::ButtonText, "btnText" },
- { model::SystemColorType::CaptionText, "captionText" },
- { model::SystemColorType::GradientActiveCaption,
"gradientActiveCaption" },
- { model::SystemColorType::GradientInactiveCaption,
"gradientInactiveCaption" },
- { model::SystemColorType::GrayText, "grayText" },
- { model::SystemColorType::Highlight, "highlight" },
- { model::SystemColorType::HighlightText, "highlightText" },
- { model::SystemColorType::HotLight, "hotLight" },
- { model::SystemColorType::InactiveBorder, "inactiveBorder" },
- { model::SystemColorType::InactiveCaption, "inactiveCaption" },
- { model::SystemColorType::InactiveCaptionText, "inactiveCaptionText" },
- { model::SystemColorType::InfoBack, "infoBk" },
- { model::SystemColorType::InfoText, "infoText" },
- { model::SystemColorType::Menu, "menu" },
- { model::SystemColorType::MenuBar, "menuBar" },
- { model::SystemColorType::MenuHighlight, "menuHighlight" },
- { model::SystemColorType::MenuText, "menuText" },
- { model::SystemColorType::ScrollBar, "scrollBar" },
- { model::SystemColorType::Window, "window" },
- { model::SystemColorType::WindowFrame, "windowFrame" },
- { model::SystemColorType::WindowText, "windowText" },
- };
- auto iterator =
constThemeColorTypeTokenMap.find(rComplexColor.meSystemColorType);
- if (iterator != constThemeColorTypeTokenMap.end())
+ auto iterator =
constSystemColorTypeTokenMap.find(rComplexColor.meSystemColorType);
+ if (iterator != constSystemColorTypeTokenMap.end())
{
const char* sValue = iterator->second;
mpFS->startElementNS(XML_a, XML_sysClr, XML_val, sValue);
@@ -844,21 +870,7 @@ bool ThemeExport::writeFormatScheme(model::FormatScheme
const& rFormatScheme)
bool ThemeExport::writeColorSet(model::Theme const& rTheme)
{
- static std::unordered_map<sal_Int32, model::ThemeColorType> constTokenMap
- = { { XML_dk1, model::ThemeColorType::Dark1 },
- { XML_lt1, model::ThemeColorType::Light1 },
- { XML_dk2, model::ThemeColorType::Dark2 },
- { XML_lt2, model::ThemeColorType::Light2 },
- { XML_accent1, model::ThemeColorType::Accent1 },
- { XML_accent2, model::ThemeColorType::Accent2 },
- { XML_accent3, model::ThemeColorType::Accent3 },
- { XML_accent4, model::ThemeColorType::Accent4 },
- { XML_accent5, model::ThemeColorType::Accent5 },
- { XML_accent6, model::ThemeColorType::Accent6 },
- { XML_hlink, model::ThemeColorType::Hyperlink },
- { XML_folHlink, model::ThemeColorType::FollowedHyperlink } };
-
- static std::array<sal_Int32, 12> constTokenArray
+ static const constexpr std::array<sal_Int32, 12> constTokenArray
= { XML_dk1, XML_lt1, XML_dk2, XML_lt2, XML_accent1,
XML_accent2,
XML_accent3, XML_accent4, XML_accent5, XML_accent6, XML_hlink,
XML_folHlink };
@@ -868,11 +880,15 @@ bool ThemeExport::writeColorSet(model::Theme const&
rTheme)
for (auto nToken : constTokenArray)
{
- model::ThemeColorType eColorType = constTokenMap[nToken];
- Color aColor = pColorSet->getColor(eColorType);
- mpFS->startElementNS(XML_a, nToken);
- mpFS->singleElementNS(XML_a, XML_srgbClr, XML_val,
I32SHEX(sal_Int32(aColor)));
- mpFS->endElementNS(XML_a, nToken);
+ auto iterator = constTokenMap.find(nToken);
+ if (iterator != constTokenMap.end())
+ {
+ model::ThemeColorType eColorType = iterator->second;
+ Color aColor = pColorSet->getColor(eColorType);
+ mpFS->startElementNS(XML_a, nToken);
+ mpFS->singleElementNS(XML_a, XML_srgbClr, XML_val,
I32SHEX(sal_Int32(aColor)));
+ mpFS->endElementNS(XML_a, nToken);
+ }
}
return true;
diff --git a/oox/source/token/relationship.cxx
b/oox/source/token/relationship.cxx
index cfe1dedc508d..7cc0bb002fe0 100644
--- a/oox/source/token/relationship.cxx
+++ b/oox/source/token/relationship.cxx
@@ -10,21 +10,28 @@
#include <oox/token/relationship.hxx>
#include <sal/log.hxx>
-#include <map>
+#include <frozen/bits/defines.h>
+#include <frozen/bits/elsa_std.h>
+#include <frozen/unordered_map.h>
-namespace oox {
+namespace oox
+{
-OUString getRelationship(Relationship eRelationship)
+namespace
+{
+
+static constexpr frozen::unordered_map<Relationship, std::u16string_view, 48>
constRelationshipMap
{
- static const std::map<Relationship, OUString> aMap =
- {
#include "relationship.inc"
- };
+};
- auto itr = aMap.find(eRelationship);
- if (itr != aMap.end())
- return itr->second;
+} // end anonymous ns
+OUString getRelationship(Relationship eRelationship)
+{
+ auto iterator = constRelationshipMap.find(eRelationship);
+ if (iterator != constRelationshipMap.end())
+ return OUString(iterator->second);
SAL_WARN("oox", "could not find an entry for the relationship: " <<
static_cast<int>(eRelationship));
return OUString();
}
diff --git a/oox/source/token/relationship.inc
b/oox/source/token/relationship.inc
index 4a772671a96f..5b2f16b9264c 100644
--- a/oox/source/token/relationship.inc
+++ b/oox/source/token/relationship.inc
@@ -1,48 +1,48 @@
-{Relationship::ACTIVEXCONTROLBINARY,
"http://schemas.microsoft.com/office/2006/relationships/activeXControlBinary"},
-{Relationship::CHART,
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart"},
-{Relationship::CHARTUSERSHAPES,
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chartUserShapes"},
-{Relationship::COMMENTS,
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments"},
-{Relationship::COMMENTAUTHORS,
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/commentAuthors"},
-{Relationship::COMMENTSEXTENDED,
"http://schemas.microsoft.com/office/2011/relationships/commentsExtended"},
-{Relationship::CONTROL,
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/control"},
-{Relationship::CTRLPROP,
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/ctrlProp"},
-{Relationship::CUSTOMXML,
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml"},
-{Relationship::CUSTOMXMLPROPS,
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps"},
-{Relationship::DIAGRAMCOLORS,
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramColors"},
-{Relationship::DIAGRAMDATA,
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramData"},
-{Relationship::DIAGRAMDRAWING,
"http://schemas.microsoft.com/office/2007/relationships/diagramDrawing"},
-{Relationship::DIAGRAMLAYOUT,
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramLayout"},
-{Relationship::DIAGRAMQUICKSTYLE,
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramQuickStyle"},
-{Relationship::DRAWING,
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing"},
-{Relationship::ENDNOTES,
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes"},
-{Relationship::EXTERNALLINKPATH,
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLinkPath"},
-{Relationship::FONT,
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/font"},
-{Relationship::FONTTABLE,
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable"},
-{Relationship::FOOTER,
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer"},
-{Relationship::FOOTNOTES,
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes"},
-{Relationship::GLOSSARYDOCUMENT,
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/glossaryDocument"},
-{Relationship::HDPHOTO,
"http://schemas.microsoft.com/office/2007/relationships/hdphoto"},
-{Relationship::HEADER,
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/header"},
-{Relationship::HYPERLINK,
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink"},
-{Relationship::IMAGE,
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image"},
-{Relationship::MEDIA,
"http://schemas.microsoft.com/office/2007/relationships/media"},
-{Relationship::NOTESMASTER,
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesMaster"},
-{Relationship::NOTESSLIDE,
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesSlide"},
-{Relationship::NUMBERING,
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering"},
-{Relationship::OFFICEDOCUMENT,
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"},
-{Relationship::OLEOBJECT,
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject"},
-{Relationship::PACKAGE,
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/package"},
-{Relationship::PRESPROPS,
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/presProps"},
-{Relationship::SETTINGS,
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings"},
-{Relationship::SHAREDSTRINGS,
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings"},
-{Relationship::SLIDE,
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide"},
-{Relationship::SLIDELAYOUT,
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout"},
-{Relationship::SLIDEMASTER,
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster"},
-{Relationship::STYLES,
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles"},
-{Relationship::THEME,
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme"},
-{Relationship::VBAPROJECT,
"http://schemas.microsoft.com/office/2006/relationships/vbaProject"},
-{Relationship::VIDEO,
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/video"},
-{Relationship::AUDIO,
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/audio"},
-{Relationship::VMLDRAWING,
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing"},
-{Relationship::WORDVBADATA,
"http://schemas.microsoft.com/office/2006/relationships/wordVbaData"},
-{Relationship::WORKSHEET,
"http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet"}
+{Relationship::ACTIVEXCONTROLBINARY,
u"http://schemas.microsoft.com/office/2006/relationships/activeXControlBinary"},
+{Relationship::CHART,
u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart"},
+{Relationship::CHARTUSERSHAPES,
u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chartUserShapes"},
+{Relationship::COMMENTS,
u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments"},
+{Relationship::COMMENTAUTHORS,
u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/commentAuthors"},
+{Relationship::COMMENTSEXTENDED,
u"http://schemas.microsoft.com/office/2011/relationships/commentsExtended"},
+{Relationship::CONTROL,
u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/control"},
+{Relationship::CTRLPROP,
u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/ctrlProp"},
+{Relationship::CUSTOMXML,
u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXml"},
+{Relationship::CUSTOMXMLPROPS,
u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/customXmlProps"},
+{Relationship::DIAGRAMCOLORS,
u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramColors"},
+{Relationship::DIAGRAMDATA,
u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramData"},
+{Relationship::DIAGRAMDRAWING,
u"http://schemas.microsoft.com/office/2007/relationships/diagramDrawing"},
+{Relationship::DIAGRAMLAYOUT,
u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramLayout"},
+{Relationship::DIAGRAMQUICKSTYLE,
u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/diagramQuickStyle"},
+{Relationship::DRAWING,
u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing"},
+{Relationship::ENDNOTES,
u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes"},
+{Relationship::EXTERNALLINKPATH,
u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLinkPath"},
+{Relationship::FONT,
u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/font"},
+{Relationship::FONTTABLE,
u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable"},
+{Relationship::FOOTER,
u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer"},
+{Relationship::FOOTNOTES,
u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes"},
+{Relationship::GLOSSARYDOCUMENT,
u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/glossaryDocument"},
+{Relationship::HDPHOTO,
u"http://schemas.microsoft.com/office/2007/relationships/hdphoto"},
+{Relationship::HEADER,
u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/header"},
+{Relationship::HYPERLINK,
u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink"},
+{Relationship::IMAGE,
u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image"},
+{Relationship::MEDIA,
u"http://schemas.microsoft.com/office/2007/relationships/media"},
+{Relationship::NOTESMASTER,
u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesMaster"},
+{Relationship::NOTESSLIDE,
u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/notesSlide"},
+{Relationship::NUMBERING,
u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering"},
+{Relationship::OFFICEDOCUMENT,
u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument"},
+{Relationship::OLEOBJECT,
u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject"},
+{Relationship::PACKAGE,
u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/package"},
+{Relationship::PRESPROPS,
u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/presProps"},
+{Relationship::SETTINGS,
u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings"},
+{Relationship::SHAREDSTRINGS,
u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings"},
+{Relationship::SLIDE,
u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slide"},
+{Relationship::SLIDELAYOUT,
u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideLayout"},
+{Relationship::SLIDEMASTER,
u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/slideMaster"},
+{Relationship::STYLES,
u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles"},
+{Relationship::THEME,
u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme"},
+{Relationship::VBAPROJECT,
u"http://schemas.microsoft.com/office/2006/relationships/vbaProject"},
+{Relationship::VIDEO,
u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/video"},
+{Relationship::AUDIO,
u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/audio"},
+{Relationship::VMLDRAWING,
u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing"},
+{Relationship::WORDVBADATA,
u"http://schemas.microsoft.com/office/2006/relationships/wordVbaData"},
+{Relationship::WORKSHEET,
u"http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet"}
diff --git a/writerfilter/Library_writerfilter.mk
b/writerfilter/Library_writerfilter.mk
index 3e0662b4fb35..85afb7e598cd 100644
--- a/writerfilter/Library_writerfilter.mk
+++ b/writerfilter/Library_writerfilter.mk
@@ -56,6 +56,7 @@ $(eval $(call gb_Library_use_externals,writerfilter,\
icuuc \
icu_headers \
libxml2 \
+ frozen \
))
$(eval $(call gb_Library_add_exception_objects,writerfilter,\
diff --git a/writerfilter/source/dmapper/PropertyIds.cxx
b/writerfilter/source/dmapper/PropertyIds.cxx
index f809d54432c8..623161135a26 100644
--- a/writerfilter/source/dmapper/PropertyIds.cxx
+++ b/writerfilter/source/dmapper/PropertyIds.cxx
@@ -18,13 +18,16 @@
*/
#include <rtl/ustring.hxx>
#include "PropertyIds.hxx"
-#include <unordered_map>
+#include <frozen/bits/defines.h>
+#include <frozen/bits/elsa_std.h>
+#include <frozen/unordered_map.h>
namespace writerfilter::dmapper{
-const OUString & getPropertyName( PropertyIds eId )
+namespace
{
- static const std::unordered_map<PropertyIds, OUString> map {
+ constexpr const frozen::unordered_map<PropertyIds, std::u16string_view,
347> constPropertyMap
+ {
{ PROP_CHAR_WEIGHT, u"CharWeight"},
{ PROP_CHAR_POSTURE, u"CharPosture"},
{ PROP_CHAR_STRIKEOUT, u"CharStrikeout"},
@@ -373,7 +376,15 @@ const OUString & getPropertyName( PropertyIds eId )
{ PROP_PARA_CONNECT_BORDERS, u"ParaIsConnectBorder"},
{ PROP_DECORATIVE, u"Decorative"},
};
- return map.at(eId);
+} // end anonymous ns
+
+OUString getPropertyName( PropertyIds eId )
+{
+ auto iterator = constPropertyMap.find(eId);
+ if (iterator != constPropertyMap.end())
+ return OUString(iterator->second);
+
+ return OUString();
}
bool isCharacterProperty( const PropertyIds eId )
diff --git a/writerfilter/source/dmapper/PropertyIds.hxx
b/writerfilter/source/dmapper/PropertyIds.hxx
index 60d6537ae6c2..d3213b7be073 100644
--- a/writerfilter/source/dmapper/PropertyIds.hxx
+++ b/writerfilter/source/dmapper/PropertyIds.hxx
@@ -377,7 +377,7 @@ enum PropertyIds
};
//Returns the UNO string equivalent to eId.
-const OUString & getPropertyName(PropertyIds eId);
+OUString getPropertyName(PropertyIds eId);
bool isCharacterProperty(const PropertyIds eId);
diff --git a/xmloff/Library_xo.mk b/xmloff/Library_xo.mk
index d2b539d514d9..8e7f3208bfe9 100644
--- a/xmloff/Library_xo.mk
+++ b/xmloff/Library_xo.mk
@@ -41,7 +41,10 @@ $(eval $(call gb_Library_add_defs,xo,\
-DXMLOFF_DLLIMPLEMENTATION \
))
-$(eval $(call gb_Library_use_external,xo,boost_headers))
+$(eval $(call gb_Library_use_externals,xo,\
+ boost_headers \
+ frozen \
+))
$(eval $(call gb_Library_use_custom_headers,xo,\
officecfg/registry \
diff --git a/xmloff/source/style/XMLRtlGutterPropertyHandler.cxx
b/xmloff/source/style/XMLRtlGutterPropertyHandler.cxx
index 651406f0fa2b..34fa8f036f65 100644
--- a/xmloff/source/style/XMLRtlGutterPropertyHandler.cxx
+++ b/xmloff/source/style/XMLRtlGutterPropertyHandler.cxx
@@ -18,11 +18,10 @@
*/
#include <XMLRtlGutterPropertyHandler.hxx>
-
-#include <set>
-
+#include <frozen/bits/defines.h>
+#include <frozen/bits/elsa_std.h>
+#include <frozen/unordered_set.h>
#include <com/sun/star/uno/Any.hxx>
-
#include <xmloff/xmluconv.hxx>
using namespace com::sun::star;
@@ -31,13 +30,18 @@ XMLRtlGutterPropertyHandler::XMLRtlGutterPropertyHandler()
= default;
XMLRtlGutterPropertyHandler::~XMLRtlGutterPropertyHandler() = default;
+namespace
+{
+constexpr const frozen::unordered_set<std::u16string_view, 4> constRtlModes{
u"rl-tb", u"tb-rl",
+
u"rl", u"tb" };
+}
+
bool XMLRtlGutterPropertyHandler::importXML(const OUString& rStrImpValue,
uno::Any& rValue,
const SvXMLUnitConverter&) const
{
// Infer RtlGutter from WritingMode.
- std::set<OUString> aRtlModes = { "rl-tb", "tb-rl", "rl", "tb" };
- auto it = aRtlModes.find(rStrImpValue);
- rValue <<= (it != aRtlModes.end());
+ auto it = constRtlModes.find(rStrImpValue);
+ rValue <<= (it != constRtlModes.end());
return true;
}