oox : use more frozen unordered_map to avoid allocations

Change-Id: I05bc2deedf4e3d4a60ac59049f98596211ae40ca
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/205675
Tested-by: Jenkins
Reviewed-by: Arnaud Versini <arnaud.versini@pm.me>
This commit is contained in:
Arnaud Versini
2026-06-08 08:53:36 +02:00
parent a94bce360d
commit 9de2f95044
+3 -3
View File
@@ -1499,19 +1499,19 @@ void ChartExport::WriteChartObj( const Reference< XShape >& xShape, sal_Int32 nI
if (!aCSS->maEntryList.empty()) {
// use the stored data in the document model
static const std::map<model::ColorStyleMethod, std::string> aMethMap {
static constexpr auto aMethMap = frozen::make_unordered_map<model::ColorStyleMethod, const char*> ({
{ model::ColorStyleMethod::CYCLE, "cycle" },
{ model::ColorStyleMethod::WITHIN_LINEAR, "withinLinear" },
{ model::ColorStyleMethod::ACROSS_LINEAR, "acrossLinear" },
{ model::ColorStyleMethod::WITHIN_LINEAR_REVERSED, "withinLinearReversed" },
{ model::ColorStyleMethod::ACROSS_LINEAR_REVERSED, "acrossLinearReversed" }
};
});
for (const model::ColorStyleEntry& rCStyleEntry : aCSS->maEntryList) {
pFS->startElement(FSNS(XML_cs, XML_colorStyle),
FSNS( XML_xmlns, XML_cs ), pFB->getNamespaceURL(OOX_NS(cs)),
FSNS( XML_xmlns, XML_a ), pFB->getNamespaceURL(OOX_NS(dml)),
XML_meth, aMethMap.at(rCStyleEntry.meMethod).c_str(),
XML_meth, aMethMap.at(rCStyleEntry.meMethod),
XML_id, OUString::number(rCStyleEntry.mnId));
ThemeExport aTE(mpFB, GetDocumentType(), pFS);