xmloff/source/draw/XMLNumberStyles.cxx | 70 ++++++++++++++++----------------- xmloff/source/forms/elementimport.cxx | 14 +++--- xmloff/source/forms/elementimport.hxx | 2 3 files changed, 43 insertions(+), 43 deletions(-)
New commits: commit 719c8f44780c2c9c4096c5ea3582fd4b55b095ef Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Fri May 3 10:15:17 2024 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Sun May 5 19:33:46 2024 +0200 replace createFromAscii with OUString literals in OElementImport Change-Id: Ic6e93f47b903b69f1d8a15fc62be138c13b7b01a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167156 Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> Tested-by: Jenkins diff --git a/xmloff/source/forms/elementimport.cxx b/xmloff/source/forms/elementimport.cxx index 7b7609107560..a135d7e1795a 100644 --- a/xmloff/source/forms/elementimport.cxx +++ b/xmloff/source/forms/elementimport.cxx @@ -580,14 +580,14 @@ namespace xmloff m_rEventManager.registerEvents(m_xElement, _rEvents); } - void OElementImport::simulateDefaultedAttribute(sal_Int32 nElement, const OUString& _rPropertyName, const char* _pAttributeDefault) + void OElementImport::simulateDefaultedAttribute(sal_Int32 nElement, const OUString& _rPropertyName, const OUString& _pAttributeDefault) { OSL_ENSURE( m_xInfo.is(), "OPropertyImport::simulateDefaultedAttribute: the component should be more gossipy about it's properties!" ); if ( !m_xInfo.is() || m_xInfo->hasPropertyByName( _rPropertyName ) ) { if ( !encounteredAttribute( nElement ) ) - OSL_VERIFY( handleAttribute( XML_ELEMENT(FORM, (nElement & TOKEN_MASK)), OUString::createFromAscii( _pAttributeDefault ) ) ); + OSL_VERIFY( handleAttribute( XML_ELEMENT(FORM, (nElement & TOKEN_MASK)), _pAttributeDefault ) ); } } @@ -1258,7 +1258,7 @@ namespace xmloff OURLReferenceImport::startFastElement(nElement, _rxAttrList); // handle the target-frame attribute - simulateDefaultedAttribute(OAttributeMetaData::getCommonControlAttributeToken(CCAFlags::TargetFrame), PROPERTY_TARGETFRAME, "_blank"); + simulateDefaultedAttribute(OAttributeMetaData::getCommonControlAttributeToken(CCAFlags::TargetFrame), PROPERTY_TARGETFRAME, u"_blank"_ustr); } //= OValueRangeImport @@ -1353,7 +1353,7 @@ namespace xmloff // same XML element), though not all of them know this property. // So we have to do a check ... if (m_xElement.is() && m_xInfo.is() && m_xInfo->hasPropertyByName(PROPERTY_EMPTY_IS_NULL) ) - simulateDefaultedAttribute(OAttributeMetaData::getDatabaseAttributeToken(DAFlags::ConvertEmpty), PROPERTY_EMPTY_IS_NULL, "false"); + simulateDefaultedAttribute(OAttributeMetaData::getDatabaseAttributeToken(DAFlags::ConvertEmpty), PROPERTY_EMPTY_IS_NULL, u"false"_ustr); } namespace { @@ -1514,10 +1514,10 @@ namespace xmloff // for the auto-completion // the attribute default does not equal the property default, so in case we did not read this attribute, // we have to simulate it - simulateDefaultedAttribute( OAttributeMetaData::getSpecialAttributeToken( SCAFlags::AutoCompletion ), PROPERTY_AUTOCOMPLETE, "false"); + simulateDefaultedAttribute( OAttributeMetaData::getSpecialAttributeToken( SCAFlags::AutoCompletion ), PROPERTY_AUTOCOMPLETE, u"false"_ustr); // same for the convert-empty-to-null attribute, which's default is different from the property default - simulateDefaultedAttribute( OAttributeMetaData::getDatabaseAttributeToken( DAFlags::ConvertEmpty ), PROPERTY_EMPTY_IS_NULL, "false"); + simulateDefaultedAttribute( OAttributeMetaData::getDatabaseAttributeToken( DAFlags::ConvertEmpty ), PROPERTY_EMPTY_IS_NULL, u"false"_ustr); } } @@ -1925,7 +1925,7 @@ namespace xmloff OElementImport::startFastElement(nElement, _rxAttrList); // handle the target-frame attribute - simulateDefaultedAttribute(OAttributeMetaData::getCommonControlAttributeToken(CCAFlags::TargetFrame), PROPERTY_TARGETFRAME, "_blank"); + simulateDefaultedAttribute(OAttributeMetaData::getCommonControlAttributeToken(CCAFlags::TargetFrame), PROPERTY_TARGETFRAME, u"_blank"_ustr); } void OFormImport::endFastElement(sal_Int32 nElement) diff --git a/xmloff/source/forms/elementimport.hxx b/xmloff/source/forms/elementimport.hxx index 01de34976024..44aa4c7dba94 100644 --- a/xmloff/source/forms/elementimport.hxx +++ b/xmloff/source/forms/elementimport.hxx @@ -136,7 +136,7 @@ namespace xmloff property value as if the attribute was encountered.</p> @see encounteredAttribute */ - void simulateDefaultedAttribute(sal_Int32 nElement, const OUString& _rPropertyName, const char* _pAttributeDefault); + void simulateDefaultedAttribute(sal_Int32 nElement, const OUString& _rPropertyName, const OUString& _pAttributeDefault); /** to be called from within handleAttribute, checks whether the given attribute is covered by our generic attribute handler mechanisms commit 4910509d6e780ffc96fc484ffe34b058a5088b11 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Fri May 3 10:11:59 2024 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Sun May 5 19:33:38 2024 +0200 replace createFromAscii with OUString literals in SdXMLNumberStyles Change-Id: Ice3a35bcaa9ea0005fb97fef5bbcc2c3e2259f39 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167155 Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> Tested-by: Jenkins diff --git a/xmloff/source/draw/XMLNumberStyles.cxx b/xmloff/source/draw/XMLNumberStyles.cxx index a604de1cd347..87a34cdcf6c1 100644 --- a/xmloff/source/draw/XMLNumberStyles.cxx +++ b/xmloff/source/draw/XMLNumberStyles.cxx @@ -96,15 +96,15 @@ enum class DataStyleNumber : sal_uInt8 struct SdXMLFixedDataStyle { - const char* mpName; + OUString maName; bool mbAutomatic; bool mbDateStyle; DataStyleNumber mpFormat[8]; }; -const SdXMLFixedDataStyle aSdXML_Standard_Short = +constexpr SdXMLFixedDataStyle aSdXML_Standard_Short = { - "D1", true, true, + u"D1"_ustr, true, true, { DataStyleNumber::DayLong, DataStyleNumber::TextPoint, @@ -115,9 +115,9 @@ const SdXMLFixedDataStyle aSdXML_Standard_Short = } }; -const SdXMLFixedDataStyle aSdXML_Standard_Long = +constexpr SdXMLFixedDataStyle aSdXML_Standard_Long = { - "D2", true, true, + u"D2"_ustr, true, true, { DataStyleNumber::DayOfWeekLong, DataStyleNumber::TextCommaSpace, @@ -130,9 +130,9 @@ const SdXMLFixedDataStyle aSdXML_Standard_Long = } }; -const SdXMLFixedDataStyle aSdXML_DateStyle_1 = +constexpr SdXMLFixedDataStyle aSdXML_DateStyle_1 = { - "D3", false, true, + u"D3"_ustr, false, true, { DataStyleNumber::DayLong, DataStyleNumber::TextPoint, @@ -143,9 +143,9 @@ const SdXMLFixedDataStyle aSdXML_DateStyle_1 = } }; -const SdXMLFixedDataStyle aSdXML_DateStyle_2 = +constexpr SdXMLFixedDataStyle aSdXML_DateStyle_2 = { - "D4", false, true, + u"D4"_ustr, false, true, { DataStyleNumber::DayLong, DataStyleNumber::TextPoint, @@ -156,9 +156,9 @@ const SdXMLFixedDataStyle aSdXML_DateStyle_2 = } }; -const SdXMLFixedDataStyle aSdXML_DateStyle_3 = +constexpr SdXMLFixedDataStyle aSdXML_DateStyle_3 = { - "D5", false, true, + u"D5"_ustr, false, true, { DataStyleNumber::Day, DataStyleNumber::TextPointSpace, @@ -169,9 +169,9 @@ const SdXMLFixedDataStyle aSdXML_DateStyle_3 = } }; -const SdXMLFixedDataStyle aSdXML_DateStyle_4 = +constexpr SdXMLFixedDataStyle aSdXML_DateStyle_4 = { - "D6", false, true, + u"D6"_ustr, false, true, { DataStyleNumber::Day, DataStyleNumber::TextPointSpace, @@ -182,9 +182,9 @@ const SdXMLFixedDataStyle aSdXML_DateStyle_4 = } }; -const SdXMLFixedDataStyle aSdXML_DateStyle_5 = +constexpr SdXMLFixedDataStyle aSdXML_DateStyle_5 = { - "D7", false, true, + u"D7"_ustr, false, true, { DataStyleNumber::DayOfWeek, DataStyleNumber::TextCommaSpace, @@ -197,9 +197,9 @@ const SdXMLFixedDataStyle aSdXML_DateStyle_5 = } }; -const SdXMLFixedDataStyle aSdXML_DateStyle_6 = +constexpr SdXMLFixedDataStyle aSdXML_DateStyle_6 = { - "D8", false, true, + u"D8"_ustr, false, true, { DataStyleNumber::DayOfWeekLong, DataStyleNumber::TextCommaSpace, @@ -212,8 +212,8 @@ const SdXMLFixedDataStyle aSdXML_DateStyle_6 = } }; -const SdXMLFixedDataStyle aSdXML_TimeStyle_1 = -{ "T1", true, false, +constexpr SdXMLFixedDataStyle aSdXML_TimeStyle_1 = +{ u"T1"_ustr, true, false, { DataStyleNumber::Hours, DataStyleNumber::TextColon, @@ -225,8 +225,8 @@ const SdXMLFixedDataStyle aSdXML_TimeStyle_1 = } }; -const SdXMLFixedDataStyle aSdXML_TimeStyle_2 = -{ "T2", false, false, +constexpr SdXMLFixedDataStyle aSdXML_TimeStyle_2 = +{ u"T2"_ustr, false, false, { DataStyleNumber::Hours, DataStyleNumber::TextColon, @@ -235,8 +235,8 @@ const SdXMLFixedDataStyle aSdXML_TimeStyle_2 = } }; -const SdXMLFixedDataStyle aSdXML_TimeStyle_3 = -{ "T3", false, false, +constexpr SdXMLFixedDataStyle aSdXML_TimeStyle_3 = +{ u"T3"_ustr, false, false, { DataStyleNumber::Hours, DataStyleNumber::TextColon, @@ -247,8 +247,8 @@ const SdXMLFixedDataStyle aSdXML_TimeStyle_3 = } }; -const SdXMLFixedDataStyle aSdXML_TimeStyle_4 = -{ "T4", false, false, +constexpr SdXMLFixedDataStyle aSdXML_TimeStyle_4 = +{ u"T4"_ustr, false, false, { DataStyleNumber::Hours, DataStyleNumber::TextColon, @@ -259,8 +259,8 @@ const SdXMLFixedDataStyle aSdXML_TimeStyle_4 = } }; -const SdXMLFixedDataStyle aSdXML_TimeStyle_5 = -{ "T5", false, false, +constexpr SdXMLFixedDataStyle aSdXML_TimeStyle_5 = +{ u"T5"_ustr, false, false, { DataStyleNumber::Hours, DataStyleNumber::TextColon, @@ -270,8 +270,8 @@ const SdXMLFixedDataStyle aSdXML_TimeStyle_5 = } }; -const SdXMLFixedDataStyle aSdXML_TimeStyle_6 = -{ "T6", false, false, +constexpr SdXMLFixedDataStyle aSdXML_TimeStyle_6 = +{ u"T6"_ustr, false, false, { DataStyleNumber::Hours, DataStyleNumber::TextColon, @@ -283,8 +283,8 @@ const SdXMLFixedDataStyle aSdXML_TimeStyle_6 = } }; -const SdXMLFixedDataStyle aSdXML_TimeStyle_7 = -{ "T7", false, false, +constexpr SdXMLFixedDataStyle aSdXML_TimeStyle_7 = +{ u"T7"_ustr, false, false, { DataStyleNumber::Hours, DataStyleNumber::TextColon, @@ -349,9 +349,9 @@ static void SdXMLExportDataStyleNumber( SdXMLExport& rExport, SdXMLDataStyleNumb static void SdXMLExportStyle( SdXMLExport& rExport, const SdXMLFixedDataStyle* pStyle, const SdXMLFixedDataStyle* pStyle2 = nullptr ) { // name - OUString sAttrValue = OUString::createFromAscii( pStyle->mpName ); + OUString sAttrValue = pStyle->maName; if( pStyle2 ) - sAttrValue += OUString::createFromAscii( pStyle2->mpName ); + sAttrValue += pStyle2->maName; rExport.AddAttribute( XML_NAMESPACE_STYLE, XML_NAME, sAttrValue ); @@ -447,7 +447,7 @@ OUString SdXMLNumberStylesExporter::getTimeStyleName(const sal_Int32 nTimeFormat if( (nFormat >= 0) && (nFormat < SdXMLTimeFormatCount) ) { - return OUString::createFromAscii(aSdXMLFixedTimeFormats[nFormat]->mpName ); + return aSdXMLFixedTimeFormats[nFormat]->maName; } else { @@ -473,7 +473,7 @@ OUString SdXMLNumberStylesExporter::getDateStyleName(const sal_Int32 nDateFormat if( (nFormat >= 0) && (nFormat < SdXMLDateFormatCount) ) { - return OUString::createFromAscii(aSdXMLFixedDateFormats[nFormat]->mpName ); + return aSdXMLFixedDateFormats[nFormat]->maName; } else {