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

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Fri Jun 5 12:21:28 UTC 2020


 sfx2/qa/cppunit/test_metadatable.cxx    |    9 +++------
 sfx2/source/dialog/dockwin.cxx          |    3 +--
 sfx2/source/dialog/mailmodel.cxx        |    3 +--
 sfx2/source/dialog/partwnd.cxx          |    3 +--
 sfx2/source/doc/SfxDocumentMetaData.cxx |    4 +---
 sfx2/source/doc/doctemplates.cxx        |    3 +--
 sfx2/source/doc/guisaveas.cxx           |    3 +--
 sfx2/source/doc/templatedlg.cxx         |    3 +--
 sfx2/source/view/viewsh.cxx             |    3 +--
 9 files changed, 11 insertions(+), 23 deletions(-)

New commits:
commit 7653e4f209a5e81860d029c8a6c5436c0b25efdb
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Fri Jun 5 07:36:56 2020 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Fri Jun 5 14:20:51 2020 +0200

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

diff --git a/sfx2/qa/cppunit/test_metadatable.cxx b/sfx2/qa/cppunit/test_metadatable.cxx
index 06b18edfec43..7508d467a7ac 100644
--- a/sfx2/qa/cppunit/test_metadatable.cxx
+++ b/sfx2/qa/cppunit/test_metadatable.cxx
@@ -84,15 +84,12 @@ void MetadatableTest::test()
     MockMetadatable m5(*pReg);
     OUString empty;
     OUString content( "content.xml" );
-    OUString const styles( "styles.xml" );
-    OUString const sid1( "id1" );
-    OUString const sid2( "id2" );
     OUString sid3( "id3" );
     OUString sid4( "id4" );
-    beans::StringPair id1(content, sid1);
-    beans::StringPair id2(content, sid2);
+    beans::StringPair id1(content, "id1");
+    beans::StringPair id2(content, "id2");
     beans::StringPair id3(content, sid3);
-    beans::StringPair id4(styles,  sid4);
+    beans::StringPair id4("styles.xml",  sid4);
     beans::StringPair id3e(empty,  sid3);
     beans::StringPair id4e(empty,  sid4);
     m1.SetMetadataReference(id1);
diff --git a/sfx2/source/dialog/dockwin.cxx b/sfx2/source/dialog/dockwin.cxx
index 926a68ab8bfa..0287b1ac1fb8 100644
--- a/sfx2/source/dialog/dockwin.cxx
+++ b/sfx2/source/dialog/dockwin.cxx
@@ -128,7 +128,6 @@ SfxDockingWrapper::SfxDockingWrapper( vcl::Window* pParentWnd ,
                     : SfxChildWindow( pParentWnd , nId )
 {
     uno::Reference< uno::XComponentContext > xContext = ::comphelper::getProcessComponentContext();
-    const OUString aDockWindowResourceURL( "private:resource/dockingwindow/" );
 
     VclPtr<SfxTitleDockingWindow> pTitleDockWindow = VclPtr<SfxTitleDockingWindow>::Create( pBindings, this, pParentWnd,
         WB_STDDOCKWIN | WB_CLIPCHILDREN | WB_SIZEABLE | WB_3DLOOK | WB_ROLLABLE);
@@ -141,7 +140,7 @@ SfxDockingWrapper::SfxDockingWrapper( vcl::Window* pParentWnd ,
     SfxDispatcher* pDispatcher = pBindings->GetDispatcher();
     uno::Reference< frame::XFrame > xFrame = pDispatcher->GetFrame()->GetFrame().GetFrameInterface();
     // create a resource URL from the nId provided by the sfx2
-    OUString aResourceURL =  aDockWindowResourceURL + OUString::number(nId);
+    OUString aResourceURL =  "private:resource/dockingwindow/" + OUString::number(nId);
     uno::Sequence<uno::Any> aArgs(comphelper::InitAnyPropertySequence(
     {
         {"Frame", uno::Any(xFrame)},
diff --git a/sfx2/source/dialog/mailmodel.cxx b/sfx2/source/dialog/mailmodel.cxx
index 63e29270d6c2..a58080b601ee 100644
--- a/sfx2/source/dialog/mailmodel.cxx
+++ b/sfx2/source/dialog/mailmodel.cxx
@@ -432,8 +432,7 @@ SfxMailModel::SaveResult SfxMailModel::SaveDocumentAsFormat(
                 if ( !bHasLocation )
                 {
                     // Create a noname file name with the correct extension
-                    const OUString aNoNameFileName( "noname" );
-                    aFileName = aNoNameFileName;
+                    aFileName = "noname";
                 }
                 else
                 {
diff --git a/sfx2/source/dialog/partwnd.cxx b/sfx2/source/dialog/partwnd.cxx
index 367eb49e0d93..e387d2c5ba1c 100644
--- a/sfx2/source/dialog/partwnd.cxx
+++ b/sfx2/source/dialog/partwnd.cxx
@@ -105,8 +105,7 @@ SfxPartDockWnd_Impl::SfxPartDockWnd_Impl
     {
         css::uno::Reference< css::beans::XPropertySet > xLMPropSet( xFrame->getLayoutManager(), css::uno::UNO_QUERY_THROW );
 
-        const OUString aAutomaticToolbars( "AutomaticToolbars" );
-        xLMPropSet->setPropertyValue( aAutomaticToolbars, css::uno::Any( false ));
+        xLMPropSet->setPropertyValue( "AutomaticToolbars", css::uno::Any( false ));
     }
     catch( css::uno::RuntimeException& )
     {
diff --git a/sfx2/source/doc/SfxDocumentMetaData.cxx b/sfx2/source/doc/SfxDocumentMetaData.cxx
index 8c2e577eda67..c8638a52fa33 100644
--- a/sfx2/source/doc/SfxDocumentMetaData.cxx
+++ b/sfx2/source/doc/SfxDocumentMetaData.cxx
@@ -1054,13 +1054,11 @@ void SfxDocumentMetaData::init(
     // NB: we do not handle the single-XML-file ODF variant, which would
     //     have the root element office:document.
     //     The root of such documents must be converted in the importer!
-    OUString const prefix(
-        "/child::office:document-meta/child::office:meta");
     css::uno::Reference<css::xml::dom::XNode> xDocNode(
         m_xDoc, css::uno::UNO_QUERY_THROW);
     m_xParent.clear();
     try {
-        m_xParent = xPath->selectSingleNode(xDocNode, prefix);
+        m_xParent = xPath->selectSingleNode(xDocNode, "/child::office:document-meta/child::office:meta");
     } catch (const css::uno::Exception &) {
     }
 
diff --git a/sfx2/source/doc/doctemplates.cxx b/sfx2/source/doc/doctemplates.cxx
index 966293d4de23..d8b9614af046 100644
--- a/sfx2/source/doc/doctemplates.cxx
+++ b/sfx2/source/doc/doctemplates.cxx
@@ -431,8 +431,7 @@ void SfxDocTplService_Impl::init_Impl()
             TOOLS_WARN_EXCEPTION("sfx.doc", "SfxDocTplService_Impl::init_Impl: cannot create DocumentProperties service:");
         }
 
-        OUString const aService = SERVICENAME_TYPEDETECTION;
-        mxType.set( mxContext->getServiceManager()->createInstanceWithContext(aService, mxContext), UNO_QUERY );
+        mxType.set( mxContext->getServiceManager()->createInstanceWithContext(SERVICENAME_TYPEDETECTION, mxContext), UNO_QUERY );
 
         getDirList();
         readFolderList();
diff --git a/sfx2/source/doc/guisaveas.cxx b/sfx2/source/doc/guisaveas.cxx
index eb94e0873e6e..9aacff35b760 100644
--- a/sfx2/source/doc/guisaveas.cxx
+++ b/sfx2/source/doc/guisaveas.cxx
@@ -1457,7 +1457,6 @@ bool SfxStoringHelper::GUIStoreModel( const uno::Reference< frame::XModel >& xMo
 
     const OUString sFilterOptionsString(aFilterOptionsString);
     const OUString sFilterDataString(aFilterDataString);
-    const OUString sFilterFlagsString("FilterFlags");
 
     bool bPDFOptions = (nStoreMode & PDFEXPORT_REQUESTED) && !(nStoreMode & PDFDIRECTEXPORT_REQUESTED);
     bool bEPUBOptions = (nStoreMode & EPUBEXPORT_REQUESTED) && !(nStoreMode & EPUBDIRECTEXPORT_REQUESTED);
@@ -1465,7 +1464,7 @@ bool SfxStoringHelper::GUIStoreModel( const uno::Reference< frame::XModel >& xMo
     {
         // this is PDF or EPUB export, the filter options dialog should be shown before the export
         aModelData.GetMediaDescr()[sFilterNameString] <<= aFilterName;
-        if ( aModelData.GetMediaDescr().find( sFilterFlagsString ) == aModelData.GetMediaDescr().end()
+        if ( aModelData.GetMediaDescr().find( "FilterFlags" ) == aModelData.GetMediaDescr().end()
           && aModelData.GetMediaDescr().find( sFilterOptionsString ) == aModelData.GetMediaDescr().end()
           && aModelData.GetMediaDescr().find( sFilterDataString ) == aModelData.GetMediaDescr().end() )
         {
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index 3979db7cf573..9276c67ca000 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -1029,13 +1029,12 @@ void SfxTemplateManagerDlg::OnTemplateExport()
 
 void SfxTemplateManagerDlg::OnTemplateLink ()
 {
-    OUString sNodePath("/org.openoffice.Office.Common/Help/StartCenter");
     try
     {
         Reference<lang::XMultiServiceFactory> xConfig = configuration::theDefaultProvider::get( comphelper::getProcessComponentContext() );
         uno::Sequence<uno::Any> args(comphelper::InitAnyPropertySequence(
         {
-            {"nodepath", uno::Any(sNodePath)}
+            {"nodepath", uno::Any(OUString("/org.openoffice.Office.Common/Help/StartCenter"))}
         }));
         Reference<container::XNameAccess> xNameAccess(xConfig->createInstanceWithArguments("com.sun.star.configuration.ConfigurationAccess", args), UNO_QUERY);
         if( xNameAccess.is() )
diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx
index fcda0b176512..ae468e47395f 100644
--- a/sfx2/source/view/viewsh.cxx
+++ b/sfx2/source/view/viewsh.cxx
@@ -596,8 +596,7 @@ void SfxViewShell::ExecMisc_Impl( SfxRequest &rReq )
                 if ( !bHasLocation )
                 {
                     // Create a default file name with the correct extension
-                    const OUString aPreviewFileName( "webpreview" );
-                    aFileName = aPreviewFileName;
+                    aFileName = "webpreview";
                 }
                 else
                 {


More information about the Libreoffice-commits mailing list