diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-05-03 10:43:13 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2024-05-06 08:26:07 +0200 |
commit | 3c5424629903299c92f27a35bb287bea824fa007 (patch) | |
tree | 83094fda29dc4a929adda36c490a3eb5ee0b3161 /xmloff | |
parent | 11bf2d8599bd6262d7d1b24d04bf52440daeb4b1 (diff) |
replace createFromAscii with OUString literals in XMLSectionExport
Change-Id: Ia9c4c7ad04bb17e24b017bef074e5636f3a960a7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167167
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'xmloff')
-rw-r--r-- | xmloff/source/text/XMLSectionExport.cxx | 53 |
1 files changed, 26 insertions, 27 deletions
diff --git a/xmloff/source/text/XMLSectionExport.cxx b/xmloff/source/text/XMLSectionExport.cxx index c26faca46a2e..702b5dc047ab 100644 --- a/xmloff/source/text/XMLSectionExport.cxx +++ b/xmloff/source/text/XMLSectionExport.cxx @@ -930,29 +930,29 @@ static const XMLTokenEnum* aTypeLevelNameMap[] = aLevelNameBibliographyMap // bibliography }; -static const char* aLevelStylePropNameTOCMap[] = - { nullptr, "ParaStyleLevel1", "ParaStyleLevel2", "ParaStyleLevel3", - "ParaStyleLevel4", "ParaStyleLevel5", "ParaStyleLevel6", - "ParaStyleLevel7", "ParaStyleLevel8", "ParaStyleLevel9", - "ParaStyleLevel10", nullptr }; -static const char* aLevelStylePropNameTableMap[] = - { nullptr, "ParaStyleLevel1", nullptr }; -static const char* aLevelStylePropNameAlphaMap[] = - { nullptr, "ParaStyleSeparator", "ParaStyleLevel1", "ParaStyleLevel2", - "ParaStyleLevel3", nullptr }; -static const char* aLevelStylePropNameBibliographyMap[] = +constexpr OUString aLevelStylePropNameTOCMap[] = + { u""_ustr, u"ParaStyleLevel1"_ustr, u"ParaStyleLevel2"_ustr, u"ParaStyleLevel3"_ustr, + u"ParaStyleLevel4"_ustr, u"ParaStyleLevel5"_ustr, u"ParaStyleLevel6"_ustr, + u"ParaStyleLevel7"_ustr, u"ParaStyleLevel8"_ustr, u"ParaStyleLevel9"_ustr, + u"ParaStyleLevel10"_ustr, u""_ustr }; +constexpr OUString aLevelStylePropNameTableMap[] = + { u""_ustr, u"ParaStyleLevel1"_ustr, u""_ustr }; +constexpr OUString aLevelStylePropNameAlphaMap[] = + { u""_ustr, u"ParaStyleSeparator"_ustr, u"ParaStyleLevel1"_ustr, u"ParaStyleLevel2"_ustr, + u"ParaStyleLevel3"_ustr, u""_ustr }; +constexpr OUString aLevelStylePropNameBibliographyMap[] = // TODO: replace with real property names, when available - { nullptr, "ParaStyleLevel1", "ParaStyleLevel1", "ParaStyleLevel1", - "ParaStyleLevel1", "ParaStyleLevel1", "ParaStyleLevel1", - "ParaStyleLevel1", "ParaStyleLevel1", "ParaStyleLevel1", - "ParaStyleLevel1", "ParaStyleLevel1", "ParaStyleLevel1", - "ParaStyleLevel1", "ParaStyleLevel1", "ParaStyleLevel1", - "ParaStyleLevel1", "ParaStyleLevel1", "ParaStyleLevel1", - "ParaStyleLevel1", "ParaStyleLevel1", "ParaStyleLevel1", - "ParaStyleLevel1", - nullptr }; - -static const char** aTypeLevelStylePropNameMap[] = + { u""_ustr, u"ParaStyleLevel1"_ustr, u"ParaStyleLevel1"_ustr, u"ParaStyleLevel1"_ustr, + u"ParaStyleLevel1"_ustr, u"ParaStyleLevel1"_ustr, u"ParaStyleLevel1"_ustr, + u"ParaStyleLevel1"_ustr, u"ParaStyleLevel1"_ustr, u"ParaStyleLevel1"_ustr, + u"ParaStyleLevel1"_ustr, u"ParaStyleLevel1"_ustr, u"ParaStyleLevel1"_ustr, + u"ParaStyleLevel1"_ustr, u"ParaStyleLevel1"_ustr,u"ParaStyleLevel1"_ustr, + u"ParaStyleLevel1"_ustr, u"ParaStyleLevel1"_ustr, u"ParaStyleLevel1"_ustr, + u"ParaStyleLevel1"_ustr, u"ParaStyleLevel1"_ustr, u"ParaStyleLevel1"_ustr, + u"ParaStyleLevel1"_ustr, + u""_ustr }; + +constexpr const OUString* aTypeLevelStylePropNameMap[] = { aLevelStylePropNameTOCMap, // TOC aLevelStylePropNameTableMap, // table index @@ -1027,13 +1027,12 @@ bool XMLSectionExport::ExportIndexTemplate( } // paragraph level style name - const char* pPropName( + const OUString pPropName( aTypeLevelStylePropNameMap[eType-TEXT_SECTION_TYPE_TOC][nOutlineLevel]); - OSL_ENSURE(nullptr != pPropName, "can't find property name"); - if (nullptr != pPropName) + OSL_ENSURE(!pPropName.isEmpty(), "can't find property name"); + if (!pPropName.isEmpty()) { - Any aAny = rPropertySet->getPropertyValue( - OUString::createFromAscii(pPropName)); + Any aAny = rPropertySet->getPropertyValue(pPropName); OUString sParaStyleName; aAny >>= sParaStyleName; GetExport().AddAttribute(XML_NAMESPACE_TEXT, |