[Libreoffice-commits] core.git: oox/qa oox/source

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Thu Jun 4 16:11:30 UTC 2020


 oox/qa/unit/vba_encryption.cxx                   |    3 +--
 oox/source/drawingml/hyperlinkcontext.cxx        |   12 ++++--------
 oox/source/drawingml/shape.cxx                   |   18 ++++++------------
 oox/source/drawingml/textparagraph.cxx           |    3 +--
 oox/source/drawingml/textparagraphproperties.cxx |    3 +--
 oox/source/ppt/presentationfragmenthandler.cxx   |    6 ++----
 6 files changed, 15 insertions(+), 30 deletions(-)

New commits:
commit 54e35feef17580cfcbf0a2db1272fb05c85e2348
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Thu Jun 4 13:57:23 2020 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Thu Jun 4 18:10:45 2020 +0200

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

diff --git a/oox/qa/unit/vba_encryption.cxx b/oox/qa/unit/vba_encryption.cxx
index 7e8a44cd9c20..326711cae9fc 100644
--- a/oox/qa/unit/vba_encryption.cxx
+++ b/oox/qa/unit/vba_encryption.cxx
@@ -73,8 +73,7 @@ void TestVbaEncryption::testSimple2()
 
 void TestVbaEncryption::testProjKey1()
 {
-    OUString const aProjectID("{917DED54-440B-4FD1-A5C1-74ACF261E600}");
-    sal_uInt8 nProjKey = VBAEncryption::calculateProjKey(aProjectID);
+    sal_uInt8 nProjKey = VBAEncryption::calculateProjKey("{917DED54-440B-4FD1-A5C1-74ACF261E600}");
     CPPUNIT_ASSERT_EQUAL(int(0xdf), static_cast<int>(nProjKey));
 }
 
diff --git a/oox/source/drawingml/hyperlinkcontext.cxx b/oox/source/drawingml/hyperlinkcontext.cxx
index 3c19892815d4..d0a09b140dcf 100644
--- a/oox/source/drawingml/hyperlinkcontext.cxx
+++ b/oox/source/drawingml/hyperlinkcontext.cxx
@@ -85,9 +85,7 @@ HyperLinkContext::HyperLinkContext( ContextHandler2Helper const & rParent,
             sal_Int32 nIndex = aPPAct.indexOf( '?' );
             OUString aPPAction( nIndex > 0 ? aPPAct.copy( 0, nIndex ) : aPPAct );
 
-            const OUString sHlinkshowjump( "hlinkshowjump" );
-            const OUString sHlinksldjump( "hlinksldjump" );
-            if ( aPPAction.match( sHlinkshowjump ) )
+            if ( aPPAction.match( "hlinkshowjump" ) )
             {
                 const OUString sJump( "jump=" );
                 if ( aPPAct.match( sJump, nIndex + 1 ) )
@@ -96,7 +94,7 @@ HyperLinkContext::HyperLinkContext( ContextHandler2Helper const & rParent,
                     sURL += "#action?jump=" + aDestination;
                 }
             }
-            else if ( aPPAction.match( sHlinksldjump ) )
+            else if ( aPPAction.match( "hlinksldjump" ) )
             {
                 sURL.clear();
 
@@ -121,12 +119,10 @@ HyperLinkContext::HyperLinkContext( ContextHandler2Helper const & rParent,
                     sal_Int32 nPageNumber = sHref.copy( nIndex2, nLength ).toInt32();
                     if ( nPageNumber )
                     {
-                        const OUString sSlide( "slide" );
-                        const OUString sNotesSlide( "notesSlide" );
                         const OUString aSlideType( sHref.copy( 0, nIndex2 ) );
-                        if ( aSlideType.match( sSlide ) )
+                        if ( aSlideType.match( "slide" ) )
                             sURL = "#Slide " + OUString::number( nPageNumber );
-                        else if ( aSlideType.match( sNotesSlide ) )
+                        else if ( aSlideType.match( "notesSlide" ) )
                             sURL = "#Notes " + OUString::number( nPageNumber );
 //                      else: todo for other types such as notesMaster or slideMaster as they can't be referenced easily
                     }
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 3fedf4dbb761..1e9d2ea55a46 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -587,16 +587,13 @@ static void lcl_createPresetShape(const uno::Reference<drawing::XShape>& xShape,
             aGeomPropSeq );
 
     // Reset old properties
-    const OUString sCoordinateSize( "CoordinateSize" );
-    const OUString sEquations( "Equations" );
-    const OUString sPath( "Path" );
     const OUString sTextPath( "TextPath" );
     const OUString sAdjustmentValues( "AdjustmentValues" );
     const OUString sPresetTextWarp( "PresetTextWarp" );
 
-    lcl_resetPropertyValue( aGeomPropVec, sCoordinateSize );
-    lcl_resetPropertyValue( aGeomPropVec, sEquations );
-    lcl_resetPropertyValue( aGeomPropVec, sPath );
+    lcl_resetPropertyValue( aGeomPropVec, "CoordinateSize" );
+    lcl_resetPropertyValue( aGeomPropVec, "Equations" );
+    lcl_resetPropertyValue( aGeomPropVec, "Path" );
     lcl_resetPropertyValue( aGeomPropVec, sAdjustmentValues);
 
     bool bFromWordArt(false);
@@ -899,8 +896,7 @@ Reference< XShape > const & Shape::createAndInsert(
         }
         if( !msDescription.isEmpty() )
         {
-            const OUString sDescription( "Description" );
-            xSet->setPropertyValue( sDescription, Any( msDescription ) );
+            xSet->setPropertyValue( "Description", Any( msDescription ) );
         }
         if (aServiceName != "com.sun.star.text.TextFrame")
             rxShapes->add( mxShape );
@@ -908,11 +904,9 @@ Reference< XShape > const & Shape::createAndInsert(
         if ( mbHidden || mbHiddenMasterShape )
         {
             SAL_INFO("oox.drawingml", "Shape::createAndInsert: invisible shape with id='" << msId << "'");
-            const OUString sVisible( "Visible" );
-            xSet->setPropertyValue( sVisible, Any( false ) );
+            xSet->setPropertyValue( "Visible", Any( false ) );
             // In Excel hidden means not printed, let's use visibility for now until that's handled separately
-            const OUString sPrintable( "Printable" );
-            xSet->setPropertyValue( sPrintable, Any( false ) );
+            xSet->setPropertyValue( "Printable", Any( false ) );
         }
 
         if (mbLocked)
diff --git a/oox/source/drawingml/textparagraph.cxx b/oox/source/drawingml/textparagraph.cxx
index 098bf102900a..ea00199a15fc 100644
--- a/oox/source/drawingml/textparagraph.cxx
+++ b/oox/source/drawingml/textparagraph.cxx
@@ -159,8 +159,7 @@ void TextParagraph::insertAt(
         // empty paragraphs do not have bullets in ppt
         if ( !nParagraphSize )
         {
-            const OUString sNumberingLevel( "NumberingLevel" );
-            xProps->setPropertyValue( sNumberingLevel, Any( static_cast< sal_Int16 >( -1 ) ) );
+            xProps->setPropertyValue( "NumberingLevel", Any( static_cast< sal_Int16 >( -1 ) ) );
         }
 
 // FIXME this is causing a lot of disruption (ie does not work). I wonder what to do -- Hub
diff --git a/oox/source/drawingml/textparagraphproperties.cxx b/oox/source/drawingml/textparagraphproperties.cxx
index 9a0a4bc6319d..8121edb156ff 100644
--- a/oox/source/drawingml/textparagraphproperties.cxx
+++ b/oox/source/drawingml/textparagraphproperties.cxx
@@ -513,8 +513,7 @@ void TextParagraphProperties::dump() const
 
     PropertyMap emptyMap;
 
-    const OUString sText = "debug";
-    xText->setString( sText );
+    xText->setString( "debug" );
     Reference< css::text::XTextCursor > xStart = xText->createTextCursor();
     xStart->gotoEnd( true );
     Reference< XPropertySet > xPropSet( xStart, UNO_QUERY );
diff --git a/oox/source/ppt/presentationfragmenthandler.cxx b/oox/source/ppt/presentationfragmenthandler.cxx
index 03863baa8b3d..fd83c30b817a 100644
--- a/oox/source/ppt/presentationfragmenthandler.cxx
+++ b/oox/source/ppt/presentationfragmenthandler.cxx
@@ -378,7 +378,6 @@ void PresentationFragmentHandler::importSlide(sal_uInt32 nSlide, bool bFirstPage
             {
                 // Comments are present and commentAuthors.xml has still not been read
                 mbCommentAuthorsRead = true;
-                OUString aCommentAuthorsFragmentPath = "ppt/commentAuthors.xml";
                 Reference< XPresentationPage > xPresentationPage( xSlide, UNO_QUERY );
                 Reference< XDrawPage > xCommentAuthorsPage( xPresentationPage->getNotesPage() );
                 SlidePersistPtr pCommentAuthorsPersistPtr =
@@ -388,7 +387,7 @@ void PresentationFragmentHandler::importSlide(sal_uInt32 nSlide, bool bFirstPage
                                       mpTextListStyle );
                 FragmentHandlerRef xCommentAuthorsFragmentHandler(
                     new SlideFragmentHandler( getFilter(),
-                                              aCommentAuthorsFragmentPath,
+                                              "ppt/commentAuthors.xml",
                                               pCommentAuthorsPersistPtr,
                                               Slide ) );
 
@@ -568,9 +567,8 @@ void PresentationFragmentHandler::importSlide( const FragmentHandlerRef& rxSlide
         Reference< drawing::XDrawPage > xMasterSlide(pMasterPersistPtr->getPage());
         const int nCount = xMasterSlide->getCount();
 
-        const OUString sLayout = "Layout";
         uno::Reference< beans::XPropertySet > xSet( xSlide, uno::UNO_QUERY_THROW );
-        xSet->setPropertyValue( sLayout, Any( pMasterPersistPtr->getLayoutFromValueToken() ) );
+        xSet->setPropertyValue( "Layout", Any( pMasterPersistPtr->getLayoutFromValueToken() ) );
 
         while( nCount < xMasterSlide->getCount())
         {


More information about the Libreoffice-commits mailing list