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

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Fri Jun 5 05:35:06 UTC 2020


 sc/qa/extras/macros-test.cxx                                 |   12 --
 sc/qa/extras/sccellrangeobj.cxx                              |    3 
 sc/qa/unit/helper/shared_test_impl.hxx                       |    3 
 sc/qa/unit/scshapetest.cxx                                   |    3 
 sc/qa/unit/subsequent_export-test.cxx                        |    3 
 sc/qa/unit/subsequent_filters-test.cxx                       |   17 +--
 sc/qa/unit/ucalc.cxx                                         |   52 +++------
 sc/qa/unit/ucalc_formula.cxx                                 |   58 +++--------
 sc/source/core/data/documen3.cxx                             |    3 
 sc/source/core/tool/compiler.cxx                             |    3 
 sc/source/filter/xml/xmlwrap.cxx                             |    3 
 sc/source/ui/Accessibility/AccessibleCellBase.cxx            |    4 
 sc/source/ui/Accessibility/AccessibleDocument.cxx            |    3 
 sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx |    3 
 sc/source/ui/Accessibility/AccessiblePreviewHeaderCell.cxx   |    3 
 sc/source/ui/attrdlg/scabstdlg.cxx                           |    4 
 sc/source/ui/docshell/docsh4.cxx                             |    9 -
 sc/source/ui/docshell/impex.cxx                              |    3 
 sc/source/ui/miscdlgs/linkarea.cxx                           |    7 -
 sc/source/ui/vba/vbaworksheet.cxx                            |    3 
 20 files changed, 65 insertions(+), 134 deletions(-)

New commits:
commit 4b85108773f9851f358a4daa8869eeadc638d103
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Thu Jun 4 21:23:01 2020 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Fri Jun 5 07:34:21 2020 +0200

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

diff --git a/sc/qa/extras/macros-test.cxx b/sc/qa/extras/macros-test.cxx
index 3801a9998895..ee1aa5c6fe27 100644
--- a/sc/qa/extras/macros-test.cxx
+++ b/sc/qa/extras/macros-test.cxx
@@ -77,9 +77,8 @@ void ScMacrosTest::saveAndReload(css::uno::Reference<css::lang::XComponent>& xCo
 // module, we could move the test there then ) - relates to fdo#67547
 void ScMacrosTest::testMSP()
 {
-    const OUString aFileNameBase("MasterScriptProviderProblem.ods");
     OUString aFileName;
-    createFileURL(aFileNameBase, aFileName);
+    createFileURL("MasterScriptProviderProblem.ods", aFileName);
     uno::Reference< css::lang::XComponent > xComponent = loadFromDesktop(aFileName, "com.sun.star.sheet.SpreadsheetDocument");
 
     CPPUNIT_ASSERT_MESSAGE("Failed to load MasterScriptProviderProblem.ods", xComponent.is());
@@ -109,9 +108,8 @@ void ScMacrosTest::testMSP()
 
 void ScMacrosTest::testPasswordProtectedStarBasic()
 {
-    const OUString aFileNameBase("testTypePassword.ods");
     OUString aFileName;
-    createFileURL(aFileNameBase, aFileName);
+    createFileURL("testTypePassword.ods", aFileName);
     uno::Reference< css::lang::XComponent > xComponent = loadFromDesktop(aFileName, "com.sun.star.sheet.SpreadsheetDocument");
 
     CPPUNIT_ASSERT_MESSAGE("Failed to load testTypePassword.ods", xComponent.is());
@@ -164,9 +162,8 @@ void ScMacrosTest::testPasswordProtectedStarBasic()
 
 void ScMacrosTest::testStarBasic()
 {
-    const OUString aFileNameBase("StarBasic.ods");
     OUString aFileName;
-    createFileURL(aFileNameBase, aFileName);
+    createFileURL("StarBasic.ods", aFileName);
     uno::Reference< css::lang::XComponent > xComponent = loadFromDesktop(aFileName, "com.sun.star.sheet.SpreadsheetDocument");
 
     CPPUNIT_ASSERT_MESSAGE("Failed to load StarBasic.ods", xComponent.is());
@@ -361,9 +358,8 @@ void ScMacrosTest::testVba()
 
 void ScMacrosTest::testRowColumn()
 {
-    const OUString aFileNameBase("StarBasic.ods");
     OUString aFileName;
-    createFileURL(aFileNameBase, aFileName);
+    createFileURL("StarBasic.ods", aFileName);
     uno::Reference< css::lang::XComponent > xComponent = loadFromDesktop(aFileName, "com.sun.star.sheet.SpreadsheetDocument");
 
     CPPUNIT_ASSERT_MESSAGE("Failed to load StarBasic.ods", xComponent.is());
diff --git a/sc/qa/extras/sccellrangeobj.cxx b/sc/qa/extras/sccellrangeobj.cxx
index 1c0513a9a836..689783dafcbd 100644
--- a/sc/qa/extras/sccellrangeobj.cxx
+++ b/sc/qa/extras/sccellrangeobj.cxx
@@ -249,8 +249,7 @@ void ScCellRangeObj::setUp()
     CalcUnoApiTest::setUp();
 
     OUString aFileURL;
-    const OUString aFileBase("xcellrangesquery.ods");
-    createFileURL(aFileBase, aFileURL);
+    createFileURL("xcellrangesquery.ods", aFileURL);
     mxComponent = loadFromDesktop(aFileURL, "com.sun.star.sheet.SpreadsheetDocument");
 }
 
diff --git a/sc/qa/unit/helper/shared_test_impl.hxx b/sc/qa/unit/helper/shared_test_impl.hxx
index 6dbd67769c85..e5bffd5c8f06 100644
--- a/sc/qa/unit/helper/shared_test_impl.hxx
+++ b/sc/qa/unit/helper/shared_test_impl.hxx
@@ -279,9 +279,8 @@ void testCeilingFloor_Impl( ScDocument& rDoc )
     // Original test case document is ceiling-floor.xlsx
     // Sheet1.K1 has =AND(K3:K81) to evaluate all results.
     const char pORef[] = "Sheet1.K1";
-    OUString aRef(pORef);
     ScAddress aPos;
-    aPos.Parse(aRef, &rDoc);
+    aPos.Parse(pORef, &rDoc);
     ASSERT_FORMULA_EQUAL(rDoc, aPos, "AND(K3:K81)", "Wrong formula.");
     CPPUNIT_ASSERT_MESSAGE( OString( pORef + OStringLiteral(" result is error.")).getStr(),
             isFormulaWithoutError( rDoc, aPos));
diff --git a/sc/qa/unit/scshapetest.cxx b/sc/qa/unit/scshapetest.cxx
index 4a9288acddac..5236f124cbc3 100644
--- a/sc/qa/unit/scshapetest.cxx
+++ b/sc/qa/unit/scshapetest.cxx
@@ -156,12 +156,11 @@ void ScShapeTest::testCustomShapeCellAnchoredRotatedShape()
     ScDrawObjData* pData = ScDrawLayer::GetObjData(pObj);
     CPPUNIT_ASSERT_MESSAGE("expected object meta data", pData);
 
-    const OUString sExpected("start col 1 row 1 end col 2 row 8");
     const OUString sActual("start col " + OUString::number(pData->maStart.Col()) + " row "
                            + OUString::number(pData->maStart.Row()) + " end col "
                            + OUString::number(pData->maEnd.Col()) + " row "
                            + OUString::number(pData->maEnd.Row()));
-    CPPUNIT_ASSERT_EQUAL(sExpected, sActual);
+    CPPUNIT_ASSERT_EQUAL(OUString("start col 1 row 1 end col 2 row 8"), sActual);
 
     pDocSh->DoClose();
 }
diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx
index 6d4830ad9276..4719a97cf241 100644
--- a/sc/qa/unit/subsequent_export-test.cxx
+++ b/sc/qa/unit/subsequent_export-test.cxx
@@ -4423,9 +4423,8 @@ void ScExportTest::testExponentWithoutSignFormatXLSX()
     rDoc.GetNumberFormat(0, 0, 0, nNumberFormat);
     const SvNumberformat* pNumberFormat = rDoc.GetFormatTable()->GetEntry(nNumberFormat);
     const OUString& rFormatStr = pNumberFormat->GetFormatstring();
-    const OUString aExpectedFormatStr = "0.00E0";
 
-    CPPUNIT_ASSERT_EQUAL_MESSAGE("Number format lost exponent without sign during Excel export", aExpectedFormatStr, rFormatStr);
+    CPPUNIT_ASSERT_EQUAL_MESSAGE("Number format lost exponent without sign during Excel export", OUString("0.00E0"), rFormatStr);
 
     xDocSh->DoClose();
 }
diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx
index 8f106f0d9da7..80a616339ed4 100644
--- a/sc/qa/unit/subsequent_filters-test.cxx
+++ b/sc/qa/unit/subsequent_filters-test.cxx
@@ -711,11 +711,10 @@ void ScFiltersTest::testCachedFormulaResultsODS()
         //we want to me sure that volatile functions are always recalculated
         //regardless of cached results.  if you update the ods file, you must
         //update the values here.
-        //if NOW() is recalculated, then it should never equal sTodayCache
-        OUString const sTodayCache("01/25/13 01:06 PM");
+        //if NOW() is recalculated, then it should never equal "01/25/13 01:06 PM"
         OUString sTodayRecalc(rDoc.GetString(0,0,1));
 
-        CPPUNIT_ASSERT(sTodayCache != sTodayRecalc);
+        CPPUNIT_ASSERT("01/25/13 01:06 PM" != sTodayRecalc);
 
         OUString sTodayRecalcRef(rDoc.GetString(1,0,1));
         CPPUNIT_ASSERT_EQUAL(sTodayRecalc, sTodayRecalcRef);
@@ -1554,11 +1553,10 @@ void ScFiltersTest::testDataTableMultiTableXLSX()
 
 void ScFiltersTest::testBrokenQuotesCSV()
 {
-    const OUString aFileNameBase("fdo48621_broken_quotes.");
     OUString aFileExtension(getFileFormats()[FORMAT_CSV].pName, strlen(getFileFormats()[FORMAT_CSV].pName), RTL_TEXTENCODING_UTF8 );
     OUString aFilterName(getFileFormats()[FORMAT_CSV].pFilterName, strlen(getFileFormats()[FORMAT_CSV].pFilterName), RTL_TEXTENCODING_UTF8) ;
     OUString aFileName;
-    createFileURL(aFileNameBase, aFileExtension, aFileName);
+    createFileURL("fdo48621_broken_quotes.", aFileExtension, aFileName);
     OUString aFilterType(getFileFormats()[FORMAT_CSV].pTypeName, strlen(getFileFormats()[FORMAT_CSV].pTypeName), RTL_TEXTENCODING_UTF8);
     std::cout << getFileFormats()[FORMAT_CSV].pName << " Test" << std::endl;
 
@@ -1670,23 +1668,20 @@ void ScFiltersTest::testPassword_Impl(const OUString& aFileNameBase)
 void ScFiltersTest::testPasswordNew()
 {
     //tests opening a file with new password algorithm
-    const OUString aFileNameBase("password.");
-    testPassword_Impl(aFileNameBase);
+    testPassword_Impl("password.");
 }
 
 void ScFiltersTest::testPasswordOld()
 {
     //tests opening a file with old password algorithm
-    const OUString aFileNameBase("passwordOld.");
-    testPassword_Impl(aFileNameBase);
+    testPassword_Impl("passwordOld.");
 }
 
 void ScFiltersTest::testPasswordWrongSHA()
 {
     //tests opening a file wrongly using the new password algorithm
     //in a sxc with the key algorithm missing
-    const OUString aFileNameBase("passwordWrongSHA.");
-    testPassword_Impl(aFileNameBase);
+    testPassword_Impl("passwordWrongSHA.");
 }
 
 void ScFiltersTest::testControlImport()
diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx
index 0dce6db3589b..49cd337570a1 100644
--- a/sc/qa/unit/ucalc.cxx
+++ b/sc/qa/unit/ucalc.cxx
@@ -3044,8 +3044,6 @@ void Test::testToggleRefFlag()
 
 void Test::testAutofilter()
 {
-    OUString const aDBName("NONAME");
-
     m_pDoc->InsertTab( 0, "Test" );
 
     // cell contents (0 = empty cell)
@@ -3066,7 +3064,7 @@ void Test::testAutofilter()
             if (aData[i][j])
                 m_pDoc->SetString(j, i, 0, OUString::createFromAscii(aData[i][j]));
 
-    ScDBData* pDBData = new ScDBData(aDBName, 0, 0, 0, nCols-1, nRows-1);
+    ScDBData* pDBData = new ScDBData("NONAME", 0, 0, 0, nCols-1, nRows-1);
     m_pDoc->SetAnonymousDBData(0, std::unique_ptr<ScDBData>(pDBData));
 
     pDBData->SetAutoFilter(true);
@@ -3325,17 +3323,14 @@ void Test::testCopyPaste()
 
     // add notes to A1:C1
     ScAddress aAdrA1 (0, 0, 0); // empty cell content
-    OUString const aHelloA1("Hello world in A1");
     ScPostIt* pNoteA1 = m_pDoc->GetOrCreateNote(aAdrA1);
-    pNoteA1->SetText(aAdrA1, aHelloA1);
+    pNoteA1->SetText(aAdrA1, "Hello world in A1");
     ScAddress aAdrB1 (1, 0, 0); // formula cell content
-    OUString const aHelloB1("Hello world in B1");
     ScPostIt* pNoteB1 = m_pDoc->GetOrCreateNote(aAdrB1);
-    pNoteB1->SetText(aAdrB1, aHelloB1);
+    pNoteB1->SetText(aAdrB1, "Hello world in B1");
     ScAddress aAdrC1 (2, 0, 0); // string cell content
-    OUString const aHelloC1("Hello world in C1");
     ScPostIt* pNoteC1 = m_pDoc->GetOrCreateNote(aAdrC1);
-    pNoteC1->SetText(aAdrC1, aHelloC1);
+    pNoteC1->SetText(aAdrC1, "Hello world in C1");
 
     //copy Sheet1.A1:C1 to Sheet2.A2:C2
     ScRange aRange(0,0,0,2,0,0);
@@ -3508,17 +3503,14 @@ void Test::testCopyPasteTranspose()
 
     // add notes to A1:C1
     ScAddress aAdrA1 (0, 0, 0); // numerical cell content
-    OUString const aHelloA1("Hello world in A1");
     ScPostIt* pNoteA1 = m_pDoc->GetOrCreateNote(aAdrA1);
-    pNoteA1->SetText(aAdrA1, aHelloA1);
+    pNoteA1->SetText(aAdrA1, "Hello world in A1");
     ScAddress aAdrB1 (1, 0, 0); // formula cell content
-    OUString const aHelloB1("Hello world in B1");
     ScPostIt* pNoteB1 = m_pDoc->GetOrCreateNote(aAdrB1);
-    pNoteB1->SetText(aAdrB1, aHelloB1);
+    pNoteB1->SetText(aAdrB1, "Hello world in B1");
     ScAddress aAdrC1 (2, 0, 0); // string cell content
-    OUString const aHelloC1("Hello world in C1");
     ScPostIt* pNoteC1 = m_pDoc->GetOrCreateNote(aAdrC1);
-    pNoteC1->SetText(aAdrC1, aHelloC1);
+    pNoteC1->SetText(aAdrC1, "Hello world in C1");
 
     // transpose clipboard, paste and check on Sheet2
     m_pDoc->InsertTab(1, "Sheet2");
@@ -4089,17 +4081,14 @@ void Test::testMoveBlock()
 
     // add notes to A1:C1
     ScAddress aAddrA1 (0, 0, 0);
-    OUString const aHelloA1("Hello world in A1");
     ScPostIt* pNoteA1 = m_pDoc->GetOrCreateNote(aAddrA1);
-    pNoteA1->SetText(aAddrA1, aHelloA1);
+    pNoteA1->SetText(aAddrA1, "Hello world in A1");
     ScAddress aAddrB1 (1, 0, 0);
-    OUString const aHelloB1("Hello world in B1");
     ScPostIt* pNoteB1 = m_pDoc->GetOrCreateNote(aAddrB1);
-    pNoteB1->SetText(aAddrB1, aHelloB1);
+    pNoteB1->SetText(aAddrB1, "Hello world in B1");
     ScAddress aAddrC1 (2, 0, 0);
-    OUString const aHelloC1("Hello world in C1");
     ScPostIt* pNoteC1 = m_pDoc->GetOrCreateNote(aAddrC1);
-    pNoteC1->SetText(aAddrC1, aHelloC1);
+    pNoteC1->SetText(aAddrC1, "Hello world in C1");
     ScAddress aAddrD1 (3, 0, 0);
 
     // previous tests on cell note content are ok. this one fails !!! :(
@@ -4871,24 +4860,21 @@ void Test::testCopyPasteFormulas()
 
 void Test::testCopyPasteFormulasExternalDoc()
 {
-    OUString const aDocName("file:///source.fake");
-    SfxMedium* pMedium = new SfxMedium(aDocName, StreamMode::STD_READWRITE);
+    SfxMedium* pMedium = new SfxMedium("file:///source.fake", StreamMode::STD_READWRITE);
     getDocShell().DoInitNew(pMedium);
     m_pDoc = &getDocShell().GetDocument();
 
     ScDocShellRef xExtDocSh = new ScDocShell;
     xExtDocSh->SetIsInUcalc();
     OUString const aExtDocName("file:///extdata.fake");
-    OUString const aExtSh1Name("ExtSheet1");
-    OUString const aExtSh2Name("ExtSheet2");
     SfxMedium* pMed = new SfxMedium(aExtDocName, StreamMode::STD_READWRITE);
     xExtDocSh->DoInitNew(pMed);
     CPPUNIT_ASSERT_MESSAGE("external document instance not loaded.",
                            findLoadedDocShellByName(aExtDocName) != nullptr);
 
     ScDocument& rExtDoc = xExtDocSh->GetDocument();
-    rExtDoc.InsertTab(0, aExtSh1Name);
-    rExtDoc.InsertTab(1, aExtSh2Name);
+    rExtDoc.InsertTab(0, "ExtSheet1");
+    rExtDoc.InsertTab(1, "ExtSheet2");
 
     m_pDoc->InsertTab(0, "Sheet1");
     m_pDoc->InsertTab(1, "Sheet2");
@@ -4934,22 +4920,20 @@ void Test::testCopyPasteFormulasExternalDoc()
 
 void Test::testCopyPasteReferencesExternalDoc()
 {
-    OUString const aDocName("file:///source.fake");
-    SfxMedium* pMedium = new SfxMedium(aDocName, StreamMode::STD_READWRITE);
+    SfxMedium* pMedium = new SfxMedium("file:///source.fake", StreamMode::STD_READWRITE);
     getDocShell().DoInitNew(pMedium);
     m_pDoc = &getDocShell().GetDocument();
 
     ScDocShellRef xExtDocSh = new ScDocShell;
     xExtDocSh->SetIsInUcalc();
     OUString aExtDocName("file:///extdata.fake");
-    OUString const aExtSh1Name("ExtSheet1");
     SfxMedium* pMed = new SfxMedium(aExtDocName, StreamMode::STD_READWRITE);
     xExtDocSh->DoInitNew(pMed);
     CPPUNIT_ASSERT_MESSAGE("external document instance not loaded.",
                            findLoadedDocShellByName(aExtDocName) != nullptr);
 
     ScDocument& rExtDoc = xExtDocSh->GetDocument();
-    rExtDoc.InsertTab(0, aExtSh1Name);
+    rExtDoc.InsertTab(0, "ExtSheet1");
 
     m_pDoc->InsertTab(0, "Sheet1");
 
@@ -5234,12 +5218,10 @@ void Test::testNoteDeleteRow()
     // We need a drawing layer in order to create caption objects.
     m_pDoc->InitDrawLayer(&getDocShell());
 
-    OUString const aHello("Hello");
-    OUString const aJimBob("Jim Bob");
     ScAddress aPos(1, 1, 0);
     ScPostIt* pNote = m_pDoc->GetOrCreateNote(aPos);
-    pNote->SetText(aPos, aHello);
-    pNote->SetAuthor(aJimBob);
+    pNote->SetText(aPos, "Hello");
+    pNote->SetAuthor("Jim Bob");
 
     CPPUNIT_ASSERT_MESSAGE("there should be a note", m_pDoc->HasNote(1, 1, 0));
 
diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx
index eb8e0f555a52..7e6e2981aba1 100644
--- a/sc/qa/unit/ucalc_formula.cxx
+++ b/sc/qa/unit/ucalc_formula.cxx
@@ -89,14 +89,10 @@ ScRange getCachedRange(const ScExternalRefCache::TableTypeRef& pCacheTab)
 void Test::testFormulaCreateStringFromTokens()
 {
     // Insert sheets.
-    OUString const aTabName1("Test");
-    OUString const aTabName2("Kevin's Data");
-    OUString const aTabName3("Past Data");
-    OUString const aTabName4("2013");
-    m_pDoc->InsertTab(0, aTabName1);
-    m_pDoc->InsertTab(1, aTabName2);
-    m_pDoc->InsertTab(2, aTabName3);
-    m_pDoc->InsertTab(3, aTabName4);
+    m_pDoc->InsertTab(0, "Test");
+    m_pDoc->InsertTab(1, "Kevin's Data");
+    m_pDoc->InsertTab(2, "Past Data");
+    m_pDoc->InsertTab(3, "2013");
 
     // Insert named ranges.
     static const struct {
@@ -1021,10 +1017,8 @@ void Test::testFormulaCompilerJumpReordering()
     getDocShell().SetFormulaOptions(aOptions);
 
     {
-        OUString const aInput("=IF(B1;12;\"text\")");
-
         // Compile formula string first.
-        std::unique_ptr<ScTokenArray> pCode(compileFormula(m_pDoc, aInput));
+        std::unique_ptr<ScTokenArray> pCode(compileFormula(m_pDoc, "=IF(B1;12;\"text\")"));
         CPPUNIT_ASSERT(pCode);
 
         // Then generate RPN tokens.
@@ -4818,9 +4812,8 @@ void Test::testFuncMIN()
 
 void Test::testFuncN()
 {
-    OUString const aTabName("foo");
     CPPUNIT_ASSERT_MESSAGE ("failed to insert sheet",
-                            m_pDoc->InsertTab (0, aTabName));
+                            m_pDoc->InsertTab (0, "foo"));
 
     double result;
 
@@ -5202,10 +5195,8 @@ void Test::testFuncIFERROR()
 
 void Test::testFuncSHEET()
 {
-    OUString const aTabName1("test1");
-    OUString const aTabName2("test2");
     CPPUNIT_ASSERT_MESSAGE ("failed to insert sheet",
-                            m_pDoc->InsertTab (SC_TAB_APPEND, aTabName1));
+                            m_pDoc->InsertTab (SC_TAB_APPEND, "test1"));
 
     m_pDoc->SetString(0, 0, 0, "=SHEETS()");
     m_pDoc->CalcFormulaTree(false, false);
@@ -5216,7 +5207,7 @@ void Test::testFuncSHEET()
                            static_cast<SCTAB>(original), m_pDoc->GetTableCount());
 
     CPPUNIT_ASSERT_MESSAGE ("failed to insert sheet",
-                            m_pDoc->InsertTab (SC_TAB_APPEND, aTabName2));
+                            m_pDoc->InsertTab (SC_TAB_APPEND, "test2"));
 
     double modified;
     m_pDoc->GetValue(0, 0, 0, modified);
@@ -5822,9 +5813,8 @@ void Test::testFuncMATCH()
 
 void Test::testFuncCELL()
 {
-    OUString const aTabName("foo");
     CPPUNIT_ASSERT_MESSAGE ("failed to insert sheet",
-                            m_pDoc->InsertTab (0, aTabName));
+                            m_pDoc->InsertTab (0, "foo"));
 
     clearRange(m_pDoc, ScRange(0, 0, 0, 2, 20, 0)); // Clear A1:C21.
 
@@ -6465,21 +6455,13 @@ void Test::testExternalRef()
 
     OUString const name("Name");
     OUString const value("Value");
-    OUString const andy("Andy");
-    OUString const bruce("Bruce");
-    OUString const charlie("Charlie");
-    OUString const david("David");
-    OUString const edward("Edward");
-    OUString const frank("Frank");
-    OUString const george("George");
-    OUString const henry("Henry");
 
     // Sheet 1
     rExtDoc.SetString(0, 0, 0, name);
-    rExtDoc.SetString(0, 1, 0, andy);
-    rExtDoc.SetString(0, 2, 0, bruce);
-    rExtDoc.SetString(0, 3, 0, charlie);
-    rExtDoc.SetString(0, 4, 0, david);
+    rExtDoc.SetString(0, 1, 0, "Andy");
+    rExtDoc.SetString(0, 2, 0, "Bruce");
+    rExtDoc.SetString(0, 3, 0, "Charlie");
+    rExtDoc.SetString(0, 4, 0, "David");
     rExtDoc.SetString(1, 0, 0, value);
     double val = 10;
     rExtDoc.SetValue(1, 1, 0, val);
@@ -6494,10 +6476,10 @@ void Test::testExternalRef()
 
     // Sheet 3
     rExtDoc.SetString(0, 0, 2, name);
-    rExtDoc.SetString(0, 1, 2, edward);
-    rExtDoc.SetString(0, 2, 2, frank);
-    rExtDoc.SetString(0, 3, 2, george);
-    rExtDoc.SetString(0, 4, 2, henry);
+    rExtDoc.SetString(0, 1, 2, "Edward");
+    rExtDoc.SetString(0, 2, 2, "Frank");
+    rExtDoc.SetString(0, 3, 2, "George");
+    rExtDoc.SetString(0, 4, 2, "Henry");
     rExtDoc.SetString(1, 0, 2, value);
     val = 99;
     rExtDoc.SetValue(1, 1, 2, val);
@@ -6622,14 +6604,13 @@ void Test::testExternalRangeName()
     ScDocShellRef xExtDocSh = new ScDocShell;
     xExtDocSh->SetIsInUcalc();
     OUString const aExtDocName("file:///extdata.fake");
-    OUString const aExtSh1Name("Data1");
     SfxMedium* pMed = new SfxMedium(aExtDocName, StreamMode::STD_READWRITE);
     xExtDocSh->DoInitNew(pMed);
     CPPUNIT_ASSERT_MESSAGE("external document instance not loaded.",
                            findLoadedDocShellByName(aExtDocName) != nullptr);
 
     ScDocument& rExtDoc = xExtDocSh->GetDocument();
-    rExtDoc.InsertTab(0, aExtSh1Name);
+    rExtDoc.InsertTab(0, "Data1");
     rExtDoc.SetValue(0, 0, 0, 123.456);
 
     ScRangeName* pRangeName = rExtDoc.GetRangeName();
@@ -8229,8 +8210,7 @@ void Test::testFuncMDETERM()
     m_pDoc->InsertTab(0, "MDETERM_test");
     ScAddress aPos(8,0,0);
     OUString const aColCodes("ABCDEFGH");
-    OUString const aFormulaTemplate("=MDETERM(A1:B2)");
-    OUStringBuffer aFormulaBuffer(aFormulaTemplate);
+    OUStringBuffer aFormulaBuffer("=MDETERM(A1:B2)");
     for( SCSIZE nSize = 3; nSize <= 8; nSize++ )
     {
         double fVal = 1.0;
diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx
index 33c9a2b5665b..9c4ae4601948 100644
--- a/sc/source/core/data/documen3.cxx
+++ b/sc/source/core/data/documen3.cxx
@@ -162,8 +162,7 @@ void ScDocument::GetRangeNameMap(std::map<OUString, ScRangeName*>& aRangeNameMap
     {
         pRangeName.reset(new ScRangeName());
     }
-    OUString aGlobal(STR_GLOBAL_RANGE_NAME);
-    aRangeNameMap.insert(std::pair<OUString, ScRangeName*>(aGlobal, pRangeName.get()));
+    aRangeNameMap.insert(std::pair<OUString, ScRangeName*>(STR_GLOBAL_RANGE_NAME, pRangeName.get()));
 }
 
 ScRangeName* ScDocument::GetRangeName(SCTAB nTab) const
diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx
index f94931dd3278..0193705b37dd 100644
--- a/sc/source/core/tool/compiler.cxx
+++ b/sc/source/core/tool/compiler.cxx
@@ -1902,9 +1902,8 @@ void ScCompiler::CheckTabQuotes( OUString& rString,
             if( bNeedsQuote )
             {
                 const OUString one_quote('\'');
-                const OUString two_quote("''");
                 // escape embedded quotes
-                rString = rString.replaceAll( one_quote, two_quote );
+                rString = rString.replaceAll( one_quote, "''" );
             }
             break;
     }
diff --git a/sc/source/filter/xml/xmlwrap.cxx b/sc/source/filter/xml/xmlwrap.cxx
index 7712bfcc265f..ee0d01811856 100644
--- a/sc/source/filter/xml/xmlwrap.cxx
+++ b/sc/source/filter/xml/xmlwrap.cxx
@@ -781,8 +781,7 @@ bool ScXMLImportWrapper::Export(bool bStylesOnly)
         bool bUsePrettyPrinting(aSaveOpt.IsPrettyPrinting());
         xInfoSet->setPropertyValue("UsePrettyPrinting", uno::makeAny(bUsePrettyPrinting));
 
-        const OUString sTargetStorage("TargetStorage");
-        xInfoSet->setPropertyValue( sTargetStorage, uno::Any( xStorage ) );
+        xInfoSet->setPropertyValue( "TargetStorage", uno::Any( xStorage ) );
 
         OSL_ENSURE( pMedium, "There is no medium to get MediaDescriptor from!" );
         OUString aBaseURL = pMedium ? pMedium->GetBaseURL( true ) : OUString();
diff --git a/sc/source/ui/Accessibility/AccessibleCellBase.cxx b/sc/source/ui/Accessibility/AccessibleCellBase.cxx
index d08b06c50bd5..24ba0501255e 100644
--- a/sc/source/ui/Accessibility/AccessibleCellBase.cxx
+++ b/sc/source/ui/Accessibility/AccessibleCellBase.cxx
@@ -197,9 +197,7 @@ sal_Int32
 OUString
     ScAccessibleCellBase::createAccessibleDescription()
 {
-    OUString sDescription = STR_ACC_CELL_DESCR;
-
-    return sDescription;
+    return STR_ACC_CELL_DESCR;
 }
 
 OUString
diff --git a/sc/source/ui/Accessibility/AccessibleDocument.cxx b/sc/source/ui/Accessibility/AccessibleDocument.cxx
index f7f2c8aed866..8383ab64d346 100644
--- a/sc/source/ui/Accessibility/AccessibleDocument.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx
@@ -2054,8 +2054,7 @@ utl::AccessibleRelationSetHelper* ScAccessibleDocument::GetRelationSet(const ScA
 OUString
     ScAccessibleDocument::createAccessibleDescription()
 {
-    OUString sDescription = STR_ACC_DOC_DESCR;
-    return sDescription;
+    return STR_ACC_DOC_DESCR;
 }
 
 OUString
diff --git a/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx b/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx
index aacee4d694cc..6ed759781e6c 100644
--- a/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx
+++ b/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx
@@ -1475,8 +1475,7 @@ uno::Sequence<sal_Int8> SAL_CALL
 
 OUString ScAccessibleDocumentPagePreview::createAccessibleDescription()
 {
-    OUString sDescription = STR_ACC_PREVIEWDOC_DESCR;
-    return sDescription;
+    return STR_ACC_PREVIEWDOC_DESCR;
 }
 
 OUString ScAccessibleDocumentPagePreview::createAccessibleName()
diff --git a/sc/source/ui/Accessibility/AccessiblePreviewHeaderCell.cxx b/sc/source/ui/Accessibility/AccessiblePreviewHeaderCell.cxx
index ed5edfa83b20..380b173d9845 100644
--- a/sc/source/ui/Accessibility/AccessiblePreviewHeaderCell.cxx
+++ b/sc/source/ui/Accessibility/AccessiblePreviewHeaderCell.cxx
@@ -339,8 +339,7 @@ tools::Rectangle ScAccessiblePreviewHeaderCell::GetBoundingBox() const
 
 OUString ScAccessiblePreviewHeaderCell::createAccessibleDescription()
 {
-    OUString sDescription = STR_ACC_HEADERCELL_DESCR;
-    return sDescription;
+    return STR_ACC_HEADERCELL_DESCR;
 }
 
 OUString ScAccessiblePreviewHeaderCell::createAccessibleName()
diff --git a/sc/source/ui/attrdlg/scabstdlg.cxx b/sc/source/ui/attrdlg/scabstdlg.cxx
index 3d74406e0f4a..d81e26dbb0fa 100644
--- a/sc/source/ui/attrdlg/scabstdlg.cxx
+++ b/sc/source/ui/attrdlg/scabstdlg.cxx
@@ -41,9 +41,7 @@ ScAbstractDialogFactory* ScAbstractDialogFactory::Create()
 #ifndef DISABLE_DYNLOADING
     static ::osl::Module aDialogLibrary;
 
-    OUString aStrBuf = SVLIBRARY("scui");
-
-    if ( aDialogLibrary.is() || aDialogLibrary.loadRelative( &thisModule, aStrBuf,
+    if ( aDialogLibrary.is() || aDialogLibrary.loadRelative( &thisModule, SVLIBRARY("scui"),
                                                              SAL_LOADMODULE_GLOBAL | SAL_LOADMODULE_LAZY ) )
         fp = reinterpret_cast<ScAbstractDialogFactory* (SAL_CALL*)()>(
             aDialogLibrary.getFunctionSymbol( "ScCreateDialogFactory" ));
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index 226fad060971..54c011903a02 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -1171,8 +1171,6 @@ void ScDocShell::Execute( SfxRequest& rReq )
                 const OUString aSelectionLangPrefix("Current_");
                 const OUString aParagraphLangPrefix("Paragraph_");
                 const OUString aDocLangPrefix("Default_");
-                const OUString aNoLang("LANGUAGE_NONE");
-                const OUString aResetLang("RESET_LANGUAGES");
 
                 bool bSelection = false;
                 bool bParagraph = false;
@@ -1193,12 +1191,12 @@ void ScDocShell::Execute( SfxRequest& rReq )
                 {
                     aLangText = aLangText.replaceAt(nPos, aDocLangPrefix.getLength(), "");
 
-                    if ( aLangText == aNoLang )
+                    if ( aLangText == "LANGUAGE_NONE" )
                     {
                         eLang = LANGUAGE_NONE;
                         rDoc.SetLanguage( eLang, eCjk, eCtl );
                     }
-                    else if ( aLangText == aResetLang )
+                    else if ( aLangText == "RESET_LANGUAGES" )
                     {
                         bool bAutoSpell;
 
@@ -1296,8 +1294,7 @@ void ScDocShell::Execute( SfxRequest& rReq )
             if (pItem2)
                 sIgnoreText = pItem2->GetValue();
 
-            const OUString sSpellingType("Spelling");
-            if(sIgnoreText == sSpellingType)
+            if(sIgnoreText == "Spelling")
             {
                 ESelection aOldSel = pEditView->GetSelection();
                 pEditView->SpellIgnoreWord();
diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx
index 50ce540eb893..543f516a1c4d 100644
--- a/sc/source/ui/docshell/impex.cxx
+++ b/sc/source/ui/docshell/impex.cxx
@@ -463,12 +463,11 @@ bool ScImportExport::ExportStream( SvStream& rStrm, const OUString& rBaseURL, So
 
             // extra bits are used to tell the client to prefer external
             // reference link.
-            OUString const aExtraBits("calc:extref");
 
             WriteUnicodeOrByteString( rStrm, aAppName, true );
             WriteUnicodeOrByteString( rStrm, aDocName, true );
             WriteUnicodeOrByteString( rStrm, aRefName, true );
-            WriteUnicodeOrByteString( rStrm, aExtraBits, true );
+            WriteUnicodeOrByteString( rStrm, "calc:extref", true );
             if ( rStrm.GetStreamCharSet() == RTL_TEXTENCODING_UNICODE )
                 rStrm.WriteUInt16( 0 );
             else
diff --git a/sc/source/ui/miscdlgs/linkarea.cxx b/sc/source/ui/miscdlgs/linkarea.cxx
index ee7d738597dd..87fd302ca9bc 100644
--- a/sc/source/ui/miscdlgs/linkarea.cxx
+++ b/sc/source/ui/miscdlgs/linkarea.cxx
@@ -189,14 +189,11 @@ IMPL_LINK( ScLinkedAreaDlg, DialogClosedHdl, sfx2::FileDialogHelper*, _pFileDlg,
         weld::WaitObject aWait(m_xDialog.get());
 
         // replace HTML filter with DataQuery filter
-        const OUString aHTMLFilterName( FILTERNAME_HTML );
-        const OUString aWebQFilterName( FILTERNAME_QUERY );
-
         std::shared_ptr<const SfxFilter> pFilter = pMed->GetFilter();
-        if (pFilter && aHTMLFilterName == pFilter->GetFilterName())
+        if (pFilter && FILTERNAME_HTML == pFilter->GetFilterName())
         {
             std::shared_ptr<const SfxFilter> pNewFilter =
-                ScDocShell::Factory().GetFilterContainer()->GetFilter4FilterName( aWebQFilterName );
+                ScDocShell::Factory().GetFilterContainer()->GetFilter4FilterName( FILTERNAME_QUERY );
             if( pNewFilter )
                 pMed->SetFilter( pNewFilter );
         }
diff --git a/sc/source/ui/vba/vbaworksheet.cxx b/sc/source/ui/vba/vbaworksheet.cxx
index 05be52562e50..e39c36412bf9 100644
--- a/sc/source/ui/vba/vbaworksheet.cxx
+++ b/sc/source/ui/vba/vbaworksheet.cxx
@@ -653,9 +653,8 @@ void
 ScVbaWorksheet::CheckSpelling( const uno::Any& /*CustomDictionary*/,const uno::Any& /*IgnoreUppercase*/,const uno::Any& /*AlwaysSuggest*/, const uno::Any& /*SpellingLang*/ )
 {
     // #TODO# #FIXME# unused params above, can we do anything with those
-    OUString url = ".uno:SpellDialog";
     uno::Reference< frame::XModel > xModel( getModel() );
-    dispatchRequests(xModel,url);
+    dispatchRequests(xModel,".uno:SpellDialog");
 }
 
 uno::Reference< excel::XRange >


More information about the Libreoffice-commits mailing list