From 216c21050ed90a3c80c4d59abbec800e495f2a79 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 13 May 2022 12:12:47 +0200 Subject: elid some OUString construction in SmXMLExportWrapper::Export Change-Id: Icc091a7fab3c9ce368bd45536de1e75d29431c56 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134314 Tested-by: Jenkins Reviewed-by: Noel Grandin --- starmath/source/mathml/mathmlexport.cxx | 33 ++++++++++++++++++++------------- 1 file changed, 20 insertions(+), 13 deletions(-) (limited to 'starmath') diff --git a/starmath/source/mathml/mathmlexport.cxx b/starmath/source/mathml/mathmlexport.cxx index 0fb2573b5b80..64640ae0d96a 100644 --- a/starmath/source/mathml/mathmlexport.cxx +++ b/starmath/source/mathml/mathmlexport.cxx @@ -128,27 +128,31 @@ bool SmXMLExportWrapper::Export(SfxMedium& rMedium) } } + static constexpr OUStringLiteral sUsePrettyPrinting(u"UsePrettyPrinting"); + static constexpr OUStringLiteral sBaseURI(u"BaseURI"); + static constexpr OUStringLiteral sStreamRelPath(u"StreamRelPath"); + static constexpr OUStringLiteral sStreamName(u"StreamName"); + // create XPropertySet with three properties for status indicator comphelper::PropertyMapEntry aInfoMap[] - = { { OUString("UsePrettyPrinting"), 0, cppu::UnoType::get(), - beans::PropertyAttribute::MAYBEVOID, 0 }, - { OUString("BaseURI"), 0, ::cppu::UnoType::get(), - beans::PropertyAttribute::MAYBEVOID, 0 }, - { OUString("StreamRelPath"), 0, ::cppu::UnoType::get(), + = { { sUsePrettyPrinting, 0, cppu::UnoType::get(), beans::PropertyAttribute::MAYBEVOID, 0 }, - { OUString("StreamName"), 0, ::cppu::UnoType::get(), + { sBaseURI, 0, ::cppu::UnoType::get(), beans::PropertyAttribute::MAYBEVOID, + 0 }, + { sStreamRelPath, 0, ::cppu::UnoType::get(), beans::PropertyAttribute::MAYBEVOID, 0 }, + { sStreamName, 0, ::cppu::UnoType::get(), beans::PropertyAttribute::MAYBEVOID, + 0 }, { OUString(), 0, css::uno::Type(), 0, 0 } }; uno::Reference xInfoSet( comphelper::GenericPropertySet_CreateInstance(new comphelper::PropertySetInfo(aInfoMap))); bool bUsePrettyPrinting = bFlat || officecfg::Office::Common::Save::Document::PrettyPrinting::get(); - xInfoSet->setPropertyValue("UsePrettyPrinting", Any(bUsePrettyPrinting)); + xInfoSet->setPropertyValue(sUsePrettyPrinting, Any(bUsePrettyPrinting)); // Set base URI - OUString sPropName("BaseURI"); - xInfoSet->setPropertyValue(sPropName, Any(rMedium.GetBaseURL(true))); + xInfoSet->setPropertyValue(sBaseURI, Any(rMedium.GetBaseURL(true))); sal_Int32 nSteps = 0; if (xStatusIndicator.is()) @@ -172,8 +176,7 @@ bool SmXMLExportWrapper::Export(SfxMedium& rMedium) if (!aName.isEmpty()) { - sPropName = "StreamRelPath"; - xInfoSet->setPropertyValue(sPropName, Any(aName)); + xInfoSet->setPropertyValue(sStreamRelPath, Any(aName)); } } @@ -292,10 +295,14 @@ bool SmXMLExportWrapper::WriteThroughComponent(const Reference& } uno::Reference xSet(xStream, uno::UNO_QUERY); - xSet->setPropertyValue("MediaType", Any(OUString("text/xml"))); + static const OUStringLiteral sMediaType = u"MediaType"; + static const OUStringLiteral sTextXml = u"text/xml"; + xSet->setPropertyValue(sMediaType, Any(OUString(sTextXml))); // all streams must be encrypted in encrypted document - xSet->setPropertyValue("UseCommonStoragePasswordEncryption", Any(true)); + static const OUStringLiteral sUseCommonStoragePasswordEncryption + = u"UseCommonStoragePasswordEncryption"; + xSet->setPropertyValue(sUseCommonStoragePasswordEncryption, Any(true)); // set Base URL if (rPropSet.is()) -- cgit