From ac2d415a52f22caf0012b7d9b17d015aca27db9d Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Sun, 25 Jun 2017 18:40:44 +0200 Subject: loplugin:oncevar in sc Change-Id: Ice59e286debb6bd0eb692f2b2b0c2c5087c069c0 Reviewed-on: https://gerrit.libreoffice.org/39239 Reviewed-by: Noel Grandin Tested-by: Noel Grandin --- 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 +- .../Accessibility/AccessiblePreviewHeaderCell.cxx | 3 +- .../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(-) 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 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(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 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 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>& 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( fHorMaxAngle / fHorStepAngle ); + int const nHorMaxIter = static_cast( 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(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(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& xSource ) { - sheet::DataPilotFieldOrientation eOrient = sheet::DataPilotFieldOrientation_HIDDEN; - uno::Reference xDimsName = xSource->getDimensions(); uno::Reference xIntDims = new ScNameToIndexAccess( xDimsName ); long nIntCount = xIntDims->getCount(); @@ -1102,7 +1100,7 @@ static void lcl_ResetOrient( const uno::Reference& x uno::Reference 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(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 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; nPosSetString( 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 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 aRowBreaks; rDoc.GetAllRowBreaks(aRowBreaks, nScTab, false, true); - SCROW nMaxRow = numeric_limits::max(); + SCROW const nMaxRow = numeric_limits::max(); for (set::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(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>= 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(xEventContext.get()); uno::Sequence 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 pData(ConvertToDBData(aName)); + ::std::unique_ptr 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 pData(ConvertToDBData(aName)); + ::std::unique_ptr 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 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& x //! pass xCellRanges instead uno::Reference 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& 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& 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 aAddresses(xCellRanges->getRangeAddresses()); table::CellRangeAddress* pAddresses(aAddresses.getArray()); @@ -2162,8 +2158,6 @@ void ScXMLExport::AddStyleFromCells(const uno::Reference& x void ScXMLExport::AddStyleFromColumn(const uno::Reference& xColumnProperties, const OUString* pOldName, sal_Int32& rIndex, bool& rIsVisible) { - OUString SC_SCOLUMNPREFIX(XML_STYLE_FAMILY_TABLE_COLUMN_STYLES_PREFIX); - std::vector aPropStates(xColumnStylesExportPropertySetMapper->Filter(xColumnProperties)); if(!aPropStates.empty()) { @@ -2199,7 +2193,7 @@ void ScXMLExport::AddStyleFromColumn(const uno::Reference& 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& void ScXMLExport::AddStyleFromRow(const uno::Reference& xRowProperties, const OUString* pOldName, sal_Int32& rIndex) { - OUString SC_SROWPREFIX(XML_STYLE_FAMILY_TABLE_ROW_STYLES_PREFIX); - std::vector aPropStates(xRowStylesExportPropertySetMapper->Filter(xRowProperties)); if(!aPropStates.empty()) { @@ -2232,7 +2224,7 @@ void ScXMLExport::AddStyleFromRow(const uno::Reference& 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 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 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::ReferencesetPropertyValue( sPropName, uno::makeAny( sStream ) ); + xInfoSet->setPropertyValue( "StreamName", uno::makeAny( sStream ) ); } ErrCode nReturn = ERRCODE_NONE; @@ -628,10 +627,9 @@ bool ScXMLImportWrapper::ExportToComponent(const uno::ReferencesetPropertyValue("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::ReferencesetPropertyValue( 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_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 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 ); + return FillAuto( rRange, pTabMark, eDir, FILL_AUTO, FILL_DAY, nCount, 1.0/*fStep*/, MAXDOUBLE/*fMax*/, true/*bRecord*/, bApi ); } bool ScDocFunc::FillAuto( ScRange& rRange, const ScMarkData* pTabMark, FillDir eDir, FillCmd eCmd, FillDateCmd eDateCmd, sal_uLong nCount, double fStep, double fMax, bool bRecord, bool bApi ) diff --git a/sc/source/ui/docshell/docsh8.cxx b/sc/source/ui/docshell/docsh8.cxx index 170c94213a66..b21e6426e99b 100644 --- a/sc/source/ui/docshell/docsh8.cxx +++ b/sc/source/ui/docshell/docsh8.cxx @@ -326,11 +326,9 @@ ErrCode ScDocShell::DBaseImport( const OUString& rFullFileName, rtl_TextEncoding OSL_ENSURE( xRowProp.is(), "can't get RowSet" ); if (!xRowProp.is()) return SCERR_IMPORT_CONNECT; - sal_Int32 nType = sdb::CommandType::TABLE; - xRowProp->setPropertyValue( SC_DBPROP_ACTIVECONNECTION, uno::Any(xConnection) ); - xRowProp->setPropertyValue( SC_DBPROP_COMMANDTYPE, uno::Any(nType) ); + xRowProp->setPropertyValue( SC_DBPROP_COMMANDTYPE, uno::Any(sdb::CommandType::TABLE) ); xRowProp->setPropertyValue( SC_DBPROP_COMMAND, uno::Any(aTabName) ); diff --git a/sc/source/ui/docshell/impex.cxx b/sc/source/ui/docshell/impex.cxx index 731f1a662c48..3312096dfc0a 100644 --- a/sc/source/ui/docshell/impex.cxx +++ b/sc/source/ui/docshell/impex.cxx @@ -448,7 +448,7 @@ bool ScImportExport::ExportStream( SvStream& rStrm, const OUString& rBaseURL, So // extra bits are used to tell the client to prefer external // reference link. - OUString aExtraBits("calc:extref"); + OUString const aExtraBits("calc:extref"); WriteUnicodeOrByteString( rStrm, aAppName, true ); WriteUnicodeOrByteString( rStrm, aDocName, true ); @@ -1708,8 +1708,8 @@ bool ScImportExport::Sylk2Doc( SvStream& rStrm ) SylkVersion eVersion = SylkVersion::OTHER; // US-English separators for StringToDouble - sal_Unicode cDecSep = '.'; - sal_Unicode cGrpSep = ','; + sal_Unicode const cDecSep = '.'; + sal_Unicode const cGrpSep = ','; SCCOL nStartCol = aRange.aStart.Col(); SCROW nStartRow = aRange.aStart.Row(); @@ -2161,7 +2161,7 @@ bool ScImportExport::RTF2Doc( SvStream& rStrm, const OUString& rBaseURL ) bool bOk = StartPaste(); if (bOk) { - InsertDeleteFlags nFlags = InsertDeleteFlags::ALL & ~InsertDeleteFlags::STYLES; + InsertDeleteFlags const nFlags = InsertDeleteFlags::ALL & ~InsertDeleteFlags::STYLES; pDoc->DeleteAreaTab( aRange, nFlags ); pImp->WriteToDocument(); EndPaste(); @@ -2186,7 +2186,7 @@ bool ScImportExport::HTML2Doc( SvStream& rStrm, const OUString& rBaseURL ) if (pDocSh) pDocSh->MakeDrawLayer(); - InsertDeleteFlags nFlags = InsertDeleteFlags::ALL & ~InsertDeleteFlags::STYLES; + InsertDeleteFlags const nFlags = InsertDeleteFlags::ALL & ~InsertDeleteFlags::STYLES; pDoc->DeleteAreaTab( aRange, nFlags ); if (pExtOptions) diff --git a/sc/source/ui/drawfunc/drawsh5.cxx b/sc/source/ui/drawfunc/drawsh5.cxx index 2bd0815df733..f9ab423910d0 100644 --- a/sc/source/ui/drawfunc/drawsh5.cxx +++ b/sc/source/ui/drawfunc/drawsh5.cxx @@ -203,8 +203,7 @@ void ScDrawShell::ExecuteHLink( SfxRequest& rReq ) if ( xInfo->hasPropertyByName( sPropButtonType ) ) { - form::FormButtonType eButtonType = form::FormButtonType_URL; - xPropSet->setPropertyValue( sPropButtonType, uno::Any(eButtonType) ); + xPropSet->setPropertyValue( sPropButtonType, uno::Any(form::FormButtonType_URL) ); } //! Undo ??? @@ -657,8 +656,7 @@ void ScDrawShell::ExecFormatPaintbrush( SfxRequest& rReq ) ScDrawView* pDrawView = pViewData->GetScDrawView(); if ( pDrawView && pDrawView->AreObjectsMarked() ) { - bool bOnlyHardAttr = true; - SfxItemSet* pItemSet = new SfxItemSet( pDrawView->GetAttrFromMarked(bOnlyHardAttr) ); + SfxItemSet* pItemSet = new SfxItemSet( pDrawView->GetAttrFromMarked(true/*bOnlyHardAttr*/) ); pView->SetDrawBrushSet( pItemSet, bLock ); } } diff --git a/sc/source/ui/drawfunc/fuins2.cxx b/sc/source/ui/drawfunc/fuins2.cxx index 7411085b54e7..025934679a6c 100644 --- a/sc/source/ui/drawfunc/fuins2.cxx +++ b/sc/source/ui/drawfunc/fuins2.cxx @@ -572,10 +572,9 @@ FuInsertChart::FuInsertChart(ScTabViewShell* pViewSh, vcl::Window* pWin, ScDrawV { if (bUndo) { - bool bAppend = true; pScDocSh->GetUndoManager()->AddUndoAction( new ScUndoInsertTab( pScDocSh, nNewTab, - bAppend, aTabName ) ); + true/*bAppend*/, aTabName ) ); } pScDocSh->Broadcast( ScTablesHint( SC_TAB_INSERTED, nNewTab ) ); diff --git a/sc/source/ui/drawfunc/futext.cxx b/sc/source/ui/drawfunc/futext.cxx index 3062294a8292..892e4a29ee4b 100644 --- a/sc/source/ui/drawfunc/futext.cxx +++ b/sc/source/ui/drawfunc/futext.cxx @@ -341,7 +341,6 @@ bool FuText::MouseButtonDown(const MouseEvent& rMEvt) bool FuText::MouseMove(const MouseEvent& rMEvt) { - bool bReturn = false; pViewShell->SetActivePointer(pView->GetPreferredPointer( pWindow->PixelToLogic(rMEvt.GetPosPixel()), pWindow )); @@ -371,7 +370,7 @@ bool FuText::MouseMove(const MouseEvent& rMEvt) pView->MovAction(aPnt); } - return bReturn; + return false; } bool FuText::MouseButtonUp(const MouseEvent& rMEvt) @@ -379,8 +378,6 @@ bool FuText::MouseButtonUp(const MouseEvent& rMEvt) // remember button state for creation of own MouseEvents SetMouseButtonCode(rMEvt.GetButtons()); - bool bReturn = false; - if (aDragTimer.IsActive() ) { aDragTimer.Stop(); @@ -487,7 +484,7 @@ bool FuText::MouseButtonUp(const MouseEvent& rMEvt) } } - return bReturn; + return false; } // switch mouse-pointer @@ -528,9 +525,8 @@ void FuText::Activate() // if (!pTextObj) { // no text object in EditMode, therefore set CreateMode - sal_uInt16 nObj = OBJ_TEXT; - pView->SetCurrentObj(nObj); + pView->SetCurrentObj(OBJ_TEXT); pView->SetCreateMode(); } diff --git a/sc/source/ui/formdlg/dwfunctr.cxx b/sc/source/ui/formdlg/dwfunctr.cxx index e690b1568a07..00cf7c2db5b3 100644 --- a/sc/source/ui/formdlg/dwfunctr.cxx +++ b/sc/source/ui/formdlg/dwfunctr.cxx @@ -317,7 +317,6 @@ void ScFunctionWin::DoEnter() aArgStr = aFirstArgStr; if ( nArgs != VAR_ARGS && nArgs != PAIRED_VAR_ARGS ) { // no VarArgs or Fix plus VarArgs, but not VarArgs only - OUString aArgSep("; "); sal_uInt16 nFix; if (nArgs >= PAIRED_VAR_ARGS) nFix = nArgs - PAIRED_VAR_ARGS + 2; @@ -328,7 +327,7 @@ void ScFunctionWin::DoEnter() for ( sal_uInt16 nArg = 1; nArg < nFix && !pDesc->pDefArgFlags[nArg].bOptional; nArg++ ) { - aArgStr += aArgSep; + aArgStr += "; "; OUString sTmp = pDesc->maDefArgNames[nArg]; sTmp = comphelper::string::strip(sTmp, ' '); sTmp = sTmp.replaceAll(" ", "_"); diff --git a/sc/source/ui/miscdlgs/tabbgcolordlg.cxx b/sc/source/ui/miscdlgs/tabbgcolordlg.cxx index 71e2896c9e0d..4cde7ff415ca 100644 --- a/sc/source/ui/miscdlgs/tabbgcolordlg.cxx +++ b/sc/source/ui/miscdlgs/tabbgcolordlg.cxx @@ -78,8 +78,6 @@ void ScTabBgColorDlg::FillColorValueSets_Impl() const SfxPoolItem* pItem = nullptr; XColorListRef pColorList; - sal_uInt16 nSelectedItem = 0; - OSL_ENSURE( pDocSh, "DocShell not found!" ); if ( pDocSh && ( nullptr != ( pItem = pDocSh->GetItem(SID_COLOR_TABLE) ) ) ) @@ -110,7 +108,7 @@ void ScTabBgColorDlg::FillColorValueSets_Impl() m_pTabBgColorSet->set_width_request(aSize.Width()+8); m_pTabBgColorSet->set_height_request(aSize.Height()+8); - m_pTabBgColorSet->SelectItem(nSelectedItem); + m_pTabBgColorSet->SelectItem(0); } /// Handler, called when color selection is changed diff --git a/sc/source/ui/miscdlgs/textdlgs.cxx b/sc/source/ui/miscdlgs/textdlgs.cxx index 2f27de79ca8f..578681598940 100644 --- a/sc/source/ui/miscdlgs/textdlgs.cxx +++ b/sc/source/ui/miscdlgs/textdlgs.cxx @@ -82,8 +82,8 @@ void ScParagraphDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) if (nId == m_nTabPageId) { SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool())); - TabulatorDisableFlags nFlags((TabulatorDisableFlags::TypeMask &~TabulatorDisableFlags::TypeLeft) | - (TabulatorDisableFlags::FillMask &~TabulatorDisableFlags::FillNone)); + TabulatorDisableFlags const nFlags((TabulatorDisableFlags::TypeMask &~TabulatorDisableFlags::TypeLeft) | + (TabulatorDisableFlags::FillMask &~TabulatorDisableFlags::FillNone)); aSet.Put(SfxUInt16Item(SID_SVXTABULATORTABPAGE_DISABLEFLAGS, (sal_uInt16)nFlags)); rPage.PageCreated(aSet); } diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx index ec66b99e073b..a1dc66de7c38 100644 --- a/sc/source/ui/navipi/content.cxx +++ b/sc/source/ui/navipi/content.cxx @@ -1476,7 +1476,6 @@ bool ScContentTree::LoadFile( const OUString& rUrl ) if ( nPos != -1 ) aDocName = aDocName.copy(0, nPos); // only the name without #... - bool bReturn = false; OUString aURL = aDocName; OUString aFilter, aOptions; ScDocumentLoader aLoader( aURL, aFilter, aOptions ); @@ -1496,7 +1495,7 @@ bool ScContentTree::LoadFile( const OUString& rUrl ) // document is closed again by ScDocumentLoader in dtor - return bReturn; + return false; } void ScContentTree::InitWindowBits( bool bButtons ) diff --git a/sc/source/ui/undo/undoblk.cxx b/sc/source/ui/undo/undoblk.cxx index 5afa28553b49..53d6212aeb88 100644 --- a/sc/source/ui/undo/undoblk.cxx +++ b/sc/source/ui/undo/undoblk.cxx @@ -1362,7 +1362,7 @@ void ScUndoDragDrop::Redo() EnableDrawAdjust( &rDoc, false ); //! include in ScBlockUndo? // do not undo/redo objects and note captions, they are handled via drawing undo - InsertDeleteFlags nRedoFlags = (InsertDeleteFlags::ALL & ~InsertDeleteFlags::OBJECTS) | InsertDeleteFlags::NOCAPTIONS; + InsertDeleteFlags const nRedoFlags = (InsertDeleteFlags::ALL & ~InsertDeleteFlags::OBJECTS) | InsertDeleteFlags::NOCAPTIONS; /* TODO: Redoing note captions is quite tricky due to the fact that a helper clip document is used. While (re-)pasting the contents to the diff --git a/sc/source/ui/undo/undoblk3.cxx b/sc/source/ui/undo/undoblk3.cxx index 35452714d868..3aa7e90eb509 100644 --- a/sc/source/ui/undo/undoblk3.cxx +++ b/sc/source/ui/undo/undoblk3.cxx @@ -861,8 +861,6 @@ void ScUndoAutoFormat::Redo() nPPTY = ScGlobal::nScreenPPTY; } - bool bFormula = false; // remember - sc::RowHeightContext aCxt(nPPTX, nPPTY, aZoomX, aZoomY, pVirtDev); for (SCTAB nTab=nStartZ; nTab<=nEndZ; nTab++) { @@ -886,7 +884,7 @@ void ScUndoAutoFormat::Redo() if (!rDoc.ColHidden(nCol, nTab)) { sal_uInt16 nThisSize = STD_EXTRA_WIDTH + rDoc.GetOptimalColWidth( nCol, nTab, - pVirtDev, nPPTX, nPPTY, aZoomX, aZoomY, bFormula, + pVirtDev, nPPTX, nPPTY, aZoomX, aZoomY, false/*bFormula*/, &aDestMark ); rDoc.SetColWidth( nCol, nTab, nThisSize ); rDoc.ShowCol( nCol, nTab, true ); diff --git a/sc/source/ui/undo/undocell.cxx b/sc/source/ui/undo/undocell.cxx index 193420cb3fa7..df07b286bd04 100644 --- a/sc/source/ui/undo/undocell.cxx +++ b/sc/source/ui/undo/undocell.cxx @@ -95,9 +95,7 @@ ScUndoCursorAttr::~ScUndoCursorAttr() OUString ScUndoCursorAttr::GetComment() const { //! own text for automatic attribution - - sal_uInt16 nId = STR_UNDO_CURSORATTR; // "Attribute" - return ScGlobal::GetRscString( nId ); + return ScGlobal::GetRscString( STR_UNDO_CURSORATTR ); // "Attribute" } void ScUndoCursorAttr::SetEditData( EditTextObject* pOld, EditTextObject* pNew ) diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index d741224fe558..467cb4b7418b 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -7514,8 +7514,7 @@ void SAL_CALL ScTableSheetObj::link( const OUString& aUrl, const OUString& aShee else if ( nMode == sheet::SheetLinkMode_VALUE ) nLinkMode = ScLinkMode::VALUE; - sal_uLong nRefresh = 0; - rDoc.SetLink( nTab, nLinkMode, aFileString, aFilterString, aOptString, aSheetName, nRefresh ); + rDoc.SetLink( nTab, nLinkMode, aFileString, aFilterString, aOptString, aSheetName, 0/*nRefresh*/ ); pDocSh->UpdateLinks(); // if needed add or delete link SfxBindings* pBindings = pDocSh->GetViewBindings(); diff --git a/sc/source/ui/unoobj/chart2uno.cxx b/sc/source/ui/unoobj/chart2uno.cxx index 41ee1ee8a01c..b2fcb297cf84 100644 --- a/sc/source/ui/unoobj/chart2uno.cxx +++ b/sc/source/ui/unoobj/chart2uno.cxx @@ -1968,7 +1968,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL ScChart2DataProvider::detectArgum uno::makeAny( sRangeRep ), beans::PropertyState_DIRECT_VALUE )); //Sequence Mapping - bool bSequencesReordered = true;//todo detect this above or detect this sequence mapping cheaper ... + bool const bSequencesReordered = true;//todo detect this above or detect this sequence mapping cheaper ... if( bSequencesReordered && bRowSourceDetected ) { bool bDifferentIndexes = false; diff --git a/sc/source/ui/unoobj/dapiuno.cxx b/sc/source/ui/unoobj/dapiuno.cxx index 6a18af374367..859fc221cc19 100644 --- a/sc/source/ui/unoobj/dapiuno.cxx +++ b/sc/source/ui/unoobj/dapiuno.cxx @@ -2653,8 +2653,7 @@ Reference< XDataPilotField > SAL_CALL ScDataPilotFieldObj::createNameGroup( cons { ScDPSaveDimension* pOldDimension = aSaveData.GetDimensionByName( aDimName ); pSaveDimension->SetOrientation( pOldDimension->GetOrientation() ); - long nPosition = 0; //! before (immediate) base - aSaveData.SetPosition( pSaveDimension, nPosition ); + aSaveData.SetPosition( pSaveDimension, 0 ); //! before (immediate) base } // apply changes diff --git a/sc/source/ui/unoobj/datauno.cxx b/sc/source/ui/unoobj/datauno.cxx index 042200424777..30039fd76fed 100644 --- a/sc/source/ui/unoobj/datauno.cxx +++ b/sc/source/ui/unoobj/datauno.cxx @@ -2348,10 +2348,9 @@ void ScUnnamedDatabaseRangesObj::setByTable( const table::CellRangeAddress& aRan throw lang::IndexOutOfBoundsException(); ScDBDocFunc aFunc(*pDocShell); - OUString aString(STR_DB_LOCAL_NONAME); ScRange aUnnamedRange( (SCCOL)aRange.StartColumn, (SCROW)aRange.StartRow, aRange.Sheet, (SCCOL)aRange.EndColumn, (SCROW)aRange.EndRow, aRange.Sheet ); - bDone = aFunc.AddDBRange( aString, aUnnamedRange ); + bDone = aFunc.AddDBRange( STR_DB_LOCAL_NONAME, aUnnamedRange ); } if (!bDone) throw uno::RuntimeException(); // no other exceptions specified diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 2c55292e40a9..a6e3f8769a39 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -1641,7 +1641,7 @@ uno::Sequence SAL_CALL ScModelObj::getRenderer( sal_Int32 { // getRenderer(0) is used to query the settings, so it must always return something - SCTAB nCurTab = 0; //! use current sheet from view? + SCTAB const nCurTab = 0; //! use current sheet from view? ScPrintFunc aDefaultFunc( pDocShell, pDocShell->GetPrinter(), nCurTab ); Size aTwips = aDefaultFunc.GetPageSize(); awt::Size aPageSize( TwipsToHMM( aTwips.Width() ), TwipsToHMM( aTwips.Height() ) ); @@ -1797,8 +1797,8 @@ void SAL_CALL ScModelObj::render( sal_Int32 nSelRenderer, const uno::Any& aSelec sal_Int32 nDestID = pPDFData->CreateDest( aArea ); OUString aTabName; rDoc.GetName( nTab, aTabName ); - sal_Int32 nParent = -1; // top-level - pPDFData->CreateOutlineItem( nParent, aTabName, nDestID ); + // top-level + pPDFData->CreateOutlineItem( -1/*nParent*/, aTabName, nDestID ); } // #i56629# add the named destination stuff if( pPDFData && pPDFData->GetIsExportNamedDestinations() ) @@ -3419,10 +3419,8 @@ sal_Int32 ScTableSheetsObj::importSheet( throw lang::IndexOutOfBoundsException(); // Transfer Tab - bool bInsertNew = true; - bool bNotifyAndPaint = true; pDocShell->TransferTab( - *pDocShellSrc, nIndexSrc, nIndexDest, bInsertNew, bNotifyAndPaint ); + *pDocShellSrc, nIndexSrc, nIndexDest, true/*bInsertNew*/, true/*bNotifyAndPaint*/ ); return nIndexDest; } @@ -4322,8 +4320,8 @@ void SAL_CALL ScScenariosObj::addNewByName( const OUString& aName, } Color aColor( COL_LIGHTGRAY ); // Default - ScScenarioFlags nFlags = ScScenarioFlags::ShowFrame | ScScenarioFlags::PrintFrame - | ScScenarioFlags::TwoWay | ScScenarioFlags::Protected; + ScScenarioFlags const nFlags = ScScenarioFlags::ShowFrame | ScScenarioFlags::PrintFrame + | ScScenarioFlags::TwoWay | ScScenarioFlags::Protected; pDocShell->MakeScenario( nTab, aName, aComment, aColor, nFlags, aMarkData ); } diff --git a/sc/source/ui/unoobj/filtuno.cxx b/sc/source/ui/unoobj/filtuno.cxx index f31eba2295bf..c0cc98782879 100644 --- a/sc/source/ui/unoobj/filtuno.cxx +++ b/sc/source/ui/unoobj/filtuno.cxx @@ -207,11 +207,10 @@ sal_Int16 SAL_CALL ScFilterOptionsObj::execute() } else { - bool bMultiByte = true; bool bDBEnc = false; bool bAscii = false; - sal_Unicode cStrDel = '"'; + sal_Unicode const cStrDel = '"'; sal_Unicode cAsciiDel = ';'; rtl_TextEncoding eEncoding = RTL_TEXTENCODING_DONTKNOW; @@ -273,7 +272,7 @@ sal_Int16 SAL_CALL ScFilterOptionsObj::execute() ScImportOptions aOptions( cAsciiDel, cStrDel, eEncoding); ScopedVclPtr pDlg(pFact->CreateScImportOptionsDlg( - bAscii, &aOptions, &aTitle, bMultiByte, bDBEnc, + bAscii, &aOptions, &aTitle, true/*bMultiByte*/, bDBEnc, !bExport)); OSL_ENSURE(pDlg, "Dialog create fail!"); if ( pDlg->Execute() == RET_OK ) diff --git a/sc/source/ui/unoobj/tokenuno.cxx b/sc/source/ui/unoobj/tokenuno.cxx index fe072075925b..a9b4e220b4fe 100644 --- a/sc/source/ui/unoobj/tokenuno.cxx +++ b/sc/source/ui/unoobj/tokenuno.cxx @@ -357,8 +357,6 @@ bool ScTokenConversion::ConvertToTokenArray( ScDocument& rDoc, bool ScTokenConversion::ConvertToTokenSequence( const ScDocument& rDoc, uno::Sequence& rSequence, const ScTokenArray& rTokenArray ) { - bool bError = false; - sal_Int32 nLen = static_cast(rTokenArray.GetLen()); formula::FormulaToken** pTokens = rTokenArray.GetArray(); if ( pTokens ) @@ -477,7 +475,7 @@ bool ScTokenConversion::ConvertToTokenSequence( const ScDocument& rDoc, else rSequence.realloc(0); - return !bError; + return true; } ScFormulaOpCodeMapperObj::ScFormulaOpCodeMapperObj(::std::unique_ptr && _pCompiler) diff --git a/sc/source/ui/unoobj/viewuno.cxx b/sc/source/ui/unoobj/viewuno.cxx index b7b502aa9191..d76a9fcfb7cc 100644 --- a/sc/source/ui/unoobj/viewuno.cxx +++ b/sc/source/ui/unoobj/viewuno.cxx @@ -1613,10 +1613,10 @@ sal_Int32 SAL_CALL ScTabViewObj::getSplitRow() { long nSplit = rViewData.GetVSplitPos(); - ScSplitPos ePos = SC_SPLIT_TOPLEFT; // split vertically + // split vertically SCCOL nCol; SCROW nRow; - rViewData.GetPosFromPixel( 0, nSplit, ePos, nCol, nRow, false ); + rViewData.GetPosFromPixel( 0, nSplit, SC_SPLIT_TOPLEFT, nCol, nRow, false ); if ( nRow > 0 ) return nRow; } diff --git a/sc/source/ui/vba/excelvbahelper.cxx b/sc/source/ui/vba/excelvbahelper.cxx index 41f12cec6cfc..b0ecaeb83245 100644 --- a/sc/source/ui/vba/excelvbahelper.cxx +++ b/sc/source/ui/vba/excelvbahelper.cxx @@ -194,7 +194,6 @@ implnCut( const uno::Reference< frame::XModel>& xModel ) void implnPasteSpecial( const uno::Reference< frame::XModel>& xModel, InsertDeleteFlags nFlags, ScPasteFunc nFunction, bool bSkipEmpty, bool bTranspose) { PasteCellsWarningReseter resetWarningBox; - InsCellCmd eMoveMode = INS_NONE; ScTabViewShell* pTabViewShell = getBestViewShell( xModel ); if ( pTabViewShell ) @@ -209,7 +208,7 @@ void implnPasteSpecial( const uno::Reference< frame::XModel>& xModel, InsertDele pDoc = pOwnClip->GetDocument(); pTabViewShell->PasteFromClip( nFlags, pDoc, nFunction, bSkipEmpty, bTranspose, false, - eMoveMode, InsertDeleteFlags::NONE, true ); + INS_NONE, InsertDeleteFlags::NONE, true ); pTabViewShell->CellContentChanged(); } } diff --git a/sc/source/ui/vba/vbamenuitems.cxx b/sc/source/ui/vba/vbamenuitems.cxx index 76fb396352c9..8d12983e28d6 100644 --- a/sc/source/ui/vba/vbamenuitems.cxx +++ b/sc/source/ui/vba/vbamenuitems.cxx @@ -101,8 +101,9 @@ ScVbaMenuItems::Item( const uno::Any& aIndex, const uno::Any& /*aIndex2*/ ) uno::Reference< excel::XMenuItem > SAL_CALL ScVbaMenuItems::Add( const OUString& Caption, const css::uno::Any& OnAction, const css::uno::Any& /*ShortcutKey*/, const css::uno::Any& Before, const css::uno::Any& Restore, const css::uno::Any& /*StatusBar*/, const css::uno::Any& /*HelpFile*/, const css::uno::Any& /*HelpContextID*/ ) { - sal_Int32 nType = office::MsoControlType::msoControlButton; - uno::Reference< XCommandBarControl > xCommandBarControl = m_xCommandBarControls->Add( uno::makeAny( nType ), uno::Any(), uno::Any(), Before, Restore ); + uno::Reference< XCommandBarControl > xCommandBarControl = m_xCommandBarControls->Add( + uno::makeAny( office::MsoControlType::msoControlButton ), + uno::Any(), uno::Any(), Before, Restore ); xCommandBarControl->setCaption( Caption ); if( OnAction.hasValue() ) { diff --git a/sc/source/ui/vba/vbamenus.cxx b/sc/source/ui/vba/vbamenus.cxx index be32c02008d0..9c3f86ad904c 100644 --- a/sc/source/ui/vba/vbamenus.cxx +++ b/sc/source/ui/vba/vbamenus.cxx @@ -93,8 +93,9 @@ ScVbaMenus::Item( const uno::Any& aIndex, const uno::Any& /*aIndex2*/ ) uno::Reference< excel::XMenu > SAL_CALL ScVbaMenus::Add( const OUString& Caption, const css::uno::Any& Before, const css::uno::Any& Restore ) { - sal_Int32 nType = office::MsoControlType::msoControlPopup; - uno::Reference< XCommandBarControl > xCommandBarControl = m_xCommandBarControls->Add( uno::makeAny( nType ), uno::Any(), uno::Any(), Before, Restore ); + uno::Reference< XCommandBarControl > xCommandBarControl = m_xCommandBarControls->Add( + uno::makeAny( office::MsoControlType::msoControlPopup ), + uno::Any(), uno::Any(), Before, Restore ); xCommandBarControl->setCaption( Caption ); return uno::Reference< excel::XMenu >( new ScVbaMenu( this, mxContext, xCommandBarControl ) ); } diff --git a/sc/source/ui/vba/vbanames.cxx b/sc/source/ui/vba/vbanames.cxx index 9ff4af38f77d..7267aa615521 100644 --- a/sc/source/ui/vba/vbanames.cxx +++ b/sc/source/ui/vba/vbanames.cxx @@ -103,10 +103,8 @@ ScVbaNames::Add( const css::uno::Any& Name , { if ( ScRangeData::IsNameValid( sName , getScDocument() ) != ScRangeData::NAME_VALID ) { - OUString sResult ; - sal_Int32 nToken = 0; sal_Int32 nIndex = 0; - sResult = sName.getToken( nToken , '!' , nIndex ); + OUString sResult = sName.getToken( 0 , '!' , nIndex ); if ( -1 == nIndex ) sResult = sName; else @@ -200,7 +198,6 @@ ScVbaNames::Add( const css::uno::Any& Name , uno::Any aAny2; if ( mxNames.is() ) { - sal_Int32 nUnoType = 0; table::CellAddress aCellAddr( aAddr.Sheet , aAddr.StartColumn , aAddr.StartRow ); if ( mxNames->hasByName( sName ) ) mxNames->removeByName(sName); @@ -215,7 +212,7 @@ ScVbaNames::Add( const css::uno::Any& Name , sTmp += ","; sTmp = sTmp + "'" + xRange->getWorksheet()->getName() + "'." + sRangeAdd; } - mxNames->addNewByName( sName , sTmp , aCellAddr , nUnoType); + mxNames->addNewByName( sName, sTmp, aCellAddr, 0/*nUnoType*/); return Item( uno::makeAny( sName ), uno::Any() ); } } diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx index 49a0d263bb48..59769264ec1a 100644 --- a/sc/source/ui/vba/vbarange.cxx +++ b/sc/source/ui/vba/vbarange.cxx @@ -1266,7 +1266,7 @@ inline table::CellRangeAddress lclGetRangeAddress( const uno::Reference< RangeTy void lclClearRange( const uno::Reference< table::XCellRange >& rxCellRange ) { using namespace ::com::sun::star::sheet::CellFlags; - sal_Int32 nFlags = VALUE | DATETIME | STRING | ANNOTATION | FORMULA | HARDATTR | STYLES | EDITATTR | FORMATTED; + sal_Int32 const nFlags = VALUE | DATETIME | STRING | ANNOTATION | FORMULA | HARDATTR | STYLES | EDITATTR | FORMATTED; uno::Reference< sheet::XSheetOperation > xSheetOperation( rxCellRange, uno::UNO_QUERY_THROW ); xSheetOperation->clearContents( nFlags ); } @@ -1586,7 +1586,7 @@ void SAL_CALL ScVbaRange::Clear() { using namespace ::com::sun::star::sheet::CellFlags; - sal_Int32 nFlags = VALUE | DATETIME | STRING | FORMULA | HARDATTR | EDITATTR | FORMATTED; + sal_Int32 const nFlags = VALUE | DATETIME | STRING | FORMULA | HARDATTR | EDITATTR | FORMATTED; ClearContents( nFlags, true ); } @@ -1628,7 +1628,7 @@ void SAL_CALL ScVbaRange::ClearContents() { using namespace ::com::sun::star::sheet::CellFlags; - sal_Int32 nFlags = VALUE | DATETIME | STRING | FORMULA; + sal_Int32 const nFlags = VALUE | DATETIME | STRING | FORMULA; ClearContents( nFlags, true ); } @@ -1637,7 +1637,7 @@ ScVbaRange::ClearFormats() { // FIXME: need to check if we need to combine FORMATTED using namespace ::com::sun::star::sheet::CellFlags; - sal_Int32 nFlags = HARDATTR | FORMATTED | EDITATTR; + sal_Int32 const nFlags = HARDATTR | FORMATTED | EDITATTR; ClearContents( nFlags, false ); } @@ -2079,8 +2079,8 @@ ScVbaRange::Address( const uno::Any& RowAbsolute, const uno::Any& ColumnAbsolut RangeHelper thisRange( mxRange ); table::CellRangeAddress thisAddress = thisRange.getCellRangeAddressable()->getRangeAddress(); ScRange aRange( static_cast< SCCOL >( thisAddress.StartColumn ), static_cast< SCROW >( thisAddress.StartRow ), static_cast< SCTAB >( thisAddress.Sheet ), static_cast< SCCOL >( thisAddress.EndColumn ), static_cast< SCROW >( thisAddress.EndRow ), static_cast< SCTAB >( thisAddress.Sheet ) ); - ScRefFlags ROW_ABS = ( ScRefFlags::ROW_ABS | ScRefFlags::ROW2_ABS ); - ScRefFlags COL_ABS = ( ScRefFlags::COL_ABS | ScRefFlags::COL2_ABS ); + ScRefFlags const ROW_ABS = ( ScRefFlags::ROW_ABS | ScRefFlags::ROW2_ABS ); + ScRefFlags const COL_ABS = ( ScRefFlags::COL_ABS | ScRefFlags::COL2_ABS ); if ( RowAbsolute.hasValue() ) { @@ -5105,10 +5105,9 @@ ScVbaRange::AutoFill( const uno::Reference< excel::XRange >& Destination, const break; } } - double fEndValue = MAXDOUBLE; ScDocShell* pDocSh = getDocShellFromRange( mxRange ); pDocSh->GetDocFunc().FillAuto( aSourceRange, nullptr, eDir, eCmd, eDateCmd, - nCount, fStep, fEndValue, true, true ); + nCount, fStep, MAXDOUBLE/*fEndValue*/, true, true ); } sal_Bool SAL_CALL ScVbaRange::GoalSeek( const uno::Any& Goal, const uno::Reference< excel::XRange >& ChangingCell ) diff --git a/sc/source/ui/vba/vbasheetobject.cxx b/sc/source/ui/vba/vbasheetobject.cxx index c339062b2ce2..5d2a94019073 100644 --- a/sc/source/ui/vba/vbasheetobject.cxx +++ b/sc/source/ui/vba/vbasheetobject.cxx @@ -225,7 +225,7 @@ void SAL_CALL ScVbaSheetObjectBase::setName( const OUString& rName ) sal_Int32 SAL_CALL ScVbaSheetObjectBase::getPlacement() { - sal_Int32 nRet = excel::XlPlacement::xlMoveAndSize; + sal_Int32 const nRet = excel::XlPlacement::xlMoveAndSize; #if 0 // TODO: not working at the moment. SvxShape* pShape = SvxShape::getImplementation( mxShape ); if(pShape) diff --git a/sc/source/ui/vba/vbawindow.cxx b/sc/source/ui/vba/vbawindow.cxx index f0a7b7f4692a..5586c9347daa 100644 --- a/sc/source/ui/vba/vbawindow.cxx +++ b/sc/source/ui/vba/vbawindow.cxx @@ -485,97 +485,85 @@ ScVbaWindow::RangeSelection() sal_Bool SAL_CALL ScVbaWindow::getDisplayGridlines() { - OUString sName( SC_UNO_SHOWGRID ); bool bGrid = true; - getControllerProps()->getPropertyValue( sName ) >>= bGrid; + getControllerProps()->getPropertyValue( SC_UNO_SHOWGRID ) >>= bGrid; return bGrid; } void SAL_CALL ScVbaWindow::setDisplayGridlines( sal_Bool _displaygridlines ) { - OUString sName( SC_UNO_SHOWGRID ); - getControllerProps()->setPropertyValue( sName, uno::makeAny( _displaygridlines )); + getControllerProps()->setPropertyValue( SC_UNO_SHOWGRID, uno::makeAny( _displaygridlines )); } sal_Bool SAL_CALL ScVbaWindow::getDisplayHeadings() { - OUString sName( SC_UNO_COLROWHDR ); bool bHeading = true; - getControllerProps()->getPropertyValue( sName ) >>= bHeading; + getControllerProps()->getPropertyValue( SC_UNO_COLROWHDR ) >>= bHeading; return bHeading; } void SAL_CALL ScVbaWindow::setDisplayHeadings( sal_Bool _bDisplayHeadings ) { - OUString sName( SC_UNO_COLROWHDR ); - getControllerProps()->setPropertyValue( sName, uno::makeAny( _bDisplayHeadings )); + getControllerProps()->setPropertyValue( SC_UNO_COLROWHDR, uno::makeAny( _bDisplayHeadings )); } sal_Bool SAL_CALL ScVbaWindow::getDisplayHorizontalScrollBar() { - OUString sName( SC_UNO_HORSCROLL ); bool bHorizontalScrollBar = true; - getControllerProps()->getPropertyValue( sName ) >>= bHorizontalScrollBar; + getControllerProps()->getPropertyValue( SC_UNO_HORSCROLL ) >>= bHorizontalScrollBar; return bHorizontalScrollBar; } void SAL_CALL ScVbaWindow::setDisplayHorizontalScrollBar( sal_Bool _bDisplayHorizontalScrollBar ) { - OUString sName( SC_UNO_HORSCROLL ); - getControllerProps()->setPropertyValue( sName, uno::makeAny( _bDisplayHorizontalScrollBar )); + getControllerProps()->setPropertyValue( SC_UNO_HORSCROLL, uno::makeAny( _bDisplayHorizontalScrollBar )); } sal_Bool SAL_CALL ScVbaWindow::getDisplayOutline() { - OUString sName( SC_UNO_OUTLSYMB ); bool bOutline = true; - getControllerProps()->getPropertyValue( sName ) >>= bOutline; + getControllerProps()->getPropertyValue( SC_UNO_OUTLSYMB ) >>= bOutline; return bOutline; } void SAL_CALL ScVbaWindow::setDisplayOutline( sal_Bool _bDisplayOutline ) { - OUString sName( SC_UNO_OUTLSYMB ); - getControllerProps()->setPropertyValue( sName, uno::makeAny( _bDisplayOutline )); + getControllerProps()->setPropertyValue( SC_UNO_OUTLSYMB, uno::makeAny( _bDisplayOutline )); } sal_Bool SAL_CALL ScVbaWindow::getDisplayVerticalScrollBar() { - OUString sName( SC_UNO_VERTSCROLL ); bool bVerticalScrollBar = true; - getControllerProps()->getPropertyValue( sName ) >>= bVerticalScrollBar; + getControllerProps()->getPropertyValue( SC_UNO_VERTSCROLL ) >>= bVerticalScrollBar; return bVerticalScrollBar; } void SAL_CALL ScVbaWindow::setDisplayVerticalScrollBar( sal_Bool _bDisplayVerticalScrollBar ) { - OUString sName( SC_UNO_VERTSCROLL ); - getControllerProps()->setPropertyValue( sName, uno::makeAny( _bDisplayVerticalScrollBar )); + getControllerProps()->setPropertyValue( SC_UNO_VERTSCROLL, uno::makeAny( _bDisplayVerticalScrollBar )); } sal_Bool SAL_CALL ScVbaWindow::getDisplayWorkbookTabs() { - OUString sName( SC_UNO_SHEETTABS ); bool bWorkbookTabs = true; - getControllerProps()->getPropertyValue( sName ) >>= bWorkbookTabs; + getControllerProps()->getPropertyValue( SC_UNO_SHEETTABS ) >>= bWorkbookTabs; return bWorkbookTabs; } void SAL_CALL ScVbaWindow::setDisplayWorkbookTabs( sal_Bool _bDisplayWorkbookTabs ) { - OUString sName( SC_UNO_SHEETTABS ); - getControllerProps()->setPropertyValue( sName, uno::makeAny( _bDisplayWorkbookTabs )); + getControllerProps()->setPropertyValue( SC_UNO_SHEETTABS, uno::makeAny( _bDisplayWorkbookTabs )); } sal_Bool SAL_CALL diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx index feeba69dc20a..6b3fd6245ba0 100644 --- a/sc/source/ui/view/cellsh2.cxx +++ b/sc/source/ui/view/cellsh2.cxx @@ -1103,8 +1103,7 @@ void ScCellShell::GetDBState( SfxItemSet& rSet ) { // SBA wants a sal_Bool-item, enabled - bool bEnable = true; - rSet.Put(SfxBoolItem(nWhich, bEnable)); + rSet.Put(SfxBoolItem(nWhich, true)); } break; diff --git a/sc/source/ui/view/dbfunc3.cxx b/sc/source/ui/view/dbfunc3.cxx index bf745e24294f..e813f1cbebd9 100644 --- a/sc/source/ui/view/dbfunc3.cxx +++ b/sc/source/ui/view/dbfunc3.cxx @@ -992,8 +992,7 @@ void ScDBFunc::DateGroupDataPilot( const ScDPNumGroupInfo& rInfo, sal_Int32 nPar { ScDPSaveDimension* pOldDimension = aData.GetDimensionByName( aBaseDimName ); pSaveDimension->SetOrientation( pOldDimension->GetOrientation() ); - long nPosition = 0; //! before (immediate) base - aData.SetPosition( pSaveDimension, nPosition ); + aData.SetPosition( pSaveDimension, 0 ); //! before (immediate) base } } } @@ -1179,8 +1178,7 @@ void ScDBFunc::GroupDataPilot() { ScDPSaveDimension* pOldDimension = aData.GetDimensionByName( aDimName ); pSaveDimension->SetOrientation( pOldDimension->GetOrientation() ); - long nPosition = 0; //! before (immediate) base - aData.SetPosition( pSaveDimension, nPosition ); + aData.SetPosition( pSaveDimension, 0 ); //! before (immediate) base } // apply changes diff --git a/sc/source/ui/view/gridwin3.cxx b/sc/source/ui/view/gridwin3.cxx index fb6aba1ee455..83cd72fb062c 100644 --- a/sc/source/ui/view/gridwin3.cxx +++ b/sc/source/ui/view/gridwin3.cxx @@ -92,8 +92,7 @@ bool ScGridWindow::DrawMouseButtonUp(const MouseEvent& rMEvt) ScDrawView* pDrView = pViewData->GetScDrawView(); if ( pDrView ) { - bool bReplaceAll = true; - pDrView->SetAttrToMarked(*pDrawBrush, bReplaceAll); + pDrView->SetAttrToMarked(*pDrawBrush, true/*bReplaceAll*/); } if ( !pView->IsPaintBrushLocked() ) diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index 74151217831c..a7d13afe54c6 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -787,20 +787,15 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI if ( bHasChange || bHasScenario || !rHigh.empty() ) { - //! Merge SetChangedClip() with DrawMarks() ?? (different MapMode!) - bool bAny = true; - if (bAny) - { - if ( bHasChange ) - aOutputData.DrawChangeTrack(); + if ( bHasChange ) + aOutputData.DrawChangeTrack(); - if ( bHasScenario ) - lcl_DrawScenarioFrames( pContentDev, pViewData, eWhich, nX1,nY1,nX2,nY2 ); + if ( bHasScenario ) + lcl_DrawScenarioFrames( pContentDev, pViewData, eWhich, nX1,nY1,nX2,nY2 ); - lcl_DrawHighlight( aOutputData, pViewData, rHigh ); - } + lcl_DrawHighlight( aOutputData, pViewData, rHigh ); } // Drawing foreground diff --git a/sc/source/ui/view/gridwin_dbgutil.cxx b/sc/source/ui/view/gridwin_dbgutil.cxx index 70a594e65475..2927f87bdac2 100644 --- a/sc/source/ui/view/gridwin_dbgutil.cxx +++ b/sc/source/ui/view/gridwin_dbgutil.cxx @@ -90,8 +90,7 @@ void ScGridWindow::dumpCellProperties() aList.Join(aRange, false); } - OString aOutputFile("dump.xml"); - xmlTextWriterPtr writer = xmlNewTextWriterFilename( aOutputFile.getStr(), 0 ); + xmlTextWriterPtr writer = xmlNewTextWriterFilename( "dump.xml", 0 ); xmlTextWriterSetIndent(writer,1); xmlTextWriterSetIndentString(writer, BAD_CAST(" ")); diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx index 88f70a8e7249..ab70337c5790 100644 --- a/sc/source/ui/view/output2.cxx +++ b/sc/source/ui/view/output2.cxx @@ -717,10 +717,9 @@ long ScDrawStringsVars::GetMaxDigitWidth() if (nMaxDigitWidth > 0) return nMaxDigitWidth; - sal_Char cZero = '0'; for (sal_Char i = 0; i < 10; ++i) { - sal_Char cDigit = cZero + i; + sal_Char cDigit = '0' + i; long n = pOutput->pFmtDevice->GetTextWidth(OUString(cDigit)); nMaxDigitWidth = ::std::max(nMaxDigitWidth, n); } @@ -1878,8 +1877,7 @@ tools::Rectangle ScOutputData::LayoutStrings(bool bPixelToLogic, bool bPaint, co // check horizontal space - bool bNeedEditEngine = false; - if ( !bNeedEditEngine && !bOutside ) + if ( !bOutside ) { bool bRightAdjusted = false; // to correct text width calculation later switch (eOutHorJust) diff --git a/sc/source/ui/view/tabvwshb.cxx b/sc/source/ui/view/tabvwshb.cxx index 0123464a3252..009afeb5b779 100644 --- a/sc/source/ui/view/tabvwshb.cxx +++ b/sc/source/ui/view/tabvwshb.cxx @@ -270,7 +270,6 @@ ErrCode ScTabViewShell::DoVerb(long nVerb) return ERRCODE_SO_NOTIMPL; // should not be SdrOle2Obj* pOle2Obj = nullptr; - ErrCode nErr = ERRCODE_NONE; const SdrMarkList& rMarkList = pView->GetMarkedObjectList(); if (rMarkList.GetMarkCount() == 1) @@ -289,7 +288,7 @@ ErrCode ScTabViewShell::DoVerb(long nVerb) OSL_FAIL("no object for Verb found"); } - return nErr; + return ERRCODE_NONE; } void ScTabViewShell::DeactivateOle() diff --git a/sc/source/ui/view/tabvwshg.cxx b/sc/source/ui/view/tabvwshg.cxx index 7b739b8be0bd..596d0e94e2ee 100644 --- a/sc/source/ui/view/tabvwshg.cxx +++ b/sc/source/ui/view/tabvwshg.cxx @@ -82,8 +82,7 @@ void ScTabViewShell::InsertURLButton( const OUString& rName, const OUString& rUR xPropSet->setPropertyValue("TargetFrame", uno::Any(rTarget) ); } - form::FormButtonType eButtonType = form::FormButtonType_URL; - xPropSet->setPropertyValue("ButtonType", uno::Any(eButtonType) ); + xPropSet->setPropertyValue("ButtonType", uno::Any(form::FormButtonType_URL) ); if ( ::avmedia::MediaWindow::isMediaURL( rURL, ""/*TODO?*/ ) ) { diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index a82fbd678914..cb7335a216ba 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -2405,10 +2405,10 @@ void ScViewData::ReadUserData(const OUString& rData) // if available, get tab bar width: OUString aTabOpt = rData.getToken(2, ';'); - if (aTabOpt.startsWith(TAG_TABBARWIDTH)) + OUString aRest; + if (aTabOpt.startsWith(TAG_TABBARWIDTH, &aRest)) { - sal_Int32 nTagLen = RTL_CONSTASCII_LENGTH(TAG_TABBARWIDTH); - pView->SetTabBarWidth(aTabOpt.copy(nTagLen).toInt32()); + pView->SetTabBarWidth(aRest.toInt32()); nTabStart = 3; } diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx index 36e22d64ab24..9c30d27d39ef 100644 --- a/sc/source/ui/view/viewfun2.cxx +++ b/sc/source/ui/view/viewfun2.cxx @@ -2608,8 +2608,7 @@ void ScViewFunc::MoveTable( // execute without SfxCallMode::RECORD, because already contained in move command - OUString aUrl("private:factory/" STRING_SCAPP); - SfxStringItem aItem( SID_FILE_NAME, aUrl ); + SfxStringItem aItem( SID_FILE_NAME, "private:factory/" STRING_SCAPP ); SfxStringItem aTarget( SID_TARGETNAME, OUString("_blank") ); const SfxPoolItem* pRetItem = GetViewData().GetDispatcher().ExecuteList( diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx index e5a630d7a708..0c675ecd6c12 100644 --- a/sc/source/ui/view/viewfun3.cxx +++ b/sc/source/ui/view/viewfun3.cxx @@ -479,16 +479,14 @@ void ScViewFunc::PasteFromSystem() SotClipboardFormatId nBiff8 = SotExchange::RegisterFormatName("Biff8"); SotClipboardFormatId nBiff5 = SotExchange::RegisterFormatName("Biff5"); - SotExchangeDest nDestination = SotExchangeDest::SCDOC_FREE_AREA; - sal_uInt16 nSourceOptions = EXCHG_IN_ACTION_COPY; SotClipboardFormatId nFormat; // output param for GetExchangeAction sal_uInt8 nEventAction; // output param for GetExchangeAction uno::Reference xTransferable( aDataHelper.GetXTransferable() ); sal_uInt8 nAction = SotExchange::GetExchangeAction( aDataHelper.GetDataFlavorExVector(), - nDestination, - nSourceOptions, + SotExchangeDest::SCDOC_FREE_AREA, + EXCHG_IN_ACTION_COPY, EXCHG_IN_ACTION_DEFAULT, nFormat, nEventAction, SotClipboardFormatId::NONE, &xTransferable ); @@ -1950,7 +1948,6 @@ void ScViewFunc::DataFormPutData( SCROW nCurrentRow , bool bRowInfo = ( nStartCol==0 && nEndCol==MAXCOL ); SCCOL nUndoEndCol = nStartCol+aColLength-1; SCROW nUndoEndRow = nCurrentRow; - InsertDeleteFlags nUndoFlags = InsertDeleteFlags::NONE; if ( bRecord ) { @@ -1974,7 +1971,7 @@ void ScViewFunc::DataFormPutData( SCROW nCurrentRow , SfxUndoAction* pUndo = new ScUndoDataForm( pDocSh, nStartCol, nCurrentRow, nStartTab, nUndoEndCol, nUndoEndRow, nEndTab, rMark, - pUndoDoc, pRedoDoc, nUndoFlags, + pUndoDoc, pRedoDoc, InsertDeleteFlags::NONE, pUndoData ); pUndoMgr->AddUndoAction( new ScUndoWrapper( pUndo ), true ); -- cgit