xmloff/source/draw/animimp.cxx                  |   40 +++++++-----------------
 xmloff/source/draw/shapeimport.cxx              |   16 +++------
 xmloff/source/script/XMLEventExport.cxx         |    4 --
 xmloff/source/script/XMLScriptExportHandler.cxx |    4 --
 xmloff/source/style/prstylei.cxx                |   12 ++-----
 5 files changed, 23 insertions(+), 53 deletions(-)

New commits:
commit e7eae3aa6e3af0b05c6aa471d2c4892918757e7a
Author:     RMZeroFour <ritobrot...@gmail.com>
AuthorDate: Sat Mar 23 19:21:44 2024 +0530
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Sat Mar 23 20:49:49 2024 +0100

    tdf#158067 Replace OUStringLiteral with _ustr
    
    As part of the efforts in #158067 to replace static constexpr
    OUStringLiteral variables with string literals of the form
    u""_ustr, this commit performs the replacements in some files
    of the xmloff module.
    
    Change-Id: Icce2ed7f9a69ef023aaff498975d6afabf161d4f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/165200
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>

diff --git a/xmloff/source/draw/animimp.cxx b/xmloff/source/draw/animimp.cxx
index 8248d51bd019..afd1fffd2f13 100644
--- a/xmloff/source/draw/animimp.cxx
+++ b/xmloff/source/draw/animimp.cxx
@@ -314,22 +314,6 @@ AnimationEffect ImplSdXMLgetEffect( XMLEffect eKind, 
XMLEffectDirection eDirecti
     }
 }
 
-namespace
-{
-    constexpr OUStringLiteral gsDimColor = u"DimColor";
-    constexpr OUStringLiteral gsDimHide = u"DimHide";
-    constexpr OUStringLiteral gsDimPrev = u"DimPrevious";
-    constexpr OUStringLiteral gsEffect = u"Effect";
-    constexpr OUStringLiteral gsPlayFull = u"PlayFull";
-    constexpr OUStringLiteral gsSound = u"Sound";
-    constexpr OUStringLiteral gsSoundOn = u"SoundOn";
-    constexpr OUStringLiteral gsSpeed = u"Speed";
-    constexpr OUStringLiteral gsTextEffect = u"TextEffect";
-    constexpr OUStringLiteral gsPresShapeService = 
u"com.sun.star.presentation.Shape";
-    constexpr OUStringLiteral gsAnimPath = u"AnimationPath";
-    constexpr OUStringLiteral gsIsAnimation = u"IsAnimation";
-};
-
 namespace {
 
 enum XMLActionKind
@@ -501,7 +485,7 @@ void XMLAnimationsEffectContext::endFastElement(sal_Int32 )
                     // check for presentation shape service
                     {
                         Reference< XServiceInfo > xServiceInfo( xSet, 
UNO_QUERY );
-                        if( !xServiceInfo.is() || 
!xServiceInfo->supportsService( gsPresShapeService ) )
+                        if( !xServiceInfo.is() || 
!xServiceInfo->supportsService( u"com.sun.star.presentation.Shape"_ustr ) )
                             return;
                     }
 
@@ -518,13 +502,13 @@ void XMLAnimationsEffectContext::endFastElement(sal_Int32 
)
             {
                 if( meKind == XMLE_DIM )
                 {
-                    xSet->setPropertyValue( gsDimPrev, Any(true) );
+                    xSet->setPropertyValue( u"DimPrevious"_ustr, Any(true) );
 
-                    xSet->setPropertyValue( gsDimColor, Any(maDimColor) );
+                    xSet->setPropertyValue( u"DimColor"_ustr, Any(maDimColor) 
);
                 }
                 else if( meKind == XMLE_PLAY )
                 {
-                    xSet->setPropertyValue( gsIsAnimation, Any(true) );
+                    xSet->setPropertyValue( u"IsAnimation"_ustr, Any(true) );
 
                     // #i42894# speed is not supported for the old group 
animation fallback, so no need to set it
                     // aAny <<= meSpeed;
@@ -534,23 +518,23 @@ void XMLAnimationsEffectContext::endFastElement(sal_Int32 
)
                 {
                     if( meKind == XMLE_HIDE && !mbTextEffect && meEffect == 
EK_none )
                     {
-                        xSet->setPropertyValue( gsDimHide, Any(true) );
+                        xSet->setPropertyValue( u"DimHide"_ustr, Any(true) );
                     }
                     else
                     {
                         const AnimationEffect eEffect = ImplSdXMLgetEffect( 
meEffect, meDirection, mnStartScale, meKind == XMLE_SHOW );
 
                         if (mbTextEffect)
-                            xSet->setPropertyValue( gsTextEffect, Any( eEffect 
) );
+                            xSet->setPropertyValue( u"TextEffect"_ustr, Any( 
eEffect ) );
                         else
-                            xSet->setPropertyValue( gsEffect, Any( eEffect ) );
-                        xSet->setPropertyValue( gsSpeed, Any( meSpeed ) );
+                            xSet->setPropertyValue( u"Effect"_ustr, Any( 
eEffect ) );
+                        xSet->setPropertyValue( u"Speed"_ustr, Any( meSpeed ) 
);
 
                         if( eEffect == AnimationEffect_PATH && 
!maPathShapeId.isEmpty() )
                         {
                             Reference< XShape > xPath( 
GetImport().getInterfaceToIdentifierMapper().getReference( maPathShapeId ), 
UNO_QUERY );
                             if( xPath.is() )
-                                xSet->setPropertyValue( gsAnimPath, Any( xPath 
) );
+                                xSet->setPropertyValue( u"AnimationPath"_ustr, 
Any( xPath ) );
                         }
                     }
                 }
@@ -559,9 +543,9 @@ void XMLAnimationsEffectContext::endFastElement(sal_Int32 )
             {
                 if( xSet.is() )
                 {
-                    xSet->setPropertyValue( gsSound, Any(maSoundURL) );
-                    xSet->setPropertyValue( gsPlayFull, Any(mbPlayFull) );
-                    xSet->setPropertyValue( gsSoundOn, Any(true) );
+                    xSet->setPropertyValue( u"Sound"_ustr, Any(maSoundURL) );
+                    xSet->setPropertyValue( u"PlayFull"_ustr, Any(mbPlayFull) 
);
+                    xSet->setPropertyValue( u"SoundOn"_ustr, Any(true) );
                 }
                 else
                 {
diff --git a/xmloff/source/draw/shapeimport.cxx 
b/xmloff/source/draw/shapeimport.cxx
index a891259a10e7..06e61539abbf 100644
--- a/xmloff/source/draw/shapeimport.cxx
+++ b/xmloff/source/draw/shapeimport.cxx
@@ -98,11 +98,6 @@ struct XMLShapeImportHelperImpl
     bool                        mbIsPresentationShapesSupported;
 };
 
-constexpr OUStringLiteral gsStartShape(u"StartShape");
-constexpr OUStringLiteral gsEndShape(u"EndShape");
-constexpr OUStringLiteral gsStartGluePointIndex(u"StartGluePointIndex");
-constexpr OUStringLiteral gsEndGluePointIndex(u"EndGluePointIndex");
-
 XMLShapeImportHelper::XMLShapeImportHelper(
         SvXMLImport& rImporter,
         const uno::Reference< frame::XModel>& rModel,
@@ -461,8 +456,7 @@ void XMLShapeImportHelper::addShape( uno::Reference< 
drawing::XShape >& rShape,
         uno::Reference<beans::XPropertySet> xPropertySet(rShape, 
uno::UNO_QUERY);
         if (xPropertySet.is())
         {
-            static constexpr OUStringLiteral sHandlePathObjScale = 
u"HandlePathObjScale";
-            xPropertySet->setPropertyValue(sHandlePathObjScale, 
uno::Any(true));
+            xPropertySet->setPropertyValue(u"HandlePathObjScale"_ustr, 
uno::Any(true));
         }
     }
 }
@@ -815,15 +809,15 @@ void XMLShapeImportHelper::restoreConnections()
             if( xShape.is() )
             {
                 if (rHint.bStart)
-                    xConnector->setPropertyValue( gsStartShape, 
uno::Any(xShape) );
+                    xConnector->setPropertyValue( u"StartShape"_ustr, 
uno::Any(xShape) );
                 else
-                    xConnector->setPropertyValue( gsEndShape, uno::Any(xShape) 
);
+                    xConnector->setPropertyValue( u"EndShape"_ustr, 
uno::Any(xShape) );
 
                 sal_Int32 nGlueId = rHint.nDestGlueId < 4 ? rHint.nDestGlueId 
: getGluePointId( xShape, rHint.nDestGlueId );
                 if(rHint.bStart)
-                    xConnector->setPropertyValue( gsStartGluePointIndex, 
uno::Any(nGlueId) );
+                    xConnector->setPropertyValue( u"StartGluePointIndex"_ustr, 
uno::Any(nGlueId) );
                 else
-                    xConnector->setPropertyValue( gsEndGluePointIndex, 
uno::Any(nGlueId) );
+                    xConnector->setPropertyValue( u"EndGluePointIndex"_ustr, 
uno::Any(nGlueId) );
             }
 
             // #86637# restore line deltas
diff --git a/xmloff/source/script/XMLEventExport.cxx 
b/xmloff/source/script/XMLEventExport.cxx
index c8c63e7f1044..839944a2676d 100644
--- a/xmloff/source/script/XMLEventExport.cxx
+++ b/xmloff/source/script/XMLEventExport.cxx
@@ -40,8 +40,6 @@ using ::com::sun::star::container::XNameReplace;
 using ::com::sun::star::container::XNameAccess;
 using ::xmloff::token::XML_EVENT_LISTENERS;
 
-constexpr OUStringLiteral gsEventType(u"EventType");
-
 XMLEventExport::XMLEventExport(SvXMLExport& rExp) :
     m_rExport(rExp),
     m_bExtNamespace(false)
@@ -187,7 +185,7 @@ void XMLEventExport::ExportEvent(
 {
     // search for EventType value and then delegate to EventHandler
     const PropertyValue* pValue = std::find_if(rEventValues.begin(), 
rEventValues.end(),
-        [](const PropertyValue& rValue) { return gsEventType == rValue.Name; 
});
+        [](const PropertyValue& rValue) { return u"EventType"_ustr == 
rValue.Name; });
 
     if (pValue == rEventValues.end())
         return;
diff --git a/xmloff/source/script/XMLScriptExportHandler.cxx 
b/xmloff/source/script/XMLScriptExportHandler.cxx
index 6b35a4456402..6b5075d02112 100644
--- a/xmloff/source/script/XMLScriptExportHandler.cxx
+++ b/xmloff/source/script/XMLScriptExportHandler.cxx
@@ -31,8 +31,6 @@ using namespace ::xmloff::token;
 
 using ::com::sun::star::beans::PropertyValue;
 
-constexpr OUStringLiteral gsURL(u"Script");
-
 XMLScriptExportHandler::XMLScriptExportHandler()
 {
 }
@@ -55,7 +53,7 @@ void XMLScriptExportHandler::Export(
 
     for(const auto& rValue : rValues)
     {
-        if (gsURL == rValue.Name)
+        if (u"Script"_ustr == rValue.Name)
         {
             OUString sTmp;
             rValue.Value >>= sTmp;
diff --git a/xmloff/source/style/prstylei.cxx b/xmloff/source/style/prstylei.cxx
index e59c666c1e13..95a869653fd9 100644
--- a/xmloff/source/style/prstylei.cxx
+++ b/xmloff/source/style/prstylei.cxx
@@ -620,11 +620,6 @@ void 
XMLPropStyleContext::translateNameBasedDrawingLayerFillStyleDefinitionsToSt
     if(!rMapper.is())
         return;
 
-    static constexpr OUStringLiteral s_FillGradientName(u"FillGradientName");
-    static constexpr OUStringLiteral s_FillHatchName(u"FillHatchName");
-    static constexpr OUStringLiteral s_FillBitmapName(u"FillBitmapName");
-    static constexpr OUStringLiteral 
s_FillTransparenceGradientName(u"FillTransparenceGradientName");
-
     for(auto& a : maProperties)
     {
         if(a.mnIndex != -1)
@@ -632,15 +627,16 @@ void 
XMLPropStyleContext::translateNameBasedDrawingLayerFillStyleDefinitionsToSt
             const OUString& rPropName = rMapper->GetEntryAPIName(a.mnIndex);
             XmlStyleFamily aStyleFamily(XmlStyleFamily::DATA_STYLE);
 
-            if(rPropName == s_FillGradientName || rPropName == 
s_FillTransparenceGradientName)
+            if(rPropName == u"FillGradientName"_ustr
+               || rPropName == u"FillTransparenceGradientName"_ustr)
             {
                 aStyleFamily = XmlStyleFamily::SD_GRADIENT_ID;
             }
-            else if(rPropName == s_FillHatchName)
+            else if(rPropName == u"FillHatchName"_ustr)
             {
                 aStyleFamily = XmlStyleFamily::SD_HATCH_ID;
             }
-            else if(rPropName == s_FillBitmapName)
+            else if(rPropName == u"FillBitmapName"_ustr)
             {
                 aStyleFamily = XmlStyleFamily::SD_FILL_IMAGE_ID;
             }

Reply via email to