replace createFromAscii with OUString literals in OElementImport

Change-Id: Ic6e93f47b903b69f1d8a15fc62be138c13b7b01a
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/167156
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Tested-by: Jenkins
This commit is contained in:
Noel Grandin
2024-05-03 10:15:17 +02:00
parent 4910509d6e
commit 719c8f4478
2 changed files with 8 additions and 8 deletions

View File

@@ -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)

View File

@@ -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