Extended loplugin:ostr: Automatic rewrite O[U]StringLiteral: oox

Change-Id: Ic5bcb44fbe56804e23bcdfd039a77c010858ca02
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/158206
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
This commit is contained in:
Stephan Bergmann
2023-10-20 07:58:45 +02:00
parent cbe3899ed9
commit 44bd87fd78
18 changed files with 29 additions and 29 deletions
+1 -1
View File
@@ -920,7 +920,7 @@ CPPUNIT_TEST_FIXTURE(Test, testFontworkDirectColor)
// Examine the saved markup.
xmlDocUniquePtr pXmlDoc = parseExport("word/document.xml");
static constexpr OStringLiteral sElement = "//w:txbxContent/w:p/w:r/w:rPr/";
static constexpr OString sElement = "//w:txbxContent/w:p/w:r/w:rPr/"_ostr;
// Make sure the fallback in <w:color> has correct value.
assertXPath(pXmlDoc, sElement + "w:color", "val", "2E8B57");
+4 -4
View File
@@ -34,7 +34,7 @@ CPPUNIT_TEST_FIXTURE(TestMCGR, testFontworkColorGradient)
// linear gradient with 30deg angle
assertXPath(pXmlDoc, "//a:r/a:rPr/a:gradFill/a:lin", "ang", "3600000");
// three color stops, no transparency
static constexpr OStringLiteral sPath = "//a:r/a:rPr/a:gradFill/a:gsLst/";
static constexpr OString sPath = "//a:r/a:rPr/a:gradFill/a:gsLst/"_ostr;
assertXPath(pXmlDoc, sPath + "a:gs", 3);
assertXPath(pXmlDoc, sPath + "a:gs[1]", "pos", "0");
assertXPath(pXmlDoc, sPath + "a:gs[1]/a:srgbClr", "val", "ff1493");
@@ -57,7 +57,7 @@ CPPUNIT_TEST_FIXTURE(TestMCGR, testFontworkColorGradientWord)
// linear gradient with 30deg angle
assertXPath(pXmlDoc, "//w14:lin", "ang", "3600000");
// three color stops, no transparency
static constexpr OStringLiteral sPath = "//w14:gradFill/w14:gsLst/";
static constexpr OString sPath = "//w14:gradFill/w14:gsLst/"_ostr;
assertXPath(pXmlDoc, sPath + "w14:gs", 3);
assertXPath(pXmlDoc, sPath + "w14:gs[1]", "pos", "0");
assertXPath(pXmlDoc, sPath + "w14:gs[1]/w14:srgbClr", "val", "ff1493");
@@ -88,7 +88,7 @@ CPPUNIT_TEST_FIXTURE(TestMCGR, testStepCount)
// Without the fix the colors in the sections were wrong. And when opening a file with StepCount
// and saving it immediately to pptx, a continuous gradient might be produced.
static constexpr OStringLiteral sPath = "//a:gradFill/a:gsLst/";
static constexpr OString sPath = "//a:gradFill/a:gsLst/"_ostr;
// The default way of load and save would have produced 2 stops, but we need start stop, end stop
// and 3*2 inner stops.
assertXPath(pXmlDoc, sPath + "a:gs", 8);
@@ -115,7 +115,7 @@ CPPUNIT_TEST_FIXTURE(TestMCGR, testAxialColorLinearTrans)
// method will be changed, the test needs to be adjusted.
xmlDocUniquePtr pXmlDoc = parseExport("ppt/slides/slide1.xml");
static constexpr OStringLiteral sPath = "//a:gradFill/a:gsLst/";
static constexpr OString sPath = "//a:gradFill/a:gsLst/"_ostr;
assertXPath(pXmlDoc, sPath + "a:gs", 3);
assertXPath(pXmlDoc, sPath + "a:gs[1]", "pos", "0");
assertXPath(pXmlDoc, sPath + "a:gs[1]/a:srgbClr", "val", "00ffff");
+3 -3
View File
@@ -269,10 +269,10 @@ OUString FilterBase::getAbsoluteUrl( const OUString& rUrl ) const
{
// handle some special cases before calling ::rtl::Uri::convertRelToAbs()
static constexpr OUStringLiteral aFileSchema = u"file:";
static constexpr OUStringLiteral aFilePrefix = u"file:///";
static constexpr OUString aFileSchema = u"file:"_ustr;
static constexpr OUString aFilePrefix = u"file:///"_ustr;
const sal_Int32 nFilePrefixLen = aFilePrefix.getLength();
static constexpr OUStringLiteral aUncPrefix = u"//";
static constexpr OUString aUncPrefix = u"//"_ustr;
/* (1) convert all backslashes to slashes, and check that passed URL is
not empty. */
+2 -2
View File
@@ -183,7 +183,7 @@ struct XmlFilterBaseImpl
explicit XmlFilterBaseImpl();
};
constexpr OUStringLiteral gaBinSuffix( u".bin" );
constexpr OUString gaBinSuffix( u".bin"_ustr );
XmlFilterBaseImpl::XmlFilterBaseImpl() :
mrNamespaceMap(StaticNamespaceMap())
@@ -258,7 +258,7 @@ void XmlFilterBase::putPropertiesToDocumentGrabBag(const css::uno::Reference<css
{
uno::Reference<beans::XPropertySetInfo> xPropsInfo = xDocProps->getPropertySetInfo();
static constexpr OUStringLiteral aGrabBagPropName = u"InteropGrabBag";
static constexpr OUString aGrabBagPropName = u"InteropGrabBag"_ustr;
if (xPropsInfo.is() && xPropsInfo->hasPropertyByName(aGrabBagPropName))
{
// get existing grab bag
+1 -1
View File
@@ -32,7 +32,7 @@ void lclRandomGenerateValues(sal_uInt8* aArray, sal_uInt32 aSize)
rtl_random_destroyPool(aRandomPool);
}
constexpr OUStringLiteral lclCspName = u"Microsoft Enhanced RSA and AES Cryptographic Provider";
constexpr OUString lclCspName = u"Microsoft Enhanced RSA and AES Cryptographic Provider"_ustr;
constexpr const sal_uInt32 AES128Size = 16;
} // end anonymous namespace
@@ -134,7 +134,7 @@ void CustomShapeProperties::pushToPropSet(
if ( !maAdjustmentGuideList.empty() )
{
static constexpr OUStringLiteral sCustomShapeGeometry(u"CustomShapeGeometry");
static constexpr OUString sCustomShapeGeometry(u"CustomShapeGeometry"_ustr);
static constexpr OUStringLiteral sAdjustmentValues(u"AdjustmentValues");
uno::Any aGeoPropSet = xPropSet->getPropertyValue( sCustomShapeGeometry );
uno::Sequence< beans::PropertyValue > aGeoPropSeq;
+3 -3
View File
@@ -156,9 +156,9 @@ void FontworkHelpers::putCustomShapeIntoTextPathMode(
= comphelper::sequenceToContainer<std::vector<beans::PropertyValue>>(aGeomPropSeq);
// Reset old properties
static constexpr OUStringLiteral sTextPath(u"TextPath");
static constexpr OUStringLiteral sAdjustmentValues(u"AdjustmentValues");
static constexpr OUStringLiteral sPresetTextWarp(u"PresetTextWarp");
static constexpr OUString sTextPath(u"TextPath"_ustr);
static constexpr OUString sAdjustmentValues(u"AdjustmentValues"_ustr);
static constexpr OUString sPresetTextWarp(u"PresetTextWarp"_ustr);
resetPropertyValueInVec(aGeomPropVec, u"CoordinateSize"_ustr);
resetPropertyValueInVec(aGeomPropVec, u"Equations"_ustr);
+2 -2
View File
@@ -81,7 +81,7 @@ HyperLinkContext::HyperLinkContext( ContextHandler2Helper const & rParent,
// ppaction://macro?name=MACRO_NAME
// ppaction://program
static constexpr OUStringLiteral sPPAction( u"ppaction://" );
static constexpr OUString sPPAction( u"ppaction://"_ustr );
if ( aAction.matchIgnoreAsciiCase( sPPAction ) )
{
OUString aPPAct( aAction.copy( sPPAction.getLength() ) );
@@ -90,7 +90,7 @@ HyperLinkContext::HyperLinkContext( ContextHandler2Helper const & rParent,
if ( aPPAction.match( "hlinkshowjump" ) )
{
static constexpr OUStringLiteral sJump( u"jump=" );
static constexpr OUString sJump( u"jump="_ustr );
if ( aPPAct.match( sJump, nIndex + 1 ) )
{
std::u16string_view aDestination( aPPAct.subView( nIndex + 1 + sJump.getLength() ) );
+1 -1
View File
@@ -1419,7 +1419,7 @@ Reference< XShape > const & Shape::createAndInsert(
if(mnRotation)
{
uno::Reference<beans::XPropertySet> xPropertySet(mxShape, uno::UNO_QUERY);
static constexpr OUStringLiteral aGrabBagPropName = u"FrameInteropGrabBag";
static constexpr OUString aGrabBagPropName = u"FrameInteropGrabBag"_ustr;
uno::Sequence<beans::PropertyValue> aGrabBag;
xPropertySet->getPropertyValue(aGrabBagPropName) >>= aGrabBag;
beans::PropertyValue aPair(comphelper::makePropertyValue("mso-rotation-angle",
+1 -1
View File
@@ -1134,7 +1134,7 @@ void VMLExport::AddLineDimensions( const tools::Rectangle& rRectangle )
if ( mnGroupLevel == 1 )
{
static constexpr OStringLiteral aPt( "pt" );
static constexpr OString aPt( "pt"_ostr );
aLeft = OString::number( double( rRectangle.Left() ) / 20 ) + aPt;
aTop = OString::number( double( rRectangle.Top() ) / 20 ) + aPt;
aRight = OString::number( double( rRectangle.Right() ) / 20 ) + aPt;
+2 -2
View File
@@ -90,8 +90,8 @@ void ObjectContainer::createContainer() const
}
constexpr OUStringLiteral gaDashNameBase( u"msLineDash " ); ///< Base name for all named line dashes.
constexpr OUStringLiteral gaGradientNameBase( u"msFillGradient " ); ///< Base name for all named fill gradients.
constexpr OUStringLiteral gaTransGradNameBase( u"msTransGradient " ); ///< Base name for all named fill gradients.
constexpr OUString gaGradientNameBase( u"msFillGradient "_ustr ); ///< Base name for all named fill gradients.
constexpr OUString gaTransGradNameBase( u"msTransGradient "_ustr ); ///< Base name for all named fill gradients.
constexpr OUStringLiteral gaBitmapUrlNameBase( u"msFillBitmap " ); ///< Base name for all named fill bitmap URLs.
constexpr OUStringLiteral gaHatchNameBase( u"msFillHatch " ); ///< Base name for all named fill hatches.
+1 -1
View File
@@ -92,7 +92,7 @@ void SaveInteropProperties(uno::Reference<frame::XModel> const& xModel,
OUString const& rObjectName, OUString const*const pOldObjectName,
OUString const& rProgId)
{
static constexpr OUStringLiteral sEmbeddingsPropName = u"EmbeddedObjects";
static constexpr OUString sEmbeddingsPropName = u"EmbeddedObjects"_ustr;
// get interop grab bag from document
uno::Reference<beans::XPropertySet> const xDocProps(xModel, uno::UNO_QUERY);
+1 -1
View File
@@ -182,7 +182,7 @@ void PPTShape::addShape(
if (sServiceName != "com.sun.star.drawing.GraphicObjectShape" &&
sServiceName != "com.sun.star.drawing.OLE2Shape")
{
static constexpr OUStringLiteral sOutlinerShapeService(u"com.sun.star.presentation.OutlinerShape");
static constexpr OUString sOutlinerShapeService(u"com.sun.star.presentation.OutlinerShape"_ustr);
SAL_INFO("oox.ppt","has master: " << std::hex << rSlidePersist.getMasterPersist().get());
switch (mnSubType)
{
@@ -194,7 +194,7 @@ void PresentationFragmentHandler::importCustomSlideShow(std::vector<CustomShow>&
UNO_QUERY);
if (xShow.is())
{
static constexpr OUStringLiteral sSlide = u"slides/slide";
static constexpr OUString sSlide = u"slides/slide"_ustr;
for (size_t j = 0; j < rCustomShowList[i].maSldLst.size(); ++j)
{
OUString sCustomSlide = rCustomShowList[i].maSldLst[j];
@@ -314,7 +314,7 @@ void PresentationFragmentHandler::saveThemeToGrabBag(const oox::drawingml::Theme
{
uno::Reference<beans::XPropertySetInfo> xPropsInfo = xDocProps->getPropertySetInfo();
static constexpr OUStringLiteral aGrabBagPropName = u"InteropGrabBag";
static constexpr OUString aGrabBagPropName = u"InteropGrabBag"_ustr;
if (xPropsInfo.is() && xPropsInfo->hasPropertyByName(aGrabBagPropName))
{
// get existing grab bag
+1 -1
View File
@@ -242,7 +242,7 @@ void SlidePersist::applyTextStyles( const XmlFilterBase& rFilterBase )
OUString aFamily;
static constexpr OUStringLiteral sOutline( u"outline1" );
static constexpr OUStringLiteral sTitle( u"title" );
static constexpr OUString sTitle( u"title"_ustr );
static constexpr OUStringLiteral sStandard( u"standard" );
static constexpr OUStringLiteral sSubtitle( u"subtitle" );
+1 -1
View File
@@ -264,7 +264,7 @@ bool lclProcessCharacters( OStringBuffer& rBuffer, const OString& rChars )
} // namespace
constexpr OStringLiteral gaOpeningCData( "<![CDATA[" );
constexpr OStringLiteral gaClosingCData( "]]>" );
constexpr OString gaClosingCData( "]]>"_ostr );
InputStream::InputStream( const Reference< XComponentContext >& rxContext, const Reference< XInputStream >& rxInStrm ) :
// use single-byte ISO-8859-1 encoding which maps all byte characters to the first 256 Unicode characters
+1 -1
View File
@@ -312,7 +312,7 @@ void ShapeBase::finalizeFragmentImport()
else {
// Temporary fix, shapetype not found if referenced from different substream
// FIXME: extend scope of ShapeContainer to store all shapetypes from the document
static constexpr OUStringLiteral sShapeTypePrefix = u"shapetype_";
static constexpr OUString sShapeTypePrefix = u"shapetype_"_ustr;
OUString tmp;
if (aType.startsWith(sShapeTypePrefix)) {
maTypeModel.moShapeType = o3tl::toInt32(aType.subView(sShapeTypePrefix.getLength()));
+1 -1
View File
@@ -295,7 +295,7 @@ ShapeTypeContext::ShapeTypeContext(ContextHandler2Helper const & rParent,
{
mrTypeModel.maShapeName = rAttribs.getXString( XML_id, OUString() );
// get ShapeType and ShapeId from name for compatibility
static constexpr OUStringLiteral sShapeTypePrefix = u"shapetype_";
static constexpr OUString sShapeTypePrefix = u"shapetype_"_ustr;
OUString tmp;
if( mrTypeModel.maShapeName.startsWith( sShapeTypePrefix ) )
{