diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2018-01-15 09:03:41 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2018-01-15 09:03:41 +0100 |
commit | 83922317915f06561e621caddc91512829609ec1 (patch) | |
tree | 790761ad43fce305bc8d4b94afb0fc42814acdc6 /sc | |
parent | e1bdc38a0b8861281f4111fa78b39f76be6e14e7 (diff) |
More loplugin:cstylecast: sc
Change-Id: Iaaa5b99cdff49bc1e88443ee23d98c005ff84911
Diffstat (limited to 'sc')
69 files changed, 206 insertions, 217 deletions
diff --git a/sc/inc/address.hxx b/sc/inc/address.hxx index 2be0ff1ccb7b..77ee970b08ee 100644 --- a/sc/inc/address.hxx +++ b/sc/inc/address.hxx @@ -176,11 +176,11 @@ namespace o3tl } inline void applyStartToEndFlags(ScRefFlags &target,const ScRefFlags source) { - target |= ScRefFlags((std::underlying_type<ScRefFlags>::type)source << 4); + target |= ScRefFlags(static_cast<std::underlying_type<ScRefFlags>::type>(source) << 4); } inline void applyStartToEndFlags(ScRefFlags &target) { - target |= ScRefFlags((std::underlying_type<ScRefFlags>::type)target << 4); + target |= ScRefFlags(static_cast<std::underlying_type<ScRefFlags>::type>(target) << 4); } // ScAddress diff --git a/sc/inc/attrib.hxx b/sc/inc/attrib.hxx index ccec669d1db2..24218eb8bdb4 100644 --- a/sc/inc/attrib.hxx +++ b/sc/inc/attrib.hxx @@ -89,7 +89,7 @@ public: SfxPoolItem * Clone(SfxItemPool * pPool = nullptr) const override; - ScMF GetValue() const { return (ScMF) SfxInt16Item::GetValue(); } + ScMF GetValue() const { return static_cast<ScMF>(SfxInt16Item::GetValue()); } bool IsHorOverlapped() const { return bool( GetValue() & ScMF::Hor ); } bool IsVerOverlapped() const { return bool( GetValue() & ScMF::Ver ); } diff --git a/sc/inc/conditio.hxx b/sc/inc/conditio.hxx index a27eeafc9ab8..77a066740ebd 100644 --- a/sc/inc/conditio.hxx +++ b/sc/inc/conditio.hxx @@ -171,7 +171,7 @@ inline std::basic_ostream<charT, traits> & operator <<(std::basic_ostream<charT, stream << "NONE"; break; default: - stream << "?(" << (int)rMode << ")"; + stream << "?(" << static_cast<int>(rMode) << ")"; break; } @@ -274,7 +274,7 @@ inline std::basic_ostream<charT, traits> & operator <<(std::basic_ostream<charT, stream << "Data"; break; default: - stream << "?(" << (int)rType << ")"; + stream << "?(" << static_cast<int>(rType) << ")"; break; } return stream; diff --git a/sc/inc/generalfunction.hxx b/sc/inc/generalfunction.hxx index 69c94b0529e5..fa0ae390d906 100644 --- a/sc/inc/generalfunction.hxx +++ b/sc/inc/generalfunction.hxx @@ -30,69 +30,69 @@ enum class ScGeneralFunction { /** nothing is calculated. */ - NONE = (int)css::sheet::GeneralFunction_NONE, + NONE = int(css::sheet::GeneralFunction_NONE), /** function is determined automatically. <p>If the values are all numerical, SUM is used, otherwise COUNT.</p> */ - AUTO = (int)css::sheet::GeneralFunction_AUTO, + AUTO = int(css::sheet::GeneralFunction_AUTO), /** sum of all numerical values is calculated. */ - SUM = (int)css::sheet::GeneralFunction_SUM, + SUM = int(css::sheet::GeneralFunction_SUM), /** all values, including non-numerical values, are counted. */ - COUNT = (int)css::sheet::GeneralFunction_COUNT, + COUNT = int(css::sheet::GeneralFunction_COUNT), /** average of all numerical values is calculated. */ - AVERAGE = (int)css::sheet::GeneralFunction_AVERAGE, + AVERAGE = int(css::sheet::GeneralFunction_AVERAGE), /** maximum value of all numerical values is calculated. */ - MAX = (int)css::sheet::GeneralFunction_MAX, + MAX = int(css::sheet::GeneralFunction_MAX), /** minimum value of all numerical values is calculated. */ - MIN = (int)css::sheet::GeneralFunction_MIN, + MIN = int(css::sheet::GeneralFunction_MIN), /** product of all numerical values is calculated. */ - PRODUCT = (int)css::sheet::GeneralFunction_PRODUCT, + PRODUCT = int(css::sheet::GeneralFunction_PRODUCT), /** numerical values are counted. */ - COUNTNUMS = (int)css::sheet::GeneralFunction_COUNTNUMS, + COUNTNUMS = int(css::sheet::GeneralFunction_COUNTNUMS), /** standard deviation is calculated based on a sample. */ - STDEV = (int)css::sheet::GeneralFunction_STDEV, + STDEV = int(css::sheet::GeneralFunction_STDEV), /** standard deviation is calculated based on the entire population. */ - STDEVP = (int)css::sheet::GeneralFunction_STDEVP, + STDEVP = int(css::sheet::GeneralFunction_STDEVP), /** variance is calculated based on a sample. */ - VAR = (int)css::sheet::GeneralFunction_VAR, + VAR = int(css::sheet::GeneralFunction_VAR), /** variance is calculated based on the entire population. */ - VARP = (int)css::sheet::GeneralFunction_VARP, + VARP = int(css::sheet::GeneralFunction_VARP), /** * median of all numerical values is calculated. diff --git a/sc/qa/unit/helper/shared_test_impl.hxx b/sc/qa/unit/helper/shared_test_impl.hxx index e978191ba337..344e932b0695 100644 --- a/sc/qa/unit/helper/shared_test_impl.hxx +++ b/sc/qa/unit/helper/shared_test_impl.hxx @@ -263,7 +263,7 @@ void testFunctionsExcel2010_Impl( ScDocument& rDoc ) ScFormulaCell* pFC = rDoc.GetFormulaCell( ScAddress( 1, nRow, 0) ); if ( pFC && pFC->GetErrCode() != FormulaError::NONE ) - aStr += ", error code =" + OString::number( (int)pFC->GetErrCode() ); + aStr += ", error code =" + OString::number( static_cast<int>(pFC->GetErrCode()) ); CPPUNIT_ASSERT_MESSAGE( OString( "Expected a formula cell without error at row " + aStr ).getStr(), isFormulaWithoutError( rDoc, ScAddress( 1, nRow, 0))); diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index 7d69b8eee5ae..daf934187252 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -1009,7 +1009,7 @@ struct Border column(col), row(r), leftWidth(lW), topWidth(tW), rightWidth(rW), bottomWidth(bW), lOutWidth(lOutW), lInWidth(lInW), lDistance(lDist), tOutWidth(tOutW), tInWidth(tInW), tDistance(tDist), rOutWidth(rOutW), rInWidth(rInW), rDistance(rDist), bOutWidth(bOutW), bInWidth(bInW), bDistance(bDist), - lStyle((SvxBorderLineStyle)lSt), tStyle((SvxBorderLineStyle)tSt), rStyle((SvxBorderLineStyle)rSt), bStyle((SvxBorderLineStyle)bSt) {}; + lStyle(static_cast<SvxBorderLineStyle>(lSt)), tStyle(static_cast<SvxBorderLineStyle>(tSt)), rStyle(static_cast<SvxBorderLineStyle>(rSt)), bStyle(static_cast<SvxBorderLineStyle>(bSt)) {}; }; void ScFiltersTest::testBordersOoo33() @@ -3179,7 +3179,7 @@ void ScFiltersTest::testVBAUserFunctionXLSM() // Check the formula state after the load. FormulaError nErrCode = pFC->GetErrCode(); - CPPUNIT_ASSERT_EQUAL(0, (int)nErrCode); + CPPUNIT_ASSERT_EQUAL(0, static_cast<int>(nErrCode)); // Check the result. CPPUNIT_ASSERT_EQUAL(42.0, rDoc.GetValue(ScAddress(0,0,0))); @@ -3223,7 +3223,7 @@ void ScFiltersTest::testErrorOnExternalReferences() ScFormulaCell* pFC = rDoc.GetFormulaCell(ScAddress(0,0,0)); CPPUNIT_ASSERT(pFC); - CPPUNIT_ASSERT_EQUAL((int)FormulaError::NoName, (int)pFC->GetErrCode()); + CPPUNIT_ASSERT_EQUAL(int(FormulaError::NoName), static_cast<int>(pFC->GetErrCode())); ASSERT_FORMULA_EQUAL(rDoc, ScAddress(0,0,0), "'file:///Path/To/FileA.ods'#$Sheet1.A1A", "Formula changed"); diff --git a/sc/qa/unit/tiledrendering/tiledrendering.cxx b/sc/qa/unit/tiledrendering/tiledrendering.cxx index 21c7200939fd..a1dd154f4717 100644 --- a/sc/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sc/qa/unit/tiledrendering/tiledrendering.cxx @@ -698,7 +698,7 @@ bool lcl_hasEditView(const ScViewData& rViewData) bool bResult = false; for (unsigned int i=0; i<4; i++) { - bResult = rViewData.HasEditView( (ScSplitPos) i ); + bResult = rViewData.HasEditView( static_cast<ScSplitPos>(i) ); if (bResult) break; } return bResult; diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index d18ba23885c6..99bd10ca627a 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -1045,7 +1045,7 @@ void Test::testValueIterator() { CPPUNIT_ASSERT_MESSAGE("Iteration longer than expected.", nCheckPos < nCheckLen); CPPUNIT_ASSERT_EQUAL(aChecks[nCheckPos], fVal); - CPPUNIT_ASSERT_EQUAL(0, (int)nErr); + CPPUNIT_ASSERT_EQUAL(0, static_cast<int>(nErr)); } } @@ -1667,7 +1667,7 @@ struct AllZeroMatrix { void operator() (SCSIZE /*nCol*/, SCSIZE /*nRow*/, const ScMatrixValue& rVal) const { - CPPUNIT_ASSERT_EQUAL_MESSAGE("element is not of numeric type", (int)ScMatValType::Value, (int)rVal.nType); + CPPUNIT_ASSERT_EQUAL_MESSAGE("element is not of numeric type", int(ScMatValType::Value), static_cast<int>(rVal.nType)); ASSERT_DOUBLES_EQUAL_MESSAGE("element value must be zero", 0.0, rVal.fVal); } }; @@ -1676,7 +1676,7 @@ struct PartiallyFilledZeroMatrix { void operator() (SCSIZE nCol, SCSIZE nRow, const ScMatrixValue& rVal) const { - CPPUNIT_ASSERT_EQUAL_MESSAGE("element is not of numeric type", (int)ScMatValType::Value, (int)rVal.nType); + CPPUNIT_ASSERT_EQUAL_MESSAGE("element is not of numeric type", int(ScMatValType::Value), static_cast<int>(rVal.nType)); if (1 <= nCol && nCol <= 2 && 2 <= nRow && nRow <= 8) { ASSERT_DOUBLES_EQUAL_MESSAGE("element value must be 3.0", 3.0, rVal.fVal); @@ -1692,7 +1692,7 @@ struct AllEmptyMatrix { void operator() (SCSIZE /*nCol*/, SCSIZE /*nRow*/, const ScMatrixValue& rVal) const { - CPPUNIT_ASSERT_EQUAL_MESSAGE("element is not of empty type", (int)ScMatValType::Empty, (int)rVal.nType); + CPPUNIT_ASSERT_EQUAL_MESSAGE("element is not of empty type", int(ScMatValType::Empty), static_cast<int>(rVal.nType)); ASSERT_DOUBLES_EQUAL_MESSAGE("value of \"empty\" element is expected to be zero", 0.0, rVal.fVal); } }; @@ -1703,27 +1703,27 @@ struct PartiallyFilledEmptyMatrix { if (nCol == 1 && nRow == 1) { - CPPUNIT_ASSERT_EQUAL_MESSAGE("element is not of boolean type", (int)ScMatValType::Boolean, (int)rVal.nType); + CPPUNIT_ASSERT_EQUAL_MESSAGE("element is not of boolean type", int(ScMatValType::Boolean), static_cast<int>(rVal.nType)); ASSERT_DOUBLES_EQUAL_MESSAGE("element value is not what is expected", 1.0, rVal.fVal); } else if (nCol == 4 && nRow == 5) { - CPPUNIT_ASSERT_EQUAL_MESSAGE("element is not of value type", (int)ScMatValType::Value, (int)rVal.nType); + CPPUNIT_ASSERT_EQUAL_MESSAGE("element is not of value type", int(ScMatValType::Value), static_cast<int>(rVal.nType)); ASSERT_DOUBLES_EQUAL_MESSAGE("element value is not what is expected", -12.5, rVal.fVal); } else if (nCol == 8 && nRow == 2) { - CPPUNIT_ASSERT_EQUAL_MESSAGE("element is not of value type", (int)ScMatValType::String, (int)rVal.nType); + CPPUNIT_ASSERT_EQUAL_MESSAGE("element is not of value type", int(ScMatValType::String), static_cast<int>(rVal.nType)); CPPUNIT_ASSERT_EQUAL_MESSAGE("element value is not what is expected", OUString("Test"), rVal.aStr.getString()); } else if (nCol == 8 && nRow == 11) { - CPPUNIT_ASSERT_EQUAL_MESSAGE("element is not of empty path type", (int)ScMatValType::EmptyPath, (int)rVal.nType); + CPPUNIT_ASSERT_EQUAL_MESSAGE("element is not of empty path type", int(ScMatValType::EmptyPath), static_cast<int>(rVal.nType)); ASSERT_DOUBLES_EQUAL_MESSAGE("value of \"empty\" element is expected to be zero", 0.0, rVal.fVal); } else { - CPPUNIT_ASSERT_EQUAL_MESSAGE("element is not of empty type", (int)ScMatValType::Empty, (int)rVal.nType); + CPPUNIT_ASSERT_EQUAL_MESSAGE("element is not of empty type", int(ScMatValType::Empty), static_cast<int>(rVal.nType)); ASSERT_DOUBLES_EQUAL_MESSAGE("value of \"empty\" element is expected to be zero", 0.0, rVal.fVal); } } @@ -6512,7 +6512,7 @@ void Test::testEmptyCalcDocDefaults() CPPUNIT_ASSERT_EQUAL( sal_uLong(0), m_pDoc->GetCellCount() ); CPPUNIT_ASSERT_EQUAL( sal_uLong(0), m_pDoc->GetFormulaGroupCount() ); CPPUNIT_ASSERT_EQUAL( sal_uLong(0), m_pDoc->GetCodeCount() ); - CPPUNIT_ASSERT_EQUAL( (int)CharCompressType::NONE, (int)m_pDoc->GetAsianCompression() ); + CPPUNIT_ASSERT_EQUAL( int(CharCompressType::NONE), static_cast<int>(m_pDoc->GetAsianCompression()) ); CPPUNIT_ASSERT_EQUAL( false, m_pDoc->HasPrintRange() ); CPPUNIT_ASSERT_EQUAL( false, m_pDoc->IsInVBAMode() ); diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx index 8c5c8fefab1a..e282b0eb3a60 100644 --- a/sc/qa/unit/ucalc_formula.cxx +++ b/sc/qa/unit/ucalc_formula.cxx @@ -1199,11 +1199,11 @@ void Test::testFormulaRefUpdate() aPos = ScAddress(2,1,0); ScFormulaCell* pFC = m_pDoc->GetFormulaCell(aPos); CPPUNIT_ASSERT_MESSAGE("This should be a formula cell.", pFC); - CPPUNIT_ASSERT_EQUAL((int)FormulaError::NoRef, (int)pFC->GetErrCode()); + CPPUNIT_ASSERT_EQUAL(int(FormulaError::NoRef), static_cast<int>(pFC->GetErrCode())); aPos = ScAddress(2,2,0); pFC = m_pDoc->GetFormulaCell(aPos); CPPUNIT_ASSERT_MESSAGE("This should be a formula cell.", pFC); - CPPUNIT_ASSERT_EQUAL((int)FormulaError::NoRef, (int)pFC->GetErrCode()); + CPPUNIT_ASSERT_EQUAL(int(FormulaError::NoRef), static_cast<int>(pFC->GetErrCode())); // Clear all and start over. clearRange(m_pDoc, ScRange(0,0,0,10,10,0)); @@ -1303,11 +1303,11 @@ void Test::testFormulaRefUpdate() // Both A4 and A5 should show #REF! errors. pFC = m_pDoc->GetFormulaCell(ScAddress(0,3,0)); CPPUNIT_ASSERT_MESSAGE("This should be a formula cell.", pFC); - CPPUNIT_ASSERT_EQUAL((int)FormulaError::NoRef, (int)pFC->GetErrCode()); + CPPUNIT_ASSERT_EQUAL(int(FormulaError::NoRef), static_cast<int>(pFC->GetErrCode())); pFC = m_pDoc->GetFormulaCell(ScAddress(0,4,0)); CPPUNIT_ASSERT_MESSAGE("This should be a formula cell.", pFC); - CPPUNIT_ASSERT_EQUAL((int)FormulaError::NoRef, (int)pFC->GetErrCode()); + CPPUNIT_ASSERT_EQUAL(int(FormulaError::NoRef), static_cast<int>(pFC->GetErrCode())); m_pDoc->DeleteTab(0); } @@ -1937,7 +1937,7 @@ void Test::testFormulaRefUpdateInsertRows() rFunc.InsertCells(ScRange(0,1,0,MAXCOL,3,0), &aMark, INS_INSROWS_BEFORE, false, true); ScFormulaCell* pFC = m_pDoc->GetFormulaCell(ScAddress(0,5,0)); CPPUNIT_ASSERT(pFC); - CPPUNIT_ASSERT_EQUAL_MESSAGE("This formula cell should not be an error.", 0, (int)pFC->GetErrCode()); + CPPUNIT_ASSERT_EQUAL_MESSAGE("This formula cell should not be an error.", 0, static_cast<int>(pFC->GetErrCode())); ASSERT_DOUBLES_EQUAL(3.0, m_pDoc->GetValue(ScAddress(0,5,0))); ASSERT_FORMULA_EQUAL(*m_pDoc, ScAddress(0,5,0), "MAX(A7:A9)", "Wrong formula!"); @@ -4007,17 +4007,17 @@ void Test::testFuncSUM() m_pDoc->SetString(ScAddress(0,2,0), "=1/0"); FormulaError nErr = m_pDoc->GetErrCode(ScAddress(0,2,0)); CPPUNIT_ASSERT_EQUAL_MESSAGE("Cell should have a division by zero error.", - (int)FormulaError::DivisionByZero, (int)nErr); + int(FormulaError::DivisionByZero), static_cast<int>(nErr)); nErr = m_pDoc->GetErrCode(ScAddress(0,3,0)); CPPUNIT_ASSERT_EQUAL_MESSAGE("SUM should have also inherited a div-by-zero error.", - (int)FormulaError::DivisionByZero, (int)nErr); + int(FormulaError::DivisionByZero), static_cast<int>(nErr)); // Set #NA! to A2. A4 should now inherit this error. m_pDoc->SetString(ScAddress(0,1,0), "=NA()"); nErr = m_pDoc->GetErrCode(ScAddress(0,1,0)); CPPUNIT_ASSERT_MESSAGE("A2 should be an error.", nErr != FormulaError::NONE); CPPUNIT_ASSERT_EQUAL_MESSAGE("A4 should have inherited the same error as A2.", - (int)nErr, (int)m_pDoc->GetErrCode(ScAddress(0,3,0))); + static_cast<int>(nErr), static_cast<int>(m_pDoc->GetErrCode(ScAddress(0,3,0)))); m_pDoc->DeleteTab(0); } @@ -4172,8 +4172,8 @@ void Test::testFuncMIN() CPPUNIT_ASSERT_EQUAL(static_cast<SCCOL>(1), nCols); CPPUNIT_ASSERT_EQUAL(static_cast<SCROW>(2), nRows); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Formula in C1 is invalid.", 0, (int)m_pDoc->GetErrCode(ScAddress(2,0,0))); - CPPUNIT_ASSERT_EQUAL_MESSAGE("Formula in C2 is invalid.", 0, (int)m_pDoc->GetErrCode(ScAddress(2,1,0))); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Formula in C1 is invalid.", 0, static_cast<int>(m_pDoc->GetErrCode(ScAddress(2,0,0)))); + CPPUNIT_ASSERT_EQUAL_MESSAGE("Formula in C2 is invalid.", 0, static_cast<int>(m_pDoc->GetErrCode(ScAddress(2,1,0)))); CPPUNIT_ASSERT_EQUAL(0.0, m_pDoc->GetValue(ScAddress(2,0,0))); CPPUNIT_ASSERT_EQUAL(0.0, m_pDoc->GetValue(ScAddress(2,1,0))); @@ -4762,9 +4762,9 @@ void Test::testFuncLOOKUP() printRange(m_pDoc, ScRange(0,4,0,1,6,0), "Data range for LOOKUP."); // Values for B5:B7 should be 1, 2, and 3. - CPPUNIT_ASSERT_EQUAL_MESSAGE("This formula should not have an error code.", 0, (int)m_pDoc->GetErrCode(ScAddress(1,4,0))); - CPPUNIT_ASSERT_EQUAL_MESSAGE("This formula should not have an error code.", 0, (int)m_pDoc->GetErrCode(ScAddress(1,5,0))); - CPPUNIT_ASSERT_EQUAL_MESSAGE("This formula should not have an error code.", 0, (int)m_pDoc->GetErrCode(ScAddress(1,6,0))); + CPPUNIT_ASSERT_EQUAL_MESSAGE("This formula should not have an error code.", 0, static_cast<int>(m_pDoc->GetErrCode(ScAddress(1,4,0)))); + CPPUNIT_ASSERT_EQUAL_MESSAGE("This formula should not have an error code.", 0, static_cast<int>(m_pDoc->GetErrCode(ScAddress(1,5,0)))); + CPPUNIT_ASSERT_EQUAL_MESSAGE("This formula should not have an error code.", 0, static_cast<int>(m_pDoc->GetErrCode(ScAddress(1,6,0)))); ASSERT_DOUBLES_EQUAL(1.0, m_pDoc->GetValue(ScAddress(1,4,0))); ASSERT_DOUBLES_EQUAL(2.0, m_pDoc->GetValue(ScAddress(1,5,0))); @@ -6132,14 +6132,14 @@ void Test::testExternalRefFunctions() m_pDoc->SetString(0, 0, 0, "=SUM('file:///extdata.fake'#Data.B1:AMJ1048575)"); ScFormulaCell* pFC = m_pDoc->GetFormulaCell( ScAddress(0,0,0)); FormulaError nErr = pFC->GetErrCode(); - CPPUNIT_ASSERT_EQUAL_MESSAGE("huge external range reference expected to yield FormulaError::MatrixSize", (int)FormulaError::MatrixSize, (int)nErr); + CPPUNIT_ASSERT_EQUAL_MESSAGE("huge external range reference expected to yield FormulaError::MatrixSize", int(FormulaError::MatrixSize), static_cast<int>(nErr)); ScMarkData aMark; aMark.SelectOneTable(0); m_pDoc->InsertMatrixFormula(0,0,0,0, aMark, "'file:///extdata.fake'#Data.B1:AMJ1048575"); pFC = m_pDoc->GetFormulaCell( ScAddress(0,0,0)); nErr = pFC->GetErrCode(); - CPPUNIT_ASSERT_EQUAL_MESSAGE("huge external range reference expected to yield FormulaError::MatrixSize", (int)FormulaError::MatrixSize, (int)nErr); + CPPUNIT_ASSERT_EQUAL_MESSAGE("huge external range reference expected to yield FormulaError::MatrixSize", int(FormulaError::MatrixSize), static_cast<int>(nErr)); SCSIZE nMatCols, nMatRows; const ScMatrix* pMat = pFC->GetMatrix(); CPPUNIT_ASSERT_MESSAGE("matrix expected", pMat != nullptr); diff --git a/sc/qa/unit/ucalc_pivottable.cxx b/sc/qa/unit/ucalc_pivottable.cxx index ca7c88f196b5..217b16577ba7 100644 --- a/sc/qa/unit/ucalc_pivottable.cxx +++ b/sc/qa/unit/ucalc_pivottable.cxx @@ -2310,7 +2310,7 @@ void Test::testFuncGETPIVOTDATALeafAccess() for (size_t i = 0; i < SAL_N_ELEMENTS(aChecks); ++i) { FormulaError nErr = m_pDoc->GetErrCode(ScAddress(4,i,1)); - CPPUNIT_ASSERT_EQUAL((sal_uInt16)FormulaError::NONE, (sal_uInt16)nErr); + CPPUNIT_ASSERT_EQUAL(sal_uInt16(FormulaError::NONE), static_cast<sal_uInt16>(nErr)); double fVal = m_pDoc->GetValue(ScAddress(4,i,1)); CPPUNIT_ASSERT_EQUAL(aChecks[i].mfResult, fVal); } diff --git a/sc/source/core/data/conditio.cxx b/sc/source/core/data/conditio.cxx index 5dbe88df5102..4829be28388d 100644 --- a/sc/source/core/data/conditio.cxx +++ b/sc/source/core/data/conditio.cxx @@ -1421,7 +1421,7 @@ ScFormatEntry* ScConditionEntry::Clone(ScDocument* pDoc) const ScConditionMode ScConditionEntry::GetModeFromApi(css::sheet::ConditionOperator nOperation) { ScConditionMode eMode = ScConditionMode::NONE; - switch ((sal_Int32)nOperation) + switch (static_cast<sal_Int32>(nOperation)) { case css::sheet::ConditionOperator2::EQUAL: eMode = ScConditionMode::Equal; diff --git a/sc/source/core/data/documen5.cxx b/sc/source/core/data/documen5.cxx index 254be756e6b5..f92b74087450 100644 --- a/sc/source/core/data/documen5.cxx +++ b/sc/source/core/data/documen5.cxx @@ -71,7 +71,7 @@ static void lcl_GetChartParameters( const uno::Reference< chart2::XChartDocument if ( aPropName == "CellRangeRepresentation" ) rProp.Value >>= rRanges; else if ( aPropName == "DataRowSource" ) - rDataRowSource = (chart::ChartDataRowSource)ScUnoHelpFunctions::GetEnumFromAny( rProp.Value ); + rDataRowSource = static_cast<chart::ChartDataRowSource>(ScUnoHelpFunctions::GetEnumFromAny( rProp.Value )); else if ( aPropName == "HasCategories" ) rHasCategories = ScUnoHelpFunctions::GetBoolFromAny( rProp.Value ); else if ( aPropName == "FirstCellAsLabel" ) diff --git a/sc/source/core/data/dpobject.cxx b/sc/source/core/data/dpobject.cxx index 8d3dd0ef2759..963de1d40987 100644 --- a/sc/source/core/data/dpobject.cxx +++ b/sc/source/core/data/dpobject.cxx @@ -2717,8 +2717,8 @@ void ScDPObject::ConvertOrientation( sal_uInt16 nMask = 1; for (sal_uInt16 nBit=0; nBit<16; nBit++) { - if ( nFuncs & (PivotFunc)nMask ) - nSubTotalFuncs.push_back( ScDataPilotConversion::FirstFunc( (PivotFunc)nMask ) ); + if ( nFuncs & static_cast<PivotFunc>(nMask) ) + nSubTotalFuncs.push_back( ScDataPilotConversion::FirstFunc( static_cast<PivotFunc>(nMask) ) ); nMask *= 2; } pDim->SetSubTotals( nSubTotalFuncs ); diff --git a/sc/source/core/data/dpsave.cxx b/sc/source/core/data/dpsave.cxx index d6d6d9e91224..834c1e7df3e4 100644 --- a/sc/source/core/data/dpsave.cxx +++ b/sc/source/core/data/dpsave.cxx @@ -598,7 +598,7 @@ void ScDPSaveDimension::WriteToSource( const uno::Reference<uno::XInterface>& xD { uno::Sequence<sal_Int16> aSeq(maSubTotalFuncs.size()); for(size_t i = 0; i < maSubTotalFuncs.size(); ++i) - aSeq.getArray()[i] = (sal_Int16)maSubTotalFuncs[i]; + aSeq.getArray()[i] = static_cast<sal_Int16>(maSubTotalFuncs[i]); xLevProp->setPropertyValue( SC_UNO_DP_SUBTOTAL2, uno::Any(aSeq) ); } if ( nShowEmptyMode != SC_DPSAVEMODE_DONTKNOW ) @@ -720,7 +720,7 @@ void ScDPSaveDimension::Dump(int nIndent) const cout << aIndent << " + orientation: "; if (nOrientation <= DataPilotFieldOrientation_DATA) - cout << pOrientNames[(int)nOrientation]; + cout << pOrientNames[static_cast<int>(nOrientation)]; else cout << "(invalid)"; cout << endl; diff --git a/sc/source/core/data/dptabres.cxx b/sc/source/core/data/dptabres.cxx index 94b656a72ccf..2ceb4f70f91b 100644 --- a/sc/source/core/data/dptabres.cxx +++ b/sc/source/core/data/dptabres.cxx @@ -739,7 +739,7 @@ static ScSubTotalFunc lcl_GetForceFunc( const ScDPLevel* pLevel, long nFuncNo ) if ( nFuncNo >= 0 && nFuncNo < nSequence ) { - ScGeneralFunction eUser = (ScGeneralFunction)aSeq.getConstArray()[nFuncNo]; + ScGeneralFunction eUser = static_cast<ScGeneralFunction>(aSeq.getConstArray()[nFuncNo]); if (eUser != ScGeneralFunction::AUTO) eRet = ScDPUtil::toSubTotalFunc(eUser); } diff --git a/sc/source/core/data/dptabsrc.cxx b/sc/source/core/data/dptabsrc.cxx index ef3318fd4399..3ccb38ddf3af 100644 --- a/sc/source/core/data/dptabsrc.cxx +++ b/sc/source/core/data/dptabsrc.cxx @@ -1472,13 +1472,13 @@ void SAL_CALL ScDPDimension::setPropertyValue( const OUString& aPropertyName, co { sheet::GeneralFunction eEnum; if (aValue >>= eEnum) - setFunction( (ScGeneralFunction)eEnum ); + setFunction( static_cast<ScGeneralFunction>(eEnum) ); } else if ( aPropertyName == SC_UNO_DP_FUNCTION2 ) { sal_Int16 eEnum; if (aValue >>= eEnum) - setFunction( (ScGeneralFunction)eEnum ); + setFunction( static_cast<ScGeneralFunction>(eEnum) ); } else if ( aPropertyName == SC_UNO_DP_REFVALUE ) aValue >>= aReferenceValue; @@ -1556,14 +1556,14 @@ uno::Any SAL_CALL ScDPDimension::getPropertyValue( const OUString& aPropertyName if (nVal == ScGeneralFunction::MEDIAN) nVal = ScGeneralFunction::NONE; const int nValAsInt = static_cast<int>(nVal); - assert(nValAsInt >= (int)css::sheet::GeneralFunction_NONE && - nValAsInt <= (int)css::sheet::GeneralFunction_VARP); - aRet <<= (sheet::GeneralFunction)nValAsInt; + assert(nValAsInt >= int(css::sheet::GeneralFunction_NONE) && + nValAsInt <= int(css::sheet::GeneralFunction_VARP)); + aRet <<= static_cast<sheet::GeneralFunction>(nValAsInt); } else if ( aPropertyName == SC_UNO_DP_FUNCTION2 ) { ScGeneralFunction eVal = getFunction(); - aRet <<= (sal_Int16)eVal; + aRet <<= static_cast<sal_Int16>(eVal); } else if ( aPropertyName == SC_UNO_DP_REFVALUE ) aRet <<= aReferenceValue; diff --git a/sc/source/core/data/global.cxx b/sc/source/core/data/global.cxx index be0b44c8782c..4ec80cb92025 100644 --- a/sc/source/core/data/global.cxx +++ b/sc/source/core/data/global.cxx @@ -344,7 +344,7 @@ OUString ScGlobal::GetErrorString(FormulaError nErr) case FormulaError::IllegalFPOperation: return ScCompiler::GetNativeSymbol(ocErrNum); default: - return GetRscString(STR_ERROR_STR) + OUString::number( (int)nErr ); + return GetRscString(STR_ERROR_STR) + OUString::number( static_cast<int>(nErr) ); } return GetRscString(pErrNumber); } diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx index 5c93183e7371..7576c3b9f020 100644 --- a/sc/source/core/tool/address.cxx +++ b/sc/source/core/tool/address.cxx @@ -2215,7 +2215,7 @@ OUString ScRange::Format( ScRefFlags nFlags, const ScDocument* pDoc, lcl_RowAbsFlagDiffer( nFlags )) { // move flags of end reference to start reference, mask with BITS to exclude FORCE_DOC flag - nFlags = ScRefFlags::VALID | (ScRefFlags((std::underlying_type<ScRefFlags>::type)nFlags >> 4) & ScRefFlags::BITS); + nFlags = ScRefFlags::VALID | (ScRefFlags(static_cast<std::underlying_type<ScRefFlags>::type>(nFlags) >> 4) & ScRefFlags::BITS); if ( bOneTab ) pDoc = nullptr; else diff --git a/sc/source/core/tool/appoptio.cxx b/sc/source/core/tool/appoptio.cxx index 3e875ae1470e..9da510633b2b 100644 --- a/sc/source/core/tool/appoptio.cxx +++ b/sc/source/core/tool/appoptio.cxx @@ -344,7 +344,7 @@ ScAppCfg::ScAppCfg() : switch(nProp) { case SCLAYOUTOPT_MEASURE: - if (pValues[nProp] >>= nIntVal) SetAppMetric( (FieldUnit) nIntVal ); + if (pValues[nProp] >>= nIntVal) SetAppMetric( static_cast<FieldUnit>(nIntVal) ); break; case SCLAYOUTOPT_STATUSBAR: if ( pValues[SCLAYOUTOPT_STATUSBAR] >>= nUIntValTmp ) @@ -358,7 +358,7 @@ ScAppCfg::ScAppCfg() : if (pValues[nProp] >>= nIntVal) SetZoom( static_cast<sal_uInt16>(nIntVal) ); break; case SCLAYOUTOPT_ZOOMTYPE: - if (pValues[nProp] >>= nIntVal) SetZoomType( (SvxZoomType) nIntVal ); + if (pValues[nProp] >>= nIntVal) SetZoomType( static_cast<SvxZoomType>(nIntVal) ); break; case SCLAYOUTOPT_SYNCZOOM: SetSynchronizeZoom( ScUnoHelpFunctions::GetBoolFromAny( pValues[nProp] ) ); @@ -458,7 +458,7 @@ ScAppCfg::ScAppCfg() : switch(nProp) { case SCCONTENTOPT_LINK: - if (pValues[nProp] >>= nIntVal) SetLinkMode( (ScLkUpdMode) nIntVal ); + if (pValues[nProp] >>= nIntVal) SetLinkMode( static_cast<ScLkUpdMode>(nIntVal) ); break; } } @@ -560,7 +560,7 @@ ScAppCfg::ScAppCfg() : pValues[nProp] <<= static_cast<sal_Int32>(GetZoom()); break; case SCLAYOUTOPT_ZOOMTYPE: - pValues[nProp] <<= (sal_Int32) GetZoomType(); + pValues[nProp] <<= static_cast<sal_Int32>(GetZoomType()); break; case SCLAYOUTOPT_SYNCZOOM: pValues[nProp] <<= GetSynchronizeZoom(); diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index ba03e59ff95a..b029b560e5d5 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -2903,7 +2903,7 @@ bool ScCompiler::IsOpCode2( const OUString& rName ) if (bFound) { - maRawToken.SetOpCode( (OpCode) --i ); + maRawToken.SetOpCode( static_cast<OpCode>(--i) ); } return bFound; } diff --git a/sc/source/core/tool/interpr4.cxx b/sc/source/core/tool/interpr4.cxx index 54e221800324..bedeaa75c7c9 100644 --- a/sc/source/core/tool/interpr4.cxx +++ b/sc/source/core/tool/interpr4.cxx @@ -1738,13 +1738,13 @@ formula::FormulaToken* ScInterpreter::CreateFormulaDoubleToken( double fVal, SvN if (p && p->GetRef() == 1) { p->GetDoubleAsReference() = fVal; - p->SetDoubleType( (sal_Int16)nFmt ); + p->SetDoubleType( static_cast<sal_Int16>(nFmt) ); return p; } } // Allocate a new token - auto p = new FormulaTypedDoubleToken( fVal, (sal_Int16)nFmt ); + auto p = new FormulaTypedDoubleToken( fVal, static_cast<sal_Int16>(nFmt) ); if ( mrContext.maTokens[mrContext.mnTokenCachePos] ) mrContext.maTokens[mrContext.mnTokenCachePos]->DecRef(); mrContext.maTokens[mrContext.mnTokenCachePos] = p; diff --git a/sc/source/core/tool/reffind.cxx b/sc/source/core/tool/reffind.cxx index ccb1f698556c..31e6fd8977a7 100644 --- a/sc/source/core/tool/reffind.cxx +++ b/sc/source/core/tool/reffind.cxx @@ -219,7 +219,7 @@ static ScRefFlags lcl_NextFlags( ScRefFlags nOld ) { const ScRefFlags Mask_ABS = (ScRefFlags::COL_ABS | ScRefFlags::ROW_ABS | ScRefFlags::TAB_ABS); ScRefFlags nNew = nOld & Mask_ABS; - nNew = ScRefFlags( (std::underlying_type<ScRefFlags>::type)nNew - 1 ) & Mask_ABS; // weiterzaehlen + nNew = ScRefFlags( static_cast<std::underlying_type<ScRefFlags>::type>(nNew) - 1 ) & Mask_ABS; // weiterzaehlen if (!(nOld & ScRefFlags::TAB_3D)) nNew &= ~ScRefFlags::TAB_ABS; // not 3D -> never absolute! diff --git a/sc/source/core/tool/viewopti.cxx b/sc/source/core/tool/viewopti.cxx index 65bf1db49122..483c3045f853 100644 --- a/sc/source/core/tool/viewopti.cxx +++ b/sc/source/core/tool/viewopti.cxx @@ -399,7 +399,7 @@ ScViewCfg::ScViewCfg() : //#i80528# adapt to new range eventually if(sal_Int32(VOBJ_MODE_HIDE) < nIntVal) nIntVal = sal_Int32(VOBJ_MODE_SHOW); - SetObjMode( VOBJ_TYPE_OLE, (ScVObjMode)nIntVal); + SetObjMode( VOBJ_TYPE_OLE, static_cast<ScVObjMode>(nIntVal)); } break; case SCDISPLAYOPT_CHART: @@ -408,7 +408,7 @@ ScViewCfg::ScViewCfg() : //#i80528# adapt to new range eventually if(sal_Int32(VOBJ_MODE_HIDE) < nIntVal) nIntVal = sal_Int32(VOBJ_MODE_SHOW); - SetObjMode( VOBJ_TYPE_CHART, (ScVObjMode)nIntVal); + SetObjMode( VOBJ_TYPE_CHART, static_cast<ScVObjMode>(nIntVal)); } break; case SCDISPLAYOPT_DRAWING: @@ -417,7 +417,7 @@ ScViewCfg::ScViewCfg() : //#i80528# adapt to new range eventually if(sal_Int32(VOBJ_MODE_HIDE) < nIntVal) nIntVal = sal_Int32(VOBJ_MODE_SHOW); - SetObjMode( VOBJ_TYPE_DRAW, (ScVObjMode)nIntVal); + SetObjMode( VOBJ_TYPE_DRAW, static_cast<ScVObjMode>(nIntVal)); } break; } diff --git a/sc/source/filter/excel/impop.cxx b/sc/source/filter/excel/impop.cxx index 757fae01f575..f1d8e21adb22 100644 --- a/sc/source/filter/excel/impop.cxx +++ b/sc/source/filter/excel/impop.cxx @@ -1188,7 +1188,7 @@ void ImportExcel::Bof5() } if( nVers == 0x0600 && (GetBiff() == EXC_BIFF8) ) - eDatei = ( BiffTyp ) ( eDatei - Biff5 + Biff8 ); + eDatei = static_cast<BiffTyp>( eDatei - Biff5 + Biff8 ); pExcRoot->eDateiTyp = eDatei; } diff --git a/sc/source/filter/excel/tokstack.cxx b/sc/source/filter/excel/tokstack.cxx index 0b6ea60ebbeb..01cf12452ec0 100644 --- a/sc/source/filter/excel/tokstack.cxx +++ b/sc/source/filter/excel/tokstack.cxx @@ -398,7 +398,7 @@ bool TokenPool::GetElementRek( const sal_uInt16 nId ) } } else // elementary SC_Token - pScToken->AddOpCode( ( DefTokenId ) ( *pAkt - nScTokenOff ) ); + pScToken->AddOpCode( static_cast<DefTokenId>( *pAkt - nScTokenOff ) ); } #ifdef DBG_UTIL @@ -707,7 +707,7 @@ bool TokenPool::IsSingleOp( const TokenId& rId, const DefTokenId eId ) const sal_uInt16 nSecId = pP_Id[ nPid ]; if( nSecId >= nScTokenOff ) {// Default-Token? - return ( DefTokenId ) ( nSecId - nScTokenOff ) == eId; // wanted? + return static_cast<DefTokenId>( nSecId - nScTokenOff ) == eId; // wanted? } } } diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx index 35c27f948e6e..39b50fc22432 100644 --- a/sc/source/filter/excel/xiescher.cxx +++ b/sc/source/filter/excel/xiescher.cxx @@ -1511,7 +1511,7 @@ void XclImpTextObj::DoPreProcessSdrObj( XclImpDffConverter& rDffConv, SdrObject& case EXC_OBJ_HOR_RIGHT: eVerAlign = SDRTEXTVERTADJUST_BOTTOM; break; case EXC_OBJ_HOR_JUSTIFY: eVerAlign = SDRTEXTVERTADJUST_BLOCK; break; } - MSO_Anchor eTextAnchor = (MSO_Anchor)rDffConv.GetPropertyValue( DFF_Prop_anchorText, mso_anchorTop ); + MSO_Anchor eTextAnchor = static_cast<MSO_Anchor>(rDffConv.GetPropertyValue( DFF_Prop_anchorText, mso_anchorTop )); switch( eTextAnchor ) { case mso_anchorTopCentered : @@ -1551,7 +1551,7 @@ void XclImpTextObj::DoPreProcessSdrObj( XclImpDffConverter& rDffConv, SdrObject& case EXC_OBJ_HOR_RIGHT: eVerAlign = SDRTEXTVERTADJUST_TOP; break; case EXC_OBJ_HOR_JUSTIFY: eVerAlign = SDRTEXTVERTADJUST_BLOCK; break; } - MSO_Anchor eTextAnchor = (MSO_Anchor)rDffConv.GetPropertyValue( DFF_Prop_anchorText, mso_anchorTop ); + MSO_Anchor eTextAnchor = static_cast<MSO_Anchor>(rDffConv.GetPropertyValue( DFF_Prop_anchorText, mso_anchorTop )); switch ( eTextAnchor ) { case mso_anchorTopCentered : diff --git a/sc/source/filter/rtf/eeimpars.cxx b/sc/source/filter/rtf/eeimpars.cxx index b5175a5f669f..267c84d7cf80 100644 --- a/sc/source/filter/rtf/eeimpars.cxx +++ b/sc/source/filter/rtf/eeimpars.cxx @@ -192,7 +192,7 @@ void ScEEImport::WriteToDocument( bool bSizeColsRows, double nOutputFactor, SvNu { if ( nId == EE_CHAR_ESCAPEMENT ) // Super-/Subscript always via EE { - if ( (SvxEscapement)static_cast<const SvxEscapementItem*>(pItem)->GetEnumValue() + if ( static_cast<SvxEscapement>(static_cast<const SvxEscapementItem*>(pItem)->GetEnumValue()) != SvxEscapement::Off ) bSimple = false; } diff --git a/sc/source/filter/xml/xmldrani.cxx b/sc/source/filter/xml/xmldrani.cxx index e513d4e8c0f7..9e88a8943a95 100644 --- a/sc/source/filter/xml/xmldrani.cxx +++ b/sc/source/filter/xml/xmldrani.cxx @@ -360,7 +360,7 @@ std::unique_ptr<ScDBData> ScXMLDatabaseRangeContext::ConvertToDBData(const OUStr for (SCCOL i = 0; i < nCount; ++i) { aParam.pSubTotals[nPos][i] = static_cast<SCCOL>(pAry[i].Column); - aParam.pFunctions[nPos][i] = ScDPUtil::toSubTotalFunc((ScGeneralFunction)pAry[i].Function); + aParam.pFunctions[nPos][i] = ScDPUtil::toSubTotalFunc(static_cast<ScGeneralFunction>(pAry[i].Function)); } } else diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx index a6c1cd6662bb..6bb119ec345b 100644 --- a/sc/source/ui/app/scmod.cxx +++ b/sc/source/ui/app/scmod.cxx @@ -408,7 +408,7 @@ void ScModule::Execute( SfxRequest& rReq ) const SfxPoolItem* pItem; if ( pReqArgs && SfxItemState::SET == pReqArgs->GetItemState( nSlot, true, &pItem ) ) { - FieldUnit eUnit = (FieldUnit)static_cast<const SfxUInt16Item*>(pItem)->GetValue(); + FieldUnit eUnit = static_cast<FieldUnit>(static_cast<const SfxUInt16Item*>(pItem)->GetValue()); switch( eUnit ) { case FUNIT_MM: // Just the units that are also in the dialog @@ -952,7 +952,7 @@ void ScModule::ModifyOptions( const SfxItemSet& rOptSet ) if (rOptSet.HasItem(SID_ATTR_METRIC, &pItem)) { PutItem( *pItem ); - pAppCfg->SetAppMetric( (FieldUnit)static_cast<const SfxUInt16Item*>(pItem)->GetValue() ); + pAppCfg->SetAppMetric( static_cast<FieldUnit>(static_cast<const SfxUInt16Item*>(pItem)->GetValue()) ); bSaveAppOptions = true; } diff --git a/sc/source/ui/condformat/condformatdlgentry.cxx b/sc/source/ui/condformat/condformatdlgentry.cxx index b68e99c1d171..230deaa5df6a 100644 --- a/sc/source/ui/condformat/condformatdlgentry.cxx +++ b/sc/source/ui/condformat/condformatdlgentry.cxx @@ -480,7 +480,7 @@ void StyleSelect( ListBox& rLbStyle, const ScDocument* pDoc, SvxFontPrevWindow& if(rLbStyle.GetSelectedEntryPos() == 0) { // call new style dialog - SfxUInt16Item aFamilyItem( SID_STYLE_FAMILY, (sal_uInt16) SfxStyleFamily::Para ); + SfxUInt16Item aFamilyItem( SID_STYLE_FAMILY, sal_uInt16(SfxStyleFamily::Para) ); SfxStringItem aRefItem( SID_STYLE_REFERENCE, ScGlobal::GetRscString(STR_STYLENAME_STANDARD) ); // unlock the dispatcher so SID_STYLE_NEW can be executed diff --git a/sc/source/ui/dbgui/filtdlg.cxx b/sc/source/ui/dbgui/filtdlg.cxx index 00fba720a865..53c77d2aa706 100644 --- a/sc/source/ui/dbgui/filtdlg.cxx +++ b/sc/source/ui/dbgui/filtdlg.cxx @@ -741,7 +741,7 @@ IMPL_LINK( ScFilterDlg, LbSelectHdl, ListBox&, rLb, void ) const sal_Int32 nConnect1 = pLbConnect1->GetSelectedEntryPos(); size_t nQE = nOffset; - theQueryData.GetEntry(nQE).eConnect =(ScQueryConnect)nConnect1; + theQueryData.GetEntry(nQE).eConnect =static_cast<ScQueryConnect>(nConnect1); if (maRefreshExceptQuery.size() < nQE + 1) maRefreshExceptQuery.resize(nQE + 1, false); maRefreshExceptQuery[nQE] = true; @@ -755,7 +755,7 @@ IMPL_LINK( ScFilterDlg, LbSelectHdl, ListBox&, rLb, void ) const sal_Int32 nConnect2 = pLbConnect2->GetSelectedEntryPos(); size_t nQE = 1+nOffset; - theQueryData.GetEntry(nQE).eConnect =(ScQueryConnect)nConnect2; + theQueryData.GetEntry(nQE).eConnect =static_cast<ScQueryConnect>(nConnect2); if (maRefreshExceptQuery.size() < nQE + 1) maRefreshExceptQuery.resize(nQE + 1, false); maRefreshExceptQuery[nQE]=true; @@ -768,7 +768,7 @@ IMPL_LINK( ScFilterDlg, LbSelectHdl, ListBox&, rLb, void ) const sal_Int32 nConnect3 = pLbConnect3->GetSelectedEntryPos(); size_t nQE = 2 + nOffset; - theQueryData.GetEntry(nQE).eConnect = (ScQueryConnect)nConnect3; + theQueryData.GetEntry(nQE).eConnect = static_cast<ScQueryConnect>(nConnect3); if (maRefreshExceptQuery.size() < nQE + 1) maRefreshExceptQuery.resize(nQE + 1, false); maRefreshExceptQuery[nQE] = true; @@ -782,7 +782,7 @@ IMPL_LINK( ScFilterDlg, LbSelectHdl, ListBox&, rLb, void ) const sal_Int32 nConnect4 = pLbConnect4->GetSelectedEntryPos(); size_t nQE = 3 + nOffset; - theQueryData.GetEntry(nQE).eConnect = (ScQueryConnect)nConnect4; + theQueryData.GetEntry(nQE).eConnect = static_cast<ScQueryConnect>(nConnect4); if (maRefreshExceptQuery.size() < nQE + 1) maRefreshExceptQuery.resize(nQE + 1, false); maRefreshExceptQuery[nQE] = true; @@ -959,22 +959,22 @@ IMPL_LINK( ScFilterDlg, LbSelectHdl, ListBox&, rLb, void ) } else if ( &rLb == pLbCond1) { - theQueryData.GetEntry(nOffset).eOp=(ScQueryOp)rLb.GetSelectedEntryPos(); + theQueryData.GetEntry(nOffset).eOp=static_cast<ScQueryOp>(rLb.GetSelectedEntryPos()); } else if ( &rLb == pLbCond2) { sal_uInt16 nQ=1+nOffset; - theQueryData.GetEntry(nQ).eOp=(ScQueryOp)rLb.GetSelectedEntryPos(); + theQueryData.GetEntry(nQ).eOp=static_cast<ScQueryOp>(rLb.GetSelectedEntryPos()); } else if ( &rLb == pLbCond3) { sal_uInt16 nQ=2+nOffset; - theQueryData.GetEntry(nQ).eOp=(ScQueryOp)rLb.GetSelectedEntryPos(); + theQueryData.GetEntry(nQ).eOp=static_cast<ScQueryOp>(rLb.GetSelectedEntryPos()); } else { sal_uInt16 nQ=3+nOffset; - theQueryData.GetEntry(nQ).eOp=(ScQueryOp)rLb.GetSelectedEntryPos(); + theQueryData.GetEntry(nQ).eOp=static_cast<ScQueryOp>(rLb.GetSelectedEntryPos()); } } @@ -1090,7 +1090,7 @@ IMPL_LINK( ScFilterDlg, ValModifyHdl, Edit&, rEd, void ) rEntry.nField = nField ? (theQueryData.nCol1 + static_cast<SCCOL>(nField) - 1) : static_cast<SCCOL>(0); - ScQueryOp eOp = (ScQueryOp)pLbCond->GetSelectedEntryPos(); + ScQueryOp eOp = static_cast<ScQueryOp>(pLbCond->GetSelectedEntryPos()); rEntry.eOp = eOp; if (maHasDates[nQE] && !bByEmptyOrNotByEmpty) rItem.meType = ScQueryEntry::ByDate; diff --git a/sc/source/ui/dbgui/pfiltdlg.cxx b/sc/source/ui/dbgui/pfiltdlg.cxx index 6de3a16d1759..331b607df22a 100644 --- a/sc/source/ui/dbgui/pfiltdlg.cxx +++ b/sc/source/ui/dbgui/pfiltdlg.cxx @@ -358,7 +358,7 @@ const ScQueryItem& ScPivotFilterDlg::GetOutputItem() for ( SCSIZE i=0; i<3; i++ ) { const sal_Int32 nField = aFieldLbArr[i]->GetSelectedEntryPos(); - ScQueryOp eOp = (ScQueryOp)aCondLbArr[i]->GetSelectedEntryPos(); + ScQueryOp eOp = static_cast<ScQueryOp>(aCondLbArr[i]->GetSelectedEntryPos()); bool bDoThis = (aFieldLbArr[i]->GetSelectedEntryPos() != 0); theParam.GetEntry(i).bDoQuery = bDoThis; @@ -399,10 +399,10 @@ const ScQueryItem& ScPivotFilterDlg::GetOutputItem() } theParam.GetEntry(1).eConnect = (nConnect1 != LISTBOX_ENTRY_NOTFOUND) - ? (ScQueryConnect)nConnect1 + ? static_cast<ScQueryConnect>(nConnect1) : SC_AND; theParam.GetEntry(2).eConnect = (nConnect2 != LISTBOX_ENTRY_NOTFOUND) - ? (ScQueryConnect)nConnect2 + ? static_cast<ScQueryConnect>(nConnect2) : SC_AND; theParam.bInplace = false; diff --git a/sc/source/ui/dbgui/validate.cxx b/sc/source/ui/dbgui/validate.cxx index 9a0591db642a..15fee73d70b6 100644 --- a/sc/source/ui/dbgui/validate.cxx +++ b/sc/source/ui/dbgui/validate.cxx @@ -832,7 +832,7 @@ bool ScTPValidationError::FillItemSet( SfxItemSet* rArgSet ) IMPL_LINK_NOARG(ScTPValidationError, SelectActionHdl, ListBox&, void) { - ScValidErrorStyle eStyle = (ScValidErrorStyle) m_pLbAction->GetSelectedEntryPos(); + ScValidErrorStyle eStyle = static_cast<ScValidErrorStyle>(m_pLbAction->GetSelectedEntryPos()); bool bMacro = ( eStyle == SC_VALERR_MACRO ); m_pBtnSearch->Enable( bMacro ); diff --git a/sc/source/ui/docshell/externalrefmgr.cxx b/sc/source/ui/docshell/externalrefmgr.cxx index bceb7286dbb7..561d1c6fc60b 100644 --- a/sc/source/ui/docshell/externalrefmgr.cxx +++ b/sc/source/ui/docshell/externalrefmgr.cxx @@ -875,7 +875,7 @@ void ScExternalRefCache::setCellRangeData(sal_uInt16 nFileId, const ScRange& rRa else { FormulaError nErr = GetDoubleErrorValue( pMat->GetDouble(0,0)); - SAL_WARN("sc.ui","ScExternalRefCache::setCellRangeData - matrix error value is " << (int)nErr << + SAL_WARN("sc.ui","ScExternalRefCache::setCellRangeData - matrix error value is " << static_cast<int>(nErr) << (nErr == FormulaError::MatrixSize ? ", ok" : ", not ok")); } } diff --git a/sc/source/ui/drawfunc/drtxtob.cxx b/sc/source/ui/drawfunc/drtxtob.cxx index 3e428992b63e..6d718002f33f 100644 --- a/sc/source/ui/drawfunc/drtxtob.cxx +++ b/sc/source/ui/drawfunc/drtxtob.cxx @@ -724,8 +724,7 @@ void ScDrawTextObjectBar::ExecuteAttr( SfxRequest &rReq ) case SID_SET_SUPER_SCRIPT: { SvxEscapementItem aItem(EE_CHAR_ESCAPEMENT); - SvxEscapement eEsc = (SvxEscapement) - aEditAttr.Get( EE_CHAR_ESCAPEMENT ).GetEnumValue(); + SvxEscapement eEsc = static_cast<SvxEscapement>(aEditAttr.Get( EE_CHAR_ESCAPEMENT ).GetEnumValue()); if( eEsc == SvxEscapement::Superscript ) aItem.SetEscapement( SvxEscapement::Off ); @@ -738,8 +737,7 @@ void ScDrawTextObjectBar::ExecuteAttr( SfxRequest &rReq ) case SID_SET_SUB_SCRIPT: { SvxEscapementItem aItem(EE_CHAR_ESCAPEMENT); - SvxEscapement eEsc = (SvxEscapement) - aEditAttr.Get( EE_CHAR_ESCAPEMENT ).GetEnumValue(); + SvxEscapement eEsc = static_cast<SvxEscapement>(aEditAttr.Get( EE_CHAR_ESCAPEMENT ).GetEnumValue()); if( eEsc == SvxEscapement::Subscript ) aItem.SetEscapement( SvxEscapement::Off ); @@ -1096,7 +1094,7 @@ void ScDrawTextObjectBar::GetAttrState( SfxItemSet& rDestSet ) // super-/subscript - SvxEscapement eEsc = (SvxEscapement) aAttrSet.Get( EE_CHAR_ESCAPEMENT ).GetEnumValue(); + SvxEscapement eEsc = static_cast<SvxEscapement>(aAttrSet.Get( EE_CHAR_ESCAPEMENT ).GetEnumValue()); if( eEsc == SvxEscapement::Superscript ) rDestSet.Put( SfxBoolItem( SID_SET_SUPER_SCRIPT, true ) ); else if( eEsc == SvxEscapement::Subscript ) diff --git a/sc/source/ui/drawfunc/fuconuno.cxx b/sc/source/ui/drawfunc/fuconuno.cxx index 6fe1bcd9bfae..619ad1c4f79d 100644 --- a/sc/source/ui/drawfunc/fuconuno.cxx +++ b/sc/source/ui/drawfunc/fuconuno.cxx @@ -31,7 +31,7 @@ FuConstUnoControl::FuConstUnoControl(ScTabViewShell* pViewSh, vcl::Window* pWin, const SfxUInt32Item* pInventorItem = rReq.GetArg<SfxUInt32Item>(SID_FM_CONTROL_INVENTOR); const SfxUInt16Item* pIdentifierItem = rReq.GetArg<SfxUInt16Item>(SID_FM_CONTROL_IDENTIFIER); if( pInventorItem ) - nInventor = (SdrInventor)pInventorItem->GetValue(); + nInventor = static_cast<SdrInventor>(pInventorItem->GetValue()); if( pIdentifierItem ) nIdentifier = pIdentifierItem->GetValue(); } diff --git a/sc/source/ui/miscdlgs/acredlin.cxx b/sc/source/ui/miscdlgs/acredlin.cxx index c1edb5cc8082..45c75bcd007f 100644 --- a/sc/source/ui/miscdlgs/acredlin.cxx +++ b/sc/source/ui/miscdlgs/acredlin.cxx @@ -220,7 +220,7 @@ void ScAcceptChgDlg::Init() pTPFilter->SetFirstTime(aChangeViewSet.GetTheFirstDateTime()); pTPFilter->SetLastDate(aChangeViewSet.GetTheLastDateTime()); pTPFilter->SetLastTime(aChangeViewSet.GetTheLastDateTime()); - pTPFilter->SetDateMode((sal_uInt16)aChangeViewSet.GetTheDateMode()); + pTPFilter->SetDateMode(static_cast<sal_uInt16>(aChangeViewSet.GetTheDateMode())); pTPFilter->CheckComment(aChangeViewSet.HasComment()); pTPFilter->SetComment(aChangeViewSet.GetTheComment()); diff --git a/sc/source/ui/miscdlgs/highred.cxx b/sc/source/ui/miscdlgs/highred.cxx index 0a1d7f537f35..9601a7c68195 100644 --- a/sc/source/ui/miscdlgs/highred.cxx +++ b/sc/source/ui/miscdlgs/highred.cxx @@ -101,7 +101,7 @@ void ScHighlightChgDlg::Init() m_pFilterCtr->SetFirstTime(aChangeViewSet.GetTheFirstDateTime()); m_pFilterCtr->SetLastDate(aChangeViewSet.GetTheLastDateTime()); m_pFilterCtr->SetLastTime(aChangeViewSet.GetTheLastDateTime()); - m_pFilterCtr->SetDateMode((sal_uInt16)aChangeViewSet.GetTheDateMode()); + m_pFilterCtr->SetDateMode(static_cast<sal_uInt16>(aChangeViewSet.GetTheDateMode())); m_pFilterCtr->CheckAuthor(aChangeViewSet.HasAuthor()); m_pFilterCtr->CheckComment(aChangeViewSet.HasComment()); m_pFilterCtr->SetComment(aChangeViewSet.GetTheComment()); diff --git a/sc/source/ui/miscdlgs/tabopdlg.cxx b/sc/source/ui/miscdlgs/tabopdlg.cxx index cee7b8ea075c..50bfa8180ec9 100644 --- a/sc/source/ui/miscdlgs/tabopdlg.cxx +++ b/sc/source/ui/miscdlgs/tabopdlg.cxx @@ -305,7 +305,7 @@ IMPL_LINK( ScTabOpDlg, BtnHdl, Button*, pBtn, void ) } if (nError) - RaiseError( (ScTabOpErr) nError ); + RaiseError( static_cast<ScTabOpErr>(nError) ); else { ScTabOpParam aOutParam(theFormulaCell, theFormulaEnd, theRowCell, theColCell, eMode); diff --git a/sc/source/ui/miscdlgs/textdlgs.cxx b/sc/source/ui/miscdlgs/textdlgs.cxx index afaf95393b57..5e06e95ddf6c 100644 --- a/sc/source/ui/miscdlgs/textdlgs.cxx +++ b/sc/source/ui/miscdlgs/textdlgs.cxx @@ -85,7 +85,7 @@ void ScParagraphDlg::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool())); TabulatorDisableFlags const nFlags((TabulatorDisableFlags::TypeMask &~TabulatorDisableFlags::TypeLeft) | (TabulatorDisableFlags::FillMask &~TabulatorDisableFlags::FillNone)); - aSet.Put(SfxUInt16Item(SID_SVXTABULATORTABPAGE_DISABLEFLAGS, (sal_uInt16)nFlags)); + aSet.Put(SfxUInt16Item(SID_SVXTABULATORTABPAGE_DISABLEFLAGS, static_cast<sal_uInt16>(nFlags))); rPage.PageCreated(aSet); } } diff --git a/sc/source/ui/navipi/content.cxx b/sc/source/ui/navipi/content.cxx index 4b14ddf3add9..6f662e16cc4e 100644 --- a/sc/source/ui/navipi/content.cxx +++ b/sc/source/ui/navipi/content.cxx @@ -65,7 +65,7 @@ using namespace com::sun::star; // order of the categories in navigator ------------------------------------- -static const ScContentId pTypeList[(int)ScContentId::LAST + 1] = +static const ScContentId pTypeList[int(ScContentId::LAST) + 1] = { ScContentId::ROOT, // ROOT (0) has to be at the front ScContentId::TABLE, @@ -132,12 +132,12 @@ ScContentTree::ScContentTree(vcl::Window* pParent, ScNavigatorDlg* pNavigatorDlg , bisInNavigatoeDlg(false) { SetQuickSearch(true); - for (sal_uInt16 i = 0; i <= (int)ScContentId::LAST; ++i) + for (sal_uInt16 i = 0; i <= int(ScContentId::LAST); ++i) pPosList[pTypeList[i]] = i; // inverse for searching pRootNodes[ScContentId::ROOT] = nullptr; - for (sal_uInt16 i = 1; i < (int)ScContentId::LAST; ++i) - InitRoot((ScContentId)i); + for (sal_uInt16 i = 1; i < int(ScContentId::LAST); ++i) + InitRoot(static_cast<ScContentId>(i)); SetNodeDefaultImages(); @@ -249,9 +249,9 @@ void ScContentTree::InitRoot( ScContentId nType ) return; } - BitmapEx aBitmap(aContentBmps[(int)nType - 1]); + BitmapEx aBitmap(aContentBmps[static_cast<int>(nType) - 1]); Image aImage(aBitmap); - OUString aName(ScResId(SCSTR_CONTENT_ARY[(int)nType])); + OUString aName(ScResId(SCSTR_CONTENT_ARY[static_cast<int>(nType)])); // back to the correct position: sal_uInt16 nPos = nRootType != ScContentId::ROOT ? 0 : pPosList[nType]-1; SvTreeListEntry* pNew = InsertEntry( aName, aImage, aImage, nullptr, false, nPos ); @@ -270,8 +270,8 @@ void ScContentTree::ClearAll() Control::SetUpdateMode(false); Clear(); Control::SetUpdateMode(bOldUpdate); - for (sal_uInt16 i=1; i<=(int)ScContentId::LAST; i++) - InitRoot((ScContentId)i); + for (sal_uInt16 i=1; i<=int(ScContentId::LAST); i++) + InitRoot(static_cast<ScContentId>(i)); } void ScContentTree::ClearType(ScContentId nType) @@ -311,9 +311,9 @@ void ScContentTree::GetEntryIndexes( ScContentId& rnRootIndex, sal_uLong& rnChil SvTreeListEntry* pParent = GetParent( pEntry ); bool bFound = false; - for( int i = 1; !bFound && (i <= (int)ScContentId::LAST); ++i ) + for( int i = 1; !bFound && (i <= int(ScContentId::LAST)); ++i ) { - ScContentId nRoot = (ScContentId)i; + ScContentId nRoot = static_cast<ScContentId>(i); if( pEntry == pRootNodes[ nRoot ] ) { rnRootIndex = nRoot; @@ -1522,9 +1522,9 @@ void ScContentTree::ToggleRoot() // after selection if (pEntry) { SvTreeListEntry* pParent = GetParent(pEntry); - for (sal_uInt16 i=1; i<=(int)ScContentId::LAST; i++) - if ( pEntry == pRootNodes[(ScContentId)i] || pParent == pRootNodes[(ScContentId)i] ) - nNew = (ScContentId)i; + for (sal_uInt16 i=1; i<=int(ScContentId::LAST); i++) + if ( pEntry == pRootNodes[static_cast<ScContentId>(i)] || pParent == pRootNodes[static_cast<ScContentId>(i)] ) + nNew = static_cast<ScContentId>(i); } } @@ -1671,9 +1671,9 @@ void ScContentTree::ApplyNavigatorSettings() ScContentId nRootSel = pSettings->GetRootSelected(); sal_uLong nChildSel = pSettings->GetChildSelected(); - for( int i = 1; i <= (int)ScContentId::LAST; ++i ) + for( int i = 1; i <= int(ScContentId::LAST); ++i ) { - ScContentId nEntry = (ScContentId)i; + ScContentId nEntry = static_cast<ScContentId>(i); if( pRootNodes[ nEntry ] ) { // expand @@ -1704,9 +1704,9 @@ void ScContentTree::StoreNavigatorSettings() const ScNavigatorSettings* pSettings = ScNavigatorDlg::GetNavigatorSettings(); if( pSettings ) { - for( int i = 1; i <= (int)ScContentId::LAST; ++i ) + for( int i = 1; i <= int(ScContentId::LAST); ++i ) { - ScContentId nEntry = (ScContentId)i; + ScContentId nEntry = static_cast<ScContentId>(i); bool bExp = pRootNodes[ nEntry ] && IsExpanded( pRootNodes[ nEntry ] ); pSettings->SetExpanded( nEntry, bExp ); } diff --git a/sc/source/ui/navipi/navipi.cxx b/sc/source/ui/navipi/navipi.cxx index 46fc019c6618..bd6c65810f02 100644 --- a/sc/source/ui/navipi/navipi.cxx +++ b/sc/source/ui/navipi/navipi.cxx @@ -556,7 +556,7 @@ ScNavigatorDlg::ScNavigatorDlg(SfxBindings* pB, vcl::Window* pParent) aLbEntries->SetNavigatorDlgFlag(true); // if scenario was active, switch on - NavListMode eNavMode = (NavListMode) rCfg.GetListMode(); + NavListMode eNavMode = static_cast<NavListMode>(rCfg.GetListMode()); if (eNavMode == NAV_LMODE_SCENARIOS) aTbxCmd->CheckItem(nScenarioId); else diff --git a/sc/source/ui/optdlg/calcoptionsdlg.cxx b/sc/source/ui/optdlg/calcoptionsdlg.cxx index 82c74d735f59..4bb17dea3e22 100644 --- a/sc/source/ui/optdlg/calcoptionsdlg.cxx +++ b/sc/source/ui/optdlg/calcoptionsdlg.cxx @@ -143,7 +143,7 @@ IMPL_LINK(ScCalcOptionsDialog, AsZeroModifiedHdl, Button*, pCheckBox, void ) IMPL_LINK(ScCalcOptionsDialog, ConversionModifiedHdl, ListBox&, rConv, void ) { - maConfig.meStringConversion = (ScCalcConfig::StringConversion)rConv.GetSelectedEntryPos(); + maConfig.meStringConversion = static_cast<ScCalcConfig::StringConversion>(rConv.GetSelectedEntryPos()); CoupleEmptyAsZeroToStringConversion(); } diff --git a/sc/source/ui/optdlg/tpview.cxx b/sc/source/ui/optdlg/tpview.cxx index e9d4a1006693..7a4b999cf969 100644 --- a/sc/source/ui/optdlg/tpview.cxx +++ b/sc/source/ui/optdlg/tpview.cxx @@ -528,11 +528,11 @@ void ScTpLayoutOptions::Reset( const SfxItemSet* rCoreSet ) if ( rCoreSet->GetItemState( SID_ATTR_METRIC ) >= SfxItemState::DEFAULT ) { const SfxUInt16Item& rItem = static_cast<const SfxUInt16Item&>(rCoreSet->Get( SID_ATTR_METRIC )); - FieldUnit eFieldUnit = (FieldUnit)rItem.GetValue(); + FieldUnit eFieldUnit = static_cast<FieldUnit>(rItem.GetValue()); for ( sal_Int32 i = 0; i < m_pUnitLB->GetEntryCount(); ++i ) { - if ( (FieldUnit)reinterpret_cast<sal_IntPtr>(m_pUnitLB->GetEntryData( i )) == eFieldUnit ) + if ( static_cast<FieldUnit>(reinterpret_cast<sal_IntPtr>(m_pUnitLB->GetEntryData( i ))) == eFieldUnit ) { m_pUnitLB->SelectEntryPos( i ); break; @@ -639,7 +639,7 @@ IMPL_LINK_NOARG(ScTpLayoutOptions, MetricHdl, ListBox&, void) const sal_Int32 nMPos = m_pUnitLB->GetSelectedEntryPos(); if(nMPos != LISTBOX_ENTRY_NOTFOUND) { - FieldUnit eFieldUnit = (FieldUnit)reinterpret_cast<sal_IntPtr>(m_pUnitLB->GetEntryData( nMPos )); + FieldUnit eFieldUnit = static_cast<FieldUnit>(reinterpret_cast<sal_IntPtr>(m_pUnitLB->GetEntryData( nMPos ))); sal_Int64 nVal = m_pTabMF->Denormalize( m_pTabMF->GetValue( FUNIT_TWIP ) ); ::SetFieldUnit( *m_pTabMF, eFieldUnit ); diff --git a/sc/source/ui/undo/undocell.cxx b/sc/source/ui/undo/undocell.cxx index 972b8d76032f..159eb1df675f 100644 --- a/sc/source/ui/undo/undocell.cxx +++ b/sc/source/ui/undo/undocell.cxx @@ -890,7 +890,7 @@ OUString ScUndoDetective::GetComment() const { const char* pId = STR_UNDO_DETDELALL; if ( !bIsDelete ) - switch ( (ScDetOpType) nAction ) + switch ( static_cast<ScDetOpType>(nAction) ) { case SCDETOP_ADDSUCC: pId = STR_UNDO_DETADDSUCC; break; case SCDETOP_DELSUCC: pId = STR_UNDO_DETDELSUCC; break; @@ -923,7 +923,7 @@ void ScUndoDetective::Undo() { ScDetOpDataVector& rVec = pList->GetDataVector(); ScDetOpDataVector::iterator it = rVec.begin() + rVec.size() - 1; - if ( (*it)->GetOperation() == (ScDetOpType) nAction && (*it)->GetPos() == aPos ) + if ( (*it)->GetOperation() == static_cast<ScDetOpType>(nAction) && (*it)->GetPos() == aPos ) rVec.erase( it); else { @@ -950,7 +950,7 @@ void ScUndoDetective::Redo() if (bIsDelete) rDoc.ClearDetectiveOperations(); else - rDoc.AddDetectiveOperation( ScDetOpData( aPos, (ScDetOpType) nAction ) ); + rDoc.AddDetectiveOperation( ScDetOpData( aPos, static_cast<ScDetOpType>(nAction) ) ); ScTabViewShell* pViewShell = ScTabViewShell::GetActiveViewShell(); if (pViewShell) diff --git a/sc/source/ui/unoobj/appluno.cxx b/sc/source/ui/unoobj/appluno.cxx index ead9147989e5..b7693703dc07 100644 --- a/sc/source/ui/unoobj/appluno.cxx +++ b/sc/source/ui/unoobj/appluno.cxx @@ -306,7 +306,7 @@ void SAL_CALL ScSpreadsheetSettings::setPropertyValue( } else if (aPropertyName == SC_UNONAME_METRIC) { - aAppOpt.SetAppMetric( (FieldUnit) ScUnoHelpFunctions::GetInt16FromAny( aValue ) ); + aAppOpt.SetAppMetric( static_cast<FieldUnit>(ScUnoHelpFunctions::GetInt16FromAny( aValue )) ); bSaveApp = true; } else if (aPropertyName == SC_UNONAME_MOVEDIR) diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index a6c4172c0c80..2ee12640cd04 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -1831,7 +1831,7 @@ double SAL_CALL ScCellRangesBase::computeFunction( sheet::GeneralFunction nFunct ScAddress aDummy; // if not marked, ignored if it is negative double fVal; - ScSubTotalFunc eFunc = ScDPUtil::toSubTotalFunc((ScGeneralFunction)nFunction); + ScSubTotalFunc eFunc = ScDPUtil::toSubTotalFunc(static_cast<ScGeneralFunction>(nFunction)); ScDocument& rDoc = pDocShell->GetDocument(); if ( !rDoc.GetSelectionFunction( eFunc, aDummy, aMark, fVal ) ) { @@ -6436,7 +6436,7 @@ sal_Int32 SAL_CALL ScCellObj::getError() if (aCell.meType == CELLTYPE_FORMULA) nError = aCell.mpFormula->GetErrCode(); - return (sal_Int32)nError; + return static_cast<sal_Int32>(nError); } // XFormulaTokens diff --git a/sc/source/ui/unoobj/chartuno.cxx b/sc/source/ui/unoobj/chartuno.cxx index 556e4aef5bce..105d4e0fbc04 100644 --- a/sc/source/ui/unoobj/chartuno.cxx +++ b/sc/source/ui/unoobj/chartuno.cxx @@ -464,7 +464,7 @@ void ScChartObj::GetData_Impl( ScRangeListRef& rRanges, bool& rColHeaders, bool& if (aPropName == "CellRangeRepresentation") rProp.Value >>= aRanges; else if (aPropName == "DataRowSource") - eDataRowSource = (chart::ChartDataRowSource)ScUnoHelpFunctions::GetEnumFromAny( rProp.Value ); + eDataRowSource = static_cast<chart::ChartDataRowSource>(ScUnoHelpFunctions::GetEnumFromAny( rProp.Value )); else if (aPropName == "HasCategories") bHasCategories = ScUnoHelpFunctions::GetBoolFromAny( rProp.Value ); else if (aPropName == "FirstCellAsLabel") diff --git a/sc/source/ui/unoobj/confuno.cxx b/sc/source/ui/unoobj/confuno.cxx index 6894813441e4..01528c65697c 100644 --- a/sc/source/ui/unoobj/confuno.cxx +++ b/sc/source/ui/unoobj/confuno.cxx @@ -280,7 +280,7 @@ void SAL_CALL ScDocumentConfiguration::setPropertyValue( { // Int16 contains CharacterCompressionType values sal_Int16 nUno = ScUnoHelpFunctions::GetInt16FromAny( aValue ); - rDoc.SetAsianCompression( (CharCompressType) nUno ); + rDoc.SetAsianCompression( static_cast<CharCompressType>(nUno) ); bUpdateHeights = true; } else if ( aPropertyName == SC_UNO_ASIANKERN ) diff --git a/sc/source/ui/unoobj/dapiuno.cxx b/sc/source/ui/unoobj/dapiuno.cxx index a96b35cd0d48..51749deec887 100644 --- a/sc/source/ui/unoobj/dapiuno.cxx +++ b/sc/source/ui/unoobj/dapiuno.cxx @@ -1806,13 +1806,12 @@ void SAL_CALL ScDataPilotFieldObj::setPropertyValue( const OUString& aPropertyNa if ( aPropertyName == SC_UNONAME_FUNCTION ) { // #i109350# use GetEnumFromAny because it also allows sal_Int32 - ScGeneralFunction eFunction = (ScGeneralFunction) - ScUnoHelpFunctions::GetEnumFromAny( aValue ); + ScGeneralFunction eFunction = static_cast<ScGeneralFunction>(ScUnoHelpFunctions::GetEnumFromAny( aValue )); setFunction( eFunction ); } else if ( aPropertyName == SC_UNONAME_FUNCTION2 ) { - ScGeneralFunction eFunction = (ScGeneralFunction)ScUnoHelpFunctions::GetInt16FromAny( aValue ); + ScGeneralFunction eFunction = static_cast<ScGeneralFunction>(ScUnoHelpFunctions::GetInt16FromAny( aValue )); setFunction( eFunction ); } else if ( aPropertyName == SC_UNONAME_SUBTOTALS ) @@ -1845,8 +1844,7 @@ void SAL_CALL ScDataPilotFieldObj::setPropertyValue( const OUString& aPropertyNa else if ( aPropertyName == SC_UNONAME_ORIENT ) { //! test for correct enum type? - DataPilotFieldOrientation eOrient = (DataPilotFieldOrientation) - ScUnoHelpFunctions::GetEnumFromAny( aValue ); + DataPilotFieldOrientation eOrient = static_cast<DataPilotFieldOrientation>(ScUnoHelpFunctions::GetEnumFromAny( aValue )); setOrientation( eOrient ); } else if ( aPropertyName == SC_UNONAME_SELPAGE ) diff --git a/sc/source/ui/unoobj/datauno.cxx b/sc/source/ui/unoobj/datauno.cxx index 4125e91410f7..3127bfee7045 100644 --- a/sc/source/ui/unoobj/datauno.cxx +++ b/sc/source/ui/unoobj/datauno.cxx @@ -231,8 +231,7 @@ void ScImportDescriptor::FillImportParam( ScImportParam& rParam, const uno::Sequ else if (aPropName == SC_UNONAME_SRCTYPE) { //! test for correct enum type? - sheet::DataImportMode eMode = (sheet::DataImportMode) - ScUnoHelpFunctions::GetEnumFromAny( rProp.Value ); + sheet::DataImportMode eMode = static_cast<sheet::DataImportMode>(ScUnoHelpFunctions::GetEnumFromAny( rProp.Value )); switch (eMode) { case sheet::DataImportMode_NONE: @@ -336,8 +335,7 @@ void ScSortDescriptor::FillSortParam( ScSortParam& rParam, const uno::Sequence<b if (aPropName == SC_UNONAME_ORIENT) { //! test for correct enum type? - table::TableOrientation eOrient = (table::TableOrientation) - ScUnoHelpFunctions::GetEnumFromAny( rProp.Value ); + table::TableOrientation eOrient = static_cast<table::TableOrientation>(ScUnoHelpFunctions::GetEnumFromAny( rProp.Value )); rParam.bByRow = ( eOrient != table::TableOrientation_COLUMNS ); } else if (aPropName == SC_UNONAME_ISSORTCOLUMNS) @@ -518,7 +516,7 @@ void SAL_CALL ScSubTotalFieldObj::setSubTotalColumns( for (SCCOL i=0; i<nCount; i++) { aParam.pSubTotals[nPos][i] = static_cast<SCCOL>(pAry[i].Column); - aParam.pFunctions[nPos][i] = ScDPUtil::toSubTotalFunc((ScGeneralFunction)pAry[i].Function); + aParam.pFunctions[nPos][i] = ScDPUtil::toSubTotalFunc(static_cast<ScGeneralFunction>(pAry[i].Function)); } } else @@ -599,7 +597,7 @@ void SAL_CALL ScSubTotalDescriptorBase::addNew( for (SCCOL i=0; i<nCount; i++) { aParam.pSubTotals[nPos][i] = static_cast<SCCOL>(pAry[i].Column); - aParam.pFunctions[nPos][i] = ScDPUtil::toSubTotalFunc((ScGeneralFunction)pAry[i].Function); + aParam.pFunctions[nPos][i] = ScDPUtil::toSubTotalFunc(static_cast<ScGeneralFunction>(pAry[i].Function)); } } else @@ -839,7 +837,7 @@ sheet::GeneralFunction SAL_CALL ScConsolidationDescriptor::getFunction() void SAL_CALL ScConsolidationDescriptor::setFunction( sheet::GeneralFunction nFunction ) { SolarMutexGuard aGuard; - aParam.eFunction = ScDPUtil::toSubTotalFunc((ScGeneralFunction)nFunction); + aParam.eFunction = ScDPUtil::toSubTotalFunc(static_cast<ScGeneralFunction>(nFunction)); } uno::Sequence<table::CellRangeAddress> SAL_CALL ScConsolidationDescriptor::getSources() @@ -1414,8 +1412,7 @@ void SAL_CALL ScFilterDescriptorBase::setPropertyValue( else if (aPropertyName == SC_UNONAME_ORIENT) { //! test for correct enum type? - table::TableOrientation eOrient = (table::TableOrientation) - ScUnoHelpFunctions::GetEnumFromAny( aValue ); + table::TableOrientation eOrient = static_cast<table::TableOrientation>(ScUnoHelpFunctions::GetEnumFromAny( aValue )); aParam.bByRow = ( eOrient != table::TableOrientation_COLUMNS ); } else if (aPropertyName == SC_UNONAME_OUTPOS) diff --git a/sc/source/ui/unoobj/eventuno.cxx b/sc/source/ui/unoobj/eventuno.cxx index 26284a705fe2..6d33ea9c74c5 100644 --- a/sc/source/ui/unoobj/eventuno.cxx +++ b/sc/source/ui/unoobj/eventuno.cxx @@ -146,9 +146,9 @@ uno::Any SAL_CALL ScSheetEventsObj::getByName( const OUString& aName ) uno::Sequence<OUString> SAL_CALL ScSheetEventsObj::getElementNames() { SolarMutexGuard aGuard; - auto aNames = uno::Sequence<OUString>((int)ScSheetEventId::COUNT); - for (sal_Int32 nEvent=0; nEvent<(int)ScSheetEventId::COUNT; ++nEvent) - aNames[nEvent] = ScSheetEvents::GetEventName((ScSheetEventId)nEvent); + auto aNames = uno::Sequence<OUString>(int(ScSheetEventId::COUNT)); + for (sal_Int32 nEvent=0; nEvent<int(ScSheetEventId::COUNT); ++nEvent) + aNames[nEvent] = ScSheetEvents::GetEventName(static_cast<ScSheetEventId>(nEvent)); return aNames; } diff --git a/sc/source/ui/unoobj/fmtuno.cxx b/sc/source/ui/unoobj/fmtuno.cxx index 0c5aef2f3089..7a473cc58c67 100644 --- a/sc/source/ui/unoobj/fmtuno.cxx +++ b/sc/source/ui/unoobj/fmtuno.cxx @@ -263,7 +263,7 @@ void SAL_CALL ScTableConditionalFormat::addNew( if ( rProp.Name == SC_UNONAME_OPERATOR ) { sal_Int32 eOper = ScUnoHelpFunctions::GetEnumFromAny( rProp.Value ); - aEntry.meMode = ScConditionEntry::GetModeFromApi( (sheet::ConditionOperator)eOper ); + aEntry.meMode = ScConditionEntry::GetModeFromApi( static_cast<sheet::ConditionOperator>(eOper) ); } else if ( rProp.Name == SC_UNONAME_FORMULA1 ) { @@ -521,7 +521,7 @@ sal_Int32 SAL_CALL ScTableConditionalEntry::getConditionOperator() void SAL_CALL ScTableConditionalEntry::setConditionOperator( sal_Int32 nOperator ) { SolarMutexGuard aGuard; - aData.meMode = ScConditionEntry::GetModeFromApi( (sheet::ConditionOperator)nOperator ); + aData.meMode = ScConditionEntry::GetModeFromApi( static_cast<sheet::ConditionOperator>(nOperator) ); } OUString SAL_CALL ScTableConditionalEntry::getFormula1() @@ -625,7 +625,7 @@ ScValidationData* ScTableValidationObj::CreateValidationData( ScDocument* pDoc, FormulaGrammar::Grammar eGrammar1 = lclResolveGrammar( eGrammar, meGrammar1 ); FormulaGrammar::Grammar eGrammar2 = lclResolveGrammar( eGrammar, meGrammar2 ); - ScValidationData* pRet = new ScValidationData( (ScValidationMode)nValMode, + ScValidationData* pRet = new ScValidationData( static_cast<ScValidationMode>(nValMode), nMode, aExpr1, aExpr2, pDoc, aSrcPos, maExprNmsp1, maExprNmsp2, @@ -651,7 +651,7 @@ ScValidationData* ScTableValidationObj::CreateValidationData( ScDocument* pDoc, pRet->SetInput( aInputTitle, aInputMessage ); if (!bShowInput) pRet->ResetInput(); - pRet->SetError( aErrorTitle, aErrorMessage, (ScValidErrorStyle)nErrorStyle ); + pRet->SetError( aErrorTitle, aErrorMessage, static_cast<ScValidErrorStyle>(nErrorStyle) ); if (!bShowError) pRet->ResetError(); @@ -709,7 +709,7 @@ sal_Int32 SAL_CALL ScTableValidationObj::getConditionOperator() void SAL_CALL ScTableValidationObj::setConditionOperator( sal_Int32 nOperator ) { SolarMutexGuard aGuard; - nMode = ScConditionEntry::GetModeFromApi( (css::sheet::ConditionOperator)nOperator ); + nMode = ScConditionEntry::GetModeFromApi( static_cast<css::sheet::ConditionOperator>(nOperator) ); } OUString SAL_CALL ScTableValidationObj::getFormula1() @@ -827,8 +827,7 @@ void SAL_CALL ScTableValidationObj::setPropertyValue( } else if ( aPropertyName == SC_UNONAME_TYPE ) { - sheet::ValidationType eType = (sheet::ValidationType) - ScUnoHelpFunctions::GetEnumFromAny( aValue ); + sheet::ValidationType eType = static_cast<sheet::ValidationType>(ScUnoHelpFunctions::GetEnumFromAny( aValue )); switch (eType) { case sheet::ValidationType_ANY: nValMode = SC_VALID_ANY; break; @@ -847,8 +846,7 @@ void SAL_CALL ScTableValidationObj::setPropertyValue( } else if ( aPropertyName == SC_UNONAME_ERRALSTY ) { - sheet::ValidationAlertStyle eStyle = (sheet::ValidationAlertStyle) - ScUnoHelpFunctions::GetEnumFromAny( aValue ); + sheet::ValidationAlertStyle eStyle = static_cast<sheet::ValidationAlertStyle>(ScUnoHelpFunctions::GetEnumFromAny( aValue )); switch (eStyle) { case sheet::ValidationAlertStyle_STOP: nErrorStyle = SC_VALERR_STOP; break; diff --git a/sc/source/ui/unoobj/srchuno.cxx b/sc/source/ui/unoobj/srchuno.cxx index ffd0b1894ca0..92923e8a296f 100644 --- a/sc/source/ui/unoobj/srchuno.cxx +++ b/sc/source/ui/unoobj/srchuno.cxx @@ -169,7 +169,7 @@ uno::Any SAL_CALL ScCellSearchObj::getPropertyValue( const OUString& aPropertyNa else if (aPropertyName == SC_UNO_SRCHSIMADD) aRet <<= static_cast<sal_Int16>(pSearchItem->GetLEVLonger()); else if (aPropertyName == SC_UNO_SRCHSIMEX) aRet <<= static_cast<sal_Int16>(pSearchItem->GetLEVOther()); else if (aPropertyName == SC_UNO_SRCHSIMREM) aRet <<= static_cast<sal_Int16>(pSearchItem->GetLEVShorter()); - else if (aPropertyName == SC_UNO_SRCHTYPE) aRet <<= (sal_Int16) pSearchItem->GetCellType(); + else if (aPropertyName == SC_UNO_SRCHTYPE) aRet <<= static_cast<sal_Int16>(pSearchItem->GetCellType()); else if (aPropertyName == SC_UNO_SRCHFILTERED) aRet <<= pSearchItem->IsSearchFiltered(); else if (aPropertyName == SC_UNO_SRCHFORMATTED) aRet <<= pSearchItem->IsSearchFormatted(); diff --git a/sc/source/ui/unoobj/targuno.cxx b/sc/source/ui/unoobj/targuno.cxx index ed05e87b579c..d3d2deb062de 100644 --- a/sc/source/ui/unoobj/targuno.cxx +++ b/sc/source/ui/unoobj/targuno.cxx @@ -229,7 +229,7 @@ void ScLinkTargetTypeObj::SetLinkTargetBitmap( uno::Any& rRet, sal_uInt16 nType } if (nImgId != ScContentId::ROOT) { - BitmapEx aBitmapEx(aContentBmps[(int)nImgId -1 ]); + BitmapEx aBitmapEx(aContentBmps[static_cast<int>(nImgId) -1 ]); rRet <<= uno::Reference< awt::XBitmap > (VCLUnoHelper::CreateBitmap(aBitmapEx)); } } diff --git a/sc/source/ui/unoobj/viewuno.cxx b/sc/source/ui/unoobj/viewuno.cxx index 511b14ec3498..e2b27fc09b9e 100644 --- a/sc/source/ui/unoobj/viewuno.cxx +++ b/sc/source/ui/unoobj/viewuno.cxx @@ -185,7 +185,7 @@ sal_Int32 SAL_CALL ScViewPaneBase::getFirstVisibleColumn() ScViewData& rViewData = pViewShell->GetViewData(); ScSplitPos eWhich = ( nPane == SC_VIEWPANE_ACTIVE ) ? rViewData.GetActivePart() : - (ScSplitPos) nPane; + static_cast<ScSplitPos>(nPane); ScHSplitPos eWhichH = WhichH( eWhich ); return rViewData.GetPosX( eWhichH ); @@ -202,7 +202,7 @@ void SAL_CALL ScViewPaneBase::setFirstVisibleColumn(sal_Int32 nFirstVisibleColum ScViewData& rViewData = pViewShell->GetViewData(); ScSplitPos eWhich = ( nPane == SC_VIEWPANE_ACTIVE ) ? rViewData.GetActivePart() : - (ScSplitPos) nPane; + static_cast<ScSplitPos>(nPane); ScHSplitPos eWhichH = WhichH( eWhich ); long nDeltaX = static_cast<long>(nFirstVisibleColumn) - rViewData.GetPosX( eWhichH ); @@ -218,7 +218,7 @@ sal_Int32 SAL_CALL ScViewPaneBase::getFirstVisibleRow() ScViewData& rViewData = pViewShell->GetViewData(); ScSplitPos eWhich = ( nPane == SC_VIEWPANE_ACTIVE ) ? rViewData.GetActivePart() : - (ScSplitPos) nPane; + static_cast<ScSplitPos>(nPane); ScVSplitPos eWhichV = WhichV( eWhich ); return rViewData.GetPosY( eWhichV ); @@ -235,7 +235,7 @@ void SAL_CALL ScViewPaneBase::setFirstVisibleRow( sal_Int32 nFirstVisibleRow ) ScViewData& rViewData = pViewShell->GetViewData(); ScSplitPos eWhich = ( nPane == SC_VIEWPANE_ACTIVE ) ? rViewData.GetActivePart() : - (ScSplitPos) nPane; + static_cast<ScSplitPos>(nPane); ScVSplitPos eWhichV = WhichV( eWhich ); long nDeltaY = static_cast<long>(nFirstVisibleRow) - rViewData.GetPosY( eWhichV ); @@ -252,7 +252,7 @@ table::CellRangeAddress SAL_CALL ScViewPaneBase::getVisibleRange() ScViewData& rViewData = pViewShell->GetViewData(); ScSplitPos eWhich = ( nPane == SC_VIEWPANE_ACTIVE ) ? rViewData.GetActivePart() : - (ScSplitPos) nPane; + static_cast<ScSplitPos>(nPane); ScHSplitPos eWhichH = WhichH( eWhich ); ScVSplitPos eWhichV = WhichV( eWhich ); @@ -304,7 +304,7 @@ namespace ScViewData& rViewData = _pViewShell->GetViewData(); ScSplitPos eWhich = ( _nPane == SC_VIEWPANE_ACTIVE ) ? rViewData.GetActivePart() : - (ScSplitPos) _nPane; + static_cast<ScSplitPos>(_nPane); _rpWindow = _pViewShell->GetWindowByPos( eWhich ); _rpSdrView = _pViewShell->GetSdrView(); _rpFormShell = _pViewShell->GetFormShell(); @@ -380,7 +380,7 @@ awt::Rectangle ScViewPaneBase::GetVisArea() const { ScSplitPos eWhich = ( nPane == SC_VIEWPANE_ACTIVE ) ? pViewShell->GetViewData().GetActivePart() : - (ScSplitPos) nPane; + static_cast<ScSplitPos>(nPane); ScGridWindow* pWindow = static_cast<ScGridWindow*>(pViewShell->GetWindowByPos(eWhich)); ScDocument* pDoc = pViewShell->GetViewData().GetDocument(); if (pWindow && pDoc) @@ -1801,7 +1801,7 @@ void SAL_CALL ScTabViewObj::setPropertyValue( //#i80528# adapt to new range eventually if(sal_Int16(VOBJ_MODE_HIDE) < nIntVal) nIntVal = sal_Int16(VOBJ_MODE_SHOW); - aNewOpt.SetObjMode( VOBJ_TYPE_OLE, (ScVObjMode)nIntVal); + aNewOpt.SetObjMode( VOBJ_TYPE_OLE, static_cast<ScVObjMode>(nIntVal)); } } else if ( aPropertyName == SC_UNO_SHOWCHARTS ) @@ -1812,7 +1812,7 @@ void SAL_CALL ScTabViewObj::setPropertyValue( //#i80528# adapt to new range eventually if(sal_Int16(VOBJ_MODE_HIDE) < nIntVal) nIntVal = sal_Int16(VOBJ_MODE_SHOW); - aNewOpt.SetObjMode( VOBJ_TYPE_CHART, (ScVObjMode)nIntVal); + aNewOpt.SetObjMode( VOBJ_TYPE_CHART, static_cast<ScVObjMode>(nIntVal)); } } else if ( aPropertyName == SC_UNO_SHOWDRAW ) @@ -1823,7 +1823,7 @@ void SAL_CALL ScTabViewObj::setPropertyValue( //#i80528# adapt to new range eventually if(sal_Int16(VOBJ_MODE_HIDE) < nIntVal) nIntVal = sal_Int16(VOBJ_MODE_SHOW); - aNewOpt.SetObjMode( VOBJ_TYPE_DRAW, (ScVObjMode)nIntVal); + aNewOpt.SetObjMode( VOBJ_TYPE_DRAW, static_cast<ScVObjMode>(nIntVal)); } } else if ( aPropertyName == SC_UNO_GRIDCOLOR ) diff --git a/sc/source/ui/vba/vbaformat.cxx b/sc/source/ui/vba/vbaformat.cxx index 941c840d1e94..cc83083d892b 100644 --- a/sc/source/ui/vba/vbaformat.cxx +++ b/sc/source/ui/vba/vbaformat.cxx @@ -664,16 +664,16 @@ ScVbaFormat< Ifc... >::setReadingOrder( const uno::Any& ReadingOrder ) switch(nReadingOrder) { case excel::Constants::xlLTR: - aVal <<= (sal_Int16) text::WritingMode_LR_TB; + aVal <<= sal_Int16(text::WritingMode_LR_TB); break; case excel::Constants::xlRTL: - aVal <<= (sal_Int16) text::WritingMode_RL_TB; + aVal <<= sal_Int16(text::WritingMode_RL_TB); break; case excel::Constants::xlContext: // TODO implement xlContext // Reading order has to depend on the language of the first letter // written. - aVal <<= (sal_Int16) text::WritingMode_LR_TB; + aVal <<= sal_Int16(text::WritingMode_LR_TB); break; default: DebugHelper::basicexception(ERRCODE_BASIC_METHOD_FAILED, OUString()); diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index c77bcb3a409e..414f30bf9cac 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx @@ -1353,7 +1353,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) if ( pLinkItem ) bAsLink = pLinkItem->GetValue(); if ( pMoveItem ) - eMoveMode = (InsCellCmd) pMoveItem->GetValue(); + eMoveMode = static_cast<InsCellCmd>(pMoveItem->GetValue()); } else { diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx index 0b0c21627944..ce5fb36a4bb7 100644 --- a/sc/source/ui/view/cellsh2.cxx +++ b/sc/source/ui/view/cellsh2.cxx @@ -882,9 +882,9 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq ) const SfxItemSet* pOutSet = pDlg->GetOutputItemSet(); if ( pOutSet->GetItemState( FID_VALID_MODE, true, &pItem ) == SfxItemState::SET ) - eMode = (ScValidationMode) static_cast<const SfxAllEnumItem*>(pItem)->GetValue(); + eMode = static_cast<ScValidationMode>(static_cast<const SfxAllEnumItem*>(pItem)->GetValue()); if ( pOutSet->GetItemState( FID_VALID_CONDMODE, true, &pItem ) == SfxItemState::SET ) - eOper = (ScConditionMode) static_cast<const SfxAllEnumItem*>(pItem)->GetValue(); + eOper = static_cast<ScConditionMode>(static_cast<const SfxAllEnumItem*>(pItem)->GetValue()); if ( pOutSet->GetItemState( FID_VALID_VALUE1, true, &pItem ) == SfxItemState::SET ) { OUString aTemp1 = static_cast<const SfxStringItem*>(pItem)->GetValue(); @@ -951,7 +951,7 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq ) if ( pOutSet->GetItemState( FID_VALID_SHOWERR, true, &pItem ) == SfxItemState::SET ) bShowError = static_cast<const SfxBoolItem*>(pItem)->GetValue(); if ( pOutSet->GetItemState( FID_VALID_ERRSTYLE, true, &pItem ) == SfxItemState::SET ) - eErrStyle = (ScValidErrorStyle) static_cast<const SfxAllEnumItem*>(pItem)->GetValue(); + eErrStyle = static_cast<ScValidErrorStyle>(static_cast<const SfxAllEnumItem*>(pItem)->GetValue()); if ( pOutSet->GetItemState( FID_VALID_ERRTITLE, true, &pItem ) == SfxItemState::SET ) aErrTitle = static_cast<const SfxStringItem*>(pItem)->GetValue(); if ( pOutSet->GetItemState( FID_VALID_ERRTEXT, true, &pItem ) == SfxItemState::SET ) diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx index bb0496966d4e..0544f5bd08dd 100644 --- a/sc/source/ui/view/editsh.cxx +++ b/sc/source/ui/view/editsh.cxx @@ -1039,8 +1039,7 @@ void ScEditShell::ExecuteAttr(SfxRequest& rReq) case SID_SET_SUPER_SCRIPT: { - SvxEscapement eOld = (SvxEscapement) - pEditView->GetAttribs().Get(EE_CHAR_ESCAPEMENT).GetEnumValue(); + SvxEscapement eOld = static_cast<SvxEscapement>(pEditView->GetAttribs().Get(EE_CHAR_ESCAPEMENT).GetEnumValue()); SvxEscapement eNew = (eOld == SvxEscapement::Superscript) ? SvxEscapement::Off : SvxEscapement::Superscript; aSet.Put( SvxEscapementItem( eNew, EE_CHAR_ESCAPEMENT ) ); @@ -1049,8 +1048,7 @@ void ScEditShell::ExecuteAttr(SfxRequest& rReq) break; case SID_SET_SUB_SCRIPT: { - SvxEscapement eOld = (SvxEscapement) - pEditView->GetAttribs().Get(EE_CHAR_ESCAPEMENT).GetEnumValue(); + SvxEscapement eOld = static_cast<SvxEscapement>(pEditView->GetAttribs().Get(EE_CHAR_ESCAPEMENT).GetEnumValue()); SvxEscapement eNew = (eOld == SvxEscapement::Subscript) ? SvxEscapement::Off : SvxEscapement::Subscript; aSet.Put( SvxEscapementItem( eNew, EE_CHAR_ESCAPEMENT ) ); @@ -1161,7 +1159,7 @@ void ScEditShell::GetAttrState(SfxItemSet &rSet) if ( pHdl && pHdl->IsFormulaMode() ) rSet.ClearItem( EE_CHAR_WEIGHT ); // Highlighted brace not here - SvxEscapement eEsc = (SvxEscapement) aAttribs.Get( EE_CHAR_ESCAPEMENT ).GetEnumValue(); + SvxEscapement eEsc = static_cast<SvxEscapement>(aAttribs.Get( EE_CHAR_ESCAPEMENT ).GetEnumValue()); if( eEsc == SvxEscapement::Superscript ) { rSet.Put( SfxBoolItem( SID_SET_SUPER_SCRIPT, true ) ); diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx index ba95dba00a56..b7e9be249e63 100644 --- a/sc/source/ui/view/formatsh.cxx +++ b/sc/source/ui/view/formatsh.cxx @@ -279,7 +279,7 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq ) SfxStyleFamily eFamily = SfxStyleFamily::Para; const SfxPoolItem* pFamItem; if ( pArgs && SfxItemState::SET == pArgs->GetItemState( SID_STYLE_FAMILY, true, &pFamItem ) ) - eFamily = (SfxStyleFamily) static_cast<const SfxUInt16Item*>(pFamItem)->GetValue(); + eFamily = static_cast<SfxStyleFamily>(static_cast<const SfxUInt16Item*>(pFamItem)->GetValue()); const SfxPoolItem* pNameItem; OUString aStyleName; if (pArgs && SfxItemState::SET == pArgs->GetItemState( nSlotId, true, &pNameItem )) @@ -359,7 +359,7 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq ) SfxStyleFamily eFamily = SfxStyleFamily::Para; const SfxPoolItem* pFamItem; if ( pArgs && SfxItemState::SET == pArgs->GetItemState( SID_STYLE_FAMILY, true, &pFamItem ) ) - eFamily = (SfxStyleFamily) static_cast<const SfxUInt16Item*>(pFamItem)->GetValue(); + eFamily = static_cast<SfxStyleFamily>(static_cast<const SfxUInt16Item*>(pFamItem)->GetValue()); else if ( pArgs && SfxItemState::SET == pArgs->GetItemState( SID_STYLE_FAMILYNAME, true, &pFamItem ) ) { OUString sFamily = static_cast<const SfxStringItem*>(pFamItem)->GetValue(); diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx index c4d47392f141..9105c30870ac 100644 --- a/sc/source/ui/view/output2.cxx +++ b/sc/source/ui/view/output2.cxx @@ -1250,7 +1250,7 @@ void ScOutputData::GetOutputArea( SCCOL nX, SCSIZE nArrY, long nPosX, long nPosY rParam.maClipRect = rParam.maAlignRect; if ( nNeeded > nMergeSizeX ) { - SvxCellHorJustify eHorJust = (SvxCellHorJustify)nHorJustify; + SvxCellHorJustify eHorJust = static_cast<SvxCellHorJustify>(nHorJustify); long nMissing = nNeeded - nMergeSizeX; long nLeftMissing = 0; diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx index 070fe7dacd4f..1a36f04f2b68 100644 --- a/sc/source/ui/view/tabview.cxx +++ b/sc/source/ui/view/tabview.cxx @@ -936,7 +936,7 @@ ScSplitPos ScTabView::FindWindow( const vcl::Window* pWindow ) const ScSplitPos eVal = SC_SPLIT_BOTTOMLEFT; // Default for (sal_uInt16 i=0; i<4; i++) if ( pGridWin[i] == pWindow ) - eVal = (ScSplitPos) i; + eVal = static_cast<ScSplitPos>(i); return eVal; } diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx index 6f40587c4d54..a6b94f86f091 100644 --- a/sc/source/ui/view/tabview3.cxx +++ b/sc/source/ui/view/tabview3.cxx @@ -1353,7 +1353,7 @@ void ScTabView::MoveCursorEnter( bool bShift ) // bShift -> up/down SCCOL nMoveX = 0; SCROW nMoveY = 0; - switch ((ScDirection)rOpt.GetMoveDir()) + switch (static_cast<ScDirection>(rOpt.GetMoveDir())) { case DIR_BOTTOM: nMoveY = bShift ? -1 : 1; @@ -2036,8 +2036,8 @@ void ScTabView::MakeEditView( ScEditEngineDefaulter* pEngine, SCCOL nCol, SCROW { if (pGridWin[i] && pGridWin[i]->IsVisible() && !aViewData.HasEditView(ScSplitPos(i))) { - ScHSplitPos eHWhich = WhichH( (ScSplitPos) i ); - ScVSplitPos eVWhich = WhichV( (ScSplitPos) i ); + ScHSplitPos eHWhich = WhichH( static_cast<ScSplitPos>(i) ); + ScVSplitPos eVWhich = WhichV( static_cast<ScSplitPos>(i) ); SCCOL nScrX = aViewData.GetPosX( eHWhich ); SCROW nScrY = aViewData.GetPosY( eVWhich ); @@ -2049,8 +2049,8 @@ void ScTabView::MakeEditView( ScEditEngineDefaulter* pEngine, SCCOL nCol, SCROW // so input isn't lost (and the edit view may be scrolled into the visible area) // #i26433# during spelling, the spelling view must be active - if ( bPosVisible || aViewData.GetActivePart() == (ScSplitPos) i || - ( pSpellingView && aViewData.GetEditView((ScSplitPos) i) == pSpellingView ) ) + if ( bPosVisible || aViewData.GetActivePart() == static_cast<ScSplitPos>(i) || + ( pSpellingView && aViewData.GetEditView(static_cast<ScSplitPos>(i)) == pSpellingView ) ) { pGridWin[i]->HideCursor(); @@ -2064,7 +2064,7 @@ void ScTabView::MakeEditView( ScEditEngineDefaulter* pEngine, SCCOL nCol, SCROW // MapMode must be set after HideCursor pGridWin[i]->SetMapMode(aViewData.GetLogicMode()); - aViewData.SetEditEngine( (ScSplitPos) i, pEngine, pGridWin[i], nCol, nRow ); + aViewData.SetEditEngine( static_cast<ScSplitPos>(i), pEngine, pGridWin[i], nCol, nRow ); if ( !bPosVisible ) { @@ -2115,12 +2115,12 @@ void ScTabView::KillEditView( bool bNoPaint ) nRow1 == aViewData.GetCurY(); for (sal_uInt16 i = 0; i < 4; i++) { - bPaint[i] = aViewData.HasEditView( (ScSplitPos) i ); + bPaint[i] = aViewData.HasEditView( static_cast<ScSplitPos>(i) ); if (bPaint[i]) { bNotifyAcc = true; - EditView* pView = aViewData.GetEditView( (ScSplitPos) i ); + EditView* pView = aViewData.GetEditView( static_cast<ScSplitPos>(i) ); aRectangle[i] = pView->GetInvalidateRect(); } } @@ -2250,8 +2250,8 @@ void ScTabView::PaintArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCRO if (!pGridWin[i] || !pGridWin[i]->IsVisible()) continue; - ScHSplitPos eHWhich = WhichH( (ScSplitPos) i ); - ScVSplitPos eVWhich = WhichV( (ScSplitPos) i ); + ScHSplitPos eHWhich = WhichH( static_cast<ScSplitPos>(i) ); + ScVSplitPos eVWhich = WhichV( static_cast<ScSplitPos>(i) ); bool bOut = false; nCol1 = nStartCol; @@ -2306,8 +2306,8 @@ void ScTabView::PaintArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCRO bool bLayoutRTL = aViewData.GetDocument()->IsLayoutRTL( aViewData.GetTabNo() ); long nLayoutSign = bLayoutRTL ? -1 : 1; - Point aStart = aViewData.GetScrPos( nCol1, nRow1, (ScSplitPos) i ); - Point aEnd = aViewData.GetScrPos( nCol2+1, nRow2+1, (ScSplitPos) i ); + Point aStart = aViewData.GetScrPos( nCol1, nRow1, static_cast<ScSplitPos>(i) ); + Point aEnd = aViewData.GetScrPos( nCol2+1, nRow2+1, static_cast<ScSplitPos>(i) ); if ( eMode == ScUpdateMode::All ) { if (bIsTiledRendering) @@ -2748,7 +2748,7 @@ void ScTabView::ActivateView( bool bActivate, bool bFirst ) { if ( pGridWin[i] ) { - eWin = (ScSplitPos) i; + eWin = static_cast<ScSplitPos>(i); break; // for } } diff --git a/sc/source/ui/view/tabview4.cxx b/sc/source/ui/view/tabview4.cxx index be95dcbab4b5..1fede34f367b 100644 --- a/sc/source/ui/view/tabview4.cxx +++ b/sc/source/ui/view/tabview4.cxx @@ -458,7 +458,7 @@ void ScTabView::UpdateScrollBars( HeaderType eHeaderType ) void ScTabView::InvertHorizontal( ScVSplitPos eWhich, long nDragPos ) { for (sal_uInt16 i=0; i<4; i++) - if (WhichV((ScSplitPos)i)==eWhich) + if (WhichV(static_cast<ScSplitPos>(i))==eWhich) { ScGridWindow* pWin = pGridWin[i].get(); if (pWin) @@ -473,7 +473,7 @@ void ScTabView::InvertHorizontal( ScVSplitPos eWhich, long nDragPos ) void ScTabView::InvertVertical( ScHSplitPos eWhich, long nDragPos ) { for (sal_uInt16 i=0; i<4; i++) - if (WhichH((ScSplitPos)i)==eWhich) + if (WhichH(static_cast<ScSplitPos>(i))==eWhich) { ScGridWindow* pWin = pGridWin[i].get(); if (pWin) diff --git a/sc/source/ui/view/tabview5.cxx b/sc/source/ui/view/tabview5.cxx index eb76bafe7151..0d6a6a9324d0 100644 --- a/sc/source/ui/view/tabview5.cxx +++ b/sc/source/ui/view/tabview5.cxx @@ -171,8 +171,8 @@ ScTabView::~ScTabView() ScViewData& rOtherViewData = pOtherViewShell->GetViewData(); for (int k = 0; k < 4; ++k) { - if (rOtherViewData.HasEditView((ScSplitPos)k)) - pThisViewShell->RemoveWindowFromForeignEditView(pOtherViewShell, (ScSplitPos)k); + if (rOtherViewData.HasEditView(static_cast<ScSplitPos>(k))) + pThisViewShell->RemoveWindowFromForeignEditView(pOtherViewShell, static_cast<ScSplitPos>(k)); } }; @@ -234,7 +234,7 @@ void ScTabView::MakeDrawView( TriState nForceDesignMode ) for (i=0; i<4; i++) if (pGridWin[i]) { - if ( SC_SPLIT_BOTTOMLEFT != (ScSplitPos)i ) + if ( SC_SPLIT_BOTTOMLEFT != static_cast<ScSplitPos>(i) ) pDrawView->AddWindowToPaintView(pGridWin[i], nullptr); } pDrawView->RecalcScale(); diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx index 3c69bb0ce1d4..8b04b067818e 100644 --- a/sc/source/ui/view/tabvwsha.cxx +++ b/sc/source/ui/view/tabvwsha.cxx @@ -79,7 +79,7 @@ bool ScTabViewShell::GetFunction( OUString& rFuncStr, FormulaError nErrCode ) { if ( !(nFuncs & (1 << nFunc)) ) continue; - ScSubTotalFunc eFunc = (ScSubTotalFunc)nFunc; + ScSubTotalFunc eFunc = static_cast<ScSubTotalFunc>(nFunc); if (bIgnoreError && (eFunc == SUBTOTAL_FUNC_CNT || eFunc == SUBTOTAL_FUNC_CNT2)) nErrCode = FormulaError::NONE; diff --git a/sc/source/ui/view/tabvwshe.cxx b/sc/source/ui/view/tabvwshe.cxx index fe0ae20854f3..d7cac6b903b0 100644 --- a/sc/source/ui/view/tabvwshe.cxx +++ b/sc/source/ui/view/tabvwshe.cxx @@ -121,7 +121,7 @@ OUString ScTabViewShell::GetSelectionText( bool bWholeWord ) void ScTabViewShell::InsertURL( const OUString& rName, const OUString& rURL, const OUString& rTarget, sal_uInt16 nMode ) { - SvxLinkInsertMode eMode = (SvxLinkInsertMode) nMode; + SvxLinkInsertMode eMode = static_cast<SvxLinkInsertMode>(nMode); bool bAsText = ( eMode != HLINK_BUTTON ); // default is now text if ( bAsText ) diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index 90206529602e..8e5d5260fdcb 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -1765,7 +1765,7 @@ void ScViewData::ResetEditView() { if (bEditActive[i]) { - lcl_LOKRemoveWindow(GetViewShell(), (ScSplitPos)i); + lcl_LOKRemoveWindow(GetViewShell(), static_cast<ScSplitPos>(i)); pEngine = pEditView[i]->GetEditEngine(); pEngine->RemoveView(pEditView[i]); pEditView[i]->SetOutputArea( tools::Rectangle() ); @@ -2749,8 +2749,8 @@ void ScViewData::ReadUserData(const OUString& rData) { maTabData[nPos]->nCurX = SanitizeCol( static_cast<SCCOL>(aTabOpt.getToken(0,cTabSep).toInt32())); maTabData[nPos]->nCurY = SanitizeRow( aTabOpt.getToken(1,cTabSep).toInt32()); - maTabData[nPos]->eHSplitMode = (ScSplitMode) aTabOpt.getToken(2,cTabSep).toInt32(); - maTabData[nPos]->eVSplitMode = (ScSplitMode) aTabOpt.getToken(3,cTabSep).toInt32(); + maTabData[nPos]->eHSplitMode = static_cast<ScSplitMode>(aTabOpt.getToken(2,cTabSep).toInt32()); + maTabData[nPos]->eVSplitMode = static_cast<ScSplitMode>(aTabOpt.getToken(3,cTabSep).toInt32()); if ( maTabData[nPos]->eHSplitMode == SC_SPLIT_FIX ) { @@ -2768,7 +2768,7 @@ void ScViewData::ReadUserData(const OUString& rData) else maTabData[nPos]->nVSplitPos = aTabOpt.getToken(5,cTabSep).toInt32(); - maTabData[nPos]->eWhichActive = (ScSplitPos) aTabOpt.getToken(6,cTabSep).toInt32(); + maTabData[nPos]->eWhichActive = static_cast<ScSplitPos>(aTabOpt.getToken(6,cTabSep).toInt32()); maTabData[nPos]->nPosX[0] = SanitizeCol( static_cast<SCCOL>(aTabOpt.getToken(7,cTabSep).toInt32())); maTabData[nPos]->nPosX[1] = SanitizeCol( static_cast<SCCOL>(aTabOpt.getToken(8,cTabSep).toInt32())); maTabData[nPos]->nPosY[0] = SanitizeRow( aTabOpt.getToken(9,cTabSep).toInt32()); |