[Libreoffice-commits] core.git: xmloff/source

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Fri Jun 5 18:55:52 UTC 2020


 xmloff/source/draw/propimp0.cxx                      |    3 --
 xmloff/source/draw/sdpropls.cxx                      |    3 --
 xmloff/source/draw/shapeexport.cxx                   |    9 ++-----
 xmloff/source/draw/shapeimport.cxx                   |    3 --
 xmloff/source/draw/ximpshap.cxx                      |   14 +++---------
 xmloff/source/draw/ximpstyl.cxx                      |    6 +----
 xmloff/source/style/xmlbahdl.cxx                     |    3 --
 xmloff/source/style/xmlnume.cxx                      |    3 --
 xmloff/source/style/xmlnumi.cxx                      |    6 +----
 xmloff/source/table/XMLTableImport.cxx               |   12 +++-------
 xmloff/source/text/XMLSectionExport.cxx              |   22 ++++++-------------
 xmloff/source/text/XMLSectionSourceImportContext.cxx |    8 +-----
 xmloff/source/text/txtimp.cxx                        |    3 --
 xmloff/source/text/txtparai.cxx                      |    4 ---
 14 files changed, 31 insertions(+), 68 deletions(-)

New commits:
commit 49f6b97b3813eb5752088d5b5805c3389eb9c8a8
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Fri Jun 5 16:05:59 2020 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Fri Jun 5 20:55:15 2020 +0200

    Upcoming loplugin:elidestringvar: xmloff
    
    Change-Id: I42210925cc560fa32316c2ad7b7732c7624b1a05
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/95606
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/xmloff/source/draw/propimp0.cxx b/xmloff/source/draw/propimp0.cxx
index fe796539b5b5..991b3cb7a271 100644
--- a/xmloff/source/draw/propimp0.cxx
+++ b/xmloff/source/draw/propimp0.cxx
@@ -182,8 +182,7 @@ bool XMLTextAnimationStepPropertyHdl::importXML(
     bool bRet = false;
     sal_Int32 nValue = 0;
 
-    const OUString aPX( "px" );
-    sal_Int32 nPos = rStrImpValue.indexOf( aPX );
+    sal_Int32 nPos = rStrImpValue.indexOf( "px" );
     if( nPos != -1 )
     {
         if (::sax::Converter::convertNumber(nValue, std::u16string_view(rStrImpValue).substr(0, nPos)))
diff --git a/xmloff/source/draw/sdpropls.cxx b/xmloff/source/draw/sdpropls.cxx
index d55c2cec6b6a..2adc5da00c6d 100644
--- a/xmloff/source/draw/sdpropls.cxx
+++ b/xmloff/source/draw/sdpropls.cxx
@@ -1520,9 +1520,8 @@ void XMLShapeExportPropertyMapper::ContextFilter(
         {
             try
             {
-                const OUString sVisibleArea( "VisibleArea" );
                 awt::Rectangle aRect;
-                if( rPropSet->getPropertyValue( sVisibleArea ) >>= aRect )
+                if( rPropSet->getPropertyValue( "VisibleArea" ) >>= aRect )
                 {
                     if( pOLEVisAreaLeft )
                     {
diff --git a/xmloff/source/draw/shapeexport.cxx b/xmloff/source/draw/shapeexport.cxx
index aeb12d61c1c8..533032482b45 100644
--- a/xmloff/source/draw/shapeexport.cxx
+++ b/xmloff/source/draw/shapeexport.cxx
@@ -2374,8 +2374,7 @@ void XMLShapeExport::ImpExportGraphicObjectShape(
                 // apply possible changed stream URL to embedded image object
                 if (!sRequestedName.isEmpty())
                 {
-                    const OUString sPackageURL("vnd.sun.star.Package:");
-                    OUString newStreamURL = sPackageURL;
+                    OUString newStreamURL = "vnd.sun.star.Package:";
                     if (sInternalURL[0] == '#')
                     {
                         newStreamURL += sInternalURL.copy(1, sInternalURL.getLength() - 1);
@@ -3333,14 +3332,12 @@ void XMLShapeExport::ImpExportMediaShape(
     delete new SvXMLElementExport( mrExport, XML_NAMESPACE_DRAW, XML_PARAM, false, true );
 
     sal_Int16 nVolumeDB = 0;
-    const OUString aVolumeDBStr(  "VolumeDB"  );
     xPropSet->getPropertyValue("VolumeDB") >>= nVolumeDB;
-    mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, aVolumeDBStr );
+    mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, "VolumeDB" );
     mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_VALUE, OUString::number( nVolumeDB ) );
     delete new SvXMLElementExport( mrExport, XML_NAMESPACE_DRAW, XML_PARAM, false, true );
 
     media::ZoomLevel eZoom;
-    const OUString aZoomStr(  "Zoom"  );
     OUString aZoomValue;
     xPropSet->getPropertyValue("Zoom") >>= eZoom;
     switch( eZoom )
@@ -3360,7 +3357,7 @@ void XMLShapeExport::ImpExportMediaShape(
 
     if( !aZoomValue.isEmpty() )
     {
-        mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, aZoomStr );
+        mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_NAME, "Zoom" );
         mrExport.AddAttribute( XML_NAMESPACE_DRAW, XML_VALUE, aZoomValue );
         delete new SvXMLElementExport( mrExport, XML_NAMESPACE_DRAW, XML_PARAM, false, true );
     }
diff --git a/xmloff/source/draw/shapeimport.cxx b/xmloff/source/draw/shapeimport.cxx
index 856635c09d31..9851331a1a6b 100644
--- a/xmloff/source/draw/shapeimport.cxx
+++ b/xmloff/source/draw/shapeimport.cxx
@@ -148,8 +148,7 @@ XMLShapeImportHelper::XMLShapeImportHelper(
     mpPresPagePropsMapper = new SvXMLImportPropertyMapper( xMapper, rImporter );
 
     uno::Reference< lang::XServiceInfo > xInfo( rImporter.GetModel(), uno::UNO_QUERY );
-    const OUString aSName( "com.sun.star.presentation.PresentationDocument" );
-    mpImpl->mbIsPresentationShapesSupported = xInfo.is() && xInfo->supportsService( aSName );
+    mpImpl->mbIsPresentationShapesSupported = xInfo.is() && xInfo->supportsService( "com.sun.star.presentation.PresentationDocument" );
 }
 
 XMLShapeImportHelper::~XMLShapeImportHelper()
diff --git a/xmloff/source/draw/ximpshap.cxx b/xmloff/source/draw/ximpshap.cxx
index fdfbbc2562a8..5027b8a57867 100644
--- a/xmloff/source/draw/ximpshap.cxx
+++ b/xmloff/source/draw/ximpshap.cxx
@@ -2139,8 +2139,7 @@ void SdXMLMeasureShapeContext::StartElement(const uno::Reference< xml::sax::XAtt
         uno::Reference< text::XText > xText( mxShape, uno::UNO_QUERY );
         if( xText.is() )
         {
-            const OUString aEmpty(  " "  );
-            xText->setString( aEmpty );
+            xText->setString( " " );
         }
 
         SdXMLShapeContext::StartElement(xAttrList);
@@ -2544,9 +2543,7 @@ void SdXMLChartShapeContext::StartElement(const uno::Reference< xml::sax::XAttri
 
                 uno::Any aAny;
 
-                const OUString aCLSID( "12DCAE26-281F-416F-a234-c3086127382e");
-
-                xProps->setPropertyValue("CLSID", Any(aCLSID) );
+                xProps->setPropertyValue("CLSID", Any(OUString("12DCAE26-281F-416F-a234-c3086127382e")) );
 
                 aAny = xProps->getPropertyValue("Model");
                 uno::Reference< frame::XModel > xChartModel;
@@ -3821,8 +3818,6 @@ void SdXMLCustomShapeContext::EndElement()
 
     if ( !maCustomShapeGeometry.empty() )
     {
-        const OUString sCustomShapeGeometry    (  "CustomShapeGeometry"  );
-
         // converting the vector to a sequence
         uno::Sequence< beans::PropertyValue > aSeq( comphelper::containerToSequence(maCustomShapeGeometry) );
 
@@ -3831,7 +3826,7 @@ void SdXMLCustomShapeContext::EndElement()
             uno::Reference< beans::XPropertySet > xPropSet( mxShape, uno::UNO_QUERY );
             if( xPropSet.is() )
             {
-                xPropSet->setPropertyValue( sCustomShapeGeometry, Any(aSeq) );
+                xPropSet->setPropertyValue( "CustomShapeGeometry", Any(aSeq) );
             }
         }
         catch(const uno::Exception&)
@@ -3950,8 +3945,7 @@ void SdXMLTableShapeContext::StartElement( const css::uno::Reference< css::xml::
             {
                 Reference< XStyleFamiliesSupplier > xFamiliesSupp( GetImport().GetModel(), UNO_QUERY_THROW );
                 Reference< XNameAccess > xFamilies( xFamiliesSupp->getStyleFamilies() );
-                const OUString sFamilyName( "table"  );
-                Reference< XNameAccess > xTableFamily( xFamilies->getByName( sFamilyName ), UNO_QUERY_THROW );
+                Reference< XNameAccess > xTableFamily( xFamilies->getByName( "table" ), UNO_QUERY_THROW );
                 Reference< XStyle > xTableStyle( xTableFamily->getByName( msTemplateStyleName ), UNO_QUERY_THROW );
                 xProps->setPropertyValue("TableTemplate", Any( xTableStyle ) );
             }
diff --git a/xmloff/source/draw/ximpstyl.cxx b/xmloff/source/draw/ximpstyl.cxx
index b0968f1b6612..e8d770e7637f 100644
--- a/xmloff/source/draw/ximpstyl.cxx
+++ b/xmloff/source/draw/ximpstyl.cxx
@@ -1166,8 +1166,7 @@ void SdXMLStylesContext::ImpSetGraphicStyles() const
 {
     if(GetSdImport().GetLocalDocStyleFamilies().is()) try
     {
-        const OUString sGraphicStyleName("graphics");
-        uno::Reference< container::XNameAccess > xGraphicPageStyles( GetSdImport().GetLocalDocStyleFamilies()->getByName(sGraphicStyleName), uno::UNO_QUERY_THROW );
+        uno::Reference< container::XNameAccess > xGraphicPageStyles( GetSdImport().GetLocalDocStyleFamilies()->getByName("graphics"), uno::UNO_QUERY_THROW );
 
         ImpSetGraphicStyles(xGraphicPageStyles, XmlStyleFamily::SD_GRAPHICS_ID, OUString());
     }
@@ -1181,8 +1180,7 @@ void SdXMLStylesContext::ImpSetCellStyles() const
 {
     if(GetSdImport().GetLocalDocStyleFamilies().is()) try
     {
-        const OUString sCellStyleName("cell");
-        uno::Reference< container::XNameAccess > xGraphicPageStyles( GetSdImport().GetLocalDocStyleFamilies()->getByName(sCellStyleName), uno::UNO_QUERY_THROW );
+        uno::Reference< container::XNameAccess > xGraphicPageStyles( GetSdImport().GetLocalDocStyleFamilies()->getByName("cell"), uno::UNO_QUERY_THROW );
 
         ImpSetGraphicStyles(xGraphicPageStyles, XmlStyleFamily::TABLE_CELL, OUString());
     }
diff --git a/xmloff/source/style/xmlbahdl.cxx b/xmloff/source/style/xmlbahdl.cxx
index 87b1e1c69363..b4016039dff2 100644
--- a/xmloff/source/style/xmlbahdl.cxx
+++ b/xmloff/source/style/xmlbahdl.cxx
@@ -435,8 +435,7 @@ bool XMLColorPropHdl::importXML( const OUString& rStrImpValue, Any& rValue, cons
 {
     bool bRet = false;
 
-    const OUString astrHSL( "hsl"  );
-    if( rStrImpValue.matchIgnoreAsciiCase( astrHSL ) )
+    if( rStrImpValue.matchIgnoreAsciiCase( "hsl" ) )
     {
         sal_Int32 nOpen = rStrImpValue.indexOf( '(' );
         sal_Int32 nClose = rStrImpValue.lastIndexOf( ')' );
diff --git a/xmloff/source/style/xmlnume.cxx b/xmloff/source/style/xmlnume.cxx
index 78635379f6da..d8b4e3c8a6b3 100644
--- a/xmloff/source/style/xmlnume.cxx
+++ b/xmloff/source/style/xmlnume.cxx
@@ -736,8 +736,7 @@ void SvxXMLNumRuleExport::exportOutline()
                     xCNSupplier->getChapterNumberingRules(), UNO_QUERY );
                 if (xNumRulePropSet.is())
                 {
-                    const OUString sName( "Name" );
-                    xNumRulePropSet->getPropertyValue( sName ) >>= sOutlineStyleName;
+                    xNumRulePropSet->getPropertyValue( "Name" ) >>= sOutlineStyleName;
                 }
             }
             const SvtSaveOptions::ODFSaneDefaultVersion nODFVersion =
diff --git a/xmloff/source/style/xmlnumi.cxx b/xmloff/source/style/xmlnumi.cxx
index a8924c5a7828..0682de0e390b 100644
--- a/xmloff/source/style/xmlnumi.cxx
+++ b/xmloff/source/style/xmlnumi.cxx
@@ -519,9 +519,8 @@ Sequence<beans::PropertyValue> SvxXMLListLevelStyleContext_Impl::GetProperties()
 
             // Must append 'cBullet' even if it is zero
             // if 'bBullet' is true and 'cBullet' is zero - BulletChar property must be 0.
-            OUString sTmp = OUStringChar( cBullet );
             pProps[nPos].Name = "BulletChar";
-            pProps[nPos++].Value <<= sTmp;
+            pProps[nPos++].Value <<= OUString( cBullet );
 
             pProps[nPos].Name = "BulletFont";
             pProps[nPos++].Value <<= aFDesc;
@@ -1261,9 +1260,8 @@ void SvxXMLListStyleContext::SetDefaultStyle(
         pProps->Name = "BulletFont";
         (pProps++)->Value <<= aFDesc;
 
-        OUString sTmp = OUStringChar(sal_Unicode(0xF000 + 149));
         pProps->Name = "BulletChar";
-        (pProps++)->Value <<= sTmp;
+        (pProps++)->Value <<= OUString(sal_Unicode(0xF000 + 149));
         pProps->Name = "CharStyleName";
         (pProps++)->Value <<= OUString( "Numbering Symbols"  );
     }
diff --git a/xmloff/source/table/XMLTableImport.cxx b/xmloff/source/table/XMLTableImport.cxx
index 0c29b44e0a7f..09a158845ef7 100644
--- a/xmloff/source/table/XMLTableImport.cxx
+++ b/xmloff/source/table/XMLTableImport.cxx
@@ -256,11 +256,9 @@ void XMLTableImport::insertTabletemplate(const OUString& rsStyleName, bool bOver
     {
         Reference<XStyleFamiliesSupplier> xFamiliesSupp(mrImport.GetModel(), UNO_QUERY_THROW);
         Reference<XNameAccess> xFamilies(xFamiliesSupp->getStyleFamilies());
-        const OUString sFamilyName("TableStyles");
-        const OUString sCellFamilyName("CellStyles");
 
-        Reference<XNameContainer> xTableFamily(xFamilies->getByName(sFamilyName), UNO_QUERY_THROW);
-        Reference<XIndexAccess> xCellFamily(xFamilies->getByName(sCellFamilyName), UNO_QUERY_THROW);
+        Reference<XNameContainer> xTableFamily(xFamilies->getByName("TableStyles"), UNO_QUERY_THROW);
+        Reference<XIndexAccess> xCellFamily(xFamilies->getByName("CellStyles"), UNO_QUERY_THROW);
 
         const OUString sTemplateName(it->first);
         Reference<XMultiServiceFactory> xFactory(mrImport.GetModel(), UNO_QUERY_THROW);
@@ -313,11 +311,9 @@ void XMLTableImport::finishStyles()
     {
         Reference< XStyleFamiliesSupplier > xFamiliesSupp( mrImport.GetModel(), UNO_QUERY_THROW );
         Reference< XNameAccess > xFamilies( xFamiliesSupp->getStyleFamilies() );
-        const OUString sFamilyName( "table" );
-        const OUString sCellFamilyName( "cell" );
 
-        Reference< XNameContainer > xTableFamily( xFamilies->getByName( sFamilyName ), UNO_QUERY_THROW );
-        Reference< XNameAccess > xCellFamily( xFamilies->getByName( sCellFamilyName ), UNO_QUERY_THROW );
+        Reference< XNameContainer > xTableFamily( xFamilies->getByName( "table" ), UNO_QUERY_THROW );
+        Reference< XNameAccess > xCellFamily( xFamilies->getByName( "cell" ), UNO_QUERY_THROW );
 
         Reference< XSingleServiceFactory > xFactory( xTableFamily, UNO_QUERY_THROW );
 
diff --git a/xmloff/source/text/XMLSectionExport.cxx b/xmloff/source/text/XMLSectionExport.cxx
index 7b03730e5b59..7ba32b3f40d8 100644
--- a/xmloff/source/text/XMLSectionExport.cxx
+++ b/xmloff/source/text/XMLSectionExport.cxx
@@ -1586,32 +1586,24 @@ void XMLSectionExport::ExportBibliographyConfiguration(SvXMLExport& rExport)
 
             OSL_ENSURE( xPropSet.is(), "field master must have XPropSet" );
 
-            const OUString sBracketBefore("BracketBefore");
-            const OUString sBracketAfter("BracketAfter");
-            const OUString sIsNumberEntries("IsNumberEntries");
-            const OUString sIsSortByPosition("IsSortByPosition");
-            const OUString sSortKeys("SortKeys");
-            const OUString sSortAlgorithm("SortAlgorithm");
-            const OUString sLocale("Locale");
-
             OUString sTmp;
 
-            aAny = xPropSet->getPropertyValue(sBracketBefore);
+            aAny = xPropSet->getPropertyValue("BracketBefore");
             aAny >>= sTmp;
             rExport.AddAttribute(XML_NAMESPACE_TEXT, XML_PREFIX, sTmp);
 
-            aAny = xPropSet->getPropertyValue(sBracketAfter);
+            aAny = xPropSet->getPropertyValue("BracketAfter");
             aAny >>= sTmp;
             rExport.AddAttribute(XML_NAMESPACE_TEXT, XML_SUFFIX, sTmp);
 
-            aAny = xPropSet->getPropertyValue(sIsNumberEntries);
+            aAny = xPropSet->getPropertyValue("IsNumberEntries");
             if (*o3tl::doAccess<bool>(aAny))
             {
                 rExport.AddAttribute(XML_NAMESPACE_TEXT,
                                      XML_NUMBERED_ENTRIES, XML_TRUE);
             }
 
-            aAny = xPropSet->getPropertyValue(sIsSortByPosition);
+            aAny = xPropSet->getPropertyValue("IsSortByPosition");
             if (! *o3tl::doAccess<bool>(aAny))
             {
                 rExport.AddAttribute(XML_NAMESPACE_TEXT,
@@ -1619,7 +1611,7 @@ void XMLSectionExport::ExportBibliographyConfiguration(SvXMLExport& rExport)
             }
 
             // sort algorithm
-            aAny = xPropSet->getPropertyValue(sSortAlgorithm);
+            aAny = xPropSet->getPropertyValue("SortAlgorithm");
             OUString sAlgorithm;
             aAny >>= sAlgorithm;
             if( !sAlgorithm.isEmpty() )
@@ -1629,7 +1621,7 @@ void XMLSectionExport::ExportBibliographyConfiguration(SvXMLExport& rExport)
             }
 
             // locale
-            aAny = xPropSet->getPropertyValue(sLocale);
+            aAny = xPropSet->getPropertyValue("Locale");
             Locale aLocale;
             aAny >>= aLocale;
             rExport.AddLanguageTagAttributes( XML_NAMESPACE_FO, XML_NAMESPACE_STYLE, aLocale, true);
@@ -1640,7 +1632,7 @@ void XMLSectionExport::ExportBibliographyConfiguration(SvXMLExport& rExport)
                                         true, true);
 
             // sort keys
-            aAny = xPropSet->getPropertyValue(sSortKeys);
+            aAny = xPropSet->getPropertyValue("SortKeys");
             Sequence<Sequence<PropertyValue> > aKeys;
             aAny >>= aKeys;
             for(const Sequence<PropertyValue> & rKey : std::as_const(aKeys))
diff --git a/xmloff/source/text/XMLSectionSourceImportContext.cxx b/xmloff/source/text/XMLSectionSourceImportContext.cxx
index 2ae4e671f7c0..47241b1d9708 100644
--- a/xmloff/source/text/XMLSectionSourceImportContext.cxx
+++ b/xmloff/source/text/XMLSectionSourceImportContext.cxx
@@ -108,22 +108,18 @@ void XMLSectionSourceImportContext::StartElement(
         }
     }
 
-    // we only need them once
-    const OUString sFileLink("FileLink");
-    const OUString sLinkRegion("LinkRegion");
-
     if (!sURL.isEmpty() || !sFilterName.isEmpty())
     {
         SectionFileLink aFileLink;
         aFileLink.FileURL = GetImport().GetAbsoluteReference( sURL );
         aFileLink.FilterName = sFilterName;
 
-        rSectionPropertySet->setPropertyValue(sFileLink, Any(aFileLink));
+        rSectionPropertySet->setPropertyValue("FileLink", Any(aFileLink));
     }
 
     if (!sSectionName.isEmpty())
     {
-        rSectionPropertySet->setPropertyValue(sLinkRegion, Any(sSectionName));
+        rSectionPropertySet->setPropertyValue("LinkRegion", Any(sSectionName));
     }
 }
 
diff --git a/xmloff/source/text/txtimp.cxx b/xmloff/source/text/txtimp.cxx
index d59918c8a6e6..5349d4516a77 100644
--- a/xmloff/source/text/txtimp.cxx
+++ b/xmloff/source/text/txtimp.cxx
@@ -2034,8 +2034,7 @@ void XMLTextImportHelper::SetOutlineStyles( bool bSetEmptyLevels )
     {
         Reference<XPropertySet> xChapterNumRule(
             m_xImpl->m_xChapterNumbering, UNO_QUERY);
-        const OUString sName("Name");
-        xChapterNumRule->getPropertyValue(sName) >>= sOutlineStyleName;
+        xChapterNumRule->getPropertyValue("Name") >>= sOutlineStyleName;
     }
 
     const sal_Int32 nCount = m_xImpl->m_xChapterNumbering->getCount();
diff --git a/xmloff/source/text/txtparai.cxx b/xmloff/source/text/txtparai.cxx
index dc59304fb368..618cd85bf5bf 100644
--- a/xmloff/source/text/txtparai.cxx
+++ b/xmloff/source/text/txtparai.cxx
@@ -1647,9 +1647,7 @@ SvXMLImportContextRef XMLImpSpanContext_Impl::CreateChildContext(
         // field (StarCalc, StarDraw, ...)
         Reference< beans::XPropertySet > xPropSet( rImport.GetTextImport()->GetCursor(), UNO_QUERY );
 
-        const OUString sHyperLinkURL("HyperLinkURL");
-
-        if ( xPropSet->getPropertySetInfo()->hasPropertyByName( sHyperLinkURL ) )
+        if ( xPropSet->getPropertySetInfo()->hasPropertyByName( "HyperLinkURL" ) )
         {
             pContext = new XMLImpHyperlinkContext_Impl(
                     rImport,


More information about the Libreoffice-commits mailing list