sc/qa/unit/dataproviders_test.cxx | 3 sc/qa/unit/filters-test.cxx | 3 sc/qa/unit/subsequent_export-test.cxx | 15 - sc/qa/unit/subsequent_filters-test.cxx | 19 -- sc/qa/unit/ucalc.cxx | 74 +++----- sc/qa/unit/ucalc_condformat.cxx | 3 sc/qa/unit/ucalc_formula.cxx | 111 +++++-------- sc/qa/unit/ucalc_pivottable.cxx | 19 +- sc/qa/unit/ucalc_sharedformula.cxx | 5 sc/source/core/data/column.cxx | 3 sc/source/core/data/column2.cxx | 3 sc/source/core/data/column3.cxx | 3 sc/source/core/data/dociter.cxx | 3 sc/source/core/data/documen3.cxx | 3 sc/source/core/data/documen4.cxx | 2 sc/source/core/data/documen5.cxx | 3 sc/source/core/data/document.cxx | 3 sc/source/core/data/dpcache.cxx | 3 sc/source/core/data/dpobject.cxx | 14 - sc/source/core/data/dpsave.cxx | 4 sc/source/core/data/dptabsrc.cxx | 3 sc/source/core/data/table1.cxx | 2 sc/source/core/tool/addincol.cxx | 3 sc/source/core/tool/autoform.cxx | 9 - sc/source/core/tool/consoli.cxx | 5 sc/source/core/tool/dbdata.cxx | 3 sc/source/core/tool/detfunc.cxx | 3 sc/source/core/tool/editutil.cxx | 3 sc/source/core/tool/interpr2.cxx | 3 sc/source/core/tool/rangenam.cxx | 2 sc/source/core/tool/token.cxx | 4 sc/source/filter/excel/excform.cxx | 3 sc/source/filter/excel/excimp8.cxx | 3 sc/source/filter/excel/xepage.cxx | 2 sc/source/filter/excel/xepivot.cxx | 12 - sc/source/filter/excel/xestream.cxx | 3 sc/source/filter/excel/xeview.cxx | 8 sc/source/filter/excel/xicontent.cxx | 6 sc/source/filter/excel/xiescher.cxx | 3 sc/source/filter/excel/xlchart.cxx | 3 sc/source/filter/html/htmlpars.cxx | 4 sc/source/filter/lotus/lotform.cxx | 3 sc/source/filter/lotus/lotread.cxx | 3 sc/source/filter/qpro/qproform.cxx | 3 sc/source/filter/xcl97/xcl97rec.cxx | 8 sc/source/filter/xml/XMLCodeNameProvider.cxx | 3 sc/source/filter/xml/XMLStylesExportHelper.cxx | 3 sc/source/filter/xml/editattributemap.cxx | 3 sc/source/filter/xml/xmlcoli.cxx | 3 sc/source/filter/xml/xmlcvali.cxx | 3 sc/source/filter/xml/xmldrani.cxx | 6 sc/source/filter/xml/xmlexprt.cxx | 24 -- sc/source/filter/xml/xmlimprt.cxx | 7 sc/source/filter/xml/xmlstyle.cxx | 9 - sc/source/filter/xml/xmlwrap.cxx | 9 - sc/source/ui/Accessibility/AccessibleCell.cxx | 3 sc/source/ui/Accessibility/AccessiblePreviewHeaderCell.cxx | 3 sc/source/ui/Accessibility/AccessiblePreviewTable.cxx | 3 sc/source/ui/Accessibility/AccessibleTableBase.cxx | 6 sc/source/ui/app/inputhdl.cxx | 4 sc/source/ui/app/inputwin.cxx | 2 sc/source/ui/app/scmod.cxx | 10 - sc/source/ui/cctrl/checklistmenu.cxx | 2 sc/source/ui/condformat/condformatdlgentry.cxx | 3 sc/source/ui/dbgui/PivotLayoutDialog.cxx | 2 sc/source/ui/docshell/docfunc.cxx | 13 - sc/source/ui/docshell/docsh8.cxx | 4 sc/source/ui/docshell/impex.cxx | 10 - sc/source/ui/drawfunc/drawsh5.cxx | 6 sc/source/ui/drawfunc/fuins2.cxx | 3 sc/source/ui/drawfunc/futext.cxx | 10 - sc/source/ui/formdlg/dwfunctr.cxx | 3 sc/source/ui/miscdlgs/tabbgcolordlg.cxx | 4 sc/source/ui/miscdlgs/textdlgs.cxx | 4 sc/source/ui/navipi/content.cxx | 3 sc/source/ui/undo/undoblk.cxx | 2 sc/source/ui/undo/undoblk3.cxx | 4 sc/source/ui/undo/undocell.cxx | 4 sc/source/ui/unoobj/cellsuno.cxx | 3 sc/source/ui/unoobj/chart2uno.cxx | 2 sc/source/ui/unoobj/dapiuno.cxx | 3 sc/source/ui/unoobj/datauno.cxx | 3 sc/source/ui/unoobj/docuno.cxx | 14 - sc/source/ui/unoobj/filtuno.cxx | 5 sc/source/ui/unoobj/tokenuno.cxx | 4 sc/source/ui/unoobj/viewuno.cxx | 4 sc/source/ui/vba/excelvbahelper.cxx | 3 sc/source/ui/vba/vbamenuitems.cxx | 5 sc/source/ui/vba/vbamenus.cxx | 5 sc/source/ui/vba/vbanames.cxx | 7 sc/source/ui/vba/vbarange.cxx | 15 - sc/source/ui/vba/vbasheetobject.cxx | 2 sc/source/ui/vba/vbawindow.cxx | 36 +--- sc/source/ui/view/cellsh2.cxx | 3 sc/source/ui/view/dbfunc3.cxx | 6 sc/source/ui/view/gridwin3.cxx | 3 sc/source/ui/view/gridwin4.cxx | 15 - sc/source/ui/view/gridwin_dbgutil.cxx | 3 sc/source/ui/view/output2.cxx | 6 sc/source/ui/view/tabvwshb.cxx | 3 sc/source/ui/view/tabvwshg.cxx | 3 sc/source/ui/view/viewdata.cxx | 6 sc/source/ui/view/viewfun2.cxx | 3 sc/source/ui/view/viewfun3.cxx | 9 - 104 files changed, 285 insertions(+), 464 deletions(-)
New commits: commit ac2d415a52f22caf0012b7d9b17d015aca27db9d Author: Noel Grandin <noel.gran...@collabora.co.uk> Date: Sun Jun 25 18:40:44 2017 +0200 loplugin:oncevar in sc Change-Id: Ice59e286debb6bd0eb692f2b2b0c2c5087c069c0 Reviewed-on: https://gerrit.libreoffice.org/39239 Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> Tested-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sc/qa/unit/dataproviders_test.cxx b/sc/qa/unit/dataproviders_test.cxx index 127b261fb9ae..397fbfe4ce99 100644 --- a/sc/qa/unit/dataproviders_test.cxx +++ b/sc/qa/unit/dataproviders_test.cxx @@ -59,9 +59,8 @@ void ScDataProvidersTest::testCSVImport() { m_pDoc->InsertTab(0, "foo"); bool success; - OUString aCSVFile("dataprovider."); OUString aCSVPath; - createCSVPath( aCSVFile, aCSVPath ); + createCSVPath( "dataprovider.", aCSVPath ); OUString aDBName = "TEST"; sc::ExternalDataMapper aExternalDataMapper (&getDocShell(), aCSVPath, aDBName, 0, 0, 0, 5, 5, success); aExternalDataMapper.StartImport(); diff --git a/sc/qa/unit/filters-test.cxx b/sc/qa/unit/filters-test.cxx index ec5f4cb83c47..5b7195302d50 100644 --- a/sc/qa/unit/filters-test.cxx +++ b/sc/qa/unit/filters-test.cxx @@ -196,9 +196,8 @@ void ScFiltersTest::testRangeNameODS() ScDocument& rDoc = xDocSh->GetDocument(); testRangeNameImpl(rDoc); - OUString aSheet2CSV("rangeExp_Sheet2."); OUString aCSVPath; - createCSVPath( aSheet2CSV, aCSVPath ); + createCSVPath( "rangeExp_Sheet2.", aCSVPath ); testFile( aCSVPath, rDoc, 1); xDocSh->DoClose(); } diff --git a/sc/qa/unit/subsequent_export-test.cxx b/sc/qa/unit/subsequent_export-test.cxx index 9eb2e49d1c85..41f600b9e7d7 100644 --- a/sc/qa/unit/subsequent_export-test.cxx +++ b/sc/qa/unit/subsequent_export-test.cxx @@ -422,9 +422,8 @@ void ScExportTest::testConditionalFormatExportODS() ScDocShellRef xDocSh = saveAndReload(&(*xShell), FORMAT_ODS); CPPUNIT_ASSERT(xDocSh.is()); ScDocument& rDoc = xDocSh->GetDocument(); - OUString aCSVFile("new_cond_format_test_export."); OUString aCSVPath; - createCSVPath( aCSVFile, aCSVPath ); + createCSVPath( "new_cond_format_test_export.", aCSVPath ); testCondFile(aCSVPath, &rDoc, 0); xDocSh->DoClose(); @@ -439,15 +438,13 @@ void ScExportTest::testConditionalFormatExportXLSX() CPPUNIT_ASSERT(xDocSh.is()); ScDocument& rDoc = xDocSh->GetDocument(); { - OUString aCSVFile("new_cond_format_test_export."); OUString aCSVPath; - createCSVPath( aCSVFile, aCSVPath ); + createCSVPath( "new_cond_format_test_export.", aCSVPath ); testCondFile(aCSVPath, &rDoc, 0); } { - OUString aCSVFile("new_cond_format_test_sheet2."); OUString aCSVPath; - createCSVPath( aCSVFile, aCSVPath ); + createCSVPath( "new_cond_format_test_sheet2.", aCSVPath ); testCondFile(aCSVPath, &rDoc, 1); } @@ -2242,7 +2239,7 @@ void ScExportTest::testTrackChangesSimpleXLSX() return false; } - for (size_t i = 0, n = SAL_N_ELEMENTS(aChecks); i < n; ++i) + for (size_t i = 0; i < SAL_N_ELEMENTS(aChecks); ++i) { sal_uInt16 nActId = aChecks[i].mnActionId; const ScChangeAction* pAction = pCT->GetAction(nActId); @@ -2412,7 +2409,7 @@ void ScExportTest::testSheetTabColorsXLSX() } const char* pNames[] = { "Green", "Red", "Blue", "Yellow" }; - for (size_t i = 0, n = SAL_N_ELEMENTS(pNames); i < n; ++i) + for (size_t i = 0; i < SAL_N_ELEMENTS(pNames); ++i) { OUString aExpected = OUString::createFromAscii(pNames[i]); if (aExpected != aTabNames[i]) @@ -2430,7 +2427,7 @@ void ScExportTest::testSheetTabColorsXLSX() 0x00FFFF00, // yellow }; - for (size_t i = 0, n = SAL_N_ELEMENTS(aXclColors); i < n; ++i) + for (size_t i = 0; i < SAL_N_ELEMENTS(aXclColors); ++i) { if (aXclColors[i] != rDoc.GetTabBgColor(i).GetColor()) { diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index 02d32199d726..38e83104aa83 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -466,9 +466,8 @@ void ScFiltersTest::testRangeNameXLS() ScDocument& rDoc = xDocSh->GetDocument(); testRangeNameImpl(rDoc); - OUString aSheet2CSV("rangeExp_Sheet2."); OUString aCSVPath; - createCSVPath( aSheet2CSV, aCSVPath ); + createCSVPath( "rangeExp_Sheet2.", aCSVPath ); // fdo#44587 testFile( aCSVPath, rDoc, 1); @@ -661,7 +660,7 @@ void ScFiltersTest::testCachedFormulaResultsODS() //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 sTodayCache("01/25/13 01:06 PM"); + OUString const sTodayCache("01/25/13 01:06 PM"); OUString sTodayRecalc(rDoc.GetString(0,0,1)); CPPUNIT_ASSERT(sTodayCache != sTodayRecalc); @@ -1480,9 +1479,8 @@ void ScFiltersTest::testBrokenQuotesCSV() CPPUNIT_ASSERT_MESSAGE("Failed to load fdo48621_broken_quotes.csv", xDocSh.is()); ScDocument& rDoc = xDocSh->GetDocument(); - OUString aSheet2CSV("fdo48621_broken_quotes_exported."); OUString aCSVPath; - createCSVPath( aSheet2CSV, aCSVPath ); + createCSVPath( "fdo48621_broken_quotes_exported.", aCSVPath ); // fdo#48621 testFile( aCSVPath, rDoc, 0, StringType::PureString); @@ -1554,10 +1552,11 @@ void ScFiltersTest::testPassword_Impl(const OUString& aFileNameBase) createFileURL(aFileNameBase, aFileExtension, aFileName); OUString aFilterType(getFileFormats()[0].pTypeName, strlen(getFileFormats()[0].pTypeName), RTL_TEXTENCODING_UTF8); - SotClipboardFormatId nFormat = SotClipboardFormatId::STARCALC_8; std::shared_ptr<const SfxFilter> pFilter(new SfxFilter( aFilterName, - OUString(), getFileFormats()[0].nFormatType, nFormat, aFilterType, OUString(), + OUString(), getFileFormats()[0].nFormatType, + SotClipboardFormatId::STARCALC_8, + aFilterType, OUString(), OUString(), "private:factory/scalc*" )); const_cast<SfxFilter*>(pFilter.get())->SetVersion(SOFFICE_FILEFORMAT_CURRENT); @@ -2581,9 +2580,8 @@ void ScFiltersTest::testNewCondFormatODS() ScDocument& rDoc = xDocSh->GetDocument(); - OUString aCSVFile("new_cond_format_test."); OUString aCSVPath; - createCSVPath( aCSVFile, aCSVPath ); + createCSVPath( "new_cond_format_test.", aCSVPath ); testCondFile(aCSVPath, &rDoc, 0); xDocSh->DoClose(); @@ -2597,9 +2595,8 @@ void ScFiltersTest::testNewCondFormatXLSX() ScDocument& rDoc = xDocSh->GetDocument(); - OUString aCSVFile("new_cond_format_test."); OUString aCSVPath; - createCSVPath( aCSVFile, aCSVPath ); + createCSVPath( "new_cond_format_test.", aCSVPath ); testCondFile(aCSVPath, &rDoc, 0); xDocSh->DoClose(); diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index 0372de6abf01..80030994a8c2 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -1035,7 +1035,7 @@ void Test::testValueIterator() { const double aChecks[] = { 1.0, 2.0, 3.0 }; - size_t nCheckLen = SAL_N_ELEMENTS(aChecks); + size_t const nCheckLen = SAL_N_ELEMENTS(aChecks); ScValueIterator aIter(m_pDoc, ScRange(1,2,0,3,2,0)); bool bHas = false; size_t nCheckPos = 0; @@ -1072,7 +1072,7 @@ void Test::testHorizontalAttrIterator() { const int aChecks[][3] = { {1, 3, 1}, {1, 2, 2}, {4, 4, 2}, {2, 3, 3}, {1, 4, 4} }; - size_t nCheckLen = SAL_N_ELEMENTS(aChecks); + const size_t nCheckLen = SAL_N_ELEMENTS(aChecks); ScHorizontalAttrIterator aIter(m_pDoc, 0, 0, 0, 5, 5); SCCOL nCol1, nCol2; @@ -3014,7 +3014,7 @@ void Test::testToggleRefFlag() void Test::testAutofilter() { - OUString aDBName("NONAME"); + OUString const aDBName("NONAME"); m_pDoc->InsertTab( 0, "Test" ); @@ -3295,15 +3295,15 @@ void Test::testCopyPaste() // add notes to A1:C1 ScAddress aAdrA1 (0, 0, 0); // empty cell content - OUString aHelloA1("Hello world in A1"); + OUString const aHelloA1("Hello world in A1"); ScPostIt* pNoteA1 = m_pDoc->GetOrCreateNote(aAdrA1); pNoteA1->SetText(aAdrA1, aHelloA1); ScAddress aAdrB1 (1, 0, 0); // formula cell content - OUString aHelloB1("Hello world in B1"); + OUString const aHelloB1("Hello world in B1"); ScPostIt* pNoteB1 = m_pDoc->GetOrCreateNote(aAdrB1); pNoteB1->SetText(aAdrB1, aHelloB1); ScAddress aAdrC1 (2, 0, 0); // string cell content - OUString aHelloC1("Hello world in C1"); + OUString const aHelloC1("Hello world in C1"); ScPostIt* pNoteC1 = m_pDoc->GetOrCreateNote(aAdrC1); pNoteC1->SetText(aAdrC1, aHelloC1); @@ -3478,15 +3478,15 @@ void Test::testCopyPasteTranspose() // add notes to A1:C1 ScAddress aAdrA1 (0, 0, 0); // numerical cell content - OUString aHelloA1("Hello world in A1"); + OUString const aHelloA1("Hello world in A1"); ScPostIt* pNoteA1 = m_pDoc->GetOrCreateNote(aAdrA1); pNoteA1->SetText(aAdrA1, aHelloA1); ScAddress aAdrB1 (1, 0, 0); // formula cell content - OUString aHelloB1("Hello world in B1"); + OUString const aHelloB1("Hello world in B1"); ScPostIt* pNoteB1 = m_pDoc->GetOrCreateNote(aAdrB1); pNoteB1->SetText(aAdrB1, aHelloB1); ScAddress aAdrC1 (2, 0, 0); // string cell content - OUString aHelloC1("Hello world in C1"); + OUString const aHelloC1("Hello world in C1"); ScPostIt* pNoteC1 = m_pDoc->GetOrCreateNote(aAdrC1); pNoteC1->SetText(aAdrC1, aHelloC1); @@ -3716,8 +3716,7 @@ void Test::testCopyPasteSkipEmpty() m_pDoc->CopyToDocument(aDestRange, InsertDeleteFlags::ALL, false, *pUndoDoc, &aMark); // Paste clipboard content onto A1:A5 but skip empty cells. - bool bSkipEmpty = true; - m_pDoc->CopyFromClip(aDestRange, aMark, InsertDeleteFlags::ALL, pUndoDoc, &aClipDoc, true, false, false, bSkipEmpty); + m_pDoc->CopyFromClip(aDestRange, aMark, InsertDeleteFlags::ALL, pUndoDoc, &aClipDoc, true, false, false, true/*bSkipEmpty*/); // Create redo document. ScDocument* pRedoDoc = new ScDocument(SCDOCMODE_UNDO); @@ -4062,15 +4061,15 @@ void Test::testMoveBlock() // add notes to A1:C1 ScAddress aAddrA1 (0, 0, 0); - OUString aHelloA1("Hello world in A1"); + OUString const aHelloA1("Hello world in A1"); ScPostIt* pNoteA1 = m_pDoc->GetOrCreateNote(aAddrA1); pNoteA1->SetText(aAddrA1, aHelloA1); ScAddress aAddrB1 (1, 0, 0); - OUString aHelloB1("Hello world in B1"); + OUString const aHelloB1("Hello world in B1"); ScPostIt* pNoteB1 = m_pDoc->GetOrCreateNote(aAddrB1); pNoteB1->SetText(aAddrB1, aHelloB1); ScAddress aAddrC1 (2, 0, 0); - OUString aHelloC1("Hello world in C1"); + OUString const aHelloC1("Hello world in C1"); ScPostIt* pNoteC1 = m_pDoc->GetOrCreateNote(aAddrC1); pNoteC1->SetText(aAddrC1, aHelloC1); ScAddress aAddrD1 (3, 0, 0); @@ -4079,9 +4078,8 @@ void Test::testMoveBlock() //CPPUNIT_ASSERT_MESSAGE("Note content in B1 before move block", m_pDoc->GetNote(aAddrB1)->GetText() == aHelloB1); // move notes to B1:D1 - bool bCut = true; ScDocFunc& rDocFunc = getDocShell().GetDocFunc(); - bool bMoveDone = rDocFunc.MoveBlock(ScRange(0, 0 ,0 ,2 ,0 ,0), ScAddress(1, 0, 0), bCut, false, false, false); + bool bMoveDone = rDocFunc.MoveBlock(ScRange(0, 0 ,0 ,2 ,0 ,0), ScAddress(1, 0, 0), true/*bCut*/, false, false, false); CPPUNIT_ASSERT_MESSAGE("Cells not moved", bMoveDone); @@ -4217,10 +4215,9 @@ void Test::testCopyPasteRepeatOneFormula() m_pDoc->CopyToClip(aClipParam, &aClipDoc, &aMark, false, false); // Paste it to C2:C10. - InsertDeleteFlags nFlags = InsertDeleteFlags::CONTENTS; ScRange aDestRange(2,1,0,2,9,0); aMark.SetMarkArea(aDestRange); - m_pDoc->CopyFromClip(aDestRange, aMark, nFlags, nullptr, &aClipDoc); + m_pDoc->CopyFromClip(aDestRange, aMark, InsertDeleteFlags::CONTENTS, nullptr, &aClipDoc); // Make sure C1:C10 are grouped. const ScFormulaCell* pFC = m_pDoc->GetFormulaCell(aPos); @@ -4848,16 +4845,16 @@ void Test::testCopyPasteFormulas() void Test::testCopyPasteFormulasExternalDoc() { - OUString aDocName("file:///source.fake"); + OUString const aDocName("file:///source.fake"); SfxMedium* pMedium = new SfxMedium(aDocName, StreamMode::STD_READWRITE); getDocShell().DoInitNew(pMedium); m_pDoc = &getDocShell().GetDocument(); ScDocShellRef xExtDocSh = new ScDocShell; xExtDocSh->SetIsInUcalc(); - OUString aExtDocName("file:///extdata.fake"); - OUString aExtSh1Name("ExtSheet1"); - OUString aExtSh2Name("ExtSheet2"); + 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.", @@ -4884,11 +4881,10 @@ void Test::testCopyPasteFormulasExternalDoc() ScDocument aClipDoc(SCDOCMODE_CLIP); m_pDoc->CopyToClip(aClipParam, &aClipDoc, &aMark, false, false); - InsertDeleteFlags nFlags = InsertDeleteFlags::ALL; aRange = ScRange(1,1,1,1,6,1); ScMarkData aMarkData2; aMarkData2.SetMarkArea(aRange); - rExtDoc.CopyFromClip(aRange, aMarkData2, nFlags, nullptr, &aClipDoc); + rExtDoc.CopyFromClip(aRange, aMarkData2, InsertDeleteFlags::ALL, nullptr, &aClipDoc); OUString aFormula; rExtDoc.GetFormula(1,1,1, aFormula); @@ -4912,7 +4908,7 @@ void Test::testCopyPasteFormulasExternalDoc() void Test::testCopyPasteReferencesExternalDoc() { - OUString aDocName("file:///source.fake"); + OUString const aDocName("file:///source.fake"); SfxMedium* pMedium = new SfxMedium(aDocName, StreamMode::STD_READWRITE); getDocShell().DoInitNew(pMedium); m_pDoc = &getDocShell().GetDocument(); @@ -4920,7 +4916,7 @@ void Test::testCopyPasteReferencesExternalDoc() ScDocShellRef xExtDocSh = new ScDocShell; xExtDocSh->SetIsInUcalc(); OUString aExtDocName("file:///extdata.fake"); - OUString aExtSh1Name("ExtSheet1"); + OUString const aExtSh1Name("ExtSheet1"); SfxMedium* pMed = new SfxMedium(aExtDocName, StreamMode::STD_READWRITE); xExtDocSh->DoInitNew(pMed); CPPUNIT_ASSERT_MESSAGE("external document instance not loaded.", @@ -4940,11 +4936,10 @@ void Test::testCopyPasteReferencesExternalDoc() ScDocument aClipDoc(SCDOCMODE_CLIP); m_pDoc->CopyToClip(aClipParam, &aClipDoc, &aMark, false, false); - InsertDeleteFlags nFlags = InsertDeleteFlags::ALL; aRange = ScRange(0,0,0,0,3,0); ScMarkData aMarkData2; aMarkData2.SetMarkArea(aRange); - rExtDoc.CopyFromClip(aRange, aMarkData2, nFlags, nullptr, &aClipDoc); + rExtDoc.CopyFromClip(aRange, aMarkData2, InsertDeleteFlags::ALL, nullptr, &aClipDoc); OUString aFormula; rExtDoc.GetFormula(0,3,0, aFormula); @@ -5213,8 +5208,8 @@ void Test::testNoteDeleteRow() // We need a drawing layer in order to create caption objects. m_pDoc->InitDrawLayer(&getDocShell()); - OUString aHello("Hello"); - OUString aJimBob("Jim Bob"); + OUString const aHello("Hello"); + OUString const aJimBob("Jim Bob"); ScAddress aPos(1, 1, 0); ScPostIt* pNote = m_pDoc->GetOrCreateNote(aPos); pNote->SetText(aPos, aHello); @@ -5363,9 +5358,9 @@ void Test::testNoteLifeCycle() ScAddress aMovePos(1,2,0); ScPostIt* pOrigNote = m_pDoc->GetNote(aOrigPos); const SdrCaptionObj* pOrigCaption = pOrigNote->GetOrCreateCaption(aOrigPos); - bool bCut = true; // like Drag&Drop + bool const bCut = true; // like Drag&Drop bool bRecord = true; // record Undo - bool bPaint = false; // don't care about + bool const bPaint = false; // don't care about bool bApi = true; // API to prevent dialogs ScDocFunc& rDocFunc = getDocShell().GetDocFunc(); bool bMoveDone = rDocFunc.MoveBlock(ScRange(aOrigPos, aOrigPos), aMovePos, bCut, bRecord, bPaint, bApi); @@ -5711,8 +5706,7 @@ void Test::testCellTextWidth() m_pDoc->SetString(0, 0, 0, "Only one cell"); pIter.reset(new ScColumnTextWidthIterator(*m_pDoc, aTopCell, MAXROW)); CPPUNIT_ASSERT_MESSAGE("Column should have a cell.", pIter->hasCell()); - SCROW nTestRow = 0; - CPPUNIT_ASSERT_EQUAL(nTestRow, pIter->getPos()); + CPPUNIT_ASSERT_EQUAL(SCROW(0), pIter->getPos()); // Setting a text width here should commit it to the column. sal_uInt16 nTestVal = 432; @@ -5731,8 +5725,7 @@ void Test::testCellTextWidth() // Full range. pIter.reset(new ScColumnTextWidthIterator(*m_pDoc, aTopCell, MAXROW)); SCROW aRows[] = { 0, 2, 3, 4, 5, 6, 10, 11, 12, 13, 14, 15, 16, 17, 18 }; - size_t n = SAL_N_ELEMENTS(aRows); - for (size_t i = 0; i < n; ++i, pIter->next()) + for (size_t i = 0; i < SAL_N_ELEMENTS(aRows); ++i, pIter->next()) { CPPUNIT_ASSERT_MESSAGE("Cell expected, but not there.", pIter->hasCell()); CPPUNIT_ASSERT_EQUAL(aRows[i], pIter->getPos()); @@ -5746,8 +5739,7 @@ void Test::testCellTextWidth() aStart.SetRow(6); pIter.reset(new ScColumnTextWidthIterator(*m_pDoc, aStart, 16)); SCROW aRows[] = { 6, 10, 11, 12, 13, 14, 15, 16 }; - size_t n = SAL_N_ELEMENTS(aRows); - for (size_t i = 0; i < n; ++i, pIter->next()) + for (size_t i = 0; i < SAL_N_ELEMENTS(aRows); ++i, pIter->next()) { CPPUNIT_ASSERT_MESSAGE("Cell expected, but not there.", pIter->hasCell()); CPPUNIT_ASSERT_EQUAL(aRows[i], pIter->getPos()); @@ -5762,8 +5754,7 @@ void Test::testCellTextWidth() // Full range again. pIter.reset(new ScColumnTextWidthIterator(*m_pDoc, aTopCell, MAXROW)); SCROW aRows[] = { 0, 2, 18 }; - size_t n = SAL_N_ELEMENTS(aRows); - for (size_t i = 0; i < n; ++i, pIter->next()) + for (size_t i = 0; i < SAL_N_ELEMENTS(aRows); ++i, pIter->next()) { CPPUNIT_ASSERT_MESSAGE("Cell expected, but not there.", pIter->hasCell()); CPPUNIT_ASSERT_EQUAL(aRows[i], pIter->getPos()); @@ -5778,8 +5769,7 @@ void Test::testCellTextWidth() // Full range again. pIter.reset(new ScColumnTextWidthIterator(*m_pDoc, aTopCell, MAXROW)); SCROW aRows[] = { 0, 17 }; - size_t n = SAL_N_ELEMENTS(aRows); - for (size_t i = 0; i < n; ++i, pIter->next()) + for (size_t i = 0; i < SAL_N_ELEMENTS(aRows); ++i, pIter->next()) { CPPUNIT_ASSERT_MESSAGE("Cell expected, but not there.", pIter->hasCell()); CPPUNIT_ASSERT_EQUAL(aRows[i], pIter->getPos()); diff --git a/sc/qa/unit/ucalc_condformat.cxx b/sc/qa/unit/ucalc_condformat.cxx index d4a85cd6cd8a..b5f2087971fd 100644 --- a/sc/qa/unit/ucalc_condformat.cxx +++ b/sc/qa/unit/ucalc_condformat.cxx @@ -70,8 +70,7 @@ void Test::testCopyPasteSkipEmptyConditionalFormatting() m_pDoc->CopyToDocument(aDestRange, InsertDeleteFlags::CONTENTS, false, *pUndoDoc, &aMark); // Paste clipboard content onto A1:A5 but skip empty cells. - bool bSkipEmpty = true; - m_pDoc->CopyFromClip(aDestRange, aMark, InsertDeleteFlags::CONTENTS, pUndoDoc, &aClipDoc, true, false, false, bSkipEmpty); + m_pDoc->CopyFromClip(aDestRange, aMark, InsertDeleteFlags::CONTENTS, pUndoDoc, &aClipDoc, true, false, false, true/*bSkipEmpty*/); ScConditionalFormatList* pList = m_pDoc->GetCondFormList(0); CPPUNIT_ASSERT_EQUAL(size_t(2), pList->size()); diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx index feb5b8df5625..9d8264b1f0e4 100644 --- a/sc/qa/unit/ucalc_formula.cxx +++ b/sc/qa/unit/ucalc_formula.cxx @@ -91,10 +91,10 @@ ScRange getCachedRange(const ScExternalRefCache::TableTypeRef& pCacheTab) void Test::testFormulaCreateStringFromTokens() { // Insert sheets. - OUString aTabName1("Test"); - OUString aTabName2("Kevin's Data"); - OUString aTabName3("Past Data"); - OUString aTabName4("2013"); + 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); @@ -118,7 +118,7 @@ void Test::testFormulaCreateStringFromTokens() CPPUNIT_ASSERT_MESSAGE("Failed to obtain global named expression object.", pGlobalNames); CPPUNIT_ASSERT_MESSAGE("Failed to obtain sheet-local named expression object.", pSheetNames); - for (size_t i = 0, n = SAL_N_ELEMENTS(aNames); i < n; ++i) + for (size_t i = 0; i < SAL_N_ELEMENTS(aNames); ++i) { ScRangeData* pName = new ScRangeData( m_pDoc, OUString::createFromAscii(aNames[i].pName), OUString::createFromAscii(aNames[i].pExpr), @@ -153,7 +153,7 @@ void Test::testFormulaCreateStringFromTokens() ScDBCollection* pDBs = m_pDoc->GetDBCollection(); CPPUNIT_ASSERT_MESSAGE("Failed to fetch DB collection object.", pDBs); - for (size_t i = 0, n = SAL_N_ELEMENTS(aDBs); i < n; ++i) + for (size_t i = 0; i < SAL_N_ELEMENTS(aDBs); ++i) { ScDBData* pData = new ScDBData( OUString::createFromAscii( @@ -194,7 +194,7 @@ void Test::testFormulaCreateStringFromTokens() ScAddress aPos(0,0,0); - for (size_t i = 0, n = SAL_N_ELEMENTS(aTests); i < n; ++i) + for (size_t i = 0; i < SAL_N_ELEMENTS(aTests); ++i) { #if 0 OUString aFormula = OUString::createFromAscii(aTests[i]); @@ -1017,7 +1017,7 @@ void Test::testFormulaCompiler() { "=B1-$C2+D$3-$E$4", FormulaGrammar::GRAM_NATIVE, "RC[1]-R[1]C3+R3C[3]-R4C5", FormulaGrammar::GRAM_NATIVE_XL_R1C1 }, }; - for (size_t i = 0, n = SAL_N_ELEMENTS(aTests); i < n; ++i) + for (size_t i = 0; i < SAL_N_ELEMENTS(aTests); ++i) { std::unique_ptr<ScTokenArray> pArray; { @@ -1046,7 +1046,7 @@ void Test::testFormulaCompilerJumpReordering() getDocShell().SetFormulaOptions(aOptions); { - OUString aInput("=IF(B1;12;\"text\")"); + OUString const aInput("=IF(B1;12;\"text\")"); // Compile formula string first. std::unique_ptr<ScTokenArray> pCode(compileFormula(m_pDoc, aInput)); @@ -3806,9 +3806,8 @@ void Test::testFuncROW() void Test::testFuncSUM() { - OUString aTabName("foo"); CPPUNIT_ASSERT_MESSAGE ("failed to insert sheet", - m_pDoc->InsertTab (0, aTabName)); + m_pDoc->InsertTab (0, "foo")); sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn on auto calc. @@ -3872,8 +3871,7 @@ void Test::testFuncPRODUCT() { sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn on auto recalc. - OUString aTabName("foo"); - CPPUNIT_ASSERT_MESSAGE ("failed to insert sheet", m_pDoc->InsertTab(0, aTabName)); + CPPUNIT_ASSERT_MESSAGE ("failed to insert sheet", m_pDoc->InsertTab(0, "foo")); ScAddress aPos(3, 0, 0); m_pDoc->SetValue(0, 0, 0, 3.0); // A1 @@ -4042,7 +4040,7 @@ void Test::testFuncMIN() void Test::testFuncN() { - OUString aTabName("foo"); + OUString const aTabName("foo"); CPPUNIT_ASSERT_MESSAGE ("failed to insert sheet", m_pDoc->InsertTab (0, aTabName)); @@ -4126,9 +4124,8 @@ void Test::testFuncCOUNTIF() // COUNTIF (test case adopted from OOo i#36381) - OUString aTabName("foo"); CPPUNIT_ASSERT_MESSAGE ("failed to insert sheet", - m_pDoc->InsertTab (0, aTabName)); + m_pDoc->InsertTab (0, "foo")); // Empty A1:A39 first. clearRange(m_pDoc, ScRange(0, 0, 0, 0, 40, 0)); @@ -4309,9 +4306,8 @@ void Test::testFuncIFERROR() { // IFERROR/IFNA (fdo#56124) - OUString aTabName("foo"); CPPUNIT_ASSERT_MESSAGE ("failed to insert sheet", - m_pDoc->InsertTab (0, aTabName)); + m_pDoc->InsertTab (0, "foo")); // Empty A1:A39 first. clearRange(m_pDoc, ScRange(0, 0, 0, 0, 40, 0)); @@ -4421,8 +4417,8 @@ void Test::testFuncIFERROR() void Test::testFuncSHEET() { - OUString aTabName1("test1"); - OUString aTabName2("test2"); + OUString const aTabName1("test1"); + OUString const aTabName2("test2"); CPPUNIT_ASSERT_MESSAGE ("failed to insert sheet", m_pDoc->InsertTab (SC_TAB_APPEND, aTabName1)); @@ -4454,9 +4450,8 @@ void Test::testFuncSHEET() void Test::testFuncNOW() { - OUString aTabName("foo"); CPPUNIT_ASSERT_MESSAGE ("failed to insert sheet", - m_pDoc->InsertTab (0, aTabName)); + m_pDoc->InsertTab (0, "foo")); double val = 1; m_pDoc->SetValue(0, 0, 0, val); @@ -4486,9 +4481,8 @@ void Test::testFuncNUMBERVALUE() { // NUMBERVALUE fdo#57180 - OUString aTabName("foo"); CPPUNIT_ASSERT_MESSAGE ("failed to insert sheet", - m_pDoc->InsertTab (0, aTabName)); + m_pDoc->InsertTab (0, "foo")); // Empty A1:A39 first. clearRange(m_pDoc, ScRange(0, 0, 0, 0, 40, 0)); @@ -4628,9 +4622,8 @@ void Test::testFuncVLOOKUP() { // VLOOKUP - OUString aTabName("foo"); CPPUNIT_ASSERT_MESSAGE ("failed to insert sheet", - m_pDoc->InsertTab (0, aTabName)); + m_pDoc->InsertTab (0, "foo")); // Clear A1:F40. clearRange(m_pDoc, ScRange(0, 0, 0, 5, 39, 0)); @@ -4876,9 +4869,8 @@ void runTestHorizontalMATCH(ScDocument* pDoc, const char* aData[DataSize], StrSt void Test::testFuncMATCH() { - OUString 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, 40, 40, 0)); { @@ -5012,7 +5004,7 @@ void Test::testFuncMATCH() void Test::testFuncCELL() { - OUString aTabName("foo"); + OUString const aTabName("foo"); CPPUNIT_ASSERT_MESSAGE ("failed to insert sheet", m_pDoc->InsertTab (0, aTabName)); @@ -5021,8 +5013,7 @@ void Test::testFuncCELL() { const char* pContent = "Some random text"; m_pDoc->SetString(2, 9, 0, OUString::createFromAscii(pContent)); // Set this value to C10. - double val = 1.2; - m_pDoc->SetValue(2, 0, 0, val); // Set numeric value to C1; + m_pDoc->SetValue(2, 0, 0, 1.2); // Set numeric value to C1; // We don't test: FILENAME, FORMAT, WIDTH, PROTECT, PREFIX StrStrCheck aChecks[] = { @@ -5055,9 +5046,8 @@ void Test::testFuncCELL() /** See also test case document fdo#44456 sheet cpearson */ void Test::testFuncDATEDIF() { - OUString aTabName("foo"); CPPUNIT_ASSERT_MESSAGE ("failed to insert sheet", - m_pDoc->InsertTab (0, aTabName)); + m_pDoc->InsertTab (0, "foo")); const char* aData[][5] = { { "2007-01-01", "2007-01-10", "d", "9", "=DATEDIF(A1;B1;C1)" } , @@ -5655,16 +5645,16 @@ void Test::testExternalRef() rExtDoc.InsertTab(1, aExtSh2Name); rExtDoc.InsertTab(2, aExtSh3Name); - OUString name("Name"); - OUString value("Value"); - OUString andy("Andy"); - OUString bruce("Bruce"); - OUString charlie("Charlie"); - OUString david("David"); - OUString edward("Edward"); - OUString frank("Frank"); - OUString george("George"); - OUString henry("Henry"); + 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); @@ -5813,8 +5803,8 @@ void Test::testExternalRangeName() { ScDocShellRef xExtDocSh = new ScDocShell; xExtDocSh->SetIsInUcalc(); - OUString aExtDocName("file:///extdata.fake"); - OUString aExtSh1Name("Data1"); + 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.", @@ -6321,7 +6311,7 @@ void Test::testFuncTableRef() ScRangeName* pGlobalNames = m_pDoc->GetRangeName(); CPPUNIT_ASSERT_MESSAGE("Failed to obtain global named expression object.", pGlobalNames); - for (size_t i = 0, n = SAL_N_ELEMENTS(aNames); i < n; ++i) + for (size_t i = 0; i < SAL_N_ELEMENTS(aNames); ++i) { // Choose base position that does not intersect with the database // range definition to test later use of [#This Row] results in @@ -6336,7 +6326,7 @@ void Test::testFuncTableRef() } // Use the named expressions in COUNTA() formulas, on row 2 that intersects. - for (size_t i = 0, n = SAL_N_ELEMENTS(aNames); i < n; ++i) + for (size_t i = 0; i < SAL_N_ELEMENTS(aNames); ++i) { OUString aFormula( "=COUNTA(" + OUString::createFromAscii( aNames[i].pName) + ")"); ScAddress aPos(3+i,1,0); @@ -6348,7 +6338,7 @@ void Test::testFuncTableRef() } // Use the named expressions in SUM() formulas, on row 3 that intersects. - for (size_t i = 0, n = SAL_N_ELEMENTS(aNames); i < n; ++i) + for (size_t i = 0; i < SAL_N_ELEMENTS(aNames); ++i) { OUString aFormula( "=SUM(" + OUString::createFromAscii( aNames[i].pName) + ")"); ScAddress aPos(3+i,2,0); @@ -6360,7 +6350,7 @@ void Test::testFuncTableRef() } // Use the named expressions in SUM() formulas, on row 4 that intersects. - for (size_t i = 0, n = SAL_N_ELEMENTS(aNames); i < n; ++i) + for (size_t i = 0; i < SAL_N_ELEMENTS(aNames); ++i) { OUString aFormula( "=SUM(" + OUString::createFromAscii( aNames[i].pName) + ")"); ScAddress aPos(3+i,3,0); @@ -6372,7 +6362,7 @@ void Test::testFuncTableRef() } // Use the named expressions in SUM() formulas, on row 5 that does not intersect. - for (size_t i = 0, n = SAL_N_ELEMENTS(aNames); i < n; ++i) + for (size_t i = 0; i < SAL_N_ELEMENTS(aNames); ++i) { OUString aFormula( "=SUM(" + OUString::createFromAscii( aNames[i].pName) + ")"); ScAddress aPos(3+i,4,0); @@ -6390,7 +6380,7 @@ void Test::testFuncTableRef() // Re-verify the named expression in SUM() formula, on row 4 that // intersects, now starting at column E, still works. m_pDoc->CalcAll(); - for (size_t i = 0, n = SAL_N_ELEMENTS(aNames); i < n; ++i) + for (size_t i = 0; i < SAL_N_ELEMENTS(aNames); ++i) { OUString aFormula( "=SUM(" + OUString::createFromAscii( aNames[i].pName) + ")"); ScAddress aPos(4+i,3,0); @@ -6495,7 +6485,7 @@ void Test::testFuncTableRef() ScRangeName* pGlobalNames = m_pDoc->GetRangeName(); CPPUNIT_ASSERT_MESSAGE("Failed to obtain global named expression object.", pGlobalNames); - for (size_t i = 0, n = SAL_N_ELEMENTS(aHlNames); i < n; ++i) + for (size_t i = 0; i < SAL_N_ELEMENTS(aHlNames); ++i) { // Choose base position that does not intersect with the database // range definition to test later use of [#This Row] results in @@ -6510,7 +6500,7 @@ void Test::testFuncTableRef() } // Use the named expressions in COUNTA() formulas, on row 10 that intersects. - for (size_t i = 0, n = SAL_N_ELEMENTS(aHlNames); i < n; ++i) + for (size_t i = 0; i < SAL_N_ELEMENTS(aHlNames); ++i) { OUString aFormula( "=COUNTA(" + OUString::createFromAscii( aHlNames[i].pName) + ")"); ScAddress aPos(7+i,9,0); @@ -6522,7 +6512,7 @@ void Test::testFuncTableRef() } // Use the named expressions in SUM() formulas, on row 11 that intersects. - for (size_t i = 0, n = SAL_N_ELEMENTS(aHlNames); i < n; ++i) + for (size_t i = 0; i < SAL_N_ELEMENTS(aHlNames); ++i) { OUString aFormula( "=SUM(" + OUString::createFromAscii( aHlNames[i].pName) + ")"); ScAddress aPos(7+i,10,0); @@ -6534,7 +6524,7 @@ void Test::testFuncTableRef() } // Use the named expressions in SUM() formulas, on row 12 that intersects. - for (size_t i = 0, n = SAL_N_ELEMENTS(aHlNames); i < n; ++i) + for (size_t i = 0; i < SAL_N_ELEMENTS(aHlNames); ++i) { OUString aFormula( "=SUM(" + OUString::createFromAscii( aHlNames[i].pName) + ")"); ScAddress aPos(7+i,11,0); @@ -6546,7 +6536,7 @@ void Test::testFuncTableRef() } // Use the named expressions in SUM() formulas, on row 13 that does not intersect. - for (size_t i = 0, n = SAL_N_ELEMENTS(aHlNames); i < n; ++i) + for (size_t i = 0; i < SAL_N_ELEMENTS(aHlNames); ++i) { OUString aFormula( "=SUM(" + OUString::createFromAscii( aHlNames[i].pName) + ")"); ScAddress aPos(7+i,12,0); @@ -6564,7 +6554,7 @@ void Test::testFuncTableRef() // Re-verify the named expression in SUM() formula, on row 12 that // intersects, now starting at column I, still works. m_pDoc->CalcAll(); - for (size_t i = 0, n = SAL_N_ELEMENTS(aHlNames); i < n; ++i) + for (size_t i = 0; i < SAL_N_ELEMENTS(aHlNames); ++i) { OUString aFormula( "=SUM(" + OUString::createFromAscii( aHlNames[i].pName) + ")"); ScAddress aPos(8+i,11,0); @@ -7420,8 +7410,8 @@ void Test::testFuncMDETERM() m_pDoc->InsertTab(0, "MDETERM_test"); ScAddress aPos(8,0,0); - OUString aColCodes("ABCDEFGH"); - OUString aFormulaTemplate("=MDETERM(A1:B2)"); + OUString const aColCodes("ABCDEFGH"); + OUString const aFormulaTemplate("=MDETERM(A1:B2)"); OUStringBuffer aFormulaBuffer(aFormulaTemplate); for( SCSIZE nSize = 3; nSize <= 8; nSize++ ) { @@ -7701,10 +7691,9 @@ void Test::testTdf97587() m_pDoc->CopyToClip(aClipParam, &aClipDoc, &aMark, false, false); // Paste it to first range. - InsertDeleteFlags nFlags = InsertDeleteFlags::CONTENTS; ScRange aDestRange(1, 1, 0, 1, TOTAL_ROWS + ROW_RANGE, 0); aMark.SetMarkArea(aDestRange); - m_pDoc->CopyFromClip(aDestRange, aMark, nFlags, nullptr, &aClipDoc); + m_pDoc->CopyFromClip(aDestRange, aMark, InsertDeleteFlags::CONTENTS, nullptr, &aClipDoc); // Check the formula results in column B. for( SCROW i = 0; i < TOTAL_ROWS + 1; ++i ) diff --git a/sc/qa/unit/ucalc_pivottable.cxx b/sc/qa/unit/ucalc_pivottable.cxx index 7f286a6e3b89..1b2d64e0bb0f 100644 --- a/sc/qa/unit/ucalc_pivottable.cxx +++ b/sc/qa/unit/ucalc_pivottable.cxx @@ -211,7 +211,7 @@ void Test::testPivotTable() }; size_t nFieldCount = SAL_N_ELEMENTS(aFields); - size_t nDataCount = SAL_N_ELEMENTS(aData); + size_t const nDataCount = SAL_N_ELEMENTS(aData); ScRange aSrcRange = insertDPSourceData(m_pDoc, aFields, nFieldCount, aData, nDataCount); SCROW nRow1 = aSrcRange.aStart.Row(), nRow2 = aSrcRange.aEnd.Row(); @@ -392,7 +392,7 @@ void Test::testPivotTableLabels() }; size_t nFieldCount = SAL_N_ELEMENTS(aFields); - size_t nDataCount = SAL_N_ELEMENTS(aData); + size_t const nDataCount = SAL_N_ELEMENTS(aData); ScRange aSrcRange = insertDPSourceData(m_pDoc, aFields, nFieldCount, aData, nDataCount); SCROW nRow1 = aSrcRange.aStart.Row(), nRow2 = aSrcRange.aEnd.Row(); @@ -448,7 +448,7 @@ void Test::testPivotTableDateLabels() }; size_t nFieldCount = SAL_N_ELEMENTS(aFields); - size_t nDataCount = SAL_N_ELEMENTS(aData); + size_t const nDataCount = SAL_N_ELEMENTS(aData); ScRange aSrcRange = insertDPSourceData(m_pDoc, aFields, nFieldCount, aData, nDataCount); SCROW nRow1 = aSrcRange.aStart.Row(), nRow2 = aSrcRange.aEnd.Row(); @@ -531,7 +531,7 @@ void Test::testPivotTableFilters() }; size_t nFieldCount = SAL_N_ELEMENTS(aFields); - size_t nDataCount = SAL_N_ELEMENTS(aData); + size_t const nDataCount = SAL_N_ELEMENTS(aData); ScRange aSrcRange = insertDPSourceData(m_pDoc, aFields, nFieldCount, aData, nDataCount); SCROW nRow1 = aSrcRange.aStart.Row(), nRow2 = aSrcRange.aEnd.Row(); @@ -680,7 +680,7 @@ void Test::testPivotTableNamedSource() }; size_t nFieldCount = SAL_N_ELEMENTS(aFields); - size_t nDataCount = SAL_N_ELEMENTS(aData); + size_t const nDataCount = SAL_N_ELEMENTS(aData); // Insert the raw data. ScRange aSrcRange = insertDPSourceData(m_pDoc, aFields, nFieldCount, aData, nDataCount); @@ -1593,8 +1593,7 @@ void Test::testPivotTableTextNumber() }; // Insert raw data such that the first column values are entered as text. - size_t nRowCount = SAL_N_ELEMENTS(aData); - for (size_t nRow = 0; nRow < nRowCount; ++nRow) + for (size_t nRow = 0; nRow < SAL_N_ELEMENTS(aData); ++nRow) { ScSetStringParam aParam; aParam.mbDetectNumberFormat = false; @@ -1773,7 +1772,7 @@ void Test::testPivotTableNumStability() m_pDoc->InsertTab(0, "Data"); m_pDoc->InsertTab(1, "Table"); - size_t nRowCount = SAL_N_ELEMENTS(aData); + size_t const nRowCount = SAL_N_ELEMENTS(aData); ScAddress aPos(1,1,0); ScRange aDataRange = insertRangeData(m_pDoc, aPos, aData, nRowCount); @@ -2352,7 +2351,7 @@ void Test::testPivotTableRepeatItemLabels() }; size_t nFieldCount = SAL_N_ELEMENTS(aFields); - size_t nDataCount = SAL_N_ELEMENTS(aData); + size_t const nDataCount = SAL_N_ELEMENTS(aData); ScRange aSrcRange = insertDPSourceData(m_pDoc, aFields, nFieldCount, aData, nDataCount); SCROW nRow1 = aSrcRange.aStart.Row(), nRow2 = aSrcRange.aEnd.Row(); @@ -2424,7 +2423,7 @@ void Test::testPivotTableDPCollection() }; size_t nFieldCount = SAL_N_ELEMENTS(aFields); - size_t nDataCount = SAL_N_ELEMENTS(aData); + size_t const nDataCount = SAL_N_ELEMENTS(aData); ScRange aSrcRange = insertDPSourceData(m_pDoc, aFields, nFieldCount, aData, nDataCount); SCROW nRow1 = aSrcRange.aStart.Row(), nRow2 = aSrcRange.aEnd.Row(); diff --git a/sc/qa/unit/ucalc_sharedformula.cxx b/sc/qa/unit/ucalc_sharedformula.cxx index 204e9dfaef30..dcf4accd0307 100644 --- a/sc/qa/unit/ucalc_sharedformula.cxx +++ b/sc/qa/unit/ucalc_sharedformula.cxx @@ -714,9 +714,8 @@ void Test::testSharedFormulasRefUpdateExternal() // Launch an external document shell. ScDocShellRef xExtDocSh = new ScDocShell; xExtDocSh->SetIsInUcalc(); - OUString aExtDocName("file:///extdata.fake"); - SfxMedium* pMed = new SfxMedium(aExtDocName, StreamMode::STD_READWRITE); + SfxMedium* pMed = new SfxMedium("file:///extdata.fake", StreamMode::STD_READWRITE); xExtDocSh->DoInitNew(pMed); ScDocument& rExtDoc = xExtDocSh->GetDocument(); @@ -792,7 +791,7 @@ void Test::testSharedFormulasInsertRow() { // B1:B2 and B4:B5 should point to $A$5. SCROW pRows[] = { 0, 1, 3, 4 }; - for (size_t i = 0, n = SAL_N_ELEMENTS(pRows); i < n; ++i) + for (size_t i = 0; i < SAL_N_ELEMENTS(pRows); ++i) { ScAddress aPos(1, pRows[i], 0); ASSERT_FORMULA_EQUAL(*pDoc, aPos, "$A$5", "Wrong formula!"); diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx index b1acc841a0ca..8456b872f70e 100644 --- a/sc/source/core/data/column.cxx +++ b/sc/source/core/data/column.cxx @@ -1750,8 +1750,7 @@ void ScColumn::CopyUpdated( const ScColumn& rPosCol, ScColumn& rDestCol ) const sc::SingleColumnSpanSet::SpansType aRanges; aRangeSet.getSpans(aRanges); - bool bCopyNotes = true; - CopyToClipHandler aFunc(*this, rDestCol, nullptr, bCopyNotes); + CopyToClipHandler aFunc(*this, rDestCol, nullptr, true/*bCopyNotes*/); sc::CellStoreType::const_iterator itPos = maCells.begin(); sc::SingleColumnSpanSet::SpansType::const_iterator it = aRanges.begin(), itEnd = aRanges.end(); for (; it != itEnd; ++it) diff --git a/sc/source/core/data/column2.cxx b/sc/source/core/data/column2.cxx index 506e59006253..582fe6734a00 100644 --- a/sc/source/core/data/column2.cxx +++ b/sc/source/core/data/column2.cxx @@ -695,7 +695,6 @@ sal_uInt16 ScColumn::GetOptimalColWidth( ScNeededSizeOptions aOptions; aOptions.bFormula = bFormula; const ScPatternAttr* pOldPattern = nullptr; - SvtScriptType nOldScript = SvtScriptType::NONE; // Go though all non-empty cells within selection. sc::CellStoreType::const_iterator itPos = maCells.begin(); @@ -723,7 +722,7 @@ sal_uInt16 ScColumn::GetOptimalColWidth( const ScPatternAttr* pPattern = GetPattern(nRow); aOptions.pPattern = pPattern; - aOptions.bGetFont = (pPattern != pOldPattern || nScript != nOldScript); + aOptions.bGetFont = (pPattern != pOldPattern || nScript != SvtScriptType::NONE); pOldPattern = pPattern; sal_uInt16 nThis = (sal_uInt16) GetNeededSize( nRow, pDev, nPPTX, nPPTY, rZoomX, rZoomY, true, aOptions, &pOldPattern); diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index 92765d1314bc..112afef0a14a 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -1454,9 +1454,8 @@ public: { case sc::element_type_numeric: { - double fVal1 = 0.0; double fVal2 = sc::numeric_block::at(*aPos.first->data, aPos.second); - doFunction(nDestRow, fVal1, fVal2); + doFunction(nDestRow, 0.0, fVal2); } break; case sc::element_type_string: diff --git a/sc/source/core/data/dociter.cxx b/sc/source/core/data/dociter.cxx index 901496de75d6..989534a67527 100644 --- a/sc/source/core/data/dociter.cxx +++ b/sc/source/core/data/dociter.cxx @@ -2308,8 +2308,7 @@ void ScHorizontalAttrIterator::InitForNextRow(bool bInitialization) if ( !nIndex && !pArray->nCount ) { - SCROW nThisEnd = MAXROW; - pNextEnd[nPos] = nThisEnd; + pNextEnd[nPos] = MAXROW; OSL_ENSURE( pNextEnd[nPos] >= nRow, "Sequence out of order" ); ppPatterns[nPos] = nullptr; } diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx index 4c4d25752207..677eef69ba6b 100644 --- a/sc/source/core/data/documen3.cxx +++ b/sc/source/core/data/documen3.cxx @@ -125,11 +125,10 @@ void ScDocument::GetAllTabRangeNames(ScRangeName::TabNameCopyMap& rNames) const void ScDocument::SetAllRangeNames(const std::map<OUString, std::unique_ptr<ScRangeName>>& rRangeMap) { - OUString aGlobalStr(STR_GLOBAL_RANGE_NAME); auto itr = rRangeMap.begin(), itrEnd = rRangeMap.end(); for (; itr!=itrEnd; ++itr) { - if (itr->first == aGlobalStr) + if (itr->first == STR_GLOBAL_RANGE_NAME) { delete pRangeName; const ScRangeName *const pName = itr->second.get(); diff --git a/sc/source/core/data/documen4.cxx b/sc/source/core/data/documen4.cxx index a6cbd1a321f6..d2f74b9f6125 100644 --- a/sc/source/core/data/documen4.cxx +++ b/sc/source/core/data/documen4.cxx @@ -147,7 +147,7 @@ bool ScDocument::Solver(SCCOL nFCol, SCROW nFRow, SCTAB nFTab, sal_uInt16 nHorIter = 0; const double fHorStepAngle = 5.0; const double fHorMaxAngle = 80.0; - int nHorMaxIter = static_cast<int>( fHorMaxAngle / fHorStepAngle ); + int const nHorMaxIter = static_cast<int>( fHorMaxAngle / fHorStepAngle ); bool bDoneHorMove = false; while ( !bDoneHorMove && !bHorMoveError && nHorIter++ < nHorMaxIter ) diff --git a/sc/source/core/data/documen5.cxx b/sc/source/core/data/documen5.cxx index c15f9fc2de9b..73e750c4f62c 100644 --- a/sc/source/core/data/documen5.cxx +++ b/sc/source/core/data/documen5.cxx @@ -143,7 +143,6 @@ void ScDocument::UpdateAllCharts() OUString sRangeStr; aRanges->Format( sRangeStr, ScRefFlags::RANGE_ABS_3D, this, GetAddressConvention() ); - chart::ChartDataRowSource eDataRowSource = chart::ChartDataRowSource_COLUMNS; bool bHasCategories = pChartObj->HasRowHeaders(); bool bFirstCellAsLabel = pChartObj->HasColHeaders(); @@ -163,7 +162,7 @@ void ScDocument::UpdateAllCharts() pShell->GetModel(), uno::UNO_QUERY ); xReceiver->attachNumberFormatsSupplier( xNumberFormatsSupplier ); - lcl_SetChartParameters( xReceiver, sRangeStr, eDataRowSource, + lcl_SetChartParameters( xReceiver, sRangeStr, chart::ChartDataRowSource_COLUMNS, bHasCategories, bFirstCellAsLabel ); } diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index 41545c80b41a..b0a953801d72 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -2995,11 +2995,10 @@ void ScDocument::CopyMultiRangeFromClip( if (!bSkipAttrForEmpty) { // Do the deletion first. - InsertDeleteFlags nDelFlag = InsertDeleteFlags::CONTENTS; SCCOL nColSize = rClipParam.getPasteColSize(); SCROW nRowSize = rClipParam.getPasteRowSize(); - DeleteArea(nCol1, nRow1, nCol1+nColSize-1, nRow1+nRowSize-1, rMark, nDelFlag, false, &aBroadcastSpans); + DeleteArea(nCol1, nRow1, nCol1+nColSize-1, nRow1+nRowSize-1, rMark, InsertDeleteFlags::CONTENTS, false, &aBroadcastSpans); } sc::CopyFromClipContext aCxt(*this, nullptr, pClipDoc, nInsFlag, bAsLink, bSkipAttrForEmpty); diff --git a/sc/source/core/data/dpcache.cxx b/sc/source/core/data/dpcache.cxx index 2064d840496d..d01419e0e2af 100644 --- a/sc/source/core/data/dpcache.cxx +++ b/sc/source/core/data/dpcache.cxx @@ -768,8 +768,7 @@ bool ScDPCache::ValidQuery( SCROW nRow, const ScQueryParam &rParam) const bool bRealWildOrRegExp = (rParam.eSearchType != utl::SearchParam::SearchType::Normal && ((rEntry.eOp == SC_EQUAL) || (rEntry.eOp == SC_NOT_EQUAL))); - bool bTestWildOrRegExp = false; - if (bRealWildOrRegExp || bTestWildOrRegExp) + if (bRealWildOrRegExp) { sal_Int32 nStart = 0; sal_Int32 nEnd = aCellStr.getLength(); diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx index 810742838814..050cb6639773 100644 --- a/sc/source/core/data/dpobject.cxx +++ b/sc/source/core/data/dpobject.cxx @@ -1452,7 +1452,6 @@ bool dequote( const OUString& rSource, sal_Int32 nStartPos, sal_Int32& rEndPos, { // nStartPos has to point to opening quote - bool bRet = false; const sal_Unicode cQuote = '\''; if (rSource[nStartPos] == cQuote) @@ -1488,7 +1487,7 @@ bool dequote( const OUString& rSource, sal_Int32 nStartPos, sal_Int32& rEndPos, // no closing quote before the end of the string -> error (bRet still false) } - return bRet; + return false; } struct ScGetPivotDataFunctionEntry @@ -2426,8 +2425,6 @@ bool ScDPObject::FillLabelDataForDimension( OUString aSubtotalName = ScUnoHelpFunctions::GetStringProperty( xDimProp, SC_UNO_DP_FIELD_SUBTOTALNAME, OUString()); - bool bIsValue = true; //TODO: check - // Name from the UNO dimension object may have trailing '*'s in which // case it's a duplicate dimension. Convert that to a duplicate index. @@ -2438,7 +2435,7 @@ bool ScDPObject::FillLabelDataForDimension( rLabelData.mnCol = static_cast<SCCOL>(nDim); rLabelData.mnDupCount = nDupCount; rLabelData.mbDataLayout = bData; - rLabelData.mbIsValue = bIsValue; + rLabelData.mbIsValue = true; //TODO: check if (!bData) { @@ -3749,15 +3746,10 @@ ScDPObject* ScDPCollection::GetByName(const OUString& rName) const OUString ScDPCollection::CreateNewName() const { - OUString aBase("DataPilot"); - size_t n = maTables.size(); for (size_t nAdd = 0; nAdd <= n; ++nAdd) // nCount+1 tries { - OUStringBuffer aBuf; - aBuf.append(aBase); - aBuf.append(static_cast<sal_Int32>(1 + nAdd)); - OUString aNewName = aBuf.makeStringAndClear(); + OUString aNewName = "DataPilot" + OUString::number(1 + nAdd); bool bFound = false; TablesType::const_iterator itr = maTables.begin(), itrEnd = maTables.end(); for (; itr != itrEnd; ++itr) diff --git a/sc/source/core/data/dpsave.cxx b/sc/source/core/data/dpsave.cxx index a7420be0bf78..323eb34b431d 100644 --- a/sc/source/core/data/dpsave.cxx +++ b/sc/source/core/data/dpsave.cxx @@ -1091,8 +1091,6 @@ void ScDPSaveData::SetDrillDown(bool bSet) static void lcl_ResetOrient( const uno::Reference<sheet::XDimensionsSupplier>& xSource ) { - sheet::DataPilotFieldOrientation eOrient = sheet::DataPilotFieldOrientation_HIDDEN; - uno::Reference<container::XNameAccess> xDimsName = xSource->getDimensions(); uno::Reference<container::XIndexAccess> xIntDims = new ScNameToIndexAccess( xDimsName ); long nIntCount = xIntDims->getCount(); @@ -1102,7 +1100,7 @@ static void lcl_ResetOrient( const uno::Reference<sheet::XDimensionsSupplier>& x uno::Reference<beans::XPropertySet> xDimProp( xIntDim, uno::UNO_QUERY ); if (xDimProp.is()) { - xDimProp->setPropertyValue( SC_UNO_DP_ORIENTATION, uno::Any(eOrient) ); + xDimProp->setPropertyValue( SC_UNO_DP_ORIENTATION, uno::Any(sheet::DataPilotFieldOrientation_HIDDEN) ); } } } diff --git a/sc/source/core/data/dptabsrc.cxx b/sc/source/core/data/dptabsrc.cxx index 38c21bd0e92b..7c92e59d3745 100644 --- a/sc/source/core/data/dptabsrc.cxx +++ b/sc/source/core/data/dptabsrc.cxx @@ -1626,8 +1626,7 @@ uno::Any SAL_CALL ScDPDimension::getPropertyValue( const OUString& aPropertyName aRet <<= mbHasHiddenMember; else if (aPropertyName == SC_UNO_DP_FLAGS) { - sal_Int32 nFlags = 0; // tabular data: all orientations are possible - aRet <<= nFlags; + aRet <<= sal_Int32(0); // tabular data: all orientations are possible } else { diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx index 45f17c663b51..0611f1b7369a 100644 --- a/sc/source/core/data/table1.cxx +++ b/sc/source/core/data/table1.cxx @@ -320,7 +320,7 @@ ScTable::ScTable( ScDocument* pDoc, SCTAB nNewTab, const OUString& rNewName, if ( pDrawLayer->ScAddPage( nTab ) ) // sal_False (not inserted) during Undo { pDrawLayer->ScRenamePage( nTab, aName ); - sal_uLong nx = (sal_uLong) ((double) (MAXCOL+1) * STD_COL_WIDTH * HMM_PER_TWIPS ); + sal_uLong const nx = (sal_uLong) ((double) (MAXCOL+1) * STD_COL_WIDTH * HMM_PER_TWIPS ); sal_uLong ny = (sal_uLong) ((double) (MAXROW+1) * ScGlobal::nStdRowHeight * HMM_PER_TWIPS ); pDrawLayer->SetPageSize( static_cast<sal_uInt16>(nTab), Size( nx, ny ), false ); } diff --git a/sc/source/core/tool/addincol.cxx b/sc/source/core/tool/addincol.cxx index d4041aa40656..82a464737af6 100644 --- a/sc/source/core/tool/addincol.cxx +++ b/sc/source/core/tool/addincol.cxx @@ -479,7 +479,6 @@ void ScUnoAddInCollection::ReadConfiguration() std::unique_ptr<ScAddInArgDesc[]> pVisibleArgs; long nVisibleCount = 0; - long nCallerPos = SC_CALLERPOS_NONE; OUString aArgumentsPath(aFuncPropPath + CFGSTR_PARAMETERS); @@ -547,7 +546,7 @@ void ScUnoAddInCollection::ReadConfiguration() aFuncName, aLocalName, aDescription, nCategory, sHelpId, xFunc, aObject, - nVisibleCount, pVisibleArgs.get(), nCallerPos ); + nVisibleCount, pVisibleArgs.get(), SC_CALLERPOS_NONE ); pData->SetCompNames( aCompNames ); diff --git a/sc/source/core/tool/autoform.cxx b/sc/source/core/tool/autoform.cxx index 889af745e706..40b6a836adfa 100644 --- a/sc/source/core/tool/autoform.cxx +++ b/sc/source/core/tool/autoform.cxx @@ -801,8 +801,7 @@ bool ScAutoFormatData::Load( SvStream& rStream, const ScAfVersions& rVersions ) bool ScAutoFormatData::Save(SvStream& rStream, sal_uInt16 fileVersion) { - sal_uInt16 nVal = AUTOFORMAT_DATA_ID; - rStream.WriteUInt16( nVal ); + rStream.WriteUInt16( AUTOFORMAT_DATA_ID ); // --- from 680/dr25 on: store strings as UTF-8 write_uInt16_lenPrefixed_uInt8s_FromOUString(rStream, aName, RTL_TEXTENCODING_UTF8); @@ -1021,7 +1020,6 @@ void ScAutoFormat::Load() if( nVal == AUTOFORMAT_ID_358 || (AUTOFORMAT_ID_504 <= nVal && nVal <= AUTOFORMAT_ID) ) { - sal_uInt16 nFileVers = SOFFICE_FILEFORMAT_40; sal_uInt8 nChrSet, nCnt; long nPos = rStream.Tell(); rStream.ReadUChar( nCnt ).ReadUChar( nChrSet ); @@ -1031,7 +1029,7 @@ void ScAutoFormat::Load() rStream.Seek( nPos + nCnt ); } rStream.SetStreamCharSet( GetSOLoadTextEncoding( nChrSet ) ); - rStream.SetVersion( nFileVers ); + rStream.SetVersion( SOFFICE_FILEFORMAT_40 ); } if( nVal == AUTOFORMAT_ID_358 || nVal == AUTOFORMAT_ID_X || @@ -1073,8 +1071,7 @@ bool ScAutoFormat::Save() rStream.SetVersion( fileVersion ); // Attention: A common header has to be saved - sal_uInt16 nVal = AUTOFORMAT_ID; - rStream.WriteUInt16( nVal ) + rStream.WriteUInt16( AUTOFORMAT_ID ) .WriteUChar( 2 ) // Number of chars of the header including this .WriteUChar( ::GetSOStoreTextEncoding( osl_getThreadTextEncoding() ) ); diff --git a/sc/source/core/tool/consoli.cxx b/sc/source/core/tool/consoli.cxx index 76e59047febb..cf3a3a355605 100644 --- a/sc/source/core/tool/consoli.cxx +++ b/sc/source/core/tool/consoli.cxx @@ -716,7 +716,6 @@ void ScConsData::OutputToDocument( ScDocument* pDestDoc, SCCOL nCol, SCROW nRow, if (ppTitlePos && !maTitles.empty() && !maRowHeaders.empty()) { - OUString aDelim( " / " ); for (SCSIZE nPos=0; nPos<nDataCount; nPos++) { SCSIZE nTPos = ppTitlePos[nArrY][nPos]; @@ -726,9 +725,7 @@ void ScConsData::OutputToDocument( ScDocument* pDestDoc, SCCOL nCol, SCROW nRow, bDo = false; // empty if ( bDo && nTPos < nNeeded ) { - aString = maRowHeaders[nArrY]; - aString += aDelim; - aString += maTitles[nPos]; + aString = maRowHeaders[nArrY] + " / " + maTitles[nPos]; pDestDoc->SetString( nCol-1, nRow+nArrY+nTPos, nTab, aString ); } } diff --git a/sc/source/core/tool/dbdata.cxx b/sc/source/core/tool/dbdata.cxx index 1f2e7703f271..202ec4edfb3a 100644 --- a/sc/source/core/tool/dbdata.cxx +++ b/sc/source/core/tool/dbdata.cxx @@ -1236,9 +1236,8 @@ ScDBData* ScDBCollection::AnonDBs::getByRange(const ScRange& rRange) if (!pData) { // Insert a new db data. They all have identical names. - OUString aName(STR_DB_GLOBAL_NONAME); ::std::unique_ptr<ScDBData> pNew(new ScDBData( - aName, rRange.aStart.Tab(), rRange.aStart.Col(), rRange.aStart.Row(), + STR_DB_GLOBAL_NONAME, rRange.aStart.Tab(), rRange.aStart.Col(), rRange.aStart.Row(), rRange.aEnd.Col(), rRange.aEnd.Row(), true, false, false)); pData = pNew.get(); m_DBs.push_back(std::move(pNew)); diff --git a/sc/source/core/tool/detfunc.cxx b/sc/source/core/tool/detfunc.cxx index 56c3578088aa..be341862b9ce 100644 --- a/sc/source/core/tool/detfunc.cxx +++ b/sc/source/core/tool/detfunc.cxx @@ -189,8 +189,7 @@ ScDetectiveData::ScDetectiveData( SdrModel* pModel ) : aCircleSet.Put( XLineColorItem( OUString(), Color( ScDetectiveFunc::GetErrorColor() ) ) ); aCircleSet.Put( XFillStyleItem( drawing::FillStyle_NONE ) ); - sal_uInt16 nWidth = 55; // 54 = 1 Pixel - aCircleSet.Put( XLineWidthItem( nWidth ) ); + aCircleSet.Put( XLineWidthItem( 55 ) ); // 54 = 1 Pixel } ScCommentData::ScCommentData( ScDocument& rDoc, SdrModel* pModel ) : diff --git a/sc/source/core/tool/editutil.cxx b/sc/source/core/tool/editutil.cxx index 94a762a9f7ca..383d8227468a 100644 --- a/sc/source/core/tool/editutil.cxx +++ b/sc/source/core/tool/editutil.cxx @@ -153,11 +153,10 @@ void ScEditUtil::RemoveCharAttribs( EditTextObject& rEditText, const ScPatternAt { ATTR_FONT_WEIGHT, EE_CHAR_WEIGHT }, { ATTR_FONT_COLOR, EE_CHAR_COLOR } }; - sal_uInt16 nMapCount = SAL_N_ELEMENTS(AttrTypeMap); const SfxItemSet& rSet = rAttr.GetItemSet(); const SfxPoolItem* pItem; - for (sal_uInt16 i = 0; i < nMapCount; ++i) + for (sal_uInt16 i = 0; i < SAL_N_ELEMENTS(AttrTypeMap); ++i) { if ( rSet.GetItemState(AttrTypeMap[i].nAttrType, false, &pItem) == SfxItemState::SET ) rEditText.RemoveCharAttribs(AttrTypeMap[i].nCharType); diff --git a/sc/source/core/tool/interpr2.cxx b/sc/source/core/tool/interpr2.cxx index 3e61c081e24b..fd80714c2001 100644 --- a/sc/source/core/tool/interpr2.cxx +++ b/sc/source/core/tool/interpr2.cxx @@ -3337,7 +3337,6 @@ void ScInterpreter::ScEuroConvert() double fToRate; int nFromDec; int nToDec; - OUString aEur( "EUR"); if ( lclConvertMoney( aFromUnit, fFromRate, nFromDec ) && lclConvertMoney( aToUnit, fToRate, nToDec ) ) { @@ -3346,7 +3345,7 @@ void ScInterpreter::ScEuroConvert() fRes = fVal; else { - if ( aFromUnit.equalsIgnoreAsciiCase( aEur ) ) + if ( aFromUnit.equalsIgnoreAsciiCase( "EUR" ) ) fRes = fVal * fToRate; else { diff --git a/sc/source/core/tool/rangenam.cxx b/sc/source/core/tool/rangenam.cxx index cbf3ff621495..b9c6f9a77f8d 100644 --- a/sc/source/core/tool/rangenam.cxx +++ b/sc/source/core/tool/rangenam.cxx @@ -473,7 +473,7 @@ ScRangeData::IsNameValidType ScRangeData::IsNameValid( const OUString& rName, Sc { /* XXX If changed, sc/source/filter/ftools/ftools.cxx * ScfTools::ConvertToScDefinedName needs to be changed too. */ - sal_Char a('.'); + sal_Char const a('.'); if (rName.indexOf(a) != -1) return NAME_INVALID_BAD_STRING; sal_Int32 nPos = 0; diff --git a/sc/source/core/tool/token.cxx b/sc/source/core/tool/token.cxx index 8349a781dd5c..2e054973dca2 100644 --- a/sc/source/core/tool/token.cxx +++ b/sc/source/core/tool/token.cxx @@ -5062,7 +5062,6 @@ OUString ScTokenArray::CreateString( sc::TokenStringContext& rCxt, const ScAddre { const FormulaToken* pToken = *p; OpCode eOp = pToken->GetOpCode(); - bool bCheckType = true; if (eOp == ocSpaces) { // TODO : Handle intersection operator '!!'. @@ -5073,8 +5072,7 @@ OUString ScTokenArray::CreateString( sc::TokenStringContext& rCxt, const ScAddre if (eOp < rCxt.mxOpCodeMap->getSymbolCount()) aBuf.append(rCxt.mxOpCodeMap->getSymbol(eOp)); - if (bCheckType) - appendTokenByType(rCxt, aBuf, *pToken, rPos, IsFromRangeName()); + appendTokenByType(rCxt, aBuf, *pToken, rPos, IsFromRangeName()); } return aBuf.makeStringAndClear(); diff --git a/sc/source/filter/excel/excform.cxx b/sc/source/filter/excel/excform.cxx index 8ed97f50c82e..f300bddc93ac 100644 --- a/sc/source/filter/excel/excform.cxx +++ b/sc/source/filter/excel/excform.cxx @@ -1610,11 +1610,10 @@ void ExcelToSc::DoMulArgs( DefTokenId eId, sal_uInt8 nAnz ) // [Parameter{;Parameter}] if( nLast > nSkipEnd ) { - sal_Int16 nNull = -1; // skip this parameter aPool << eParam[ nLast ]; for( nLauf = nLast - 1 ; nLauf > nSkipEnd ; nLauf-- ) { - if( nLauf != nNull ) + if( nLauf != -1 ) // skip this parameter aPool << ocSep << eParam[ nLauf ]; } } diff --git a/sc/source/filter/excel/excimp8.cxx b/sc/source/filter/excel/excimp8.cxx index 849fee3b4157..2fcd0aedb8dd 100644 --- a/sc/source/filter/excel/excimp8.cxx +++ b/sc/source/filter/excel/excimp8.cxx @@ -783,8 +783,7 @@ void XclImpAutoFilterData::Apply() if( bActive || bCriteria) { ScDocument& rDoc = pExcRoot->pIR->GetDocRef(); - OUString aNewName(STR_DB_LOCAL_NONAME); - pCurrDBData = new ScDBData(aNewName , Tab(), + pCurrDBData = new ScDBData(STR_DB_LOCAL_NONAME, Tab(), StartCol(),StartRow(), EndCol(),EndRow() ); if(bCriteria) { diff --git a/sc/source/filter/excel/xepage.cxx b/sc/source/filter/excel/xepage.cxx index e4bf6a5c99c8..dcd86be84c7a 100644 --- a/sc/source/filter/excel/xepage.cxx +++ b/sc/source/filter/excel/xepage.cxx @@ -310,7 +310,7 @@ XclExpPageSettings::XclExpPageSettings( const XclExpRoot& rRoot ) : set<SCROW> aRowBreaks; rDoc.GetAllRowBreaks(aRowBreaks, nScTab, false, true); - SCROW nMaxRow = numeric_limits<sal_uInt16>::max(); + SCROW const nMaxRow = numeric_limits<sal_uInt16>::max(); for (set<SCROW>::const_iterator itr = aRowBreaks.begin(), itrEnd = aRowBreaks.end(); itr != itrEnd; ++itr) { SCROW nRow = *itr; diff --git a/sc/source/filter/excel/xepivot.cxx b/sc/source/filter/excel/xepivot.cxx index 53599bb3b2e1..5f79475a5dd4 100644 --- a/sc/source/filter/excel/xepivot.cxx +++ b/sc/source/filter/excel/xepivot.cxx @@ -1517,14 +1517,14 @@ void XclExpPivotTable::WriteQsiSxTag( XclExpStream& rStrm ) const { rStrm.StartRecord( 0x0802, 32 ); - sal_uInt16 nRecordType = 0x0802; - sal_uInt16 nDummyFlags = 0x0000; - sal_uInt16 nTableType = 1; // 0 = query table : 1 = pivot table + sal_uInt16 const nRecordType = 0x0802; + sal_uInt16 const nDummyFlags = 0x0000; + sal_uInt16 const nTableType = 1; // 0 = query table : 1 = pivot table rStrm << nRecordType << nDummyFlags << nTableType; // General flags - sal_uInt16 nFlags = 0x0001; + sal_uInt16 const nFlags = 0x0001; #if 0 // for doc purpose sal_uInt16 nFlags = 0x0000; @@ -1540,7 +1540,7 @@ void XclExpPivotTable::WriteQsiSxTag( XclExpStream& rStrm ) const // Feature-specific options. The value differs depending on the table // type, but we assume the table type is always pivot table. - sal_uInt32 nOptions = 0x00000000; + sal_uInt32 const nOptions = 0x00000000; #if 0 // documentation for which bit is for what bool bNoStencil = false; @@ -1555,7 +1555,7 @@ void XclExpPivotTable::WriteQsiSxTag( XclExpStream& rStrm ) const rStrm << nOptions; sal_uInt8 eXclVer = 0; // Excel2000 - sal_uInt8 nOffsetBytes = 16; + sal_uInt8 const nOffsetBytes = 16; rStrm << eXclVer // version table last refreshed << eXclVer // minimum version to refresh << nOffsetBytes diff --git a/sc/source/filter/excel/xestream.cxx b/sc/source/filter/excel/xestream.cxx index 43aa4c0b9525..222e4aa18300 100644 --- a/sc/source/filter/excel/xestream.cxx +++ b/sc/source/filter/excel/xestream.cxx @@ -270,9 +270,8 @@ void XclExpStream::WriteZeroBytesToRecord( std::size_t nBytes ) // not in record. return; - sal_uInt8 nZero = 0; for (std::size_t i = 0; i < nBytes; ++i) - *this << nZero; + *this << sal_uInt8(0)/*nZero*/; } void XclExpStream::CopyFromStream(SvStream& rInStrm, sal_uInt64 const nBytes) diff --git a/sc/source/filter/excel/xeview.cxx b/sc/source/filter/excel/xeview.cxx index 153ee4f2612c..918866c9b089 100644 --- a/sc/source/filter/excel/xeview.cxx +++ b/sc/source/filter/excel/xeview.cxx @@ -256,11 +256,11 @@ void XclExpTabBgColor::WriteBody( XclExpStream& rStrm ) { if ( mrTabViewData.IsDefaultTabBgColor() ) return; - sal_uInt16 rt = 0x0862; //rt - sal_uInt16 grbitFrt = 0x0000; //grbit must be set to 0 + sal_uInt16 const rt = 0x0862; //rt + sal_uInt16 const grbitFrt = 0x0000; //grbit must be set to 0 sal_uInt32 unused = 0x00000000; //Use twice... - sal_uInt32 cb = 0x00000014; // Record Size, may be larger in future... - sal_uInt16 reserved = 0x0000; //trailing bits are 0 + sal_uInt32 const cb = 0x00000014; // Record Size, may be larger in future... + sal_uInt16 const reserved = 0x0000; //trailing bits are 0 sal_uInt16 TabBgColorIndex; XclExpPalette& rPal = rStrm.GetRoot().GetPalette(); TabBgColorIndex = rPal.GetColorIndex(mrTabViewData.mnTabBgColorId); diff --git a/sc/source/filter/excel/xicontent.cxx b/sc/source/filter/excel/xicontent.cxx index 150820e88ae0..178237899f52 100644 --- a/sc/source/filter/excel/xicontent.cxx +++ b/sc/source/filter/excel/xicontent.cxx @@ -680,8 +680,7 @@ void XclImpCondFormat::ReadCF( XclImpStream& rStrm ) if( !mxScCondFmt.get() ) { - sal_uLong nKey = 0; - mxScCondFmt.reset( new ScConditionalFormat( nKey, &GetDocRef() ) ); + mxScCondFmt.reset( new ScConditionalFormat( 0/*nKey*/, &GetDocRef() ) ); if(maRanges.size() > 1) maRanges.Join(*maRanges[0], true); mxScCondFmt->SetRange(maRanges); @@ -1082,9 +1081,8 @@ void XclImpWebQueryBuffer::ReadWqtables( XclImpStream& rStrm ) void XclImpWebQueryBuffer::Apply() { ScDocument& rDoc = GetDoc(); - OUString aFilterName( EXC_WEBQRY_FILTER ); for( XclImpWebQueryList::iterator itQuery = maWQList.begin(); itQuery != maWQList.end(); ++itQuery ) - itQuery->Apply( rDoc, aFilterName ); + itQuery->Apply( rDoc, EXC_WEBQRY_FILTER ); } // Decryption ================================================================= diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx index faf4802ff3c0..f8455ba868b7 100644 --- a/sc/source/filter/excel/xiescher.cxx +++ b/sc/source/filter/excel/xiescher.cxx @@ -1496,10 +1496,9 @@ void XclImpTextObj::DoPreProcessSdrObj( XclImpDffConverter& rDffConv, SdrObject& { if( SdrObjCustomShape* pObjCustomShape = dynamic_cast< SdrObjCustomShape* >( &rSdrObj ) ) { - double fAngle = 180.0; css::beans::PropertyValue aTextRotateAngle; aTextRotateAngle.Name = "TextRotateAngle"; - aTextRotateAngle.Value <<= fAngle; + aTextRotateAngle.Value <<= 180.0; SdrCustomShapeGeometryItem aGeometryItem(static_cast<const SdrCustomShapeGeometryItem&>(pObjCustomShape->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ))); aGeometryItem.SetPropertyValue( aTextRotateAngle ); pObjCustomShape->SetMergedItem( aGeometryItem ); diff --git a/sc/source/filter/excel/xlchart.cxx b/sc/source/filter/excel/xlchart.cxx index 655d4abce789..638c65f981c5 100644 --- a/sc/source/filter/excel/xlchart.cxx +++ b/sc/source/filter/excel/xlchart.cxx @@ -992,7 +992,6 @@ void XclChPropSetHelper::WriteAreaProperties( ScfPropertySet& rPropSet, namespace cssd = ::com::sun::star::drawing; cssd::FillStyle eFillStyle = cssd::FillStyle_NONE; Color aColor; - sal_Int16 nTransparency = 0; // fill color if( rAreaFmt.mnPattern != EXC_PATT_NONE ) @@ -1004,7 +1003,7 @@ void XclChPropSetHelper::WriteAreaProperties( ScfPropertySet& rPropSet, // write the properties ScfPropSetHelper& rAreaHlp = GetAreaHelper( ePropMode ); rAreaHlp.InitializeWrite(); - rAreaHlp << eFillStyle << aColor << nTransparency; + rAreaHlp << eFillStyle << aColor << 0/*nTransparency*/; rAreaHlp.WriteToPropertySet( rPropSet ); } diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx index 87d444436546..4811c230c2bc 100644 --- a/sc/source/filter/html/htmlpars.cxx +++ b/sc/source/filter/html/htmlpars.cxx @@ -2136,11 +2136,9 @@ void ScHTMLTable::DataOn( const HtmlImportInfo& rInfo ) { // Pick up the number format associated with this class (if // any). - OUString aElem("td"); OUString aClass = itr->GetString(); - OUString aProp("mso-number-format"); const ScHTMLStyles& rStyles = mpParser->GetStyles(); - const OUString& rVal = rStyles.getPropertyValue(aElem, aClass, aProp); + const OUString& rVal = rStyles.getPropertyValue("td", aClass, "mso-number-format"); if (!rVal.isEmpty()) { OUString aNumFmt = decodeNumberFormat(rVal); diff --git a/sc/source/filter/lotus/lotform.cxx b/sc/source/filter/lotus/lotform.cxx index c066684443e7..790fc829ebcc 100644 --- a/sc/source/filter/lotus/lotform.cxx +++ b/sc/source/filter/lotus/lotform.cxx @@ -201,10 +201,9 @@ void LotusToSc::DoFunc( DefTokenId eOc, sal_uInt8 nAnz, const sal_Char* pExtStri // [Parameter{;Parameter}] aPool << eParam[ nLast ]; - sal_Int16 nNull = -1; // lists the parameter to be excluded for( nLauf = nLast - 1 ; nLauf >= 0 ; nLauf-- ) { - if( nLauf != nNull ) + if( nLauf != -1 ) // lists the parameter to be excluded aPool << ocSep << eParam[ nLauf ]; } } diff --git a/sc/source/filter/lotus/lotread.cxx b/sc/source/filter/lotus/lotread.cxx index 9d4dfab84bb3..ce871ba4b49c 100644 --- a/sc/source/filter/lotus/lotread.cxx +++ b/sc/source/filter/lotus/lotread.cxx @@ -197,7 +197,6 @@ ErrCode ImportLotus::Read() SCTAB nCnt; OUString aTabName; OUString aBaseName; - OUString aRef( "temp" ); if( nTabs != 0 ) { if( nTabs > 1 ) @@ -210,7 +209,7 @@ ErrCode ImportLotus::Read() OSL_ENSURE( pD->HasTable( nCnt ), "-ImportLotus::Read(): Where is my table?!" ); pD->GetName( nCnt, aTabName ); - if( aTabName.equals(aRef) ) + if( aTabName == "temp" ) { aTabName = aBaseName; pD->CreateValidTabName( aTabName ); diff --git a/sc/source/filter/qpro/qproform.cxx b/sc/source/filter/qpro/qproform.cxx index 4ec3f386a338..6ba6f136e0b0 100644 --- a/sc/source/filter/qpro/qproform.cxx +++ b/sc/source/filter/qpro/qproform.cxx @@ -140,11 +140,10 @@ void QProToSc::DoFunc( DefTokenId eOc, sal_uInt16 nArgs, const sal_Char* pExtStr aPool << eParam[ 3 ] << ocSep << eParam[ 2 ] << ocSep << eParam[ 1 ] << ocSep << eParam[ 0 ]; else { - sal_Int16 nNull = -1; aPool << eParam[ nLast ]; for( nCount = nLast - 1 ; nCount >= 0 ; nCount-- ) { - if( nCount != nNull ) + if( nCount != -1 ) aPool << ocSep << eParam[ nCount ]; } } diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx index 951bf09bd53c..ed8bb5e8cdda 100644 --- a/sc/source/filter/xcl97/xcl97rec.cxx +++ b/sc/source/filter/xcl97/xcl97rec.cxx @@ -1586,9 +1586,8 @@ void XclExpSheetProtectOptions::WriteBody( XclExpStream& rStrm ) sal_uInt16 nBytes = 0x0867; rStrm << nBytes; - unsigned char nZero = 0x00; for (int i = 0; i < 9; ++i) - rStrm << nZero; + rStrm << 0; nBytes = 0x0200; rStrm << nBytes; @@ -1612,7 +1611,7 @@ XclExpSheetEnhancedProtection::XclExpSheetEnhancedProtection( const XclExpRoot& void XclExpSheetEnhancedProtection::WriteBody( XclExpStream& rStrm ) { - sal_uInt16 nRecordType = 0x0868; + sal_uInt16 const nRecordType = 0x0868; rStrm << nRecordType; // frtHeader rt rStrm.WriteZeroBytesToRecord(10); // frtHeader unused rStrm << EXC_ISFPROTECTION; // isf @@ -1809,8 +1808,7 @@ void XclExpWriteAccess::WriteBody( XclExpStream& rStrm ) 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20 }; - std::size_t nDataSize = sizeof(aData); - for (std::size_t i = 0; i < nDataSize; ++i) + for (std::size_t i = 0; i < sizeof(aData); ++i) rStrm << aData[i]; } diff --git a/sc/source/filter/xml/XMLCodeNameProvider.cxx b/sc/source/filter/xml/XMLCodeNameProvider.cxx index bb05210c22ab..8cd724f7c950 100644 --- a/sc/source/filter/xml/XMLCodeNameProvider.cxx +++ b/sc/source/filter/xml/XMLCodeNameProvider.cxx @@ -29,11 +29,10 @@ bool XMLCodeNameProvider::_getCodeName( const uno::Any& aAny, OUString& rCodeNam if( !(aAny >>= aProps) ) return false; - OUString sCodeNameProp("CodeName"); sal_Int32 nPropCount = aProps.getLength(); for( sal_Int32 i=0; i<nPropCount; i++ ) { - if( aProps[i].Name == sCodeNameProp ) + if( aProps[i].Name == "CodeName" ) { OUString sCodeName; if( aProps[i].Value >>= sCodeName ) diff --git a/sc/source/filter/xml/XMLStylesExportHelper.cxx b/sc/source/filter/xml/XMLStylesExportHelper.cxx index 6236dd6e7369..e1e1a39d7ae8 100644 --- a/sc/source/filter/xml/XMLStylesExportHelper.cxx +++ b/sc/source/filter/xml/XMLStylesExportHelper.cxx @@ -157,8 +157,7 @@ void ScMyValidationsContainer::AddValidation(const uno::Any& aTempAny, { sal_Int32 nNameIndex(nCount + 1); OUString sCount(OUString::number(nNameIndex)); - OUString sPrefix("val"); - aValidation.sName += sPrefix; + aValidation.sName += "val"; aValidation.sName += sCount; aValidationVec.push_back(aValidation); nValidationIndex = nCount; diff --git a/sc/source/filter/xml/editattributemap.cxx b/sc/source/filter/xml/editattributemap.cxx index fdb009cbde56..518a37b988e7 100644 --- a/sc/source/filter/xml/editattributemap.cxx +++ b/sc/source/filter/xml/editattributemap.cxx @@ -67,8 +67,7 @@ ScXMLEditAttributeMap::Entry const aEntries[] = { ScXMLEditAttributeMap::ScXMLEditAttributeMap() { - size_t n = SAL_N_ELEMENTS(aEntries); - for (size_t i = 0; i < n; ++i) + for (size_t i = 0; i < SAL_N_ELEMENTS(aEntries); ++i) { maAPIEntries.insert( StrToEntriesType::value_type( diff --git a/sc/source/filter/xml/xmlcoli.cxx b/sc/source/filter/xml/xmlcoli.cxx index 9c396d04b555..2b90f841284d 100644 --- a/sc/source/filter/xml/xmlcoli.cxx +++ b/sc/source/filter/xml/xmlcoli.cxx @@ -135,11 +135,10 @@ void ScXMLTableColContext::EndElement() } } } - OUString sVisible(SC_UNONAME_CELLVIS); bool bValue(true); if (!IsXMLToken(sVisibility, XML_VISIBLE)) bValue = false; - xColumnProperties->setPropertyValue(sVisible, uno::makeAny(bValue)); + xColumnProperties->setPropertyValue(SC_UNONAME_CELLVIS, uno::makeAny(bValue)); } } } diff --git a/sc/source/filter/xml/xmlcvali.cxx b/sc/source/filter/xml/xmlcvali.cxx index b736cec252c3..af76bf829149 100644 --- a/sc/source/filter/xml/xmlcvali.cxx +++ b/sc/source/filter/xml/xmlcvali.cxx @@ -383,11 +383,10 @@ void ScXMLContentValidationContext::EndElement() // #i36650# event-listeners element moved up one level if (xEventContext.is()) { - OUString sOnError("OnError"); XMLEventsImportContext* pEvents = static_cast<XMLEventsImportContext*>(xEventContext.get()); uno::Sequence<beans::PropertyValue> aValues; - pEvents->GetEventSequence( sOnError, aValues ); + pEvents->GetEventSequence( "OnError", aValues ); sal_Int32 nLength = aValues.getLength(); for( sal_Int32 i = 0; i < nLength; i++ ) diff --git a/sc/source/filter/xml/xmldrani.cxx b/sc/source/filter/xml/xmldrani.cxx index c38fd98e9f37..eab22def3a85 100644 --- a/sc/source/filter/xml/xmldrani.cxx +++ b/sc/source/filter/xml/xmldrani.cxx @@ -428,8 +428,7 @@ void ScXMLDatabaseRangeContext::EndElement() if (meRangeType == ScDBCollection::SheetAnonymous) { - OUString aName(STR_DB_LOCAL_NONAME); - ::std::unique_ptr<ScDBData> pData(ConvertToDBData(aName)); + ::std::unique_ptr<ScDBData> pData(ConvertToDBData(STR_DB_LOCAL_NONAME)); if (pData.get()) { @@ -443,8 +442,7 @@ void ScXMLDatabaseRangeContext::EndElement() } else if (meRangeType == ScDBCollection::GlobalAnonymous) { - OUString aName(STR_DB_GLOBAL_NONAME); - ::std::unique_ptr<ScDBData> pData(ConvertToDBData(aName)); + ::std::unique_ptr<ScDBData> pData(ConvertToDBData(STR_DB_GLOBAL_NONAME)); if (pData.get()) { diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx index 89fb12331df3..aba3614f99cb 100644 --- a/sc/source/filter/xml/xmlexprt.cxx +++ b/sc/source/filter/xml/xmlexprt.cxx @@ -1978,14 +1978,13 @@ void ScXMLExport::ExportStyles_( bool bUsed ) if (xCellStyles.is()) { sal_Int32 nCount(xCellStyles->getCount()); - OUString sNumberFormat(SC_UNONAME_NUMFMT); for (sal_Int32 i = 0; i < nCount; ++i) { uno::Reference <beans::XPropertySet> xCellProperties(xCellStyles->getByIndex(i), uno::UNO_QUERY); if (xCellProperties.is()) { sal_Int32 nNumberFormat = 0; - if (xCellProperties->getPropertyValue(sNumberFormat) >>= nNumberFormat) + if (xCellProperties->getPropertyValue(SC_UNONAME_NUMFMT) >>= nNumberFormat) addDataStyle(nNumberFormat); } } @@ -2012,9 +2011,6 @@ void ScXMLExport::AddStyleFromCells(const uno::Reference<beans::XPropertySet>& x //! pass xCellRanges instead uno::Reference<sheet::XSheetCellRanges> xCellRanges( xProperties, uno::UNO_QUERY ); - OUString SC_SCELLPREFIX(XML_STYLE_FAMILY_TABLE_CELL_STYLES_PREFIX); - OUString SC_NUMBERFORMAT(SC_UNONAME_NUMFMT); - OUString sStyleName; sal_Int32 nNumberFormat(-1); sal_Int32 nValidationIndex(-1); @@ -2072,7 +2068,7 @@ void ScXMLExport::AddStyleFromCells(const uno::Reference<beans::XPropertySet>& x if (nCount == 1) // this is the CellStyle and should be removed if alone aPropStates.clear(); if (nNumberFormat == -1) - xProperties->getPropertyValue(SC_NUMBERFORMAT) >>= nNumberFormat; + xProperties->getPropertyValue(SC_UNONAME_NUMFMT) >>= nNumberFormat; if (!sStyleName.isEmpty()) { if (!aPropStates.empty()) @@ -2114,7 +2110,7 @@ void ScXMLExport::AddStyleFromCells(const uno::Reference<beans::XPropertySet>& x delete pTemp; } else - nIndex = pCellStyles->GetIndexOfStyleName(sName, SC_SCELLPREFIX, bIsAutoStyle); + nIndex = pCellStyles->GetIndexOfStyleName(sName, XML_STYLE_FAMILY_TABLE_CELL_STYLES_PREFIX, bIsAutoStyle); uno::Sequence<table::CellRangeAddress> aAddresses(xCellRanges->getRangeAddresses()); table::CellRangeAddress* pAddresses(aAddresses.getArray()); @@ -2162,8 +2158,6 @@ void ScXMLExport::AddStyleFromCells(const uno::Reference<beans::XPropertySet>& x void ScXMLExport::AddStyleFromColumn(const uno::Reference<beans::XPropertySet>& xColumnProperties, const OUString* pOldName, sal_Int32& rIndex, bool& rIsVisible) { - OUString SC_SCOLUMNPREFIX(XML_STYLE_FAMILY_TABLE_COLUMN_STYLES_PREFIX); - std::vector<XMLPropertyState> aPropStates(xColumnStylesExportPropertySetMapper->Filter(xColumnProperties)); if(!aPropStates.empty()) { @@ -2199,7 +2193,7 @@ void ScXMLExport::AddStyleFromColumn(const uno::Reference<beans::XPropertySet>& rIndex = pColumnStyles->AddStyleName(pTemp); } else - rIndex = pColumnStyles->GetIndexOfStyleName(sName, SC_SCOLUMNPREFIX); + rIndex = pColumnStyles->GetIndexOfStyleName(sName, XML_STYLE_FAMILY_TABLE_COLUMN_STYLES_PREFIX); } } } @@ -2207,8 +2201,6 @@ void ScXMLExport::AddStyleFromColumn(const uno::Reference<beans::XPropertySet>& void ScXMLExport::AddStyleFromRow(const uno::Reference<beans::XPropertySet>& xRowProperties, const OUString* pOldName, sal_Int32& rIndex) { - OUString SC_SROWPREFIX(XML_STYLE_FAMILY_TABLE_ROW_STYLES_PREFIX); - std::vector<XMLPropertyState> aPropStates(xRowStylesExportPropertySetMapper->Filter(xRowProperties)); if(!aPropStates.empty()) { @@ -2232,7 +2224,7 @@ void ScXMLExport::AddStyleFromRow(const uno::Reference<beans::XPropertySet>& xRo rIndex = pRowStyles->AddStyleName(pTemp); } else - rIndex = pRowStyles->GetIndexOfStyleName(sName, SC_SROWPREFIX); + rIndex = pRowStyles->GetIndexOfStyleName(sName, XML_STYLE_FAMILY_TABLE_ROW_STYLES_PREFIX); } } } @@ -3382,8 +3374,6 @@ void ScXMLExport::ExportShape(const uno::Reference < drawing::XShape >& xShape, uno::Reference < beans::XPropertySet > xShapeProps ( xShape, uno::UNO_QUERY ); bool bIsChart( false ); OUString sPropCLSID ("CLSID"); - OUString sPropModel ("Model"); - OUString sPersistName ("PersistName"); if (xShapeProps.is()) { sal_Int32 nZOrder = 0; @@ -3404,7 +3394,7 @@ void ScXMLExport::ExportShape(const uno::Reference < drawing::XShape >& xShape, if ( pDoc ) { OUString aChartName; - xShapeProps->getPropertyValue( sPersistName ) >>= aChartName; + xShapeProps->getPropertyValue( "PersistName" ) >>= aChartName; ScChartListenerCollection* pCollection = pDoc->GetChartListenerCollection(); if (pCollection) { @@ -3431,7 +3421,7 @@ void ScXMLExport::ExportShape(const uno::Reference < drawing::XShape >& xShape, if ( sRanges.isEmpty() ) { uno::Reference< frame::XModel > xChartModel; - if( ( xShapeProps->getPropertyValue( sPropModel ) >>= xChartModel ) && + if( ( xShapeProps->getPropertyValue( "Model" ) >>= xChartModel ) && xChartModel.is()) { uno::Reference< chart2::XChartDocument > xChartDoc( xChartModel, uno::UNO_QUERY ); diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx index 2bcbd62b9e69..c777658a65cf 100644 --- a/sc/source/filter/xml/xmlimprt.cxx +++ b/sc/source/filter/xml/xmlimprt.cxx @@ -2661,15 +2661,12 @@ void ScXMLImport::SetConfigurationSettings(const uno::Sequence<beans::PropertyVa if (xMultiServiceFactory.is()) { sal_Int32 nCount(aConfigProps.getLength()); - OUString sCTName("TrackedChangesProtectionKey"); - OUString sVBName("VBACompatibilityMode"); - OUString sSCName("ScriptConfiguration"); css::uno::Sequence<css::beans::PropertyValue> aFilteredProps( aConfigProps.getLength()); sal_Int32 nFilteredPropsLen = 0; for (sal_Int32 i = nCount - 1; i >= 0; --i) { - if (aConfigProps[i].Name == sCTName) + if (aConfigProps[i].Name == "TrackedChangesProtectionKey") { OUString sKey; if (aConfigProps[i].Value >>= sKey) @@ -2691,7 +2688,7 @@ void ScXMLImport::SetConfigurationSettings(const uno::Sequence<beans::PropertyVa } } // store the following items for later use (after document is loaded) - else if ((aConfigProps[i].Name == sVBName) || (aConfigProps[i].Name == sSCName)) + else if ((aConfigProps[i].Name == "VBACompatibilityMode") || (aConfigProps[i].Name == "ScriptConfiguration")) { uno::Reference< beans::XPropertySet > xImportInfo = getImportInfo(); if (xImportInfo.is()) diff --git a/sc/source/filter/xml/xmlstyle.cxx b/sc/source/filter/xml/xmlstyle.cxx index 094907096a82..269f242b708f 100644 --- a/sc/source/filter/xml/xmlstyle.cxx +++ b/sc/source/filter/xml/xmlstyle.cxx @@ -685,10 +685,9 @@ void ScXMLAutoStylePoolP::exportStyleContent( SvXMLAutoStylePoolP::exportStyleContent( rHandler, nFamily, rProperties, rPropExp, rUnitConverter, rNamespaceMap ); if (nFamily == XML_STYLE_FAMILY_TABLE_CELL) { - bool bNotFound = true; ::std::vector< XMLPropertyState >::const_iterator i(rProperties.begin()); ::std::vector< XMLPropertyState >::const_iterator endi(rProperties.end()); - for(; i != endi && bNotFound; ++i) + for(; i != endi; ++i) { if (i->mnIndex != -1) { @@ -1347,8 +1346,7 @@ bool XmlScPropHdl_HoriJustifySource::importXML( } else if (IsXMLToken(rStrImpValue, XML_VALUE_TYPE)) { - table::CellHoriJustify nValue(table::CellHoriJustify_STANDARD); - rValue <<= nValue; + rValue <<= table::CellHoriJustify_STANDARD; bRetval = true; } @@ -1408,8 +1406,7 @@ bool XmlScPropHdl_HoriJustifyRepeat::importXML( } else if (IsXMLToken(rStrImpValue, XML_TRUE)) { - table::CellHoriJustify nValue = table::CellHoriJustify_REPEAT; - rValue <<= nValue; + rValue <<= table::CellHoriJustify_REPEAT; bRetval = true; } diff --git a/sc/source/filter/xml/xmlwrap.cxx b/sc/source/filter/xml/xmlwrap.cxx index 92295e09f993..979c3cda75c1 100644 --- a/sc/source/filter/xml/xmlwrap.cxx +++ b/sc/source/filter/xml/xmlwrap.cxx @@ -154,8 +154,7 @@ ErrCode ScXMLImportWrapper::ImportFromComponent(const uno::Reference<uno::XCompo OSL_ENSURE( xInfoSet.is(), "missing property set" ); if( xInfoSet.is() ) { - OUString sPropName("StreamName"); - xInfoSet->setPropertyValue( sPropName, uno::makeAny( sStream ) ); + xInfoSet->setPropertyValue( "StreamName", uno::makeAny( sStream ) ); } ErrCode nReturn = ERRCODE_NONE; @@ -628,10 +627,9 @@ bool ScXMLImportWrapper::ExportToComponent(const uno::Reference<uno::XComponentC if (xSet.is()) { xSet->setPropertyValue("MediaType", uno::makeAny(sMediaType)); - OUString aUseCommonPassPropName("UseCommonStoragePasswordEncryption"); // advise storage impl to use common encryption - xSet->setPropertyValue( aUseCommonPassPropName, uno::makeAny(true) ); + xSet->setPropertyValue( "UseCommonStoragePasswordEncryption", uno::makeAny(true) ); } xOut = xStream->getOutputStream(); @@ -644,8 +642,7 @@ bool ScXMLImportWrapper::ExportToComponent(const uno::Reference<uno::XComponentC OSL_ENSURE( xInfoSet.is(), "missing property set" ); if( xInfoSet.is() ) { - OUString sPropName("StreamName"); - xInfoSet->setPropertyValue( sPropName, uno::makeAny( sName ) ); + xInfoSet->setPropertyValue( "StreamName", uno::makeAny( sName ) ); } xWriter->setOutputStream( xOut ); diff --git a/sc/source/ui/Accessibility/AccessibleCell.cxx b/sc/source/ui/Accessibility/AccessibleCell.cxx index a88d46a0d7d5..8c672119d411 100644 --- a/sc/source/ui/Accessibility/AccessibleCell.cxx +++ b/sc/source/ui/Accessibility/AccessibleCell.cxx @@ -540,10 +540,9 @@ uno::Sequence< beans::PropertyValue > SAL_CALL ScAccessibleCell::getCharacterAtt sal_uInt16 nParaIndent = static_cast< const SfxUInt16Item* >( mpDoc->GetAttr( maCellAddress.Col(), maCellAddress.Row(), maCellAddress.Tab(), ATTR_INDENT ) )->GetValue(); if (nParaIndent > 0) { - OUString sLeftMarginName ("ParaLeftMargin"); for (int i = 0; i < aAttribs.getLength(); ++i) { - if (sLeftMarginName == pAttribs[i].Name) + if ("ParaLeftMargin" == pAttribs[i].Name) { pAttribs[i].Value <<= nParaIndent; break; diff --git a/sc/source/ui/Accessibility/AccessiblePreviewHeaderCell.cxx b/sc/source/ui/Accessibility/AccessiblePreviewHeaderCell.cxx index 448aad8cfdbd..d13dfe1e072b 100644 --- a/sc/source/ui/Accessibility/AccessiblePreviewHeaderCell.cxx +++ b/sc/source/ui/Accessibility/AccessiblePreviewHeaderCell.cxx @@ -173,8 +173,7 @@ uno::Any SAL_CALL ScAccessiblePreviewHeaderCell::getMaximumValue() uno::Any SAL_CALL ScAccessiblePreviewHeaderCell::getMinimumValue() { - double fValue(0.0); - return uno::Any(fValue); + return uno::Any(0.0); } //===== XAccessibleComponent ============================================ diff --git a/sc/source/ui/Accessibility/AccessiblePreviewTable.cxx b/sc/source/ui/Accessibility/AccessiblePreviewTable.cxx index 7354b92bf90e..8d9ee27c0070 100644 --- a/sc/source/ui/Accessibility/AccessiblePreviewTable.cxx +++ b/sc/source/ui/Accessibility/AccessiblePreviewTable.cxx @@ -580,8 +580,7 @@ uno::Sequence<sal_Int8> SAL_CALL ScAccessiblePreviewTable::getImplementationId() OUString SAL_CALL ScAccessiblePreviewTable::createAccessibleDescription() { - OUString sDesc(STR_ACC_TABLE_DESCR); - return sDesc; + return OUString(STR_ACC_TABLE_DESCR); } OUString SAL_CALL ScAccessiblePreviewTable::createAccessibleName() diff --git a/sc/source/ui/Accessibility/AccessibleTableBase.cxx b/sc/source/ui/Accessibility/AccessibleTableBase.cxx index b598dba0953a..e9c22a9d8e0e 100644 --- a/sc/source/ui/Accessibility/AccessibleTableBase.cxx +++ b/sc/source/ui/Accessibility/AccessibleTableBase.cxx @@ -343,8 +343,7 @@ uno::Reference< XAccessible > SAL_CALL OUString SAL_CALL ScAccessibleTableBase::createAccessibleDescription() { - OUString sDesc(STR_ACC_TABLE_DESCR); - return sDesc; + return OUString(STR_ACC_TABLE_DESCR); } OUString SAL_CALL ScAccessibleTableBase::createAccessibleName() @@ -398,8 +397,7 @@ void SAL_CALL ScAccessibleTableBase::selectAllAccessibleChildren() sal_Int32 SAL_CALL ScAccessibleTableBase::getSelectedAccessibleChildCount( ) { - sal_Int32 nResult(0); - return nResult; + return 0; } uno::Reference<XAccessible > SAL_CALL diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index dfbd1c43bbb3..a8982a130c75 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -1086,7 +1086,7 @@ void ScInputHandler::ShowTip( const OUString& rText ) aPos = pTipVisibleParent->OutputToScreenPixel( aPos ); tools::Rectangle aRect( aPos, aPos ); - QuickHelpFlags nAlign = QuickHelpFlags::Left|QuickHelpFlags::Bottom; + QuickHelpFlags const nAlign = QuickHelpFlags::Left|QuickHelpFlags::Bottom; nTipVisible = Help::ShowPopover(pTipVisibleParent, aRect, rText, nAlign); pTipVisibleParent->AddEventListener( LINK( this, ScInputHandler, ShowHideTipVisibleParentListener ) ); } @@ -1110,7 +1110,7 @@ void ScInputHandler::ShowTipBelow( const OUString& rText ) } aPos = pTipVisibleSecParent->OutputToScreenPixel( aPos ); tools::Rectangle aRect( aPos, aPos ); - QuickHelpFlags nAlign = QuickHelpFlags::Left | QuickHelpFlags::Top | QuickHelpFlags::NoEvadePointer; + QuickHelpFlags const nAlign = QuickHelpFlags::Left | QuickHelpFlags::Top | QuickHelpFlags::NoEvadePointer; nTipVisibleSec = Help::ShowPopover(pTipVisibleSecParent, aRect, rText, nAlign); pTipVisibleSecParent->AddEventListener( LINK( this, ScInputHandler, ShowHideTipVisibleSecParentListener ) ); } diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx index 70957b3aa601..96f0fb41da9f 100644 --- a/sc/source/ui/app/inputwin.cxx +++ b/sc/source/ui/app/inputwin.cxx @@ -2050,7 +2050,7 @@ void ScPosWnd::Modify() tools::Rectangle aRect( aPos, aPos ); OUString aText = ScGlobal::GetRscString( nStrId ); - QuickHelpFlags nAlign = QuickHelpFlags::Left|QuickHelpFlags::Bottom; + QuickHelpFlags const nAlign = QuickHelpFlags::Left|QuickHelpFlags::Bottom; nTipVisible = Help::ShowPopover(pWin, aRect, aText, nAlign); } } diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx index db43a50e0268..513c23e06381 100644 --- a/sc/source/ui/app/scmod.cxx +++ b/sc/source/ui/app/scmod.cxx @@ -379,16 +379,10 @@ void ScModule::Execute( SfxRequest& rReq ) switch ( nSlot ) { case SID_CHOOSE_DESIGN: - { - OUString aMacroName("Template.Samples.ShowStyles"); - SfxApplication::CallAppBasic( aMacroName ); - } + SfxApplication::CallAppBasic( "Template.Samples.ShowStyles" ); break; case SID_EURO_CONVERTER: - { - OUString aMacroName("Euro.ConvertRun.Main"); - SfxApplication::CallAppBasic( aMacroName ); - } + SfxApplication::CallAppBasic( "Euro.ConvertRun.Main" ); break; case SID_AUTOSPELL_CHECK: { diff --git a/sc/source/ui/cctrl/checklistmenu.cxx b/sc/source/ui/cctrl/checklistmenu.cxx index d4ff05e72f6c..0a42c36d2c45 100644 --- a/sc/source/ui/cctrl/checklistmenu.cxx +++ b/sc/source/ui/cctrl/checklistmenu.cxx @@ -361,7 +361,7 @@ void ScMenuFloatingWindow::drawMenuItem(vcl::RenderContext& rRenderContext, size getMenuItemPosSize(nPos, aPos, aSize); DecorationView aDecoView(&rRenderContext); - long nXOffset = 5; + long const nXOffset = 5; long nYOffset = (aSize.Height() - maLabelFont.GetFontHeight())/2; rRenderContext. DrawCtrlText(Point(aPos.X()+nXOffset, aPos.Y() + nYOffset), maMenuItems[nPos].maText, 0, maMenuItems[nPos].maText.getLength(), diff --git a/sc/source/ui/condformat/condformatdlgentry.cxx b/sc/source/ui/condformat/condformatdlgentry.cxx index c47b7dc74643..44fa974ee649 100644 --- a/sc/source/ui/condformat/condformatdlgentry.cxx +++ b/sc/source/ui/condformat/condformatdlgentry.cxx @@ -607,13 +607,12 @@ IMPL_LINK_NOARG(ScFormulaFrmtEntry, StyleSelectHdl, ListBox&, void) ScFormatEntry* ScFormulaFrmtEntry::createFormulaEntry() const { - ScConditionMode eMode = SC_COND_DIRECT; OUString aFormula = maEdFormula->GetText(); if(aFormula.isEmpty()) return nullptr; OUString aExpr2; - ScFormatEntry* pEntry = new ScCondFormatEntry(eMode, aFormula, aExpr2, mpDoc, maPos, maLbStyle->GetSelectEntry()); + ScFormatEntry* pEntry = new ScCondFormatEntry(SC_COND_DIRECT, aFormula, aExpr2, mpDoc, maPos, maLbStyle->GetSelectEntry()); return pEntry; } diff --git a/sc/source/ui/dbgui/PivotLayoutDialog.cxx b/sc/source/ui/dbgui/PivotLayoutDialog.cxx index 95cd569d12a8..59dc0e18723d 100644 --- a/sc/source/ui/dbgui/PivotLayoutDialog.cxx +++ b/sc/source/ui/dbgui/PivotLayoutDialog.cxx @@ -505,7 +505,7 @@ void ScPivotLayoutDialog::ApplyChanges() SfxDispatcher* pDispatcher = GetBindings().GetDispatcher(); - SfxCallMode nCallMode = SfxCallMode::SLOT | SfxCallMode::RECORD; + SfxCallMode const nCallMode = SfxCallMode::SLOT | SfxCallMode::RECORD; const SfxPoolItem* pResult = pDispatcher->ExecuteList(SID_PIVOT_TABLE, nCallMode, { &aPivotItem }); diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index 63adda37a3f8..77049df85c8f 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -3497,11 +3497,9 @@ bool ScDocFunc::SetWidthOrHeight( return false; } - bool bSuccess = false; SCCOLROW nStart = rRanges[0].mnStart; SCCOLROW nEnd = rRanges[0].mnEnd; - bool bFormula = false; if ( eMode == SC_SIZE_OPTIMAL ) { //! Option "Show formulas" - but where to get them from? @@ -3598,7 +3596,7 @@ bool ScDocFunc::SetWidthOrHeight( if ( eMode==SC_SIZE_OPTIMAL || eMode==SC_SIZE_VISOPT ) nThisSize = nSizeTwips + - lcl_GetOptimalColWidth( rDocShell, nCol, nTab, bFormula ); + lcl_GetOptimalColWidth( rDocShell, nCol, nTab, false/*bFormula*/ ); if ( nThisSize ) rDoc.SetColWidth( nCol, nTab, nThisSize ); @@ -3642,7 +3640,7 @@ bool ScDocFunc::SetWidthOrHeight( rDocShell.PostPaint(0,0,nTab,MAXCOL,MAXROW,nTab,PaintPartFlags::All); aModificator.SetDocumentModified(); - return bSuccess; + return false; } bool ScDocFunc::InsertPageBreak( bool bColumn, const ScAddress& rPos, @@ -4044,7 +4042,6 @@ bool ScDocFunc::AutoFormat( const ScRange& rRange, const ScMarkData* pTabMark, { ScDocShellModificator aModificator( rDocShell ); - bool bSuccess = false; ScDocument& rDoc = rDocShell.GetDocument(); SCCOL nStartCol = rRange.aStart.Col(); SCROW nStartRow = rRange.aStart.Row(); @@ -4141,7 +4138,7 @@ bool ScDocFunc::AutoFormat( const ScRange& rRange, const ScMarkData* pTabMark, else if (!bApi) rDocShell.ErrorMessage(aTester.GetMessageId()); - return bSuccess; + return false; } bool ScDocFunc::EnterMatrix( const ScRange& rRange, const ScMarkData* pTabMark, @@ -4614,9 +4611,7 @@ bool ScDocFunc::FillSeries( const ScRange& rRange, const ScMarkData* pTabMark, bool ScDocFunc::FillAuto( ScRange& rRange, const ScMarkData* pTabMark, FillDir eDir, sal_uLong nCount, bool bApi ) { - double fStep = 1.0; - double fMax = MAXDOUBLE; - return FillAuto( rRange, pTabMark, eDir, FILL_AUTO, FILL_DAY, nCount, fStep, fMax, true/*bRecord*/, bApi ); ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits