diff options
Diffstat (limited to 'sc/source/ui')
109 files changed, 661 insertions, 667 deletions
diff --git a/sc/source/ui/Accessibility/AccessibleCellBase.cxx b/sc/source/ui/Accessibility/AccessibleCellBase.cxx index 26c56e133ca9..0ab07a04f1e9 100644 --- a/sc/source/ui/Accessibility/AccessibleCellBase.cxx +++ b/sc/source/ui/Accessibility/AccessibleCellBase.cxx @@ -415,13 +415,13 @@ OUString ScAccessibleCellBase::getShadowAttrs() sShadowAttrs += OUString::number( nLocationVal ); sShadowAttrs += sInnerSplit; sShadowAttrs += "ShadowWidth="; - sShadowAttrs += OUString::number( (sal_Int32)aShadowFmt.ShadowWidth ) ; + sShadowAttrs += OUString::number( static_cast<sal_Int32>(aShadowFmt.ShadowWidth) ) ; sShadowAttrs += sInnerSplit; sShadowAttrs += "IsTransparent="; - sShadowAttrs += OUString::number( (int)aShadowFmt.IsTransparent ) ; + sShadowAttrs += OUString::number( static_cast<int>(aShadowFmt.IsTransparent) ) ; sShadowAttrs += sInnerSplit; sShadowAttrs += "Color="; - sShadowAttrs += OUString::number( (sal_Int32)aShadowFmt.Color ); + sShadowAttrs += OUString::number( static_cast<sal_Int32>(aShadowFmt.Color) ); sShadowAttrs += sOuterSplit; return sShadowAttrs; } @@ -499,16 +499,16 @@ OUString ScAccessibleCellBase::getBorderAttrs() else//add all the border properties to the return string. { sBorderAttrs += "TopBorder:Color="; - sBorderAttrs += OUString::number( (sal_Int32)aTopBorder.Color ); + sBorderAttrs += OUString::number( static_cast<sal_Int32>(aTopBorder.Color) ); sBorderAttrs += sInnerSplit; sBorderAttrs += "InnerLineWidth="; - sBorderAttrs += OUString::number( (sal_Int32)aTopBorder.InnerLineWidth ); + sBorderAttrs += OUString::number( static_cast<sal_Int32>(aTopBorder.InnerLineWidth) ); sBorderAttrs += sInnerSplit; sBorderAttrs += "OuterLineWidth="; - sBorderAttrs += OUString::number( (sal_Int32)aTopBorder.OuterLineWidth ); + sBorderAttrs += OUString::number( static_cast<sal_Int32>(aTopBorder.OuterLineWidth) ); sBorderAttrs += sInnerSplit; sBorderAttrs += "LineDistance="; - sBorderAttrs += OUString::number( (sal_Int32)aTopBorder.LineDistance ); + sBorderAttrs += OUString::number( static_cast<sal_Int32>(aTopBorder.LineDistance) ); sBorderAttrs += sOuterSplit; } //bottom border @@ -519,16 +519,16 @@ OUString ScAccessibleCellBase::getBorderAttrs() else { sBorderAttrs += "BottomBorder:Color="; - sBorderAttrs += OUString::number( (sal_Int32)aBottomBorder.Color ); + sBorderAttrs += OUString::number( static_cast<sal_Int32>(aBottomBorder.Color) ); sBorderAttrs += sInnerSplit; sBorderAttrs += "InnerLineWidth="; - sBorderAttrs += OUString::number( (sal_Int32)aBottomBorder.InnerLineWidth ); + sBorderAttrs += OUString::number( static_cast<sal_Int32>(aBottomBorder.InnerLineWidth) ); sBorderAttrs += sInnerSplit; sBorderAttrs += "OuterLineWidth="; - sBorderAttrs += OUString::number( (sal_Int32)aBottomBorder.OuterLineWidth ); + sBorderAttrs += OUString::number( static_cast<sal_Int32>(aBottomBorder.OuterLineWidth) ); sBorderAttrs += sInnerSplit; sBorderAttrs += "LineDistance="; - sBorderAttrs += OUString::number( (sal_Int32)aBottomBorder.LineDistance ); + sBorderAttrs += OUString::number( static_cast<sal_Int32>(aBottomBorder.LineDistance) ); sBorderAttrs += sOuterSplit; } //left border @@ -539,16 +539,16 @@ OUString ScAccessibleCellBase::getBorderAttrs() else { sBorderAttrs += "LeftBorder:Color="; - sBorderAttrs += OUString::number( (sal_Int32)aLeftBorder.Color ); + sBorderAttrs += OUString::number( static_cast<sal_Int32>(aLeftBorder.Color) ); sBorderAttrs += sInnerSplit; sBorderAttrs += "InnerLineWidth="; - sBorderAttrs += OUString::number( (sal_Int32)aLeftBorder.InnerLineWidth ); + sBorderAttrs += OUString::number( static_cast<sal_Int32>(aLeftBorder.InnerLineWidth) ); sBorderAttrs += sInnerSplit; sBorderAttrs += "OuterLineWidth="; - sBorderAttrs += OUString::number( (sal_Int32)aLeftBorder.OuterLineWidth ); + sBorderAttrs += OUString::number( static_cast<sal_Int32>(aLeftBorder.OuterLineWidth) ); sBorderAttrs += sInnerSplit; sBorderAttrs += "LineDistance="; - sBorderAttrs += OUString::number( (sal_Int32)aLeftBorder.LineDistance ); + sBorderAttrs += OUString::number( static_cast<sal_Int32>(aLeftBorder.LineDistance) ); sBorderAttrs += sOuterSplit; } //right border @@ -559,16 +559,16 @@ OUString ScAccessibleCellBase::getBorderAttrs() else { sBorderAttrs += "RightBorder:Color="; - sBorderAttrs += OUString::number( (sal_Int32)aRightBorder.Color ); + sBorderAttrs += OUString::number( static_cast<sal_Int32>(aRightBorder.Color) ); sBorderAttrs += sInnerSplit; sBorderAttrs += "InnerLineWidth="; - sBorderAttrs += OUString::number( (sal_Int32)aRightBorder.InnerLineWidth ); + sBorderAttrs += OUString::number( static_cast<sal_Int32>(aRightBorder.InnerLineWidth) ); sBorderAttrs += sInnerSplit; sBorderAttrs += "OuterLineWidth="; - sBorderAttrs += OUString::number( (sal_Int32)aRightBorder.OuterLineWidth ); + sBorderAttrs += OUString::number( static_cast<sal_Int32>(aRightBorder.OuterLineWidth) ); sBorderAttrs += sInnerSplit; sBorderAttrs += "LineDistance="; - sBorderAttrs += OUString::number( (sal_Int32)aRightBorder.LineDistance ); + sBorderAttrs += OUString::number( static_cast<sal_Int32>(aRightBorder.LineDistance) ); sBorderAttrs += sOuterSplit; } return sBorderAttrs; diff --git a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx index 580fd0917e53..e5ba30cccc6c 100644 --- a/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx +++ b/sc/source/ui/Accessibility/AccessibleSpreadsheet.cxx @@ -866,7 +866,7 @@ sal_Bool SAL_CALL ScAccessibleSpreadsheet::isAccessibleRowSelected( sal_Int32 nR if (mpViewShell) { const ScMarkData& rMarkdata = mpViewShell->GetViewData().GetMarkData(); - bResult = rMarkdata.IsRowMarked((SCROW)nRow); + bResult = rMarkdata.IsRowMarked(static_cast<SCROW>(nRow)); } return bResult; } @@ -887,7 +887,7 @@ sal_Bool SAL_CALL ScAccessibleSpreadsheet::isAccessibleColumnSelected( sal_Int32 if (mpViewShell) { const ScMarkData& rMarkdata = mpViewShell->GetViewData().GetMarkData(); - bResult = rMarkdata.IsColumnMarked((SCCOL)nColumn); + bResult = rMarkdata.IsColumnMarked(static_cast<SCCOL>(nColumn)); } return bResult; } diff --git a/sc/source/ui/Accessibility/AccessibleTableBase.cxx b/sc/source/ui/Accessibility/AccessibleTableBase.cxx index 21dbd525d235..94ccd54312ea 100644 --- a/sc/source/ui/Accessibility/AccessibleTableBase.cxx +++ b/sc/source/ui/Accessibility/AccessibleTableBase.cxx @@ -311,8 +311,8 @@ sal_Int32 SAL_CALL ScAccessibleTableBase::getAccessibleChildCount() // FIXME: representing rows & columns this way is a plain and simple madness. // this needs a radical re-think. - sal_Int64 nMax = ((sal_Int64)(maRange.aEnd.Row() - maRange.aStart.Row() + 1) * - (sal_Int64)(maRange.aEnd.Col() - maRange.aStart.Col() + 1)); + sal_Int64 nMax = (static_cast<sal_Int64>(maRange.aEnd.Row() - maRange.aStart.Row() + 1) * + static_cast<sal_Int64>(maRange.aEnd.Col() - maRange.aStart.Col() + 1)); if (nMax > SAL_MAX_INT32) nMax = SAL_MAX_INT32; if (nMax < 0) diff --git a/sc/source/ui/app/client.cxx b/sc/source/ui/app/client.cxx index a3a8e12f874b..a46ca516a599 100644 --- a/sc/source/ui/app/client.cxx +++ b/sc/source/ui/app/client.cxx @@ -214,7 +214,7 @@ void ScClient::ViewChanged() tools::Rectangle aLogicRect = pDrawObj->GetLogicRect(); Fraction aFractX = GetScaleWidth() * aVisSize.Width(); Fraction aFractY = GetScaleHeight() * aVisSize.Height(); - aVisSize = Size( (long) aFractX, (long) aFractY ); // Scaled for Draw model + aVisSize = Size( static_cast<long>(aFractX), static_cast<long>(aFractY) ); // Scaled for Draw model // pClientData->SetObjArea before pDrawObj->SetLogicRect, so that we don't // calculate wrong scalings: diff --git a/sc/source/ui/app/drwtrans.cxx b/sc/source/ui/app/drwtrans.cxx index 2a63c4c367ee..6c8863562f66 100644 --- a/sc/source/ui/app/drwtrans.cxx +++ b/sc/source/ui/app/drwtrans.cxx @@ -246,7 +246,7 @@ ScDrawTransferObj* ScDrawTransferObj::GetOwnClipboard( vcl::Window* pWin ) { sal_Int64 nHandle = xTunnel->getSomething( getUnoTunnelId() ); if ( nHandle ) - pObj = dynamic_cast<ScDrawTransferObj*>(reinterpret_cast<TransferableHelper*>( (sal_IntPtr) nHandle )); + pObj = dynamic_cast<ScDrawTransferObj*>(reinterpret_cast<TransferableHelper*>( static_cast<sal_IntPtr>(nHandle) )); } return pObj; diff --git a/sc/source/ui/app/inputhdl.cxx b/sc/source/ui/app/inputhdl.cxx index c1b87303e9a4..80620aa35383 100644 --- a/sc/source/ui/app/inputhdl.cxx +++ b/sc/source/ui/app/inputhdl.cxx @@ -455,13 +455,13 @@ void ScInputHandler::UpdateRange( sal_uInt16 nIndex, const ScRange& rNew ) DataChanged(); bInRangeUpdate = false; - long nDiff = aNewStr.getLength() - (long)(nOldEnd-nOldStart); + long nDiff = aNewStr.getLength() - static_cast<long>(nOldEnd-nOldStart); rData.aRef = rNew; rData.nSelEnd = rData.nSelEnd + nDiff; rData.nColorData = nNewColor; - sal_uInt16 nCount = (sal_uInt16) pRangeFindList->Count(); + sal_uInt16 nCount = static_cast<sal_uInt16>(pRangeFindList->Count()); for (sal_uInt16 i=nIndex+1; i<nCount; i++) { ScRangeFindData& rNext = pRangeFindList->GetObject( i ); @@ -595,7 +595,7 @@ static sal_Int32 lcl_MatchParenthesis( const OUString& rStr, sal_Int32 nPos ) } if ( nLevel ) return -1; - return (sal_Int32) (p - p0); + return static_cast<sal_Int32>(p - p0); } ScInputHandler::ScInputHandler() diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx index a7ff74f109c2..28ff4acbdd1a 100644 --- a/sc/source/ui/app/inputwin.cxx +++ b/sc/source/ui/app/inputwin.cxx @@ -679,7 +679,7 @@ void ScInputWindow::MouseMove( const MouseEvent& rMEvt ) if (bInResize) { // detect direction - long nResizeThreshold = ((long)TBX_WINDOW_HEIGHT * 0.7); + long nResizeThreshold = (long(TBX_WINDOW_HEIGHT) * 0.7); bool bResetPointerPos = false; // Detect attempt to expand toolbar too much diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx index acb719f787de..a6c1cd6662bb 100644 --- a/sc/source/ui/app/scmod.cxx +++ b/sc/source/ui/app/scmod.cxx @@ -223,10 +223,10 @@ void ScModule::ConfigurationChanged( utl::ConfigurationBroadcaster* p, Configura { const svtools::ColorConfig& rColors = GetColorConfig(); bool bArrows = - ( ScDetectiveFunc::GetArrowColor() != (ColorData)rColors.GetColorValue(svtools::CALCDETECTIVE).nColor || - ScDetectiveFunc::GetErrorColor() != (ColorData)rColors.GetColorValue(svtools::CALCDETECTIVEERROR).nColor ); + ( ScDetectiveFunc::GetArrowColor() != static_cast<ColorData>(rColors.GetColorValue(svtools::CALCDETECTIVE).nColor) || + ScDetectiveFunc::GetErrorColor() != static_cast<ColorData>(rColors.GetColorValue(svtools::CALCDETECTIVEERROR).nColor) ); bool bComments = - ( ScDetectiveFunc::GetCommentColor() != (ColorData)rColors.GetColorValue(svtools::CALCNOTESBACKGROUND).nColor ); + ( ScDetectiveFunc::GetCommentColor() != static_cast<ColorData>(rColors.GetColorValue(svtools::CALCNOTESBACKGROUND).nColor) ); if ( bArrows || bComments ) { ScDetectiveFunc::InitializeColors(); // get the new colors @@ -734,7 +734,7 @@ void ScModule::InsertEntryToLRUList(sal_uInt16 nFIndex) if(nFIndex != 0) { const ScAppOptions& rAppOpt = GetAppOptions(); - sal_uInt16 nLRUFuncCount = std::min( rAppOpt.GetLRUFuncListCount(), (sal_uInt16)LRU_MAX ); + sal_uInt16 nLRUFuncCount = std::min( rAppOpt.GetLRUFuncListCount(), sal_uInt16(LRU_MAX) ); sal_uInt16* pLRUListIds = rAppOpt.GetLRUFuncList(); sal_uInt16 aIdxList[LRU_MAX]; diff --git a/sc/source/ui/app/transobj.cxx b/sc/source/ui/app/transobj.cxx index 77e528a0dff0..258edbdce67c 100644 --- a/sc/source/ui/app/transobj.cxx +++ b/sc/source/ui/app/transobj.cxx @@ -207,7 +207,7 @@ ScTransferObj* ScTransferObj::GetOwnClipboard( vcl::Window* pUIWin ) { sal_Int64 nHandle = xTunnel->getSomething( getUnoTunnelId() ); if ( nHandle ) - pObj = dynamic_cast<ScTransferObj*>(reinterpret_cast<TransferableHelper*>( (sal_IntPtr) nHandle )); + pObj = dynamic_cast<ScTransferObj*>(reinterpret_cast<TransferableHelper*>( static_cast<sal_IntPtr>(nHandle) )); } return pObj; @@ -727,8 +727,8 @@ void ScTransferObj::InitDocShell(bool bLimitToPageSize) for (nCol=0; nCol<nStartX; nCol++) nPosX += rDestDoc.GetColWidth( nCol, 0 ); nPosY += rDestDoc.GetRowHeight( 0, nStartY-1, 0 ); - nPosX = (long) ( nPosX * HMM_PER_TWIPS ); - nPosY = (long) ( nPosY * HMM_PER_TWIPS ); + nPosX = static_cast<long>( nPosX * HMM_PER_TWIPS ); + nPosY = static_cast<long>( nPosY * HMM_PER_TWIPS ); aPaperSize.Width() *= 2; // limit OLE object to double of page size aPaperSize.Height() *= 2; @@ -749,8 +749,8 @@ void ScTransferObj::InitDocShell(bool bLimitToPageSize) break; nSizeY += nAdd; } - nSizeX = (long) ( nSizeX * HMM_PER_TWIPS ); - nSizeY = (long) ( nSizeY * HMM_PER_TWIPS ); + nSizeX = static_cast<long>( nSizeX * HMM_PER_TWIPS ); + nSizeY = static_cast<long>( nSizeY * HMM_PER_TWIPS ); // pDocSh->SetVisAreaSize( Size(nSizeX,nSizeY) ); diff --git a/sc/source/ui/cctrl/tbzoomsliderctrl.cxx b/sc/source/ui/cctrl/tbzoomsliderctrl.cxx index d5315da35ae1..7b6d58282db2 100644 --- a/sc/source/ui/cctrl/tbzoomsliderctrl.cxx +++ b/sc/source/ui/cctrl/tbzoomsliderctrl.cxx @@ -353,7 +353,7 @@ void ScZoomSliderWnd::UpdateFromItem( const SvxZoomSliderItem* pZoomSliderItem ) for ( sal_Int32 j = 0; j < rSnappingPoints.getLength(); ++j ) { const sal_Int32 nSnappingPoint = rSnappingPoints[j]; - aTmpSnappingPoints.insert( (sal_uInt16)nSnappingPoint ); + aTmpSnappingPoints.insert( static_cast<sal_uInt16>(nSnappingPoint) ); } // remove snapping points that are to close to each other: diff --git a/sc/source/ui/dataprovider/csvdataprovider.cxx b/sc/source/ui/dataprovider/csvdataprovider.cxx index a6850edec3de..c787ee4ce0c6 100644 --- a/sc/source/ui/dataprovider/csvdataprovider.cxx +++ b/sc/source/ui/dataprovider/csvdataprovider.cxx @@ -136,7 +136,7 @@ void CSVDataProvider::Import() return; mpDoc.reset(new ScDocument(SCDOCMODE_CLIP)); - mpDoc->ResetClip(mpDocument, (SCTAB)0); + mpDoc->ResetClip(mpDocument, SCTAB(0)); mxCSVFetchThread = new CSVFetchThread(*mpDoc, mrDataSource.getURL(), std::bind(&CSVDataProvider::ImportFinished, this), mrDataSource.getDataTransformation()); mxCSVFetchThread->launch(); diff --git a/sc/source/ui/dataprovider/htmldataprovider.cxx b/sc/source/ui/dataprovider/htmldataprovider.cxx index de1173b274e7..b95b448c1989 100644 --- a/sc/source/ui/dataprovider/htmldataprovider.cxx +++ b/sc/source/ui/dataprovider/htmldataprovider.cxx @@ -231,7 +231,7 @@ void HTMLDataProvider::Import() return; mpDoc.reset(new ScDocument(SCDOCMODE_CLIP)); - mpDoc->ResetClip(mpDocument, (SCTAB)0); + mpDoc->ResetClip(mpDocument, SCTAB(0)); mxHTMLFetchThread = new HTMLFetchThread(*mpDoc, mrDataSource.getURL(), mrDataSource.getID(), std::bind(&HTMLDataProvider::ImportFinished, this), mrDataSource.getDataTransformation()); mxHTMLFetchThread->launch(); diff --git a/sc/source/ui/dbgui/asciiopt.cxx b/sc/source/ui/dbgui/asciiopt.cxx index 4662e1acc163..3032106518f4 100644 --- a/sc/source/ui/dbgui/asciiopt.cxx +++ b/sc/source/ui/dbgui/asciiopt.cxx @@ -236,7 +236,7 @@ OUString ScAsciiOptions::WriteToString() const aOutStr += "," + // Language - OUString::number((sal_uInt16)eLang) + "," + + OUString::number(static_cast<sal_uInt16>(eLang)) + "," + // Import quoted field as text. OUString::boolean( bQuotedFieldAsText ) + "," + // Detect special numbers. diff --git a/sc/source/ui/dbgui/csvruler.cxx b/sc/source/ui/dbgui/csvruler.cxx index 5c8b1f6489e5..4bad68cdae50 100644 --- a/sc/source/ui/dbgui/csvruler.cxx +++ b/sc/source/ui/dbgui/csvruler.cxx @@ -567,7 +567,7 @@ void ScCsvRuler::ImplDrawBackgrDev() maBackgrDev->SetFillColor(); sal_Int32 nPos; - sal_Int32 nFirstPos = std::max( GetPosFromX( 0 ) - 1, (sal_Int32)0 ); + sal_Int32 nFirstPos = std::max( GetPosFromX( 0 ) - 1, sal_Int32(0) ); sal_Int32 nLastPos = GetPosFromX( GetWidth() ); sal_Int32 nY = (maActiveRect.Top() + maActiveRect.Bottom()) / 2; for( nPos = nFirstPos; nPos <= nLastPos; ++nPos ) diff --git a/sc/source/ui/dbgui/filtdlg.cxx b/sc/source/ui/dbgui/filtdlg.cxx index 78932e96091f..00fba720a865 100644 --- a/sc/source/ui/dbgui/filtdlg.cxx +++ b/sc/source/ui/dbgui/filtdlg.cxx @@ -325,17 +325,17 @@ void ScFilterDlg::Init( const SfxItemSet& rArgSet ) (pLbField1->GetSelectedEntryPos() != 0) && (pLbField2->GetSelectedEntryPos() != 0) - ? pLbConnect2->SelectEntryPos( (sal_uInt16)theQueryData.GetEntry(1).eConnect ) + ? pLbConnect2->SelectEntryPos( static_cast<sal_uInt16>(theQueryData.GetEntry(1).eConnect) ) : pLbConnect2->SetNoSelection(); (pLbField2->GetSelectedEntryPos() != 0) && (pLbField3->GetSelectedEntryPos() != 0) - ? pLbConnect3->SelectEntryPos( (sal_uInt16)theQueryData.GetEntry(2).eConnect ) + ? pLbConnect3->SelectEntryPos( static_cast<sal_uInt16>(theQueryData.GetEntry(2).eConnect) ) : pLbConnect3->SetNoSelection(); (pLbField3->GetSelectedEntryPos() != 0) && (pLbField4->GetSelectedEntryPos() != 0) - ? pLbConnect4->SelectEntryPos( (sal_uInt16)theQueryData.GetEntry(3).eConnect ) + ? pLbConnect4->SelectEntryPos( static_cast<sal_uInt16>(theQueryData.GetEntry(3).eConnect) ) : pLbConnect4->SetNoSelection(); if ( pLbField1->GetSelectedEntryPos() == 0 ) { @@ -1169,7 +1169,7 @@ void ScFilterDlg::RefreshEditRow( size_t nOffset ) if (maRefreshExceptQuery.size() < nQENext + 1) maRefreshExceptQuery.resize(nQENext + 1, false); if (theQueryData.GetEntry(nQENext).bDoQuery || maRefreshExceptQuery[nQENext]) - maConnLbArr[i+1]->SelectEntryPos( (sal_uInt16) theQueryData.GetEntry(nQENext).eConnect ); + maConnLbArr[i+1]->SelectEntryPos( static_cast<sal_uInt16>(theQueryData.GetEntry(nQENext).eConnect) ); else maConnLbArr[i+1]->SetNoSelection(); } @@ -1184,7 +1184,7 @@ void ScFilterDlg::RefreshEditRow( size_t nOffset ) if (maRefreshExceptQuery.size() < nQE + 1) maRefreshExceptQuery.resize(nQE + 1, false); if(rEntry.bDoQuery || maRefreshExceptQuery[nQE]) - maConnLbArr[i]->SelectEntryPos( (sal_uInt16) rEntry.eConnect ); + maConnLbArr[i]->SelectEntryPos( static_cast<sal_uInt16>(rEntry.eConnect) ); else maConnLbArr[i]->SetNoSelection(); } diff --git a/sc/source/ui/dbgui/imoptdlg.cxx b/sc/source/ui/dbgui/imoptdlg.cxx index 2959f07048aa..525d8f4a94b2 100644 --- a/sc/source/ui/dbgui/imoptdlg.cxx +++ b/sc/source/ui/dbgui/imoptdlg.cxx @@ -51,7 +51,7 @@ ScImportOptions::ScImportOptions( const OUString& rStr ) bFixedWidth = true; else nFieldSepCode = ScAsciiOptions::GetWeightedFieldSep( aToken, true); - nTextSepCode = (sal_Unicode) rStr.getToken(1,',').toInt32(); + nTextSepCode = static_cast<sal_Unicode>(rStr.getToken(1,',').toInt32()); aStrFont = rStr.getToken(2,','); eCharSet = ScGlobal::GetCharsetValue(aStrFont); diff --git a/sc/source/ui/dbgui/pfiltdlg.cxx b/sc/source/ui/dbgui/pfiltdlg.cxx index cdb6cf3516eb..6de3a16d1759 100644 --- a/sc/source/ui/dbgui/pfiltdlg.cxx +++ b/sc/source/ui/dbgui/pfiltdlg.cxx @@ -189,7 +189,7 @@ void ScPivotFilterDlg::Init( const SfxItemSet& rArgSet ) aValStr = aStrEmpty; else if (rEntry.IsQueryByNonEmpty()) aValStr = aStrNotEmpty; - sal_uInt16 nCondPos = (sal_uInt16)rEntry.eOp; + sal_uInt16 nCondPos = static_cast<sal_uInt16>(rEntry.eOp); sal_uInt16 nFieldSelPos = GetFieldSelPos( static_cast<SCCOL>(rEntry.nField) ); aFieldLbArr[i]->SelectEntryPos( nFieldSelPos ); @@ -213,12 +213,12 @@ void ScPivotFilterDlg::Init( const SfxItemSet& rArgSet ) (m_pLbField1->GetSelectedEntryPos() != 0) && (m_pLbField2->GetSelectedEntryPos() != 0) - ? m_pLbConnect1->SelectEntryPos( (sal_uInt16)theQueryData.GetEntry(1).eConnect ) + ? m_pLbConnect1->SelectEntryPos( static_cast<sal_uInt16>(theQueryData.GetEntry(1).eConnect) ) : m_pLbConnect1->SetNoSelection(); (m_pLbField2->GetSelectedEntryPos() != 0) && (m_pLbField3->GetSelectedEntryPos() != 0) - ? m_pLbConnect2->SelectEntryPos( (sal_uInt16)theQueryData.GetEntry(2).eConnect ) + ? m_pLbConnect2->SelectEntryPos( static_cast<sal_uInt16>(theQueryData.GetEntry(2).eConnect) ) : m_pLbConnect2->SetNoSelection(); if ( m_pLbField1->GetSelectedEntryPos() == 0 ) diff --git a/sc/source/ui/dbgui/scuiasciiopt.cxx b/sc/source/ui/dbgui/scuiasciiopt.cxx index 4340244a0706..e3aa2a2bfc7f 100644 --- a/sc/source/ui/dbgui/scuiasciiopt.cxx +++ b/sc/source/ui/dbgui/scuiasciiopt.cxx @@ -102,7 +102,7 @@ static void lcl_FillCombo( ComboBox& rCombo, const OUString& rList, sal_Unicode { OUString aStr; for ( i=0; i<nCount; i+=2 ) - if ( (sal_Unicode)rList.getToken(i+1,'\t').toInt32() == cSelect ) + if ( static_cast<sal_Unicode>(rList.getToken(i+1,'\t').toInt32()) == cSelect ) aStr = rList.getToken(i,'\t'); if (aStr.isEmpty()) aStr = OUString(cSelect); // Ascii @@ -121,7 +121,7 @@ static sal_Unicode lcl_CharFromCombo( const ComboBox& rCombo, const OUString& rL for ( sal_Int32 i=0; i<nCount; i+=2 ) { if ( ScGlobal::GetpTransliteration()->isEqual( aStr, rList.getToken(i,'\t') ) ) - c = (sal_Unicode)rList.getToken(i+1,'\t').toInt32(); + c = static_cast<sal_Unicode>(rList.getToken(i+1,'\t').toInt32()); } if (!c && !aStr.isEmpty()) { @@ -130,7 +130,7 @@ static sal_Unicode lcl_CharFromCombo( const ComboBox& rCombo, const OUString& rL if( (aStr.getLength() == 1) || (cFirst < '0') || (cFirst > '9') ) c = cFirst; else // keep old behaviour for compatibility (i.e. "39" -> "'") - c = (sal_Unicode) aStr.toInt32(); // Ascii + c = static_cast<sal_Unicode>(aStr.toInt32()); // Ascii } } return c; @@ -616,7 +616,7 @@ void ScImportAsciiDlg::GetOptions( ScAsciiOptions& rOpt ) rOpt.SetCharSetSystem( mbCharSetSystem ); rOpt.SetLanguage(pLbCustomLang->GetSelectLanguage()); rOpt.SetFixedLen( pRbFixed->IsChecked() ); - rOpt.SetStartRow( (long)pNfRow->GetValue() ); + rOpt.SetStartRow( static_cast<long>(pNfRow->GetValue()) ); mpTableBox->FillColumnData( rOpt ); if( pRbSeparated->IsChecked() ) { diff --git a/sc/source/ui/dbgui/scuiimoptdlg.cxx b/sc/source/ui/dbgui/scuiimoptdlg.cxx index 269d0e7e67f6..b67b692de098 100644 --- a/sc/source/ui/dbgui/scuiimoptdlg.cxx +++ b/sc/source/ui/dbgui/scuiimoptdlg.cxx @@ -64,7 +64,7 @@ sal_uInt16 ScDelimiterTable::GetCode( const OUString& rDel ) const { if ( rDel == theDelTab.getToken( i, cSep ) ) { - nCode = (sal_Unicode) theDelTab.getToken( i+1, cSep ).toInt32(); + nCode = static_cast<sal_Unicode>(theDelTab.getToken( i+1, cSep ).toInt32()); i = nCount; } else @@ -84,7 +84,7 @@ OUString ScDelimiterTable::GetDelimiter( sal_Unicode nCode ) const sal_Int32 i = 0; while ( i<nCount ) { - if ( nCode == (sal_Unicode) theDelTab.getToken( i+1, cSep ).toInt32() ) + if ( nCode == static_cast<sal_Unicode>(theDelTab.getToken( i+1, cSep ).toInt32()) ) { aStrDel = theDelTab.getToken( i, cSep ); i = nCount; @@ -318,7 +318,7 @@ sal_uInt16 ScImportOptionsDlg::GetCodeFromCombo( const ComboBox& rEd ) const nCode = pTab->GetCode( aStr ); if ( nCode == 0 ) - nCode = (sal_uInt16)aStr[0]; + nCode = static_cast<sal_uInt16>(aStr[0]); } return nCode; diff --git a/sc/source/ui/dbgui/tpsubt.cxx b/sc/source/ui/dbgui/tpsubt.cxx index ca8bd54b6537..c333c31306bd 100644 --- a/sc/source/ui/dbgui/tpsubt.cxx +++ b/sc/source/ui/dbgui/tpsubt.cxx @@ -384,7 +384,7 @@ IMPL_LINK( ScTpSubTotalGroup, CheckHdl, SvTreeListBox*, pLb, void ) if ( pEntry ) { - mpLbColumns->SelectEntryPos( (sal_uInt16)mpLbColumns->GetModel()->GetAbsPos( pEntry ) ); + mpLbColumns->SelectEntryPos( static_cast<sal_uInt16>(mpLbColumns->GetModel()->GetAbsPos( pEntry )) ); SelectHdl( pLb ); } } diff --git a/sc/source/ui/docshell/arealink.cxx b/sc/source/ui/docshell/arealink.cxx index 95fc79d8ed01..a2eb8f095163 100644 --- a/sc/source/ui/docshell/arealink.cxx +++ b/sc/source/ui/docshell/arealink.cxx @@ -292,7 +292,7 @@ bool ScAreaLink::Refresh( const OUString& rNewFile, const OUString& rNewFilter, if( FindExtRange( aTokenRange, &rSrcDoc, aToken ) ) { // columns: find maximum - nWidth = std::max( nWidth, (SCCOL)(aTokenRange.aEnd.Col() - aTokenRange.aStart.Col() + 1) ); + nWidth = std::max( nWidth, static_cast<SCCOL>(aTokenRange.aEnd.Col() - aTokenRange.aStart.Col() + 1) ); // rows: add row range + 1 empty row nHeight += aTokenRange.aEnd.Row() - aTokenRange.aStart.Row() + 2; } diff --git a/sc/source/ui/docshell/autostyl.cxx b/sc/source/ui/docshell/autostyl.cxx index 98a104c4f8c3..dec13ced11a6 100644 --- a/sc/source/ui/docshell/autostyl.cxx +++ b/sc/source/ui/docshell/autostyl.cxx @@ -26,7 +26,7 @@ static inline sal_uLong TimeNow() // seconds { - return (sal_uLong) time(nullptr); + return static_cast<sal_uLong>(time(nullptr)); } namespace { diff --git a/sc/source/ui/docshell/dbdocimp.cxx b/sc/source/ui/docshell/dbdocimp.cxx index 6710ed4659fb..d83fb8be69f4 100644 --- a/sc/source/ui/docshell/dbdocimp.cxx +++ b/sc/source/ui/docshell/dbdocimp.cxx @@ -262,7 +262,7 @@ bool ScDBDocFunc::DoImport( SCTAB nTab, const ScImportParam& rParam, uno::Reference<sdbc::XRow> xRow( xRowSet, uno::UNO_QUERY ); if ( nColCount > 0 && xRow.is() ) { - nEndCol = (SCCOL)( rParam.nCol1 + nColCount - 1 ); + nEndCol = static_cast<SCCOL>( rParam.nCol1 + nColCount - 1 ); uno::Sequence<sal_Int32> aColTypes( nColCount ); // column types uno::Sequence<sal_Bool> aColCurr( nColCount ); // currency flag is not in types diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx index 6f1ba210ff4b..c4f2b2a00168 100644 --- a/sc/source/ui/docshell/docsh.cxx +++ b/sc/source/ui/docshell/docsh.cxx @@ -1506,8 +1506,8 @@ bool ScDocShell::ConvertFrom( SfxMedium& rMedium ) if ( bRet && (bSetColWidths || bSetRowHeights) ) { // Adjust column width/row height; base 100% zoom Fraction aZoom( 1, 1 ); - double nPPTX = ScGlobal::nScreenPPTX * (double) aZoom / GetOutputFactor(); // Factor is printer display ratio - double nPPTY = ScGlobal::nScreenPPTY * (double) aZoom; + double nPPTX = ScGlobal::nScreenPPTX * static_cast<double>(aZoom) / GetOutputFactor(); // Factor is printer display ratio + double nPPTY = ScGlobal::nScreenPPTY * static_cast<double>(aZoom); ScopedVclPtrInstance< VirtualDevice > pVirtDev; // all sheets (for Excel import) SCTAB nTabCount = aDocument.GetTableCount(); @@ -1534,7 +1534,7 @@ bool ScDocShell::ConvertFrom( SfxMedium& rMedium ) nCol, nTab, pVirtDev, nPPTX, nPPTY, aZoom, aZoom, false, &aMark, &aColWidthParam[nCol] ); aDocument.SetColWidth( nCol, nTab, - nWidth + (sal_uInt16)ScGlobal::nLastColWidthExtra ); + nWidth + static_cast<sal_uInt16>(ScGlobal::nLastColWidthExtra) ); } } } @@ -2906,7 +2906,7 @@ void ScDocShell::GetDocStat( ScDocStat& rDocStat ) if ( pPrinter ) for ( SCTAB i=0; i<rDocStat.nTableCount; i++ ) rDocStat.nPageCount = sal::static_int_cast<sal_uInt16>( rDocStat.nPageCount + - (sal_uInt16) ScPrintFunc( this, pPrinter, i ).GetTotalPages() ); + static_cast<sal_uInt16>(ScPrintFunc( this, pPrinter, i ).GetTotalPages()) ); } VclPtr<SfxDocumentInfoDialog> ScDocShell::CreateDocumentInfoDialog( const SfxItemSet &rSet ) diff --git a/sc/source/ui/docshell/docsh2.cxx b/sc/source/ui/docshell/docsh2.cxx index 8dff8eb694b2..568e80078c35 100644 --- a/sc/source/ui/docshell/docsh2.cxx +++ b/sc/source/ui/docshell/docsh2.cxx @@ -48,8 +48,8 @@ bool ScDocShell::InitNew( const uno::Reference < embed::XStorage >& xStor ) // Additional tables are created by the first View, if bIsEmpty is still sal_True if( bRet ) { - Size aSize( (long) ( STD_COL_WIDTH * HMM_PER_TWIPS * OLE_STD_CELLS_X ), - (long) ( ScGlobal::nStdRowHeight * HMM_PER_TWIPS * OLE_STD_CELLS_Y ) ); + Size aSize( long( STD_COL_WIDTH * HMM_PER_TWIPS * OLE_STD_CELLS_X ), + static_cast<long>( ScGlobal::nStdRowHeight * HMM_PER_TWIPS * OLE_STD_CELLS_Y ) ); // Also adjust start here SetVisAreaOrSize( tools::Rectangle( Point(), aSize ) ); } diff --git a/sc/source/ui/docshell/docsh3.cxx b/sc/source/ui/docshell/docsh3.cxx index 35f174613450..8eae0400beee 100644 --- a/sc/source/ui/docshell/docsh3.cxx +++ b/sc/source/ui/docshell/docsh3.cxx @@ -388,10 +388,10 @@ void ScDocShell::CalcOutputFactor() pPattern->GetFont(aDefFont, SC_AUTOCOL_BLACK, pVirtWindow); // font color doesn't matter here pVirtWindow->SetFont(aDefFont); nWindowWidth = pVirtWindow->GetTextWidth(aTestString); - nWindowWidth = (long) ( nWindowWidth / ScGlobal::nScreenPPTX * HMM_PER_TWIPS ); + nWindowWidth = static_cast<long>( nWindowWidth / ScGlobal::nScreenPPTX * HMM_PER_TWIPS ); if (nPrinterWidth && nWindowWidth) - nPrtToScreenFactor = nPrinterWidth / (double) nWindowWidth; + nPrtToScreenFactor = nPrinterWidth / static_cast<double>(nWindowWidth); else { OSL_FAIL("GetTextSize returns 0 ??"); diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx index 98b8d998d22e..9534919842b7 100644 --- a/sc/source/ui/docshell/docsh4.cxx +++ b/sc/source/ui/docshell/docsh4.cxx @@ -1528,7 +1528,7 @@ bool ScDocShell::AdjustPrintZoom( const ScRange& rRange ) long nBlkTwipsX = 0; if (bHeaders) - nBlkTwipsX += (long) PRINT_HEADER_WIDTH; + nBlkTwipsX += long(PRINT_HEADER_WIDTH); SCCOL nStartCol = rRange.aStart.Col(); SCCOL nEndCol = rRange.aEnd.Col(); if ( pRepeatCol && nStartCol >= pRepeatCol->aStart.Col() ) @@ -1546,7 +1546,7 @@ bool ScDocShell::AdjustPrintZoom( const ScRange& rRange ) long nBlkTwipsY = 0; if (bHeaders) - nBlkTwipsY += (long) PRINT_HEADER_HEIGHT; + nBlkTwipsY += long(PRINT_HEADER_HEIGHT); SCROW nStartRow = rRange.aStart.Row(); SCROW nEndRow = rRange.aEnd.Row(); if ( pRepeatRow && nStartRow >= pRepeatRow->aStart.Row() ) @@ -1573,8 +1573,8 @@ bool ScDocShell::AdjustPrintZoom( const ScRange& rRange ) aPhysPage.Height() * 100 / nBlkTwipsY ); if ( nNeeded < ZOOM_MIN ) nNeeded = ZOOM_MIN; // boundary - if ( nNeeded < (long) nNewScale ) - nNewScale = (sal_uInt16) nNeeded; + if ( nNeeded < static_cast<long>(nNewScale) ) + nNewScale = static_cast<sal_uInt16>(nNeeded); bChange = ( nNewScale != nOldScale || nOldPages != 0 ); if ( bChange ) @@ -2078,7 +2078,7 @@ namespace { void SnapHor( const ScDocument& rDoc, SCTAB nTab, long& rVal, SCCOL& rStartCol ) { SCCOL nCol = 0; - long nTwips = (long) (rVal / HMM_PER_TWIPS); + long nTwips = static_cast<long>(rVal / HMM_PER_TWIPS); long nSnap = 0; while ( nCol<MAXCOL ) { @@ -2091,14 +2091,14 @@ void SnapHor( const ScDocument& rDoc, SCTAB nTab, long& rVal, SCCOL& rStartCol ) else break; } - rVal = (long) ( nSnap * HMM_PER_TWIPS ); + rVal = static_cast<long>( nSnap * HMM_PER_TWIPS ); rStartCol = nCol; } void SnapVer( const ScDocument& rDoc, SCTAB nTab, long& rVal, SCROW& rStartRow ) { SCROW nRow = 0; - long nTwips = (long) (rVal / HMM_PER_TWIPS); + long nTwips = static_cast<long>(rVal / HMM_PER_TWIPS); long nSnap = 0; bool bFound = false; @@ -2127,7 +2127,7 @@ void SnapVer( const ScDocument& rDoc, SCTAB nTab, long& rVal, SCROW& rStartRow ) if (!bFound) nRow = MAXROW; // all hidden down to the bottom - rVal = (long) ( nSnap * HMM_PER_TWIPS ); + rVal = static_cast<long>( nSnap * HMM_PER_TWIPS ); rStartRow = nRow; } diff --git a/sc/source/ui/docshell/docsh6.cxx b/sc/source/ui/docshell/docsh6.cxx index 6b611373cd05..f14c8bd8f8b7 100644 --- a/sc/source/ui/docshell/docsh6.cxx +++ b/sc/source/ui/docshell/docsh6.cxx @@ -85,15 +85,15 @@ void ScDocShell::SetVisAreaOrSize( const tools::Rectangle& rVisArea ) // Move the VisArea, otherwise only the upper left position would // be changed in SnapVisArea, and the size would be wrong. - Point aNewPos( 0, std::max( aArea.Top(), (long) 0 ) ); + Point aNewPos( 0, std::max( aArea.Top(), long(0) ) ); if ( bNegativePage ) { - aNewPos.X() = std::min( aArea.Right(), (long) 0 ); + aNewPos.X() = std::min( aArea.Right(), long(0) ); lcl_SetTopRight( aArea, aNewPos ); } else { - aNewPos.X() = std::max( aArea.Left(), (long) 0 ); + aNewPos.X() = std::max( aArea.Left(), long(0) ); aArea.SetPos( aNewPos ); } } diff --git a/sc/source/ui/docshell/docsh8.cxx b/sc/source/ui/docshell/docsh8.cxx index f24ccce4dfcb..2d9bc93ccddc 100644 --- a/sc/source/ui/docshell/docsh8.cxx +++ b/sc/source/ui/docshell/docsh8.cxx @@ -893,7 +893,7 @@ ErrCode ScDocShell::DBaseExport( const OUString& rFullFileName, rtl_TextEncoding xRowProp->setPropertyValue( SC_DBPROP_ACTIVECONNECTION, uno::Any(xConnection) ); - xRowProp->setPropertyValue( SC_DBPROP_COMMANDTYPE, uno::Any((sal_Int32) sdb::CommandType::TABLE) ); + xRowProp->setPropertyValue( SC_DBPROP_COMMANDTYPE, uno::Any(sal_Int32(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 175f3a6b3a07..12f914b2473d 100644 --- a/sc/source/ui/docshell/impex.cxx +++ b/sc/source/ui/docshell/impex.cxx @@ -1083,10 +1083,10 @@ static bool lcl_PutString( { using namespace ::com::sun::star; bool bSecondCal = false; - sal_uInt16 nDay = (sal_uInt16) rStr.copy( nStart[nDP], nEnd[nDP]+1-nStart[nDP] ).toInt32(); - sal_uInt16 nYear = (sal_uInt16) rStr.copy( nStart[nYP], nEnd[nYP]+1-nStart[nYP] ).toInt32(); + sal_uInt16 nDay = static_cast<sal_uInt16>(rStr.copy( nStart[nDP], nEnd[nDP]+1-nStart[nDP] ).toInt32()); + sal_uInt16 nYear = static_cast<sal_uInt16>(rStr.copy( nStart[nYP], nEnd[nYP]+1-nStart[nYP] ).toInt32()); OUString aMStr = rStr.copy( nStart[nMP], nEnd[nMP]+1-nStart[nMP] ); - sal_Int16 nMonth = (sal_Int16) aMStr.toInt32(); + sal_Int16 nMonth = static_cast<sal_Int16>(aMStr.toInt32()); if (!nMonth) { static const char aSepShortened[] = "SEP"; @@ -1149,11 +1149,11 @@ static bool lcl_PutString( // time fields to zero (ICU calendar instance defaults to current date/time) nHour = nMinute = nSecond = nMilli = 0; if (nFound > 3) - nHour = (sal_Int16) rStr.copy( nStart[3], nEnd[3]+1-nStart[3]).toInt32(); + nHour = static_cast<sal_Int16>(rStr.copy( nStart[3], nEnd[3]+1-nStart[3]).toInt32()); if (nFound > 4) - nMinute = (sal_Int16) rStr.copy( nStart[4], nEnd[4]+1-nStart[4]).toInt32(); + nMinute = static_cast<sal_Int16>(rStr.copy( nStart[4], nEnd[4]+1-nStart[4]).toInt32()); if (nFound > 5) - nSecond = (sal_Int16) rStr.copy( nStart[5], nEnd[5]+1-nStart[5]).toInt32(); + nSecond = static_cast<sal_Int16>(rStr.copy( nStart[5], nEnd[5]+1-nStart[5]).toInt32()); if (nFound > 6) { sal_Unicode cDec = '.'; @@ -1162,7 +1162,7 @@ static bool lcl_PutString( rtl_math_ConversionStatus eStatus; double fV = rtl::math::stringToDouble( aT, cDec, 0, &eStatus ); if (eStatus == rtl_math_ConversionStatus_Ok) - nMilli = (sal_Int16) (1000.0 * fV + 0.5); + nMilli = static_cast<sal_Int16>(1000.0 * fV + 0.5); } pCalendar->setValue( i18n::CalendarFieldIndex::HOUR, nHour ); pCalendar->setValue( i18n::CalendarFieldIndex::MINUTE, nMinute ); @@ -1975,7 +1975,7 @@ bool ScImportExport::Sylk2Doc( SvStream& rStrm ) if( nCol > nEndCol ) nEndCol = nCol; } - if ( 0 <= nFormat && nFormat < (sal_Int32)aFormats.size() && !bInvalidCol && !bInvalidRow ) + if ( 0 <= nFormat && nFormat < static_cast<sal_Int32>(aFormats.size()) && !bInvalidCol && !bInvalidRow ) { sal_uInt32 nKey = aFormats[nFormat]; pDoc->ApplyAttr( nCol, nRow, aRange.aStart.Tab(), diff --git a/sc/source/ui/docshell/pagedata.cxx b/sc/source/ui/docshell/pagedata.cxx index 0b185a6e93af..eadfc8c81614 100644 --- a/sc/source/ui/docshell/pagedata.cxx +++ b/sc/source/ui/docshell/pagedata.cxx @@ -91,7 +91,7 @@ void ScPageBreakData::AddPages() long nPage = pData[0].GetFirstPage(); for (size_t i=0; i+1<nUsed; i++) { - nPage += ((long)pData[i].GetPagesX())*pData[i].GetPagesY(); + nPage += static_cast<long>(pData[i].GetPagesX())*pData[i].GetPagesY(); pData[i+1].SetFirstPage( nPage ); } } diff --git a/sc/source/ui/drawfunc/drawsh5.cxx b/sc/source/ui/drawfunc/drawsh5.cxx index 95122e1c9e0d..b42df285c509 100644 --- a/sc/source/ui/drawfunc/drawsh5.cxx +++ b/sc/source/ui/drawfunc/drawsh5.cxx @@ -221,7 +221,7 @@ void ScDrawShell::ExecuteHLink( const SfxRequest& rReq ) if (!bDone) pViewData->GetViewShell()-> - InsertURL( rName, rURL, rTarget, (sal_uInt16) eMode ); + InsertURL( rName, rURL, rTarget, static_cast<sal_uInt16>(eMode) ); // If "text" is received by InsertURL of ViewShell, then the DrawShell is turned off !!! } diff --git a/sc/source/ui/drawfunc/fuins1.cxx b/sc/source/ui/drawfunc/fuins1.cxx index f7f99bc6bd56..36cecff0384a 100644 --- a/sc/source/ui/drawfunc/fuins1.cxx +++ b/sc/source/ui/drawfunc/fuins1.cxx @@ -61,18 +61,18 @@ void ScLimitSizeOnDrawPage( Size& rSize, Point& rPos, const Size& rPage ) if ( rSize.Width() > aPageSize.Width() || rSize.Height() > aPageSize.Height() ) { - double fX = aPageSize.Width() / (double) rSize.Width(); - double fY = aPageSize.Height() / (double) rSize.Height(); + double fX = aPageSize.Width() / static_cast<double>(rSize.Width()); + double fY = aPageSize.Height() / static_cast<double>(rSize.Height()); if ( fX < fY ) { rSize.Width() = aPageSize.Width(); - rSize.Height() = (long) ( rSize.Height() * fX ); + rSize.Height() = static_cast<long>( rSize.Height() * fX ); } else { rSize.Height() = aPageSize.Height(); - rSize.Width() = (long) ( rSize.Width() * fY ); + rSize.Width() = static_cast<long>( rSize.Width() * fY ); } if (!rSize.Width()) diff --git a/sc/source/ui/drawfunc/fupoor.cxx b/sc/source/ui/drawfunc/fupoor.cxx index 4422c944da9a..401c5993463e 100644 --- a/sc/source/ui/drawfunc/fupoor.cxx +++ b/sc/source/ui/drawfunc/fupoor.cxx @@ -203,8 +203,8 @@ bool FuPoor::IsDetectiveHit( const Point& rLogicPos ) { if (ScDetectiveFunc::IsNonAlienArrow( pObject )) { - sal_uInt16 nHitLog = (sal_uInt16) pWindow->PixelToLogic( - Size(pView->GetHitTolerancePixel(),0)).Width(); + sal_uInt16 nHitLog = static_cast<sal_uInt16>(pWindow->PixelToLogic( + Size(pView->GetHitTolerancePixel(),0)).Width()); if(SdrObjectPrimitiveHit(*pObject, rLogicPos, nHitLog, *pPV, nullptr, false)) { bFound = true; diff --git a/sc/source/ui/drawfunc/fusel2.cxx b/sc/source/ui/drawfunc/fusel2.cxx index 4c3318a50ebf..6fc497ab8f0b 100644 --- a/sc/source/ui/drawfunc/fusel2.cxx +++ b/sc/source/ui/drawfunc/fusel2.cxx @@ -58,8 +58,8 @@ bool FuSelection::TestDetective( const SdrPageView* pPV, const Point& rPos ) { if (ScDetectiveFunc::IsNonAlienArrow( pObject )) { - sal_uInt16 nHitLog = (sal_uInt16) pWindow->PixelToLogic( - Size(pView->GetHitTolerancePixel(),0)).Width(); + sal_uInt16 nHitLog = static_cast<sal_uInt16>(pWindow->PixelToLogic( + Size(pView->GetHitTolerancePixel(),0)).Width()); if (SdrObjectPrimitiveHit(*pObject, rPos, nHitLog, *pPV, nullptr, false)) { ScViewData& rViewData = pViewShell->GetViewData(); diff --git a/sc/source/ui/drawfunc/futext.cxx b/sc/source/ui/drawfunc/futext.cxx index f95b6465e07d..38583597b9d2 100644 --- a/sc/source/ui/drawfunc/futext.cxx +++ b/sc/source/ui/drawfunc/futext.cxx @@ -417,7 +417,7 @@ bool FuText::MouseButtonUp(const MouseEvent& rMEvt) aItemSet.Put( SdrTextAniDirectionItem( SdrTextAniDirection::Left ) ); aItemSet.Put( SdrTextAniCountItem( 1 ) ); aItemSet.Put( SdrTextAniAmountItem( - (sal_Int16)pWindow->PixelToLogic(Size(2,1)).Width()) ); + static_cast<sal_Int16>(pWindow->PixelToLogic(Size(2,1)).Width())) ); pObj->SetMergedItemSetAndBroadcast(aItemSet); } } @@ -683,7 +683,7 @@ SdrObject* FuText::CreateDefaultObject(const sal_uInt16 nID, const tools::Rectan aSet.Put( SdrTextAniKindItem( SdrTextAniKind::Slide ) ); aSet.Put( SdrTextAniDirectionItem( SdrTextAniDirection::Left ) ); aSet.Put( SdrTextAniCountItem( 1 ) ); - aSet.Put( SdrTextAniAmountItem( (sal_Int16)pWindow->PixelToLogic(Size(2,1)).Width()) ); + aSet.Put( SdrTextAniAmountItem( static_cast<sal_Int16>(pWindow->PixelToLogic(Size(2,1)).Width())) ); pObj->SetMergedItemSetAndBroadcast(aSet); } diff --git a/sc/source/ui/formdlg/formula.cxx b/sc/source/ui/formdlg/formula.cxx index 6c52eb700b4b..1856d0ef4f0c 100644 --- a/sc/source/ui/formdlg/formula.cxx +++ b/sc/source/ui/formdlg/formula.cxx @@ -175,7 +175,7 @@ ScFormulaDlg::ScFormulaDlg( SfxBindings* pB, SfxChildWindow* pCW, pData->SetFStart( 1 ); // after "=" } - pData->SetMode( (sal_uInt16) eMode ); + pData->SetMode( static_cast<sal_uInt16>(eMode) ); OUString rStrExp = GetMeText(); Update(rStrExp); diff --git a/sc/source/ui/inc/navipi.hxx b/sc/source/ui/inc/navipi.hxx index 95ad856bea39..dc62b5080d9f 100644 --- a/sc/source/ui/inc/navipi.hxx +++ b/sc/source/ui/inc/navipi.hxx @@ -148,7 +148,7 @@ public: { xDlg = pNaviDlg; } - SCROW GetRow() { return (SCROW)GetValue(); } + SCROW GetRow() { return static_cast<SCROW>(GetValue()); } void SetRow(SCROW nRow) { SetValue(nRow); } protected: diff --git a/sc/source/ui/inc/viewdata.hxx b/sc/source/ui/inc/viewdata.hxx index a87f3dbe6f11..26f372a33767 100644 --- a/sc/source/ui/inc/viewdata.hxx +++ b/sc/source/ui/inc/viewdata.hxx @@ -602,7 +602,7 @@ public: inline long ScViewData::ToPixel( sal_uInt16 nTwips, double nFactor ) { - long nRet = (long)( nTwips * nFactor ); + long nRet = static_cast<long>( nTwips * nFactor ); if ( !nRet && nTwips ) nRet = 1; return nRet; diff --git a/sc/source/ui/miscdlgs/acredlin.cxx b/sc/source/ui/miscdlgs/acredlin.cxx index 660f38b1d584..c1edb5cc8082 100644 --- a/sc/source/ui/miscdlgs/acredlin.cxx +++ b/sc/source/ui/miscdlgs/acredlin.cxx @@ -1748,13 +1748,13 @@ void ScAcceptChgDlg::Initialize(SfxChildWinInfo *pInfo) if ( !aStr.isEmpty()) { - sal_uInt16 nCount=(sal_uInt16)aStr.toInt32(); + sal_uInt16 nCount=static_cast<sal_uInt16>(aStr.toInt32()); for(sal_uInt16 i=0;i<nCount;i++) { sal_Int32 n1 = aStr.indexOf(';'); aStr = aStr.copy( n1+1 ); - pTheView->SetTab(i, (sal_uInt16)aStr.toInt32(), MapUnit::MapPixel); + pTheView->SetTab(i, static_cast<sal_uInt16>(aStr.toInt32()), MapUnit::MapPixel); } } } diff --git a/sc/source/ui/miscdlgs/autofmt.cxx b/sc/source/ui/miscdlgs/autofmt.cxx index e5276b3f8803..a6ffdfe75389 100644 --- a/sc/source/ui/miscdlgs/autofmt.cxx +++ b/sc/source/ui/miscdlgs/autofmt.cxx @@ -308,7 +308,7 @@ void ScAutoFmtPreview::DrawString(vcl::RenderContext& rRenderContext, size_t nCo // vertical (always center): - aPos.Y() += (mnRowHeight - (sal_uInt16)aStrSize.Height()) / 2; + aPos.Y() += (mnRowHeight - static_cast<sal_uInt16>(aStrSize.Height())) / 2; // horizontal diff --git a/sc/source/ui/miscdlgs/crnrdlg.cxx b/sc/source/ui/miscdlgs/crnrdlg.cxx index 24087e0bbd95..1931a73b5cc8 100644 --- a/sc/source/ui/miscdlgs/crnrdlg.cxx +++ b/sc/source/ui/miscdlgs/crnrdlg.cxx @@ -766,7 +766,7 @@ IMPL_LINK_NOARG(ScColRowNameRangesDlg, ColClickHdl, Button*, void) pEdAssign->SetText( aStr ); } ScRange aRange( theCurData ); - aRange.aStart.SetRow( std::min( (long)(theCurArea.aEnd.Row() + 1), (long)MAXROW ) ); + aRange.aStart.SetRow( std::min( static_cast<long>(theCurArea.aEnd.Row() + 1), long(MAXROW) ) ); aRange.aEnd.SetRow( MAXROW ); AdjustColRowData( aRange ); } @@ -786,7 +786,7 @@ IMPL_LINK_NOARG(ScColRowNameRangesDlg, RowClickHdl, Button*, void) pEdAssign->SetText( aStr ); } ScRange aRange( theCurData ); - aRange.aStart.SetCol( static_cast<SCCOL>(std::min( (long)(theCurArea.aEnd.Col() + 1), (long)MAXCOL )) ); + aRange.aStart.SetCol( static_cast<SCCOL>(std::min( static_cast<long>(theCurArea.aEnd.Col() + 1), long(MAXCOL) )) ); aRange.aEnd.SetCol( MAXCOL ); AdjustColRowData( aRange ); } diff --git a/sc/source/ui/miscdlgs/optsolver.cxx b/sc/source/ui/miscdlgs/optsolver.cxx index 7c753326be82..89594f57ab5b 100644 --- a/sc/source/ui/miscdlgs/optsolver.cxx +++ b/sc/source/ui/miscdlgs/optsolver.cxx @@ -459,10 +459,10 @@ void ScOptSolverDlg::ReadConditions() aRowEntry.nOperator = mpOperator[nRow]->GetSelectedEntryPos(); long nVecPos = nScrollPos + nRow; - if ( nVecPos >= (long)maConditions.size() && !aRowEntry.IsDefault() ) + if ( nVecPos >= static_cast<long>(maConditions.size()) && !aRowEntry.IsDefault() ) maConditions.resize( nVecPos + 1 ); - if ( nVecPos < (long)maConditions.size() ) + if ( nVecPos < static_cast<long>(maConditions.size()) ) maConditions[nVecPos] = aRowEntry; // remove default entries at the end @@ -480,7 +480,7 @@ void ScOptSolverDlg::ShowConditions() ScOptConditionRow aRowEntry; long nVecPos = nScrollPos + nRow; - if ( nVecPos < (long)maConditions.size() ) + if ( nVecPos < static_cast<long>(maConditions.size()) ) aRowEntry = maConditions[nVecPos]; mpLeftEdit[nRow]->SetRefString( aRowEntry.aLeftStr ); @@ -490,7 +490,7 @@ void ScOptSolverDlg::ShowConditions() // allow to scroll one page behind the visible or stored rows long nVisible = nScrollPos + EDIT_ROW_COUNT; - long nMax = std::max( nVisible, (long) maConditions.size() ); + long nMax = std::max( nVisible, static_cast<long>(maConditions.size()) ); m_pScrollBar->SetRange( Range( 0, nMax + EDIT_ROW_COUNT ) ); m_pScrollBar->SetThumbPos( nScrollPos ); @@ -502,7 +502,7 @@ void ScOptSolverDlg::EnableButtons() for ( sal_uInt16 nRow = 0; nRow < EDIT_ROW_COUNT; ++nRow ) { long nVecPos = nScrollPos + nRow; - mpDelButton[nRow]->Enable( nVecPos < (long)maConditions.size() ); + mpDelButton[nRow]->Enable( nVecPos < static_cast<long>(maConditions.size()) ); } } @@ -667,7 +667,7 @@ IMPL_LINK( ScOptSolverDlg, DelBtnHdl, Button*, pBtn, void ) ReadConditions(); long nVecPos = nScrollPos + nRow; - if ( nVecPos < (long)maConditions.size() ) + if ( nVecPos < static_cast<long>(maConditions.size()) ) { maConditions.erase( maConditions.begin() + nVecPos ); ShowConditions(); diff --git a/sc/source/ui/miscdlgs/solveroptions.cxx b/sc/source/ui/miscdlgs/solveroptions.cxx index 59f00ed46851..d9e8ef4bdce6 100644 --- a/sc/source/ui/miscdlgs/solveroptions.cxx +++ b/sc/source/ui/miscdlgs/solveroptions.cxx @@ -184,7 +184,7 @@ const uno::Sequence<beans::PropertyValue>& ScSolverOptionsDialog::GetProperties( // order of entries in list box and maProperties is the same sal_Int32 nEntryCount = maProperties.getLength(); SvTreeList* pModel = m_pLbSettings->GetModel(); - if ( nEntryCount == (sal_Int32)pModel->GetEntryCount() ) + if ( nEntryCount == static_cast<sal_Int32>(pModel->GetEntryCount()) ) { for (sal_Int32 nEntryPos=0; nEntryPos<nEntryCount; ++nEntryPos) { @@ -428,7 +428,7 @@ sal_Int32 ScSolverIntegerDialog::GetValue() const return SAL_MIN_INT32; if ( nValue > SAL_MAX_INT32 ) return SAL_MAX_INT32; - return (sal_Int32) nValue; + return static_cast<sal_Int32>(nValue); } ScSolverValueDialog::ScSolverValueDialog( vcl::Window * pParent ) diff --git a/sc/source/ui/navipi/navipi.cxx b/sc/source/ui/navipi/navipi.cxx index e84c61e056dc..a9e650230473 100644 --- a/sc/source/ui/navipi/navipi.cxx +++ b/sc/source/ui/navipi/navipi.cxx @@ -233,7 +233,7 @@ SCCOL ColumnEdit::NumStrToAlpha( OUString& rStr ) SCCOL nColumn = 0; if ( CharClass::isAsciiNumeric(rStr) ) - nColumn = NumToAlpha( (SCCOL)rStr.toInt32(), rStr ); + nColumn = NumToAlpha( static_cast<SCCOL>(rStr.toInt32()), rStr ); else rStr.clear(); @@ -304,7 +304,7 @@ Size RowEdit::GetOptimalSize() const void RowEdit::ExecuteRow() { SCCOL nCol = xDlg->aEdCol->GetCol(); - SCROW nRow = (SCROW)GetValue(); + SCROW nRow = static_cast<SCROW>(GetValue()); if ( (nCol > 0) && (nRow > 0) ) xDlg->SetCurrentCell(nCol - 1, nRow - 1); @@ -923,7 +923,7 @@ void ScNavigatorDlg::SetListMode(NavListMode eMode) if (eMode != NAV_LMODE_NONE) { ScNavipiCfg& rCfg = SC_MOD()->GetNavipiCfg(); - rCfg.SetListMode( (sal_uInt16) eMode ); + rCfg.SetListMode( static_cast<sal_uInt16>(eMode) ); } if (pNav) diff --git a/sc/source/ui/optdlg/tpcalc.cxx b/sc/source/ui/optdlg/tpcalc.cxx index 4ec601a23ac6..4a2e0a4e1a4a 100644 --- a/sc/source/ui/optdlg/tpcalc.cxx +++ b/sc/source/ui/optdlg/tpcalc.cxx @@ -192,7 +192,7 @@ void ScTpCalcOptions::Reset( const SfxItemSet* /* rCoreAttrs */ ) bool ScTpCalcOptions::FillItemSet( SfxItemSet* rCoreAttrs ) { // every other options are updated in handlers - pLocalOptions->SetIterCount( (sal_uInt16)m_pEdSteps->GetValue() ); + pLocalOptions->SetIterCount( static_cast<sal_uInt16>(m_pEdSteps->GetValue()) ); pLocalOptions->SetIgnoreCase( !m_pBtnCase->IsChecked() ); pLocalOptions->SetCalcAsShown( m_pBtnCalc->IsChecked() ); pLocalOptions->SetMatchWholeCell( m_pBtnMatch->IsChecked() ); diff --git a/sc/source/ui/optdlg/tpformula.cxx b/sc/source/ui/optdlg/tpformula.cxx index 14bd0695589d..0bd80b7f62db 100644 --- a/sc/source/ui/optdlg/tpformula.cxx +++ b/sc/source/ui/optdlg/tpformula.cxx @@ -116,7 +116,7 @@ void ScTpFormulaOptions::OnFocusSeparatorInput(Edit* pEdit) // Make sure the entire text is selected. sal_Int32 nLen = pEdit->GetText().getLength(); - Selection aSel(0, (sal_uInt16)nLen); + Selection aSel(0, static_cast<sal_uInt16>(nLen)); pEdit->SetSelection(aSel); maOldSepValue = pEdit->GetText(); } diff --git a/sc/source/ui/optdlg/tpview.cxx b/sc/source/ui/optdlg/tpview.cxx index 195259b2fd00..e9d4a1006693 100644 --- a/sc/source/ui/optdlg/tpview.cxx +++ b/sc/source/ui/optdlg/tpview.cxx @@ -188,9 +188,9 @@ void ScTpContentOptions::Reset( const SfxItemSet* rCoreSet ) pAnchorCB ->Check(pLocalOptions->GetOption(VOPT_ANCHOR)); pClipMarkCB->Check(pLocalOptions->GetOption(VOPT_CLIPMARKS)); - pObjGrfLB ->SelectEntryPos( (sal_uInt16)pLocalOptions->GetObjMode(VOBJ_TYPE_OLE) ); - pDiagramLB ->SelectEntryPos( (sal_uInt16)pLocalOptions->GetObjMode(VOBJ_TYPE_CHART) ); - pDrawLB ->SelectEntryPos( (sal_uInt16)pLocalOptions->GetObjMode(VOBJ_TYPE_DRAW) ); + pObjGrfLB ->SelectEntryPos( static_cast<sal_uInt16>(pLocalOptions->GetObjMode(VOBJ_TYPE_OLE)) ); + pDiagramLB ->SelectEntryPos( static_cast<sal_uInt16>(pLocalOptions->GetObjMode(VOBJ_TYPE_CHART)) ); + pDrawLB ->SelectEntryPos( static_cast<sal_uInt16>(pLocalOptions->GetObjMode(VOBJ_TYPE_DRAW)) ); pRowColHeaderCB->Check( pLocalOptions->GetOption(VOPT_HEADER) ); pHScrollCB->Check( pLocalOptions->GetOption(VOPT_HSCROLL) ); @@ -372,7 +372,7 @@ ScTpLayoutOptions::ScTpLayoutOptions( vcl::Window* pParent, { // only use these metrics sal_Int32 nPos = m_pUnitLB->InsertEntry( sMetric ); - m_pUnitLB->SetEntryData( nPos, reinterpret_cast<void*>((sal_IntPtr)eFUnit) ); + m_pUnitLB->SetEntryData( nPos, reinterpret_cast<void*>(static_cast<sal_IntPtr>(eFUnit)) ); } break; default: @@ -426,7 +426,7 @@ bool ScTpLayoutOptions::FillItemSet( SfxItemSet* rCoreSet ) const sal_Int32 nMPos = m_pUnitLB->GetSelectedEntryPos(); if ( m_pUnitLB->IsValueChangedFromSaved() ) { - sal_uInt16 nFieldUnit = (sal_uInt16)reinterpret_cast<sal_IntPtr>(m_pUnitLB->GetEntryData( nMPos )); + sal_uInt16 nFieldUnit = static_cast<sal_uInt16>(reinterpret_cast<sal_IntPtr>(m_pUnitLB->GetEntryData( nMPos ))); rCoreSet->Put( SfxUInt16Item( SID_ATTR_METRIC, nFieldUnit ) ); bRet = true; } diff --git a/sc/source/ui/pagedlg/tptable.cxx b/sc/source/ui/pagedlg/tptable.cxx index 0c9c80f8d141..43a938b2c33b 100644 --- a/sc/source/ui/pagedlg/tptable.cxx +++ b/sc/source/ui/pagedlg/tptable.cxx @@ -327,7 +327,7 @@ bool ScTablePage::FillItemSet( SfxItemSet* rCoreSet ) } else { - sal_uInt16 nPage = (sal_uInt16)( m_pBtnPageNo->IsChecked() + sal_uInt16 nPage = static_cast<sal_uInt16>( m_pBtnPageNo->IsChecked() ? m_pEdPageNo->GetValue() : 0 ); @@ -355,7 +355,7 @@ bool ScTablePage::FillItemSet( SfxItemSet* rCoreSet ) bDataChanged |= lcl_PutScaleItem( GetWhich(SID_SCATTR_PAGE_SCALE), *rCoreSet, rOldSet, *m_pLbScaleMode, SC_TPTABLE_SCALE_PERCENT, - *m_pEdScaleAll, (sal_uInt16)m_pEdScaleAll->GetValue() ); + *m_pEdScaleAll, static_cast<sal_uInt16>(m_pEdScaleAll->GetValue()) ); bDataChanged |= lcl_PutScaleItem2( GetWhich(SID_SCATTR_PAGE_SCALETO), *rCoreSet, rOldSet, @@ -366,7 +366,7 @@ bool ScTablePage::FillItemSet( SfxItemSet* rCoreSet ) bDataChanged |= lcl_PutScaleItem( GetWhich(SID_SCATTR_PAGE_SCALETOPAGES), *rCoreSet, rOldSet, *m_pLbScaleMode, SC_TPTABLE_SCALE_TO_PAGES, - *m_pEdScalePageNum, (sal_uInt16)m_pEdScalePageNum->GetValue() ); + *m_pEdScalePageNum, static_cast<sal_uInt16>(m_pEdScalePageNum->GetValue()) ); return bDataChanged; } diff --git a/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx index cdb79078bb79..318aa838b891 100644 --- a/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx +++ b/sc/source/ui/sidebar/AlignmentPropertyPanel.cxx @@ -177,8 +177,8 @@ IMPL_LINK_NOARG( AlignmentPropertyPanel, AngleModifiedHdl, Edit&, void ) FormatDegrees(fTmp); - sal_Int64 nTmp = (sal_Int64)fTmp*100; - SfxInt32Item aAngleItem( SID_ATTR_ALIGN_DEGREES,(sal_uInt32) nTmp); + sal_Int64 nTmp = static_cast<sal_Int64>(fTmp)*100; + SfxInt32Item aAngleItem( SID_ATTR_ALIGN_DEGREES,static_cast<sal_uInt32>(nTmp)); GetBindings()->GetDispatcher()->ExecuteList( SID_ATTR_ALIGN_DEGREES, SfxCallMode::RECORD, { &aAngleItem }); @@ -193,8 +193,8 @@ IMPL_LINK_NOARG( AlignmentPropertyPanel, ClickStackHdl, Button*, void ) IMPL_LINK_NOARG(AlignmentPropertyPanel, MFLeftIndentMdyHdl, Edit&, void) { mpCBXWrapText->EnableTriState(false); - sal_uInt16 nVal = (sal_uInt16)mpMFLeftIndent->GetValue(); - SfxUInt16Item aItem( SID_ATTR_ALIGN_INDENT, (sal_uInt16)CalcToUnit( nVal, MapUnit::MapTwip ) ); + sal_uInt16 nVal = static_cast<sal_uInt16>(mpMFLeftIndent->GetValue()); + SfxUInt16Item aItem( SID_ATTR_ALIGN_INDENT, static_cast<sal_uInt16>(CalcToUnit( nVal, MapUnit::MapTwip )) ); GetBindings()->GetDispatcher()->ExecuteList(SID_ATTR_ALIGN_INDENT, SfxCallMode::RECORD, { &aItem }); diff --git a/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx b/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx index a0c9eb940f8f..e56ade71b0d5 100644 --- a/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx +++ b/sc/source/ui/sidebar/NumberFormatPropertyPanel.cxx @@ -128,13 +128,13 @@ IMPL_LINK_NOARG( NumberFormatPropertyPanel, NumFormatValueHdl, Edit&, void ) || ( mpBtnEngineering->IsVisible() && mpBtnEngineering->IsEnabled() && mpBtnEngineering->IsChecked() ); bool bNegRed = mpBtnNegRed->IsEnabled() && mpBtnNegRed->IsChecked(); sal_uInt16 nPrecision = (mpEdDecimals->IsEnabled() && mpEdDecimals->IsVisible()) - ? (sal_uInt16)mpEdDecimals->GetValue() + ? static_cast<sal_uInt16>(mpEdDecimals->GetValue()) : (mpEdDenominator->IsEnabled() && mpEdDenominator->IsVisible()) - ? (sal_uInt16)mpEdDenominator->GetValue() - : (sal_uInt16)0; + ? static_cast<sal_uInt16>(mpEdDenominator->GetValue()) + : sal_uInt16(0); sal_uInt16 nLeadZeroes = (mpEdLeadZeroes->IsEnabled()) - ? (sal_uInt16)mpEdLeadZeroes->GetValue() - : (sal_uInt16)0; + ? static_cast<sal_uInt16>(mpEdLeadZeroes->GetValue()) + : sal_uInt16(0); OUString sThousand = OUString::number(static_cast<sal_Int32>(bThousand)); OUString sNegRed = OUString::number(static_cast<sal_Int32>(bNegRed)); diff --git a/sc/source/ui/styleui/styledlg.cxx b/sc/source/ui/styleui/styledlg.cxx index 328b015f5d5f..e68b412fcaa2 100644 --- a/sc/source/ui/styleui/styledlg.cxx +++ b/sc/source/ui/styleui/styledlg.cxx @@ -151,7 +151,7 @@ void ScStyleDlg::PageCreated( sal_uInt16 nPageId, SfxTabPage& rTabPage ) SfxAllItemSet aSet(*(GetInputSetImpl()->GetPool())); if (nPageId == m_nPageId) { - aSet.Put (SfxAllEnumItem((sal_uInt16)SID_ENUM_PAGE_MODE, SVX_PAGE_MODE_CENTER)); + aSet.Put (SfxAllEnumItem(sal_uInt16(SID_ENUM_PAGE_MODE), SVX_PAGE_MODE_CENTER)); rTabPage.PageCreated(aSet); } else if (nPageId == m_nHeaderId || nPageId == m_nFooterId) diff --git a/sc/source/ui/undo/undocell.cxx b/sc/source/ui/undo/undocell.cxx index 13314009be56..972b8d76032f 100644 --- a/sc/source/ui/undo/undocell.cxx +++ b/sc/source/ui/undo/undocell.cxx @@ -875,7 +875,7 @@ ScUndoDetective::ScUndoDetective( ScDocShell* pNewDocShell, bIsDelete = ( pOperation == nullptr ); if (!bIsDelete) { - nAction = (sal_uInt16) pOperation->GetOperation(); + nAction = static_cast<sal_uInt16>(pOperation->GetOperation()); aPos = pOperation->GetPos(); } } diff --git a/sc/source/ui/undo/undotab.cxx b/sc/source/ui/undo/undotab.cxx index db0c34d0568c..290457ce4f87 100644 --- a/sc/source/ui/undo/undotab.cxx +++ b/sc/source/ui/undo/undotab.cxx @@ -277,7 +277,7 @@ void ScUndoDeleteTab::SetChangeTrack() aRange.aStart.SetTab( theTabs[i] ); aRange.aEnd.SetTab( theTabs[i] ); pChangeTrack->AppendDeleteRange( aRange, pRefUndoDoc, - nTmpChangeAction, nEndChangeAction, (short) i ); + nTmpChangeAction, nEndChangeAction, static_cast<short>(i) ); } } else diff --git a/sc/source/ui/unoobj/afmtuno.cxx b/sc/source/ui/unoobj/afmtuno.cxx index 4adf5aa937ec..cd7dd861c9ed 100644 --- a/sc/source/ui/unoobj/afmtuno.cxx +++ b/sc/source/ui/unoobj/afmtuno.cxx @@ -295,7 +295,7 @@ sal_Int32 SAL_CALL ScAutoFormatsObj::getCount() uno::Any SAL_CALL ScAutoFormatsObj::getByIndex( sal_Int32 nIndex ) { SolarMutexGuard aGuard; - uno::Reference< container::XNamed > xFormat(GetObjectByIndex_Impl((sal_uInt16)nIndex)); + uno::Reference< container::XNamed > xFormat(GetObjectByIndex_Impl(static_cast<sal_uInt16>(nIndex))); if (!xFormat.is()) throw lang::IndexOutOfBoundsException(); return uno::makeAny(xFormat); @@ -443,7 +443,7 @@ uno::Any SAL_CALL ScAutoFormatObj::getByIndex( sal_Int32 nIndex ) throw lang::IndexOutOfBoundsException(); if (IsInserted()) - return uno::makeAny(uno::Reference< beans::XPropertySet >(GetObjectByIndex_Impl((sal_uInt16)nIndex))); + return uno::makeAny(uno::Reference< beans::XPropertySet >(GetObjectByIndex_Impl(static_cast<sal_uInt16>(nIndex)))); return uno::Any(); } diff --git a/sc/source/ui/unoobj/appluno.cxx b/sc/source/ui/unoobj/appluno.cxx index 2f94542b7875..ead9147989e5 100644 --- a/sc/source/ui/unoobj/appluno.cxx +++ b/sc/source/ui/unoobj/appluno.cxx @@ -350,7 +350,7 @@ void SAL_CALL ScSpreadsheetSettings::setPropertyValue( // ScGlobal::SetUseTabCol does not do much else pUserList->clear(); - sal_uInt16 nCount = (sal_uInt16)aSeq.getLength(); + sal_uInt16 nCount = static_cast<sal_uInt16>(aSeq.getLength()); const OUString* pAry = aSeq.getConstArray(); for (sal_uInt16 i=0; i<nCount; i++) { @@ -395,16 +395,16 @@ uno::Any SAL_CALL ScSpreadsheetSettings::getPropertyValue( const OUString& aProp else if (aPropertyName == SC_UNONAME_ENTERED ) aRet <<= aInpOpt.GetEnterEdit(); else if (aPropertyName == SC_UNONAME_EXPREF ) aRet <<= aInpOpt.GetExpandRefs(); else if (aPropertyName == SC_UNONAME_EXTFMT ) aRet <<= aInpOpt.GetExtendFormat(); - else if (aPropertyName == SC_UNONAME_LINKUPD ) aRet <<= (sal_Int16) aAppOpt.GetLinkMode(); + else if (aPropertyName == SC_UNONAME_LINKUPD ) aRet <<= static_cast<sal_Int16>(aAppOpt.GetLinkMode()); else if (aPropertyName == SC_UNONAME_MARKHDR ) aRet <<= aInpOpt.GetMarkHeader(); else if (aPropertyName == SC_UNONAME_MOVESEL ) aRet <<= aInpOpt.GetMoveSelection(); else if (aPropertyName == SC_UNONAME_RANGEFIN ) aRet <<= aInpOpt.GetRangeFinder(); else if (aPropertyName == SC_UNONAME_USETABCOL ) aRet <<= aInpOpt.GetUseTabCol(); else if (aPropertyName == SC_UNONAME_PRMETRICS ) aRet <<= aInpOpt.GetTextWysiwyg(); else if (aPropertyName == SC_UNONAME_REPLWARN ) aRet <<= aInpOpt.GetReplaceCellsWarn(); - else if (aPropertyName == SC_UNONAME_METRIC ) aRet <<= (sal_Int16) aAppOpt.GetAppMetric(); - else if (aPropertyName == SC_UNONAME_MOVEDIR ) aRet <<= (sal_Int16) aInpOpt.GetMoveDir(); - else if (aPropertyName == SC_UNONAME_STBFUNC ) aRet <<= (sal_Int16) aAppOpt.GetStatusFunc(); + else if (aPropertyName == SC_UNONAME_METRIC ) aRet <<= static_cast<sal_Int16>(aAppOpt.GetAppMetric()); + else if (aPropertyName == SC_UNONAME_MOVEDIR ) aRet <<= static_cast<sal_Int16>(aInpOpt.GetMoveDir()); + else if (aPropertyName == SC_UNONAME_STBFUNC ) aRet <<= static_cast<sal_Int16>(aAppOpt.GetStatusFunc()); else if (aPropertyName == SC_UNONAME_SCALE ) { sal_Int16 nZoomVal = 0; @@ -486,12 +486,12 @@ void SAL_CALL ScRecentFunctionsObj::setRecentFunctionIds( const uno::Sequence<sal_Int32>& aRecentFunctionIds ) { SolarMutexGuard aGuard; - sal_uInt16 nCount = (sal_uInt16) std::min( aRecentFunctionIds.getLength(), (sal_Int32) LRU_MAX ); + sal_uInt16 nCount = static_cast<sal_uInt16>(std::min( aRecentFunctionIds.getLength(), sal_Int32(LRU_MAX) )); const sal_Int32* pAry = aRecentFunctionIds.getConstArray(); std::unique_ptr<sal_uInt16[]> pFuncs(nCount ? new sal_uInt16[nCount] : nullptr); for (sal_uInt16 i=0; i<nCount; i++) - pFuncs[i] = (sal_uInt16)pAry[i]; //! check for valid values? + pFuncs[i] = static_cast<sal_uInt16>(pAry[i]); //! check for valid values? ScModule* pScMod = SC_MOD(); ScAppOptions aNewOpts(pScMod->GetAppOptions()); @@ -529,10 +529,10 @@ static void lcl_FillSequence( uno::Sequence<beans::PropertyValue>& rSequence, co beans::PropertyValue* pArray = rSequence.getArray(); pArray[0].Name = SC_UNONAME_ID; - pArray[0].Value <<= (sal_Int32) rDesc.nFIndex; + pArray[0].Value <<= static_cast<sal_Int32>(rDesc.nFIndex); pArray[1].Name = SC_UNONAME_CATEGORY; - pArray[1].Value <<= (sal_Int32) rDesc.nCategory; + pArray[1].Value <<= static_cast<sal_Int32>(rDesc.nCategory); pArray[2].Name = SC_UNONAME_NAME; if (rDesc.pFuncName) @@ -582,7 +582,7 @@ uno::Sequence<beans::PropertyValue> SAL_CALL ScFunctionListObj::getById( sal_Int if ( !pFuncList ) throw uno::RuntimeException(); // should not happen - sal_uInt16 nCount = (sal_uInt16)pFuncList->GetCount(); + sal_uInt16 nCount = static_cast<sal_uInt16>(pFuncList->GetCount()); for (sal_uInt16 nIndex=0; nIndex<nCount; nIndex++) { const ScFuncDesc* pDesc = pFuncList->GetFunction(nIndex); @@ -606,7 +606,7 @@ uno::Any SAL_CALL ScFunctionListObj::getByName( const OUString& aName ) if ( !pFuncList ) throw uno::RuntimeException(); // should not happen - sal_uInt16 nCount = (sal_uInt16)pFuncList->GetCount(); + sal_uInt16 nCount = static_cast<sal_uInt16>(pFuncList->GetCount()); for (sal_uInt16 nIndex=0; nIndex<nCount; nIndex++) { const ScFuncDesc* pDesc = pFuncList->GetFunction(nIndex); @@ -641,7 +641,7 @@ uno::Any SAL_CALL ScFunctionListObj::getByIndex( sal_Int32 nIndex ) if ( !pFuncList ) throw uno::RuntimeException(); // should not happen - if ( nIndex >= 0 && nIndex < (sal_Int32)pFuncList->GetCount() ) + if ( nIndex >= 0 && nIndex < static_cast<sal_Int32>(pFuncList->GetCount()) ) { const ScFuncDesc* pDesc = pFuncList->GetFunction(nIndex); if ( pDesc ) diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index 995ffc1a19f7..a6c4172c0c80 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -2043,10 +2043,10 @@ uno::Any SAL_CALL ScCellRangesBase::getPropertyDefault( const OUString& aPropert { case ATTR_VALUE_FORMAT: // default has no language set - aAny <<= (sal_Int32)( static_cast<const SfxUInt32Item&>(rSet.Get(pEntry->nWID)).GetValue() ); + aAny <<= static_cast<sal_Int32>( static_cast<const SfxUInt32Item&>(rSet.Get(pEntry->nWID)).GetValue() ); break; case ATTR_INDENT: - aAny <<= (sal_Int16)( TwipsToHMM(static_cast<const SfxUInt16Item&>( + aAny <<= static_cast<sal_Int16>( TwipsToHMM(static_cast<const SfxUInt16Item&>( rSet.Get(pEntry->nWID)).GetValue()) ); break; default: @@ -2154,7 +2154,7 @@ static void lcl_SetCellProperty( const SfxItemPropertySimpleEntry& rEntry, const if ( !(rValue >>= nIntVal) ) throw lang::IllegalArgumentException(); - sal_uLong nNewFormat = (sal_uLong)nIntVal; + sal_uLong nNewFormat = static_cast<sal_uLong>(nIntVal); rSet.Put( SfxUInt32Item( ATTR_VALUE_FORMAT, nNewFormat ) ); const SvNumberformat* pNewEntry = pFormatter->GetEntry( nNewFormat ); @@ -2184,7 +2184,7 @@ static void lcl_SetCellProperty( const SfxItemPropertySimpleEntry& rEntry, const if ( !(rValue >>= nIntVal) ) throw lang::IllegalArgumentException(); - rSet.Put( SfxUInt16Item( rEntry.nWID, (sal_uInt16)HMMToTwips(nIntVal) ) ); + rSet.Put( SfxUInt16Item( rEntry.nWID, static_cast<sal_uInt16>(HMMToTwips(nIntVal)) ) ); } break; @@ -2492,11 +2492,11 @@ void ScCellRangesBase::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pE pDataSet->Get( ATTR_LANGUAGE_FORMAT ).GetLanguage(); nOldFormat = rDoc.GetFormatTable()-> GetFormatForLanguageIfBuiltIn( nOldFormat, eOldLang ); - rAny <<= (sal_Int32)nOldFormat; + rAny <<= static_cast<sal_Int32>(nOldFormat); } break; case ATTR_INDENT: - rAny <<= (sal_Int16)( TwipsToHMM(static_cast<const SfxUInt16Item&>( + rAny <<= static_cast<sal_Int16>( TwipsToHMM(static_cast<const SfxUInt16Item&>( pDataSet->Get(pEntry->nWID)).GetValue()) ); break; case ATTR_STACKED: @@ -3100,7 +3100,7 @@ ScRangeListRef ScCellRangesBase::GetLimitedChartRanges_Impl( long nDataColumns, nEndRow = MAXROW; ScRangeListRef xChartRanges = new ScRangeList; - xChartRanges->Append( ScRange( 0, 0, nTab, (SCCOL)nEndColumn, (SCROW)nEndRow, nTab ) ); + xChartRanges->Append( ScRange( 0, 0, nTab, static_cast<SCCOL>(nEndColumn), static_cast<SCROW>(nEndRow), nTab ) ); return xChartRanges; } } @@ -3536,8 +3536,8 @@ uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryContentC { // date/time identification - sal_uLong nIndex = (sal_uLong)static_cast<const SfxUInt32Item*>(rDoc.GetAttr( - aIter.GetPos(), ATTR_VALUE_FORMAT))->GetValue(); + sal_uLong nIndex = static_cast<sal_uLong>(static_cast<const SfxUInt32Item*>(rDoc.GetAttr( + aIter.GetPos(), ATTR_VALUE_FORMAT))->GetValue()); SvNumFormatType nTyp = rDoc.GetFormatTable()->GetType(nIndex); if ((nTyp == SvNumFormatType::DATE) || (nTyp == SvNumFormatType::TIME) || (nTyp == SvNumFormatType::DATETIME)) @@ -3648,7 +3648,7 @@ uno::Reference<sheet::XSheetCellRanges> ScCellRangesBase::QueryDifferences_Impl( ScDocument& rDoc = pDocShell->GetDocument(); ScMarkData aMarkData; - SCCOLROW nCmpPos = bColumnDiff ? (SCCOLROW)aCompare.Row : (SCCOLROW)aCompare.Column; + SCCOLROW nCmpPos = bColumnDiff ? static_cast<SCCOLROW>(aCompare.Row) : static_cast<SCCOLROW>(aCompare.Column); // first select everything, where at all something is in the comparison column // (in the second step the selection is cancelled for equal cells) @@ -3740,8 +3740,8 @@ uno::Reference<sheet::XSheetCellRanges> SAL_CALL ScCellRangesBase::queryIntersec const table::CellRangeAddress& aRange ) { SolarMutexGuard aGuard; - ScRange aMask( (SCCOL)aRange.StartColumn, (SCROW)aRange.StartRow, aRange.Sheet, - (SCCOL)aRange.EndColumn, (SCROW)aRange.EndRow, aRange.Sheet ); + ScRange aMask( static_cast<SCCOL>(aRange.StartColumn), static_cast<SCROW>(aRange.StartRow), aRange.Sheet, + static_cast<SCCOL>(aRange.EndColumn), static_cast<SCROW>(aRange.EndRow), aRange.Sheet ); ScRangeList aNew; for ( size_t i = 0, nCount = aRanges.size(); i < nCount; ++i ) @@ -4825,7 +4825,7 @@ uno::Reference<table::XCell> ScCellRangeObj::GetCellByPosition_Impl( if ( nPosX <= aRange.aEnd.Col() && nPosY <= aRange.aEnd.Row() ) { - ScAddress aNew( (SCCOL)nPosX, (SCROW)nPosY, aRange.aStart.Tab() ); + ScAddress aNew( static_cast<SCCOL>(nPosX), static_cast<SCROW>(nPosY), aRange.aStart.Tab() ); return new ScCellObj( pDocSh, aNew ); } } @@ -4860,8 +4860,8 @@ uno::Reference<table::XCellRange> SAL_CALL ScCellRangeObj::getCellRangeByPositio if ( nStartX <= nEndX && nEndX <= aRange.aEnd.Col() && nStartY <= nEndY && nEndY <= aRange.aEnd.Row() ) { - ScRange aNew( (SCCOL)nStartX, (SCROW)nStartY, aRange.aStart.Tab(), - (SCCOL)nEndX, (SCROW)nEndY, aRange.aEnd.Tab() ); + ScRange aNew( static_cast<SCCOL>(nStartX), static_cast<SCROW>(nStartY), aRange.aStart.Tab(), + static_cast<SCCOL>(nEndX), static_cast<SCROW>(nEndY), aRange.aEnd.Tab() ); return new ScCellRangeObj( pDocSh, aNew ); } } @@ -5229,14 +5229,14 @@ void SAL_CALL ScCellRangeObj::setTableOperation( const table::CellRangeAddress& { bool bError = false; ScTabOpParam aParam; - aParam.aRefFormulaCell = ScRefAddress( (SCCOL)aFormulaRange.StartColumn, - (SCROW)aFormulaRange.StartRow, aFormulaRange.Sheet ); - aParam.aRefFormulaEnd = ScRefAddress( (SCCOL)aFormulaRange.EndColumn, - (SCROW)aFormulaRange.EndRow, aFormulaRange.Sheet ); - aParam.aRefRowCell = ScRefAddress( (SCCOL)aRowCell.Column, - (SCROW)aRowCell.Row, aRowCell.Sheet ); - aParam.aRefColCell = ScRefAddress( (SCCOL)aColumnCell.Column, - (SCROW)aColumnCell.Row, aColumnCell.Sheet ); + aParam.aRefFormulaCell = ScRefAddress( static_cast<SCCOL>(aFormulaRange.StartColumn), + static_cast<SCROW>(aFormulaRange.StartRow), aFormulaRange.Sheet ); + aParam.aRefFormulaEnd = ScRefAddress( static_cast<SCCOL>(aFormulaRange.EndColumn), + static_cast<SCROW>(aFormulaRange.EndRow), aFormulaRange.Sheet ); + aParam.aRefRowCell = ScRefAddress( static_cast<SCCOL>(aRowCell.Column), + static_cast<SCROW>(aRowCell.Row), aRowCell.Sheet ); + aParam.aRefColCell = ScRefAddress( static_cast<SCCOL>(aColumnCell.Column), + static_cast<SCROW>(aColumnCell.Row), aColumnCell.Sheet ); switch (nMode) { @@ -5642,10 +5642,10 @@ uno::Reference<sheet::XSheetFilterDescriptor> SAL_CALL ScCellRangeObj::createFil aParam.bHasHeader = true; table::CellRangeAddress aDataAddress(xAddr->getRangeAddress()); - aParam.nCol1 = (SCCOL)aDataAddress.StartColumn; - aParam.nRow1 = (SCROW)aDataAddress.StartRow; - aParam.nCol2 = (SCCOL)aDataAddress.EndColumn; - aParam.nRow2 = (SCROW)aDataAddress.EndRow; + aParam.nCol1 = static_cast<SCCOL>(aDataAddress.StartColumn); + aParam.nRow1 = static_cast<SCROW>(aDataAddress.StartRow); + aParam.nCol2 = static_cast<SCCOL>(aDataAddress.EndColumn); + aParam.nRow2 = static_cast<SCROW>(aDataAddress.EndRow); aParam.nTab = aDataAddress.Sheet; ScDocument& rDoc = pDocSh->GetDocument(); @@ -7125,7 +7125,7 @@ void SAL_CALL ScTableSheetObj::moveRange( const table::CellAddress& aDestination OSL_ENSURE( aSource.Sheet == GetTab_Impl(), "wrong table in CellRangeAddress" ); ScRange aSourceRange; ScUnoConversion::FillScRange( aSourceRange, aSource ); - ScAddress aDestPos( (SCCOL)aDestination.Column, (SCROW)aDestination.Row, aDestination.Sheet ); + ScAddress aDestPos( static_cast<SCCOL>(aDestination.Column), static_cast<SCROW>(aDestination.Row), aDestination.Sheet ); (void)pDocSh->GetDocFunc().MoveBlock( aSourceRange, aDestPos, true, true, true, true ); } } @@ -7140,7 +7140,7 @@ void SAL_CALL ScTableSheetObj::copyRange( const table::CellAddress& aDestination OSL_ENSURE( aSource.Sheet == GetTab_Impl(), "wrong table in CellRangeAddress" ); ScRange aSourceRange; ScUnoConversion::FillScRange( aSourceRange, aSource ); - ScAddress aDestPos( (SCCOL)aDestination.Column, (SCROW)aDestination.Row, aDestination.Sheet ); + ScAddress aDestPos( static_cast<SCCOL>(aDestination.Column), static_cast<SCROW>(aDestination.Row), aDestination.Sheet ); (void)pDocSh->GetDocFunc().MoveBlock( aSourceRange, aDestPos, false, true, true, true ); } } @@ -7229,7 +7229,7 @@ void SAL_CALL ScTableSheetObj::setPrintAreas( if ( rDoc.IsUndoEnabled() ) pOldRanges = rDoc.CreatePrintRangeSaver(); - sal_uInt16 nCount = (sal_uInt16) aPrintAreas.getLength(); + sal_uInt16 nCount = static_cast<sal_uInt16>(aPrintAreas.getLength()); rDoc.ClearPrintRanges( nTab ); if (nCount) { @@ -7552,7 +7552,7 @@ sal_Bool SAL_CALL ScTableSheetObj::hideDependents( const table::CellAddress& aPo { SCTAB nTab = GetTab_Impl(); OSL_ENSURE( aPosition.Sheet == nTab, "wrong table in CellAddress" ); - ScAddress aPos( (SCCOL)aPosition.Column, (SCROW)aPosition.Row, nTab ); + ScAddress aPos( static_cast<SCCOL>(aPosition.Column), static_cast<SCROW>(aPosition.Row), nTab ); return pDocSh->GetDocFunc().DetectiveDelSucc( aPos ); } return false; @@ -7566,7 +7566,7 @@ sal_Bool SAL_CALL ScTableSheetObj::hidePrecedents( const table::CellAddress& aPo { SCTAB nTab = GetTab_Impl(); OSL_ENSURE( aPosition.Sheet == nTab, "wrong table in CellAddress" ); - ScAddress aPos( (SCCOL)aPosition.Column, (SCROW)aPosition.Row, nTab ); + ScAddress aPos( static_cast<SCCOL>(aPosition.Column), static_cast<SCROW>(aPosition.Row), nTab ); return pDocSh->GetDocFunc().DetectiveDelPred( aPos ); } return false; @@ -7580,7 +7580,7 @@ sal_Bool SAL_CALL ScTableSheetObj::showDependents( const table::CellAddress& aPo { SCTAB nTab = GetTab_Impl(); OSL_ENSURE( aPosition.Sheet == nTab, "wrong table in CellAddress" ); - ScAddress aPos( (SCCOL)aPosition.Column, (SCROW)aPosition.Row, nTab ); + ScAddress aPos( static_cast<SCCOL>(aPosition.Column), static_cast<SCROW>(aPosition.Row), nTab ); return pDocSh->GetDocFunc().DetectiveAddSucc( aPos ); } return false; @@ -7594,7 +7594,7 @@ sal_Bool SAL_CALL ScTableSheetObj::showPrecedents( const table::CellAddress& aPo { SCTAB nTab = GetTab_Impl(); OSL_ENSURE( aPosition.Sheet == nTab, "wrong table in CellAddress" ); - ScAddress aPos( (SCCOL)aPosition.Column, (SCROW)aPosition.Row, nTab ); + ScAddress aPos( static_cast<SCCOL>(aPosition.Column), static_cast<SCROW>(aPosition.Row), nTab ); return pDocSh->GetDocFunc().DetectiveAddPred( aPos ); } return false; @@ -7608,7 +7608,7 @@ sal_Bool SAL_CALL ScTableSheetObj::showErrors( const table::CellAddress& aPositi { SCTAB nTab = GetTab_Impl(); OSL_ENSURE( aPosition.Sheet == nTab, "wrong table in CellAddress" ); - ScAddress aPos( (SCCOL)aPosition.Column, (SCROW)aPosition.Row, nTab ); + ScAddress aPos( static_cast<SCCOL>(aPosition.Column), static_cast<SCROW>(aPosition.Row), nTab ); return pDocSh->GetDocFunc().DetectiveAddError( aPos ); } return false; @@ -7826,15 +7826,15 @@ void SAL_CALL ScTableSheetObj::addRanges( const uno::Sequence<table::CellRangeAd ScMarkData aMarkData; aMarkData.SelectTable( nTab, true ); - sal_uInt16 nRangeCount = (sal_uInt16)rScenRanges.getLength(); + sal_uInt16 nRangeCount = static_cast<sal_uInt16>(rScenRanges.getLength()); if (nRangeCount) { const table::CellRangeAddress* pAry = rScenRanges.getConstArray(); for (sal_uInt16 i=0; i<nRangeCount; i++) { OSL_ENSURE( pAry[i].Sheet == nTab, "addRanges with wrong Tab" ); - ScRange aOneRange( (SCCOL)pAry[i].StartColumn, (SCROW)pAry[i].StartRow, nTab, - (SCCOL)pAry[i].EndColumn, (SCROW)pAry[i].EndRow, nTab ); + ScRange aOneRange( static_cast<SCCOL>(pAry[i].StartColumn), static_cast<SCROW>(pAry[i].StartRow), nTab, + static_cast<SCCOL>(pAry[i].EndColumn), static_cast<SCROW>(pAry[i].EndRow), nTab ); aMarkData.SetMultiMarkArea( aOneRange ); } @@ -8592,7 +8592,7 @@ void ScTableColumnObj::SetOnePropertyValue(const SfxItemPropertySimpleEntry* pEn // property is 1/100mm, column width is twips nNewWidth = HMMToTwips(nNewWidth); rFunc.SetWidthOrHeight( - true, aColArr, nTab, SC_SIZE_ORIGINAL, (sal_uInt16)nNewWidth, true, true); + true, aColArr, nTab, SC_SIZE_ORIGINAL, static_cast<sal_uInt16>(nNewWidth), true, true); } } else if ( pEntry->nWID == SC_WID_UNO_CELLVIS ) @@ -8642,8 +8642,8 @@ void ScTableColumnObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pE // for hidden column, return original height sal_uInt16 nWidth = rDoc.GetOriginalWidth( nCol, nTab ); // property is 1/100mm, column width is twips - nWidth = (sal_uInt16) TwipsToHMM(nWidth); - rAny <<= (sal_Int32)nWidth; + nWidth = static_cast<sal_uInt16>(TwipsToHMM(nWidth)); + rAny <<= static_cast<sal_Int32>(nWidth); } else if ( pEntry->nWID == SC_WID_UNO_CELLVIS ) { @@ -8729,7 +8729,7 @@ void ScTableRowObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntr // property is 1/100mm, row height is twips nNewHeight = HMMToTwips(nNewHeight); rFunc.SetWidthOrHeight( - false, aRowArr, nTab, SC_SIZE_ORIGINAL, (sal_uInt16)nNewHeight, true, true); + false, aRowArr, nTab, SC_SIZE_ORIGINAL, static_cast<sal_uInt16>(nNewHeight), true, true); } } else if ( pEntry->nWID == SC_WID_UNO_CELLVIS ) @@ -8788,8 +8788,8 @@ void ScTableRowObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEntr // for hidden row, return original height sal_uInt16 nHeight = rDoc.GetOriginalHeight( nRow, nTab ); // property is 1/100mm, row height is twips - nHeight = (sal_uInt16) TwipsToHMM(nHeight); - rAny <<= (sal_Int32)nHeight; + nHeight = static_cast<sal_uInt16>(TwipsToHMM(nHeight)); + rAny <<= static_cast<sal_Int32>(nHeight); } else if ( pEntry->nWID == SC_WID_UNO_CELLVIS ) { diff --git a/sc/source/ui/unoobj/cellvaluebinding.cxx b/sc/source/ui/unoobj/cellvaluebinding.cxx index 19a6b01961bc..29cb35a199a5 100644 --- a/sc/source/ui/unoobj/cellvaluebinding.cxx +++ b/sc/source/ui/unoobj/cellvaluebinding.cxx @@ -226,7 +226,7 @@ namespace calc if ( m_xCell.is() ) aReturn <<= m_xCell->getValue(); else - aReturn <<= (double)0; + aReturn <<= double(0); break; case TypeClass_LONG: @@ -236,13 +236,13 @@ namespace calc // The list position value in the cell is 1-based. // We subtract 1 from any cell value (no special handling for 0 or negative values). - sal_Int32 nValue = (sal_Int32) rtl::math::approxFloor( m_xCell->getValue() ); + sal_Int32 nValue = static_cast<sal_Int32>(rtl::math::approxFloor( m_xCell->getValue() )); --nValue; aReturn <<= nValue; } else - aReturn <<= (sal_Int32)0; + aReturn <<= sal_Int32(0); break; default: diff --git a/sc/source/ui/unoobj/chartuno.cxx b/sc/source/ui/unoobj/chartuno.cxx index 1becb502b718..556e4aef5bce 100644 --- a/sc/source/ui/unoobj/chartuno.cxx +++ b/sc/source/ui/unoobj/chartuno.cxx @@ -686,7 +686,7 @@ void SAL_CALL ScChartObj::setRanges( const uno::Sequence<table::CellRangeAddress GetData_Impl( xOldRanges, bColHeaders, bRowHeaders ); ScRangeList* pList = new ScRangeList; - sal_uInt16 nRangeCount = (sal_uInt16)aRanges.getLength(); + sal_uInt16 nRangeCount = static_cast<sal_uInt16>(aRanges.getLength()); if (nRangeCount) { const table::CellRangeAddress* pAry = aRanges.getConstArray(); diff --git a/sc/source/ui/unoobj/cursuno.cxx b/sc/source/ui/unoobj/cursuno.cxx index 4e3677ad3584..edeaa08590f1 100644 --- a/sc/source/ui/unoobj/cursuno.cxx +++ b/sc/source/ui/unoobj/cursuno.cxx @@ -218,8 +218,8 @@ void SAL_CALL ScCellCursorObj::collapseToSize( sal_Int32 nColumns, sal_Int32 nRo if ( nEndY > MAXROW ) nEndY = MAXROW; //! error/exception or so, if too big/small - aNewRange.aEnd.SetCol((SCCOL)nEndX); - aNewRange.aEnd.SetRow((SCROW)nEndY); + aNewRange.aEnd.SetCol(static_cast<SCCOL>(nEndX)); + aNewRange.aEnd.SetRow(static_cast<SCROW>(nEndY)); aNewRange.PutInOrder(); //! really? @@ -398,11 +398,11 @@ void SAL_CALL ScCellCursorObj::gotoOffset( sal_Int32 nColumnOffset, sal_Int32 nR aOneRange.aStart.Row() + nRowOffset >= 0 && aOneRange.aEnd.Row() + nRowOffset <= MAXROW ) { - ScRange aNew( (SCCOL)(aOneRange.aStart.Col() + nColumnOffset), - (SCROW)(aOneRange.aStart.Row() + nRowOffset), + ScRange aNew( static_cast<SCCOL>(aOneRange.aStart.Col() + nColumnOffset), + static_cast<SCROW>(aOneRange.aStart.Row() + nRowOffset), aOneRange.aStart.Tab(), - (SCCOL)(aOneRange.aEnd.Col() + nColumnOffset), - (SCROW)(aOneRange.aEnd.Row() + nRowOffset), + static_cast<SCCOL>(aOneRange.aEnd.Col() + nColumnOffset), + static_cast<SCROW>(aOneRange.aEnd.Row() + nRowOffset), aOneRange.aEnd.Tab() ); SetNewRange( aNew ); } diff --git a/sc/source/ui/unoobj/dapiuno.cxx b/sc/source/ui/unoobj/dapiuno.cxx index 5522e9555970..a96b35cd0d48 100644 --- a/sc/source/ui/unoobj/dapiuno.cxx +++ b/sc/source/ui/unoobj/dapiuno.cxx @@ -421,8 +421,8 @@ void SAL_CALL ScDataPilotTablesObj::insertNewByName( const OUString& aNewName, if (!pNewObj) throw RuntimeException("Failed to get DPObject", static_cast<cppu::OWeakObject*>(this)); - ScRange aOutputRange((SCCOL)aOutputAddress.Column, (SCROW)aOutputAddress.Row, (SCTAB)aOutputAddress.Sheet, - (SCCOL)aOutputAddress.Column, (SCROW)aOutputAddress.Row, (SCTAB)aOutputAddress.Sheet); + ScRange aOutputRange(static_cast<SCCOL>(aOutputAddress.Column), static_cast<SCROW>(aOutputAddress.Row), static_cast<SCTAB>(aOutputAddress.Sheet), + static_cast<SCCOL>(aOutputAddress.Column), static_cast<SCROW>(aOutputAddress.Row), static_cast<SCTAB>(aOutputAddress.Sheet)); pNewObj->SetOutRange(aOutputRange); OUString aName = aNewName; if (aName.isEmpty()) diff --git a/sc/source/ui/unoobj/datauno.cxx b/sc/source/ui/unoobj/datauno.cxx index db9420ae2987..4125e91410f7 100644 --- a/sc/source/ui/unoobj/datauno.cxx +++ b/sc/source/ui/unoobj/datauno.cxx @@ -421,8 +421,8 @@ void ScSortDescriptor::FillSortParam( ScSortParam& rParam, const uno::Sequence<b if ( rProp.Value >>= aAddress ) { rParam.nDestTab = aAddress.Sheet; - rParam.nDestCol = (SCCOL)aAddress.Column; - rParam.nDestRow = (SCROW)aAddress.Row; + rParam.nDestCol = static_cast<SCCOL>(aAddress.Column); + rParam.nDestRow = static_cast<SCROW>(aAddress.Row); } } else if (aPropName == SC_UNONAME_ISULIST) @@ -431,7 +431,7 @@ void ScSortDescriptor::FillSortParam( ScSortParam& rParam, const uno::Sequence<b { sal_Int32 nVal = 0; if ( rProp.Value >>= nVal ) - rParam.nUserIndex = (sal_uInt16)nVal; + rParam.nUserIndex = static_cast<sal_uInt16>(nVal); } else if (aPropName == SC_UNONAME_COLLLOC) { @@ -474,7 +474,7 @@ void SAL_CALL ScSubTotalFieldObj::setGroupColumn( sal_Int32 nGroupColumn ) ScSubTotalParam aParam; xParent->GetData(aParam); - aParam.nField[nPos] = (SCCOL)nGroupColumn; + aParam.nField[nPos] = static_cast<SCCOL>(nGroupColumn); xParent->PutData(aParam); } @@ -638,7 +638,7 @@ sal_Int32 SAL_CALL ScSubTotalDescriptorBase::getCount() uno::Any SAL_CALL ScSubTotalDescriptorBase::getByIndex( sal_Int32 nIndex ) { SolarMutexGuard aGuard; - uno::Reference<sheet::XSubTotalField> xField(GetObjectByIndex_Impl((sal_uInt16)nIndex)); + uno::Reference<sheet::XSubTotalField> xField(GetObjectByIndex_Impl(static_cast<sal_uInt16>(nIndex))); if (!xField.is()) throw lang::IndexOutOfBoundsException(); @@ -692,7 +692,7 @@ void SAL_CALL ScSubTotalDescriptorBase::setPropertyValue( { sal_Int32 nVal = 0; if ( aValue >>= nVal ) - aParam.nUserIndex = (sal_uInt16)nVal; + aParam.nUserIndex = static_cast<sal_uInt16>(nVal); } else if (aPropertyName == SC_UNONAME_MAXFLD ) { @@ -729,9 +729,9 @@ uno::Any SAL_CALL ScSubTotalDescriptorBase::getPropertyValue( const OUString& aP else if (aPropertyName == SC_UNONAME_ULIST || aPropertyName == SC_UNONAME_ENUSLIST ) aRet <<= aParam.bUserDef; else if (aPropertyName == SC_UNONAME_UINDEX || aPropertyName == SC_UNONAME_USINDEX ) - aRet <<= (sal_Int32) aParam.nUserIndex; + aRet <<= static_cast<sal_Int32>(aParam.nUserIndex); else if (aPropertyName == SC_UNONAME_MAXFLD ) - aRet <<= (sal_Int32) MAXSUBTOTAL; + aRet <<= sal_Int32(MAXSUBTOTAL); return aRet; } @@ -871,7 +871,7 @@ void SAL_CALL ScConsolidationDescriptor::setSources( const uno::Sequence<table::CellRangeAddress>& aSources ) { SolarMutexGuard aGuard; - sal_uInt16 nCount = (sal_uInt16)aSources.getLength(); + sal_uInt16 nCount = static_cast<sal_uInt16>(aSources.getLength()); if (nCount) { const table::CellRangeAddress* pAry = aSources.getConstArray(); @@ -905,8 +905,8 @@ void SAL_CALL ScConsolidationDescriptor::setStartOutputPosition( const table::CellAddress& aStartOutputPosition ) { SolarMutexGuard aGuard; - aParam.nCol = (SCCOL)aStartOutputPosition.Column; - aParam.nRow = (SCROW)aStartOutputPosition.Row; + aParam.nCol = static_cast<SCCOL>(aStartOutputPosition.Column); + aParam.nRow = static_cast<SCROW>(aStartOutputPosition.Row); aParam.nTab = aStartOutputPosition.Sheet; } @@ -1424,8 +1424,8 @@ void SAL_CALL ScFilterDescriptorBase::setPropertyValue( if ( aValue >>= aAddress ) { aParam.nDestTab = aAddress.Sheet; - aParam.nDestCol = (SCCOL)aAddress.Column; - aParam.nDestRow = (SCROW)aAddress.Row; + aParam.nDestCol = static_cast<SCCOL>(aAddress.Column); + aParam.nDestRow = static_cast<SCROW>(aAddress.Row); } } else if (aPropertyName == SC_UNONAME_SAVEOUT) @@ -1454,7 +1454,7 @@ uno::Any SAL_CALL ScFilterDescriptorBase::getPropertyValue( const OUString& aPro else if (aPropertyName == SC_UNONAME_ISCASE ) aRet <<= aParam.bCaseSens; else if (aPropertyName == SC_UNONAME_MAXFLD ) - aRet <<= (sal_Int32) aParam.GetEntryCount(); + aRet <<= static_cast<sal_Int32>(aParam.GetEntryCount()); else if (aPropertyName == SC_UNONAME_ORIENT ) { table::TableOrientation eOrient = aParam.bByRow ? table::TableOrientation_ROWS : @@ -1682,8 +1682,8 @@ void SAL_CALL ScDatabaseRangeObj::setDataArea( const table::CellRangeAddress& aD { ScDBData aNewData( *pData ); //! MoveTo ??? - aNewData.SetArea( aDataArea.Sheet, (SCCOL)aDataArea.StartColumn, (SCROW)aDataArea.StartRow, - (SCCOL)aDataArea.EndColumn, (SCROW)aDataArea.EndRow ); + aNewData.SetArea( aDataArea.Sheet, static_cast<SCCOL>(aDataArea.StartColumn), static_cast<SCROW>(aDataArea.StartRow), + static_cast<SCCOL>(aDataArea.EndColumn), static_cast<SCROW>(aDataArea.EndRow) ); ScDBDocFunc aFunc(*pDocShell); aFunc.ModifyDBData(aNewData); } @@ -2189,8 +2189,8 @@ void SAL_CALL ScDatabaseRangesObj::addNewByName( const OUString& aName, { ScDBDocFunc aFunc(*pDocShell); - ScRange aNameRange( (SCCOL)aRange.StartColumn, (SCROW)aRange.StartRow, aRange.Sheet, - (SCCOL)aRange.EndColumn, (SCROW)aRange.EndRow, aRange.Sheet ); + ScRange aNameRange( static_cast<SCCOL>(aRange.StartColumn), static_cast<SCROW>(aRange.StartRow), aRange.Sheet, + static_cast<SCCOL>(aRange.EndColumn), static_cast<SCROW>(aRange.EndRow), aRange.Sheet ); bDone = aFunc.AddDBRange( aName, aNameRange ); } if (!bDone) @@ -2346,8 +2346,8 @@ void ScUnnamedDatabaseRangesObj::setByTable( const table::CellRangeAddress& aRan throw lang::IndexOutOfBoundsException(); ScDBDocFunc aFunc(*pDocShell); - ScRange aUnnamedRange( (SCCOL)aRange.StartColumn, (SCROW)aRange.StartRow, aRange.Sheet, - (SCCOL)aRange.EndColumn, (SCROW)aRange.EndRow, aRange.Sheet ); + ScRange aUnnamedRange( static_cast<SCCOL>(aRange.StartColumn), static_cast<SCROW>(aRange.StartRow), aRange.Sheet, + static_cast<SCCOL>(aRange.EndColumn), static_cast<SCROW>(aRange.EndRow), aRange.Sheet ); bDone = aFunc.AddDBRange( STR_DB_LOCAL_NONAME, aUnnamedRange ); } if (!bDone) @@ -2377,7 +2377,7 @@ sal_Bool ScUnnamedDatabaseRangesObj::hasByTable( sal_Int32 nTab ) { if (pDocShell->GetDocument().GetTableCount() <= nTab) throw lang::IndexOutOfBoundsException(); - if (pDocShell->GetDocument().GetAnonymousDBData((SCTAB) nTab)) + if (pDocShell->GetDocument().GetAnonymousDBData(static_cast<SCTAB>(nTab))) return true; return false; } diff --git a/sc/source/ui/unoobj/dispuno.cxx b/sc/source/ui/unoobj/dispuno.cxx index e8a1818420c4..0f0d25e3f53f 100644 --- a/sc/source/ui/unoobj/dispuno.cxx +++ b/sc/source/ui/unoobj/dispuno.cxx @@ -248,7 +248,7 @@ static void lcl_FillDataSource( frame::FeatureStateEvent& rEvent, const ScImport aDescriptor[svx::DataAccessDescriptorProperty::DataSource] <<= OUString(); aDescriptor[svx::DataAccessDescriptorProperty::Command] <<= OUString(); - aDescriptor[svx::DataAccessDescriptorProperty::CommandType] <<= (sal_Int32)sdb::CommandType::TABLE; + aDescriptor[svx::DataAccessDescriptorProperty::CommandType] <<= sal_Int32(sdb::CommandType::TABLE); } rEvent.State <<= aDescriptor.createPropertyValueSequence(); } diff --git a/sc/source/ui/unoobj/docuno.cxx b/sc/source/ui/unoobj/docuno.cxx index 901e34a86a31..7322c70493b5 100644 --- a/sc/source/ui/unoobj/docuno.cxx +++ b/sc/source/ui/unoobj/docuno.cxx @@ -1420,7 +1420,7 @@ static bool lcl_ParseTarget( const OUString& rTarget, ScRange& rTargetRange, too ( nNumeric = rTarget.toInt32() ) > 0 && nNumeric <= MAXROW+1 ) { // row number is always mapped to cell A(row) on the same sheet - rTargetRange = ScAddress( 0, (SCROW)(nNumeric-1), nSourceTab ); // target row number is 1-based + rTargetRange = ScAddress( 0, static_cast<SCROW>(nNumeric-1), nSourceTab ); // target row number is 1-based bRangeValid = true; // row number } else if ( pDoc->GetTable( rTarget, nNameTab ) ) @@ -2055,14 +2055,10 @@ void SAL_CALL ScModelObj::render( sal_Int32 nSelRenderer, const uno::Any& aSelec Fraction aScaleX( aLocationPixel.GetWidth(), aLocationMM.GetWidth() ); Fraction aScaleY( aLocationPixel.GetHeight(), aLocationMM.GetHeight() ); - long nX1 = aLocationPixel.Left() + (long) - ( Fraction( aTargetRect.Left() - aLocationMM.Left(), 1 ) * aScaleX ); - long nX2 = aLocationPixel.Left() + (long) - ( Fraction( aTargetRect.Right() - aLocationMM.Left(), 1 ) * aScaleX ); - long nY1 = aLocationPixel.Top() + (long) - ( Fraction( aTargetRect.Top() - aLocationMM.Top(), 1 ) * aScaleY ); - long nY2 = aLocationPixel.Top() + (long) - ( Fraction( aTargetRect.Bottom() - aLocationMM.Top(), 1 ) * aScaleY ); + long nX1 = aLocationPixel.Left() + static_cast<long>( Fraction( aTargetRect.Left() - aLocationMM.Left(), 1 ) * aScaleX ); + long nX2 = aLocationPixel.Left() + static_cast<long>( Fraction( aTargetRect.Right() - aLocationMM.Left(), 1 ) * aScaleX ); + long nY1 = aLocationPixel.Top() + static_cast<long>( Fraction( aTargetRect.Top() - aLocationMM.Top(), 1 ) * aScaleY ); + long nY2 = aLocationPixel.Top() + static_cast<long>( Fraction( aTargetRect.Bottom() - aLocationMM.Top(), 1 ) * aScaleY ); if ( nX1 > aLocationPixel.Right() ) nX1 = aLocationPixel.Right(); if ( nX2 > aLocationPixel.Right() ) nX2 = aLocationPixel.Right(); @@ -2285,8 +2281,8 @@ sheet::GoalResult SAL_CALL ScModelObj::seekGoal( ScDocument& rDoc = pDocShell->GetDocument(); double fValue = 0.0; bool bFound = rDoc.Solver( - (SCCOL)aFormulaPosition.Column, (SCROW)aFormulaPosition.Row, aFormulaPosition.Sheet, - (SCCOL)aVariablePosition.Column, (SCROW)aVariablePosition.Row, aVariablePosition.Sheet, + static_cast<SCCOL>(aFormulaPosition.Column), static_cast<SCROW>(aFormulaPosition.Row), aFormulaPosition.Sheet, + static_cast<SCCOL>(aVariablePosition.Column), static_cast<SCROW>(aVariablePosition.Row), aVariablePosition.Sheet, aGoalValue, fValue ); aResult.Result = fValue; if (bFound) @@ -3286,7 +3282,7 @@ uno::Reference<drawing::XDrawPage> ScDrawPagesObj::GetObjectByIndex_Impl(sal_Int OSL_ENSURE(pDrawLayer,"Cannot create Draw-Layer"); if ( pDrawLayer && nIndex >= 0 && nIndex < pDocShell->GetDocument().GetTableCount() ) { - SdrPage* pPage = pDrawLayer->GetPage((sal_uInt16)nIndex); + SdrPage* pPage = pDrawLayer->GetPage(static_cast<sal_uInt16>(nIndex)); OSL_ENSURE(pPage,"Draw-Page not found"); if (pPage) { @@ -3606,7 +3602,7 @@ sal_Int32 ScTableSheetsObj::importSheet( uno::Reference< table::XCell > SAL_CALL ScTableSheetsObj::getCellByPosition( sal_Int32 nColumn, sal_Int32 nRow, sal_Int32 nSheet ) { SolarMutexGuard aGuard; - uno::Reference<table::XCellRange> xSheet(static_cast<ScCellRangeObj*>(GetObjectByIndex_Impl((sal_uInt16)nSheet))); + uno::Reference<table::XCellRange> xSheet(static_cast<ScCellRangeObj*>(GetObjectByIndex_Impl(static_cast<sal_uInt16>(nSheet)))); if (! xSheet.is()) throw lang::IndexOutOfBoundsException(); @@ -3616,7 +3612,7 @@ uno::Reference< table::XCell > SAL_CALL ScTableSheetsObj::getCellByPosition( sal uno::Reference< table::XCellRange > SAL_CALL ScTableSheetsObj::getCellRangeByPosition( sal_Int32 nLeft, sal_Int32 nTop, sal_Int32 nRight, sal_Int32 nBottom, sal_Int32 nSheet ) { SolarMutexGuard aGuard; - uno::Reference<table::XCellRange> xSheet(static_cast<ScCellRangeObj*>(GetObjectByIndex_Impl((sal_uInt16)nSheet))); + uno::Reference<table::XCellRange> xSheet(static_cast<ScCellRangeObj*>(GetObjectByIndex_Impl(static_cast<sal_uInt16>(nSheet)))); if (! xSheet.is()) throw lang::IndexOutOfBoundsException(); @@ -3791,8 +3787,8 @@ void SAL_CALL ScTableColumnsObj::insertByIndex( sal_Int32 nPosition, sal_Int32 n if ( pDocShell && nCount > 0 && nPosition >= 0 && nStartCol+nPosition <= nEndCol && nStartCol+nPosition+nCount-1 <= MAXCOL ) { - ScRange aRange( (SCCOL)(nStartCol+nPosition), 0, nTab, - (SCCOL)(nStartCol+nPosition+nCount-1), MAXROW, nTab ); + ScRange aRange( static_cast<SCCOL>(nStartCol+nPosition), 0, nTab, + static_cast<SCCOL>(nStartCol+nPosition+nCount-1), MAXROW, nTab ); bDone = pDocShell->GetDocFunc().InsertCells( aRange, nullptr, INS_INSCOLS_BEFORE, true, true ); } if (!bDone) @@ -3806,8 +3802,8 @@ void SAL_CALL ScTableColumnsObj::removeByIndex( sal_Int32 nIndex, sal_Int32 nCou // the range to be deleted has to lie within the object if ( pDocShell && nCount > 0 && nIndex >= 0 && nStartCol+nIndex+nCount-1 <= nEndCol ) { - ScRange aRange( (SCCOL)(nStartCol+nIndex), 0, nTab, - (SCCOL)(nStartCol+nIndex+nCount-1), MAXROW, nTab ); + ScRange aRange( static_cast<SCCOL>(nStartCol+nIndex), 0, nTab, + static_cast<SCCOL>(nStartCol+nIndex+nCount-1), MAXROW, nTab ); bDone = pDocShell->GetDocFunc().DeleteCells( aRange, nullptr, DEL_DELCOLS, true ); } if (!bDone) @@ -3911,7 +3907,7 @@ void SAL_CALL ScTableColumnsObj::setPropertyValue( sal_Int32 nNewWidth = 0; if ( aValue >>= nNewWidth ) rFunc.SetWidthOrHeight( - true, aColArr, nTab, SC_SIZE_ORIGINAL, (sal_uInt16)HMMToTwips(nNewWidth), true, true); + true, aColArr, nTab, SC_SIZE_ORIGINAL, static_cast<sal_uInt16>(HMMToTwips(nNewWidth)), true, true); } else if ( aPropertyName == SC_UNONAME_CELLVIS ) { @@ -3955,7 +3951,7 @@ uno::Any SAL_CALL ScTableColumnsObj::getPropertyValue( const OUString& aProperty { // for hidden column, return original height sal_uInt16 nWidth = rDoc.GetOriginalWidth( nStartCol, nTab ); - aAny <<= (sal_Int32)TwipsToHMM(nWidth); + aAny <<= static_cast<sal_Int32>(TwipsToHMM(nWidth)); } else if ( aPropertyName == SC_UNONAME_CELLVIS ) { @@ -4030,8 +4026,8 @@ void SAL_CALL ScTableRowsObj::insertByIndex( sal_Int32 nPosition, sal_Int32 nCou if ( pDocShell && nCount > 0 && nPosition >= 0 && nStartRow+nPosition <= nEndRow && nStartRow+nPosition+nCount-1 <= MAXROW ) { - ScRange aRange( 0, (SCROW)(nStartRow+nPosition), nTab, - MAXCOL, (SCROW)(nStartRow+nPosition+nCount-1), nTab ); + ScRange aRange( 0, static_cast<SCROW>(nStartRow+nPosition), nTab, + MAXCOL, static_cast<SCROW>(nStartRow+nPosition+nCount-1), nTab ); bDone = pDocShell->GetDocFunc().InsertCells( aRange, nullptr, INS_INSROWS_BEFORE, true, true ); } if (!bDone) @@ -4045,8 +4041,8 @@ void SAL_CALL ScTableRowsObj::removeByIndex( sal_Int32 nIndex, sal_Int32 nCount // the range to be deleted has to lie within the object if ( pDocShell && nCount > 0 && nIndex >= 0 && nStartRow+nIndex+nCount-1 <= nEndRow ) { - ScRange aRange( 0, (SCROW)(nStartRow+nIndex), nTab, - MAXCOL, (SCROW)(nStartRow+nIndex+nCount-1), nTab ); + ScRange aRange( 0, static_cast<SCROW>(nStartRow+nIndex), nTab, + MAXCOL, static_cast<SCROW>(nStartRow+nIndex+nCount-1), nTab ); bDone = pDocShell->GetDocFunc().DeleteCells( aRange, nullptr, DEL_DELROWS, true ); } if (!bDone) @@ -4121,7 +4117,7 @@ void SAL_CALL ScTableRowsObj::setPropertyValue( // TODO: It's probably cleaner to use a different property name // for this. - rDoc.SetRowHeightOnly( nStartRow, nEndRow, nTab, (sal_uInt16)HMMToTwips(nNewHeight) ); + rDoc.SetRowHeightOnly( nStartRow, nEndRow, nTab, static_cast<sal_uInt16>(HMMToTwips(nNewHeight)) ); } else { @@ -4144,12 +4140,12 @@ void SAL_CALL ScTableRowsObj::setPropertyValue( // TODO: This is a band-aid fix. Eventually we need to // re-work ods' style import to get it to set styles to // ScDocument directly. - rDoc.SetRowHeightOnly( nStartRow, nEndRow, nTab, (sal_uInt16)HMMToTwips(nNewHeight) ); + rDoc.SetRowHeightOnly( nStartRow, nEndRow, nTab, static_cast<sal_uInt16>(HMMToTwips(nNewHeight)) ); rDoc.SetManualHeight( nStartRow, nEndRow, nTab, true ); } else rFunc.SetWidthOrHeight( - false, aRowArr, nTab, SC_SIZE_ORIGINAL, (sal_uInt16)HMMToTwips(nNewHeight), true, true); + false, aRowArr, nTab, SC_SIZE_ORIGINAL, static_cast<sal_uInt16>(HMMToTwips(nNewHeight)), true, true); } } else if ( aPropertyName == SC_UNONAME_CELLVIS ) @@ -4212,7 +4208,7 @@ uno::Any SAL_CALL ScTableRowsObj::getPropertyValue( const OUString& aPropertyNam { // for hidden row, return original height sal_uInt16 nHeight = rDoc.GetOriginalHeight( nStartRow, nTab ); - aAny <<= (sal_Int32)TwipsToHMM(nHeight); + aAny <<= static_cast<sal_Int32>(TwipsToHMM(nHeight)); } else if ( aPropertyName == SC_UNONAME_CELLVIS ) { @@ -4333,7 +4329,7 @@ void SAL_CALL ScAnnotationsObj::insertNew( if (pDocShell) { OSL_ENSURE( aPosition.Sheet == nTab, "addAnnotation with a wrong Sheet" ); - ScAddress aPos( (SCCOL)aPosition.Column, (SCROW)aPosition.Row, nTab ); + ScAddress aPos( static_cast<SCCOL>(aPosition.Column), static_cast<SCROW>(aPosition.Row), nTab ); pDocShell->GetDocFunc().ReplaceNote( aPos, rText, nullptr, nullptr, true ); } } @@ -4439,7 +4435,7 @@ bool ScScenariosObj::GetScenarioIndex_Impl( const OUString& rName, SCTAB& rIndex { OUString aTabName; ScDocument& rDoc = pDocShell->GetDocument(); - SCTAB nCount = (SCTAB)getCount(); + SCTAB nCount = static_cast<SCTAB>(getCount()); for (SCTAB i=0; i<nCount; i++) if (rDoc.GetName( nTab+i+1, aTabName )) if (aTabName == rName) @@ -4454,7 +4450,7 @@ bool ScScenariosObj::GetScenarioIndex_Impl( const OUString& rName, SCTAB& rIndex ScTableSheetObj* ScScenariosObj::GetObjectByIndex_Impl(sal_Int32 nIndex) { - sal_uInt16 nCount = (sal_uInt16)getCount(); + sal_uInt16 nCount = static_cast<sal_uInt16>(getCount()); if ( pDocShell && nIndex >= 0 && nIndex < nCount ) return new ScTableSheetObj( pDocShell, nTab+static_cast<SCTAB>(nIndex)+1 ); @@ -4480,15 +4476,15 @@ void SAL_CALL ScScenariosObj::addNewByName( const OUString& aName, ScMarkData aMarkData; aMarkData.SelectTable( nTab, true ); - sal_uInt16 nRangeCount = (sal_uInt16)aRanges.getLength(); + sal_uInt16 nRangeCount = static_cast<sal_uInt16>(aRanges.getLength()); if (nRangeCount) { const table::CellRangeAddress* pAry = aRanges.getConstArray(); for (sal_uInt16 i=0; i<nRangeCount; i++) { OSL_ENSURE( pAry[i].Sheet == nTab, "addScenario with a wrong Tab" ); - ScRange aRange( (SCCOL)pAry[i].StartColumn, (SCROW)pAry[i].StartRow, nTab, - (SCCOL)pAry[i].EndColumn, (SCROW)pAry[i].EndRow, nTab ); + ScRange aRange( static_cast<SCCOL>(pAry[i].StartColumn), static_cast<SCROW>(pAry[i].StartRow), nTab, + static_cast<SCCOL>(pAry[i].EndColumn), static_cast<SCROW>(pAry[i].EndRow), nTab ); aMarkData.SetMultiMarkArea( aRange ); } @@ -4576,7 +4572,7 @@ uno::Any SAL_CALL ScScenariosObj::getByName( const OUString& aName ) uno::Sequence<OUString> SAL_CALL ScScenariosObj::getElementNames() { SolarMutexGuard aGuard; - SCTAB nCount = (SCTAB)getCount(); + SCTAB nCount = static_cast<SCTAB>(getCount()); uno::Sequence<OUString> aSeq(nCount); if ( pDocShell ) // otherwise Count = 0 diff --git a/sc/source/ui/unoobj/filtuno.cxx b/sc/source/ui/unoobj/filtuno.cxx index 5f1279807ec4..3a03ca3dff03 100644 --- a/sc/source/ui/unoobj/filtuno.cxx +++ b/sc/source/ui/unoobj/filtuno.cxx @@ -93,7 +93,7 @@ namespace pProperties[0] >>= nChar; if( nChar >= 0) { - nCharSet = (rtl_TextEncoding) nChar; + nCharSet = static_cast<rtl_TextEncoding>(nChar); return charsetSource::charset_from_user_setting; } } @@ -113,7 +113,7 @@ namespace aValues = aItem.GetProperties( aNames ); pProperties = aValues.getArray(); - pProperties[0] <<= (sal_Int32) nCharSet; + pProperties[0] <<= static_cast<sal_Int32>(nCharSet); aItem.PutProperties(aNames, aValues); } diff --git a/sc/source/ui/unoobj/fmtuno.cxx b/sc/source/ui/unoobj/fmtuno.cxx index 9f2116ac4cf7..0c5aef2f3089 100644 --- a/sc/source/ui/unoobj/fmtuno.cxx +++ b/sc/source/ui/unoobj/fmtuno.cxx @@ -293,7 +293,7 @@ void SAL_CALL ScTableConditionalFormat::addNew( { table::CellAddress aAddress; if ( rProp.Value >>= aAddress ) - aEntry.maPos = ScAddress( (SCCOL)aAddress.Column, (SCROW)aAddress.Row, aAddress.Sheet ); + aEntry.maPos = ScAddress( static_cast<SCCOL>(aAddress.Column), static_cast<SCROW>(aAddress.Row), aAddress.Sheet ); } else if ( rProp.Name == SC_UNONAME_SOURCESTR ) { @@ -377,7 +377,7 @@ sal_Int32 SAL_CALL ScTableConditionalFormat::getCount() uno::Any SAL_CALL ScTableConditionalFormat::getByIndex( sal_Int32 nIndex ) { SolarMutexGuard aGuard; - uno::Reference<sheet::XSheetConditionalEntry> xEntry(GetObjectByIndex_Impl((sal_uInt16)nIndex)); + uno::Reference<sheet::XSheetConditionalEntry> xEntry(GetObjectByIndex_Impl(static_cast<sal_uInt16>(nIndex))); if (!xEntry.is()) throw lang::IndexOutOfBoundsException(); @@ -415,7 +415,7 @@ uno::Any SAL_CALL ScTableConditionalFormat::getByName( const OUString& aName ) for (long i=0; i<nCount; i++) if ( aName == lcl_GetEntryNameFromIndex(i) ) { - xEntry.set(GetObjectByIndex_Impl((sal_uInt16)i)); + xEntry.set(GetObjectByIndex_Impl(static_cast<sal_uInt16>(i))); break; } @@ -561,7 +561,7 @@ table::CellAddress SAL_CALL ScTableConditionalEntry::getSourcePosition() void SAL_CALL ScTableConditionalEntry::setSourcePosition( const table::CellAddress& aSourcePosition ) { SolarMutexGuard aGuard; - aData.maPos.Set( (SCCOL)aSourcePosition.Column, (SCROW)aSourcePosition.Row, aSourcePosition.Sheet ); + aData.maPos.Set( static_cast<SCCOL>(aSourcePosition.Column), static_cast<SCROW>(aSourcePosition.Row), aSourcePosition.Sheet ); } // XSheetConditionalEntry @@ -749,7 +749,7 @@ table::CellAddress SAL_CALL ScTableValidationObj::getSourcePosition() void SAL_CALL ScTableValidationObj::setSourcePosition( const table::CellAddress& aSourcePosition ) { SolarMutexGuard aGuard; - aSrcPos.Set( (SCCOL)aSourcePosition.Column, (SCROW)aSourcePosition.Row, aSourcePosition.Sheet ); + aSrcPos.Set( static_cast<SCCOL>(aSourcePosition.Column), static_cast<SCROW>(aSourcePosition.Row), aSourcePosition.Sheet ); } uno::Sequence<sheet::FormulaToken> SAL_CALL ScTableValidationObj::getTokens( sal_Int32 nIndex ) diff --git a/sc/source/ui/unoobj/funcuno.cxx b/sc/source/ui/unoobj/funcuno.cxx index 2069bfdd81ac..d4d1e53b5443 100644 --- a/sc/source/ui/unoobj/funcuno.cxx +++ b/sc/source/ui/unoobj/funcuno.cxx @@ -329,15 +329,15 @@ public: void visitElem( long nCol, long nRow, sal_Int16 elem ) { - mpDoc->SetValue( (SCCOL) nCol, (SCROW) nRow, 0, elem ); + mpDoc->SetValue( static_cast<SCCOL>(nCol), static_cast<SCROW>(nRow), 0, elem ); } void visitElem( long nCol, long nRow, sal_Int32 elem ) { - mpDoc->SetValue( (SCCOL) nCol, (SCROW) nRow, 0, elem ); + mpDoc->SetValue( static_cast<SCCOL>(nCol), static_cast<SCROW>(nRow), 0, elem ); } void visitElem( long nCol, long nRow, const double& elem ) { - mpDoc->SetValue( (SCCOL) nCol, (SCROW) nRow, 0, elem ); + mpDoc->SetValue( static_cast<SCCOL>(nCol), static_cast<SCROW>(nRow), 0, elem ); } void visitElem( long nCol, long nRow, const OUString& elem ) { @@ -560,7 +560,7 @@ uno::Any SAL_CALL ScFunctionAccess::callFunction( const OUString& aName, else { // copy data - if ( !lcl_CopyData( pSrcDoc, aSrcRange, pDoc, ScAddress( 0, (SCROW)nDocRow, 0 ) ) ) + if ( !lcl_CopyData( pSrcDoc, aSrcRange, pDoc, ScAddress( 0, static_cast<SCROW>(nDocRow), 0 ) ) ) bOverflow = true; } diff --git a/sc/source/ui/unoobj/linkuno.cxx b/sc/source/ui/unoobj/linkuno.cxx index 6d038269e1dc..42ac15dcf61f 100644 --- a/sc/source/ui/unoobj/linkuno.cxx +++ b/sc/source/ui/unoobj/linkuno.cxx @@ -191,7 +191,7 @@ void ScSheetLinkObj::ModifyRefreshDelay_Impl( sal_Int32 nRefresh ) { ScTableLink* pLink = GetLink_Impl(); if( pLink ) - pLink->SetRefreshDelay( (sal_uLong) nRefresh ); + pLink->SetRefreshDelay( static_cast<sal_uLong>(nRefresh) ); } // XPropertySet @@ -348,7 +348,7 @@ sal_Int32 ScSheetLinkObj::getRefreshDelay() const sal_Int32 nRet = 0; ScTableLink* pLink = GetLink_Impl(); if (pLink) - nRet = (sal_Int32) pLink->GetRefreshDelay(); + nRet = static_cast<sal_Int32>(pLink->GetRefreshDelay()); return nRet; } @@ -659,7 +659,7 @@ void ScAreaLinkObj::ModifyRefreshDelay_Impl( sal_Int32 nRefresh ) { ScAreaLink* pLink = lcl_GetAreaLink( pDocShell, nPos ); if( pLink ) - pLink->SetRefreshDelay( (sal_uLong) nRefresh ); + pLink->SetRefreshDelay( static_cast<sal_uLong>(nRefresh) ); } // XRefreshable @@ -831,7 +831,7 @@ sal_Int32 ScAreaLinkObj::getRefreshDelay() const sal_Int32 nRet = 0; ScAreaLink* pLink = lcl_GetAreaLink(pDocShell, nPos); if (pLink) - nRet = (sal_Int32) pLink->GetRefreshDelay(); + nRet = static_cast<sal_Int32>(pLink->GetRefreshDelay()); return nRet; } @@ -904,7 +904,7 @@ void ScAreaLinksObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) ScAreaLinkObj* ScAreaLinksObj::GetObjectByIndex_Impl(sal_Int32 nIndex) { if ( pDocShell && nIndex >= 0 && nIndex < getCount() ) - return new ScAreaLinkObj( pDocShell, (size_t)nIndex ); + return new ScAreaLinkObj( pDocShell, static_cast<size_t>(nIndex) ); return nullptr; // not found } @@ -919,7 +919,7 @@ void SAL_CALL ScAreaLinksObj::insertAtPosition( const table::CellAddress& aDestP if (pDocShell) { OUString aFileStr (aFileName); - ScAddress aDestAddr( (SCCOL)aDestPos.Column, (SCROW)aDestPos.Row, aDestPos.Sheet ); + ScAddress aDestAddr( static_cast<SCCOL>(aDestPos.Column), static_cast<SCROW>(aDestPos.Row), aDestPos.Sheet ); aFileStr = ScGlobal::GetAbsDocName( aFileStr, pDocShell ); //! in InsertAreaLink ??? pDocShell->GetDocFunc().InsertAreaLink( aFileStr, aFilter, aFilterOptions, @@ -931,7 +931,7 @@ void SAL_CALL ScAreaLinksObj::insertAtPosition( const table::CellAddress& aDestP void SAL_CALL ScAreaLinksObj::removeByIndex( sal_Int32 nIndex ) { SolarMutexGuard aGuard; - ScAreaLink* pLink = lcl_GetAreaLink(pDocShell, (size_t)nIndex); + ScAreaLink* pLink = lcl_GetAreaLink(pDocShell, static_cast<size_t>(nIndex)); if (pLink) { //! SetAddUndo or what @@ -1217,7 +1217,7 @@ ScDDELinkObj* ScDDELinksObj::GetObjectByIndex_Impl(sal_Int32 nIndex) if (pDocShell) { OUString aAppl, aTopic, aItem; - if ( pDocShell->GetDocument().GetDdeLinkData( (size_t)nIndex, aAppl, aTopic, aItem ) ) + if ( pDocShell->GetDocument().GetDdeLinkData( static_cast<size_t>(nIndex), aAppl, aTopic, aItem ) ) return new ScDDELinkObj( pDocShell, aAppl, aTopic, aItem ); } return nullptr; diff --git a/sc/source/ui/unoobj/nameuno.cxx b/sc/source/ui/unoobj/nameuno.cxx index cfb60594f039..1caa62e9920c 100644 --- a/sc/source/ui/unoobj/nameuno.cxx +++ b/sc/source/ui/unoobj/nameuno.cxx @@ -276,7 +276,7 @@ table::CellAddress SAL_CALL ScNamedRangeObj::getReferencePosition() void SAL_CALL ScNamedRangeObj::setReferencePosition( const table::CellAddress& aReferencePosition ) { SolarMutexGuard aGuard; - ScAddress aPos( (SCCOL)aReferencePosition.Column, (SCROW)aReferencePosition.Row, aReferencePosition.Sheet ); + ScAddress aPos( static_cast<SCCOL>(aReferencePosition.Column), static_cast<SCROW>(aReferencePosition.Row), aReferencePosition.Sheet ); // GRAM_API for API compatibility. Modify_Impl( nullptr, nullptr, nullptr, &aPos, nullptr,formula::FormulaGrammar::GRAM_API ); } @@ -477,7 +477,7 @@ void SAL_CALL ScNamedRangesObj::addNewByName( const OUString& aName, sal_Int32 nUnoType ) { SolarMutexGuard aGuard; - ScAddress aPos( (SCCOL)aPosition.Column, (SCROW)aPosition.Row, aPosition.Sheet ); + ScAddress aPos( static_cast<SCCOL>(aPosition.Column), static_cast<SCROW>(aPosition.Row), aPosition.Sheet ); ScRangeData::Type nNewType = ScRangeData::Type::Name; if ( nUnoType & sheet::NamedRangeFlag::FILTER_CRITERIA ) nNewType |= ScRangeData::Type::Criteria; @@ -564,7 +564,7 @@ void SAL_CALL ScNamedRangesObj::removeByName( const OUString& aName ) void SAL_CALL ScNamedRangesObj::outputList( const table::CellAddress& aOutputPosition ) { SolarMutexGuard aGuard; - ScAddress aPos( (SCCOL)aOutputPosition.Column, (SCROW)aOutputPosition.Row, aOutputPosition.Sheet ); + ScAddress aPos( static_cast<SCCOL>(aOutputPosition.Column), static_cast<SCROW>(aOutputPosition.Row), aOutputPosition.Sheet ); if (pDocShell) pDocShell->GetDocFunc().InsertNameList( aPos, true ); } @@ -600,7 +600,7 @@ sal_Int32 SAL_CALL ScNamedRangesObj::getCount() uno::Any SAL_CALL ScNamedRangesObj::getByIndex( sal_Int32 nIndex ) { SolarMutexGuard aGuard; - uno::Reference< sheet::XNamedRange > xRange(GetObjectByIndex_Impl((sal_uInt16)nIndex)); + uno::Reference< sheet::XNamedRange > xRange(GetObjectByIndex_Impl(static_cast<sal_uInt16>(nIndex))); if ( !xRange.is() ) throw lang::IndexOutOfBoundsException(); @@ -1090,7 +1090,7 @@ void SAL_CALL ScLabelRangesObj::removeByIndex( sal_Int32 nIndex ) ScDocument& rDoc = pDocShell->GetDocument(); ScRangePairList* pOldList = bColumn ? rDoc.GetColNameRanges() : rDoc.GetRowNameRanges(); - if ( pOldList && nIndex >= 0 && nIndex < (sal_Int32)pOldList->size() ) + if ( pOldList && nIndex >= 0 && nIndex < static_cast<sal_Int32>(pOldList->size()) ) { ScRangePairListRef xNewList(pOldList->Clone()); @@ -1143,7 +1143,7 @@ sal_Int32 SAL_CALL ScLabelRangesObj::getCount() uno::Any SAL_CALL ScLabelRangesObj::getByIndex( sal_Int32 nIndex ) { SolarMutexGuard aGuard; - uno::Reference< sheet::XLabelRange > xRange(GetObjectByIndex_Impl((sal_uInt16)nIndex)); + uno::Reference< sheet::XLabelRange > xRange(GetObjectByIndex_Impl(static_cast<sal_uInt16>(nIndex))); if ( !xRange.is() ) throw lang::IndexOutOfBoundsException(); diff --git a/sc/source/ui/unoobj/optuno.cxx b/sc/source/ui/unoobj/optuno.cxx index ae39a0aae238..e74b9471618a 100644 --- a/sc/source/ui/unoobj/optuno.cxx +++ b/sc/source/ui/unoobj/optuno.cxx @@ -81,7 +81,7 @@ bool ScDocOptionsHelper::setPropertyValue( ScDocOptions& rOptions, { sal_Int32 nIntVal = 0; if ( aValue >>= nIntVal ) - rOptions.SetIterCount( (sal_uInt16)nIntVal ); + rOptions.SetIterCount( static_cast<sal_uInt16>(nIntVal) ); } break; case PROP_UNO_ITEREPSILON : @@ -140,7 +140,7 @@ uno::Any ScDocOptionsHelper::getPropertyValue( aRet <<= rOptions.IsCalcAsShown(); break; case PROP_UNO_DEFTABSTOP : - aRet <<= (sal_Int16)( rOptions.GetTabDistance() ); + aRet <<= static_cast<sal_Int16>( rOptions.GetTabDistance() ); break; case PROP_UNO_IGNORECASE : aRet <<= rOptions.IsIgnoreCase(); @@ -149,7 +149,7 @@ uno::Any ScDocOptionsHelper::getPropertyValue( aRet <<= rOptions.IsIter(); break; case PROP_UNO_ITERCOUNT: - aRet <<= (sal_Int32)( rOptions.GetIterCount() ); + aRet <<= static_cast<sal_Int32>( rOptions.GetIterCount() ); break; case PROP_UNO_ITEREPSILON: aRet <<= rOptions.GetIterEps(); @@ -173,7 +173,7 @@ uno::Any ScDocOptionsHelper::getPropertyValue( aRet <<= rOptions.IsAutoSpell(); break; case PROP_UNO_STANDARDDEC : - aRet <<= (sal_Int16)( rOptions.GetStdPrecision() ); + aRet <<= static_cast<sal_Int16>( rOptions.GetStdPrecision() ); break; case PROP_UNO_REGEXENABLED: aRet <<= rOptions.IsFormulaRegexEnabled(); diff --git a/sc/source/ui/unoobj/scdetect.cxx b/sc/source/ui/unoobj/scdetect.cxx index 3741a8a17265..881c5f9834a3 100644 --- a/sc/source/ui/unoobj/scdetect.cxx +++ b/sc/source/ui/unoobj/scdetect.cxx @@ -107,7 +107,7 @@ bool detectThisFormat(SvStream& rStr, const sal_uInt16* pSearch) if( nMuster < 0x0100 ) { // compare bytes - if( ( sal_uInt8 ) nMuster != nByte ) + if( static_cast<sal_uInt8>(nMuster) != nByte ) bSync = false; } else if( nMuster & M_DC ) @@ -115,12 +115,12 @@ bool detectThisFormat(SvStream& rStr, const sal_uInt16* pSearch) } else if( nMuster & M_ALT(0) ) { // alternative Bytes - sal_uInt8 nAnzAlt = ( sal_uInt8 ) nMuster; + sal_uInt8 nAnzAlt = static_cast<sal_uInt8>(nMuster); bSync = false; // first unsynchron while( nAnzAlt > 0 ) { pSearch++; - if( ( sal_uInt8 ) *pSearch == nByte ) + if( static_cast<sal_uInt8>(*pSearch) == nByte ) bSync = true; // only now synchronization nAnzAlt--; } diff --git a/sc/source/ui/unoobj/srchuno.cxx b/sc/source/ui/unoobj/srchuno.cxx index 9c9d52ff56f5..ffd0b1894ca0 100644 --- a/sc/source/ui/unoobj/srchuno.cxx +++ b/sc/source/ui/unoobj/srchuno.cxx @@ -166,9 +166,9 @@ uno::Any SAL_CALL ScCellSearchObj::getPropertyValue( const OUString& aPropertyNa else if (aPropertyName == SC_UNO_SRCHSIMREL) aRet <<= pSearchItem->IsLEVRelaxed(); else if (aPropertyName == SC_UNO_SRCHSTYLES) aRet <<= pSearchItem->GetPattern(); else if (aPropertyName == SC_UNO_SRCHWORDS) aRet <<= pSearchItem->GetWordOnly(); - else if (aPropertyName == SC_UNO_SRCHSIMADD) aRet <<= (sal_Int16) pSearchItem->GetLEVLonger(); - else if (aPropertyName == SC_UNO_SRCHSIMEX) aRet <<= (sal_Int16) pSearchItem->GetLEVOther(); - else if (aPropertyName == SC_UNO_SRCHSIMREM) aRet <<= (sal_Int16) pSearchItem->GetLEVShorter(); + 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_SRCHFILTERED) aRet <<= pSearchItem->IsSearchFiltered(); else if (aPropertyName == SC_UNO_SRCHFORMATTED) aRet <<= pSearchItem->IsSearchFormatted(); diff --git a/sc/source/ui/unoobj/styleuno.cxx b/sc/source/ui/unoobj/styleuno.cxx index 3cbecb95c7d4..1b38a451a033 100644 --- a/sc/source/ui/unoobj/styleuno.cxx +++ b/sc/source/ui/unoobj/styleuno.cxx @@ -626,7 +626,7 @@ ScStyleObj* ScStyleFamilyObj::GetObjectByIndex_Impl(sal_uInt32 nIndex) SfxStyleSheetIterator aIter( pStylePool, eFamily ); if ( nIndex < aIter.Count() ) { - SfxStyleSheetBase* pStyle = aIter[(sal_uInt16)nIndex]; + SfxStyleSheetBase* pStyle = aIter[static_cast<sal_uInt16>(nIndex)]; if ( pStyle ) { return new ScStyleObj( pDocShell, eFamily, pStyle->GetName() ); @@ -1558,7 +1558,7 @@ void ScStyleObj::setPropertyValue_Impl( const OUString& rPropertyName, const Sfx { sal_Int16 nVal = 0; *pValue >>= nVal; - rSet.Put( SfxUInt16Item( pEntry->nWID, (sal_uInt16)HMMToTwips(nVal) ) ); + rSet.Put( SfxUInt16Item( pEntry->nWID, static_cast<sal_uInt16>(HMMToTwips(nVal)) ) ); } break; case ATTR_ROTATE_VALUE: @@ -1651,7 +1651,7 @@ void ScStyleObj::setPropertyValue_Impl( const OUString& rPropertyName, const Sfx for (sal_uInt16 i=0; i<nCount; i++) if ( aName == pPrinter->GetPaperBinName(i) ) { - nTray = (sal_uInt8) i; + nTray = static_cast<sal_uInt8>(i); bFound = true; break; } diff --git a/sc/source/ui/unoobj/tokenuno.cxx b/sc/source/ui/unoobj/tokenuno.cxx index 54bec9d48568..5419c1b40833 100644 --- a/sc/source/ui/unoobj/tokenuno.cxx +++ b/sc/source/ui/unoobj/tokenuno.cxx @@ -372,7 +372,7 @@ bool ScTokenConversion::ConvertToTokenSequence( const ScDocument& rDoc, case svByte: // Only the count of spaces is stored as "long". Parameter count is ignored. if ( eOpCode == ocSpaces ) - rAPI.Data <<= (sal_Int32) rToken.GetByte(); + rAPI.Data <<= static_cast<sal_Int32>(rToken.GetByte()); else rAPI.Data.clear(); // no data break; diff --git a/sc/source/ui/unoobj/viewuno.cxx b/sc/source/ui/unoobj/viewuno.cxx index 9e25bbfefec0..511b14ec3498 100644 --- a/sc/source/ui/unoobj/viewuno.cxx +++ b/sc/source/ui/unoobj/viewuno.cxx @@ -205,7 +205,7 @@ void SAL_CALL ScViewPaneBase::setFirstVisibleColumn(sal_Int32 nFirstVisibleColum (ScSplitPos) nPane; ScHSplitPos eWhichH = WhichH( eWhich ); - long nDeltaX = ((long)nFirstVisibleColumn) - rViewData.GetPosX( eWhichH ); + long nDeltaX = static_cast<long>(nFirstVisibleColumn) - rViewData.GetPosX( eWhichH ); pViewShell->ScrollX( nDeltaX, eWhichH ); } } @@ -238,7 +238,7 @@ void SAL_CALL ScViewPaneBase::setFirstVisibleRow( sal_Int32 nFirstVisibleRow ) (ScSplitPos) nPane; ScVSplitPos eWhichV = WhichV( eWhich ); - long nDeltaY = ((long)nFirstVisibleRow) - rViewData.GetPosY( eWhichV ); + long nDeltaY = static_cast<long>(nFirstVisibleRow) - rViewData.GetPosY( eWhichV ); pViewShell->ScrollY( nDeltaY, eWhichV ); } } @@ -283,8 +283,8 @@ uno::Reference<table::XCellRange> SAL_CALL ScViewPaneBase::getReferredCells() ScDocShell* pDocSh = pViewShell->GetViewData().GetDocShell(); table::CellRangeAddress aAdr(getVisibleRange()); //! helper function with ScRange? - ScRange aRange( (SCCOL)aAdr.StartColumn, (SCROW)aAdr.StartRow, aAdr.Sheet, - (SCCOL)aAdr.EndColumn, (SCROW)aAdr.EndRow, aAdr.Sheet ); + ScRange aRange( static_cast<SCCOL>(aAdr.StartColumn), static_cast<SCROW>(aAdr.StartRow), aAdr.Sheet, + static_cast<SCCOL>(aAdr.EndColumn), static_cast<SCROW>(aAdr.EndRow), aAdr.Sheet ); if ( aRange.aStart == aRange.aEnd ) return new ScCellObj( pDocSh, aRange.aStart ); else @@ -988,7 +988,7 @@ sal_Int32 SAL_CALL ScTabViewObj::getCount() uno::Any SAL_CALL ScTabViewObj::getByIndex( sal_Int32 nIndex ) { SolarMutexGuard aGuard; - uno::Reference<sheet::XViewPane> xPane(GetObjectByIndex_Impl((sal_uInt16)nIndex)); + uno::Reference<sheet::XViewPane> xPane(GetObjectByIndex_Impl(static_cast<sal_uInt16>(nIndex))); if (!xPane.is()) throw lang::IndexOutOfBoundsException(); @@ -1126,8 +1126,8 @@ uno::Reference< uno::XInterface > ScTabViewObj::GetClickedObject(const Point& rP vcl::Window* pActiveWin = rData.GetActiveWin(); Point aPos = pActiveWin->PixelToLogic(rPoint); - sal_uInt16 nHitLog = (sal_uInt16) pActiveWin->PixelToLogic( - Size(pDrawView->GetHitTolerancePixel(),0)).Width(); + sal_uInt16 nHitLog = static_cast<sal_uInt16>(pActiveWin->PixelToLogic( + Size(pDrawView->GetHitTolerancePixel(),0)).Width()); const size_t nCount(pDrawPage->GetObjCount()); bool bFound(false); @@ -1406,7 +1406,7 @@ sal_Int16 ScTabViewObj::GetZoom() const if (pViewSh) { const Fraction& rZoomY = pViewSh->GetViewData().GetZoomY(); // Y will be shown - return (sal_Int16)long( rZoomY * 100 ); + return static_cast<sal_Int16>(long( rZoomY * 100 )); } return 0; } @@ -1653,7 +1653,7 @@ void SAL_CALL ScTabViewObj::freezeAtPosition( sal_Int32 nColumns, sal_Int32 nRow aWinStart = pWin->GetPosPixel(); ScViewData& rViewData = pViewSh->GetViewData(); - Point aSplit(rViewData.GetScrPos( (SCCOL)nColumns, (SCROW)nRows, SC_SPLIT_BOTTOMLEFT, true )); + Point aSplit(rViewData.GetScrPos( static_cast<SCCOL>(nColumns), static_cast<SCROW>(nRows), SC_SPLIT_BOTTOMLEFT, true )); aSplit += aWinStart; pViewSh->SplitAtPixel( aSplit ); @@ -1799,7 +1799,7 @@ void SAL_CALL ScTabViewObj::setPropertyValue( if ( aValue >>= nIntVal ) { //#i80528# adapt to new range eventually - if((sal_Int16)VOBJ_MODE_HIDE < nIntVal) nIntVal = (sal_Int16)VOBJ_MODE_SHOW; + if(sal_Int16(VOBJ_MODE_HIDE) < nIntVal) nIntVal = sal_Int16(VOBJ_MODE_SHOW); aNewOpt.SetObjMode( VOBJ_TYPE_OLE, (ScVObjMode)nIntVal); } @@ -1810,7 +1810,7 @@ void SAL_CALL ScTabViewObj::setPropertyValue( if ( aValue >>= nIntVal ) { //#i80528# adapt to new range eventually - if((sal_Int16)VOBJ_MODE_HIDE < nIntVal) nIntVal = (sal_Int16)VOBJ_MODE_SHOW; + if(sal_Int16(VOBJ_MODE_HIDE) < nIntVal) nIntVal = sal_Int16(VOBJ_MODE_SHOW); aNewOpt.SetObjMode( VOBJ_TYPE_CHART, (ScVObjMode)nIntVal); } @@ -1821,7 +1821,7 @@ void SAL_CALL ScTabViewObj::setPropertyValue( if ( aValue >>= nIntVal ) { //#i80528# adapt to new range eventually - if((sal_Int16)VOBJ_MODE_HIDE < nIntVal) nIntVal = (sal_Int16)VOBJ_MODE_SHOW; + if(sal_Int16(VOBJ_MODE_HIDE) < nIntVal) nIntVal = sal_Int16(VOBJ_MODE_SHOW); aNewOpt.SetObjMode( VOBJ_TYPE_DRAW, (ScVObjMode)nIntVal); } @@ -1905,10 +1905,10 @@ uno::Any SAL_CALL ScTabViewObj::getPropertyValue( const OUString& aPropertyName aRet <<= rOpt.GetOption( VOPT_SYNTAX ); else if ( aPropertyName == SC_UNO_VERTSCROLL || aPropertyName == OLD_UNO_VERTSCROLL ) aRet <<= rOpt.GetOption( VOPT_VSCROLL ); - else if ( aPropertyName == SC_UNO_SHOWOBJ ) aRet <<= (sal_Int16)( rOpt.GetObjMode( VOBJ_TYPE_OLE ) ); - else if ( aPropertyName == SC_UNO_SHOWCHARTS ) aRet <<= (sal_Int16)( rOpt.GetObjMode( VOBJ_TYPE_CHART ) ); - else if ( aPropertyName == SC_UNO_SHOWDRAW ) aRet <<= (sal_Int16)( rOpt.GetObjMode( VOBJ_TYPE_DRAW ) ); - else if ( aPropertyName == SC_UNO_GRIDCOLOR ) aRet <<= (sal_Int32)( rOpt.GetGridColor().GetColor() ); + else if ( aPropertyName == SC_UNO_SHOWOBJ ) aRet <<= static_cast<sal_Int16>( rOpt.GetObjMode( VOBJ_TYPE_OLE ) ); + else if ( aPropertyName == SC_UNO_SHOWCHARTS ) aRet <<= static_cast<sal_Int16>( rOpt.GetObjMode( VOBJ_TYPE_CHART ) ); + else if ( aPropertyName == SC_UNO_SHOWDRAW ) aRet <<= static_cast<sal_Int16>( rOpt.GetObjMode( VOBJ_TYPE_DRAW ) ); + else if ( aPropertyName == SC_UNO_GRIDCOLOR ) aRet <<= static_cast<sal_Int32>( rOpt.GetGridColor().GetColor() ); else if ( aPropertyName == SC_UNO_VISAREA ) aRet <<= GetVisArea(); else if ( aPropertyName == SC_UNO_ZOOMTYPE ) aRet <<= GetZoomType(); else if ( aPropertyName == SC_UNO_ZOOMVALUE ) aRet <<= GetZoom(); diff --git a/sc/source/ui/vba/vbaapplication.cxx b/sc/source/ui/vba/vbaapplication.cxx index 396eb3fcada3..e576308bcdfe 100644 --- a/sc/source/ui/vba/vbaapplication.cxx +++ b/sc/source/ui/vba/vbaapplication.cxx @@ -597,10 +597,10 @@ ScVbaApplication::GoTo( const uno::Any& Reference, const uno::Any& Scroll ) ScSplitPos eWhich = pShell->GetViewData().GetActivePart(); sal_Int32 nValueX = pShell->GetViewData().GetPosX(WhichH(eWhich)); sal_Int32 nValueY = pShell->GetViewData().GetPosY(WhichV(eWhich)); - xWindow->SmallScroll( uno::makeAny( (sal_Int16)(xVbaSheetRange->getRow() - 1) ), - uno::makeAny( (sal_Int16)nValueY ), - uno::makeAny( (sal_Int16)(xVbaSheetRange->getColumn() - 1) ), - uno::makeAny( (sal_Int16)nValueX ) ); + xWindow->SmallScroll( uno::makeAny( static_cast<sal_Int16>(xVbaSheetRange->getRow() - 1) ), + uno::makeAny( static_cast<sal_Int16>(nValueY) ), + uno::makeAny( static_cast<sal_Int16>(xVbaSheetRange->getColumn() - 1) ), + uno::makeAny( static_cast<sal_Int16>(nValueX) ) ); gridWindow->GrabFocus(); } else @@ -637,10 +637,10 @@ ScVbaApplication::GoTo( const uno::Any& Reference, const uno::Any& Scroll ) ScSplitPos eWhich = pShell->GetViewData().GetActivePart(); sal_Int32 nValueX = pShell->GetViewData().GetPosX(WhichH(eWhich)); sal_Int32 nValueY = pShell->GetViewData().GetPosY(WhichV(eWhich)); - xWindow->SmallScroll( uno::makeAny( (sal_Int16)(xVbaRange->getRow() - 1) ), - uno::makeAny( (sal_Int16)nValueY ), - uno::makeAny( (sal_Int16)(xVbaRange->getColumn() - 1) ), - uno::makeAny( (sal_Int16)nValueX ) ); + xWindow->SmallScroll( uno::makeAny( static_cast<sal_Int16>(xVbaRange->getRow() - 1) ), + uno::makeAny( static_cast<sal_Int16>(nValueY) ), + uno::makeAny( static_cast<sal_Int16>(xVbaRange->getColumn() - 1) ), + uno::makeAny( static_cast<sal_Int16>(nValueX) ) ); gridWindow->GrabFocus(); } else @@ -941,7 +941,7 @@ ScVbaApplication::getTemplatesPath() OUString SAL_CALL ScVbaApplication::getPathSeparator() { - return OUString( (sal_Unicode) SAL_PATHDELIMITER ); + return OUString( sal_Unicode(SAL_PATHDELIMITER) ); } OUString SAL_CALL diff --git a/sc/source/ui/vba/vbafont.cxx b/sc/source/ui/vba/vbafont.cxx index 3f51efced61f..38efe31db616 100644 --- a/sc/source/ui/vba/vbafont.cxx +++ b/sc/source/ui/vba/vbafont.cxx @@ -90,7 +90,7 @@ uno::Any SAL_CALL ScVbaFont::getColorIndex() { if(mbFormControl) - return uno::Any( (sal_Int32) 0 ); + return uno::Any( sal_Int32(0) ); if ( GetDataSet() ) if ( GetDataSet()->GetItemState( ATTR_FONT_COLOR) == SfxItemState::DONTCARE ) return aNULL(); diff --git a/sc/source/ui/vba/vbainterior.cxx b/sc/source/ui/vba/vbainterior.cxx index 91bfe2fae30e..f8ee6eec03fa 100644 --- a/sc/source/ui/vba/vbainterior.cxx +++ b/sc/source/ui/vba/vbainterior.cxx @@ -82,7 +82,7 @@ static PatternMap aPatternMap( lcl_getPatternMap() ); ScVbaInterior::ScVbaInterior( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< beans::XPropertySet >& xProps, ScDocument* pScDoc ) : ScVbaInterior_BASE( xParent, xContext ), m_xProps(xProps), m_pScDoc( pScDoc ) { // auto color - m_aPattColor.SetColor( (sal_uInt32)0x0 ); + m_aPattColor.SetColor( sal_uInt32(0x0) ); m_nPattern = 0; if ( !m_xProps.is() ) throw lang::IllegalArgumentException("properties", uno::Reference< uno::XInterface >(), 2 ); @@ -129,9 +129,9 @@ ScVbaInterior::SetMixedColor() // set mixed color Color aMixedColor; if( nPattern > 0 ) - aMixedColor = GetPatternColor( Color(nPatternColor), aBackColor, (sal_uInt32)nPattern ); + aMixedColor = GetPatternColor( Color(nPatternColor), aBackColor, static_cast<sal_uInt32>(nPattern) ); else - aMixedColor = GetPatternColor( aBackColor, aBackColor, (sal_uInt32)nPattern ); + aMixedColor = GetPatternColor( aBackColor, aBackColor, static_cast<sal_uInt32>(nPattern) ); sal_Int32 nMixedColor = aMixedColor.GetColor() & COLORMAST; m_xProps->setPropertyValue( BACKCOLOR , uno::makeAny( nMixedColor ) ); } diff --git a/sc/source/ui/vba/vbapagesetup.cxx b/sc/source/ui/vba/vbapagesetup.cxx index 288120c962f8..dd4a0169ee64 100644 --- a/sc/source/ui/vba/vbapagesetup.cxx +++ b/sc/source/ui/vba/vbapagesetup.cxx @@ -516,7 +516,7 @@ void SAL_CALL ScVbaPageSetup::setFirstPageNumber( sal_Int32 firstPageNumber) try { uno::Any aValue; - aValue <<= (sal_Int16)firstPageNumber; + aValue <<= static_cast<sal_Int16>(firstPageNumber); mxPageProps->setPropertyValue("FirstPageNumber", aValue ); } catch (const uno::Exception&) diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx index added596c776..3e44a75d22cd 100644 --- a/sc/source/ui/vba/vbarange.cxx +++ b/sc/source/ui/vba/vbarange.cxx @@ -209,7 +209,7 @@ static double lcl_TwipsToPoints( sal_uInt16 nVal ) static double lcl_Round2DecPlaces( double nVal ) { - nVal = (nVal * (double)100); + nVal = (nVal * double(100)); long tmp = static_cast<long>(nVal); if ( ( nVal - tmp ) >= 0.5 ) ++tmp; @@ -729,9 +729,9 @@ CellValueSetter::processValue( const uno::Any& aValue, const uno::Reference< tab { uno::Reference< table::XCellRange > xRange( xCell, uno::UNO_QUERY_THROW ); if ( bState ) - xCell->setValue( (double) 1 ); + xCell->setValue( double(1) ); else - xCell->setValue( (double) 0 ); + xCell->setValue( double(0) ); NumFormatHelper cellNumFormat( xRange ); cellNumFormat.setNumberFormat( util::NumberFormat::LOGICAL ); } @@ -2762,8 +2762,8 @@ ScVbaRange::Range( const uno::Any &Cell1, const uno::Any &Cell2, bool bForceUseI if ( nStartX <= nEndX && nEndX <= parentAddress.aEnd.Col() && nStartY <= nEndY && nEndY <= parentAddress.aEnd.Row() ) { - ScRange aNew( (SCCOL)nStartX, (SCROW)nStartY, parentAddress.aStart.Tab(), - (SCCOL)nEndX, (SCROW)nEndY, parentAddress.aEnd.Tab() ); + ScRange aNew( static_cast<SCCOL>(nStartX), static_cast<SCROW>(nStartY), parentAddress.aStart.Tab(), + static_cast<SCCOL>(nEndX), static_cast<SCROW>(nEndY), parentAddress.aEnd.Tab() ); xCellRange = new ScCellRangeObj( getScDocShell(), aNew ); } } @@ -3555,7 +3555,7 @@ ScVbaRange::End( ::sal_Int32 Direction ) OUString sActiveCell = xApplication->getActiveCell()->Address(aDft, aDft, aDft, aDft, aDft ); // position current cell upper left of this range - Cells( uno::makeAny( (sal_Int32) 1 ), uno::makeAny( (sal_Int32) 1 ) )->Select(); + Cells( uno::makeAny( sal_Int32(1) ), uno::makeAny( sal_Int32(1) ) )->Select(); uno::Reference< frame::XModel > xModel = getModelFromRange( mxRange ); @@ -4303,7 +4303,7 @@ static void lcl_setTableFieldsFromCriteria( OUString& sCriteria1, const uno::Ref bool bIsNumeric = false; if ( sCriteria1.startsWith( EQUALS ) ) { - if ( sCriteria1.getLength() == (sal_Int32)strlen(EQUALS) ) + if ( sCriteria1.getLength() == static_cast<sal_Int32>(strlen(EQUALS)) ) rFilterField.Operator = sheet::FilterOperator2::EMPTY; else { @@ -4318,7 +4318,7 @@ static void lcl_setTableFieldsFromCriteria( OUString& sCriteria1, const uno::Ref } else if ( sCriteria1.startsWith( NOTEQUALS ) ) { - if ( sCriteria1.getLength() == (sal_Int32)strlen(NOTEQUALS) ) + if ( sCriteria1.getLength() == static_cast<sal_Int32>(strlen(NOTEQUALS)) ) rFilterField.Operator = sheet::FilterOperator2::NOT_EMPTY; else { @@ -4885,7 +4885,7 @@ uno::Any ScVbaRange::getShowDetail() ScDocument& rDoc = getDocumentFromRange( mxRange ); ScOutlineTable* pOutlineTable = rDoc.GetOutlineTable(static_cast<SCTAB>(thisAddress.Sheet), true); const ScOutlineArray& rOutlineArray = bColumn ? pOutlineTable->GetColArray(): pOutlineTable->GetRowArray(); - SCCOLROW nPos = bColumn ? (SCCOLROW)(thisAddress.EndColumn-1):(SCCOLROW)(thisAddress.EndRow-1); + SCCOLROW nPos = bColumn ? static_cast<SCCOLROW>(thisAddress.EndColumn-1):static_cast<SCCOLROW>(thisAddress.EndRow-1); const ScOutlineEntry* pEntry = rOutlineArray.GetEntryByPos( 0, nPos ); if( pEntry ) { diff --git a/sc/source/ui/view/cellsh1.cxx b/sc/source/ui/view/cellsh1.cxx index f4599a40b35f..c77bcb3a409e 100644 --- a/sc/source/ui/view/cellsh1.cxx +++ b/sc/source/ui/view/cellsh1.cxx @@ -1465,7 +1465,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) rReq.AppendItem( SfxBoolItem( FN_PARAM_3, bTranspose ) ); rReq.AppendItem( SfxBoolItem( FN_PARAM_4, bAsLink ) ); rReq.AppendItem( SfxUInt16Item( FN_PARAM_1, static_cast<sal_uInt16>(nFunction) ) ); - rReq.AppendItem( SfxInt16Item( FN_PARAM_5, (sal_Int16) eMoveMode ) ); + rReq.AppendItem( SfxInt16Item( FN_PARAM_5, static_cast<sal_Int16>(eMoveMode) ) ); rReq.Done(); } } @@ -2525,7 +2525,7 @@ void ScCellShell::ExecuteEdit( SfxRequest& rReq ) const OUString& rName = pHyper->GetName(); const OUString& rURL = pHyper->GetURL(); const OUString& rTarget = pHyper->GetTargetFrame(); - sal_uInt16 nType = (sal_uInt16) pHyper->GetInsertMode(); + sal_uInt16 nType = static_cast<sal_uInt16>(pHyper->GetInsertMode()); pTabViewShell->InsertURL( rName, rURL, rTarget, nType ); rReq.Done(); diff --git a/sc/source/ui/view/cellsh3.cxx b/sc/source/ui/view/cellsh3.cxx index f0a77deca879..d40a11d2dd79 100644 --- a/sc/source/ui/view/cellsh3.cxx +++ b/sc/source/ui/view/cellsh3.cxx @@ -576,10 +576,10 @@ void ScCellShell::Execute( SfxRequest& rReq ) if ( pDlg->Execute() == RET_OK ) { long nVal = pDlg->GetInputValue(); - pTabViewShell->SetMarkedWidthOrHeight( false, SC_SIZE_DIRECT, (sal_uInt16)nVal ); + pTabViewShell->SetMarkedWidthOrHeight( false, SC_SIZE_DIRECT, static_cast<sal_uInt16>(nVal) ); // #101390#; the value of the macro should be in HMM so use TwipsToEvenHMM to convert - rReq.AppendItem( SfxUInt16Item( FID_ROW_HEIGHT, (sal_uInt16)TwipsToEvenHMM(nVal) ) ); + rReq.AppendItem( SfxUInt16Item( FID_ROW_HEIGHT, static_cast<sal_uInt16>(TwipsToEvenHMM(nVal)) ) ); rReq.Done(); } @@ -616,11 +616,11 @@ void ScCellShell::Execute( SfxRequest& rReq ) if ( pDlg->Execute() == RET_OK ) { long nVal = pDlg->GetInputValue(); - pTabViewShell->SetMarkedWidthOrHeight( false, SC_SIZE_OPTIMAL, (sal_uInt16)nVal ); + pTabViewShell->SetMarkedWidthOrHeight( false, SC_SIZE_OPTIMAL, static_cast<sal_uInt16>(nVal) ); ScGlobal::nLastRowHeightExtra = nVal; // #101390#; the value of the macro should be in HMM so use TwipsToEvenHMM to convert - rReq.AppendItem( SfxUInt16Item( FID_ROW_OPT_HEIGHT, (sal_uInt16)TwipsToEvenHMM(nVal) ) ); + rReq.AppendItem( SfxUInt16Item( FID_ROW_OPT_HEIGHT, static_cast<sal_uInt16>(TwipsToEvenHMM(nVal)) ) ); rReq.Done(); } @@ -681,10 +681,10 @@ void ScCellShell::Execute( SfxRequest& rReq ) if ( pDlg->Execute() == RET_OK ) { long nVal = pDlg->GetInputValue(); - pTabViewShell->SetMarkedWidthOrHeight( true, SC_SIZE_DIRECT, (sal_uInt16)nVal ); + pTabViewShell->SetMarkedWidthOrHeight( true, SC_SIZE_DIRECT, static_cast<sal_uInt16>(nVal) ); // #101390#; the value of the macro should be in HMM so use TwipsToEvenHMM to convert - rReq.AppendItem( SfxUInt16Item( FID_COL_WIDTH, (sal_uInt16)TwipsToEvenHMM(nVal)) ); + rReq.AppendItem( SfxUInt16Item( FID_COL_WIDTH, static_cast<sal_uInt16>(TwipsToEvenHMM(nVal))) ); rReq.Done(); } @@ -720,11 +720,11 @@ void ScCellShell::Execute( SfxRequest& rReq ) if ( pDlg->Execute() == RET_OK ) { long nVal = pDlg->GetInputValue(); - pTabViewShell->SetMarkedWidthOrHeight( true, SC_SIZE_OPTIMAL, (sal_uInt16)nVal ); + pTabViewShell->SetMarkedWidthOrHeight( true, SC_SIZE_OPTIMAL, static_cast<sal_uInt16>(nVal) ); ScGlobal::nLastColWidthExtra = nVal; // #101390#; the value of the macro should be in HMM so use TwipsToEvenHMM to convert - rReq.AppendItem( SfxUInt16Item( FID_COL_OPT_WIDTH, (sal_uInt16)TwipsToEvenHMM(nVal) ) ); + rReq.AppendItem( SfxUInt16Item( FID_COL_OPT_WIDTH, static_cast<sal_uInt16>(TwipsToEvenHMM(nVal)) ) ); rReq.Done(); } } diff --git a/sc/source/ui/view/colrowba.cxx b/sc/source/ui/view/colrowba.cxx index 246fd7b5238a..f1636efe1509 100644 --- a/sc/source/ui/view/colrowba.cxx +++ b/sc/source/ui/view/colrowba.cxx @@ -74,7 +74,7 @@ sal_uInt16 ScColBar::GetEntrySize( SCCOLROW nEntryNo ) const if (pDoc->ColHidden(static_cast<SCCOL>(nEntryNo), nTab)) return 0; else - return (sal_uInt16) ScViewData::ToPixel( pDoc->GetColWidth( static_cast<SCCOL>(nEntryNo), nTab ), rViewData.GetPPTX() ); + return static_cast<sal_uInt16>(ScViewData::ToPixel( pDoc->GetColWidth( static_cast<SCCOL>(nEntryNo), nTab ), rViewData.GetPPTX() )); } OUString ScColBar::GetEntryText( SCCOLROW nEntryNo ) const @@ -97,7 +97,7 @@ void ScColBar::SetEntrySize( SCCOLROW nPos, sal_uInt16 nNewSize ) eMode = SC_SIZE_OPTIMAL; } else - nSizeTwips = (sal_uInt16) ( nNewSize / rViewData.GetPPTX() ); + nSizeTwips = static_cast<sal_uInt16>( nNewSize / rViewData.GetPPTX() ); const ScMarkData& rMark = rViewData.GetMarkData(); @@ -196,7 +196,7 @@ void ScColBar::DrawInvert( long nDragPosP ) OUString ScColBar::GetDragHelp( long nVal ) { - long nTwips = (long) ( nVal / pTabView->GetViewData().GetPPTX() ); + long nTwips = static_cast<long>( nVal / pTabView->GetViewData().GetPPTX() ); return lcl_MetricString( nTwips, ScGlobal::GetRscString(STR_TIP_WIDTH) ); } @@ -234,8 +234,8 @@ sal_uInt16 ScRowBar::GetEntrySize( SCCOLROW nEntryNo ) const if (pDoc->RowHidden(nEntryNo, nTab, nullptr, &nLastRow)) return 0; else - return (sal_uInt16) ScViewData::ToPixel( pDoc->GetOriginalHeight( nEntryNo, - nTab ), rViewData.GetPPTY() ); + return static_cast<sal_uInt16>(ScViewData::ToPixel( pDoc->GetOriginalHeight( nEntryNo, + nTab ), rViewData.GetPPTY() )); } OUString ScRowBar::GetEntryText( SCCOLROW nEntryNo ) const @@ -256,7 +256,7 @@ void ScRowBar::SetEntrySize( SCCOLROW nPos, sal_uInt16 nNewSize ) eMode = SC_SIZE_OPTIMAL; } else - nSizeTwips = (sal_uInt16) ( nNewSize / rViewData.GetPPTY() ); + nSizeTwips = static_cast<sal_uInt16>( nNewSize / rViewData.GetPPTY() ); const ScMarkData& rMark = rViewData.GetMarkData(); @@ -355,7 +355,7 @@ void ScRowBar::DrawInvert( long nDragPosP ) OUString ScRowBar::GetDragHelp( long nVal ) { - long nTwips = (long) ( nVal / pTabView->GetViewData().GetPPTY() ); + long nTwips = static_cast<long>( nVal / pTabView->GetViewData().GetPPTY() ); return lcl_MetricString( nTwips, ScGlobal::GetRscString(STR_TIP_HEIGHT) ); } diff --git a/sc/source/ui/view/drawutil.cxx b/sc/source/ui/view/drawutil.cxx index 435c0854fa5d..ff859eb2074c 100644 --- a/sc/source/ui/view/drawutil.cxx +++ b/sc/source/ui/view/drawutil.cxx @@ -38,7 +38,7 @@ void ScDrawUtil::CalcScale( const ScDocument* pDoc, SCTAB nTab, for (SCCOL i=nStartCol; i<nEndCol; i++) { sal_uInt16 nWidth = pDoc->GetColWidth(i,nTab); - nTwipsX += (long) nWidth; + nTwipsX += static_cast<long>(nWidth); nPixelX += ScViewData::ToPixel( nWidth, nPPTX ); } @@ -63,20 +63,20 @@ void ScDrawUtil::CalcScale( const ScDocument* pDoc, SCTAB nTab, // because ReduceInaccurate is called later anyway. if ( aPixelLog.X() && nTwipsX ) - rScaleX = Fraction( ((double)aPixelLog.X()) * - ((double)rZoomX.GetNumerator()) / - ((double)nTwipsX) / + rScaleX = Fraction( static_cast<double>(aPixelLog.X()) * + static_cast<double>(rZoomX.GetNumerator()) / + static_cast<double>(nTwipsX) / HMM_PER_TWIPS / - ((double)rZoomX.GetDenominator()) ); + static_cast<double>(rZoomX.GetDenominator()) ); else rScaleX = Fraction( 1, 1 ); if ( aPixelLog.Y() && nTwipsY ) - rScaleY = Fraction( ((double)aPixelLog.Y()) * - ((double)rZoomY.GetNumerator()) / - ((double)nTwipsY) / + rScaleY = Fraction( static_cast<double>(aPixelLog.Y()) * + static_cast<double>(rZoomY.GetNumerator()) / + static_cast<double>(nTwipsY) / HMM_PER_TWIPS / - ((double)rZoomY.GetDenominator()) ); + static_cast<double>(rZoomY.GetDenominator()) ); else rScaleY = Fraction( 1, 1 ); diff --git a/sc/source/ui/view/editsh.cxx b/sc/source/ui/view/editsh.cxx index 9cbac20a0fc8..2b08da9db8ca 100644 --- a/sc/source/ui/view/editsh.cxx +++ b/sc/source/ui/view/editsh.cxx @@ -614,7 +614,7 @@ void ScEditShell::Execute( SfxRequest& rReq ) if (!bDone) { pViewData->GetViewShell()-> - InsertURL( rName, rURL, rTarget, (sal_uInt16) eMode ); + InsertURL( rName, rURL, rTarget, static_cast<sal_uInt16>(eMode) ); // when "Button", the InsertURL in ViewShell turns the EditShell off // thus the immediate return statement diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx index a8cfadc0dfab..ba95dba00a56 100644 --- a/sc/source/ui/view/formatsh.cxx +++ b/sc/source/ui/view/formatsh.cxx @@ -1232,10 +1232,10 @@ void ScFormatShell::ExecuteNumFormat( SfxRequest& rReq ) break; } - const bool bThousand = (bool)sFormat[0].toInt32(); - const bool bNegRed = (bool)sFormat[1].toInt32(); - const sal_uInt16 nPrecision = (sal_uInt16)sFormat[2].toInt32(); - const sal_uInt16 nLeadZeroes = (sal_uInt16)sFormat[3].toInt32(); + const bool bThousand = static_cast<bool>(sFormat[0].toInt32()); + const bool bNegRed = static_cast<bool>(sFormat[1].toInt32()); + const sal_uInt16 nPrecision = static_cast<sal_uInt16>(sFormat[2].toInt32()); + const sal_uInt16 nLeadZeroes = static_cast<sal_uInt16>(sFormat[3].toInt32()); aCode = pFormatter->GenerateFormat( nCurrentNumberFormat,//modify diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index 1d1cae4a5dc2..84ad31b969da 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -4654,7 +4654,7 @@ bool ScGridWindow::HitRangeFinder( const Point& rMouse, RfCorner& rCorner, bool bCornerVerticalUp = rMouse.Y() >= aCellStart.Y() && rMouse.Y() <= aCellStart.Y() + 8; // corner is hit only if the mouse is within the cell - sal_uInt16 nCount = (sal_uInt16)pRangeFinder->Count(); + sal_uInt16 nCount = static_cast<sal_uInt16>(pRangeFinder->Count()); for (sal_uInt16 i=nCount; i;) { // search backwards so that the last repainted frame is found @@ -4953,10 +4953,10 @@ void ScGridWindow::RFMouseMove( const MouseEvent& rMEvt, bool bUp ) nEndY = MAXROW; } - aNew.aStart.SetCol((SCCOL)nStartX); - aNew.aStart.SetRow((SCROW)nStartY); - aNew.aEnd.SetCol((SCCOL)nEndX); - aNew.aEnd.SetRow((SCROW)nEndY); + aNew.aStart.SetCol(static_cast<SCCOL>(nStartX)); + aNew.aStart.SetRow(static_cast<SCROW>(nStartY)); + aNew.aEnd.SetCol(static_cast<SCCOL>(nEndX)); + aNew.aEnd.SetRow(static_cast<SCROW>(nEndY)); } if ( bUp ) @@ -5244,7 +5244,7 @@ bool ScGridWindow::HasScenarioButton( const Point& rPosPixel, ScRange& rScenRang if (!nBWidth) return false; // No Button drawn yet -> there is none long nBHeight = aButSize.Height(); - long nHSpace = (long)( SC_SCENARIO_HSPACE * pViewData->GetPPTX() ); + long nHSpace = static_cast<long>( SC_SCENARIO_HSPACE * pViewData->GetPPTX() ); //! cache the Ranges in Table!!!! diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index 9387c1e6d79c..5bfda7ea5915 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -97,8 +97,8 @@ static void lcl_DrawOneFrame( vcl::RenderContext* pDev, const tools::Rectangle& lcl_LimitRect( aInner, aVisible ); tools::Rectangle aOuter = aInner; - long nHor = (long) ( SC_SCENARIO_HSPACE * nPPTX ); - long nVer = (long) ( SC_SCENARIO_VSPACE * nPPTY ); + long nHor = static_cast<long>( SC_SCENARIO_HSPACE * nPPTX ); + long nVer = static_cast<long>( SC_SCENARIO_VSPACE * nPPTY ); aOuter.Left() -= nHor; aOuter.Right() += nHor; aOuter.Top() -= nVer; @@ -842,7 +842,7 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI if ( pRangeFinder && !pRangeFinder->IsHidden() && pRangeFinder->GetDocName() == pDocSh->GetTitle() ) { - sal_uInt16 nCount = (sal_uInt16)pRangeFinder->Count(); + sal_uInt16 nCount = static_cast<sal_uInt16>(pRangeFinder->Count()); for (sal_uInt16 i=0; i<nCount; i++) { ScRangeFindData& rData = pRangeFinder->GetObject(i); @@ -1461,9 +1461,9 @@ void ScGridWindow::DrawPagePreview( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, long nPageNo = rData.GetFirstPage(); if ( rData.IsTopDown() ) - nPageNo += ((long)nColPos)*nRowBreaks+nRowPos; + nPageNo += static_cast<long>(nColPos)*nRowBreaks+nRowPos; else - nPageNo += ((long)nRowPos)*nColBreaks+nColPos; + nPageNo += static_cast<long>(nRowPos)*nColBreaks+nColPos; OUString aThisPageStr = aPageStr.replaceFirst("%1", OUString::number(nPageNo)); diff --git a/sc/source/ui/view/hdrcont.cxx b/sc/source/ui/view/hdrcont.cxx index 96d388c0483e..07b69115fdc8 100644 --- a/sc/source/ui/view/hdrcont.cxx +++ b/sc/source/ui/view/hdrcont.cxx @@ -272,9 +272,9 @@ void ScHeaderControl::Paint( vcl::RenderContext& /*rRenderContext*/, const tools Size aTextSize; if (bVertical) - nBarSize = (sal_uInt16) GetSizePixel().Width(); + nBarSize = static_cast<sal_uInt16>(GetSizePixel().Width()); else - nBarSize = (sal_uInt16) GetSizePixel().Height(); + nBarSize = static_cast<sal_uInt16>(GetSizePixel().Height()); SCCOLROW nPos = GetPos(); @@ -786,7 +786,7 @@ void ScHeaderControl::MouseButtonUp( const MouseEvent& rMEvt ) else { if (bDragMoved) - SetEntrySize( nDragNo, (sal_uInt16) nNewWidth ); + SetEntrySize( nDragNo, static_cast<sal_uInt16>(nNewWidth) ); } } else diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx index 6cfa4c2861b1..bd3687cd1cd3 100644 --- a/sc/source/ui/view/output.cxx +++ b/sc/source/ui/view/output.cxx @@ -1220,9 +1220,9 @@ void ScOutputData::DrawExtraShadow(bool bLeft, bool bTop, bool bRight, bool bBot nPosY + pRowInfo[nArrY].nHeight - 1 ); long nSize = pAttr->GetWidth(); - long nSizeX = (long)(nSize*mnPPTX); + long nSizeX = static_cast<long>(nSize*mnPPTX); if (nSizeX >= nMaxWidth) nSizeX = nMaxWidth-1; - long nSizeY = (long)(nSize*mnPPTY); + long nSizeY = static_cast<long>(nSize*mnPPTY); if (nSizeY >= nRowHeight) nSizeY = nRowHeight-1; nSizeX *= nLayoutSign; // used only to add to rectangle values @@ -1562,7 +1562,7 @@ void ScOutputData::DrawRotatedFrame(vcl::RenderContext& rRenderContext) while (nCol > nX) { --nCol; - nPosX -= nLayoutSign * (long)pRowInfo[0].pCellInfo[nCol + 1].nWidth; + nPosX -= nLayoutSign * static_cast<long>(pRowInfo[0].pCellInfo[nCol + 1].nWidth); } } @@ -1582,7 +1582,7 @@ void ScOutputData::DrawRotatedFrame(vcl::RenderContext& rRenderContext) double nCos = cos(nRealOrient); double nSin = sin(nRealOrient); //! restrict !!! - long nSkew = (long)(nRowHeight * nCos / nSin); + long nSkew = static_cast<long>(nRowHeight * nCos / nSin); switch (eRotMode) { @@ -2262,8 +2262,8 @@ void ScOutputData::AddPDFNotes() if ( mpDoc->GetNote(nMergeX, nMergeY, nTab) && ( bIsMerged || ( !pInfo->bHOverlapped && !pInfo->bVOverlapped ) ) ) { - long nNoteWidth = (long)( SC_CLIPMARK_SIZE * mnPPTX ); - long nNoteHeight = (long)( SC_CLIPMARK_SIZE * mnPPTY ); + long nNoteWidth = static_cast<long>( SC_CLIPMARK_SIZE * mnPPTX ); + long nNoteHeight = static_cast<long>( SC_CLIPMARK_SIZE * mnPPTY ); long nMarkX = nPosX + ( pRowInfo[0].pCellInfo[nX+1].nWidth - nNoteWidth ) * nLayoutSign; if ( bIsMerged || pInfo->bMerged ) @@ -2352,26 +2352,26 @@ void ScOutputData::DrawClipMarks() nOverX, nOverY, nTab, ATTR_MERGE_FLAG ))->GetValue() & ScMF::Hor ) ) { --nOverX; - nStartPosX -= nLayoutSign * (long) ( mpDoc->GetColWidth(nOverX,nTab) * mnPPTX ); + nStartPosX -= nLayoutSign * static_cast<long>( mpDoc->GetColWidth(nOverX,nTab) * mnPPTX ); } while ( nOverY > 0 && ( static_cast<const ScMergeFlagAttr*>(mpDoc->GetAttr( nOverX, nOverY, nTab, ATTR_MERGE_FLAG ))->GetValue() & ScMF::Ver ) ) { --nOverY; - nStartPosY -= nLayoutSign * (long) ( mpDoc->GetRowHeight(nOverY,nTab) * mnPPTY ); + nStartPosY -= nLayoutSign * static_cast<long>( mpDoc->GetRowHeight(nOverY,nTab) * mnPPTY ); } - long nOutWidth = (long) ( mpDoc->GetColWidth(nOverX,nTab) * mnPPTX ); - long nOutHeight = (long) ( mpDoc->GetRowHeight(nOverY,nTab) * mnPPTY ); + long nOutWidth = static_cast<long>( mpDoc->GetColWidth(nOverX,nTab) * mnPPTX ); + long nOutHeight = static_cast<long>( mpDoc->GetRowHeight(nOverY,nTab) * mnPPTY ); const ScMergeAttr* pMerge = static_cast<const ScMergeAttr*>( mpDoc->GetAttr( nOverX, nOverY, nTab, ATTR_MERGE )); SCCOL nCountX = pMerge->GetColMerge(); for (SCCOL i=1; i<nCountX; i++) - nOutWidth += (long) ( mpDoc->GetColWidth(nOverX+i,nTab) * mnPPTX ); + nOutWidth += static_cast<long>( mpDoc->GetColWidth(nOverX+i,nTab) * mnPPTX ); SCROW nCountY = pMerge->GetRowMerge(); - nOutHeight += (long) mpDoc->GetScaledRowHeight( nOverY+1, nOverY+nCountY-1, nTab, mnPPTY); + nOutHeight += static_cast<long>(mpDoc->GetScaledRowHeight( nOverY+1, nOverY+nCountY-1, nTab, mnPPTY)); if ( bLayoutRTL ) nStartPosX -= nOutWidth - 1; @@ -2390,9 +2390,9 @@ void ScOutputData::DrawClipMarks() &pInfo->pPatternAttr->GetItem(ATTR_MERGE); SCCOL nCountX = pMerge->GetColMerge(); for (SCCOL i=1; i<nCountX; i++) - nOutWidth += (long) ( mpDoc->GetColWidth(nOverX+i,nTab) * mnPPTX ); + nOutWidth += static_cast<long>( mpDoc->GetColWidth(nOverX+i,nTab) * mnPPTX ); SCROW nCountY = pMerge->GetRowMerge(); - nOutHeight += (long) mpDoc->GetScaledRowHeight( nOverY+1, nOverY+nCountY-1, nTab, mnPPTY); + nOutHeight += static_cast<long>(mpDoc->GetScaledRowHeight( nOverY+1, nOverY+nCountY-1, nTab, mnPPTY)); } long nStartPosX = nPosX; @@ -2409,7 +2409,7 @@ void ScOutputData::DrawClipMarks() else aCellRect.Right() -= 1; - long nMarkPixel = (long)( SC_CLIPMARK_SIZE * mnPPTX ); + long nMarkPixel = static_cast<long>( SC_CLIPMARK_SIZE * mnPPTX ); Size aMarkSize( nMarkPixel, (nMarkPixel-1)*2 ); if ( pInfo->nClipMark & ( bLayoutRTL ? ScClipMark::Right : ScClipMark::Left ) ) diff --git a/sc/source/ui/view/output2.cxx b/sc/source/ui/view/output2.cxx index 9e0d761e64d8..c4d47392f141 100644 --- a/sc/source/ui/view/output2.cxx +++ b/sc/source/ui/view/output2.cxx @@ -700,7 +700,7 @@ void ScDrawStringsVars::SetAutoText( const OUString& rAutoText ) if ( !pRefDevice->GetConnectMetaFile() || pRefDevice->GetOutDevType() == OUTDEV_PRINTER ) { double fMul = pOutput->GetStretch(); - aTextSize.Width() = (long)(aTextSize.Width() / fMul + 0.5); + aTextSize.Width() = static_cast<long>(aTextSize.Width() / fMul + 0.5); } aTextSize.Height() = aMetric.GetAscent() + aMetric.GetDescent(); @@ -770,7 +770,7 @@ void ScDrawStringsVars::TextChanged() if ( !pRefDevice->GetConnectMetaFile() || pRefDevice->GetOutDevType() == OUTDEV_PRINTER ) { double fMul = pOutput->GetStretch(); - aTextSize.Width() = (long)(aTextSize.Width() / fMul + 0.5); + aTextSize.Width() = static_cast<long>(aTextSize.Width() / fMul + 0.5); } aTextSize.Height() = aMetric.GetAscent() + aMetric.GetDescent(); @@ -825,12 +825,12 @@ double ScOutputData::GetStretch() if ( mpRefDevice == pFmtDevice ) { MapMode aOld = mpRefDevice->GetMapMode(); - return ((double)aOld.GetScaleY()) / ((double)aOld.GetScaleX()) * ((double)aZoomY) / ((double)aZoomX); + return static_cast<double>(aOld.GetScaleY()) / static_cast<double>(aOld.GetScaleX()) * static_cast<double>(aZoomY) / static_cast<double>(aZoomX); } else { // when formatting for printer, device map mode has already been taken care of - return ((double)aZoomY) / ((double)aZoomX); + return static_cast<double>(aZoomY) / static_cast<double>(aZoomX); } } @@ -1168,7 +1168,7 @@ void ScOutputData::GetOutputArea( SCCOL nX, SCSIZE nArrY, long nPosX, long nPosY //! extra member function for width? long nColWidth = ( nCompCol <= nX2 ) ? pRowInfo[0].pCellInfo[nCompCol+1].nWidth : - (long) ( mpDoc->GetColWidth( nCompCol, nTab ) * mnPPTX ); + static_cast<long>( mpDoc->GetColWidth( nCompCol, nTab ) * mnPPTX ); nCellPosX += nColWidth * nLayoutSign; ++nCompCol; } @@ -1177,7 +1177,7 @@ void ScOutputData::GetOutputArea( SCCOL nX, SCSIZE nArrY, long nPosX, long nPosY --nCompCol; long nColWidth = ( nCompCol <= nX2 ) ? pRowInfo[0].pCellInfo[nCompCol+1].nWidth : - (long) ( mpDoc->GetColWidth( nCompCol, nTab ) * mnPPTX ); + static_cast<long>( mpDoc->GetColWidth( nCompCol, nTab ) * mnPPTX ); nCellPosX -= nColWidth * nLayoutSign; } @@ -1196,11 +1196,11 @@ void ScOutputData::GetOutputArea( SCCOL nX, SCSIZE nArrY, long nPosX, long nPosY { sal_uInt16 nDocHeight = mpDoc->GetRowHeight( nCompRow, nTab ); if ( nDocHeight ) - nCellPosY += (long) ( nDocHeight * mnPPTY ); + nCellPosY += static_cast<long>( nDocHeight * mnPPTY ); ++nCompRow; } } - nCellPosY -= (long) mpDoc->GetScaledRowHeight( nCellY, nCompRow-1, nTab, mnPPTY ); + nCellPosY -= static_cast<long>(mpDoc->GetScaledRowHeight( nCellY, nCompRow-1, nTab, mnPPTY )); const ScMergeAttr* pMerge = &rPattern.GetItem( ATTR_MERGE ); bool bMerged = pMerge->IsMerged(); @@ -1216,7 +1216,7 @@ void ScOutputData::GetOutputArea( SCCOL nX, SCSIZE nArrY, long nPosX, long nPosY { long nColWidth = ( nCellX+i <= nX2 ) ? pRowInfo[0].pCellInfo[nCellX+i+1].nWidth : - (long) ( mpDoc->GetColWidth( sal::static_int_cast<SCCOL>(nCellX+i), nTab ) * mnPPTX ); + static_cast<long>( mpDoc->GetColWidth( sal::static_int_cast<SCCOL>(nCellX+i), nTab ) * mnPPTX ); nMergeSizeX += nColWidth; } long nMergeSizeY = 0; @@ -1228,7 +1228,7 @@ void ScOutputData::GetOutputArea( SCCOL nX, SCSIZE nArrY, long nPosX, long nPosY nDirect = 1; // skip in loop } // following rows always from document - nMergeSizeY += (long) mpDoc->GetScaledRowHeight( nCellY+nDirect, nCellY+nMergeRows-1, nTab, mnPPTY); + nMergeSizeY += static_cast<long>(mpDoc->GetScaledRowHeight( nCellY+nDirect, nCellY+nMergeRows-1, nTab, mnPPTY)); --nMergeSizeX; // leave out the grid horizontally, also for alignment (align between grid lines) @@ -1286,7 +1286,7 @@ void ScOutputData::GetOutputArea( SCCOL nX, SCSIZE nArrY, long nPosX, long nPosY while ( nRightMissing > 0 && nRightX < MAXCOL && ( bOverwrite || IsAvailable( nRightX+1, nCellY ) ) ) { ++nRightX; - long nAdd = (long) ( mpDoc->GetColWidth( nRightX, nTab ) * mnPPTX ); + long nAdd = static_cast<long>( mpDoc->GetColWidth( nRightX, nTab ) * mnPPTX ); nRightMissing -= nAdd; rParam.maClipRect.Right() += nAdd * nLayoutSign; @@ -1300,7 +1300,7 @@ void ScOutputData::GetOutputArea( SCCOL nX, SCSIZE nArrY, long nPosX, long nPosY rThisRowInfo.pCellInfo[nLeftX].bHideGrid = true; --nLeftX; - long nAdd = (long) ( mpDoc->GetColWidth( nLeftX, nTab ) * mnPPTX ); + long nAdd = static_cast<long>( mpDoc->GetColWidth( nLeftX, nTab ) * mnPPTX ); nLeftMissing -= nAdd; rParam.maClipRect.Left() -= nAdd * nLayoutSign; } @@ -1312,14 +1312,14 @@ void ScOutputData::GetOutputArea( SCCOL nX, SCSIZE nArrY, long nPosX, long nPosY { rThisRowInfo.pCellInfo[nRightX+1].nClipMark |= ScClipMark::Right; bAnyClipped = true; - long nMarkPixel = (long)( SC_CLIPMARK_SIZE * mnPPTX ); + long nMarkPixel = static_cast<long>( SC_CLIPMARK_SIZE * mnPPTX ); rParam.maClipRect.Right() -= nMarkPixel * nLayoutSign; } if ( nLeftMissing > 0 && bMarkClipped && nLeftX >= nX1 && nLeftX <= nX2 && !bBreak && !bCellIsValue ) { rThisRowInfo.pCellInfo[nLeftX+1].nClipMark |= ScClipMark::Left; bAnyClipped = true; - long nMarkPixel = (long)( SC_CLIPMARK_SIZE * mnPPTX ); + long nMarkPixel = static_cast<long>( SC_CLIPMARK_SIZE * mnPPTX ); rParam.maClipRect.Left() += nMarkPixel * nLayoutSign; } @@ -1802,8 +1802,8 @@ tools::Rectangle ScOutputData::LayoutStrings(bool bPixelToLogic, bool bPaint, co else { long nHeight = aVars.GetTextSize().Height() + - (long)(aVars.GetMargin()->GetTopMargin()*mnPPTY) + - (long)(aVars.GetMargin()->GetBottomMargin()*mnPPTY); + static_cast<long>(aVars.GetMargin()->GetTopMargin()*mnPPTY) + + static_cast<long>(aVars.GetMargin()->GetBottomMargin()*mnPPTY); bNeedEdit = ( nHeight > aAreaParam.maClipRect.GetHeight() ); } } @@ -1835,8 +1835,8 @@ tools::Rectangle ScOutputData::LayoutStrings(bool bPixelToLogic, bool bPaint, co aVars.SetTextToWidthOrHash(aCell, aAreaParam.mnColWidth - nTotalMargin); nNeededWidth = aVars.GetTextSize().Width() + - (long) ( aVars.GetLeftTotal() * mnPPTX ) + - (long) ( aVars.GetMargin()->GetRightMargin() * mnPPTX ); + static_cast<long>( aVars.GetLeftTotal() * mnPPTX ) + + static_cast<long>( aVars.GetMargin()->GetRightMargin() * mnPPTX ); if ( nNeededWidth <= aAreaParam.maClipRect.GetWidth() ) { // Cell value is no longer clipped. Reset relevant parameters. @@ -1867,17 +1867,17 @@ tools::Rectangle ScOutputData::LayoutStrings(bool bPixelToLogic, bool bPaint, co switch (eOutHorJust) { case SvxCellHorJustify::Left: - nJustPosX += (long) ( aVars.GetLeftTotal() * mnPPTX ); + nJustPosX += static_cast<long>( aVars.GetLeftTotal() * mnPPTX ); break; case SvxCellHorJustify::Right: nJustPosX += nAvailWidth - aVars.GetTextSize().Width() - - (long) ( aVars.GetRightTotal() * mnPPTX ); + static_cast<long>( aVars.GetRightTotal() * mnPPTX ); bRightAdjusted = true; break; case SvxCellHorJustify::Center: nJustPosX += ( nAvailWidth - aVars.GetTextSize().Width() + - (long) ( aVars.GetLeftTotal() * mnPPTX ) - - (long) ( aVars.GetMargin()->GetRightMargin() * mnPPTX ) ) / 2; + static_cast<long>( aVars.GetLeftTotal() * mnPPTX ) - + static_cast<long>( aVars.GetMargin()->GetRightMargin() * mnPPTX ) ) / 2; break; default: { @@ -1891,22 +1891,22 @@ tools::Rectangle ScOutputData::LayoutStrings(bool bPixelToLogic, bool bPaint, co case SvxCellVerJustify::Top: case SvxCellVerJustify::Block: { - long nTop = (long)( aVars.GetMargin()->GetTopMargin() * mnPPTY ); + long nTop = static_cast<long>( aVars.GetMargin()->GetTopMargin() * mnPPTY ); nJustPosY += nTop; nTestClipHeight += nTop; } break; case SvxCellVerJustify::Bottom: { - long nBot = (long)( aVars.GetMargin()->GetBottomMargin() * mnPPTY ); + long nBot = static_cast<long>( aVars.GetMargin()->GetBottomMargin() * mnPPTY ); nJustPosY += nOutHeight - aVars.GetTextSize().Height() - nBot; nTestClipHeight += nBot; } break; case SvxCellVerJustify::Center: { - long nTop = (long)( aVars.GetMargin()->GetTopMargin() * mnPPTY ); - long nBot = (long)( aVars.GetMargin()->GetBottomMargin() * mnPPTY ); + long nTop = static_cast<long>( aVars.GetMargin()->GetTopMargin() * mnPPTY ); + long nBot = static_cast<long>( aVars.GetMargin()->GetBottomMargin() * mnPPTY ); nJustPosY += ( nOutHeight + nTop - aVars.GetTextSize().Height() - nBot ) / 2; nTestClipHeight += std::abs( nTop - nBot ); @@ -2208,7 +2208,7 @@ static long lcl_GetEditSize( EditEngine& rEngine, bool bWidth, bool bSwap, long if ( nAttrRotate ) { - long nRealWidth = (long) rEngine.CalcTextWidth(); + long nRealWidth = static_cast<long>(rEngine.CalcTextWidth()); long nRealHeight = rEngine.GetTextHeight(); // assuming standard mode, otherwise width isn't used @@ -2217,12 +2217,12 @@ static long lcl_GetEditSize( EditEngine& rEngine, bool bWidth, bool bSwap, long double nAbsCos = fabs( cos( nRealOrient ) ); double nAbsSin = fabs( sin( nRealOrient ) ); if ( bWidth ) - return (long) ( nRealWidth * nAbsCos + nRealHeight * nAbsSin ); + return static_cast<long>( nRealWidth * nAbsCos + nRealHeight * nAbsSin ); else - return (long) ( nRealHeight * nAbsCos + nRealWidth * nAbsSin ); + return static_cast<long>( nRealHeight * nAbsCos + nRealWidth * nAbsSin ); } else if ( bWidth ) - return (long) rEngine.CalcTextWidth(); + return static_cast<long>(rEngine.CalcTextWidth()); else return rEngine.GetTextHeight(); } @@ -2707,7 +2707,7 @@ void ScOutputData::DrawEditParam::adjustForHyperlinkInPDF(Point aURLStart, const if (!bHasURL) return; - long nURLWidth = (long) mpEngine->CalcTextWidth(); + long nURLWidth = static_cast<long>(mpEngine->CalcTextWidth()); long nURLHeight = mpEngine->GetTextHeight(); if (mbBreak) { @@ -3081,7 +3081,7 @@ void ScOutputData::DrawEditStandard(DrawEditParam& rParam) pClipMarkCell->nClipMark |= ScClipMark::Right; //! also allow left? bAnyClipped = true; - long nMarkPixel = (long)( SC_CLIPMARK_SIZE * mnPPTX ); + long nMarkPixel = static_cast<long>( SC_CLIPMARK_SIZE * mnPPTX ); if ( aAreaParam.maClipRect.Right() - nMarkPixel > aAreaParam.maClipRect.Left() ) aAreaParam.maClipRect.Right() -= nMarkPixel; } @@ -3919,7 +3919,7 @@ void ScOutputData::DrawEditStacked(DrawEditParam& rParam) pClipMarkCell->nClipMark |= ScClipMark::Right; //! also allow left? bAnyClipped = true; - long nMarkPixel = (long)( SC_CLIPMARK_SIZE * mnPPTX ); + long nMarkPixel = static_cast<long>( SC_CLIPMARK_SIZE * mnPPTX ); if ( aAreaParam.maClipRect.Right() - nMarkPixel > aAreaParam.maClipRect.Left() ) aAreaParam.maClipRect.Right() -= nMarkPixel; } @@ -4208,7 +4208,7 @@ void ScOutputData::DrawEditAsianVertical(DrawEditParam& rParam) pClipMarkCell->nClipMark |= ScClipMark::Right; //! also allow left? bAnyClipped = true; - long nMarkPixel = (long)( SC_CLIPMARK_SIZE * mnPPTX ); + long nMarkPixel = static_cast<long>( SC_CLIPMARK_SIZE * mnPPTX ); if ( aAreaParam.maClipRect.Right() - nMarkPixel > aAreaParam.maClipRect.Left() ) aAreaParam.maClipRect.Right() -= nMarkPixel; } @@ -4486,7 +4486,7 @@ void ScOutputData::DrawRotated(bool bPixelToLogic) for (SCSIZE nArrY=0; nArrY+1<nArrCount; nArrY++) // 0 for the rest of the merged { RowInfo* pThisRowInfo = &pRowInfo[nArrY]; - long nCellHeight = (long) pThisRowInfo->nHeight; + long nCellHeight = static_cast<long>(pThisRowInfo->nHeight); if (nArrY==1) nRowPosY = nScrY; // positions before are calculated individually if ( ( pThisRowInfo->bChanged || nArrY==0 ) && pThisRowInfo->nRotMaxCol != SC_ROTMAX_NONE ) @@ -4535,7 +4535,7 @@ void ScOutputData::DrawRotated(bool bPixelToLogic) if (aCell.isEmpty() || IsEmptyCellText(pThisRowInfo, nX, nY)) bHidden = true; // nRotateDir is also set without a cell - long nCellWidth = (long) pRowInfo[0].pCellInfo[nX+1].nWidth; + long nCellWidth = static_cast<long>(pRowInfo[0].pCellInfo[nX+1].nWidth); SvxCellHorJustify eHorJust = pPattern->GetItem(ATTR_HOR_JUSTIFY, pCondSet).GetValue(); @@ -4562,7 +4562,7 @@ void ScOutputData::DrawRotated(bool bPixelToLogic) while (nCol > nX) { --nCol; - nStartX -= nLayoutSign * (long) pRowInfo[0].pCellInfo[nCol+1].nWidth; + nStartX -= nLayoutSign * static_cast<long>(pRowInfo[0].pCellInfo[nCol+1].nWidth); } } } @@ -4579,9 +4579,9 @@ void ScOutputData::DrawRotated(bool bPixelToLogic) { SCCOL nCountX = pMerge->GetColMerge(); for (SCCOL i=1; i<nCountX; i++) - nOutWidth += (long) ( mpDoc->GetColWidth(nX+i,nTab) * mnPPTX ); + nOutWidth += static_cast<long>( mpDoc->GetColWidth(nX+i,nTab) * mnPPTX ); SCROW nCountY = pMerge->GetRowMerge(); - nOutHeight += (long) mpDoc->GetScaledRowHeight( nY+1, nY+nCountY-1, nTab, mnPPTY); + nOutHeight += static_cast<long>(mpDoc->GetScaledRowHeight( nY+1, nY+nCountY-1, nTab, mnPPTY)); } SvxCellVerJustify eVerJust = @@ -4642,10 +4642,10 @@ void ScOutputData::DrawRotated(bool bPixelToLogic) if ( bPixelToLogic ) nTotalHeight = mpRefDevice->PixelToLogic(Size(0,nTotalHeight)).Height(); - long nLeftM = (long) ( (pMargin->GetLeftMargin() + nIndent) * mnPPTX ); - long nTopM = (long) ( pMargin->GetTopMargin() * mnPPTY ); - long nRightM = (long) ( pMargin->GetRightMargin() * mnPPTX ); - long nBottomM = (long) ( pMargin->GetBottomMargin() * mnPPTY ); + long nLeftM = static_cast<long>( (pMargin->GetLeftMargin() + nIndent) * mnPPTX ); + long nTopM = static_cast<long>( pMargin->GetTopMargin() * mnPPTY ); + long nRightM = static_cast<long>( pMargin->GetRightMargin() * mnPPTX ); + long nBottomM = static_cast<long>( pMargin->GetBottomMargin() * mnPPTY ); nStartX += nLeftM; nStartY += nTopM; nOutWidth -= nLeftM + nRightM; @@ -4687,7 +4687,7 @@ void ScOutputData::DrawRotated(bool bPixelToLogic) //! of rows, as long as the rows can not be outputted individually //! offsetted -> therefore unlimited, so no wrapping. //! With offset rows the following would be correct: - aPaperSize.Width() = (long)(nOutHeight / fabs(nSin)); + aPaperSize.Width() = static_cast<long>(nOutHeight / fabs(nSin)); } else if (eOrient == SvxCellOrientation::Standard) aPaperSize.Width() = nOutWidth; @@ -4737,7 +4737,7 @@ void ScOutputData::DrawRotated(bool bPixelToLogic) pEngine->SetUpdateMode( true ); // after SetText, before CalcTextWidth/GetTextHeight - long nEngineWidth = (long) pEngine->CalcTextWidth(); + long nEngineWidth = static_cast<long>(pEngine->CalcTextWidth()); long nEngineHeight = pEngine->GetTextHeight(); if (nAttrRotate && bBreak) @@ -4752,8 +4752,8 @@ void ScOutputData::DrawRotated(bool bPixelToLogic) // everything is in pixels long nEnginePixel = mpRefDevice->LogicToPixel( Size(0,nEngineHeight)).Height(); - long nEffHeight = nOutHeight - (long)(nEnginePixel * nAbsCos) + 2; - long nNewWidth = (long)(nEffHeight / nAbsSin) + 2; + long nEffHeight = nOutHeight - static_cast<long>(nEnginePixel * nAbsCos) + 2; + long nNewWidth = static_cast<long>(nEffHeight / nAbsSin) + 2; bool bFits = ( nNewWidth >= aPaperSize.Width() ); if ( bFits ) nSteps = 0; @@ -4763,7 +4763,7 @@ void ScOutputData::DrawRotated(bool bPixelToLogic) { // can't fit -> fall back to using half height nEffHeight = nOutHeight / 2; - nNewWidth = (long)(nEffHeight / nAbsSin) + 2; + nNewWidth = static_cast<long>(nEffHeight / nAbsSin) + 2; nSteps = 0; } else @@ -4777,7 +4777,7 @@ void ScOutputData::DrawRotated(bool bPixelToLogic) pEngine->SetPaperSize(aPaperSize); // Scale is always 1 //pEngine->QuickFormatDoc( sal_True ); - nEngineWidth = (long) pEngine->CalcTextWidth(); + nEngineWidth = static_cast<long>(pEngine->CalcTextWidth()); nEngineHeight = pEngine->GetTextHeight(); } } @@ -4793,13 +4793,13 @@ void ScOutputData::DrawRotated(bool bPixelToLogic) double nAbsSin = fabs( nSin ); if ( eRotMode == SVX_ROTATE_MODE_STANDARD ) - nEngineWidth = (long) ( nRealWidth * nAbsCos + + nEngineWidth = static_cast<long>( nRealWidth * nAbsCos + nRealHeight * nAbsSin ); else - nEngineWidth = (long) ( nRealHeight / nAbsSin ); + nEngineWidth = static_cast<long>( nRealHeight / nAbsSin ); //! limit !!! - nEngineHeight = (long) ( nRealHeight * nAbsCos + + nEngineHeight = static_cast<long>( nRealHeight * nAbsCos + nRealWidth * nAbsSin ); } @@ -4825,7 +4825,7 @@ void ScOutputData::DrawRotated(bool bPixelToLogic) if ( eRotMode != SVX_ROTATE_MODE_STANDARD ) { nGridWidth = aCellSize.Width() + - std::abs((long) ( aCellSize.Height() * nCos / nSin )); + std::abs(static_cast<long>( aCellSize.Height() * nCos / nSin )); bNegative = ( pInfo->nRotateDir == ScRotateDir::Left ); if ( bLayoutRTL ) bNegative = !bNegative; @@ -4871,11 +4871,11 @@ void ScOutputData::DrawRotated(bool bPixelToLogic) // nEngineWidth/nEngineHeight is updated in ShrinkEditEngine // (but width is only valid for standard mode) - nRealWidth = (long) pEngine->CalcTextWidth(); + nRealWidth = static_cast<long>(pEngine->CalcTextWidth()); nRealHeight = pEngine->GetTextHeight(); if ( eRotMode != SVX_ROTATE_MODE_STANDARD ) - nEngineWidth = (long) ( nRealHeight / fabs( nSin ) ); + nEngineWidth = static_cast<long>( nRealHeight / fabs( nSin ) ); } long nClipStartX = nStartX; @@ -5070,8 +5070,8 @@ void ScOutputData::DrawRotated(bool bPixelToLogic) nAddX += ( nUp * nCos / fabs(nSin) ); } - aLogicStart.X() += (long) nAddX; - aLogicStart.Y() += (long) nAddY; + aLogicStart.X() += static_cast<long>(nAddX); + aLogicStart.Y() += static_cast<long>(nAddY); } // bSimClip is not used here (because nOriVal is set) @@ -5089,7 +5089,7 @@ void ScOutputData::DrawRotated(bool bPixelToLogic) } } - pEngine->Draw( mpDev, aLogicStart, (short)nOriVal ); + pEngine->Draw( mpDev, aLogicStart, static_cast<short>(nOriVal) ); if (bMetaFile) mpDev->Pop(); diff --git a/sc/source/ui/view/output3.cxx b/sc/source/ui/view/output3.cxx index 9cb20ad3c1ad..37da03f697b8 100644 --- a/sc/source/ui/view/output3.cxx +++ b/sc/source/ui/view/output3.cxx @@ -58,8 +58,8 @@ Point ScOutputData::PrePrintDrawingLayer(long nLogStX, long nLogStY ) aRect.Top() = aRect.Bottom() = -aOffset.Y(); Point aMMOffset( aOffset ); - aMMOffset.X() = (long)(aMMOffset.X() * HMM_PER_TWIPS); - aMMOffset.Y() = (long)(aMMOffset.Y() * HMM_PER_TWIPS); + aMMOffset.X() = static_cast<long>(aMMOffset.X() * HMM_PER_TWIPS); + aMMOffset.Y() = static_cast<long>(aMMOffset.Y() * HMM_PER_TWIPS); if (!bMetaFile) aMMOffset += Point( nLogStX, nLogStY ); @@ -68,10 +68,10 @@ Point ScOutputData::PrePrintDrawingLayer(long nLogStX, long nLogStY ) aRect.Right() += mpDoc->GetColWidth( nCol, nTab ); aRect.Bottom() += mpDoc->GetRowHeight( nY1, nY2, nTab ); - aRect.Left() = (long) (aRect.Left() * HMM_PER_TWIPS); - aRect.Top() = (long) (aRect.Top() * HMM_PER_TWIPS); - aRect.Right() = (long) (aRect.Right() * HMM_PER_TWIPS); - aRect.Bottom() = (long) (aRect.Bottom() * HMM_PER_TWIPS); + aRect.Left() = static_cast<long>(aRect.Left() * HMM_PER_TWIPS); + aRect.Top() = static_cast<long>(aRect.Top() * HMM_PER_TWIPS); + aRect.Right() = static_cast<long>(aRect.Right() * HMM_PER_TWIPS); + aRect.Bottom() = static_cast<long>(aRect.Bottom() * HMM_PER_TWIPS); if(pViewShell || pDrawView) { diff --git a/sc/source/ui/view/preview.cxx b/sc/source/ui/view/preview.cxx index 86c6821623c1..8fa2d8e3bd0b 100644 --- a/sc/source/ui/view/preview.cxx +++ b/sc/source/ui/view/preview.cxx @@ -351,7 +351,7 @@ void ScPreview::DoPrint( ScPreviewLocationData* pFillLocation ) } Fraction aPreviewZoom( nZoom, 100 ); - Fraction aHorPrevZoom( (long)( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 ); + Fraction aHorPrevZoom( static_cast<long>( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 ); MapMode aMMMode( MapUnit::Map100thMM, Point(), aHorPrevZoom, aPreviewZoom ); bool bDoPrint = ( pFillLocation == nullptr ); @@ -460,15 +460,15 @@ void ScPreview::DoPrint( ScPreviewLocationData* pFillLocation ) if (nPrinted) // if not, draw everything grey { aLocalPageSize = pPrintFunc->GetPageSize(); - aLocalPageSize.Width() = (long) (aLocalPageSize.Width() * HMM_PER_TWIPS ); - aLocalPageSize.Height() = (long) (aLocalPageSize.Height() * HMM_PER_TWIPS ); - - nLeftMargin = (long) ( nLeftMargin * HMM_PER_TWIPS ); - nRightMargin = (long) ( nRightMargin * HMM_PER_TWIPS ); - nTopMargin = (long) ( nTopMargin * HMM_PER_TWIPS ); - nBottomMargin = (long) ( nBottomMargin * HMM_PER_TWIPS ); - nHeaderHeight = (long) ( nHeaderHeight * HMM_PER_TWIPS * mnScale / 100 + nTopMargin ); - nFooterHeight = (long) ( nFooterHeight * HMM_PER_TWIPS * mnScale / 100 + nBottomMargin ); + aLocalPageSize.Width() = static_cast<long>(aLocalPageSize.Width() * HMM_PER_TWIPS ); + aLocalPageSize.Height() = static_cast<long>(aLocalPageSize.Height() * HMM_PER_TWIPS ); + + nLeftMargin = static_cast<long>( nLeftMargin * HMM_PER_TWIPS ); + nRightMargin = static_cast<long>( nRightMargin * HMM_PER_TWIPS ); + nTopMargin = static_cast<long>( nTopMargin * HMM_PER_TWIPS ); + nBottomMargin = static_cast<long>( nBottomMargin * HMM_PER_TWIPS ); + nHeaderHeight = static_cast<long>( nHeaderHeight * HMM_PER_TWIPS * mnScale / 100 + nTopMargin ); + nFooterHeight = static_cast<long>( nFooterHeight * HMM_PER_TWIPS * mnScale / 100 + nBottomMargin ); } if (!bStateValid) @@ -543,10 +543,10 @@ void ScPreview::DoPrint( ScPreviewLocationData* pFillLocation ) { SetMapMode(aMMMode); SetLineColor( COL_BLACK ); - DrawInvert( (long)( nTopMargin - aOffset.Y() ), PointerStyle::VSizeBar ); - DrawInvert( (long)(nPageEndY - nBottomMargin ), PointerStyle::VSizeBar ); - DrawInvert( (long)( nLeftMargin - aOffset.X() ), PointerStyle::HSizeBar ); - DrawInvert( (long)( nPageEndX - nRightMargin ) , PointerStyle::HSizeBar ); + DrawInvert( static_cast<long>( nTopMargin - aOffset.Y() ), PointerStyle::VSizeBar ); + DrawInvert( static_cast<long>(nPageEndY - nBottomMargin ), PointerStyle::VSizeBar ); + DrawInvert( static_cast<long>( nLeftMargin - aOffset.X() ), PointerStyle::HSizeBar ); + DrawInvert( static_cast<long>( nPageEndX - nRightMargin ) , PointerStyle::HSizeBar ); if( bHeaderOn ) { DrawInvert( nHeaderHeight - aOffset.Y(), PointerStyle::VSizeBar ); @@ -738,7 +738,7 @@ void ScPreview::SetZoom(sal_uInt16 nNewZoom) // apply new MapMode and call UpdateScrollBars to update aOffset Fraction aPreviewZoom( nZoom, 100 ); - Fraction aHorPrevZoom( (long)( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 ); + Fraction aHorPrevZoom( static_cast<long>( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 ); MapMode aMMMode( MapUnit::Map100thMM, Point(), aHorPrevZoom, aPreviewZoom ); SetMapMode( aMMMode ); @@ -821,8 +821,8 @@ sal_uInt16 ScPreview::GetOptimalZoom(bool bWidthOnly) Size aLocalPageSize = lcl_GetDocPageSize( &pDocShell->GetDocument(), nTab ); if ( aLocalPageSize.Width() && aLocalPageSize.Height() ) { - long nZoomX = (long) ( aWinSize.Width() * 100 / ( aLocalPageSize.Width() * nWinScaleX )); - long nZoomY = (long) ( aWinSize.Height() * 100 / ( aLocalPageSize.Height() * nWinScaleY )); + long nZoomX = static_cast<long>( aWinSize.Width() * 100 / ( aLocalPageSize.Width() * nWinScaleX )); + long nZoomY = static_cast<long>( aWinSize.Height() * 100 / ( aLocalPageSize.Height() * nWinScaleY )); long nOptimal = nZoomX; if (!bWidthOnly && nZoomY<nOptimal) @@ -833,7 +833,7 @@ sal_uInt16 ScPreview::GetOptimalZoom(bool bWidthOnly) if (nOptimal>400) nOptimal = 400; - return (sal_uInt16) nOptimal; + return static_cast<sal_uInt16>(nOptimal); } else return nZoom; @@ -966,7 +966,7 @@ void ScPreview::DataChanged( const DataChangedEvent& rDCEvt ) void ScPreview::MouseButtonDown( const MouseEvent& rMEvt ) { Fraction aPreviewZoom( nZoom, 100 ); - Fraction aHorPrevZoom( (long)( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 ); + Fraction aHorPrevZoom( static_cast<long>( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 ); MapMode aMMMode( MapUnit::Map100thMM, Point(), aHorPrevZoom, aPreviewZoom ); aButtonDownChangePoint = PixelToLogic( rMEvt.GetPosPixel(),aMMMode ); @@ -1049,7 +1049,7 @@ void ScPreview::MouseButtonDown( const MouseEvent& rMEvt ) void ScPreview::MouseButtonUp( const MouseEvent& rMEvt ) { Fraction aPreviewZoom( nZoom, 100 ); - Fraction aHorPrevZoom( (long)( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 ); + Fraction aHorPrevZoom( static_cast<long>( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 ); MapMode aMMMode( MapUnit::Map100thMM, Point(), aHorPrevZoom, aPreviewZoom ); aButtonUpPt = PixelToLogic( rMEvt.GetPosPixel(),aMMMode ); @@ -1103,13 +1103,13 @@ void ScPreview::MouseButtonUp( const MouseEvent& rMEvt ) ScDocShellModificator aModificator( *pDocShell ); if( bLeftRulerChange && bLeftRulerMove ) { - aLRItem.SetLeft( (long)( aButtonUpPt.X() / HMM_PER_TWIPS + aOffset.X() / HMM_PER_TWIPS )); + aLRItem.SetLeft( static_cast<long>( aButtonUpPt.X() / HMM_PER_TWIPS + aOffset.X() / HMM_PER_TWIPS )); rStyleSet.Put( aLRItem ); pDocShell->SetModified(); } else if( bRightRulerChange && bRightRulerMove ) { - aLRItem.SetRight( (long)( nWidth - aButtonUpPt.X() / HMM_PER_TWIPS - aOffset.X() / HMM_PER_TWIPS )); + aLRItem.SetRight( static_cast<long>( nWidth - aButtonUpPt.X() / HMM_PER_TWIPS - aOffset.X() / HMM_PER_TWIPS )); rStyleSet.Put( aLRItem ); pDocShell->SetModified(); } @@ -1175,13 +1175,13 @@ void ScPreview::MouseButtonUp( const MouseEvent& rMEvt ) if( bTopRulerMove && bTopRulerChange ) { - aULItem.SetUpperValue( (sal_uInt16)( aButtonUpPt.Y() / HMM_PER_TWIPS + aOffset.Y() / HMM_PER_TWIPS ) ); + aULItem.SetUpperValue( static_cast<sal_uInt16>( aButtonUpPt.Y() / HMM_PER_TWIPS + aOffset.Y() / HMM_PER_TWIPS ) ); rStyleSet.Put( aULItem ); pDocShell->SetModified(); } else if( bBottomRulerMove && bBottomRulerChange ) { - aULItem.SetLowerValue( (sal_uInt16)( nHeight - aButtonUpPt.Y() / HMM_PER_TWIPS - aOffset.Y() / HMM_PER_TWIPS ) ); + aULItem.SetLowerValue( static_cast<sal_uInt16>( nHeight - aButtonUpPt.Y() / HMM_PER_TWIPS - aOffset.Y() / HMM_PER_TWIPS ) ); rStyleSet.Put( aULItem ); pDocShell->SetModified(); } @@ -1192,7 +1192,7 @@ void ScPreview::MouseButtonUp( const MouseEvent& rMEvt ) { const SfxItemSet& rHeaderSet = static_cast<const SvxSetItem*>(pItem)->GetItemSet(); Size aHeaderSize = rHeaderSet.Get(ATTR_PAGE_SIZE).GetSize(); - aHeaderSize.Height() = (long)( aButtonUpPt.Y() / HMM_PER_TWIPS + aOffset.Y() / HMM_PER_TWIPS - aULItem.GetUpper()); + aHeaderSize.Height() = static_cast<long>( aButtonUpPt.Y() / HMM_PER_TWIPS + aOffset.Y() / HMM_PER_TWIPS - aULItem.GetUpper()); aHeaderSize.Height() = aHeaderSize.Height() * 100 / mnScale; SvxSetItem aNewHeader( rStyleSet.Get(ATTR_PAGE_HEADERSET) ); aNewHeader.GetItemSet().Put( SvxSizeItem( ATTR_PAGE_SIZE, aHeaderSize ) ); @@ -1207,7 +1207,7 @@ void ScPreview::MouseButtonUp( const MouseEvent& rMEvt ) { const SfxItemSet& rFooterSet = static_cast<const SvxSetItem*>(pItem)->GetItemSet(); Size aFooterSize = rFooterSet.Get(ATTR_PAGE_SIZE).GetSize(); - aFooterSize.Height() = (long)( nHeight - aButtonUpPt.Y() / HMM_PER_TWIPS - aOffset.Y() / HMM_PER_TWIPS - aULItem.GetLower() ); + aFooterSize.Height() = static_cast<long>( nHeight - aButtonUpPt.Y() / HMM_PER_TWIPS - aOffset.Y() / HMM_PER_TWIPS - aULItem.GetLower() ); aFooterSize.Height() = aFooterSize.Height() * 100 / mnScale; SvxSetItem aNewFooter( rStyleSet.Get(ATTR_PAGE_FOOTERSET) ); aNewFooter.GetItemSet().Put( SvxSizeItem( ATTR_PAGE_SIZE, aFooterSize ) ); @@ -1267,20 +1267,20 @@ void ScPreview::MouseButtonUp( const MouseEvent& rMEvt ) if( !bLayoutRTL ) { - nNewColWidth = (long) ( PixelToLogic( Point( rMEvt.GetPosPixel().X() - mvRight[ nColNumberButttonDown ], 0), aMMMode ).X() / HMM_PER_TWIPS ) * 100 / mnScale; + nNewColWidth = static_cast<long>( PixelToLogic( Point( rMEvt.GetPosPixel().X() - mvRight[ nColNumberButttonDown ], 0), aMMMode ).X() / HMM_PER_TWIPS ) * 100 / mnScale; nNewColWidth += pDocShell->GetDocument().GetColWidth( nColNumberButttonDown, nTab ); } else { - nNewColWidth = (long) ( PixelToLogic( Point( mvRight[ nColNumberButttonDown ] - rMEvt.GetPosPixel().X(), 0), aMMMode ).X() / HMM_PER_TWIPS ) * 100 / mnScale; + nNewColWidth = static_cast<long>( PixelToLogic( Point( mvRight[ nColNumberButttonDown ] - rMEvt.GetPosPixel().X(), 0), aMMMode ).X() / HMM_PER_TWIPS ) * 100 / mnScale; nNewColWidth += pDocShell->GetDocument().GetColWidth( nColNumberButttonDown, nTab ); } if( nNewColWidth >= 0 ) { pDocShell->GetDocFunc().SetWidthOrHeight( - true, aCols, nTab, SC_SIZE_DIRECT, (sal_uInt16)nNewColWidth, true, true); + true, aCols, nTab, SC_SIZE_DIRECT, static_cast<sal_uInt16>(nNewColWidth), true, true); pDocShell->SetModified(); } if ( ValidTab( nTab ) ) @@ -1299,7 +1299,7 @@ void ScPreview::MouseButtonUp( const MouseEvent& rMEvt ) void ScPreview::MouseMove( const MouseEvent& rMEvt ) { Fraction aPreviewZoom( nZoom, 100 ); - Fraction aHorPrevZoom( (long)( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 ); + Fraction aHorPrevZoom( static_cast<long>( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 ); MapMode aMMMode( MapUnit::Map100thMM, Point(), aHorPrevZoom, aPreviewZoom ); Point aMouseMovePoint = PixelToLogic( rMEvt.GetPosPixel(), aMMMode ); @@ -1322,31 +1322,31 @@ void ScPreview::MouseMove( const MouseEvent& rMEvt ) else pPrintFunc = new ScPrintFunc( this, pDocShell, nTab, nFirstAttr[nTab], nTotalPages, nullptr, &aOptions ); - nLeftMargin = (long)( pPrintFunc->GetLeftMargin() * HMM_PER_TWIPS - aOffset.X() ); - nRightMargin = (long)( pPrintFunc->GetRightMargin() * HMM_PER_TWIPS ); - nRightMargin = (long)( nWidth * HMM_PER_TWIPS - nRightMargin - aOffset.X() ); - nTopMargin = (long)( pPrintFunc->GetTopMargin() * HMM_PER_TWIPS - aOffset.Y() ); - nBottomMargin = (long)( pPrintFunc->GetBottomMargin() * HMM_PER_TWIPS ); - nBottomMargin = (long)( nHeight * HMM_PER_TWIPS - nBottomMargin - aOffset.Y() ); + nLeftMargin = static_cast<long>( pPrintFunc->GetLeftMargin() * HMM_PER_TWIPS - aOffset.X() ); + nRightMargin = static_cast<long>( pPrintFunc->GetRightMargin() * HMM_PER_TWIPS ); + nRightMargin = static_cast<long>( nWidth * HMM_PER_TWIPS - nRightMargin - aOffset.X() ); + nTopMargin = static_cast<long>( pPrintFunc->GetTopMargin() * HMM_PER_TWIPS - aOffset.Y() ); + nBottomMargin = static_cast<long>( pPrintFunc->GetBottomMargin() * HMM_PER_TWIPS ); + nBottomMargin = static_cast<long>( nHeight * HMM_PER_TWIPS - nBottomMargin - aOffset.Y() ); if( mnScale > 0 ) { - nHeaderHeight = (long)( nTopMargin + pPrintFunc->GetHeader().nHeight * HMM_PER_TWIPS * mnScale / 100 ); - nFooterHeight = (long)( nBottomMargin - pPrintFunc->GetFooter().nHeight * HMM_PER_TWIPS * mnScale / 100 ); + nHeaderHeight = static_cast<long>( nTopMargin + pPrintFunc->GetHeader().nHeight * HMM_PER_TWIPS * mnScale / 100 ); + nFooterHeight = static_cast<long>( nBottomMargin - pPrintFunc->GetFooter().nHeight * HMM_PER_TWIPS * mnScale / 100 ); } else { - nHeaderHeight = (long)( nTopMargin + pPrintFunc->GetHeader().nHeight * HMM_PER_TWIPS ); - nFooterHeight = (long)( nBottomMargin - pPrintFunc->GetFooter().nHeight * HMM_PER_TWIPS ); + nHeaderHeight = static_cast<long>( nTopMargin + pPrintFunc->GetHeader().nHeight * HMM_PER_TWIPS ); + nFooterHeight = static_cast<long>( nBottomMargin - pPrintFunc->GetFooter().nHeight * HMM_PER_TWIPS ); } delete pPrintFunc; } Point aPixPt( rMEvt.GetPosPixel() ); Point aLeftTop = LogicToPixel( Point( nLeftMargin, -aOffset.Y() ) , aMMMode ); - Point aLeftBottom = LogicToPixel( Point( nLeftMargin ,(long)(nHeight * HMM_PER_TWIPS - aOffset.Y()) ), aMMMode ); + Point aLeftBottom = LogicToPixel( Point( nLeftMargin ,static_cast<long>(nHeight * HMM_PER_TWIPS - aOffset.Y()) ), aMMMode ); Point aRightTop = LogicToPixel( Point( nRightMargin, -aOffset.Y() ), aMMMode ); Point aTopLeft = LogicToPixel( Point( -aOffset.X(), nTopMargin ), aMMMode ); - Point aTopRight = LogicToPixel( Point( (long)(nWidth * HMM_PER_TWIPS - aOffset.X()), nTopMargin ), aMMMode ); + Point aTopRight = LogicToPixel( Point( static_cast<long>(nWidth * HMM_PER_TWIPS - aOffset.X()), nTopMargin ), aMMMode ); Point aBottomLeft = LogicToPixel( Point( -aOffset.X(), nBottomMargin ), aMMMode ); Point aHeaderLeft = LogicToPixel( Point( -aOffset.X(), nHeaderHeight ), aMMMode ); Point aFooderLeft = LogicToPixel( Point( -aOffset.X(), nFooterHeight ), aMMMode ); @@ -1356,7 +1356,7 @@ void ScPreview::MouseMove( const MouseEvent& rMEvt ) for( SCCOL i=aPageArea.aStart.Col(); i<= aPageArea.aEnd.Col(); i++ ) { Point aColumnTop = LogicToPixel( Point( 0, -aOffset.Y() ) ,aMMMode ); - Point aColumnBottom = LogicToPixel( Point( 0, (long)( nHeight * HMM_PER_TWIPS - aOffset.Y()) ), aMMMode ); + Point aColumnBottom = LogicToPixel( Point( 0, static_cast<long>( nHeight * HMM_PER_TWIPS - aOffset.Y()) ), aMMMode ); long nRight = i < static_cast<SCCOL>(mvRight.size()) ? mvRight[i] : 0; if( aPixPt.X() < ( nRight + 2 ) && ( aPixPt.X() > ( nRight - 2 ) ) && ( aPixPt.X() < aRightTop.X() ) && ( aPixPt.X() > aLeftTop.X() ) && ( aPixPt.Y() > aColumnTop.Y() ) && ( aPixPt.Y() < aColumnBottom.Y() ) && !bLeftRulerMove && !bRightRulerMove @@ -1537,7 +1537,7 @@ css::uno::Reference<css::accessibility::XAccessible> ScPreview::CreateAccessible void ScPreview::DragMove( long nDragMovePos, PointerStyle nFlags ) { Fraction aPreviewZoom( nZoom, 100 ); - Fraction aHorPrevZoom( (long)( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 ); + Fraction aHorPrevZoom( static_cast<long>( 100 * nZoom / pDocShell->GetOutputFactor() ), 10000 ); MapMode aMMMode( MapUnit::Map100thMM, Point(), aHorPrevZoom, aPreviewZoom ); SetMapMode( aMMMode ); long nPos = nDragMovePos; @@ -1567,12 +1567,12 @@ void ScPreview::DrawInvert( long nDragPos, PointerStyle nFlags ) long nWidth = lcl_GetDocPageSize( &pDocShell->GetDocument(), nTab ).Width(); if( nFlags == PointerStyle::HSizeBar || nFlags == PointerStyle::HSplit ) { - tools::Rectangle aRect( nDragPos, -aOffset.Y(), nDragPos + 1,(long)( ( nHeight * HMM_PER_TWIPS ) - aOffset.Y())); + tools::Rectangle aRect( nDragPos, -aOffset.Y(), nDragPos + 1,static_cast<long>( ( nHeight * HMM_PER_TWIPS ) - aOffset.Y())); Invert( aRect, InvertFlags::N50 ); } else if( nFlags == PointerStyle::VSizeBar ) { - tools::Rectangle aRect( -aOffset.X(), nDragPos,(long)( ( nWidth * HMM_PER_TWIPS ) - aOffset.X() ), nDragPos + 1 ); + tools::Rectangle aRect( -aOffset.X(), nDragPos,static_cast<long>( ( nWidth * HMM_PER_TWIPS ) - aOffset.X() ), nDragPos + 1 ); Invert( aRect, InvertFlags::N50 ); } } diff --git a/sc/source/ui/view/prevloc.cxx b/sc/source/ui/view/prevloc.cxx index cdcc83fcf6dd..4161242f5ff2 100644 --- a/sc/source/ui/view/prevloc.cxx +++ b/sc/source/ui/view/prevloc.cxx @@ -288,14 +288,14 @@ tools::Rectangle ScPreviewLocationData::GetOffsetPixel( const ScAddress& rCellPo { sal_uInt16 nDocW = pDoc->GetColWidth( nCol, nTab ); if (nDocW) - nPosX += (long) (nDocW * nScaleX); + nPosX += static_cast<long>(nDocW * nScaleX); } - long nSizeX = (long) ( pDoc->GetColWidth( nEndCol, nTab ) * nScaleX ); + long nSizeX = static_cast<long>( pDoc->GetColWidth( nEndCol, nTab ) * nScaleX ); SCROW nEndRow = rCellPos.Row(); - long nPosY = (long) pDoc->GetScaledRowHeight( rRange.aStart.Row(), - nEndRow, nTab, nScaleY); - long nSizeY = (long) ( pDoc->GetRowHeight( nEndRow, nTab ) * nScaleY ); + long nPosY = static_cast<long>(pDoc->GetScaledRowHeight( rRange.aStart.Row(), + nEndRow, nTab, nScaleY)); + long nSizeY = static_cast<long>( pDoc->GetRowHeight( nEndRow, nTab ) * nScaleY ); Size aOffsetLogic( nPosX, nPosY ); Size aSizeLogic( nSizeX, nSizeY ); @@ -553,7 +553,7 @@ void ScPreviewLocationData::GetTableInfo( const tools::Rectangle& rVisiblePixel, if (!pDoc->ColHidden(nCol, nTab)) { sal_uInt16 nDocW = pDoc->GetColWidth( nCol, nTab ); - long nNextX = nPosX + (long) (nDocW * nScaleX); + long nNextX = nPosX + static_cast<long>(nDocW * nScaleX); long nPixelStart = pWindow->LogicToPixel( Size( nPosX, 0 ), aCellMapMode ).Width(); long nPixelEnd = pWindow->LogicToPixel( Size( nNextX, 0 ), aCellMapMode ).Width() - 1; @@ -572,7 +572,7 @@ void ScPreviewLocationData::GetTableInfo( const tools::Rectangle& rVisiblePixel, if (!pDoc->ColHidden(nCol, nTab)) { sal_uInt16 nDocW = pDoc->GetColWidth( nCol, nTab ); - long nNextX = nPosX + (long) (nDocW * nScaleX); + long nNextX = nPosX + static_cast<long>(nDocW * nScaleX); long nPixelStart = pWindow->LogicToPixel( Size( nPosX, 0 ), aCellMapMode ).Width(); long nPixelEnd = pWindow->LogicToPixel( Size( nNextX, 0 ), aCellMapMode ).Width() - 1; @@ -618,7 +618,7 @@ void ScPreviewLocationData::GetTableInfo( const tools::Rectangle& rVisiblePixel, continue; sal_uInt16 nDocH = pDoc->GetOriginalHeight( nRow, nTab ); - long nNextY = nPosY + (long) (nDocH * nScaleY); + long nNextY = nPosY + static_cast<long>(nDocH * nScaleY); long nPixelStart = pWindow->LogicToPixel( Size( 0, nPosY ), aCellMapMode ).Height(); long nPixelEnd = pWindow->LogicToPixel( Size( 0, nNextY ), aCellMapMode ).Height() - 1; @@ -639,7 +639,7 @@ void ScPreviewLocationData::GetTableInfo( const tools::Rectangle& rVisiblePixel, continue; sal_uInt16 nDocH = pDoc->GetOriginalHeight( nRow, nTab ); - long nNextY = nPosY + (long) (nDocH * nScaleY); + long nNextY = nPosY + static_cast<long>(nDocH * nScaleY); long nPixelStart = pWindow->LogicToPixel( Size( 0, nPosY ), aCellMapMode ).Height(); long nPixelEnd = pWindow->LogicToPixel( Size( 0, nNextY ), aCellMapMode ).Height() - 1; diff --git a/sc/source/ui/view/prevwsh.cxx b/sc/source/ui/view/prevwsh.cxx index 41b7caa91af7..2bab27e4f3c1 100644 --- a/sc/source/ui/view/prevwsh.cxx +++ b/sc/source/ui/view/prevwsh.cxx @@ -246,8 +246,8 @@ bool ScPreviewShell::GetPageSize( Size& aPageSize ) const SfxItemSet* pParamSet = &pStyleSheet->GetItemSet(); aPageSize = pParamSet->Get(ATTR_PAGE_SIZE).GetSize(); - aPageSize.Width() = (long) (aPageSize.Width() * HMM_PER_TWIPS ); - aPageSize.Height() = (long) (aPageSize.Height() * HMM_PER_TWIPS ); + aPageSize.Width() = static_cast<long>(aPageSize.Width() * HMM_PER_TWIPS ); + aPageSize.Height() = static_cast<long>(aPageSize.Height() * HMM_PER_TWIPS ); return true; } @@ -483,14 +483,14 @@ bool ScPreviewShell::ScrollCommand( const CommandEvent& rCEvt ) long nOld = pPreview->GetZoom(); long nNew; if ( pData->GetDelta() < 0 ) - nNew = std::max( (long) MINZOOM, basegfx::zoomtools::zoomOut( nOld )); + nNew = std::max( long(MINZOOM), basegfx::zoomtools::zoomOut( nOld )); else - nNew = std::min( (long) MAXZOOM, basegfx::zoomtools::zoomIn( nOld )); + nNew = std::min( long(MAXZOOM), basegfx::zoomtools::zoomIn( nOld )); if ( nNew != nOld ) { eZoom = SvxZoomType::PERCENT; - pPreview->SetZoom( (sal_uInt16)nNew ); + pPreview->SetZoom( static_cast<sal_uInt16>(nNew) ); } bDone = true; @@ -918,7 +918,7 @@ void ScPreviewShell::ReadUserData(const OUString& rData, bool /* bBrowse */) if (!rData.isEmpty()) { sal_Int32 nIndex = 0; - pPreview->SetZoom((sal_uInt16)rData.getToken(0, SC_USERDATA_SEP, nIndex).toInt32()); + pPreview->SetZoom(static_cast<sal_uInt16>(rData.getToken(0, SC_USERDATA_SEP, nIndex).toInt32())); pPreview->SetPageNo(rData.getToken(0, SC_USERDATA_SEP, nIndex).toInt32()); eZoom = SvxZoomType::PERCENT; } diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx index 5a7711e9867a..2282d7ec9ebe 100644 --- a/sc/source/ui/view/printfun.cxx +++ b/sc/source/ui/view/printfun.cxx @@ -514,15 +514,15 @@ void ScPrintFunc::DrawToDev( ScDocument* pDoc, OutputDevice* pDev, double /* nPr long nTwipsSizeX = 0; for (SCCOL i=nX1; i<=nX2; i++) nTwipsSizeX += pDoc->GetColWidth( i, nTab ); - long nTwipsSizeY = (long) pDoc->GetRowHeight( nY1, nY2, nTab ); + long nTwipsSizeY = static_cast<long>(pDoc->GetRowHeight( nY1, nY2, nTab )); // if no lines, still space for the outline frame (20 Twips = 1pt) // (HasLines initializes aLines to 0,0,0,0) nTwipsSizeX += aLines.Left() + std::max( aLines.Right(), 20L ); nTwipsSizeY += aLines.Top() + std::max( aLines.Bottom(), 20L ); - double nScaleX = (double) nDevSizeX / nTwipsSizeX; - double nScaleY = (double) nDevSizeY / nTwipsSizeY; + double nScaleX = static_cast<double>(nDevSizeX) / nTwipsSizeX; + double nScaleY = static_cast<double>(nDevSizeY) / nTwipsSizeY; //! hand over Flag at FillInfo !!!!! ScRange aERange; @@ -548,9 +548,9 @@ void ScPrintFunc::DrawToDev( ScDocument* pDoc, OutputDevice* pDev, double /* nPr // If no lines, still leave space for grid lines // (would be elseways cut away) - long nAddX = (long)( aLines.Left() * nScaleX ); + long nAddX = static_cast<long>( aLines.Left() * nScaleX ); nScrX += ( nAddX ? nAddX : 1 ); - long nAddY = (long)( aLines.Top() * nScaleY ); + long nAddY = static_cast<long>( aLines.Top() * nScaleY ); nScrY += ( nAddY ? nAddY : 1 ); ScOutputData aOutputData( pDev, OUTTYPE_PRINTER, aTabInfo, pDoc, nTab, @@ -768,7 +768,7 @@ long ScPrintFunc::TextHeight( const EditTextObject* pObject ) pEditEngine->SetTextNewDefaults( *pObject, *pEditDefaults, false ); - return (long) pEditEngine->GetTextHeight(); + return static_cast<long>(pEditEngine->GetTextHeight()); } // nZoom must be set !!! @@ -932,7 +932,7 @@ void ScPrintFunc::InitParam( const ScPrintOptions* pOptions ) aTableParam.bLeftRight = !aTableParam.bLeftRight; aTableParam.nFirstPageNo = lcl_GetUShort(pParamSet,ATTR_PAGE_FIRSTPAGENO); if (!aTableParam.nFirstPageNo) - aTableParam.nFirstPageNo = (sal_uInt16) nPageStart; // from previous table + aTableParam.nFirstPageNo = static_cast<sal_uInt16>(nPageStart); // from previous table if ( pScaleItem && pScaleToItem && pScaleToPagesItem ) { @@ -1277,10 +1277,10 @@ void ScPrintFunc::DrawBorder( long nScrX, long nScrY, long nScrW, long nScrH, // aFrameRect - outside around frame, without shadow if ( pShadow && pShadow->GetLocation() != SvxShadowLocation::NONE ) { - nLeft += (long) ( pShadow->CalcShadowSpace(SvxShadowItemSide::LEFT) * nScaleX ); - nRight += (long) ( pShadow->CalcShadowSpace(SvxShadowItemSide::RIGHT) * nScaleX ); - nTop += (long) ( pShadow->CalcShadowSpace(SvxShadowItemSide::TOP) * nScaleY ); - nBottom += (long) ( pShadow->CalcShadowSpace(SvxShadowItemSide::BOTTOM) * nScaleY ); + nLeft += static_cast<long>( pShadow->CalcShadowSpace(SvxShadowItemSide::LEFT) * nScaleX ); + nRight += static_cast<long>( pShadow->CalcShadowSpace(SvxShadowItemSide::RIGHT) * nScaleX ); + nTop += static_cast<long>( pShadow->CalcShadowSpace(SvxShadowItemSide::TOP) * nScaleY ); + nBottom += static_cast<long>( pShadow->CalcShadowSpace(SvxShadowItemSide::BOTTOM) * nScaleY ); } tools::Rectangle aFrameRect( Point(nScrX+nLeft, nScrY+nTop), Size(nScrW-nLeft-nRight, nScrH-nTop-nBottom) ); @@ -1288,10 +1288,10 @@ void ScPrintFunc::DrawBorder( long nScrX, long nScrY, long nScrW, long nScrH, // center of frame, to paint lines through OutputData if (pBorderData) { - nLeft += (long) ( lcl_LineTotal(pBorderData->GetLeft()) * nScaleX / 2 ); - nRight += (long) ( lcl_LineTotal(pBorderData->GetRight()) * nScaleX / 2 ); - nTop += (long) ( lcl_LineTotal(pBorderData->GetTop()) * nScaleY / 2 ); - nBottom += (long) ( lcl_LineTotal(pBorderData->GetBottom()) * nScaleY / 2 ); + nLeft += static_cast<long>( lcl_LineTotal(pBorderData->GetLeft()) * nScaleX / 2 ); + nRight += static_cast<long>( lcl_LineTotal(pBorderData->GetRight()) * nScaleX / 2 ); + nTop += static_cast<long>( lcl_LineTotal(pBorderData->GetTop()) * nScaleY / 2 ); + nBottom += static_cast<long>( lcl_LineTotal(pBorderData->GetBottom()) * nScaleY / 2 ); } long nEffHeight = nScrH - nTop - nBottom; long nEffWidth = nScrW - nLeft - nRight; @@ -1325,8 +1325,8 @@ void ScPrintFunc::DrawBorder( long nScrX, long nScrY, long nScrW, long nScrH, { pDev->SetFillColor(pShadow->GetColor()); pDev->SetLineColor(); - long nShadowX = (long) ( pShadow->GetWidth() * nScaleX ); - long nShadowY = (long) ( pShadow->GetWidth() * nScaleY ); + long nShadowX = static_cast<long>( pShadow->GetWidth() * nScaleX ); + long nShadowY = static_cast<long>( pShadow->GetWidth() * nScaleY ); switch (pShadow->GetLocation()) { case SvxShadowLocation::TopLeft: @@ -1380,9 +1380,9 @@ void ScPrintFunc::DrawBorder( long nScrX, long nScrY, long nScrW, long nScrH, nScaleX, nScaleY, false, false ); OSL_ENSURE(aTabInfo.mnArrCount,"nArrCount == 0"); - aTabInfo.mpRowInfo[1].nHeight = (sal_uInt16) nEffHeight; + aTabInfo.mpRowInfo[1].nHeight = static_cast<sal_uInt16>(nEffHeight); aTabInfo.mpRowInfo[0].pCellInfo[1].nWidth = - aTabInfo.mpRowInfo[1].pCellInfo[1].nWidth = (sal_uInt16) nEffWidth; + aTabInfo.mpRowInfo[1].pCellInfo[1].nWidth = static_cast<sal_uInt16>(nEffWidth); ScOutputData aOutputData( pDev, OUTTYPE_PRINTER, aTabInfo, pBorderDoc.get(), 0, nScrX+nLeft, nScrY+nTop, 0,0, 0,0, nScaleX, nScaleY ); @@ -1403,14 +1403,14 @@ void ScPrintFunc::PrintColHdr( SCCOL nX1, SCCOL nX2, long nScrX, long nScrY ) long nOneY = aOnePixel.Height(); SCCOL nCol; - long nHeight = (long) (PRINT_HEADER_HEIGHT * nScaleY); + long nHeight = static_cast<long>(PRINT_HEADER_HEIGHT * nScaleY); long nEndY = nScrY + nHeight - nOneY; long nPosX = nScrX; if ( bLayoutRTL ) { for (nCol=nX1; nCol<=nX2; nCol++) - nPosX += (long)( pDoc->GetColWidth( nCol, nPrintTab ) * nScaleX ); + nPosX += static_cast<long>( pDoc->GetColWidth( nCol, nPrintTab ) * nScaleX ); } else nPosX -= nOneX; @@ -1422,7 +1422,7 @@ void ScPrintFunc::PrintColHdr( SCCOL nX1, SCCOL nX2, long nScrX, long nScrY ) sal_uInt16 nDocW = pDoc->GetColWidth( nCol, nPrintTab ); if (nDocW) { - long nWidth = (long) (nDocW * nScaleX); + long nWidth = static_cast<long>(nDocW * nScaleX); long nEndX = nPosX + nWidth * nLayoutSign; pDev->DrawRect( tools::Rectangle( nPosX,nPosY,nEndX,nEndY ) ); @@ -1450,7 +1450,7 @@ void ScPrintFunc::PrintRowHdr( SCROW nY1, SCROW nY2, long nScrX, long nScrY ) bool bLayoutRTL = pDoc->IsLayoutRTL( nPrintTab ); - long nWidth = (long) (PRINT_HEADER_WIDTH * nScaleX); + long nWidth = static_cast<long>(PRINT_HEADER_WIDTH * nScaleX); long nEndX = nScrX + nWidth; long nPosX = nScrX; if ( !bLayoutRTL ) @@ -1466,7 +1466,7 @@ void ScPrintFunc::PrintRowHdr( SCROW nY1, SCROW nY2, long nScrX, long nScrY ) sal_uInt16 nDocH = pDoc->GetRowHeight( nRow, nPrintTab ); if (nDocH) { - long nHeight = (long) (nDocH * nScaleY); + long nHeight = static_cast<long>(nDocH * nScaleY); long nEndY = nPosY + nHeight; pDev->DrawRect( tools::Rectangle( nPosX,nPosY,nEndX,nEndY ) ); @@ -1490,7 +1490,7 @@ void ScPrintFunc::LocateColHdr( SCCOL nX1, SCCOL nX2, long nScrX, long nScrY, long nOneX = aOnePixel.Width(); long nOneY = aOnePixel.Height(); - long nHeight = (long) (PRINT_HEADER_HEIGHT * nScaleY); + long nHeight = static_cast<long>(PRINT_HEADER_HEIGHT * nScaleY); long nEndY = nScrY + nHeight - nOneY; long nPosX = nScrX - nOneX; @@ -1498,7 +1498,7 @@ void ScPrintFunc::LocateColHdr( SCCOL nX1, SCCOL nX2, long nScrX, long nScrY, { sal_uInt16 nDocW = pDoc->GetColWidth( nCol, nPrintTab ); if (nDocW) - nPosX += (long) (nDocW * nScaleX); + nPosX += static_cast<long>(nDocW * nScaleX); } tools::Rectangle aCellRect( nScrX, nScrY, nPosX, nEndY ); rLocationData.AddColHeaders( aCellRect, nX1, nX2, bRepCol ); @@ -1513,7 +1513,7 @@ void ScPrintFunc::LocateRowHdr( SCROW nY1, SCROW nY2, long nScrX, long nScrY, bool bLayoutRTL = pDoc->IsLayoutRTL( nPrintTab ); - long nWidth = (long) (PRINT_HEADER_WIDTH * nScaleX); + long nWidth = static_cast<long>(PRINT_HEADER_WIDTH * nScaleX); long nEndX = nScrX + nWidth; if ( !bLayoutRTL ) nEndX -= nOneX; @@ -1541,8 +1541,8 @@ void ScPrintFunc::LocateArea( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, aTwipOffset.Y() -= pDoc->GetRowHeight( 0, nY1-1, nPrintTab ); Point aMMOffset( aTwipOffset ); - aMMOffset.X() = (long)(aMMOffset.X() * HMM_PER_TWIPS); - aMMOffset.Y() = (long)(aMMOffset.Y() * HMM_PER_TWIPS); + aMMOffset.X() = static_cast<long>(aMMOffset.X() * HMM_PER_TWIPS); + aMMOffset.Y() = static_cast<long>(aMMOffset.Y() * HMM_PER_TWIPS); aMMOffset += Point( nLogStX, nLogStY ); MapMode aDrawMapMode( MapUnit::Map100thMM, aMMOffset, aLogicMode.GetScaleX(), aLogicMode.GetScaleY() ); @@ -1557,7 +1557,7 @@ void ScPrintFunc::LocateArea( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, { sal_uInt16 nDocW = pDoc->GetColWidth( nCol, nPrintTab ); if (nDocW) - nPosX += (long) (nDocW * nScaleX); + nPosX += static_cast<long>(nDocW * nScaleX); } long nPosY = nScrY - nOneY; @@ -1834,7 +1834,7 @@ void ScPrintFunc::PrintHF( long nPageNo, bool bHeader, long nStartY, pEditDefaults->Put( SvxAdjustItem( SvxAdjust::Left, EE_PARA_JUST ) ); pEditEngine->SetTextNewDefaults( *pObject, *pEditDefaults, false ); Point aDraw = aStart; - long nDif = aPaperSize.Height() - (long) pEditEngine->GetTextHeight(); + long nDif = aPaperSize.Height() - static_cast<long>(pEditEngine->GetTextHeight()); if (nDif > 0) aDraw.Y() += nDif / 2; pEditEngine->Draw( pDev, aDraw ); @@ -1848,7 +1848,7 @@ void ScPrintFunc::PrintHF( long nPageNo, bool bHeader, long nStartY, pEditDefaults->Put( SvxAdjustItem( SvxAdjust::Center, EE_PARA_JUST ) ); pEditEngine->SetTextNewDefaults( *pObject, *pEditDefaults, false ); Point aDraw = aStart; - long nDif = aPaperSize.Height() - (long) pEditEngine->GetTextHeight(); + long nDif = aPaperSize.Height() - static_cast<long>(pEditEngine->GetTextHeight()); if (nDif > 0) aDraw.Y() += nDif / 2; pEditEngine->Draw( pDev, aDraw ); @@ -1862,7 +1862,7 @@ void ScPrintFunc::PrintHF( long nPageNo, bool bHeader, long nStartY, pEditDefaults->Put( SvxAdjustItem( SvxAdjust::Right, EE_PARA_JUST ) ); pEditEngine->SetTextNewDefaults( *pObject, *pEditDefaults, false ); Point aDraw = aStart; - long nDif = aPaperSize.Height() - (long) pEditEngine->GetTextHeight(); + long nDif = aPaperSize.Height() - static_cast<long>(pEditEngine->GetTextHeight()); if (nDif > 0) aDraw.Y() += nDif / 2; pEditEngine->Draw( pDev, aDraw ); @@ -1955,7 +1955,7 @@ long ScPrintFunc::DoNotes( long nNoteStart, bool bDoPrint, ScPreviewLocationData long ScPrintFunc::PrintNotes( long nPageNo, long nNoteStart, bool bDoPrint, ScPreviewLocationData* pLocationData ) { - if ( nNoteStart >= (long) aNotePosList.size() || !aTableParam.bNotes ) + if ( nNoteStart >= static_cast<long>(aNotePosList.size()) || !aTableParam.bNotes ) return 0; if ( bDoPrint && bClearWin ) @@ -1970,8 +1970,8 @@ long ScPrintFunc::PrintNotes( long nPageNo, long nNoteStart, bool bDoPrint, ScPr pDev->SetLineColor(); pDev->SetFillColor(aBackgroundColor); pDev->DrawRect(tools::Rectangle(Point(), - Size((long)(aPageSize.Width() * nScaleX * 100 / nZoom), - (long)(aPageSize.Height() * nScaleY * 100 / nZoom)))); + Size(static_cast<long>(aPageSize.Width() * nScaleX * 100 / nZoom), + static_cast<long>(aPageSize.Height() * nScaleY * 100 / nZoom)))); } // adjust aPageRect for left/right page @@ -2039,8 +2039,8 @@ void ScPrintFunc::PrintPage( long nPageNo, SCCOL nX1, SCROW nY1, SCCOL nX2, SCRO pDev->SetLineColor(); pDev->SetFillColor(aBackgroundColor); pDev->DrawRect(tools::Rectangle(Point(), - Size((long)(aPageSize.Width() * nScaleX * 100 / nZoom), - (long)(aPageSize.Height() * nScaleY * 100 / nZoom)))); + Size(static_cast<long>(aPageSize.Width() * nScaleX * 100 / nZoom), + static_cast<long>(aPageSize.Height() * nScaleY * 100 / nZoom)))); } // adjust aPageRect for left/right page @@ -2107,7 +2107,7 @@ void ScPrintFunc::PrintPage( long nPageNo, SCCOL nX1, SCROW nY1, SCCOL nX2, SCRO for (i=nRepeatStartCol; i<=nRepeatEndCol; i++) nDataWidth += pDoc->GetColWidth( i,nPrintTab ); if (aTableParam.bHeaders) - nDataWidth += (long) PRINT_HEADER_WIDTH; + nDataWidth += long(PRINT_HEADER_WIDTH); if (pBorderItem) nDataWidth += pBorderItem->GetDistance(SvxBoxItemLine::LEFT) + pBorderItem->GetDistance(SvxBoxItemLine::RIGHT); //! Line width? @@ -2130,7 +2130,7 @@ void ScPrintFunc::PrintPage( long nPageNo, SCCOL nX1, SCROW nY1, SCCOL nX2, SCRO nDataHeight += pDoc->GetRowHeight( nRepeatStartRow, nRepeatEndRow, nPrintTab); if (aTableParam.bHeaders) - nDataHeight += (long) PRINT_HEADER_HEIGHT; + nDataHeight += long(PRINT_HEADER_HEIGHT); if (pBorderItem) nDataHeight += pBorderItem->GetDistance(SvxBoxItemLine::TOP) + pBorderItem->GetDistance(SvxBoxItemLine::BOTTOM); //! Line width? @@ -2153,37 +2153,37 @@ void ScPrintFunc::PrintPage( long nPageNo, SCCOL nX1, SCROW nY1, SCCOL nX2, SCRO long nContentHeight = 0; if (aTableParam.bHeaders) { - nHeaderWidth = (long) (PRINT_HEADER_WIDTH * nScaleX); - nHeaderHeight = (long) (PRINT_HEADER_HEIGHT * nScaleY); + nHeaderWidth = static_cast<long>(PRINT_HEADER_WIDTH * nScaleX); + nHeaderHeight = static_cast<long>(PRINT_HEADER_HEIGHT * nScaleY); } if (bDoRepCol) for (SCCOL i=nRepeatStartCol; i<=nRepeatEndCol; i++) - nRepeatWidth += (long) (pDoc->GetColWidth(i,nPrintTab) * nScaleX); + nRepeatWidth += static_cast<long>(pDoc->GetColWidth(i,nPrintTab) * nScaleX); if (bDoRepRow) nRepeatHeight += pDoc->GetScaledRowHeight( nRepeatStartRow, nRepeatEndRow, nPrintTab, nScaleY); for (SCCOL i=nX1; i<=nX2; i++) - nContentWidth += (long) (pDoc->GetColWidth(i,nPrintTab) * nScaleX); + nContentWidth += static_cast<long>(pDoc->GetColWidth(i,nPrintTab) * nScaleX); nContentHeight += pDoc->GetScaledRowHeight( nY1, nY2, nPrintTab, nScaleY); // partition the page - long nStartX = (long) ( nLeftSpace * nScaleX ); - long nStartY = (long) ( nTopSpace * nScaleY ); + long nStartX = static_cast<long>( nLeftSpace * nScaleX ); + long nStartY = static_cast<long>( nTopSpace * nScaleY ); long nInnerStartX = nStartX; long nInnerStartY = nStartY; if (pBorderItem) { - nInnerStartX += (long) ( ( lcl_LineTotal(pBorderItem->GetLeft()) + + nInnerStartX += static_cast<long>( ( lcl_LineTotal(pBorderItem->GetLeft()) + pBorderItem->GetDistance(SvxBoxItemLine::LEFT) ) * nScaleX ); - nInnerStartY += (long) ( ( lcl_LineTotal(pBorderItem->GetTop()) + + nInnerStartY += static_cast<long>( ( lcl_LineTotal(pBorderItem->GetTop()) + pBorderItem->GetDistance(SvxBoxItemLine::TOP) ) * nScaleY ); } if (pShadowItem && pShadowItem->GetLocation() != SvxShadowLocation::NONE) { - nInnerStartX += (long) ( pShadowItem->CalcShadowSpace(SvxShadowItemSide::LEFT) * nScaleX ); - nInnerStartY += (long) ( pShadowItem->CalcShadowSpace(SvxShadowItemSide::TOP) * nScaleY ); + nInnerStartX += static_cast<long>( pShadowItem->CalcShadowSpace(SvxShadowItemSide::LEFT) * nScaleX ); + nInnerStartY += static_cast<long>( pShadowItem->CalcShadowSpace(SvxShadowItemSide::TOP) * nScaleY ); } if ( bLayoutRTL ) @@ -2229,15 +2229,15 @@ void ScPrintFunc::PrintPage( long nPageNo, SCCOL nX1, SCROW nY1, SCCOL nX2, SCRO long nBorderEndY = nEndY; if (pBorderItem) { - nBorderEndX += (long) ( ( lcl_LineTotal(pBorderItem->GetRight()) + + nBorderEndX += static_cast<long>( ( lcl_LineTotal(pBorderItem->GetRight()) + pBorderItem->GetDistance(SvxBoxItemLine::RIGHT) ) * nScaleX ); - nBorderEndY += (long) ( ( lcl_LineTotal(pBorderItem->GetBottom()) + + nBorderEndY += static_cast<long>( ( lcl_LineTotal(pBorderItem->GetBottom()) + pBorderItem->GetDistance(SvxBoxItemLine::BOTTOM) ) * nScaleY ); } if (pShadowItem && pShadowItem->GetLocation() != SvxShadowLocation::NONE) { - nBorderEndX += (long) ( pShadowItem->CalcShadowSpace(SvxShadowItemSide::RIGHT) * nScaleX ); - nBorderEndY += (long) ( pShadowItem->CalcShadowSpace(SvxShadowItemSide::BOTTOM) * nScaleY ); + nBorderEndX += static_cast<long>( pShadowItem->CalcShadowSpace(SvxShadowItemSide::RIGHT) * nScaleX ); + nBorderEndY += static_cast<long>( pShadowItem->CalcShadowSpace(SvxShadowItemSide::BOTTOM) * nScaleY ); } if ( bDoPrint ) @@ -2484,7 +2484,7 @@ long ScPrintFunc::CountPages() // sets also nPagesX, nP nPages += m_aRanges.m_aPageRows[nY].CountVisible(); } else - nPages += ((long) m_aRanges.m_nPagesX) * m_aRanges.m_nPagesY; + nPages += static_cast<long>(m_aRanges.m_nPagesX) * m_aRanges.m_nPagesY; if ( pPageData ) FillPageData(); } @@ -2499,7 +2499,7 @@ long ScPrintFunc::CountPages() // sets also nPagesX, nP nPages += m_aRanges.m_aPageRows[nY].CountVisible(); } else - nPages += ((long) m_aRanges.m_nPagesX) * m_aRanges.m_nPagesY; + nPages += static_cast<long>(m_aRanges.m_nPagesX) * m_aRanges.m_nPagesY; if ( pPageData ) FillPageData(); } @@ -2580,7 +2580,7 @@ void ScPrintFunc::InitModes() // set MapModes from nZoom etc. { aOffset = Point( aSrcOffset.X()*100/nZoom, aSrcOffset.Y()*100/nZoom ); - long nEffZoom = nZoom * (long) nManualZoom; + long nEffZoom = nZoom * static_cast<long>(nManualZoom); nScaleX = nScaleY = HMM_PER_TWIPS; // output in 1/100 mm Fraction aZoomFract( nEffZoom,10000 ); @@ -2589,7 +2589,7 @@ void ScPrintFunc::InitModes() // set MapModes from nZoom etc. if ( !pPrinter && !bIsRender ) // adjust scale for preview { double nFact = pDocShell->GetOutputFactor(); - aHorFract = Fraction( (long)( nEffZoom / nFact ), 10000 ); + aHorFract = Fraction( static_cast<long>( nEffZoom / nFact ), 10000 ); } aLogicMode = MapMode( MapUnit::Map100thMM, Point(), aHorFract, aZoomFract ); @@ -2597,7 +2597,7 @@ void ScPrintFunc::InitModes() // set MapModes from nZoom etc. Point aLogicOfs( -aOffset.X(), -aOffset.Y() ); aOffsetMode = MapMode( MapUnit::Map100thMM, aLogicOfs, aHorFract, aZoomFract ); - Point aTwipsOfs( (long) ( -aOffset.X() / nScaleX + 0.5 ), (long) ( -aOffset.Y() / nScaleY + 0.5 ) ); + Point aTwipsOfs( static_cast<long>( -aOffset.X() / nScaleX + 0.5 ), static_cast<long>( -aOffset.Y() / nScaleY + 0.5 ) ); aTwipMode = MapMode( MapUnit::MapTwip, aTwipsOfs, aHorFract, aZoomFract ); } @@ -2944,8 +2944,8 @@ Size ScPrintFunc::GetDocPageSize() Size aDocPageSize = aPageRect.GetSize(); if (aTableParam.bHeaders) { - aDocPageSize.Width() -= (long) PRINT_HEADER_WIDTH; - aDocPageSize.Height() -= (long) PRINT_HEADER_HEIGHT; + aDocPageSize.Width() -= long(PRINT_HEADER_WIDTH); + aDocPageSize.Height() -= long(PRINT_HEADER_HEIGHT); } if (pBorderItem) { diff --git a/sc/source/ui/view/select.cxx b/sc/source/ui/view/select.cxx index f06043c79276..34edfe50b2c7 100644 --- a/sc/source/ui/view/select.cxx +++ b/sc/source/ui/view/select.cxx @@ -494,7 +494,7 @@ bool ScViewFunctionSet::SetCursorAtCell( SCCOL nPosX, SCROW nPosY, bool bScroll long nSizeX = 0; for (SCCOL i=nPosX+1; i<=nEndX; i++) nSizeX += pDoc->GetColWidth( i, nTab ); - long nSizeY = (long) pDoc->GetRowHeight( nPosY+1, nEndY, nTab ); + long nSizeY = static_cast<long>(pDoc->GetRowHeight( nPosY+1, nEndY, nTab )); SCCOL nDelStartX = nStartX; SCROW nDelStartY = nStartY; diff --git a/sc/source/ui/view/tabview.cxx b/sc/source/ui/view/tabview.cxx index 9e88f11f36e5..070fe7dacd4f 100644 --- a/sc/source/ui/view/tabview.cxx +++ b/sc/source/ui/view/tabview.cxx @@ -765,7 +765,7 @@ void ScTabView::UpdateVarZoom() const Fraction& rOldX = GetViewData().GetZoomX(); const Fraction& rOldY = GetViewData().GetZoomY(); long nOldPercent = long(rOldY * 100); - sal_uInt16 nNewZoom = CalcZoom( eZoomType, (sal_uInt16)nOldPercent ); + sal_uInt16 nNewZoom = CalcZoom( eZoomType, static_cast<sal_uInt16>(nOldPercent) ); Fraction aNew( nNewZoom, 100 ); if ( aNew != rOldX || aNew != rOldY ) @@ -985,12 +985,12 @@ bool ScTabView::ScrollCommand( const CommandEvent& rCEvt, ScSplitPos ePos ) // and can't be changed directly const Fraction& rOldY = aViewData.GetZoomY(); - long nOld = (long)( rOldY * 100 ); + long nOld = static_cast<long>( rOldY * 100 ); long nNew; if ( pData->GetDelta() < 0 ) - nNew = std::max( (long) MINZOOM, basegfx::zoomtools::zoomOut( nOld )); + nNew = std::max( long(MINZOOM), basegfx::zoomtools::zoomOut( nOld )); else - nNew = std::min( (long) MAXZOOM, basegfx::zoomtools::zoomIn( nOld )); + nNew = std::min( long(MAXZOOM), basegfx::zoomtools::zoomIn( nOld )); if ( nNew != nOld ) { // scroll wheel doesn't set the AppOptions default @@ -1087,7 +1087,7 @@ IMPL_LINK( ScTabView, ScrollHdl, ScrollBar*, pScroll, void ) if (bHoriz) { aHelpStr = ScGlobal::GetRscString(STR_COLUMN) + - " " + ScColToAlpha((SCCOL) nScrollPos); + " " + ScColToAlpha(static_cast<SCCOL>(nScrollPos)); aRect.Left() = aMousePos.X(); aRect.Top() = aPos.Y() - 4; @@ -1120,10 +1120,10 @@ IMPL_LINK( ScTabView, ScrollHdl, ScrollBar*, pScroll, void ) nDelta = 1; break; case ScrollType::PageUp: - if ( pScroll == aHScrollLeft.get() ) nDelta = -(long) aViewData.PrevCellsX( SC_SPLIT_LEFT ); - if ( pScroll == aHScrollRight.get() ) nDelta = -(long) aViewData.PrevCellsX( SC_SPLIT_RIGHT ); - if ( pScroll == aVScrollTop.get() ) nDelta = -(long) aViewData.PrevCellsY( SC_SPLIT_TOP ); - if ( pScroll == aVScrollBottom.get() ) nDelta = -(long) aViewData.PrevCellsY( SC_SPLIT_BOTTOM ); + if ( pScroll == aHScrollLeft.get() ) nDelta = -static_cast<long>(aViewData.PrevCellsX( SC_SPLIT_LEFT )); + if ( pScroll == aHScrollRight.get() ) nDelta = -static_cast<long>(aViewData.PrevCellsX( SC_SPLIT_RIGHT )); + if ( pScroll == aVScrollTop.get() ) nDelta = -static_cast<long>(aViewData.PrevCellsY( SC_SPLIT_TOP )); + if ( pScroll == aVScrollBottom.get() ) nDelta = -static_cast<long>(aViewData.PrevCellsY( SC_SPLIT_BOTTOM )); if (nDelta==0) nDelta=-1; break; case ScrollType::PageDown: @@ -1592,7 +1592,7 @@ void ScTabView::DoHSplit(long nSplitPos) long nLeftWidth = nSplitPos - pRowBar[SC_SPLIT_BOTTOM]->GetSizePixel().Width(); if ( nLeftWidth < 0 ) nLeftWidth = 0; nNewDelta = nOldDelta + aViewData.CellsAtX( nOldDelta, 1, SC_SPLIT_LEFT, - (sal_uInt16) nLeftWidth ); + static_cast<sal_uInt16>(nLeftWidth) ); if ( nNewDelta > MAXCOL ) nNewDelta = MAXCOL; aViewData.SetPosX( SC_SPLIT_RIGHT, nNewDelta ); @@ -1664,7 +1664,7 @@ void ScTabView::DoVSplit(long nSplitPos) long nTopHeight = nSplitPos - pColBar[SC_SPLIT_LEFT]->GetSizePixel().Height(); if ( nTopHeight < 0 ) nTopHeight = 0; nNewDelta = nOldDelta + aViewData.CellsAtY( nOldDelta, 1, SC_SPLIT_TOP, - (sal_uInt16) nTopHeight ); + static_cast<sal_uInt16>(nTopHeight) ); if ( nNewDelta > MAXROW ) nNewDelta = MAXROW; aViewData.SetPosY( SC_SPLIT_BOTTOM, nNewDelta ); @@ -1699,11 +1699,11 @@ Point ScTabView::GetInsertPos() long nPosX = 0; for (SCCOL i=0; i<nCol; i++) nPosX += pDoc->GetColWidth(i,nTab); - nPosX = (long)(nPosX * HMM_PER_TWIPS); + nPosX = static_cast<long>(nPosX * HMM_PER_TWIPS); if ( pDoc->IsNegativePage( nTab ) ) nPosX = -nPosX; - long nPosY = (long) pDoc->GetRowHeight( 0, nRow-1, nTab); - nPosY = (long)(nPosY * HMM_PER_TWIPS); + long nPosY = static_cast<long>(pDoc->GetRowHeight( 0, nRow-1, nTab)); + nPosY = static_cast<long>(nPosY * HMM_PER_TWIPS); return Point(nPosX,nPosY); } @@ -1737,8 +1737,8 @@ Point ScTabView::GetChartInsertPos( const Size& rSize, const ScRange& rCellRange bool bLayoutRTL = pDoc->IsLayoutRTL( nTab ); long nLayoutSign = bLayoutRTL ? -1 : 1; - long nDocX = (long)( (double) pDoc->GetColOffset( MAXCOL + 1, nTab ) * HMM_PER_TWIPS ) * nLayoutSign; - long nDocY = (long)( (double) pDoc->GetRowOffset( MAXROW + 1, nTab ) * HMM_PER_TWIPS ); + long nDocX = static_cast<long>( static_cast<double>(pDoc->GetColOffset( MAXCOL + 1, nTab )) * HMM_PER_TWIPS ) * nLayoutSign; + long nDocY = static_cast<long>( static_cast<double>(pDoc->GetRowOffset( MAXROW + 1, nTab )) * HMM_PER_TWIPS ); if ( aVisible.Left() * nLayoutSign > nDocX * nLayoutSign ) aVisible.Left() = nDocX; @@ -2795,7 +2795,7 @@ OUString ScTabView::getRowColumnHeaders(const tools::Rectangle& rRectangle) if (pModelObj) aOldSize = pModelObj->getDocumentSize(); - aViewData.SetMaxTiledRow(std::min(std::max(nEndRow, aViewData.GetMaxTiledRow()) + nVisibleRows, (long)MAXTILEDROW)); + aViewData.SetMaxTiledRow(std::min(std::max(nEndRow, aViewData.GetMaxTiledRow()) + nVisibleRows, long(MAXTILEDROW))); Size aNewSize(0, 0); if (pModelObj) @@ -2936,7 +2936,7 @@ OUString ScTabView::getRowColumnHeaders(const tools::Rectangle& rRectangle) if (pModelObj) aOldSize = pModelObj->getDocumentSize(); - aViewData.SetMaxTiledCol(std::min(std::max(nEndCol, aViewData.GetMaxTiledCol()) + nVisibleCols, (long)MAXCOL)); + aViewData.SetMaxTiledCol(std::min(std::max(nEndCol, aViewData.GetMaxTiledCol()) + nVisibleCols, long(MAXCOL))); Size aNewSize(0, 0); if (pModelObj) diff --git a/sc/source/ui/view/tabview2.cxx b/sc/source/ui/view/tabview2.cxx index ee2897e38a69..cf4770798a19 100644 --- a/sc/source/ui/view/tabview2.cxx +++ b/sc/source/ui/view/tabview2.cxx @@ -1125,7 +1125,7 @@ static bool lcl_FitsInWindow( double fScaleX, double fScaleY, sal_uInt16 nZoom, SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCROW nEndRow, SCCOL nFixPosX, SCROW nFixPosY ) { - double fZoomFactor = (double)Fraction(nZoom,100); + double fZoomFactor = static_cast<double>(Fraction(nZoom,100)); fScaleX *= fZoomFactor; fScaleY *= fZoomFactor; @@ -1137,7 +1137,7 @@ static bool lcl_FitsInWindow( double fScaleX, double fScaleY, sal_uInt16 nZoom, sal_uInt16 nColTwips = pDoc->GetColWidth( nCol, nTab ); if (nColTwips) { - nBlockX += (long)(nColTwips * fScaleX); + nBlockX += static_cast<long>(nColTwips * fScaleX); if (nBlockX > nWindowX) return false; } @@ -1147,7 +1147,7 @@ static bool lcl_FitsInWindow( double fScaleX, double fScaleY, sal_uInt16 nZoom, sal_uInt16 nColTwips = pDoc->GetColWidth( nCol, nTab ); if (nColTwips) { - nBlockX += (long)(nColTwips * fScaleX); + nBlockX += static_cast<long>(nColTwips * fScaleX); if (nBlockX > nWindowX) return false; } @@ -1163,7 +1163,7 @@ static bool lcl_FitsInWindow( double fScaleX, double fScaleY, sal_uInt16 nZoom, sal_uInt16 nRowTwips = pDoc->GetRowHeight(nRow, nTab); if (nRowTwips) { - nBlockY += (long)(nRowTwips * fScaleY); + nBlockY += static_cast<long>(nRowTwips * fScaleY); if (nBlockY > nWindowY) return false; } @@ -1173,7 +1173,7 @@ static bool lcl_FitsInWindow( double fScaleX, double fScaleY, sal_uInt16 nZoom, sal_uInt16 nRowTwips = pDoc->GetRowHeight(nRow, nTab); if (nRowTwips) { - nBlockY += (long)(nRowTwips * fScaleY); + nBlockY += static_cast<long>(nRowTwips * fScaleY); if (nBlockY > nWindowY) return false; } @@ -1350,9 +1350,9 @@ sal_uInt16 ScTabView::CalcZoom( SvxZoomType eType, sal_uInt16 nOldZoom ) double nPPTX = ScGlobal::nScreenPPTX / aViewData.GetDocShell()->GetOutputFactor(); double nPPTY = ScGlobal::nScreenPPTY; - long nZoomX = (long) ( aWinSize.Width() * 100 / + long nZoomX = static_cast<long>( aWinSize.Width() * 100 / ( aPageSize.Width() * nPPTX ) ); - long nZoomY = (long) ( aWinSize.Height() * 100 / + long nZoomY = static_cast<long>( aWinSize.Height() * 100 / ( aPageSize.Height() * nPPTY ) ); if (nZoomX > 0) diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx index d1db0c9e9d97..6f40587c4d54 100644 --- a/sc/source/ui/view/tabview3.cxx +++ b/sc/source/ui/view/tabview3.cxx @@ -2344,7 +2344,7 @@ void ScTabView::PaintArea( SCCOL nStartCol, SCROW nStartRow, SCCOL nEndCol, SCRO //!if ( nCol1 > 0 && !aViewData.GetDocument()->IsBlockEmpty( //! aViewData.GetTabNo(), //! 0, nRow1, nCol1-1, nRow2 ) ) - long nMarkPixel = (long)( SC_CLIPMARK_SIZE * aViewData.GetPPTX() ); + long nMarkPixel = static_cast<long>( SC_CLIPMARK_SIZE * aViewData.GetPPTX() ); aStart.X() -= nMarkPixel * nLayoutSign; } @@ -2430,7 +2430,7 @@ void ScTabView::PaintRangeFinder( long nNumber ) if ( pRangeFinder && pRangeFinder->GetDocName() == aViewData.GetDocShell()->GetTitle() ) { SCTAB nTab = aViewData.GetTabNo(); - sal_uInt16 nCount = (sal_uInt16)pRangeFinder->Count(); + sal_uInt16 nCount = static_cast<sal_uInt16>(pRangeFinder->Count()); if (nNumber < 0) { diff --git a/sc/source/ui/view/tabview4.cxx b/sc/source/ui/view/tabview4.cxx index a366f99be4a0..be95dcbab4b5 100644 --- a/sc/source/ui/view/tabview4.cxx +++ b/sc/source/ui/view/tabview4.cxx @@ -369,7 +369,7 @@ static long lcl_GetScrollRange( SCCOLROW nDocEnd, SCCOLROW nPos, SCCOLROW nVis, ++nVis; ++nMax; // for partially visible cells - SCCOLROW nEnd = std::max(nDocEnd, (SCCOLROW)(nPos+nVis)) + nVis; + SCCOLROW nEnd = std::max(nDocEnd, static_cast<SCCOLROW>(nPos+nVis)) + nVis; if (nEnd > nMax) nEnd = nMax; diff --git a/sc/source/ui/view/tabview5.cxx b/sc/source/ui/view/tabview5.cxx index 005399636816..eb76bafe7151 100644 --- a/sc/source/ui/view/tabview5.cxx +++ b/sc/source/ui/view/tabview5.cxx @@ -581,7 +581,7 @@ void ScTabView::MakeVisible( const tools::Rectangle& rHMMRect ) if (nScrollX > 0) while (nScrollX > 0 && nPosX < MAXCOL) { - nScrollX -= (long) ( pDoc->GetColWidth(nPosX, nTab) * nPPTX ); + nScrollX -= static_cast<long>( pDoc->GetColWidth(nPosX, nTab) * nPPTX ); ++nPosX; ++nLinesX; } @@ -589,14 +589,14 @@ void ScTabView::MakeVisible( const tools::Rectangle& rHMMRect ) while (nScrollX < 0 && nPosX > 0) { --nPosX; - nScrollX += (long) ( pDoc->GetColWidth(nPosX, nTab) * nPPTX ); + nScrollX += static_cast<long>( pDoc->GetColWidth(nPosX, nTab) * nPPTX ); --nLinesX; } if (nScrollY > 0) while (nScrollY > 0 && nPosY < MAXROW) { - nScrollY -= (long) ( pDoc->GetRowHeight(nPosY, nTab) * nPPTY ); + nScrollY -= static_cast<long>( pDoc->GetRowHeight(nPosY, nTab) * nPPTY ); ++nPosY; ++nLinesY; } @@ -604,7 +604,7 @@ void ScTabView::MakeVisible( const tools::Rectangle& rHMMRect ) while (nScrollY < 0 && nPosY > 0) { --nPosY; - nScrollY += (long) ( pDoc->GetRowHeight(nPosY, nTab) * nPPTY ); + nScrollY += static_cast<long>( pDoc->GetRowHeight(nPosY, nTab) * nPPTY ); --nLinesY; } diff --git a/sc/source/ui/view/tabvwsh3.cxx b/sc/source/ui/view/tabvwsh3.cxx index ddd1ef663525..a1450c31bf06 100644 --- a/sc/source/ui/view/tabvwsh3.cxx +++ b/sc/source/ui/view/tabvwsh3.cxx @@ -381,7 +381,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) { // one-based row numbers - aScAddress.SetRow( (SCROW)(nNumeric - 1) ); + aScAddress.SetRow( static_cast<SCROW>(nNumeric - 1) ); aScAddress.SetCol( rViewData.GetCurX() ); aScAddress.SetTab( nTab ); aScRange = ScRange( aScAddress, aScAddress ); @@ -692,7 +692,7 @@ void ScTabViewShell::Execute( SfxRequest& rReq ) SvxZoomType eOldZoomType = GetZoomType(); SvxZoomType eNewZoomType = eOldZoomType; const Fraction& rOldY = GetViewData().GetZoomY(); // Y is shown - sal_uInt16 nOldZoom = (sal_uInt16)long( rOldY * 100 ); + sal_uInt16 nOldZoom = static_cast<sal_uInt16>(long( rOldY * 100 )); sal_uInt16 nZoom = nOldZoom; bool bCancel = false; diff --git a/sc/source/ui/view/tabvwsha.cxx b/sc/source/ui/view/tabvwsha.cxx index 844eecb01f3a..3c69bb0ce1d4 100644 --- a/sc/source/ui/view/tabvwsha.cxx +++ b/sc/source/ui/view/tabvwsha.cxx @@ -301,7 +301,7 @@ void ScTabViewShell::GetState( SfxItemSet& rSet ) else { const Fraction& rOldY = GetViewData().GetZoomY(); - sal_uInt16 nZoom = (sal_uInt16)long( rOldY * 100 ); + sal_uInt16 nZoom = static_cast<sal_uInt16>(long( rOldY * 100 )); rSet.Put( SvxZoomItem( SvxZoomType::PERCENT, nZoom, nWhich ) ); } break; @@ -313,7 +313,7 @@ void ScTabViewShell::GetState( SfxItemSet& rSet ) else { const Fraction& rOldY = GetViewData().GetZoomY(); - sal_uInt16 nCurrentZoom = (sal_uInt16)long( rOldY * 100 ); + sal_uInt16 nCurrentZoom = static_cast<sal_uInt16>(long( rOldY * 100 )); if( nCurrentZoom ) { diff --git a/sc/source/ui/view/viewdata.cxx b/sc/source/ui/view/viewdata.cxx index a7fe6dc18ce8..90206529602e 100644 --- a/sc/source/ui/view/viewdata.cxx +++ b/sc/source/ui/view/viewdata.cxx @@ -514,8 +514,8 @@ ScViewData::ScViewData( ScDocShell* pDocSh, ScTabViewShell* pViewSh ) : SetHScrollMode ( true ); SetOutlineMode ( true ); - aScrSize = Size( (long) ( STD_COL_WIDTH * PIXEL_PER_TWIPS * OLE_STD_CELLS_X ), - (long) ( ScGlobal::nStdRowHeight * PIXEL_PER_TWIPS * OLE_STD_CELLS_Y ) ); + aScrSize = Size( long( STD_COL_WIDTH * PIXEL_PER_TWIPS * OLE_STD_CELLS_X ), + static_cast<long>( ScGlobal::nStdRowHeight * PIXEL_PER_TWIPS * OLE_STD_CELLS_Y ) ); maTabData.push_back( new ScViewDataTable ); pThisTab = maTabData[nTabNo]; for (sal_uInt16 j=0; j<4; j++) @@ -824,9 +824,9 @@ void ScViewData::SetZoom( const Fraction& rNewX, const Fraction& rNewY, std::vec // sanity check - we shouldn't need something this low / big SAL_WARN_IF(rNewX < Fraction(1, 100) || rNewX > Fraction(100, 1), "sc.viewdata", - "fraction rNewX not sensible: " << (double) rNewX); + "fraction rNewX not sensible: " << static_cast<double>(rNewX)); SAL_WARN_IF(rNewY < Fraction(1, 100) || rNewY > Fraction(100, 1), "sc.viewdata", - "fraction rNewY not sensible: " << (double) rNewY); + "fraction rNewY not sensible: " << static_cast<double>(rNewY)); if ( bAll ) { @@ -2043,7 +2043,7 @@ SCCOL ScViewData::CellsAtX( SCCOL nPosX, SCCOL nDir, ScHSplitPos eWhichX, sal_uI SCCOL nX; sal_uInt16 nScrPosX = 0; - if (nScrSizeX == SC_SIZE_NONE) nScrSizeX = (sal_uInt16) aScrSize.Width(); + if (nScrSizeX == SC_SIZE_NONE) nScrSizeX = static_cast<sal_uInt16>(aScrSize.Width()); if (nDir==1) nX = nPosX; // forwards @@ -2062,7 +2062,7 @@ SCCOL ScViewData::CellsAtX( SCCOL nPosX, SCCOL nDir, ScHSplitPos eWhichX, sal_uI if (nTSize) { long nSizeXPix = ToPixel( nTSize, nPPTX ); - nScrPosX = sal::static_int_cast<sal_uInt16>( nScrPosX + (sal_uInt16) nSizeXPix ); + nScrPosX = sal::static_int_cast<sal_uInt16>( nScrPosX + static_cast<sal_uInt16>(nSizeXPix) ); } } } @@ -2083,7 +2083,7 @@ SCROW ScViewData::CellsAtY( SCROW nPosY, SCROW nDir, ScVSplitPos eWhichY, sal_uI if (pView) const_cast<ScViewData*>(this)->aScrSize.Height() = pView->GetGridHeight(eWhichY); - if (nScrSizeY == SC_SIZE_NONE) nScrSizeY = (sal_uInt16) aScrSize.Height(); + if (nScrSizeY == SC_SIZE_NONE) nScrSizeY = static_cast<sal_uInt16>(aScrSize.Height()); SCROW nY; @@ -2316,7 +2316,7 @@ void ScViewData::SetPosX( ScHSplitPos eWhich, SCCOL nNewPosX ) pThisTab->nPosX[eWhich] = nNewPosX; pThisTab->nTPosX[eWhich] = nTPosX; - pThisTab->nMPosX[eWhich] = (long) (nTPosX * HMM_PER_TWIPS); + pThisTab->nMPosX[eWhich] = static_cast<long>(nTPosX * HMM_PER_TWIPS); pThisTab->nPixPosX[eWhich] = nPixPosX; } else @@ -2359,7 +2359,7 @@ void ScViewData::SetPosY( ScVSplitPos eWhich, SCROW nNewPosY ) pThisTab->nPosY[eWhich] = nNewPosY; pThisTab->nTPosY[eWhich] = nTPosY; - pThisTab->nMPosY[eWhich] = (long) (nTPosY * HMM_PER_TWIPS); + pThisTab->nMPosY[eWhich] = static_cast<long>(nTPosY * HMM_PER_TWIPS); pThisTab->nPixPosY[eWhich] = nPixPosY; } else @@ -2421,7 +2421,7 @@ void ScViewData::SetScreen( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ) if (nTSize) { nSizePix = ToPixel( nTSize, nPPTX ); - nScrPosX += (sal_uInt16) nSizePix; + nScrPosX += static_cast<sal_uInt16>(nSizePix); } } @@ -2431,7 +2431,7 @@ void ScViewData::SetScreen( SCCOL nCol1, SCROW nRow1, SCCOL nCol2, SCROW nRow2 ) if (nTSize) { nSizePix = ToPixel( nTSize, nPPTY ); - nScrPosY += (sal_uInt16) nSizePix; + nScrPosY += static_cast<sal_uInt16>(nSizePix); } } @@ -2446,14 +2446,14 @@ void ScViewData::SetScreenPos( const Point& rVisAreaStart ) bool bEnd; nSize = 0; - nTwips = (long) (rVisAreaStart.X() / HMM_PER_TWIPS); + nTwips = static_cast<long>(rVisAreaStart.X() / HMM_PER_TWIPS); if ( pDoc->IsLayoutRTL( nTabNo ) ) nTwips = -nTwips; SCCOL nX1 = 0; bEnd = false; while (!bEnd) { - nAdd = (long) pDoc->GetColWidth(nX1,nTabNo); + nAdd = static_cast<long>(pDoc->GetColWidth(nX1,nTabNo)); if (nSize+nAdd <= nTwips+1 && nX1<MAXCOL) { nSize += nAdd; @@ -2464,12 +2464,12 @@ void ScViewData::SetScreenPos( const Point& rVisAreaStart ) } nSize = 0; - nTwips = (long) (rVisAreaStart.Y() / HMM_PER_TWIPS); + nTwips = static_cast<long>(rVisAreaStart.Y() / HMM_PER_TWIPS); SCROW nY1 = 0; bEnd = false; while (!bEnd) { - nAdd = (long) pDoc->GetRowHeight(nY1,nTabNo); + nAdd = static_cast<long>(pDoc->GetRowHeight(nY1,nTabNo)); if (nSize+nAdd <= nTwips+1 && nY1<MAXROW) { nSize += nAdd; @@ -2494,10 +2494,8 @@ void ScViewData::SetScreen( const tools::Rectangle& rVisArea ) // here without GetOutputFactor(), since it's for the output into a Metafile aScrSize = rVisArea.GetSize(); - aScrSize.Width() = (long) - ( aScrSize.Width() * ScGlobal::nScreenPPTX / HMM_PER_TWIPS ); - aScrSize.Height() = (long) - ( aScrSize.Height() * ScGlobal::nScreenPPTY / HMM_PER_TWIPS ); + aScrSize.Width() = static_cast<long>( aScrSize.Width() * ScGlobal::nScreenPPTX / HMM_PER_TWIPS ); + aScrSize.Height() = static_cast<long>( aScrSize.Height() * ScGlobal::nScreenPPTY / HMM_PER_TWIPS ); } ScDocFunc& ScViewData::GetDocFunc() const @@ -2572,18 +2570,18 @@ void ScViewData::UpdateScreenZoom( const Fraction& rNewX, const Fraction& rNewY aHeight *= Fraction( aScrSize.Height(),1 ); aHeight /= aOldY; - aScrSize.Width() = (long) aWidth; - aScrSize.Height() = (long) aHeight; + aScrSize.Width() = static_cast<long>(aWidth); + aScrSize.Height() = static_cast<long>(aHeight); } void ScViewData::CalcPPT() { double nOldPPTX = nPPTX; double nOldPPTY = nPPTY; - nPPTX = ScGlobal::nScreenPPTX * (double) GetZoomX(); + nPPTX = ScGlobal::nScreenPPTX * static_cast<double>(GetZoomX()); if (pDocShell) nPPTX = nPPTX / pDocShell->GetOutputFactor(); // Factor is printer to screen - nPPTY = ScGlobal::nScreenPPTY * (double) GetZoomY(); + nPPTY = ScGlobal::nScreenPPTY * static_cast<double>(GetZoomY()); // if detective objects are present, // try to adjust horizontal scale so the most common column width has minimal rounding errors, @@ -2636,9 +2634,9 @@ void ScViewData::WriteUserData(OUString& rData) // PosX[left]/PosX[right]/PosY[top]/PosY[bottom] // when rows bigger than 8192, "+" instead of "/" - sal_uInt16 nZoom = (sal_uInt16)long(pThisTab->aZoomY * 100); + sal_uInt16 nZoom = static_cast<sal_uInt16>(long(pThisTab->aZoomY * 100)); rData = OUString::number( nZoom ) + "/"; - nZoom = (sal_uInt16)long(pThisTab->aPageZoomY * 100); + nZoom = static_cast<sal_uInt16>(long(pThisTab->aPageZoomY * 100)); rData += OUString::number( nZoom ) + "/"; if (bPagebreak) rData += "1"; @@ -2836,7 +2834,7 @@ void ScViewData::WriteExtOptions( ScExtDocOptions& rDocOpt ) const rSplitPos = Point( bHSplit ? pViewTab->nHSplitPos : 0, bVSplit ? pViewTab->nVSplitPos : 0 ); rSplitPos = Application::GetDefaultDevice()->PixelToLogic( rSplitPos, MapMode( MapUnit::MapTwip ) ); if( pDocShell ) - rSplitPos.X() = (long)((double)rSplitPos.X() / pDocShell->GetOutputFactor()); + rSplitPos.X() = static_cast<long>(static_cast<double>(rSplitPos.X()) / pDocShell->GetOutputFactor()); } else if( bFrozen ) { @@ -2976,7 +2974,7 @@ void ScViewData::ReadExtOptions( const ScExtDocOptions& rDocOpt ) if( pDocShell && SC_MOD()->GetInputOptions().GetTextWysiwyg()) { double nFactor = pDocShell->GetOutputFactor(); - aPixel.X() = (long)( aPixel.X() * nFactor + 0.5 ); + aPixel.X() = static_cast<long>( aPixel.X() * nFactor + 0.5 ); } bHSplit = bHSplit && aPixel.X() > 0; diff --git a/sc/source/ui/view/viewfun2.cxx b/sc/source/ui/view/viewfun2.cxx index e3ff5a013a01..729cad4210eb 100644 --- a/sc/source/ui/view/viewfun2.cxx +++ b/sc/source/ui/view/viewfun2.cxx @@ -174,7 +174,7 @@ bool ScViewFunc::AdjustRowHeight( SCROW nStartRow, SCROW nEndRow ) Fraction aZoomY = GetViewData().GetZoomY(); sal_uInt16 nOldPixel = 0; if (nStartRow == nEndRow) - nOldPixel = (sal_uInt16) (rDoc.GetRowHeight(nStartRow,nTab) * nPPTY); + nOldPixel = static_cast<sal_uInt16>(rDoc.GetRowHeight(nStartRow,nTab) * nPPTY); ScSizeDeviceProvider aProv(pDocSh); if (aProv.IsPrinter()) @@ -192,7 +192,7 @@ bool ScViewFunc::AdjustRowHeight( SCROW nStartRow, SCROW nEndRow ) if (bChanged && ( nStartRow == nEndRow )) { - sal_uInt16 nNewPixel = (sal_uInt16) (rDoc.GetRowHeight(nStartRow,nTab) * nPPTY); + sal_uInt16 nNewPixel = static_cast<sal_uInt16>(rDoc.GetRowHeight(nStartRow,nTab) * nPPTY); if ( nNewPixel == nOldPixel ) bChanged = false; } diff --git a/sc/source/ui/view/viewfun3.cxx b/sc/source/ui/view/viewfun3.cxx index dd038f35e242..4111afb66aac 100644 --- a/sc/source/ui/view/viewfun3.cxx +++ b/sc/source/ui/view/viewfun3.cxx @@ -609,12 +609,12 @@ void ScViewFunc::PasteFromTransferable( const uno::Reference<datatransfer::XTran { sal_Int64 nHandle = xTunnel->getSomething( ScTransferObj::getUnoTunnelId() ); if ( nHandle ) - pOwnClip = reinterpret_cast<ScTransferObj*>( (sal_IntPtr) nHandle); + pOwnClip = reinterpret_cast<ScTransferObj*>( static_cast<sal_IntPtr>(nHandle)); else { nHandle = xTunnel->getSomething( ScDrawTransferObj::getUnoTunnelId() ); if ( nHandle ) - pDrawClip = reinterpret_cast<ScDrawTransferObj*>( (sal_IntPtr) nHandle ); + pDrawClip = reinterpret_cast<ScDrawTransferObj*>( static_cast<sal_IntPtr>(nHandle) ); } } diff --git a/sc/source/ui/view/viewfun5.cxx b/sc/source/ui/view/viewfun5.cxx index 7a82ea88b9ea..3f4db0cfba59 100644 --- a/sc/source/ui/view/viewfun5.cxx +++ b/sc/source/ui/view/viewfun5.cxx @@ -97,7 +97,7 @@ bool ScViewFunc::PasteDataFormat( SotClipboardFormatId nFormatId, if (pDoc->IsNegativePage(nTab)) nXT = -nXT; sal_uLong nYT = pDoc->GetRowHeight( 0, nPosY-1, nTab); - aPos = Point( (long)(nXT * HMM_PER_TWIPS), (long)(nYT * HMM_PER_TWIPS) ); + aPos = Point( static_cast<long>(nXT * HMM_PER_TWIPS), static_cast<long>(nYT * HMM_PER_TWIPS) ); } } diff --git a/sc/source/ui/view/viewfunc.cxx b/sc/source/ui/view/viewfunc.cxx index 787d9f9a8352..3959bcd28348 100644 --- a/sc/source/ui/view/viewfunc.cxx +++ b/sc/source/ui/view/viewfunc.cxx @@ -305,7 +305,7 @@ static bool lcl_AddFunction( ScAppOptions& rAppOpt, sal_uInt16 nOpCode ) if ( !lcl_FunctionKnown( nOpCode ) ) return false; // not in function list -> no change - sal_uInt16 nNewCount = std::min( (sal_uInt16)(nOldCount + 1), (sal_uInt16)LRU_MAX ); + sal_uInt16 nNewCount = std::min( static_cast<sal_uInt16>(nOldCount + 1), sal_uInt16(LRU_MAX) ); sal_uInt16 nNewList[LRU_MAX]; nNewList[0] = nOpCode; for (nPos=1; nPos<nNewCount; nPos++) @@ -2372,7 +2372,7 @@ void ScViewFunc::ModifyCellSize( ScDirection eDir, bool bOptimal ) nMargin = sal::static_int_cast<sal_uInt16>( nMargin + pPattern->GetItem(ATTR_INDENT).GetValue() ); - nWidth = (sal_uInt16)(nEdit * pDocSh->GetOutputFactor() / HMM_PER_TWIPS) + nWidth = static_cast<sal_uInt16>(nEdit * pDocSh->GetOutputFactor() / HMM_PER_TWIPS) + nMargin + STD_EXTRA_WIDTH; } } @@ -2393,7 +2393,7 @@ void ScViewFunc::ModifyCellSize( ScDirection eDir, bool bOptimal ) long nPixel = rDoc.GetNeededSize( nCol, nRow, nTab, aProv.GetDevice(), nPPTX, nPPTY, aZoomX, aZoomY, true ); - sal_uInt16 nTwips = (sal_uInt16)( nPixel / nPPTX ); + sal_uInt16 nTwips = static_cast<sal_uInt16>( nPixel / nPPTX ); if (nTwips != 0) nWidth = nTwips + STD_EXTRA_WIDTH; else |