diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2018-01-12 20:13:55 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2018-01-12 20:13:55 +0100 |
commit | c049c76fc521f2b55b39a6e9eb0f0092bcf6ef77 (patch) | |
tree | 2bc2c059a6f6a175a0c0e5321887adc077fef419 /svx/source/svdraw | |
parent | 0ae2d98d1f6d29c80bd1ee830db4c333e4ee1e1d (diff) |
More loplugin:cstylecast: svx
auto-rewrite with <https://gerrit.libreoffice.org/#/c/47798/> "Enable
loplugin:cstylecast for some more cases" plus
solenv/clang-format/reformat-formatted-files
Change-Id: I100e6c14cbf1d780f0e5ebca6b0c9e71ce1caaf7
Diffstat (limited to 'svx/source/svdraw')
31 files changed, 231 insertions, 231 deletions
diff --git a/svx/source/svdraw/gradtrns.cxx b/svx/source/svdraw/gradtrns.cxx index 2672d25d700f..660f94b0d61b 100644 --- a/svx/source/svdraw/gradtrns.cxx +++ b/svx/source/svdraw/gradtrns.cxx @@ -33,7 +33,7 @@ void GradTransformer::GradToVec(GradTransGradient const & rG, GradTransVector& r rV.aCol1 = rG.aGradient.GetStartColor(); if(100 != rG.aGradient.GetStartIntens()) { - const double fFact((double)rG.aGradient.GetStartIntens() / 100.0); + const double fFact(static_cast<double>(rG.aGradient.GetStartIntens()) / 100.0); rV.aCol1 = Color(rV.aCol1.getBColor() * fFact); } @@ -41,7 +41,7 @@ void GradTransformer::GradToVec(GradTransGradient const & rG, GradTransVector& r rV.aCol2 = rG.aGradient.GetEndColor(); if(100 != rG.aGradient.GetEndIntens()) { - const double fFact((double)rG.aGradient.GetEndIntens() / 100.0); + const double fFact(static_cast<double>(rG.aGradient.GetEndIntens()) / 100.0); rV.aCol2 = Color(rV.aCol2.getBColor() * fFact); } @@ -61,14 +61,14 @@ void GradTransformer::GradToVec(GradTransGradient const & rG, GradTransVector& r if(rG.aGradient.GetBorder()) { basegfx::B2DVector aFullVec(aStartPos - aEndPos); - const double fLen = (aFullVec.getLength() * (100.0 - (double)rG.aGradient.GetBorder())) / 100.0; + const double fLen = (aFullVec.getLength() * (100.0 - static_cast<double>(rG.aGradient.GetBorder()))) / 100.0; aFullVec.normalize(); aStartPos = aEndPos + (aFullVec * fLen); } if(rG.aGradient.GetAngle()) { - const double fAngle = (double)rG.aGradient.GetAngle() * (F_PI180 / 10.0); + const double fAngle = static_cast<double>(rG.aGradient.GetAngle()) * (F_PI180 / 10.0); const basegfx::B2DHomMatrix aTransformation(basegfx::utils::createRotateAroundPoint(aCenter, -fAngle)); aStartPos *= aTransformation; @@ -84,14 +84,14 @@ void GradTransformer::GradToVec(GradTransGradient const & rG, GradTransVector& r if(rG.aGradient.GetBorder()) { basegfx::B2DVector aFullVec(aEndPos - aStartPos); - const double fLen = (aFullVec.getLength() * (100.0 - (double)rG.aGradient.GetBorder())) / 100.0; + const double fLen = (aFullVec.getLength() * (100.0 - static_cast<double>(rG.aGradient.GetBorder()))) / 100.0; aFullVec.normalize(); aEndPos = aStartPos + (aFullVec * fLen); } if(rG.aGradient.GetAngle()) { - const double fAngle = (double)rG.aGradient.GetAngle() * (F_PI180 / 10.0); + const double fAngle = static_cast<double>(rG.aGradient.GetAngle()) * (F_PI180 / 10.0); const basegfx::B2DHomMatrix aTransformation(basegfx::utils::createRotateAroundPoint(aCenter, -fAngle)); aStartPos *= aTransformation; @@ -108,14 +108,14 @@ void GradTransformer::GradToVec(GradTransGradient const & rG, GradTransVector& r if(rG.aGradient.GetBorder()) { basegfx::B2DVector aFullVec(aStartPos - aEndPos); - const double fLen = (aFullVec.getLength() * (100.0 - (double)rG.aGradient.GetBorder())) / 100.0; + const double fLen = (aFullVec.getLength() * (100.0 - static_cast<double>(rG.aGradient.GetBorder()))) / 100.0; aFullVec.normalize(); aStartPos = aEndPos + (aFullVec * fLen); } if(rG.aGradient.GetAngle()) { - const double fAngle = (double)rG.aGradient.GetAngle() * (F_PI180 / 10.0); + const double fAngle = static_cast<double>(rG.aGradient.GetAngle()) * (F_PI180 / 10.0); const basegfx::B2DHomMatrix aTransformation(basegfx::utils::createRotateAroundPoint(aEndPos, -fAngle)); aStartPos *= aTransformation; @@ -143,14 +143,14 @@ void GradTransformer::GradToVec(GradTransGradient const & rG, GradTransVector& r if(rG.aGradient.GetBorder()) { basegfx::B2DVector aFullVec(aStartPos - aEndPos); - const double fLen = (aFullVec.getLength() * (100.0 - (double)rG.aGradient.GetBorder())) / 100.0; + const double fLen = (aFullVec.getLength() * (100.0 - static_cast<double>(rG.aGradient.GetBorder()))) / 100.0; aFullVec.normalize(); aStartPos = aEndPos + (aFullVec * fLen); } if(rG.aGradient.GetAngle()) { - const double fAngle = (double)rG.aGradient.GetAngle() * (F_PI180 / 10.0); + const double fAngle = static_cast<double>(rG.aGradient.GetAngle()) * (F_PI180 / 10.0); const basegfx::B2DHomMatrix aTransformation(basegfx::utils::createRotateAroundPoint(aEndPos, -fAngle)); aStartPos *= aTransformation; @@ -269,7 +269,7 @@ void GradTransformer::VecToGrad(GradTransVector const & rV, GradTransGradient& r // set if(nNewBorder != rG.aGradient.GetBorder()) { - rG.aGradient.SetBorder((sal_uInt16)nNewBorder); + rG.aGradient.SetBorder(static_cast<sal_uInt16>(nNewBorder)); } } @@ -300,7 +300,7 @@ void GradTransformer::VecToGrad(GradTransVector const & rV, GradTransGradient& r // set if(nNewBorder != rG.aGradient.GetBorder()) { - rG.aGradient.SetBorder((sal_uInt16)nNewBorder); + rG.aGradient.SetBorder(static_cast<sal_uInt16>(nNewBorder)); } aFullVec.normalize(); @@ -362,8 +362,8 @@ void GradTransformer::VecToGrad(GradTransVector const & rV, GradTransGradient& r nNewYOffset = 100; } - rG.aGradient.SetXOffset((sal_uInt16)nNewXOffset); - rG.aGradient.SetYOffset((sal_uInt16)nNewYOffset); + rG.aGradient.SetXOffset(static_cast<sal_uInt16>(nNewXOffset)); + rG.aGradient.SetYOffset(static_cast<sal_uInt16>(nNewYOffset)); aStartPos -= aOffset; aEndPos -= aOffset; @@ -394,7 +394,7 @@ void GradTransformer::VecToGrad(GradTransVector const & rV, GradTransGradient& r // set if(nNewBorder != rG.aGradient.GetBorder()) { - rG.aGradient.SetBorder((sal_uInt16)nNewBorder); + rG.aGradient.SetBorder(static_cast<sal_uInt16>(nNewBorder)); } // angle is not definitely necessary for these modes, but it makes @@ -458,8 +458,8 @@ void GradTransformer::VecToGrad(GradTransVector const & rV, GradTransGradient& r nNewYOffset = 100; } - rG.aGradient.SetXOffset((sal_uInt16)nNewXOffset); - rG.aGradient.SetYOffset((sal_uInt16)nNewYOffset); + rG.aGradient.SetXOffset(static_cast<sal_uInt16>(nNewXOffset)); + rG.aGradient.SetYOffset(static_cast<sal_uInt16>(nNewYOffset)); aStartPos -= aOffset; aEndPos -= aOffset; @@ -490,7 +490,7 @@ void GradTransformer::VecToGrad(GradTransVector const & rV, GradTransGradient& r // set if(nNewBorder != rG.aGradient.GetBorder()) { - rG.aGradient.SetBorder((sal_uInt16)nNewBorder); + rG.aGradient.SetBorder(static_cast<sal_uInt16>(nNewBorder)); } // angle is not definitely necessary for these modes, but it makes diff --git a/svx/source/svdraw/svdattr.cxx b/svx/source/svdraw/svdattr.cxx index af28e4d9cafb..c2797daf43e9 100644 --- a/svx/source/svdraw/svdattr.cxx +++ b/svx/source/svdraw/svdattr.cxx @@ -1626,7 +1626,7 @@ bool SdrMeasureUnitItem::GetPresentation(SfxItemPresentation ePres, bool SdrMeasureUnitItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const { - rVal <<= (sal_Int32)GetValue(); + rVal <<= static_cast<sal_Int32>(GetValue()); return true; } @@ -1750,7 +1750,7 @@ SfxPoolItem* SdrGrafGamma100Item::Clone( SfxItemPool* /*pPool */) const bool SdrGrafGamma100Item::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/) const { - rVal <<= ((double)GetValue()) / 100.0; + rVal <<= static_cast<double>(GetValue()) / 100.0; return true; } @@ -1760,7 +1760,7 @@ bool SdrGrafGamma100Item::PutValue( const uno::Any& rVal, sal_uInt8 /*nMemberId* if(!(rVal >>= nGamma)) return false; - SetValue( (sal_uInt32)(nGamma * 100.0 ) ); + SetValue( static_cast<sal_uInt32>(nGamma * 100.0 ) ); return true; } diff --git a/svx/source/svdraw/svddrgmt.cxx b/svx/source/svdraw/svddrgmt.cxx index 536c27e1b271..3ba7c41b8b6b 100644 --- a/svx/source/svdraw/svddrgmt.cxx +++ b/svx/source/svdraw/svddrgmt.cxx @@ -2840,8 +2840,8 @@ basegfx::B2DPolyPolygon impCreateDragRaster(SdrPageView const & rPageView, const if(nVerDiv < DRAG_CROOK_RASTER_MINIMUM) nVerDiv = DRAG_CROOK_RASTER_MINIMUM; - const double fXLen(rMarkRect.GetWidth() / (double)nHorDiv); - const double fYLen(rMarkRect.GetHeight() / (double)nVerDiv); + const double fXLen(rMarkRect.GetWidth() / static_cast<double>(nHorDiv)); + const double fYLen(rMarkRect.GetHeight() / static_cast<double>(nVerDiv)); double fYPos(rMarkRect.Top()); sal_uInt32 a, b; @@ -3158,15 +3158,15 @@ void SdrDragCrook::MoveSdrDrag(const Point& rPnt) if (bVertical) { - a=((double)dy1)/((double)dx1); // slope of the radius - nNeuRad=((long)(dy1*a)+dx1) /2; + a=static_cast<double>(dy1)/static_cast<double>(dx1); // slope of the radius + nNeuRad=(static_cast<long>(dy1*a)+dx1) /2; aNeuCenter.X()+=nNeuRad; nPntWink=GetAngle(aPnt-aNeuCenter); } else { - a=((double)dx1)/((double)dy1); // slope of the radius - nNeuRad=((long)(dx1*a)+dy1) /2; + a=static_cast<double>(dx1)/static_cast<double>(dy1); // slope of the radius + nNeuRad=(static_cast<long>(dx1*a)+dy1) /2; aNeuCenter.Y()+=nNeuRad; nPntWink=GetAngle(aPnt-aNeuCenter)-9000; } @@ -3200,7 +3200,7 @@ void SdrDragCrook::MoveSdrDrag(const Point& rPnt) if (bResize) { - long nMul=(long)(nUmfang*NormAngle360(nPntWink)/36000); + long nMul=static_cast<long>(nUmfang*NormAngle360(nPntWink)/36000); if (bAtCenter) nMul*=2; @@ -3210,7 +3210,7 @@ void SdrDragCrook::MoveSdrDrag(const Point& rPnt) } else { - nAngle=(long)((nMarkSize*360/nUmfang)*100)/2; + nAngle=static_cast<long>((nMarkSize*360/nUmfang)*100)/2; if (nAngle==0) bValid=false; @@ -3841,8 +3841,8 @@ bool SdrDragCrop::EndSdrDrag(bool /*bCopy*/) } const SdrGrafCropItem& rOldCrop = pObj->GetMergedItem(SDRATTR_GRAFCROP); - double fScaleX = ( aGraphicSize.Width() - rOldCrop.GetLeft() - rOldCrop.GetRight() ) / (double)aOldRect.GetWidth(); - double fScaleY = ( aGraphicSize.Height() - rOldCrop.GetTop() - rOldCrop.GetBottom() ) / (double)aOldRect.GetHeight(); + double fScaleX = ( aGraphicSize.Width() - rOldCrop.GetLeft() - rOldCrop.GetRight() ) / static_cast<double>(aOldRect.GetWidth()); + double fScaleY = ( aGraphicSize.Height() - rOldCrop.GetTop() - rOldCrop.GetBottom() ) / static_cast<double>(aOldRect.GetHeight()); sal_Int32 nDiffLeft = aNewRect.Left() - aOldRect.Left(); sal_Int32 nDiffTop = aNewRect.Top() - aOldRect.Top(); diff --git a/svx/source/svdraw/svdedtv1.cxx b/svx/source/svdraw/svdedtv1.cxx index beb208537ad3..53da7eb8e21f 100644 --- a/svx/source/svdraw/svdedtv1.cxx +++ b/svx/source/svdraw/svdedtv1.cxx @@ -515,13 +515,13 @@ void SdrEditView::ImpCrookObj(SdrObject* pO, const Point& rRef, const Point& rRa { // for PolyObj's, but NOT for SdrPathObj's, e.g. the measurement object sal_uInt32 nPointCount(pO->GetPointCount()); - XPolygon aXP((sal_uInt16)nPointCount); + XPolygon aXP(static_cast<sal_uInt16>(nPointCount)); sal_uInt32 nPtNum; for(nPtNum = 0; nPtNum < nPointCount; nPtNum++) { Point aPt(pO->GetPoint(nPtNum)); - aXP[(sal_uInt16)nPtNum]=aPt; + aXP[static_cast<sal_uInt16>(nPtNum)]=aPt; } switch (eMode) @@ -535,7 +535,7 @@ void SdrEditView::ImpCrookObj(SdrObject* pO, const Point& rRef, const Point& rRa { // broadcasting could be optimized here, but for the // current two points of the measurement object, it's fine - pO->SetPoint(aXP[(sal_uInt16)nPtNum],nPtNum); + pO->SetPoint(aXP[static_cast<sal_uInt16>(nPtNum)],nPtNum); } bDone = true; @@ -629,13 +629,13 @@ void SdrEditView::ImpDistortObj(SdrObject* pO, const tools::Rectangle& rRef, con { // e. g. for the measurement object sal_uInt32 nPointCount(pO->GetPointCount()); - XPolygon aXP((sal_uInt16)nPointCount); + XPolygon aXP(static_cast<sal_uInt16>(nPointCount)); sal_uInt32 nPtNum; for(nPtNum = 0; nPtNum < nPointCount; nPtNum++) { Point aPt(pO->GetPoint(nPtNum)); - aXP[(sal_uInt16)nPtNum]=aPt; + aXP[static_cast<sal_uInt16>(nPtNum)]=aPt; } aXP.Distort(rRef, rDistortedRect); @@ -644,7 +644,7 @@ void SdrEditView::ImpDistortObj(SdrObject* pO, const tools::Rectangle& rRef, con { // broadcasting could be optimized here, but for the // current two points of the measurement object it's fine - pO->SetPoint(aXP[(sal_uInt16)nPtNum],nPtNum); + pO->SetPoint(aXP[static_cast<sal_uInt16>(nPtNum)],nPtNum); } } } @@ -1097,7 +1097,7 @@ void SdrEditView::SetAttrToMarked(const SfxItemSet& rAttr, bool bReplaceAll) if(SfxItemState::DONTCARE != rSet.GetItemState(XATTR_LINESTARTWIDTH)) { const sal_Int32 nValAct(rSet.Get(XATTR_LINESTARTWIDTH).GetValue()); - const sal_Int32 nValNewStart(std::max((sal_Int32)0, nValAct + (((nNewLineWidth - nOldLineWidth) * 15) / 10))); + const sal_Int32 nValNewStart(std::max(sal_Int32(0), nValAct + (((nNewLineWidth - nOldLineWidth) * 15) / 10))); pObj->SetMergedItem(XLineStartWidthItem(nValNewStart)); } @@ -1105,7 +1105,7 @@ void SdrEditView::SetAttrToMarked(const SfxItemSet& rAttr, bool bReplaceAll) if(SfxItemState::DONTCARE != rSet.GetItemState(XATTR_LINEENDWIDTH)) { const sal_Int32 nValAct(rSet.Get(XATTR_LINEENDWIDTH).GetValue()); - const sal_Int32 nValNewEnd(std::max((sal_Int32)0, nValAct + (((nNewLineWidth - nOldLineWidth) * 15) / 10))); + const sal_Int32 nValNewEnd(std::max(sal_Int32(0), nValAct + (((nNewLineWidth - nOldLineWidth) * 15) / 10))); pObj->SetMergedItem(XLineEndWidthItem(nValNewEnd)); } @@ -1542,8 +1542,8 @@ void SdrEditView::SetGeoAttrToMarked(const SfxItemSet& rAttr) } else { if (nNewShearAngle!=0 && nOldShearAngle!=0) { // bug fix - double nOld=tan((double)nOldShearAngle*nPi180); - double nNew=tan((double)nNewShearAngle*nPi180); + double nOld=tan(static_cast<double>(nOldShearAngle)*nPi180); + double nNew=tan(static_cast<double>(nNewShearAngle)*nPi180); nNew-=nOld; nNew=atan(nNew)/nPi180; nShearAngle=svx::Round(nNew); diff --git a/svx/source/svdraw/svdedtv2.cxx b/svx/source/svdraw/svdedtv2.cxx index 5d5e7dfaa631..1ebde1442249 100644 --- a/svx/source/svdraw/svdedtv2.cxx +++ b/svx/source/svdraw/svdedtv2.cxx @@ -840,35 +840,35 @@ void SdrEditView::DistributeMarkedObjects() { // calculate room in-between sal_Int32 nWidth = GetAllMarkedBoundRect().GetWidth() + 1; - double fStepWidth = ((double)nWidth - (double)nFullLength) / (double)(aEntryList.size() - 1); - double fStepStart = (double)aEntryList[ 0 ]->mnPos; - fStepStart += fStepWidth + (double)((aEntryList[ 0 ]->mnLength + aEntryList[ 1 ]->mnLength) / 2); + double fStepWidth = (static_cast<double>(nWidth) - static_cast<double>(nFullLength)) / static_cast<double>(aEntryList.size() - 1); + double fStepStart = static_cast<double>(aEntryList[ 0 ]->mnPos); + fStepStart += fStepWidth + static_cast<double>((aEntryList[ 0 ]->mnLength + aEntryList[ 1 ]->mnLength) / 2); // move entries 1..n-1 for( size_t i = 1, n = aEntryList.size()-1; i < n; ++i ) { ImpDistributeEntry* pCurr = aEntryList[ i ]; ImpDistributeEntry* pNext = aEntryList[ i + 1]; - sal_Int32 nDelta = (sal_Int32)(fStepStart + 0.5) - pCurr->mnPos; + sal_Int32 nDelta = static_cast<sal_Int32>(fStepStart + 0.5) - pCurr->mnPos; if( bUndo ) AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pCurr->mpObj)); pCurr->mpObj->Move(Size(nDelta, 0)); - fStepStart += fStepWidth + (double)((pCurr->mnLength + pNext->mnLength) / 2); + fStepStart += fStepWidth + static_cast<double>((pCurr->mnLength + pNext->mnLength) / 2); } } else { // calculate distances sal_Int32 nWidth = aEntryList[ aEntryList.size() - 1 ]->mnPos - aEntryList[ 0 ]->mnPos; - double fStepWidth = (double)nWidth / (double)(aEntryList.size() - 1); - double fStepStart = (double)aEntryList[ 0 ]->mnPos; + double fStepWidth = static_cast<double>(nWidth) / static_cast<double>(aEntryList.size() - 1); + double fStepStart = static_cast<double>(aEntryList[ 0 ]->mnPos); fStepStart += fStepWidth; // move entries 1..n-1 for( size_t i = 1 ; i < aEntryList.size()-1 ; ++i ) { ImpDistributeEntry* pCurr = aEntryList[ i ]; - sal_Int32 nDelta = (sal_Int32)(fStepStart + 0.5) - pCurr->mnPos; + sal_Int32 nDelta = static_cast<sal_Int32>(fStepStart + 0.5) - pCurr->mnPos; if( bUndo ) AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pCurr->mpObj)); pCurr->mpObj->Move(Size(nDelta, 0)); @@ -935,35 +935,35 @@ void SdrEditView::DistributeMarkedObjects() { // calculate room in-between sal_Int32 nHeight = GetAllMarkedBoundRect().GetHeight() + 1; - double fStepWidth = ((double)nHeight - (double)nFullLength) / (double)(aEntryList.size() - 1); - double fStepStart = (double)aEntryList[ 0 ]->mnPos; - fStepStart += fStepWidth + (double)((aEntryList[ 0 ]->mnLength + aEntryList[ 1 ]->mnLength) / 2); + double fStepWidth = (static_cast<double>(nHeight) - static_cast<double>(nFullLength)) / static_cast<double>(aEntryList.size() - 1); + double fStepStart = static_cast<double>(aEntryList[ 0 ]->mnPos); + fStepStart += fStepWidth + static_cast<double>((aEntryList[ 0 ]->mnLength + aEntryList[ 1 ]->mnLength) / 2); // move entries 1..n-1 for( size_t i = 1, n = aEntryList.size()-1; i < n; ++i) { ImpDistributeEntry* pCurr = aEntryList[ i ]; ImpDistributeEntry* pNext = aEntryList[ i + 1 ]; - sal_Int32 nDelta = (sal_Int32)(fStepStart + 0.5) - pCurr->mnPos; + sal_Int32 nDelta = static_cast<sal_Int32>(fStepStart + 0.5) - pCurr->mnPos; if( bUndo ) AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pCurr->mpObj)); pCurr->mpObj->Move(Size(0, nDelta)); - fStepStart += fStepWidth + (double)((pCurr->mnLength + pNext->mnLength) / 2); + fStepStart += fStepWidth + static_cast<double>((pCurr->mnLength + pNext->mnLength) / 2); } } else { // calculate distances sal_Int32 nHeight = aEntryList[ aEntryList.size() - 1 ]->mnPos - aEntryList[ 0 ]->mnPos; - double fStepWidth = (double)nHeight / (double)(aEntryList.size() - 1); - double fStepStart = (double)aEntryList[ 0 ]->mnPos; + double fStepWidth = static_cast<double>(nHeight) / static_cast<double>(aEntryList.size() - 1); + double fStepStart = static_cast<double>(aEntryList[ 0 ]->mnPos); fStepStart += fStepWidth; // move entries 1..n-1 for(size_t i = 1, n = aEntryList.size()-1; i < n; ++i) { ImpDistributeEntry* pCurr = aEntryList[ i ]; - sal_Int32 nDelta = (sal_Int32)(fStepStart + 0.5) - pCurr->mnPos; + sal_Int32 nDelta = static_cast<sal_Int32>(fStepStart + 0.5) - pCurr->mnPos; if( bUndo ) AddUndo(GetModel()->GetSdrUndoFactory().CreateUndoGeoObject(*pCurr->mpObj)); pCurr->mpObj->Move(Size(0, nDelta)); diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx index 72938cf77f26..c22e0d410939 100644 --- a/svx/source/svdraw/svdedxv.cxx +++ b/svx/source/svdraw/svdedxv.cxx @@ -1236,7 +1236,7 @@ bool SdrObjEditView::SdrBeginTextEdit( if(&rOutDev != pWin && OUTDEV_WINDOW == rOutDev.GetOutDevType()) { OutlinerView* pOutlView = ImpMakeOutlinerView(static_cast<vcl::Window*>(&rOutDev), nullptr); - pTextEditOutliner->InsertView(pOutlView, (sal_uInt16)i); + pTextEditOutliner->InsertView(pOutlView, static_cast<sal_uInt16>(i)); } } @@ -1689,7 +1689,7 @@ bool SdrObjEditView::IsTextEditHit(const Point& rHit) const if( pRef ) nHitTol = OutputDevice::LogicToLogic( nHitTol, MapUnit::Map100thMM, pRef->GetMapMode().GetMapUnit() ); - bOk = pTextEditOutliner->IsTextPos( aPnt, (sal_uInt16)nHitTol ); + bOk = pTextEditOutliner->IsTextPos( aPnt, static_cast<sal_uInt16>(nHitTol) ); } } return bOk; diff --git a/svx/source/svdraw/svdfmtf.cxx b/svx/source/svdraw/svdfmtf.cxx index 3e4775056414..ba272a204c52 100644 --- a/svx/source/svdraw/svdfmtf.cxx +++ b/svx/source/svdraw/svdfmtf.cxx @@ -225,12 +225,12 @@ size_t ImpSdrGDIMetaFileImport::DoImport( if(aMtfSize.Width() != (maScaleRect.GetWidth() - 1)) { - mfScaleX = (double)( maScaleRect.GetWidth() - 1 ) / (double)aMtfSize.Width(); + mfScaleX = static_cast<double>( maScaleRect.GetWidth() - 1 ) / static_cast<double>(aMtfSize.Width()); } if(aMtfSize.Height() != (maScaleRect.GetHeight() - 1)) { - mfScaleY = (double)( maScaleRect.GetHeight() - 1 ) / (double)aMtfSize.Height(); + mfScaleY = static_cast<double>( maScaleRect.GetHeight() - 1 ) / static_cast<double>(aMtfSize.Height()); } } @@ -579,8 +579,8 @@ void ImpSdrGDIMetaFileImport::InsertObj(SdrObject* pObj, bool bScale) basegfx::fround(floor(std::max(0.0, aPixel.getMinX()))), basegfx::fround(floor(std::max(0.0, aPixel.getMinY())))); const Size aClipSize( - basegfx::fround(ceil(std::min((double)aOrigSizePixel.Width(), aPixel.getWidth()))), - basegfx::fround(ceil(std::min((double)aOrigSizePixel.Height(), aPixel.getHeight())))); + basegfx::fround(ceil(std::min(static_cast<double>(aOrigSizePixel.Width()), aPixel.getWidth()))), + basegfx::fround(ceil(std::min(static_cast<double>(aOrigSizePixel.Height()), aPixel.getHeight())))); const BitmapEx aClippedBitmap( aBitmapEx, aClipTopLeft, @@ -977,8 +977,8 @@ void ImpSdrGDIMetaFileImport::ImportText( const Point& rPos, const OUString& rSt vcl::Font aFnt( mpVD->GetFont() ); FontAlign eAlg( aFnt.GetAlignment() ); - sal_Int32 nTextWidth = (sal_Int32)( mpVD->GetTextWidth( rStr ) * mfScaleX ); - sal_Int32 nTextHeight = (sal_Int32)( mpVD->GetTextHeight() * mfScaleY ); + sal_Int32 nTextWidth = static_cast<sal_Int32>( mpVD->GetTextWidth( rStr ) * mfScaleX ); + sal_Int32 nTextHeight = static_cast<sal_Int32>( mpVD->GetTextHeight() * mfScaleY ); Point aPos( FRound(rPos.X() * mfScaleX + maOfs.X()), FRound(rPos.Y() * mfScaleY + maOfs.Y()) ); Size aSize( nTextWidth, nTextHeight ); @@ -1490,12 +1490,12 @@ void ImpSdrGDIMetaFileImport::DoAction(MetaFloatTransparentAction const & rAct) if(100 != rGradient.GetStartIntensity()) { - aStart *= (double)rGradient.GetStartIntensity() / 100.0; + aStart *= static_cast<double>(rGradient.GetStartIntensity()) / 100.0; } if(100 != rGradient.GetEndIntensity()) { - aEnd *= (double)rGradient.GetEndIntensity() / 100.0; + aEnd *= static_cast<double>(rGradient.GetEndIntensity()) / 100.0; } const bool bEqualColors(aStart == aEnd); diff --git a/svx/source/svdraw/svdhdl.cxx b/svx/source/svdraw/svdhdl.cxx index ef9634ad0800..6a46dd1f4a18 100644 --- a/svx/source/svdraw/svdhdl.cxx +++ b/svx/source/svdraw/svdhdl.cxx @@ -871,17 +871,17 @@ sdr::overlay::OverlayObject* SdrHdl::CreateOverlayObject( { // AnchorTR for SW, take top right as (0,0) pRetval = new sdr::overlay::OverlayAnimatedBitmapEx(rPos, aBmpEx1, aBmpEx2, nBlinkTime, - (sal_uInt16)(aBmpEx1.GetSizePixel().Width() - 1), 0, - (sal_uInt16)(aBmpEx2.GetSizePixel().Width() - 1), 0); + static_cast<sal_uInt16>(aBmpEx1.GetSizePixel().Width() - 1), 0, + static_cast<sal_uInt16>(aBmpEx2.GetSizePixel().Width() - 1), 0); } else { // create centered handle as default pRetval = new sdr::overlay::OverlayAnimatedBitmapEx(rPos, aBmpEx1, aBmpEx2, nBlinkTime, - (sal_uInt16)(aBmpEx1.GetSizePixel().Width() - 1) >> 1, - (sal_uInt16)(aBmpEx1.GetSizePixel().Height() - 1) >> 1, - (sal_uInt16)(aBmpEx2.GetSizePixel().Width() - 1) >> 1, - (sal_uInt16)(aBmpEx2.GetSizePixel().Height() - 1) >> 1); + static_cast<sal_uInt16>(aBmpEx1.GetSizePixel().Width() - 1) >> 1, + static_cast<sal_uInt16>(aBmpEx1.GetSizePixel().Height() - 1) >> 1, + static_cast<sal_uInt16>(aBmpEx2.GetSizePixel().Width() - 1) >> 1, + static_cast<sal_uInt16>(aBmpEx2.GetSizePixel().Height() - 1) >> 1); } } else @@ -911,12 +911,12 @@ sdr::overlay::OverlayObject* SdrHdl::CreateOverlayObject( { // AnchorTR for SW, take top right as (0,0) pRetval = new sdr::overlay::OverlayBitmapEx(rPos, aBmpEx, - (sal_uInt16)(aBmpEx.GetSizePixel().Width() - 1), 0); + static_cast<sal_uInt16>(aBmpEx.GetSizePixel().Width() - 1), 0); } else { - sal_uInt16 nCenX((sal_uInt16)(aBmpEx.GetSizePixel().Width() - 1) >> 1); - sal_uInt16 nCenY((sal_uInt16)(aBmpEx.GetSizePixel().Height() - 1) >> 1); + sal_uInt16 nCenX(static_cast<sal_uInt16>(aBmpEx.GetSizePixel().Width() - 1) >> 1); + sal_uInt16 nCenY(static_cast<sal_uInt16>(aBmpEx.GetSizePixel().Height() - 1) >> 1); if(aMoveOutsideOffset.X() > 0) { @@ -924,7 +924,7 @@ sdr::overlay::OverlayObject* SdrHdl::CreateOverlayObject( } else if(aMoveOutsideOffset.X() < 0) { - nCenX = (sal_uInt16)(aBmpEx.GetSizePixel().Width() - 1); + nCenX = static_cast<sal_uInt16>(aBmpEx.GetSizePixel().Width() - 1); } if(aMoveOutsideOffset.Y() > 0) @@ -933,7 +933,7 @@ sdr::overlay::OverlayObject* SdrHdl::CreateOverlayObject( } else if(aMoveOutsideOffset.Y() < 0) { - nCenY = (sal_uInt16)(aBmpEx.GetSizePixel().Height() - 1); + nCenY = static_cast<sal_uInt16>(aBmpEx.GetSizePixel().Height() - 1); } // create centered handle as default @@ -986,7 +986,7 @@ Pointer SdrHdl::GetPointer() const while (nHdlAngle<0) nHdlAngle+=36000; while (nHdlAngle>=36000) nHdlAngle-=36000; nHdlAngle/=4500; - switch ((sal_uInt8)nHdlAngle) { + switch (static_cast<sal_uInt8>(nHdlAngle)) { case 0: ePtr=PointerStyle::ESize; break; case 1: ePtr=PointerStyle::NESize; break; case 2: ePtr=PointerStyle::NSize; break; @@ -1120,8 +1120,8 @@ void SdrHdlColor::CreateB2dIAObject() sdr::overlay::OverlayBitmapEx( aPosition, BitmapEx(aBmpCol), - (sal_uInt16)(aBmpCol.GetSizePixel().Width() - 1) >> 1, - (sal_uInt16)(aBmpCol.GetSizePixel().Height() - 1) >> 1 + static_cast<sal_uInt16>(aBmpCol.GetSizePixel().Width() - 1) >> 1, + static_cast<sal_uInt16>(aBmpCol.GetSizePixel().Height() - 1) >> 1 ); // OVERLAYMANAGER @@ -1160,18 +1160,18 @@ Bitmap SdrHdlColor::CreateColorDropper(Color aCol) // draw lighter UpperLeft const Color aLightColor( - (sal_uInt8)(::std::min((sal_Int16)((sal_Int16)aCol.GetRed() + (sal_Int16)0x0040), (sal_Int16)0x00ff)), - (sal_uInt8)(::std::min((sal_Int16)((sal_Int16)aCol.GetGreen() + (sal_Int16)0x0040), (sal_Int16)0x00ff)), - (sal_uInt8)(::std::min((sal_Int16)((sal_Int16)aCol.GetBlue() + (sal_Int16)0x0040), (sal_Int16)0x00ff))); + static_cast<sal_uInt8>(::std::min(static_cast<sal_Int16>(static_cast<sal_Int16>(aCol.GetRed()) + sal_Int16(0x0040)), sal_Int16(0x00ff))), + static_cast<sal_uInt8>(::std::min(static_cast<sal_Int16>(static_cast<sal_Int16>(aCol.GetGreen()) + sal_Int16(0x0040)), sal_Int16(0x00ff))), + static_cast<sal_uInt8>(::std::min(static_cast<sal_Int16>(static_cast<sal_Int16>(aCol.GetBlue()) + sal_Int16(0x0040)), sal_Int16(0x00ff)))); pWrite->SetLineColor(aLightColor); pWrite->DrawLine(Point(1, 1), Point(1, nHeight - 2)); pWrite->DrawLine(Point(2, 1), Point(nWidth - 2, 1)); // draw darker LowerRight const Color aDarkColor( - (sal_uInt8)(::std::max((sal_Int16)((sal_Int16)aCol.GetRed() - (sal_Int16)0x0040), (sal_Int16)0x0000)), - (sal_uInt8)(::std::max((sal_Int16)((sal_Int16)aCol.GetGreen() - (sal_Int16)0x0040), (sal_Int16)0x0000)), - (sal_uInt8)(::std::max((sal_Int16)((sal_Int16)aCol.GetBlue() - (sal_Int16)0x0040), (sal_Int16)0x0000))); + static_cast<sal_uInt8>(::std::max(static_cast<sal_Int16>(static_cast<sal_Int16>(aCol.GetRed()) - sal_Int16(0x0040)), sal_Int16(0x0000))), + static_cast<sal_uInt8>(::std::max(static_cast<sal_Int16>(static_cast<sal_Int16>(aCol.GetGreen()) - sal_Int16(0x0040)), sal_Int16(0x0000))), + static_cast<sal_uInt8>(::std::max(static_cast<sal_Int16>(static_cast<sal_Int16>(aCol.GetBlue()) - sal_Int16(0x0040)), sal_Int16(0x0000)))); pWrite->SetLineColor(aDarkColor); pWrite->DrawLine(Point(2, nHeight - 2), Point(nWidth - 2, nHeight - 2)); pWrite->DrawLine(Point(nWidth - 2, 2), Point(nWidth - 2, nHeight - 3)); @@ -1276,8 +1276,8 @@ void SdrHdlGradient::CreateB2dIAObject() double fHalfArrowWidth = (0.05 * 0.5) * fVecLen; aVec.normalize(); basegfx::B2DVector aPerpend(-aVec.getY(), aVec.getX()); - sal_Int32 nMidX = (sal_Int32)(aPos.X() + aVec.getX() * fLongPercentArrow); - sal_Int32 nMidY = (sal_Int32)(aPos.Y() + aVec.getY() * fLongPercentArrow); + sal_Int32 nMidX = static_cast<sal_Int32>(aPos.X() + aVec.getX() * fLongPercentArrow); + sal_Int32 nMidY = static_cast<sal_Int32>(aPos.Y() + aVec.getY() * fLongPercentArrow); Point aMidPoint(nMidX, nMidY); basegfx::B2DPoint aPosition(aPos.X(), aPos.Y()); @@ -1294,10 +1294,10 @@ void SdrHdlGradient::CreateB2dIAObject() maOverlayGroup.append(pNewOverlayObject); // arrowhead - Point aLeft(aMidPoint.X() + (sal_Int32)(aPerpend.getX() * fHalfArrowWidth), - aMidPoint.Y() + (sal_Int32)(aPerpend.getY() * fHalfArrowWidth)); - Point aRight(aMidPoint.X() - (sal_Int32)(aPerpend.getX() * fHalfArrowWidth), - aMidPoint.Y() - (sal_Int32)(aPerpend.getY() * fHalfArrowWidth)); + Point aLeft(aMidPoint.X() + static_cast<sal_Int32>(aPerpend.getX() * fHalfArrowWidth), + aMidPoint.Y() + static_cast<sal_Int32>(aPerpend.getY() * fHalfArrowWidth)); + Point aRight(aMidPoint.X() - static_cast<sal_Int32>(aPerpend.getX() * fHalfArrowWidth), + aMidPoint.Y() - static_cast<sal_Int32>(aPerpend.getY() * fHalfArrowWidth)); basegfx::B2DPoint aPositionLeft(aLeft.X(), aLeft.Y()); basegfx::B2DPoint aPositionRight(aRight.X(), aRight.Y()); @@ -2390,10 +2390,10 @@ void SdrCropHdl::CreateB2dIAObject() aBmpEx1, aBmpEx2, nBlinkTime, - (sal_uInt16)(aBmpEx1.GetSizePixel().Width() - 1) >> 1, - (sal_uInt16)(aBmpEx1.GetSizePixel().Height() - 1) >> 1, - (sal_uInt16)(aBmpEx2.GetSizePixel().Width() - 1) >> 1, - (sal_uInt16)(aBmpEx2.GetSizePixel().Height() - 1) >> 1, + static_cast<sal_uInt16>(aBmpEx1.GetSizePixel().Width() - 1) >> 1, + static_cast<sal_uInt16>(aBmpEx1.GetSizePixel().Height() - 1) >> 1, + static_cast<sal_uInt16>(aBmpEx2.GetSizePixel().Width() - 1) >> 1, + static_cast<sal_uInt16>(aBmpEx2.GetSizePixel().Height() - 1) >> 1, mfShearX, mfRotation); } @@ -2403,8 +2403,8 @@ void SdrCropHdl::CreateB2dIAObject() pOverlayObject = new sdr::overlay::OverlayBitmapEx( aPosition, aBmpEx1, - (sal_uInt16)(aBmpEx1.GetSizePixel().Width() - 1) >> 1, - (sal_uInt16)(aBmpEx1.GetSizePixel().Height() - 1) >> 1, + static_cast<sal_uInt16>(aBmpEx1.GetSizePixel().Width() - 1) >> 1, + static_cast<sal_uInt16>(aBmpEx1.GetSizePixel().Height() - 1) >> 1, 0.0, mfShearX, mfRotation); diff --git a/svx/source/svdraw/svdibrow.cxx b/svx/source/svdraw/svdibrow.cxx index 02df784f9f34..6e1f04d693ce 100644 --- a/svx/source/svdraw/svdibrow.cxx +++ b/svx/source/svdraw/svdibrow.cxx @@ -291,7 +291,7 @@ bool SdrItemBrowserControl::SeekRow(long nRow) OUString SdrItemBrowserControl::GetCellText(long _nRow, sal_uInt16 _nColId) const { OUString sRet; - if ( _nRow >= 0 && _nRow < (sal_Int32)aList.size() ) + if ( _nRow >= 0 && _nRow < static_cast<sal_Int32>(aList.size()) ) { auto& pEntry = aList[_nRow]; if ( pEntry->bComment ) @@ -1149,9 +1149,9 @@ IMPL_LINK(SdrItemBrowser, ChangedHdl, SdrItemBrowserControl&, rBrowse, void) nLongY = s.toInt32(); } switch (pEntry->eItemType) { - case ItemType::BYTE : static_cast<SfxByteItem *>(pNewItem)->SetValue((sal_uInt8 )nLongVal); break; - case ItemType::INT16 : static_cast<SfxInt16Item *>(pNewItem)->SetValue((sal_Int16 )nLongVal); break; - case ItemType::UINT16: static_cast<SfxUInt16Item*>(pNewItem)->SetValue((sal_uInt16)nLongVal); break; + case ItemType::BYTE : static_cast<SfxByteItem *>(pNewItem)->SetValue(static_cast<sal_uInt8>(nLongVal)); break; + case ItemType::INT16 : static_cast<SfxInt16Item *>(pNewItem)->SetValue(static_cast<sal_Int16>(nLongVal)); break; + case ItemType::UINT16: static_cast<SfxUInt16Item*>(pNewItem)->SetValue(static_cast<sal_uInt16>(nLongVal)); break; case ItemType::INT32: { if(dynamic_cast<const SdrAngleItem *>(pNewItem) != nullptr) { @@ -1162,7 +1162,7 @@ IMPL_LINK(SdrItemBrowser, ChangedHdl, SdrItemBrowserControl&, rBrowse, void) static_cast<SfxInt32Item *>(pNewItem)->SetValue(nLongVal); } break; case ItemType::UINT32: static_cast<SfxUInt32Item*>(pNewItem)->SetValue(aNewText.toInt32()); break; - case ItemType::ENUM : static_cast<SfxEnumItemInterface*>(pNewItem)->SetEnumValue((sal_uInt16)nLongVal); break; + case ItemType::ENUM : static_cast<SfxEnumItemInterface*>(pNewItem)->SetEnumValue(static_cast<sal_uInt16>(nLongVal)); break; case ItemType::BOOL: { aNewText = aNewText.toAsciiUpperCase(); if (aNewText == "TRUE") nLongVal=1; @@ -1173,13 +1173,13 @@ IMPL_LINK(SdrItemBrowser, ChangedHdl, SdrItemBrowserControl&, rBrowse, void) if (aNewText == "YES") nLongVal=1; static_cast<SfxBoolItem*>(pNewItem)->SetValue(nLongVal == 1); } break; - case ItemType::FLAG : static_cast<SfxFlagItem *>(pNewItem)->SetValue((sal_uInt16)nLongVal); break; + case ItemType::FLAG : static_cast<SfxFlagItem *>(pNewItem)->SetValue(static_cast<sal_uInt16>(nLongVal)); break; case ItemType::STRING: static_cast<SfxStringItem*>(pNewItem)->SetValue(aNewText); break; case ItemType::POINT : static_cast<SfxPointItem*>(pNewItem)->SetValue(Point(nLongX,nLongY)); break; case ItemType::RECT : break; case ItemType::RANGE : { - static_cast<SfxRangeItem*>(pNewItem)->From()=(sal_uInt16)nLongX; - static_cast<SfxRangeItem*>(pNewItem)->From()=(sal_uInt16)nLongY; + static_cast<SfxRangeItem*>(pNewItem)->From()=static_cast<sal_uInt16>(nLongX); + static_cast<SfxRangeItem*>(pNewItem)->From()=static_cast<sal_uInt16>(nLongY); } break; case ItemType::FRACTION: { if (!bPairX) nLongX=1; @@ -1206,7 +1206,7 @@ IMPL_LINK(SdrItemBrowser, ChangedHdl, SdrItemBrowserControl&, rBrowse, void) case ItemType::FONTWIDTH: { sal_uInt16 nProp=100; if (aNewText.indexOf('%') != -1) { - nProp=(sal_uInt16)nLongVal; + nProp=static_cast<sal_uInt16>(nLongVal); } static_cast<SvxCharScaleWidthItem*>(pNewItem)->SetValue(nProp); } break; diff --git a/svx/source/svdraw/svdlayer.cxx b/svx/source/svdraw/svdlayer.cxx index a3b0cf980370..e3dcf0c57928 100644 --- a/svx/source/svdraw/svdlayer.cxx +++ b/svx/source/svdraw/svdlayer.cxx @@ -50,7 +50,7 @@ void SdrLayerIDSet::PutValue( const css::uno::Any & rAny ) css::uno::Sequence< sal_Int8 > aSeq; if( rAny >>= aSeq ) { - sal_Int16 nCount = (sal_Int16)aSeq.getLength(); + sal_Int16 nCount = static_cast<sal_Int16>(aSeq.getLength()); if( nCount > 32 ) nCount = 32; @@ -99,7 +99,7 @@ SdrLayer::SdrLayer(SdrLayerID nNewID, const OUString& rNewName) : void SdrLayer::SetStandardLayer() { - nType=(sal_uInt16)true; + nType=sal_uInt16(true); maName = ImpGetResStr(STR_StandardLayerName); if (pModel!=nullptr) { SdrHint aHint(SdrHintKind::LayerChange); diff --git a/svx/source/svdraw/svdmodel.cxx b/svx/source/svdraw/svdmodel.cxx index 2b56e8703aa5..c21866ed41f9 100644 --- a/svx/source/svdraw/svdmodel.cxx +++ b/svx/source/svdraw/svdmodel.cxx @@ -636,7 +636,7 @@ void SdrModel::ClearModel(bool bCalledFromDestructor) sal_Int32 nCount=GetPageCount(); for (i=nCount-1; i>=0; i--) { - DeletePage( (sal_uInt16)i ); + DeletePage( static_cast<sal_uInt16>(i) ); } maPages.clear(); PageListChanged(); @@ -645,7 +645,7 @@ void SdrModel::ClearModel(bool bCalledFromDestructor) nCount=GetMasterPageCount(); for(i=nCount-1; i>=0; i--) { - DeleteMasterPage( (sal_uInt16)i ); + DeleteMasterPage( static_cast<sal_uInt16>(i) ); } maMaPag.clear(); MasterPageListChanged(); @@ -1639,7 +1639,7 @@ void SdrModel::Merge(SdrModel& rSourceModel, // get the drawing pages if (bInsPages) { sal_uInt16 nSourcePos=nFirstPageNum; - sal_uInt16 nMergeCount=sal_uInt16(std::abs((long)((long)nFirstPageNum-nLastPageNum))+1); + sal_uInt16 nMergeCount=sal_uInt16(std::abs(static_cast<long>(static_cast<long>(nFirstPageNum)-nLastPageNum))+1); if (nDestPos>GetPageCount()) nDestPos=GetPageCount(); while (nMergeCount>0) { SdrPage* pPg=nullptr; diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx index 0ca03c2dca26..7e148a98c303 100644 --- a/svx/source/svdraw/svdmrkv.cxx +++ b/svx/source/svdraw/svdmrkv.cxx @@ -1424,7 +1424,7 @@ bool SdrMarkView::MarkObj(const Point& rPnt, short nTol, bool bToggle, bool bDee nTol=ImpGetHitTolLogic(nTol,nullptr); SdrSearchOptions nOptions=SdrSearchOptions::PICKMARKABLE; if (bDeep) nOptions=nOptions|SdrSearchOptions::DEEP; - SdrObject* pObj = PickObj(rPnt, (sal_uInt16)nTol, pPV, nOptions); + SdrObject* pObj = PickObj(rPnt, static_cast<sal_uInt16>(nTol), pPV, nOptions); if (pObj) { bool bUnmark=bToggle && IsObjMarked(pObj); MarkObj(pObj,pPV,bUnmark); diff --git a/svx/source/svdraw/svdmrkv1.cxx b/svx/source/svdraw/svdmrkv1.cxx index e1f41bf58e96..85a2e193fb7b 100644 --- a/svx/source/svdraw/svdmrkv1.cxx +++ b/svx/source/svdraw/svdmrkv1.cxx @@ -133,11 +133,11 @@ bool SdrMarkView::ImpMarkPoint(SdrHdl* pHdl, SdrMark* pMark, bool bUnmark) SdrUShortCont& rPts=pMark->GetMarkedPoints(); if (!bUnmark) { - rPts.insert((sal_uInt16)nHdlNum); + rPts.insert(static_cast<sal_uInt16>(nHdlNum)); } else { - SdrUShortCont::const_iterator it = rPts.find( (sal_uInt16)nHdlNum ); + SdrUShortCont::const_iterator it = rPts.find( static_cast<sal_uInt16>(nHdlNum) ); if (it != rPts.end()) { rPts.erase(it); diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx index 11ba1cbbdf76..ad591651b37e 100644 --- a/svx/source/svdraw/svdoashp.cxx +++ b/svx/source/svdraw/svdoashp.cxx @@ -308,23 +308,23 @@ SdrObject* ImpCreateShadowObjectClone(const SdrObject& rOriginal, const SfxItemS if(aGradient.GetStartIntens() != 100) { - nStartLuminance = (sal_uInt8)(nStartLuminance * ((double)aGradient.GetStartIntens() / 100.0)); + nStartLuminance = static_cast<sal_uInt8>(nStartLuminance * (static_cast<double>(aGradient.GetStartIntens()) / 100.0)); } if(aGradient.GetEndIntens() != 100) { - nEndLuminance = (sal_uInt8)(nEndLuminance * ((double)aGradient.GetEndIntens() / 100.0)); + nEndLuminance = static_cast<sal_uInt8>(nEndLuminance * (static_cast<double>(aGradient.GetEndIntens()) / 100.0)); } ::Color aStartColor( - (sal_uInt8)((nStartLuminance * aShadowColor.GetRed()) / 256), - (sal_uInt8)((nStartLuminance * aShadowColor.GetGreen()) / 256), - (sal_uInt8)((nStartLuminance * aShadowColor.GetBlue()) / 256)); + static_cast<sal_uInt8>((nStartLuminance * aShadowColor.GetRed()) / 256), + static_cast<sal_uInt8>((nStartLuminance * aShadowColor.GetGreen()) / 256), + static_cast<sal_uInt8>((nStartLuminance * aShadowColor.GetBlue()) / 256)); ::Color aEndColor( - (sal_uInt8)((nEndLuminance * aShadowColor.GetRed()) / 256), - (sal_uInt8)((nEndLuminance * aShadowColor.GetGreen()) / 256), - (sal_uInt8)((nEndLuminance * aShadowColor.GetBlue()) / 256)); + static_cast<sal_uInt8>((nEndLuminance * aShadowColor.GetRed()) / 256), + static_cast<sal_uInt8>((nEndLuminance * aShadowColor.GetGreen()) / 256), + static_cast<sal_uInt8>((nEndLuminance * aShadowColor.GetBlue()) / 256)); aGradient.SetStartColor(aStartColor); aGradient.SetEndColor(aEndColor); @@ -363,11 +363,11 @@ SdrObject* ImpCreateShadowObjectClone(const SdrObject& rOriginal, const SfxItemS { for(long x(0); x < pReadAccess->Width(); x++) { - sal_uInt16 nLuminance((sal_uInt16)pReadAccess->GetLuminance(y, x) + 1); + sal_uInt16 nLuminance(static_cast<sal_uInt16>(pReadAccess->GetLuminance(y, x)) + 1); const BitmapColor aDestColor( - (sal_uInt8)((nLuminance * (sal_uInt16)aShadowColor.GetRed()) >> 8), - (sal_uInt8)((nLuminance * (sal_uInt16)aShadowColor.GetGreen()) >> 8), - (sal_uInt8)((nLuminance * (sal_uInt16)aShadowColor.GetBlue()) >> 8)); + static_cast<sal_uInt8>((nLuminance * static_cast<sal_uInt16>(aShadowColor.GetRed())) >> 8), + static_cast<sal_uInt8>((nLuminance * static_cast<sal_uInt16>(aShadowColor.GetGreen())) >> 8), + static_cast<sal_uInt8>((nLuminance * static_cast<sal_uInt16>(aShadowColor.GetBlue())) >> 8)); pWriteAccess->SetPixel(y, x, aDestColor); } } @@ -689,8 +689,8 @@ std::vector< SdrCustomShapeInteraction > SdrObjCustomShape::GetInteractionHandle // BaseProperties section -#define DEFAULT_MINIMUM_SIGNED_COMPARE ((sal_Int32)0x80000000) -#define DEFAULT_MAXIMUM_SIGNED_COMPARE ((sal_Int32)0x7fffffff) +#define DEFAULT_MINIMUM_SIGNED_COMPARE (sal_Int32(0x80000000)) +#define DEFAULT_MAXIMUM_SIGNED_COMPARE (sal_Int32(0x7fffffff)) static sal_Int32 GetNumberOfProperties ( const SvxMSDffHandle* pData ) { @@ -1406,8 +1406,8 @@ void SdrObjCustomShape::AdaptTextMinSize() { const long nHDist(GetTextLeftDistance() + GetTextRightDistance()); const long nVDist(GetTextUpperDistance() + GetTextLowerDistance()); - const long nTWdt(std::max(long(0), (long)(aTextBound.GetWidth() - 1 - nHDist))); - const long nTHgt(std::max(long(0), (long)(aTextBound.GetHeight() - 1 - nVDist))); + const long nTWdt(std::max(long(0), static_cast<long>(aTextBound.GetWidth() - 1 - nHDist))); + const long nTHgt(std::max(long(0), static_cast<long>(aTextBound.GetHeight() - 1 - nVDist))); aSet.Put(makeSdrTextMinFrameWidthItem(nTWdt)); aSet.Put(makeSdrTextMinFrameHeightItem(nTHgt)); @@ -1570,7 +1570,7 @@ void SdrObjCustomShape::NbcRotate( const Point& rRef, long nAngle, double sn, do aGeo.nRotationAngle = 0; // resetting aGeo data aGeo.RecalcSinCos(); - long nW = (long)( fObjectRotation * 100 ); // applying our object rotation + long nW = static_cast<long>( fObjectRotation * 100 ); // applying our object rotation if ( bMirroredX ) nW = 36000 - nW; if ( bMirroredY ) @@ -2057,7 +2057,7 @@ bool SdrObjCustomShape::applySpecialDrag(SdrDragStat& rDrag) case SdrHdlKind::CustomShape1 : { rDrag.SetEndDragChangesGeoAndAttributes(true); - DragMoveCustomShapeHdl( rDrag.GetNow(), (sal_uInt16)pHdl->GetPointNum(), !rDrag.GetDragMethod()->IsShiftPressed() ); + DragMoveCustomShapeHdl( rDrag.GetNow(), static_cast<sal_uInt16>(pHdl->GetPointNum()), !rDrag.GetDragMethod()->IsShiftPressed() ); SetRectsDirty(); InvalidateRenderGeometry(); SetChanged(); @@ -2415,16 +2415,16 @@ tools::Rectangle SdrObjCustomShape::ImpCalculateTextFrame( const bool bHgt, cons aNewTextRect.GetWidth() && aNewTextRect.GetHeight()) { aReturnValue = maRect; - double fXScale = (double)aOldTextRect.GetWidth() / (double)aNewTextRect.GetWidth(); - double fYScale = (double)aOldTextRect.GetHeight() / (double)aNewTextRect.GetHeight(); - double fRightDiff = (double)( aAdjustedTextRect.Right() - aNewTextRect.Right() ) * fXScale; - double fLeftDiff = (double)( aAdjustedTextRect.Left() - aNewTextRect.Left() ) * fXScale; - double fTopDiff = (double)( aAdjustedTextRect.Top() - aNewTextRect.Top() ) * fYScale; - double fBottomDiff= (double)( aAdjustedTextRect.Bottom()- aNewTextRect.Bottom()) * fYScale; - aReturnValue.Left() += (sal_Int32)fLeftDiff; - aReturnValue.Right() += (sal_Int32)fRightDiff; - aReturnValue.Top() += (sal_Int32)fTopDiff; - aReturnValue.Bottom() += (sal_Int32)fBottomDiff; + double fXScale = static_cast<double>(aOldTextRect.GetWidth()) / static_cast<double>(aNewTextRect.GetWidth()); + double fYScale = static_cast<double>(aOldTextRect.GetHeight()) / static_cast<double>(aNewTextRect.GetHeight()); + double fRightDiff = static_cast<double>( aAdjustedTextRect.Right() - aNewTextRect.Right() ) * fXScale; + double fLeftDiff = static_cast<double>( aAdjustedTextRect.Left() - aNewTextRect.Left() ) * fXScale; + double fTopDiff = static_cast<double>( aAdjustedTextRect.Top() - aNewTextRect.Top() ) * fYScale; + double fBottomDiff= static_cast<double>( aAdjustedTextRect.Bottom()- aNewTextRect.Bottom()) * fYScale; + aReturnValue.Left() += static_cast<sal_Int32>(fLeftDiff); + aReturnValue.Right() += static_cast<sal_Int32>(fRightDiff); + aReturnValue.Top() += static_cast<sal_Int32>(fTopDiff); + aReturnValue.Bottom() += static_cast<sal_Int32>(fBottomDiff); } } return aReturnValue; diff --git a/svx/source/svdraw/svdocapt.cxx b/svx/source/svdraw/svdocapt.cxx index 9c62fa28067d..4a7b3bd878f9 100644 --- a/svx/source/svdraw/svdocapt.cxx +++ b/svx/source/svdraw/svdocapt.cxx @@ -288,7 +288,7 @@ SdrHdl* SdrCaptionObj::GetHdl(sal_uInt32 nHdlNum) const if(nPntNum < aTailPoly.GetSize()) { - SdrHdl* pHdl = new SdrHdl(aTailPoly.GetPoint((sal_uInt16)nPntNum), SdrHdlKind::Poly); + SdrHdl* pHdl = new SdrHdl(aTailPoly.GetPoint(static_cast<sal_uInt16>(nPntNum)), SdrHdlKind::Poly); pHdl->SetPolyNum(1); pHdl->SetPointNum(nPntNum); return pHdl; diff --git a/svx/source/svdraw/svdoedge.cxx b/svx/source/svdraw/svdoedge.cxx index 150fbc2b8811..d9c42bfcab63 100644 --- a/svx/source/svdraw/svdoedge.cxx +++ b/svx/source/svdraw/svdoedge.cxx @@ -1331,7 +1331,7 @@ XPolygon SdrEdgeObj::ImpCalcEdgeTrack(const Point& rPt1, long nAngle1, const too } if (nTmp>=3) { nQual0=nQual; - nQual+=(sal_uIntPtr)nTmp*0x01000000; + nQual+=static_cast<sal_uIntPtr>(nTmp)*0x01000000; if (nQual<nQual0 || nTmp>15) bOverflow = true; } if (nPointCount>=2) { // check exit angle again @@ -1388,7 +1388,7 @@ XPolygon SdrEdgeObj::ImpCalcEdgeTrack(const Point& rPt1, long nAngle1, const too } if (nPointCount<=1) nIntersections++; nQual0=nQual; - nQual+=(sal_uIntPtr)nIntersections*0x10000000; + nQual+=static_cast<sal_uIntPtr>(nIntersections)*0x10000000; if (nQual<nQual0 || nIntersections>15) bOverflow = true; if (bOverflow || nQual==0xFFFFFFFF) nQual=0xFFFFFFFE; @@ -1775,8 +1775,8 @@ SdrHdl* SdrEdgeObj::GetHdl(sal_uInt32 nHdlNum) const } } if (nPt>0) { - Point aPos((*pEdgeTrack)[(sal_uInt16)nPt]); - aPos+=(*pEdgeTrack)[(sal_uInt16)nPt+1]; + Point aPos((*pEdgeTrack)[static_cast<sal_uInt16>(nPt)]); + aPos+=(*pEdgeTrack)[static_cast<sal_uInt16>(nPt)+1]; aPos.X()/=2; aPos.Y()/=2; pHdl->SetPos(aPos); @@ -1787,7 +1787,7 @@ SdrHdl* SdrEdgeObj::GetHdl(sal_uInt32 nHdlNum) const } else if (eKind==SdrEdgeKind::ThreeLines) { sal_uInt32 nNum(nHdlNum); if (GetConnectedNode(true)==nullptr) nNum++; - Point aPos((*pEdgeTrack)[(sal_uInt16)nNum-1]); + Point aPos((*pEdgeTrack)[static_cast<sal_uInt16>(nNum)-1]); pHdl=new ImpEdgeHdl(aPos,SdrHdlKind::Poly); if (nNum==2) static_cast<ImpEdgeHdl*>(pHdl)->SetLineCode(SdrEdgeLineCode::Obj1Line2); if (nNum==3) static_cast<ImpEdgeHdl*>(pHdl)->SetLineCode(SdrEdgeLineCode::Obj2Line2); @@ -2104,7 +2104,7 @@ bool SdrEdgeObj::ImpFindConnector(const Point& rPt, const SdrPageView& rPV, SdrO aMouseRect.Top() -=aHalfConSiz.Height(); aMouseRect.Right() +=aHalfConSiz.Width(); aMouseRect.Bottom()+=aHalfConSiz.Height(); - sal_uInt16 nBoundHitTol=(sal_uInt16)aHalfConSiz.Width()/2; if (nBoundHitTol==0) nBoundHitTol=1; + sal_uInt16 nBoundHitTol=static_cast<sal_uInt16>(aHalfConSiz.Width())/2; if (nBoundHitTol==0) nBoundHitTol=1; size_t no=pOL->GetObjCount(); bool bFnd = false; SdrObjConnection aTestCon; @@ -2167,7 +2167,7 @@ bool SdrEdgeObj::ImpFindConnector(const Point& rPt, const SdrPageView& rPV, SdrO if (bOk && aMouseRect.IsInside(aConPos)) { if (bUser) bUserFnd = true; bFnd = true; - sal_uIntPtr nDist=(sal_uIntPtr)std::abs(aConPos.X()-rPt.X())+(sal_uIntPtr)std::abs(aConPos.Y()-rPt.Y()); + sal_uIntPtr nDist=static_cast<sal_uIntPtr>(std::abs(aConPos.X()-rPt.X()))+static_cast<sal_uIntPtr>(std::abs(aConPos.Y()-rPt.Y())); if (nDist<nBestDist) { nBestDist=nDist; aTestCon.pObj=pObj; @@ -2519,7 +2519,7 @@ void SdrEdgeObj::setGluePointIndex( bool bTail, sal_Int32 nIndex /* = -1 */ ) // for user defined glue points we have // to get the id for this index first const SdrGluePointList* pList = rConn1.GetObject() ? rConn1.GetObject()->GetGluePointList() : nullptr; - if( pList == nullptr || SDRGLUEPOINT_NOTFOUND == pList->FindGluePoint((sal_uInt16)nIndex) ) + if( pList == nullptr || SDRGLUEPOINT_NOTFOUND == pList->FindGluePoint(static_cast<sal_uInt16>(nIndex)) ) return; } else if( nIndex < 0 ) @@ -2527,7 +2527,7 @@ void SdrEdgeObj::setGluePointIndex( bool bTail, sal_Int32 nIndex /* = -1 */ ) nIndex = 0; } - rConn1.SetConnectorId( (sal_uInt16)nIndex ); + rConn1.SetConnectorId( static_cast<sal_uInt16>(nIndex) ); SetChanged(); SetRectsDirty(); diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx index cf185f1f808d..060a357775e0 100644 --- a/svx/source/svdraw/svdograf.cxx +++ b/svx/source/svdraw/svdograf.cxx @@ -1281,7 +1281,7 @@ void SdrGrafObj::ImpSetAttrToGrafInfo() aGrafInfo.SetChannelG( rSet.Get( SDRATTR_GRAFGREEN ).GetValue() ); aGrafInfo.SetChannelB( rSet.Get( SDRATTR_GRAFBLUE ).GetValue() ); aGrafInfo.SetGamma( rSet.Get( SDRATTR_GRAFGAMMA ).GetValue() * 0.01 ); - aGrafInfo.SetTransparency( (sal_uInt8) FRound( std::min( nTrans, (sal_uInt16) 100 ) * 2.55 ) ); + aGrafInfo.SetTransparency( static_cast<sal_uInt8>(FRound( std::min( nTrans, sal_uInt16(100) ) * 2.55 )) ); aGrafInfo.SetInvert( rSet.Get( SDRATTR_GRAFINVERT ).GetValue() ); aGrafInfo.SetDrawMode( rSet.Get( SDRATTR_GRAFMODE ).GetValue() ); aGrafInfo.SetCrop( rCrop.GetLeft(), rCrop.GetTop(), rCrop.GetRight(), rCrop.GetBottom() ); @@ -1311,21 +1311,21 @@ void SdrGrafObj::AdjustToMaxRect( const tools::Rectangle& rMaxRect, bool bShrink ( aSize.Width() > aMaxSize.Width() ) )&& aSize.Height() && aMaxSize.Height() ) { - float fGrfWH = (float)aSize.Width() / - (float)aSize.Height(); - float fWinWH = (float)aMaxSize.Width() / - (float)aMaxSize.Height(); + float fGrfWH = static_cast<float>(aSize.Width()) / + static_cast<float>(aSize.Height()); + float fWinWH = static_cast<float>(aMaxSize.Width()) / + static_cast<float>(aMaxSize.Height()); // Scale graphic to page size if ( fGrfWH < fWinWH ) { - aSize.Width() = (long)(aMaxSize.Height() * fGrfWH); + aSize.Width() = static_cast<long>(aMaxSize.Height() * fGrfWH); aSize.Height()= aMaxSize.Height(); } else if ( fGrfWH > 0.F ) { aSize.Width() = aMaxSize.Width(); - aSize.Height()= (long)(aMaxSize.Width() / fGrfWH); + aSize.Height()= static_cast<long>(aMaxSize.Width() / fGrfWH); } aPos = rMaxRect.Center(); @@ -1504,7 +1504,7 @@ Reference< XInputStream > SdrGrafObj::getInputStream() sal_uInt8 * pBuffer = new sal_uInt8[ nSize ]; memcpy( pBuffer, pSourceData, nSize ); - SvMemoryStream* pStream = new SvMemoryStream( static_cast<void*>(pBuffer), (std::size_t)nSize, StreamMode::READ ); + SvMemoryStream* pStream = new SvMemoryStream( static_cast<void*>(pBuffer), static_cast<std::size_t>(nSize), StreamMode::READ ); pStream->ObjectOwnsMemory( true ); xStream.set( new utl::OInputStreamWrapper( pStream, true ) ); } diff --git a/svx/source/svdraw/svdomeas.cxx b/svx/source/svdraw/svdomeas.cxx index ff7980c5a74c..78b77fc5509b 100644 --- a/svx/source/svdraw/svdomeas.cxx +++ b/svx/source/svdraw/svdomeas.cxx @@ -255,7 +255,7 @@ void SdrMeasureObj::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const sal_uInt16 SdrMeasureObj::GetObjIdentifier() const { - return (sal_uInt16)OBJ_MEASURE; + return sal_uInt16(OBJ_MEASURE); } struct ImpMeasureRec : public SdrDragStatUserData @@ -337,7 +337,7 @@ long impGetLineStartEndDistance(const basegfx::B2DPolyPolygon& rPolyPolygon, lon { const basegfx::B2DRange aPolygonRange(rPolyPolygon.getB2DRange()); const double fOldWidth(std::max(aPolygonRange.getWidth(), 1.0)); - const double fScale((double)nNewWidth / fOldWidth); + const double fScale(static_cast<double>(nNewWidth) / fOldWidth); long nHeight(basegfx::fround(aPolygonRange.getHeight() * fScale)); if(bCenter) @@ -913,8 +913,8 @@ void SdrMeasureObj::ImpEvalDrag(ImpMeasureRec& rRec, const SdrDragStat& rDrag) c if (!bHLin || !bVLin) { // else aPt1==aPt2 long ndx=aPt.X()-aFix.X(); long ndy=aPt.Y()-aFix.Y(); - double nXFact=0; if (!bVLin) nXFact=(double)ndx/(double)ndx0; - double nYFact=0; if (!bHLin) nYFact=(double)ndy/(double)ndy0; + double nXFact=0; if (!bVLin) nXFact=static_cast<double>(ndx)/static_cast<double>(ndx0); + double nYFact=0; if (!bHLin) nYFact=static_cast<double>(ndy)/static_cast<double>(ndy0); bool bHor=bHLin || (!bVLin && (nXFact>nYFact) ==bBigOrtho); bool bVer=bVLin || (!bHLin && (nXFact<=nYFact)==bBigOrtho); if (bHor) ndy=long(ndy0*nXFact); diff --git a/svx/source/svdraw/svdomedia.cxx b/svx/source/svdraw/svdomedia.cxx index bece1c68cece..e3e46d3d9a82 100644 --- a/svx/source/svdraw/svdomedia.cxx +++ b/svx/source/svdraw/svdomedia.cxx @@ -189,21 +189,21 @@ void SdrMediaObj::AdjustToMaxRect( const tools::Rectangle& rMaxRect, bool bShrin ( aSize.Width() > aMaxSize.Width() ) )&& aSize.Height() && aMaxSize.Height() ) { - float fGrfWH = (float)aSize.Width() / - (float)aSize.Height(); - float fWinWH = (float)aMaxSize.Width() / - (float)aMaxSize.Height(); + float fGrfWH = static_cast<float>(aSize.Width()) / + static_cast<float>(aSize.Height()); + float fWinWH = static_cast<float>(aMaxSize.Width()) / + static_cast<float>(aMaxSize.Height()); // scale graphic to page size if ( fGrfWH < fWinWH ) { - aSize.Width() = (long)(aMaxSize.Height() * fGrfWH); + aSize.Width() = static_cast<long>(aMaxSize.Height() * fGrfWH); aSize.Height()= aMaxSize.Height(); } else if ( fGrfWH > 0.F ) { aSize.Width() = aMaxSize.Width(); - aSize.Height()= (long)(aMaxSize.Width() / fGrfWH); + aSize.Height()= static_cast<long>(aMaxSize.Width() / fGrfWH); } aPos = rMaxRect.Center(); diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx index 6ccff1fae000..89adf7910b7e 100644 --- a/svx/source/svdraw/svdoole2.cxx +++ b/svx/source/svdraw/svdoole2.cxx @@ -1528,8 +1528,8 @@ void SdrOle2Obj::ImpSetVisAreaSize() // objects' visual area. The scaling will not change, but it might exist already and must // be used in calculations MapUnit aMapUnit = VCLUnoHelper::UnoEmbed2VCLMapUnit( mpImpl->mxObjRef->getMapUnit( GetAspect() ) ); - Size aVisSize( (long)( Fraction( maRect.GetWidth() ) / aScaleWidth ), - (long)( Fraction( maRect.GetHeight() ) / aScaleHeight ) ); + Size aVisSize( static_cast<long>( Fraction( maRect.GetWidth() ) / aScaleWidth ), + static_cast<long>( Fraction( maRect.GetHeight() ) / aScaleHeight ) ); aVisSize = OutputDevice::LogicToLogic(aVisSize, MapMode(pModel->GetScaleUnit()), MapMode(aMapUnit)); awt::Size aSz; @@ -1545,8 +1545,8 @@ void SdrOle2Obj::ImpSetVisAreaSize() {} tools::Rectangle aAcceptedVisArea; - aAcceptedVisArea.SetSize( Size( (long)( Fraction( long( aSz.Width ) ) * aScaleWidth ), - (long)( Fraction( long( aSz.Height ) ) * aScaleHeight ) ) ); + aAcceptedVisArea.SetSize( Size( static_cast<long>( Fraction( long( aSz.Width ) ) * aScaleWidth ), + static_cast<long>( Fraction( long( aSz.Height ) ) * aScaleHeight ) ) ); if (aVisSize != aAcceptedVisArea.GetSize()) { // server changed VisArea to its liking and the VisArea is different than the suggested one diff --git a/svx/source/svdraw/svdopath.cxx b/svx/source/svdraw/svdopath.cxx index d9bc1287e904..26c2861f11e1 100644 --- a/svx/source/svdraw/svdopath.cxx +++ b/svx/source/svdraw/svdopath.cxx @@ -169,8 +169,8 @@ ImpSdrPathDragData::ImpSdrPathDragData(const SdrPathObj& rPO, const SdrHdl& rHdl { bValid=false; bClosed=rPO.IsClosed(); // closed object? - nPoly=(sal_uInt16)rHdl.GetPolyNum(); // number of the polygon in the PolyPolygon - nPnt=(sal_uInt16)rHdl.GetPointNum(); // number of points in the above polygon + nPoly=static_cast<sal_uInt16>(rHdl.GetPolyNum()); // number of the polygon in the PolyPolygon + nPnt=static_cast<sal_uInt16>(rHdl.GetPointNum()); // number of points in the above polygon const XPolygon aTmpXP(rPO.GetPathPoly().getB2DPolygon(nPoly)); nPointCount=aTmpXP.GetPointCount(); // number of point of the polygon if (nPointCount==0 || (bClosed && nPointCount==1)) return; // minimum of 1 points for Lines, minimum of 2 points for Polygon @@ -325,7 +325,7 @@ void ImpPathCreateUser::CalcCircle(const Point& rP1, const Point& rP2, const Poi long nRad=0; if (bRet) { double cs=cos(nTmpAngle*nPi180); - double nR=(double)GetLen(Point(dx,dy))/cs/2; + double nR=static_cast<double>(GetLen(Point(dx,dy)))/cs/2; nRad=std::abs(svx::Round(nR)); } if (dAngle<18000) { @@ -552,7 +552,7 @@ bool ImpPathForDragAndCreate::beginPathDrag( SdrDragStat const & rDrag ) const bool bMultiPointDrag(true); - if(aPathPolygon[(sal_uInt16)pHdl->GetPolyNum()].IsControl((sal_uInt16)pHdl->GetPointNum())) + if(aPathPolygon[static_cast<sal_uInt16>(pHdl->GetPolyNum())].IsControl(static_cast<sal_uInt16>(pHdl->GetPointNum()))) bMultiPointDrag = false; if(bMultiPointDrag) @@ -605,8 +605,8 @@ bool ImpPathForDragAndCreate::movePathDrag( SdrDragStat& rDrag ) const { for(SdrHdl* pHandle : mpSdrPathDragData->maHandles) { - const sal_uInt16 nPolyIndex((sal_uInt16)pHandle->GetPolyNum()); - const sal_uInt16 nPointIndex((sal_uInt16)pHandle->GetPointNum()); + const sal_uInt16 nPolyIndex(static_cast<sal_uInt16>(pHandle->GetPolyNum())); + const sal_uInt16 nPointIndex(static_cast<sal_uInt16>(pHandle->GetPointNum())); const XPolygon& rOrig = mpSdrPathDragData->maOrig[nPolyIndex]; XPolygon& rMove = mpSdrPathDragData->maMove[nPolyIndex]; const sal_uInt16 nPointCount(rOrig.GetPointCount()); @@ -688,8 +688,8 @@ bool ImpPathForDragAndCreate::movePathDrag( SdrDragStat& rDrag ) const long ndx=aPos.X()-aPnt1.X(); long ndy=aPos.Y()-aPnt1.Y(); bPnt1=true; - double nXFact=0; if (!bVLin) nXFact=(double)ndx/(double)ndx0; - double nYFact=0; if (!bHLin) nYFact=(double)ndy/(double)ndy0; + double nXFact=0; if (!bVLin) nXFact=static_cast<double>(ndx)/static_cast<double>(ndx0); + double nYFact=0; if (!bHLin) nYFact=static_cast<double>(ndy)/static_cast<double>(ndy0); bool bHor=bHLin || (!bVLin && (nXFact>nYFact) ==bBigOrtho); bool bVer=bVLin || (!bHLin && (nXFact<=nYFact)==bBigOrtho); if (bHor) ndy=long(ndy0*nXFact); @@ -709,8 +709,8 @@ bool ImpPathForDragAndCreate::movePathDrag( SdrDragStat& rDrag ) const long ndx=aPos.X()-aPnt2.X(); long ndy=aPos.Y()-aPnt2.Y(); bPnt2=true; - double nXFact=0; if (!bVLin) nXFact=(double)ndx/(double)ndx0; - double nYFact=0; if (!bHLin) nYFact=(double)ndy/(double)ndy0; + double nXFact=0; if (!bVLin) nXFact=static_cast<double>(ndx)/static_cast<double>(ndx0); + double nYFact=0; if (!bHLin) nYFact=static_cast<double>(ndy)/static_cast<double>(ndy0); bool bHor=bHLin || (!bVLin && (nXFact>nYFact) ==bBigOrtho); bool bVer=bVLin || (!bHLin && (nXFact<=nYFact)==bBigOrtho); if (bHor) ndy=long(ndy0*nXFact); @@ -848,7 +848,7 @@ bool ImpPathForDragAndCreate::endPathDrag(SdrDragStat const & rDrag) const SdrHdl* pHdl=rDrag.GetHdl(); // reference the polygon - XPolygon& rXP=aPathPolygon[(sal_uInt16)pHdl->GetPolyNum()]; + XPolygon& rXP=aPathPolygon[static_cast<sal_uInt16>(pHdl->GetPolyNum())]; // the 5 points that might have changed if (!mpSdrPathDragData->bPrevIsBegPnt) rXP[mpSdrPathDragData->nPrevPrevPnt0]=mpSdrPathDragData->aXP[mpSdrPathDragData->nPrevPrevPnt]; @@ -1031,8 +1031,8 @@ OUString ImpPathForDragAndCreate::getSpecialDragComment(const SdrDragStat& rDrag if(!pDragData->IsMultiPointDrag()) { - sal_uInt16 nPntNum((sal_uInt16)pHdl->GetPointNum()); - const XPolygon& rXPoly = aPathPolygon[(sal_uInt16)rDrag.GetHdl()->GetPolyNum()]; + sal_uInt16 nPntNum(static_cast<sal_uInt16>(pHdl->GetPointNum())); + const XPolygon& rXPoly = aPathPolygon[static_cast<sal_uInt16>(rDrag.GetHdl()->GetPolyNum())]; sal_uInt16 nPointCount(rXPoly.GetPointCount()); bool bClose(IsClosed(meObjectKind)); @@ -1151,10 +1151,10 @@ basegfx::B2DPolyPolygon ImpPathForDragAndCreate::getSpecialDragPoly(const SdrDra } else { - const XPolygon& rXP=aPathPolygon[(sal_uInt16)rDrag.GetHdl()->GetPolyNum()]; + const XPolygon& rXP=aPathPolygon[static_cast<sal_uInt16>(rDrag.GetHdl()->GetPolyNum())]; if (rXP.GetPointCount()<=2) { XPolygon aXPoly(rXP); - aXPoly[(sal_uInt16)rDrag.GetHdl()->GetPointNum()]=rDrag.GetNow(); + aXPoly[static_cast<sal_uInt16>(rDrag.GetHdl()->GetPointNum())]=rDrag.GetNow(); aRetval.Insert(std::move(aXPoly)); return aRetval.getB2DPolyPolygon(); } @@ -2060,8 +2060,8 @@ sal_uInt32 SdrPathObj::GetPlusHdlCount(const SdrHdl& rHdl) const // keep old stuff to be able to keep old SdrHdl stuff, too const XPolyPolygon aOldPathPolygon(GetPathPoly()); sal_uInt16 nCnt = 0; - sal_uInt16 nPnt = (sal_uInt16)rHdl.GetPointNum(); - sal_uInt16 nPolyNum = (sal_uInt16)rHdl.GetPolyNum(); + sal_uInt16 nPnt = static_cast<sal_uInt16>(rHdl.GetPointNum()); + sal_uInt16 nPolyNum = static_cast<sal_uInt16>(rHdl.GetPolyNum()); if(nPolyNum < aOldPathPolygon.Count()) { @@ -2091,8 +2091,8 @@ SdrHdl* SdrPathObj::GetPlusHdl(const SdrHdl& rHdl, sal_uInt32 nPlusNum) const // keep old stuff to be able to keep old SdrHdl stuff, too const XPolyPolygon aOldPathPolygon(GetPathPoly()); SdrHdl* pHdl = nullptr; - sal_uInt16 nPnt = (sal_uInt16)rHdl.GetPointNum(); - sal_uInt16 nPolyNum = (sal_uInt16)rHdl.GetPolyNum(); + sal_uInt16 nPnt = static_cast<sal_uInt16>(rHdl.GetPointNum()); + sal_uInt16 nPolyNum = static_cast<sal_uInt16>(rHdl.GetPolyNum()); if (nPolyNum<aOldPathPolygon.Count()) { @@ -2253,7 +2253,7 @@ bool SdrPathObj::EndCreate(SdrDragStat& rStat, SdrCreateCmd eCmd) const sal_Int32 nCloseDist(pOut->PixelToLogic(Size(pView->GetAutoCloseDistPix(), 0)).Width()); const basegfx::B2DVector aDistVector(aCandidate.getB2DPoint(aCandidate.count() - 1) - aCandidate.getB2DPoint(0)); - if(aDistVector.getLength() <= (double)nCloseDist) + if(aDistVector.getLength() <= static_cast<double>(nCloseDist)) { // close it ImpSetClosed(true); diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx index 1063eb5f53a5..b1159c51e348 100644 --- a/svx/source/svdraw/svdotext.cxx +++ b/svx/source/svdraw/svdotext.cxx @@ -942,7 +942,7 @@ void SdrTextObj::ImpSetCharStretching(SdrOutliner& rOutliner, const Size& rTextS bNoMoreLoop = true; } - rOutliner.SetGlobalCharStretching((sal_uInt16)nX,(sal_uInt16)nY); + rOutliner.SetGlobalCharStretching(static_cast<sal_uInt16>(nX),static_cast<sal_uInt16>(nY)); nLoopCount++; Size aSiz(rOutliner.CalcTextSize()); long nXDiff=aSiz.Width()-nWantWdt; diff --git a/svx/source/svdraw/svdotextdecomposition.cxx b/svx/source/svdraw/svdotextdecomposition.cxx index 2afac1312087..ac46823402b7 100644 --- a/svx/source/svdraw/svdotextdecomposition.cxx +++ b/svx/source/svdraw/svdotextdecomposition.cxx @@ -245,7 +245,7 @@ namespace for(sal_Int32 a=0; a < rInfo.mnTextLen; a++) { - aDXArray.push_back((double)rInfo.mpDXArray[a]); + aDXArray.push_back(static_cast<double>(rInfo.mpDXArray[a])); } } @@ -559,7 +559,7 @@ namespace { // for contour text, ignore (clip away) all portions which are below // the visible area given by maScale - if(pInfo && (double)pInfo->mrStartPos.Y() < maScale.getY()) + if(pInfo && static_cast<double>(pInfo->mrStartPos.Y()) < maScale.getY()) { impHandleDrawPortionInfo(*pInfo); } @@ -1171,7 +1171,7 @@ void SdrTextObj::impDecomposeStretchTextPrimitive( // to layout without mirroring const double fScaleX(fabs(aScale.getX()) / aOutlinerScale.getX()); const double fScaleY(fabs(aScale.getY()) / aOutlinerScale.getY()); - rOutliner.SetGlobalCharStretching((sal_Int16)FRound(fScaleX * 100.0), (sal_Int16)FRound(fScaleY * 100.0)); + rOutliner.SetGlobalCharStretching(static_cast<sal_Int16>(FRound(fScaleX * 100.0)), static_cast<sal_Int16>(FRound(fScaleY * 100.0))); // mirroring. We are now in aAnchorTextRange sizes. When mirroring in X and Y, // move the null point which was top left to bottom right. @@ -1199,7 +1199,7 @@ void SdrTextObj::impDecomposeStretchTextPrimitive( // timing generators #define ENDLESS_LOOP (0xffffffff) -#define ENDLESS_TIME ((double)0xffffffff) +#define ENDLESS_TIME (double(0xffffffff)) #define PIXEL_DPI (96.0) void SdrTextObj::impGetBlinkTextTiming(drawinglayer::animation::AnimationEntryList& rAnimList) const @@ -1209,8 +1209,8 @@ void SdrTextObj::impGetBlinkTextTiming(drawinglayer::animation::AnimationEntryLi // get values const SfxItemSet& rSet = GetObjectItemSet(); - const sal_uInt32 nRepeat((sal_uInt32)rSet.Get(SDRATTR_TEXT_ANICOUNT).GetValue()); - double fDelay((double)rSet.Get(SDRATTR_TEXT_ANIDELAY).GetValue()); + const sal_uInt32 nRepeat(static_cast<sal_uInt32>(rSet.Get(SDRATTR_TEXT_ANICOUNT).GetValue())); + double fDelay(static_cast<double>(rSet.Get(SDRATTR_TEXT_ANIDELAY).GetValue())); if(0.0 == fDelay) { @@ -1373,8 +1373,8 @@ void SdrTextObj::impGetScrollTextTiming(drawinglayer::animation::AnimationEntryL // get data. Goal is to calculate fTimeFullPath which is the time needed to // move animation from (0.0) to (1.0) state const SfxItemSet& rSet = GetObjectItemSet(); - double fAnimationDelay((double)rSet.Get(SDRATTR_TEXT_ANIDELAY).GetValue()); - double fSingleStepWidth((double)rSet.Get(SDRATTR_TEXT_ANIAMOUNT).GetValue()); + double fAnimationDelay(static_cast<double>(rSet.Get(SDRATTR_TEXT_ANIDELAY).GetValue())); + double fSingleStepWidth(static_cast<double>(rSet.Get(SDRATTR_TEXT_ANIAMOUNT).GetValue())); const SdrTextAniDirection eDirection(GetTextAniDirection()); const bool bForward(SdrTextAniDirection::Right == eDirection || SdrTextAniDirection::Down == eDirection); diff --git a/svx/source/svdraw/svdotextpathdecomposition.cxx b/svx/source/svdraw/svdotextpathdecomposition.cxx index 26de0ee7d22c..45e01138f885 100644 --- a/svx/source/svdraw/svdotextpathdecomposition.cxx +++ b/svx/source/svdraw/svdotextpathdecomposition.cxx @@ -98,7 +98,7 @@ namespace for(sal_Int32 a=0; a < mnTextLength; a++) { - maDblDXArray.push_back((double)rInfo.mpDXArray[a]); + maDblDXArray.push_back(static_cast<double>(rInfo.mpDXArray[a])); } } } @@ -147,7 +147,7 @@ namespace if(maFont.IsVertical()) { - fRetval = aTextLayouter.getTextHeight() * (double)nLength; + fRetval = aTextLayouter.getTextHeight() * static_cast<double>(nLength); } else { @@ -629,7 +629,7 @@ namespace drawinglayer::primitive2d::UnifiedTransparencePrimitive2D* pNew2 = new drawinglayer::primitive2d::UnifiedTransparencePrimitive2D( aStrokePrimitiveSequence, - (double)rOutlineAttribute.getTransparence() / 100.0); + static_cast<double>(rOutlineAttribute.getTransparence()) / 100.0); aNewPrimitives.push_back(pNew2); } else diff --git a/svx/source/svdraw/svdotxat.cxx b/svx/source/svdraw/svdotxat.cxx index f6aa20a83961..7d92683764d0 100644 --- a/svx/source/svdraw/svdotxat.cxx +++ b/svx/source/svdraw/svdotxat.cxx @@ -371,7 +371,7 @@ void SdrTextObj::ImpSetTextStyleSheetListeners() sal_uIntPtr nNum=GetBroadcasterCount(); while (nNum>0) { nNum--; - SfxBroadcaster* pBroadcast=GetBroadcasterJOE((sal_uInt16)nNum); + SfxBroadcaster* pBroadcast=GetBroadcasterJOE(static_cast<sal_uInt16>(nNum)); SfxStyleSheet* pStyle=dynamic_cast<SfxStyleSheet*>( pBroadcast ); if (pStyle!=nullptr && pStyle!=GetStyleSheet()) { // special case for stylesheet of the object if (aStyleSheets.find(pStyle)==aStyleSheets.end()) { diff --git a/svx/source/svdraw/svdpage.cxx b/svx/source/svdraw/svdpage.cxx index 3a1d4a7619c0..527c17f7b609 100644 --- a/svx/source/svdraw/svdpage.cxx +++ b/svx/source/svdraw/svdpage.cxx @@ -854,7 +854,7 @@ void SdrObjList::SetNavigationOrder (const uno::Reference<container::XIndexAcces if (rxOrder.is()) { const sal_Int32 nCount = rxOrder->getCount(); - if ((sal_uInt32)nCount != maList.size()) + if (static_cast<sal_uInt32>(nCount) != maList.size()) return; if (mxNavigationOrder.get() == nullptr) diff --git a/svx/source/svdraw/svdpntv.cxx b/svx/source/svdraw/svdpntv.cxx index 625578db868c..854d445f83fd 100644 --- a/svx/source/svdraw/svdpntv.cxx +++ b/svx/source/svdraw/svdpntv.cxx @@ -379,8 +379,8 @@ sal_uInt16 SdrPaintView::ImpGetHitTolLogic(short nHitTol, const OutputDevice* pO void SdrPaintView::TheresNewMapMode() { if (mpActualOutDev) { - mnHitTolLog=(sal_uInt16)mpActualOutDev->PixelToLogic(Size(mnHitTolPix,0)).Width(); - mnMinMovLog=(sal_uInt16)mpActualOutDev->PixelToLogic(Size(mnMinMovPix,0)).Width(); + mnHitTolLog=static_cast<sal_uInt16>(mpActualOutDev->PixelToLogic(Size(mnHitTolPix,0)).Width()); + mnMinMovLog=static_cast<sal_uInt16>(mpActualOutDev->PixelToLogic(Size(mnMinMovPix,0)).Width()); } } diff --git a/svx/source/svdraw/svdpoev.cxx b/svx/source/svdraw/svdpoev.cxx index f6b9bd6d7845..7fdd6c433160 100644 --- a/svx/source/svdraw/svdpoev.cxx +++ b/svx/source/svdraw/svdpoev.cxx @@ -395,7 +395,7 @@ void SdrPolyEditView::RipUpAtMarkedPoints() nPntNum -= nMax; } - aReplaceSet.insert( (sal_uInt16)nPntNum ); + aReplaceSet.insert( static_cast<sal_uInt16>(nPntNum) ); } rPts.swap(aReplaceSet); diff --git a/svx/source/svdraw/svdsnpv.cxx b/svx/source/svdraw/svdsnpv.cxx index 24478a7ac13e..6a442f4cd538 100644 --- a/svx/source/svdraw/svdsnpv.cxx +++ b/svx/source/svdraw/svdsnpv.cxx @@ -372,31 +372,31 @@ SdrSnap SdrSnapView::SnapPos(Point& rPnt, const SdrPageView* pPV) const double fSnapWidth(aSnapWdtX); if(dx == NOT_SNAPPED && fSnapWidth != 0.0) { - double fx = (double)x; + double fx = static_cast<double>(x); // round instead of trunc - if(fx - (double)pPV->GetPageOrigin().X() >= 0.0) + if(fx - static_cast<double>(pPV->GetPageOrigin().X()) >= 0.0) fx += fSnapWidth / 2.0; else fx -= fSnapWidth / 2.0; - x = (long)((fx - (double)pPV->GetPageOrigin().X()) / fSnapWidth); - x = (long)((double)x * fSnapWidth + (double)pPV->GetPageOrigin().X()); + x = static_cast<long>((fx - static_cast<double>(pPV->GetPageOrigin().X())) / fSnapWidth); + x = static_cast<long>(static_cast<double>(x) * fSnapWidth + static_cast<double>(pPV->GetPageOrigin().X())); dx = 0; } fSnapWidth = double(aSnapWdtY); if(dy == NOT_SNAPPED && fSnapWidth) { - double fy = (double)y; + double fy = static_cast<double>(y); // round instead of trunc - if(fy - (double)pPV->GetPageOrigin().Y() >= 0.0) + if(fy - static_cast<double>(pPV->GetPageOrigin().Y()) >= 0.0) fy += fSnapWidth / 2.0; else fy -= fSnapWidth / 2.0; - y = (long)((fy - (double)pPV->GetPageOrigin().Y()) / fSnapWidth); - y = (long)((double)y * fSnapWidth + (double)pPV->GetPageOrigin().Y()); + y = static_cast<long>((fy - static_cast<double>(pPV->GetPageOrigin().Y())) / fSnapWidth); + y = static_cast<long>(static_cast<double>(y) * fSnapWidth + static_cast<double>(pPV->GetPageOrigin().Y())); dy = 0; } } diff --git a/svx/source/svdraw/svdtrans.cxx b/svx/source/svdraw/svdtrans.cxx index 1c6eff45a09e..c110d62b444f 100644 --- a/svx/source/svdraw/svdtrans.cxx +++ b/svx/source/svdraw/svdtrans.cxx @@ -174,15 +174,15 @@ double CrookRotateXPoint(Point& rPnt, Point* pC1, Point* pC2, const Point& rCent // move into the direction of the center, as a basic position for the rotation pC1->Y()-=y0; // resize, account for the distance from the center - pC1->Y()=svx::Round(((double)pC1->Y()) /rRad.X()*(cx-pC1->X())); + pC1->Y()=svx::Round(static_cast<double>(pC1->Y()) /rRad.X()*(cx-pC1->X())); pC1->Y()+=cy; } else { // move into the direction of the center, as a basic position for the rotation pC1->X()-=x0; // resize, account for the distance from the center long nPntRad=cy-pC1->Y(); - double nFact=(double)nPntRad/(double)rRad.Y(); - pC1->X()=svx::Round((double)pC1->X()*nFact); + double nFact=static_cast<double>(nPntRad)/static_cast<double>(rRad.Y()); + pC1->X()=svx::Round(static_cast<double>(pC1->X())*nFact); pC1->X()+=cx; } RotatePoint(*pC1,rCenter,sn,cs); @@ -192,15 +192,15 @@ double CrookRotateXPoint(Point& rPnt, Point* pC1, Point* pC2, const Point& rCent // move into the direction of the center, as a basic position for the rotation pC2->Y()-=y0; // resize, account for the distance from the center - pC2->Y()=svx::Round(((double)pC2->Y()) /rRad.X()*(rCenter.X()-pC2->X())); + pC2->Y()=svx::Round(static_cast<double>(pC2->Y()) /rRad.X()*(rCenter.X()-pC2->X())); pC2->Y()+=cy; } else { // move into the direction of the center, as a basic position for the rotation pC2->X()-=x0; // resize, account for the distance from the center long nPntRad=rCenter.Y()-pC2->Y(); - double nFact=(double)nPntRad/(double)rRad.Y(); - pC2->X()=svx::Round((double)pC2->X()*nFact); + double nFact=static_cast<double>(nPntRad)/static_cast<double>(rRad.Y()); + pC2->X()=svx::Round(static_cast<double>(pC2->X())*nFact); pC2->X()+=cx; } RotatePoint(*pC2,rCenter,sn,cs); @@ -277,7 +277,7 @@ double CrookStretchXPoint(Point& rPnt, Point* pC1, Point* pC2, const Point& rCen long nBtm=rRefRect.Bottom(); long nHgt=nBtm-nTop; long dy=rPnt.Y()-y0; - double a=((double)(y0-nTop))/nHgt; + double a=static_cast<double>(y0-nTop)/nHgt; a*=dy; rPnt.Y()=y0+svx::Round(a); } return 0.0; @@ -388,7 +388,7 @@ long GetAngle(const Point& rPnt) if (rPnt.Y()>0) a=-9000; else a=9000; } else { - a=svx::Round(atan2((double)-rPnt.Y(),(double)rPnt.X())/nPi180); + a=svx::Round(atan2(static_cast<double>(-rPnt.Y()),static_cast<double>(rPnt.X()))/nPi180); } return a; } @@ -425,7 +425,7 @@ long GetLen(const Point& rPnt) x*=x; y*=y; x+=y; - x=svx::Round(sqrt((double)x)); + x=svx::Round(sqrt(static_cast<double>(x))); return x; } else { double nx=x; diff --git a/svx/source/svdraw/svdview.cxx b/svx/source/svdraw/svdview.cxx index b93bd1da7afc..798afa63c23c 100644 --- a/svx/source/svdraw/svdview.cxx +++ b/svx/source/svdraw/svdview.cxx @@ -649,7 +649,7 @@ SdrHitKind SdrView::PickAnything(const Point& rLogicPos, SdrViewEvent& rVEvt) co if (bGlue) { pObj=pHdl->GetObj(); - nGlueId=(sal_uInt16)pHdl->GetObjHdlNum(); + nGlueId=static_cast<sal_uInt16>(pHdl->GetObjHdlNum()); } } else if (bMarked) |