diff options
163 files changed, 991 insertions, 993 deletions
diff --git a/include/svx/EnhancedCustomShapeGeometry.hxx b/include/svx/EnhancedCustomShapeGeometry.hxx index d67d6832a057..3befba19fa57 100644 --- a/include/svx/EnhancedCustomShapeGeometry.hxx +++ b/include/svx/EnhancedCustomShapeGeometry.hxx @@ -88,7 +88,7 @@ struct mso_CustomShape sal_uInt32 nHandles; }; -#define MSO_I | (sal_Int32)0x80000000 +#define MSO_I | sal_Int32(0x80000000) bool SortFilledObjectsToBackByDefault( MSO_SPT eSpType ); SVX_DLLPUBLIC bool IsCustomShapeFilledByDefault( MSO_SPT eSpType ); diff --git a/include/svx/flagsdef.hxx b/include/svx/flagsdef.hxx index 30b1ff401203..1b09540e7198 100644 --- a/include/svx/flagsdef.hxx +++ b/include/svx/flagsdef.hxx @@ -53,13 +53,13 @@ namespace o3tl // flags for SvxBorderTabPage #define SVX_HIDESHADOWCTL 0x01 -#define DISABLE_CASEMAP ((sal_uInt16)0x0001) -#define DISABLE_WORDLINE ((sal_uInt16)0x0002) -#define DISABLE_BLINK ((sal_uInt16)0x0004) -#define DISABLE_UNDERLINE_COLOR ((sal_uInt16)0x0008) +#define DISABLE_CASEMAP (sal_uInt16(0x0001)) +#define DISABLE_WORDLINE (sal_uInt16(0x0002)) +#define DISABLE_BLINK (sal_uInt16(0x0004)) +#define DISABLE_UNDERLINE_COLOR (sal_uInt16(0x0008)) -#define DISABLE_LANGUAGE ((sal_uInt16)0x0010) -#define DISABLE_HIDE_LANGUAGE ((sal_uInt16)0x0020) +#define DISABLE_LANGUAGE (sal_uInt16(0x0010)) +#define DISABLE_HIDE_LANGUAGE (sal_uInt16(0x0020)) // flags for SvxCharBasePage's child class #define SVX_PREVIEW_CHARACTER 0x01 diff --git a/include/svx/gridctrl.hxx b/include/svx/gridctrl.hxx index 17755af8f086..d3d3c778b5bc 100644 --- a/include/svx/gridctrl.hxx +++ b/include/svx/gridctrl.hxx @@ -325,7 +325,7 @@ protected: virtual bool SaveModified() override; virtual bool IsModified() const override; - virtual sal_uInt16 AppendColumn(const OUString& rName, sal_uInt16 nWidth, sal_uInt16 nPos = HEADERBAR_APPEND, sal_uInt16 nId = (sal_uInt16)-1) override; + virtual sal_uInt16 AppendColumn(const OUString& rName, sal_uInt16 nWidth, sal_uInt16 nPos = HEADERBAR_APPEND, sal_uInt16 nId = sal_uInt16(-1)) override; void RemoveColumn(sal_uInt16 nId); DbGridColumn* CreateColumn(sal_uInt16 nId) const; virtual void ColumnMoved(sal_uInt16 nId) override; @@ -418,7 +418,7 @@ public: // the number of columns in the model sal_uInt16 GetViewColCount() const { return ColCount() - 1; } - sal_uInt16 GetModelColCount() const { return (sal_uInt16)m_aColumns.size(); } + sal_uInt16 GetModelColCount() const { return static_cast<sal_uInt16>(m_aColumns.size()); } // reverse to GetViewColumnPos: Id of position, the first non-handle column has position 0 sal_uInt16 GetColumnIdFromViewPos( sal_uInt16 nPos ) const { return GetColumnId(nPos + 1); } sal_uInt16 GetColumnIdFromModelPos( sal_uInt16 nPos ) const; diff --git a/include/svx/scene3d.hxx b/include/svx/scene3d.hxx index c0a9a247746b..17351e83d9fd 100644 --- a/include/svx/scene3d.hxx +++ b/include/svx/scene3d.hxx @@ -108,7 +108,7 @@ public: // Distance: double GetDistance() const - { return (double)GetObjectItemSet().Get(SDRATTR_3DSCENE_DISTANCE).GetValue(); } + { return static_cast<double>(GetObjectItemSet().Get(SDRATTR_3DSCENE_DISTANCE).GetValue()); } // Focal length: before cm, now 1/10th mm (*100) double GetFocalLength() const diff --git a/include/svx/sdasitm.hxx b/include/svx/sdasitm.hxx index 3af42c9c19ba..254aba0a7c4d 100644 --- a/include/svx/sdasitm.hxx +++ b/include/svx/sdasitm.hxx @@ -84,7 +84,7 @@ inline SdrOnOffItem makeSdrTextWordWrapItem( bool bAuto ) { inline size_t SdrCustomShapeGeometryItem::PropertyPairHash::operator()( const SdrCustomShapeGeometryItem::PropertyPair &r1 ) const { - return (size_t)r1.first.hashCode() + r1.second.hashCode(); + return static_cast<size_t>(r1.first.hashCode()) + r1.second.hashCode(); }; #endif diff --git a/include/svx/svdtrans.hxx b/include/svx/svdtrans.hxx index 6ad879d3a822..f3e25203ff2e 100644 --- a/include/svx/svdtrans.hxx +++ b/include/svx/svdtrans.hxx @@ -51,7 +51,7 @@ class XPolygon; class XPolyPolygon; namespace svx { - inline long Round(double a) { return a>0.0 ? (long)(a+0.5) : -(long)((-a)+0.5); } + inline long Round(double a) { return a>0.0 ? static_cast<long>(a+0.5) : -static_cast<long>((-a)+0.5); } } inline void MoveRect(tools::Rectangle& rRect, const Size& S) { rRect.Move(S.Width(),S.Height()); } @@ -145,11 +145,11 @@ inline double GetCrookAngle(Point& rPnt, const Point& rCenter, const Point& rRad double nAngle; if (bVertical) { long dy=rPnt.Y()-rCenter.Y(); - nAngle=(double)dy/(double)rRad.Y(); + nAngle=static_cast<double>(dy)/static_cast<double>(rRad.Y()); rPnt.Y()=rCenter.Y(); } else { long dx=rCenter.X()-rPnt.X(); - nAngle=(double)dx/(double)rRad.X(); + nAngle=static_cast<double>(dx)/static_cast<double>(rRad.X()); rPnt.X()=rCenter.X(); } return nAngle; diff --git a/include/svx/transfrmhelper.hxx b/include/svx/transfrmhelper.hxx index d5f293dbc10a..ddc542c8a533 100644 --- a/include/svx/transfrmhelper.hxx +++ b/include/svx/transfrmhelper.hxx @@ -30,11 +30,11 @@ public: static void ConvertRect(basegfx::B2DRange& rRange, const sal_uInt16 nDigits, const MapUnit ePoolUnit, const FieldUnit eDlgUnit) { const basegfx::B2DPoint aTopLeft( - (double)MetricField::ConvertValue(basegfx::fround(rRange.getMinX()), nDigits, ePoolUnit, eDlgUnit), - (double)MetricField::ConvertValue(basegfx::fround(rRange.getMinY()), nDigits, ePoolUnit, eDlgUnit)); + static_cast<double>(MetricField::ConvertValue(basegfx::fround(rRange.getMinX()), nDigits, ePoolUnit, eDlgUnit)), + static_cast<double>(MetricField::ConvertValue(basegfx::fround(rRange.getMinY()), nDigits, ePoolUnit, eDlgUnit))); const basegfx::B2DPoint aBottomRight( - (double)MetricField::ConvertValue(basegfx::fround(rRange.getMaxX()), nDigits, ePoolUnit, eDlgUnit), - (double)MetricField::ConvertValue(basegfx::fround(rRange.getMaxY()), nDigits, ePoolUnit, eDlgUnit)); + static_cast<double>(MetricField::ConvertValue(basegfx::fround(rRange.getMaxX()), nDigits, ePoolUnit, eDlgUnit)), + static_cast<double>(MetricField::ConvertValue(basegfx::fround(rRange.getMaxY()), nDigits, ePoolUnit, eDlgUnit))); rRange = basegfx::B2DRange(aTopLeft, aBottomRight); } diff --git a/svx/source/accessibility/ChildrenManagerImpl.cxx b/svx/source/accessibility/ChildrenManagerImpl.cxx index 7cf63fdf7f49..d16b23aa792f 100644 --- a/svx/source/accessibility/ChildrenManagerImpl.cxx +++ b/svx/source/accessibility/ChildrenManagerImpl.cxx @@ -128,7 +128,7 @@ uno::Reference<XAccessible> ChildrenManagerImpl::GetChild (long nIndex) { // Check whether the given index is valid. - if (nIndex < 0 || (unsigned long)nIndex >= maVisibleChildren.size()) + if (nIndex < 0 || static_cast<unsigned long>(nIndex) >= maVisibleChildren.size()) throw lang::IndexOutOfBoundsException ( "no accessible child with index " + OUString::number(nIndex), mxParent); diff --git a/svx/source/accessibility/charmapacc.cxx b/svx/source/accessibility/charmapacc.cxx index dcb869c75a3d..2bb6e448d2a7 100644 --- a/svx/source/accessibility/charmapacc.cxx +++ b/svx/source/accessibility/charmapacc.cxx @@ -618,7 +618,7 @@ OUString SAL_CALL SvxShowCharSetItemAcc::getAccessibleDescription() sal_UCS4 c_Shifted = c; for( int i = 0; i < tmp_len; ++i ) { - char h = (char)(c_Shifted & 0x0F); + char h = static_cast<char>(c_Shifted & 0x0F); buf[tmp_len+1-i] = (h > 9) ? (h - 10 + 'A') : (h + '0'); c_Shifted >>= 4; } diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx index 668225f9743b..518b74249c16 100644 --- a/svx/source/customshapes/EnhancedCustomShape2d.cxx +++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx @@ -61,13 +61,13 @@ using namespace ::com::sun::star::drawing::EnhancedCustomShapeSegmentCommand; void EnhancedCustomShape2d::SetEnhancedCustomShapeParameter( EnhancedCustomShapeParameter& rParameter, const sal_Int32 nValue ) { - sal_uInt32 nDat = (sal_uInt32)nValue; + sal_uInt32 nDat = static_cast<sal_uInt32>(nValue); sal_Int32 nNewValue = nValue; // check if this is a special point if ( ( nDat >> 16 ) == 0x8000 ) { - nNewValue = (sal_uInt16)nDat; + nNewValue = static_cast<sal_uInt16>(nDat); rParameter.Type = EnhancedCustomShapeParameterType::EQUATION; } else @@ -642,8 +642,8 @@ void EnhancedCustomShape2d::SetPathSize( sal_Int32 nIndex ) nCoordHeight = nCoordHeightG; } - fXScale = nCoordWidth == 0 ? 0.0 : (double)aLogicRect.GetWidth() / (double)nCoordWidth; - fYScale = nCoordHeight == 0 ? 0.0 : (double)aLogicRect.GetHeight() / (double)nCoordHeight; + fXScale = nCoordWidth == 0 ? 0.0 : static_cast<double>(aLogicRect.GetWidth()) / static_cast<double>(nCoordWidth); + fYScale = nCoordHeight == 0 ? 0.0 : static_cast<double>(aLogicRect.GetHeight()) / static_cast<double>(nCoordHeight); if ( bOOXMLShape ) { SAL_INFO( @@ -656,21 +656,21 @@ void EnhancedCustomShape2d::SetPathSize( sal_Int32 nIndex ) if ( nCoordWidth == 0 ) { if ( nWidth ) - fXScale = (double)aLogicRect.GetWidth() / (double)nWidth; + fXScale = static_cast<double>(aLogicRect.GetWidth()) / static_cast<double>(nWidth); else fXScale = 1.0; } if ( nCoordHeight == 0 ) { if ( nHeight ) - fYScale = (double)aLogicRect.GetHeight() / (double)nHeight; + fYScale = static_cast<double>(aLogicRect.GetHeight()) / static_cast<double>(nHeight); else fYScale = 1.0; } } - if ( (sal_uInt32)nXRef != 0x80000000 && aLogicRect.GetHeight() ) + if ( static_cast<sal_uInt32>(nXRef) != 0x80000000 && aLogicRect.GetHeight() ) { - fXRatio = (double)aLogicRect.GetWidth() / (double)aLogicRect.GetHeight(); + fXRatio = static_cast<double>(aLogicRect.GetWidth()) / static_cast<double>(aLogicRect.GetHeight()); if ( fXRatio > 1 ) fXScale /= fXRatio; else @@ -678,9 +678,9 @@ void EnhancedCustomShape2d::SetPathSize( sal_Int32 nIndex ) } else fXRatio = 1.0; - if ( (sal_uInt32)nYRef != 0x80000000 && aLogicRect.GetWidth() ) + if ( static_cast<sal_uInt32>(nYRef) != 0x80000000 && aLogicRect.GetWidth() ) { - fYRatio = (double)aLogicRect.GetHeight() / (double)aLogicRect.GetWidth(); + fYRatio = static_cast<double>(aLogicRect.GetHeight()) / static_cast<double>(aLogicRect.GetWidth()); if ( fYRatio > 1 ) fYScale /= fYRatio; else @@ -747,7 +747,7 @@ EnhancedCustomShape2d::EnhancedCustomShape2d( SdrObject* pAObj ) : *pAny >>= bFlipV; if ( dynamic_cast<const SdrObjCustomShape*>( pCustomShapeObj) != nullptr ) // should always be a SdrObjCustomShape, but you don't know - nRotateAngle = (sal_Int32)(static_cast<SdrObjCustomShape*>(pCustomShapeObj)->GetObjectRotation() * 100.0); + nRotateAngle = static_cast<sal_Int32>(static_cast<SdrObjCustomShape*>(pCustomShapeObj)->GetObjectRotation() * 100.0); else nRotateAngle = pCustomShapeObj->GetRotateAngle(); @@ -832,8 +832,8 @@ double EnhancedCustomShape2d::GetEnumFunc( const ExpressionFunct eFunc ) const case ExpressionFunct::EnumPi : fRet = F_PI; break; case ExpressionFunct::EnumLeft : fRet = 0.0; break; case ExpressionFunct::EnumTop : fRet = 0.0; break; - case ExpressionFunct::EnumRight : fRet = (double)nCoordWidth * fXRatio; break; - case ExpressionFunct::EnumBottom : fRet = (double)nCoordHeight * fYRatio; break; + case ExpressionFunct::EnumRight : fRet = static_cast<double>(nCoordWidth) * fXRatio; break; + case ExpressionFunct::EnumBottom : fRet = static_cast<double>(nCoordHeight) * fYRatio; break; case ExpressionFunct::EnumXStretch : fRet = nXRef; break; case ExpressionFunct::EnumYStretch : fRet = nYRef; break; case ExpressionFunct::EnumHasStroke : fRet = bStroked ? 1.0 : 0.0; break; @@ -857,7 +857,7 @@ double EnhancedCustomShape2d::GetAdjustValueAsDouble( const sal_Int32 nIndex ) c { sal_Int32 nNumber = 0; seqAdjustmentValues[ nIndex ].Value >>= nNumber; - fNumber = (double)nNumber; + fNumber = static_cast<double>(nNumber); } } return fNumber; @@ -866,7 +866,7 @@ double EnhancedCustomShape2d::GetEquationValueAsDouble( const sal_Int32 nIndex ) { double fNumber = 0.0; static sal_uInt32 nLevel = 0; - if ( nIndex < (sal_Int32)vNodesSharedPtr.size() ) + if ( nIndex < static_cast<sal_Int32>(vNodesSharedPtr.size()) ) { if ( vNodesSharedPtr[ nIndex ].get() ) { nLevel ++; @@ -935,7 +935,7 @@ Point EnhancedCustomShape2d::GetPoint( const css::drawing::EnhancedCustomShapePa { fVal *= fYScale; } - aRetValue.Y() = (sal_Int32)fVal; + aRetValue.Y() = static_cast<sal_Int32>(fVal); } else // width { @@ -1052,15 +1052,15 @@ Color EnhancedCustomShape2d::GetColorData( const Color& rFillColor, sal_uInt32 n { if (dBrightness >=0.0) { //lighten, blending with white - return Color( (sal_uInt8)static_cast< sal_Int32 >( basegfx::clamp(rFillColor.GetRed() * (1.0-dBrightness) + dBrightness * 255.0, 0.0, 255.0) ), - (sal_uInt8)static_cast< sal_Int32 >( basegfx::clamp(rFillColor.GetGreen() * (1.0-dBrightness) + dBrightness * 255.0, 0.0, 255.0) ), - (sal_uInt8)static_cast< sal_Int32 >( basegfx::clamp(rFillColor.GetBlue() * (1.0-dBrightness) + dBrightness * 255.0, 0.0, 255.0) ) ); + return Color( static_cast<sal_uInt8>(static_cast< sal_Int32 >( basegfx::clamp(rFillColor.GetRed() * (1.0-dBrightness) + dBrightness * 255.0, 0.0, 255.0) )), + static_cast<sal_uInt8>(static_cast< sal_Int32 >( basegfx::clamp(rFillColor.GetGreen() * (1.0-dBrightness) + dBrightness * 255.0, 0.0, 255.0) )), + static_cast<sal_uInt8>(static_cast< sal_Int32 >( basegfx::clamp(rFillColor.GetBlue() * (1.0-dBrightness) + dBrightness * 255.0, 0.0, 255.0) )) ); } else { //darken (indicated by negative sign), blending with black - return Color( (sal_uInt8)static_cast< sal_Int32 >( basegfx::clamp(rFillColor.GetRed() * (1.0+dBrightness), 0.0, 255.0) ), - (sal_uInt8)static_cast< sal_Int32 >( basegfx::clamp(rFillColor.GetGreen() * (1.0+dBrightness), 0.0, 255.0) ), - (sal_uInt8)static_cast< sal_Int32 >( basegfx::clamp(rFillColor.GetBlue() * (1.0+dBrightness), 0.0, 255.0) ) ); + return Color( static_cast<sal_uInt8>(static_cast< sal_Int32 >( basegfx::clamp(rFillColor.GetRed() * (1.0+dBrightness), 0.0, 255.0) )), + static_cast<sal_uInt8>(static_cast< sal_Int32 >( basegfx::clamp(rFillColor.GetGreen() * (1.0+dBrightness), 0.0, 255.0) )), + static_cast<sal_uInt8>(static_cast< sal_Int32 >( basegfx::clamp(rFillColor.GetBlue() * (1.0+dBrightness), 0.0, 255.0) )) ); } } } @@ -1091,9 +1091,9 @@ Color EnhancedCustomShape2d::GetColorData( const Color& rFillColor, sal_uInt32 n } aHSVColor = basegfx::utils::hsv2rgb(aHSVColor); - return Color( (sal_uInt8)static_cast< sal_Int32 >( basegfx::clamp(aHSVColor.getRed(),0.0,1.0) * 255.0 + 0.5 ), - (sal_uInt8)static_cast< sal_Int32 >( basegfx::clamp(aHSVColor.getGreen(),0.0,1.0) * 255.0 + 0.5 ), - (sal_uInt8)static_cast< sal_Int32 >( basegfx::clamp(aHSVColor.getBlue(),0.0,1.0) * 255.0 + 0.5 ) ); + return Color( static_cast<sal_uInt8>(static_cast< sal_Int32 >( basegfx::clamp(aHSVColor.getRed(),0.0,1.0) * 255.0 + 0.5 )), + static_cast<sal_uInt8>(static_cast< sal_Int32 >( basegfx::clamp(aHSVColor.getGreen(),0.0,1.0) * 255.0 + 0.5 )), + static_cast<sal_uInt8>(static_cast< sal_Int32 >( basegfx::clamp(aHSVColor.getBlue(),0.0,1.0) * 255.0 + 0.5 )) ); } } @@ -1648,8 +1648,8 @@ void EnhancedCustomShape2d::CreateSubPath( sal_Int32& rSrcPt, sal_Int32& rSegmen fWidth *= fXScale; fHeight*= fYScale; - Point aP( (sal_Int32)( _aCenter.X() - fWidth ), (sal_Int32)( _aCenter.Y() - fHeight ) ); - Size aS( (sal_Int32)( fWidth * 2.0 ), (sal_Int32)( fHeight * 2.0 ) ); + Point aP( static_cast<sal_Int32>( _aCenter.X() - fWidth ), static_cast<sal_Int32>( _aCenter.Y() - fHeight ) ); + Size aS( static_cast<sal_Int32>( fWidth * 2.0 ), static_cast<sal_Int32>( fHeight * 2.0 ) ); tools::Rectangle aRect( aP, aS ); if ( aRect.GetWidth() && aRect.GetHeight() ) { @@ -1657,11 +1657,11 @@ void EnhancedCustomShape2d::CreateSubPath( sal_Int32& rSrcPt, sal_Int32& rSegmen GetParameter( fStartAngle, seqCoordinates[ rSrcPt + 2 ].First, false, false ); GetParameter( fEndAngle , seqCoordinates[ rSrcPt + 2 ].Second, false, false ); - if ( ((sal_Int32)fStartAngle % 360) != ((sal_Int32)fEndAngle % 360) ) + if ( (static_cast<sal_Int32>(fStartAngle) % 360) != (static_cast<sal_Int32>(fEndAngle) % 360) ) { - if ( (sal_Int32)fStartAngle & 0x7fff0000 ) // SJ: if the angle was imported from our escher import, then the + if ( static_cast<sal_Int32>(fStartAngle) & 0x7fff0000 ) // SJ: if the angle was imported from our escher import, then the fStartAngle /= 65536.0; // value is shifted by 16. TODO: already change the fixed float to a - if ( (sal_Int32)fEndAngle & 0x7fff0000 ) // double in the import filter + if ( static_cast<sal_Int32>(fEndAngle) & 0x7fff0000 ) // double in the import filter { fEndAngle /= 65536.0; fEndAngle = fEndAngle + fStartAngle; @@ -1678,7 +1678,7 @@ void EnhancedCustomShape2d::CreateSubPath( sal_Int32& rSrcPt, sal_Int32& rSegmen double fy1 = ( -sin( fStartAngle * F_PI180 ) * 65536.0 * fYScale ) + fCenterY; double fx2 = ( cos( fEndAngle * F_PI180 ) * 65536.0 * fXScale ) + fCenterX; double fy2 = ( -sin( fEndAngle * F_PI180 ) * 65536.0 * fYScale ) + fCenterY; - aNewB2DPolygon.append(CreateArc( aRect, Point( (sal_Int32)fx1, (sal_Int32)fy1 ), Point( (sal_Int32)fx2, (sal_Int32)fy2 ), false)); + aNewB2DPolygon.append(CreateArc( aRect, Point( static_cast<sal_Int32>(fx1), static_cast<sal_Int32>(fy1) ), Point( static_cast<sal_Int32>(fx2), static_cast<sal_Int32>(fy2) ), false)); } else { /* SJ: TODO: this block should be replaced sometimes, because the current point @@ -1686,8 +1686,8 @@ void EnhancedCustomShape2d::CreateSubPath( sal_Int32& rSrcPt, sal_Int32& rSegmen point if ANGLEELLIPSETO was used, but the method CreateArc is at the moment not able to draw full circles (if startangle is 0 and endangle 360 nothing is painted :-( */ - sal_Int32 nXControl = (sal_Int32)((double)aRect.GetWidth() * 0.2835 ); - sal_Int32 nYControl = (sal_Int32)((double)aRect.GetHeight() * 0.2835 ); + sal_Int32 nXControl = static_cast<sal_Int32>(static_cast<double>(aRect.GetWidth()) * 0.2835 ); + sal_Int32 nYControl = static_cast<sal_Int32>(static_cast<double>(aRect.GetHeight()) * 0.2835 ); Point aCenter( aRect.Center() ); // append start point @@ -1792,12 +1792,12 @@ void EnhancedCustomShape2d::CreateSubPath( sal_Int32& rSrcPt, sal_Int32& rSegmen if ( aRect.GetWidth() && aRect.GetHeight() ) { Point aCenter( aRect.Center() ); - Point aStart( GetPoint( seqCoordinates[ (sal_uInt16)( rSrcPt + nXor ) ], true, true ) ); - Point aEnd( GetPoint( seqCoordinates[ (sal_uInt16)( rSrcPt + ( nXor ^ 1 ) ) ], true, true ) ); - aStart.X() = (sal_Int32)( (double)( aStart.X() - aCenter.X() ) ) + aCenter.X(); - aStart.Y() = (sal_Int32)( (double)( aStart.Y() - aCenter.Y() ) ) + aCenter.Y(); - aEnd.X() = (sal_Int32)( (double)( aEnd.X() - aCenter.X() ) ) + aCenter.X(); - aEnd.Y() = (sal_Int32)( (double)( aEnd.Y() - aCenter.Y() ) ) + aCenter.Y(); + Point aStart( GetPoint( seqCoordinates[ static_cast<sal_uInt16>( rSrcPt + nXor ) ], true, true ) ); + Point aEnd( GetPoint( seqCoordinates[ static_cast<sal_uInt16>( rSrcPt + ( nXor ^ 1 ) ) ], true, true ) ); + aStart.X() = static_cast<sal_Int32>( static_cast<double>( aStart.X() - aCenter.X() ) ) + aCenter.X(); + aStart.Y() = static_cast<sal_Int32>( static_cast<double>( aStart.Y() - aCenter.Y() ) ) + aCenter.Y(); + aEnd.X() = static_cast<sal_Int32>( static_cast<double>( aEnd.X() - aCenter.X() ) ) + aCenter.X(); + aEnd.Y() = static_cast<sal_Int32>( static_cast<double>( aEnd.Y() - aCenter.Y() ) ) + aCenter.Y(); aNewB2DPolygon.append(CreateArc( aRect, aStart, aEnd, bClockwise)); } rSrcPt += 4; @@ -1811,11 +1811,11 @@ void EnhancedCustomShape2d::CreateSubPath( sal_Int32& rSrcPt, sal_Int32& rSegmen for ( sal_uInt16 i = 0; ( i < nPntCount ) && ( rSrcPt + 1 < nCoordSize ); i++ ) { - GetParameter ( fWR, seqCoordinates[ (sal_uInt16)rSrcPt ].First, true, false ); - GetParameter ( fHR, seqCoordinates[ (sal_uInt16)rSrcPt ].Second, false, true ); + GetParameter ( fWR, seqCoordinates[ static_cast<sal_uInt16>(rSrcPt) ].First, true, false ); + GetParameter ( fHR, seqCoordinates[ static_cast<sal_uInt16>(rSrcPt) ].Second, false, true ); - GetParameter ( fStartAngle, seqCoordinates[ (sal_uInt16)( rSrcPt + 1) ].First, false, false ); - GetParameter ( fSwingAngle, seqCoordinates[ (sal_uInt16)( rSrcPt + 1 ) ].Second, false, false ); + GetParameter ( fStartAngle, seqCoordinates[ static_cast<sal_uInt16>( rSrcPt + 1) ].First, false, false ); + GetParameter ( fSwingAngle, seqCoordinates[ static_cast<sal_uInt16>( rSrcPt + 1 ) ].Second, false, false ); // Convert angles to radians, but don't do any scaling / translation yet. diff --git a/svx/source/customshapes/EnhancedCustomShape3d.cxx b/svx/source/customshapes/EnhancedCustomShape3d.cxx index d9968a768142..535f1c9a2ab9 100644 --- a/svx/source/customshapes/EnhancedCustomShape3d.cxx +++ b/svx/source/customshapes/EnhancedCustomShape3d.cxx @@ -229,16 +229,16 @@ Point EnhancedCustomShape3d::Transformation2D::Transform2D( const basegfx::B3DPo Point aPoint2D; if ( eProjectionMode == drawing::ProjectionMode_PARALLEL ) { - aPoint2D.X() = (sal_Int32)rPoint3D.getX(); - aPoint2D.Y() = (sal_Int32)rPoint3D.getY(); + aPoint2D.X() = static_cast<sal_Int32>(rPoint3D.getX()); + aPoint2D.Y() = static_cast<sal_Int32>(rPoint3D.getY()); } else { double fX = rPoint3D.getX() - fOriginX; double fY = rPoint3D.getY() - fOriginY; double f = ( fZScreen - fViewPoint.getZ() ) / ( rPoint3D.getZ() - fViewPoint.getZ() ); - aPoint2D.X() = (sal_Int32)(( fX - fViewPoint.getX() ) * f + fViewPoint.getX() + fOriginX ); - aPoint2D.Y() = (sal_Int32)(( fY - fViewPoint.getY() ) * f + fViewPoint.getY() + fOriginY ); + aPoint2D.X() = static_cast<sal_Int32>(( fX - fViewPoint.getX() ) * f + fViewPoint.getX() + fOriginX ); + aPoint2D.Y() = static_cast<sal_Int32>(( fY - fViewPoint.getY() ) * f + fViewPoint.getY() + fOriginY ); } aPoint2D.Move( aCenter.X(), aCenter.Y() ); return aPoint2D; @@ -513,13 +513,13 @@ SdrObject* EnhancedCustomShape3d::Create3DObject( const SdrObject* pShape2d, con const XFillBitmapItem& rBmpItm = p3DObj->GetMergedItem(XATTR_FILLBITMAP); aFillBmp = rBmpItm.GetGraphicObject().GetGraphic().GetBitmapEx(); Size aBmpSize( aFillBmp.GetSizePixel() ); - double fXScale = (double)aBoundRect.GetWidth() / (double)aSnapRect.GetWidth(); - double fYScale = (double)aBoundRect.GetHeight() / (double)aSnapRect.GetHeight(); + double fXScale = static_cast<double>(aBoundRect.GetWidth()) / static_cast<double>(aSnapRect.GetWidth()); + double fYScale = static_cast<double>(aBoundRect.GetHeight()) / static_cast<double>(aSnapRect.GetHeight()); - Point aPt( (sal_Int32)( (double)( aBoundRect.Left() - aSnapRect.Left() )* (double)aBmpSize.Width() / (double)aSnapRect.GetWidth() ), - (sal_Int32)( (double)( aBoundRect.Top() - aSnapRect.Top() ) * (double)aBmpSize.Height() / (double)aSnapRect.GetHeight() ) ); - Size aSize( (sal_Int32)( aBmpSize.Width() * fXScale ), - (sal_Int32)( aBmpSize.Height() * fYScale ) ); + Point aPt( static_cast<sal_Int32>( static_cast<double>( aBoundRect.Left() - aSnapRect.Left() )* static_cast<double>(aBmpSize.Width()) / static_cast<double>(aSnapRect.GetWidth()) ), + static_cast<sal_Int32>( static_cast<double>( aBoundRect.Top() - aSnapRect.Top() ) * static_cast<double>(aBmpSize.Height()) / static_cast<double>(aSnapRect.GetHeight()) ) ); + Size aSize( static_cast<sal_Int32>( aBmpSize.Width() * fXScale ), + static_cast<sal_Int32>( aBmpSize.Height() * fYScale ) ); tools::Rectangle aCropRect( aPt, aSize ); aFillBmp.Crop( aCropRect ); p3DObj->SetMergedItem(XFillBitmapItem(OUString(), Graphic(aFillBmp))); @@ -670,13 +670,13 @@ SdrObject* EnhancedCustomShape3d::Create3DObject( const SdrObject* pShape2d, con /* sal_Bool bLight2Harsh = */ GetBool( rGeometryItem, "SecondLightHarsh", false ); /* sal_Bool bLightFace = */ GetBool( rGeometryItem, "LightFace", false ); - sal_uInt16 nAmbientColor = (sal_uInt16)( fAmbientIntensity * 255.0 ); + sal_uInt16 nAmbientColor = static_cast<sal_uInt16>( fAmbientIntensity * 255.0 ); if ( nAmbientColor > 255 ) nAmbientColor = 255; - Color aGlobalAmbientColor( (sal_uInt8)nAmbientColor, (sal_uInt8)nAmbientColor, (sal_uInt8)nAmbientColor ); + Color aGlobalAmbientColor( static_cast<sal_uInt8>(nAmbientColor), static_cast<sal_uInt8>(nAmbientColor), static_cast<sal_uInt8>(nAmbientColor) ); pScene->GetProperties().SetObjectItem( makeSvx3DAmbientcolorItem( aGlobalAmbientColor ) ); - sal_uInt8 nSpotLight1 = (sal_uInt8)( fLightIntensity * 255.0 ); + sal_uInt8 nSpotLight1 = static_cast<sal_uInt8>( fLightIntensity * 255.0 ); basegfx::B3DVector aSpotLight1( aFirstLightDirection.DirectionX, - ( aFirstLightDirection.DirectionY ), -( aFirstLightDirection.DirectionZ ) ); aSpotLight1.normalize(); pScene->GetProperties().SetObjectItem( makeSvx3DLightOnOff1Item( true ) ); @@ -684,7 +684,7 @@ SdrObject* EnhancedCustomShape3d::Create3DObject( const SdrObject* pShape2d, con pScene->GetProperties().SetObjectItem( makeSvx3DLightcolor1Item( aAmbientSpot1Color ) ); pScene->GetProperties().SetObjectItem( makeSvx3DLightDirection1Item( aSpotLight1 ) ); - sal_uInt8 nSpotLight2 = (sal_uInt8)( fLight2Intensity * 255.0 ); + sal_uInt8 nSpotLight2 = static_cast<sal_uInt8>( fLight2Intensity * 255.0 ); basegfx::B3DVector aSpotLight2( aSecondLightDirection.DirectionX, -aSecondLightDirection.DirectionY, -aSecondLightDirection.DirectionZ ); aSpotLight2.normalize(); pScene->GetProperties().SetObjectItem( makeSvx3DLightOnOff2Item( true ) ); @@ -708,14 +708,14 @@ SdrObject* EnhancedCustomShape3d::Create3DObject( const SdrObject* pShape2d, con aSpecularCol = Color( 200, 200, 200 ); fSpecular += 0.15; } - sal_Int32 nIntensity = (sal_Int32)fSpecular * 100; + sal_Int32 nIntensity = static_cast<sal_Int32>(fSpecular) * 100; if ( nIntensity > 100 ) nIntensity = 100; else if ( nIntensity < 0 ) nIntensity = 0; nIntensity = 100 - nIntensity; pScene->GetProperties().SetObjectItem( makeSvx3DMaterialSpecularItem( aSpecularCol ) ); - pScene->GetProperties().SetObjectItem( makeSvx3DMaterialSpecularIntensityItem( (sal_uInt16)nIntensity ) ); + pScene->GetProperties().SetObjectItem( makeSvx3DMaterialSpecularIntensityItem( static_cast<sal_uInt16>(nIntensity) ) ); pScene->SetLogicRect( CalculateNewSnapRect( pCustomShape, aSnapRect, aBoundRect2d, pMap ) ); @@ -746,12 +746,12 @@ tools::Rectangle EnhancedCustomShape3d::CalculateNewSnapRect( const SdrObject* p for ( i = 0; i < 4; i++ ) { - aBoundVolume.append(basegfx::B3DPoint(aPolygon[ (sal_uInt16)i ].X() - aCenter.X(), aPolygon[ (sal_uInt16)i ].Y() - aCenter.Y(), fExtrusionForward)); + aBoundVolume.append(basegfx::B3DPoint(aPolygon[ static_cast<sal_uInt16>(i) ].X() - aCenter.X(), aPolygon[ static_cast<sal_uInt16>(i) ].Y() - aCenter.Y(), fExtrusionForward)); } for ( i = 0; i < 4; i++ ) { - aBoundVolume.append(basegfx::B3DPoint(aPolygon[ (sal_uInt16)i ].X() - aCenter.X(), aPolygon[ (sal_uInt16)i ].Y() - aCenter.Y(), fExtrusionBackward)); + aBoundVolume.append(basegfx::B3DPoint(aPolygon[ static_cast<sal_uInt16>(i) ].X() - aCenter.X(), aPolygon[ static_cast<sal_uInt16>(i) ].Y() - aCenter.Y(), fExtrusionBackward)); } drawing::Direction3D aRotationCenterDefault( 0, 0, 0 ); // default seems to be wrong, a fractional size of shape has to be used!! @@ -783,7 +783,7 @@ tools::Rectangle EnhancedCustomShape3d::CalculateNewSnapRect( const SdrObject* p tools::Polygon aTransformed( 8 ); for ( i = 0; i < 8; i++ ) - aTransformed[ (sal_uInt16)i ] = aTransformation2D.Transform2D( aBoundVolume.getB3DPoint( i ) ); + aTransformed[ static_cast<sal_uInt16>(i) ] = aTransformation2D.Transform2D( aBoundVolume.getB3DPoint( i ) ); return aTransformed.GetBoundRect(); } diff --git a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx index be18edd1b2f8..a6c033a3fafb 100644 --- a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx +++ b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx @@ -337,7 +337,7 @@ void GetTextAreaOutline( const FWData& rFWData, const SdrObject* pCustomShape, F pDXArry.reset(new long[ rText.getLength() ]); pVirDev->GetTextArray( rText, pDXArry.get()); FontMetric aFontMetric( pVirDev->GetFontMetric() ); - aFont.SetAverageFontWidth( (sal_Int32)( (double)aFontMetric.GetAverageFontWidth() * ( (double)100 / (double)nCharScaleWidth ) ) ); + aFont.SetAverageFontWidth( static_cast<sal_Int32>( static_cast<double>(aFontMetric.GetAverageFontWidth()) * ( double(100) / static_cast<double>(nCharScaleWidth) ) ) ); pVirDev->SetFont( aFont ); } FWCharacterData aCharacterData; @@ -394,7 +394,7 @@ void GetTextAreaOutline( const FWData& rFWData, const SdrObject* pCustomShape, F { tools::Rectangle aPolyPolyBoundRect( aOutlineIter->GetBoundRect() ); if (aPolyPolyBoundRect.GetHeight() != rParagraphBoundRect.GetHeight() && aPolyPolyBoundRect.GetHeight()) - aOutlineIter->Scale( 1.0, (double)rParagraphBoundRect.GetHeight() / aPolyPolyBoundRect.GetHeight() ); + aOutlineIter->Scale( 1.0, static_cast<double>(rParagraphBoundRect.GetHeight()) / aPolyPolyBoundRect.GetHeight() ); aPolyPolyBoundRect = aOutlineIter->GetBoundRect(); sal_Int32 nMove = aPolyPolyBoundRect.Top() - rParagraphBoundRect.Top(); if ( nMove ) @@ -421,7 +421,7 @@ bool GetFontWorkOutline(FWData& rFWData, const SdrObject* pCustomShape) std::vector< FWTextArea >::iterator aTextAreaIter = rFWData.vTextAreas.begin(); std::vector< FWTextArea >::const_iterator aTextAreaIEnd = rFWData.vTextAreas.end(); - rFWData.nSingleLineHeight = (sal_Int32)( ( (double)pCustomShape->GetLogicRect().GetHeight() + rFWData.nSingleLineHeight = static_cast<sal_Int32>( ( static_cast<double>(pCustomShape->GetLogicRect().GetHeight()) / rFWData.nMaxParagraphsPerTextArea ) * rFWData.fHorizontalTextScaling ); if (rFWData.nSingleLineHeight == SAL_MIN_INT32) @@ -448,7 +448,7 @@ bool GetFontWorkOutline(FWData& rFWData, const SdrObject* pCustomShape) sal_Int32 nParaWidth = aParagraphIter->aBoundRect.GetWidth(); if ( nParaWidth ) { - double fScale = (double)aTextAreaIter->aBoundRect.GetWidth() / nParaWidth; + double fScale = static_cast<double>(aTextAreaIter->aBoundRect.GetWidth()) / nParaWidth; std::vector< FWCharacterData >::iterator aCharacterIter( aParagraphIter->vCharacters.begin() ); std::vector< FWCharacterData >::const_iterator aCharacterIEnd( aParagraphIter->vCharacters.end() ); @@ -574,7 +574,7 @@ void InsertMissingOutlinePoints( const std::vector< double >& rDistances, for (sal_uInt16 i = 0; i < nSize; ++i) { Point& rPoint = rPoly[ i ]; - double fDistance = (double)( rPoint.X() - rTextAreaBoundRect.Left() ) / (double)nTextWidth; + double fDistance = static_cast<double>( rPoint.X() - rTextAreaBoundRect.Left() ) / static_cast<double>(nTextWidth); if ( i ) { if ( fDistance > fLastDistance ) @@ -586,7 +586,7 @@ void InsertMissingOutlinePoints( const std::vector< double >& rDistances, sal_Int32 fX = rPoint.X() - rPt0.X(); sal_Int32 fY = rPoint.Y() - rPt0.Y(); double fd = ( 1.0 / ( fDistance - fLastDistance ) ) * ( *aIter - fLastDistance ); - rPoly.Insert( i, Point( (sal_Int32)( rPt0.X() + fX * fd ), (sal_Int32)( rPt0.Y() + fY * fd ) ) ); + rPoly.Insert( i, Point( static_cast<sal_Int32>( rPt0.X() + fX * fd ), static_cast<sal_Int32>( rPt0.Y() + fY * fd ) ) ); fDistance = *aIter; } } @@ -602,7 +602,7 @@ void InsertMissingOutlinePoints( const std::vector< double >& rDistances, sal_Int32 fX = rPoint.X() - rPt0.X(); sal_Int32 fY = rPoint.Y() - rPt0.Y(); double fd = ( 1.0 / ( fDistance - fLastDistance ) ) * ( *aIter - fLastDistance ); - rPoly.Insert( i, Point( (sal_Int32)( rPt0.X() + fX * fd ), (sal_Int32)( rPt0.Y() + fY * fd ) ) ); + rPoly.Insert( i, Point( static_cast<sal_Int32>( rPt0.X() + fX * fd ), static_cast<sal_Int32>( rPt0.Y() + fY * fd ) ) ); fDistance = *aIter; } } @@ -683,8 +683,8 @@ void FitTextOutlinesToShapeOutlines( const tools::PolyPolygon& aOutlines2d, FWDa double fx1 = aBoundRect.Left() - nLeft; double fx2 = aBoundRect.Right() - nLeft; double fy1, fy2; - double fM1 = fx1 / (double)nWidth; - double fM2 = fx2 / (double)nWidth; + double fM1 = fx1 / static_cast<double>(nWidth); + double fM2 = fx2 / static_cast<double>(nWidth); GetPoint( rOutlinePoly, vDistances, fM1, fx1, fy1 ); GetPoint( rOutlinePoly, vDistances, fM2, fx2, fy2 ); @@ -707,7 +707,7 @@ void FitTextOutlinesToShapeOutlines( const tools::PolyPolygon& aOutlines2d, FWDa fvx *= fL; fvy *= fL; rPolyPoly.Rotate( Point( aBoundRect.Center().X(), aParagraphIter->aBoundRect.Center().Y() ), sin( fAngle ), cos( fAngle ) ); - rPolyPoly.Move( (sal_Int32)( ( fx1 + fvx )- aBoundRect.Center().X() ), (sal_Int32)( ( fy1 + fvy ) - aParagraphIter->aBoundRect.Center().Y() ) ); + rPolyPoly.Move( static_cast<sal_Int32>( ( fx1 + fvx )- aBoundRect.Center().X() ), static_cast<sal_Int32>( ( fy1 + fvy ) - aParagraphIter->aBoundRect.Center().Y() ) ); ++aOutlineIter; } @@ -774,16 +774,16 @@ void FitTextOutlinesToShapeOutlines( const tools::PolyPolygon& aOutlines2d, FWDa Point& rPoint = aLocalPoly[ j ]; rPoint.X() -= nLeft; rPoint.Y() -= nTop; - double fX = (double)rPoint.X() / (double)nWidth; - double fY = (double)rPoint.Y() / (double)nHeight; + double fX = static_cast<double>(rPoint.X()) / static_cast<double>(nWidth); + double fY = static_cast<double>(rPoint.Y()) / static_cast<double>(nHeight); double fx1, fy1, fx2, fy2; GetPoint( rOutlinePoly, vDistances, fX, fx1, fy1 ); GetPoint( rOutlinePoly2, vDistances2, fX, fx2, fy2 ); double fWidth = fx2 - fx1; double fHeight= fy2 - fy1; - rPoint.X() = (sal_Int32)( fx1 + fWidth * fY ); - rPoint.Y() = (sal_Int32)( fy1 + fHeight* fY ); + rPoint.X() = static_cast<sal_Int32>( fx1 + fWidth * fY ); + rPoint.Y() = static_cast<sal_Int32>( fy1 + fHeight* fY ); } } diff --git a/svx/source/customshapes/EnhancedCustomShapeFunctionParser.cxx b/svx/source/customshapes/EnhancedCustomShapeFunctionParser.cxx index 43de790937e3..224c1e551666 100644 --- a/svx/source/customshapes/EnhancedCustomShapeFunctionParser.cxx +++ b/svx/source/customshapes/EnhancedCustomShapeFunctionParser.cxx @@ -53,7 +53,7 @@ void EnhancedCustomShape::FillEquationParameter( const EnhancedCustomShapeParame { double fValue(0.0); if ( rSource.Value >>= fValue ) - nValue = (sal_Int32)fValue; + nValue = static_cast<sal_Int32>(fValue); } else rSource.Value >>= nValue; @@ -127,10 +127,10 @@ public: EnhancedCustomShapeEquation aEquation; aEquation.nOperation = 1; aEquation.nPara[ 0 ] = 1; - aEquation.nPara[ 1 ] = (sal_Int16)aFract.GetNumerator(); - aEquation.nPara[ 2 ] = (sal_Int16)aFract.GetDenominator(); + aEquation.nPara[ 1 ] = static_cast<sal_Int16>(aFract.GetNumerator()); + aEquation.nPara[ 2 ] = static_cast<sal_Int16>(aFract.GetDenominator()); aRet.Type = EnhancedCustomShapeParameterType::EQUATION; - aRet.Value <<= (sal_Int32)rEquations.size(); + aRet.Value <<= static_cast<sal_Int32>(rEquations.size()); rEquations.push_back( aEquation ); } return aRet; @@ -334,7 +334,7 @@ public: aEquation.nOperation |= 3; FillEquationParameter( mpArg->fillNode( rEquations, nullptr, nFlags ), 0, aEquation ); aRet.Type = EnhancedCustomShapeParameterType::EQUATION; - aRet.Value <<= (sal_Int32)rEquations.size(); + aRet.Value <<= static_cast<sal_Int32>(rEquations.size()); rEquations.push_back( aEquation ); } break; @@ -344,7 +344,7 @@ public: aEquation.nOperation |= 13; FillEquationParameter( mpArg->fillNode( rEquations, nullptr, nFlags ), 0, aEquation ); aRet.Type = EnhancedCustomShapeParameterType::EQUATION; - aRet.Value <<= (sal_Int32)rEquations.size(); + aRet.Value <<= static_cast<sal_Int32>(rEquations.size()); rEquations.push_back( aEquation ); } break; @@ -364,12 +364,12 @@ public: _aEquation.nOperation |= 0xe; // sumangle FillEquationParameter( aSource, 1, _aEquation ); aSource.Type = EnhancedCustomShapeParameterType::EQUATION; - aSource.Value <<= (sal_Int32)rEquations.size(); + aSource.Value <<= static_cast<sal_Int32>(rEquations.size()); rEquations.push_back( _aEquation ); } FillEquationParameter( aSource, 1, aEquation ); aRet.Type = EnhancedCustomShapeParameterType::EQUATION; - aRet.Value <<= (sal_Int32)rEquations.size(); + aRet.Value <<= static_cast<sal_Int32>(rEquations.size()); rEquations.push_back( aEquation ); } break; @@ -389,12 +389,12 @@ public: aTmpEquation.nOperation |= 0xe; // sumangle FillEquationParameter( aSource, 1, aTmpEquation ); aSource.Type = EnhancedCustomShapeParameterType::EQUATION; - aSource.Value <<= (sal_Int32)rEquations.size(); + aSource.Value <<= static_cast<sal_Int32>(rEquations.size()); rEquations.push_back( aTmpEquation ); } FillEquationParameter( aSource, 1, aEquation ); aRet.Type = EnhancedCustomShapeParameterType::EQUATION; - aRet.Value <<= (sal_Int32)rEquations.size(); + aRet.Value <<= static_cast<sal_Int32>(rEquations.size()); rEquations.push_back( aEquation ); } break; @@ -414,12 +414,12 @@ public: aTmpEquation.nOperation |= 0xe; // sumangle FillEquationParameter( aSource, 1, aTmpEquation ); aSource.Type = EnhancedCustomShapeParameterType::EQUATION; - aSource.Value <<= (sal_Int32)rEquations.size(); + aSource.Value <<= static_cast<sal_Int32>(rEquations.size()); rEquations.push_back( aTmpEquation ); } FillEquationParameter( aSource, 1, aEquation ); aRet.Type = EnhancedCustomShapeParameterType::EQUATION; - aRet.Value <<= (sal_Int32)rEquations.size(); + aRet.Value <<= static_cast<sal_Int32>(rEquations.size()); rEquations.push_back( aEquation ); } break; @@ -437,7 +437,7 @@ public: aEquation.nPara[ 2 ] = 1; FillEquationParameter( mpArg->fillNode( rEquations, nullptr, nFlags ), 0, aEquation ); aRet.Type = EnhancedCustomShapeParameterType::EQUATION; - aRet.Value <<= (sal_Int32)rEquations.size(); + aRet.Value <<= static_cast<sal_Int32>(rEquations.size()); rEquations.push_back( aEquation ); } break; @@ -514,7 +514,7 @@ public: FillEquationParameter( mpFirstArg->fillNode( rEquations, nullptr, nFlags ), 0, aEquation ); FillEquationParameter( mpSecondArg->fillNode( rEquations, nullptr, nFlags ), 1, aEquation ); aRet.Type = EnhancedCustomShapeParameterType::EQUATION; - aRet.Value <<= (sal_Int32)rEquations.size(); + aRet.Value <<= static_cast<sal_Int32>(rEquations.size()); rEquations.push_back( aEquation ); } else if ( mpSecondArg->getType() == ExpressionFunct::EnumAdjustment ) @@ -524,7 +524,7 @@ public: FillEquationParameter( mpSecondArg->fillNode( rEquations, nullptr, nFlags ), 0, aEquation ); FillEquationParameter( mpFirstArg->fillNode( rEquations, nullptr, nFlags ), 1, aEquation ); aRet.Type = EnhancedCustomShapeParameterType::EQUATION; - aRet.Value <<= (sal_Int32)rEquations.size(); + aRet.Value <<= static_cast<sal_Int32>(rEquations.size()); rEquations.push_back( aEquation ); } else @@ -533,14 +533,14 @@ public: aSumangle1.nOperation |= 0xe; // sumangle FillEquationParameter( mpFirstArg->fillNode( rEquations, nullptr, nFlags &~EXPRESSION_FLAG_SUMANGLE_MODE ), 1, aSumangle1 ); aRet.Type = EnhancedCustomShapeParameterType::EQUATION; - aRet.Value <<= (sal_Int32)rEquations.size(); + aRet.Value <<= static_cast<sal_Int32>(rEquations.size()); rEquations.push_back( aSumangle1 ); EnhancedCustomShapeEquation aSumangle2; aSumangle2.nOperation |= 0xe; // sumangle FillEquationParameter( mpSecondArg->fillNode( rEquations, nullptr, nFlags &~EXPRESSION_FLAG_SUMANGLE_MODE ), 1, aSumangle2 ); aRet.Type = EnhancedCustomShapeParameterType::EQUATION; - aRet.Value <<= (sal_Int32)rEquations.size(); + aRet.Value <<= static_cast<sal_Int32>(rEquations.size()); rEquations.push_back( aSumangle2 ); EnhancedCustomShapeEquation aEquation; @@ -548,7 +548,7 @@ public: aEquation.nPara[ 0 ] = ( rEquations.size() - 2 ) | 0x400; aEquation.nPara[ 1 ] = ( rEquations.size() - 1 ) | 0x400; aRet.Type = EnhancedCustomShapeParameterType::EQUATION; - aRet.Value <<= (sal_Int32)rEquations.size(); + aRet.Value <<= static_cast<sal_Int32>(rEquations.size()); rEquations.push_back( aEquation ); } } @@ -568,7 +568,7 @@ public: FillEquationParameter( mpFirstArg->fillNode( rEquations, nullptr, nFlags ), 0, aEquation ); FillEquationParameter( mpSecondArg->fillNode( rEquations, nullptr, nFlags ), 1, aEquation ); aRet.Type = EnhancedCustomShapeParameterType::EQUATION; - aRet.Value <<= (sal_Int32)rEquations.size(); + aRet.Value <<= static_cast<sal_Int32>(rEquations.size()); rEquations.push_back( aEquation ); } } @@ -581,7 +581,7 @@ public: FillEquationParameter( mpFirstArg->fillNode( rEquations, nullptr, nFlags ), 0, aEquation ); FillEquationParameter( mpSecondArg->fillNode( rEquations, nullptr, nFlags ), 2, aEquation ); aRet.Type = EnhancedCustomShapeParameterType::EQUATION; - aRet.Value <<= (sal_Int32)rEquations.size(); + aRet.Value <<= static_cast<sal_Int32>(rEquations.size()); rEquations.push_back( aEquation ); } break; @@ -619,7 +619,7 @@ public: FillEquationParameter( mpSecondArg->fillNode( rEquations, nullptr, nFlags ), 1, aEquation ); aEquation.nPara[ 2 ] = 1; aRet.Type = EnhancedCustomShapeParameterType::EQUATION; - aRet.Value <<= (sal_Int32)rEquations.size(); + aRet.Value <<= static_cast<sal_Int32>(rEquations.size()); rEquations.push_back( aEquation ); } } @@ -633,7 +633,7 @@ public: aEquation.nPara[ 1 ] = 1; FillEquationParameter( mpSecondArg->fillNode( rEquations, nullptr, nFlags ), 2, aEquation ); aRet.Type = EnhancedCustomShapeParameterType::EQUATION; - aRet.Value <<= (sal_Int32)rEquations.size(); + aRet.Value <<= static_cast<sal_Int32>(rEquations.size()); rEquations.push_back( aEquation ); } break; @@ -644,7 +644,7 @@ public: FillEquationParameter( mpFirstArg->fillNode( rEquations, nullptr, nFlags ), 0, aEquation ); FillEquationParameter( mpSecondArg->fillNode( rEquations, nullptr, nFlags ), 1, aEquation ); aRet.Type = EnhancedCustomShapeParameterType::EQUATION; - aRet.Value <<= (sal_Int32)rEquations.size(); + aRet.Value <<= static_cast<sal_Int32>(rEquations.size()); rEquations.push_back( aEquation ); } break; @@ -655,7 +655,7 @@ public: FillEquationParameter( mpFirstArg->fillNode( rEquations, nullptr, nFlags ), 0, aEquation ); FillEquationParameter( mpSecondArg->fillNode( rEquations, nullptr, nFlags ), 1, aEquation ); aRet.Type = EnhancedCustomShapeParameterType::EQUATION; - aRet.Value <<= (sal_Int32)rEquations.size(); + aRet.Value <<= static_cast<sal_Int32>(rEquations.size()); rEquations.push_back( aEquation ); } break; @@ -666,7 +666,7 @@ public: FillEquationParameter( mpSecondArg->fillNode( rEquations, nullptr, nFlags ), 0, aEquation ); FillEquationParameter( mpFirstArg->fillNode( rEquations, nullptr, nFlags ), 1, aEquation ); aRet.Type = EnhancedCustomShapeParameterType::EQUATION; - aRet.Value <<= (sal_Int32)rEquations.size(); + aRet.Value <<= static_cast<sal_Int32>(rEquations.size()); rEquations.push_back( aEquation ); } break; @@ -712,7 +712,7 @@ public: { EnhancedCustomShapeParameter aRet; aRet.Type = EnhancedCustomShapeParameterType::EQUATION; - aRet.Value <<= (sal_Int32)rEquations.size(); + aRet.Value <<= static_cast<sal_Int32>(rEquations.size()); { EnhancedCustomShapeEquation aEquation; aEquation.nOperation |= 6; diff --git a/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx b/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx index d66009b51422..22533f893eae 100644 --- a/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx +++ b/svx/source/customshapes/EnhancedCustomShapeGeometry.cxx @@ -6197,7 +6197,7 @@ static const sal_uInt16 mso_DefaultFillingTable[] = bool IsCustomShapeFilledByDefault( MSO_SPT eSpType ) { bool bIsFilledByDefault = true; - sal_uInt32 i = (sal_uInt32)eSpType; + sal_uInt32 i = static_cast<sal_uInt32>(eSpType); if ( i < 0x100 ) bIsFilledByDefault = ( mso_DefaultFillingTable[ i >> 4 ] & ( 1 << ( i & 0xf ) ) ) == 0; return bIsFilledByDefault; @@ -6243,7 +6243,7 @@ static const sal_uInt16 mso_DefaultStrokingTable[] = bool IsCustomShapeStrokedByDefault( MSO_SPT eSpType ) { bool bIsStrokedByDefault = true; - sal_uInt32 i = (sal_uInt32)eSpType; + sal_uInt32 i = static_cast<sal_uInt32>(eSpType); if ( i < 0x100 ) bIsStrokedByDefault = ( mso_DefaultStrokingTable[ i >> 4 ] & ( 1 << ( i & 0xf ) ) ) == 0; return bIsStrokedByDefault; @@ -6256,7 +6256,7 @@ static const sal_uInt16 msoSortFilledObjectsToBackTable[] = bool SortFilledObjectsToBackByDefault( MSO_SPT eSpType ) { bool bSortFilledObjectsToBackByDefault = true; - sal_uInt32 i = (sal_uInt32)eSpType; + sal_uInt32 i = static_cast<sal_uInt32>(eSpType); if ( i < 0x100 ) bSortFilledObjectsToBackByDefault = ( msoSortFilledObjectsToBackTable[ i >> 4 ] & ( 1 << ( i & 0xf ) ) ) != 0; return bSortFilledObjectsToBackByDefault; diff --git a/svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx b/svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx index 6fbf4c8c9c42..fa71af5acfb6 100644 --- a/svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx +++ b/svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx @@ -291,7 +291,7 @@ MSO_SPT EnhancedCustomShapeTypeNames::Get( const OUString& rShapeType ) int i, nLen = rShapeType.getLength(); std::unique_ptr<char[]> pBuf(new char[ nLen + 1 ]); for ( i = 0; i < nLen; i++ ) - pBuf[ i ] = (char)rShapeType[ i ]; + pBuf[ i ] = static_cast<char>(rShapeType[ i ]); pBuf[ i ] = 0; TypeNameHashMap::const_iterator aHashIter( pHashMap->find( pBuf.get() ) ); if ( aHashIter != pHashMap->end() ) @@ -546,7 +546,7 @@ OUString EnhancedCustomShapeTypeNames::GetAccName( const OUString& rShapeType ) int i, nLen = rShapeType.getLength(); std::unique_ptr<char[]> pBuf(new char[ nLen + 1 ]); for ( i = 0; i < nLen; i++ ) - pBuf[ i ] = (char)rShapeType[ i ]; + pBuf[ i ] = static_cast<char>(rShapeType[ i ]); pBuf[ i ] = 0; TypeACCNameHashMap::const_iterator aHashIter( pACCHashMap->find( pBuf.get() ) ); if ( aHashIter != pACCHashMap->end() ) diff --git a/svx/source/dialog/SvxNumOptionsTabPageHelper.cxx b/svx/source/dialog/SvxNumOptionsTabPageHelper.cxx index 0d467080b2c0..1ac8f1a89f2f 100644 --- a/svx/source/dialog/SvxNumOptionsTabPageHelper.cxx +++ b/svx/source/dialog/SvxNumOptionsTabPageHelper.cxx @@ -44,8 +44,8 @@ void SvxNumOptionsTabPageHelper::GetI18nNumbering( ListBox& rFmtLB, sal_uInt16 n ::std::vector< sal_uInt16> aRemove( rFmtLB.GetEntryCount(), nDontRemove); for (size_t i=0; i<aRemove.size(); ++i) { - sal_uInt16 nEntryData = (sal_uInt16)reinterpret_cast<sal_uLong>(rFmtLB.GetEntryData( - sal::static_int_cast< sal_Int32 >(i))); + sal_uInt16 nEntryData = static_cast<sal_uInt16>(reinterpret_cast<sal_uLong>(rFmtLB.GetEntryData( + sal::static_int_cast< sal_Int32 >(i)))); if (nEntryData > NumberingType::CHARS_LOWER_LETTER_N && nEntryData != nDoNotRemove) aRemove[i] = nEntryData; } @@ -61,8 +61,8 @@ void SvxNumOptionsTabPageHelper::GetI18nNumbering( ListBox& rFmtLB, sal_uInt16 n bool bInsert = true; for(sal_Int32 nEntry = 0; nEntry < rFmtLB.GetEntryCount(); nEntry++) { - sal_uInt16 nEntryData = (sal_uInt16)reinterpret_cast<sal_uLong>(rFmtLB.GetEntryData(nEntry)); - if(nEntryData == (sal_uInt16) nCurrent) + sal_uInt16 nEntryData = static_cast<sal_uInt16>(reinterpret_cast<sal_uLong>(rFmtLB.GetEntryData(nEntry))); + if(nEntryData == static_cast<sal_uInt16>(nCurrent)) { bInsert = false; aRemove[nEntry] = nDontRemove; @@ -73,7 +73,7 @@ void SvxNumOptionsTabPageHelper::GetI18nNumbering( ListBox& rFmtLB, sal_uInt16 n { OUString aIdent = xInfo->getNumberingIdentifier( nCurrent ); sal_Int32 nPos = rFmtLB.InsertEntry(aIdent); - rFmtLB.SetEntryData(nPos, reinterpret_cast<void*>((sal_uLong)nCurrent)); + rFmtLB.SetEntryData(nPos, reinterpret_cast<void*>(static_cast<sal_uLong>(nCurrent))); } } } @@ -82,7 +82,7 @@ void SvxNumOptionsTabPageHelper::GetI18nNumbering( ListBox& rFmtLB, sal_uInt16 n { if (i != nDontRemove) { - sal_Int32 nPos = rFmtLB.GetEntryPos( reinterpret_cast<void*>((sal_uLong)i)); + sal_Int32 nPos = rFmtLB.GetEntryPos( reinterpret_cast<void*>(static_cast<sal_uLong>(i))); rFmtLB.RemoveEntry( nPos); } } diff --git a/svx/source/dialog/_bmpmask.cxx b/svx/source/dialog/_bmpmask.cxx index 19fdd5474194..4784c54a6fa2 100644 --- a/svx/source/dialog/_bmpmask.cxx +++ b/svx/source/dialog/_bmpmask.cxx @@ -695,15 +695,15 @@ GDIMetaFile SvxBmpMask::ImpMask( const GDIMetaFile& rMtf ) { long nTol = ( pTols[i] * 255L ) / 100L; - long nVal = (long) pSrcCols[i].GetRed(); + long nVal = static_cast<long>(pSrcCols[i].GetRed()); pMinR[i] = std::max( nVal - nTol, 0L ); pMaxR[i] = std::min( nVal + nTol, 255L ); - nVal = ( (long) pSrcCols[i].GetGreen() ); + nVal = static_cast<long>(pSrcCols[i].GetGreen()); pMinG[i] = std::max( nVal - nTol, 0L ); pMaxG[i] = std::min( nVal + nTol, 255L ); - nVal = ( (long) pSrcCols[i].GetBlue() ); + nVal = static_cast<long>(pSrcCols[i].GetBlue()); pMinB[i] = std::max( nVal - nTol, 0L ); pMaxB[i] = std::min( nVal + nTol, 255L ); diff --git a/svx/source/dialog/_contdlg.cxx b/svx/source/dialog/_contdlg.cxx index 3ab740b5dfab..e23b5a97f84a 100644 --- a/svx/source/dialog/_contdlg.cxx +++ b/svx/source/dialog/_contdlg.cxx @@ -156,7 +156,7 @@ tools::PolyPolygon SvxContourDlg::CreateAutoContour( const Graphic& rGraphic, if( aSizePix.Width() && aSizePix.Height() && ( aSizePix.Width() > 512 || aSizePix.Height() > 512 ) ) { - double fWH = (double) aSizePix.Width() / aSizePix.Height(); + double fWH = static_cast<double>(aSizePix.Width()) / aSizePix.Height(); if( fWH <= 1.0 ) aSizePix.Width() = FRound( ( aSizePix.Height() = 512 ) * fWH ); diff --git a/svx/source/dialog/compressgraphicdialog.cxx b/svx/source/dialog/compressgraphicdialog.cxx index b70192628aad..30e1731e87bc 100644 --- a/svx/source/dialog/compressgraphicdialog.cxx +++ b/svx/source/dialog/compressgraphicdialog.cxx @@ -203,7 +203,7 @@ void CompressGraphicsDialog::Update() aBitmapSizeString = aBitmapSizeString.replaceAll("$(HEIGHT_IN_PX)", OUString::number(aPixelSize.Height())); m_pFixedText2->SetText(aBitmapSizeString); - int aValX = (int) (aPixelSize.Width() / GetViewWidthInch()); + int aValX = static_cast<int>(aPixelSize.Width() / GetViewWidthInch()); OUString aViewSizeString = SvxResId(STR_IMAGE_VIEW_SIZE); @@ -229,29 +229,29 @@ void CompressGraphicsDialog::Update() void CompressGraphicsDialog::UpdateNewWidthMF() { - int nPixelX = (sal_Int32)( GetViewWidthInch() * m_dResolution ); + int nPixelX = static_cast<sal_Int32>( GetViewWidthInch() * m_dResolution ); m_pMFNewWidth->SetText( OUString::number( nPixelX )); } void CompressGraphicsDialog::UpdateNewHeightMF() { - int nPixelY = (sal_Int32)( GetViewHeightInch() * m_dResolution ); + int nPixelY = static_cast<sal_Int32>( GetViewHeightInch() * m_dResolution ); m_pMFNewHeight->SetText( OUString::number( nPixelY )); } void CompressGraphicsDialog::UpdateResolutionLB() { - m_pResolutionLB->SetText( OUString::number( (sal_Int32) m_dResolution ) ); + m_pResolutionLB->SetText( OUString::number( static_cast<sal_Int32>(m_dResolution) ) ); } double CompressGraphicsDialog::GetViewWidthInch() { - return (double) MetricField::ConvertValue(m_aViewSize100mm.Width(), 2, MapUnit::Map100thMM, FUNIT_INCH) / 100.0; + return static_cast<double>(MetricField::ConvertValue(m_aViewSize100mm.Width(), 2, MapUnit::Map100thMM, FUNIT_INCH)) / 100.0; } double CompressGraphicsDialog::GetViewHeightInch() { - return (double) MetricField::ConvertValue(m_aViewSize100mm.Height(), 2, MapUnit::Map100thMM, FUNIT_INCH) / 100.0; + return static_cast<double>(MetricField::ConvertValue(m_aViewSize100mm.Height(), 2, MapUnit::Map100thMM, FUNIT_INCH)) / 100.0; } BmpScaleFlag CompressGraphicsDialog::GetSelectedInterpolationType() @@ -275,8 +275,8 @@ void CompressGraphicsDialog::Compress(SvStream& aStream) BitmapEx aBitmap = m_aGraphic.GetBitmapEx(); if ( m_pReduceResolutionCB->IsChecked() ) { - long nPixelX = (long)( GetViewWidthInch() * m_dResolution ); - long nPixelY = (long)( GetViewHeightInch() * m_dResolution ); + long nPixelX = static_cast<long>( GetViewWidthInch() * m_dResolution ); + long nPixelY = static_cast<long>( GetViewHeightInch() * m_dResolution ); aBitmap.Scale( Size( nPixelX, nPixelY ), GetSelectedInterpolationType() ); } @@ -285,11 +285,11 @@ void CompressGraphicsDialog::Compress(SvStream& aStream) Sequence< PropertyValue > aFilterData( 3 ); aFilterData[ 0 ].Name = "Interlaced"; - aFilterData[ 0 ].Value <<= (sal_Int32) 0; + aFilterData[ 0 ].Value <<= sal_Int32(0); aFilterData[ 1 ].Name = "Compression"; - aFilterData[ 1 ].Value <<= (sal_Int32) m_pCompressionMF->GetValue(); + aFilterData[ 1 ].Value <<= static_cast<sal_Int32>(m_pCompressionMF->GetValue()); aFilterData[ 2 ].Name = "Quality"; - aFilterData[ 2 ].Value <<= (sal_Int32) m_pQualityMF->GetValue(); + aFilterData[ 2 ].Value <<= static_cast<sal_Int32>(m_pQualityMF->GetValue()); OUString aGraphicFormatName = m_pLosslessRB->IsChecked() ? OUString( "png" ) : OUString( "jpg" ); @@ -341,7 +341,7 @@ IMPL_LINK_NOARG( CompressGraphicsDialog, NewHeightModifiedHdl, Edit&, void ) IMPL_LINK_NOARG( CompressGraphicsDialog, ResolutionModifiedHdl, Edit&, void ) { - m_dResolution = (double) m_pResolutionLB->GetText().toInt32(); + m_dResolution = static_cast<double>(m_pResolutionLB->GetText().toInt32()); UpdateNewWidthMF(); UpdateNewHeightMF(); @@ -395,11 +395,11 @@ tools::Rectangle CompressGraphicsDialog::GetScaledCropRectangle() { if ( m_pReduceResolutionCB->IsChecked() ) { - long nPixelX = (long)( GetViewWidthInch() * m_dResolution ); - long nPixelY = (long)( GetViewHeightInch() * m_dResolution ); + long nPixelX = static_cast<long>( GetViewWidthInch() * m_dResolution ); + long nPixelY = static_cast<long>( GetViewHeightInch() * m_dResolution ); Size aSize = m_aGraphic.GetBitmapEx().GetSizePixel(); - double aScaleX = nPixelX / (double) aSize.Width(); - double aScaleY = nPixelY / (double) aSize.Height(); + double aScaleX = nPixelX / static_cast<double>(aSize.Width()); + double aScaleY = nPixelY / static_cast<double>(aSize.Height()); return tools::Rectangle( m_aCropRectangle.Left() * aScaleX, diff --git a/svx/source/dialog/connctrl.cxx b/svx/source/dialog/connctrl.cxx index 3828980f7dc0..ae45e3ddf275 100644 --- a/svx/source/dialog/connctrl.cxx +++ b/svx/source/dialog/connctrl.cxx @@ -96,21 +96,21 @@ void SvxXConnectionPreview::AdaptSize() const long nHeight = aWinSize.Height(); if (aRect.GetHeight() == 0) return; - double fRectWH = (double) aRect.GetWidth() / aRect.GetHeight(); + double fRectWH = static_cast<double>(aRect.GetWidth()) / aRect.GetHeight(); if (nHeight == 0) return; - double fWinWH = (double) nWidth / nHeight; + double fWinWH = static_cast<double>(nWidth) / nHeight; // Adapt bitmap to Thumb size (not here!) if ( fRectWH < fWinWH) { - aNewSize.Width() = (long) ( (double) nHeight * fRectWH ); + aNewSize.Width() = static_cast<long>( static_cast<double>(nHeight) * fRectWH ); aNewSize.Height()= nHeight; } else { aNewSize.Width() = nWidth; - aNewSize.Height()= (long) ( (double) nWidth / fRectWH ); + aNewSize.Height()= static_cast<long>( static_cast<double>(nWidth) / fRectWH ); } Fraction aFrac1( aWinSize.Width(), aRect.GetWidth() ); @@ -280,8 +280,8 @@ void SvxXConnectionPreview::MouseButtonDown( const MouseEvent& rMEvt ) aXFrac *= *pMultFrac; aYFrac *= *pMultFrac; - if( (double)aXFrac > 0.001 && (double)aXFrac < 1000.0 && - (double)aYFrac > 0.001 && (double)aYFrac < 1000.0 ) + if( static_cast<double>(aXFrac) > 0.001 && static_cast<double>(aXFrac) < 1000.0 && + static_cast<double>(aYFrac) > 0.001 && static_cast<double>(aYFrac) < 1000.0 ) { aMapMode.SetScaleX( aXFrac ); aMapMode.SetScaleY( aYFrac ); @@ -290,8 +290,8 @@ void SvxXConnectionPreview::MouseButtonDown( const MouseEvent& rMEvt ) Size aOutSize( GetOutputSize() ); Point aPt( aMapMode.GetOrigin() ); - long nX = (long)( ( (double)aOutSize.Width() - ( (double)aOutSize.Width() * (double)*pMultFrac ) ) / 2.0 + 0.5 ); - long nY = (long)( ( (double)aOutSize.Height() - ( (double)aOutSize.Height() * (double)*pMultFrac ) ) / 2.0 + 0.5 ); + long nX = static_cast<long>( ( static_cast<double>(aOutSize.Width()) - ( static_cast<double>(aOutSize.Width()) * static_cast<double>(*pMultFrac) ) ) / 2.0 + 0.5 ); + long nY = static_cast<long>( ( static_cast<double>(aOutSize.Height()) - ( static_cast<double>(aOutSize.Height()) * static_cast<double>(*pMultFrac) ) ) / 2.0 + 0.5 ); aPt.X() += nX; aPt.Y() += nY; diff --git a/svx/source/dialog/dlgctl3d.cxx b/svx/source/dialog/dlgctl3d.cxx index 6c790e52ab79..2e3d8d802b8e 100644 --- a/svx/source/dialog/dlgctl3d.cxx +++ b/svx/source/dialog/dlgctl3d.cxx @@ -623,8 +623,8 @@ void Svx3DLightControl::Tracking( const TrackingEvent& rTEvt ) { if(mbGeometrySelected) { - double fNewRotX = mfSaveActionStartVer - ((double)aDeltaPos.Y() * F_PI180); - double fNewRotY = mfSaveActionStartHor + ((double)aDeltaPos.X() * F_PI180); + double fNewRotX = mfSaveActionStartVer - (static_cast<double>(aDeltaPos.Y()) * F_PI180); + double fNewRotY = mfSaveActionStartHor + (static_cast<double>(aDeltaPos.X()) * F_PI180); // cut horizontal while(fNewRotY < 0.0) @@ -658,8 +658,8 @@ void Svx3DLightControl::Tracking( const TrackingEvent& rTEvt ) else { // interaction in progress - double fNewPosHor = mfSaveActionStartHor + ((double)aDeltaPos.X()); - double fNewPosVer = mfSaveActionStartVer - ((double)aDeltaPos.Y()); + double fNewPosHor = mfSaveActionStartHor + static_cast<double>(aDeltaPos.X()); + double fNewPosVer = mfSaveActionStartVer - static_cast<double>(aDeltaPos.Y()); // cut horizontal while(fNewPosHor < 0.0) @@ -1221,8 +1221,8 @@ IMPL_LINK_NOARG(SvxLightCtl3D, ScrollBarMove, ScrollBar*, void) const sal_Int32 nVer(maVerScroller->GetThumbPos()); maLightControl->SetPosition( - ((double)nHor) / 100.0, - ((double)((18000 - nVer) - 9000)) / 100.0); + static_cast<double>(nHor) / 100.0, + static_cast<double>((18000 - nVer) - 9000) / 100.0); if(maUserInteractiveChangeCallback.IsSet()) { diff --git a/svx/source/dialog/dlgctrl.cxx b/svx/source/dialog/dlgctrl.cxx index 6a00e15784cb..3cb0518df7a9 100644 --- a/svx/source/dialog/dlgctrl.cxx +++ b/svx/source/dialog/dlgctrl.cxx @@ -810,10 +810,10 @@ void SvxPixelCtl::Paint( vcl::RenderContext& rRenderContext, const tools::Rectan for (i = 1; i < nLines; i++) { // horizontal - nTmp = (sal_uInt16) (aRectSize.Height() * i / nLines); + nTmp = static_cast<sal_uInt16>(aRectSize.Height() * i / nLines); rRenderContext.DrawLine(Point(0, nTmp), Point(aRectSize.Width(), nTmp)); // vertically - nTmp = (sal_uInt16) ( aRectSize.Width() * i / nLines ); + nTmp = static_cast<sal_uInt16>( aRectSize.Width() * i / nLines ); rRenderContext.DrawLine(Point(nTmp, 0), Point(nTmp, aRectSize.Height())); } diff --git a/svx/source/dialog/docrecovery.cxx b/svx/source/dialog/docrecovery.cxx index 13e35da7cfa5..348084cd2d03 100644 --- a/svx/source/dialog/docrecovery.cxx +++ b/svx/source/dialog/docrecovery.cxx @@ -396,8 +396,8 @@ void SAL_CALL RecoveryCore::statusChanged(const css::frame::FeatureStateEvent& a ::comphelper::SequenceAsHashMap lInfo(aEvent.State); TURLInfo aNew; - aNew.ID = lInfo.getUnpackedValueOrDefault(STATEPROP_ID , (sal_Int32)0 ); - aNew.DocState = (EDocStates)lInfo.getUnpackedValueOrDefault(STATEPROP_STATE , (sal_Int32)0 ); + aNew.ID = lInfo.getUnpackedValueOrDefault(STATEPROP_ID , sal_Int32(0) ); + aNew.DocState = (EDocStates)lInfo.getUnpackedValueOrDefault(STATEPROP_STATE , sal_Int32(0) ); aNew.OrgURL = lInfo.getUnpackedValueOrDefault(STATEPROP_ORGURL , OUString()); aNew.TempURL = lInfo.getUnpackedValueOrDefault(STATEPROP_TEMPURL , OUString()); aNew.FactoryURL = lInfo.getUnpackedValueOrDefault(STATEPROP_FACTORYURL , OUString()); diff --git a/svx/source/dialog/fntctrl.cxx b/svx/source/dialog/fntctrl.cxx index 39e044447301..63b53beb64ce 100644 --- a/svx/source/dialog/fntctrl.cxx +++ b/svx/source/dialog/fntctrl.cxx @@ -1115,8 +1115,7 @@ void SvxFontPrevWindow::SetFromItemSet(const SfxItemSet &rSet, bool bPreviewBack if( GetWhich( rSet, SID_ATTR_CHAR_KERNING, nWhich ) ) { const SvxKerningItem& rItem = static_cast<const SvxKerningItem&>( rSet.Get( nWhich ) ); - short nKern = ( short ) - LogicToLogic( rItem.GetValue(), rSet.GetPool()->GetMetric( nWhich ), MapUnit::MapTwip ); + short nKern = static_cast<short>(LogicToLogic( rItem.GetValue(), rSet.GetPool()->GetMetric( nWhich ), MapUnit::MapTwip )); rFont.SetFixKerning( nKern ); rCJKFont.SetFixKerning( nKern ); rCTLFont.SetFixKerning( nKern ); @@ -1359,8 +1358,7 @@ void SvxFontPrevWindow::Init(const SfxItemSet& rSet) if( ISITEMSET ) { const SvxKerningItem& rItem = static_cast<const SvxKerningItem&>( rSet.Get( nWhich ) ); - short nKern = ( short ) - LogicToLogic( rItem.GetValue(), rSet.GetPool()->GetMetric( nWhich ), MapUnit::MapTwip ); + short nKern = static_cast<short>(LogicToLogic( rItem.GetValue(), rSet.GetPool()->GetMetric( nWhich ), MapUnit::MapTwip )); rFont.SetFixKerning( nKern ); rCJKFont.SetFixKerning( nKern ); rCTLFont.SetFixKerning( nKern ); diff --git a/svx/source/dialog/frmsel.cxx b/svx/source/dialog/frmsel.cxx index 5c93bfb01214..d54e1b083e65 100644 --- a/svx/source/dialog/frmsel.cxx +++ b/svx/source/dialog/frmsel.cxx @@ -47,7 +47,7 @@ using namespace ::com::sun::star::accessibility; FrameBorderType GetFrameBorderTypeFromIndex( size_t nIndex ) { - DBG_ASSERT( nIndex < (size_t)FRAMEBORDERTYPE_COUNT, + DBG_ASSERT( nIndex < size_t(FRAMEBORDERTYPE_COUNT), "svx::GetFrameBorderTypeFromIndex - invalid index" ); return static_cast< FrameBorderType >( nIndex + 1 ); } diff --git a/svx/source/dialog/graphctl.cxx b/svx/source/dialog/graphctl.cxx index b8eaa0f38a84..272ca54652f4 100644 --- a/svx/source/dialog/graphctl.cxx +++ b/svx/source/dialog/graphctl.cxx @@ -210,19 +210,19 @@ void GraphCtrl::Resize() const Size aWinSize = PixelToLogic( GetOutputSizePixel(), aDisplayMap ); const long nWidth = aWinSize.Width(); const long nHeight = aWinSize.Height(); - double fGrfWH = (double) aGraphSize.Width() / aGraphSize.Height(); - double fWinWH = (double) nWidth / nHeight; + double fGrfWH = static_cast<double>(aGraphSize.Width()) / aGraphSize.Height(); + double fWinWH = static_cast<double>(nWidth) / nHeight; // Adapt Bitmap to Thumb size if ( fGrfWH < fWinWH) { - aNewSize.Width() = (long) ( (double) nHeight * fGrfWH ); + aNewSize.Width() = static_cast<long>( static_cast<double>(nHeight) * fGrfWH ); aNewSize.Height()= nHeight; } else { aNewSize.Width() = nWidth; - aNewSize.Height()= (long) ( (double) nWidth / fGrfWH ); + aNewSize.Height()= static_cast<long>( static_cast<double>(nWidth) / fGrfWH ); } aNewPos.X() = ( nWidth - aNewSize.Width() ) >> 1; diff --git a/svx/source/dialog/hdft.cxx b/svx/source/dialog/hdft.cxx index f96dbe2cdb24..cba21b4ac2c5 100644 --- a/svx/source/dialog/hdft.cxx +++ b/svx/source/dialog/hdft.cxx @@ -307,15 +307,15 @@ bool SvxHFPage::FillItemSet( SfxItemSet* rSet ) // Margins SvxLRSpaceItem aLR( nWLRSpace ); - aLR.SetLeft( (sal_uInt16)GetCoreValue( *m_pLMEdit, eUnit ) ); - aLR.SetRight( (sal_uInt16)GetCoreValue( *m_pRMEdit, eUnit ) ); + aLR.SetLeft( static_cast<sal_uInt16>(GetCoreValue( *m_pLMEdit, eUnit )) ); + aLR.SetRight( static_cast<sal_uInt16>(GetCoreValue( *m_pRMEdit, eUnit )) ); aSet.Put( aLR ); SvxULSpaceItem aUL( nWULSpace ); if ( nId == SID_ATTR_PAGE_HEADERSET ) - aUL.SetLower( (sal_uInt16)nDist ); + aUL.SetLower( static_cast<sal_uInt16>(nDist) ); else - aUL.SetUpper( (sal_uInt16)nDist ); + aUL.SetUpper( static_cast<sal_uInt16>(nDist) ); aSet.Put( aUL ); // Background and border? @@ -1034,7 +1034,7 @@ void SvxHFPage::RangeHdl() long nFHeight = m_pBspWin->GetFtHeight(); long nFDist = m_pBspWin->GetFtDist(); - long nHeight = std::max( (long)MINBODY, + long nHeight = std::max( long(MINBODY), static_cast<long>(m_pHeightEdit->Denormalize( m_pHeightEdit->GetValue( FUNIT_TWIP ) ) ) ); long nDist = m_pTurnOnBox->IsChecked() ? static_cast<long>(m_pDistEdit->Denormalize( m_pDistEdit->GetValue( FUNIT_TWIP ) )) : 0; diff --git a/svx/source/dialog/langbox.cxx b/svx/source/dialog/langbox.cxx index 1ce44c44ae43..863a2802fb6e 100644 --- a/svx/source/dialog/langbox.cxx +++ b/svx/source/dialog/langbox.cxx @@ -318,7 +318,7 @@ void SvxLanguageBoxBase::SetLanguageList( SvxLanguageListFlags nLangList, (bool(nLangList & SvxLanguageListFlags::THES_AVAIL) && lcl_SeqHasLang(aThesAvailLang, nLangType)) || (bool(nLangList & SvxLanguageListFlags::SPELL_USED) && - lcl_SeqHasLang(aSpellUsedLang, (sal_uInt16)nLangType)) || + lcl_SeqHasLang(aSpellUsedLang, static_cast<sal_uInt16>(nLangType))) || (bool(nLangList & SvxLanguageListFlags::HYPH_USED) && lcl_SeqHasLang(aHyphUsedLang, nLangType)) || (bool(nLangList & SvxLanguageListFlags::THES_USED) && @@ -389,14 +389,14 @@ sal_Int32 SvxLanguageBoxBase::ImplInsertLanguage( const LanguageType nLangType, m_pSpellUsedLang.reset( new Sequence< sal_Int16 >( xSpell->getLanguages() ) ); } bFound = m_pSpellUsedLang && - lcl_SeqHasLang( *m_pSpellUsedLang, (sal_uInt16)nRealLang ); + lcl_SeqHasLang( *m_pSpellUsedLang, static_cast<sal_uInt16>(nRealLang) ); nAt = ImplInsertImgEntry( aStrEntry, nPos, bFound ); } else nAt = ImplInsertEntry( aStrEntry, nPos ); - ImplSetEntryData( nAt, reinterpret_cast<void*>((sal_uInt16)nLangType) ); + ImplSetEntryData( nAt, reinterpret_cast<void*>(static_cast<sal_uInt16>(nLangType)) ); return nAt; } @@ -432,7 +432,7 @@ void SvxLanguageBoxBase::InsertLanguage( const LanguageType nLangType, aStrEntry = m_aAllString; sal_Int32 nAt = ImplInsertImgEntry( aStrEntry, LISTBOX_APPEND, bCheckEntry ); - ImplSetEntryData( nAt, reinterpret_cast<void*>((sal_uInt16)nLang) ); + ImplSetEntryData( nAt, reinterpret_cast<void*>(static_cast<sal_uInt16>(nLang)) ); } @@ -488,7 +488,7 @@ bool SvxLanguageBoxBase::IsLanguageSelected( const LanguageType eLangType ) cons sal_Int32 SvxLanguageBoxBase::ImplTypeToPos( LanguageType eType ) const { - return ImplGetEntryPos( reinterpret_cast<void*>((sal_uInt16)eType) ); + return ImplGetEntryPos( reinterpret_cast<void*>(static_cast<sal_uInt16>(eType)) ); } diff --git a/svx/source/dialog/measctrl.cxx b/svx/source/dialog/measctrl.cxx index 9831067cc812..0e58188714d7 100644 --- a/svx/source/dialog/measctrl.cxx +++ b/svx/source/dialog/measctrl.cxx @@ -39,8 +39,8 @@ SvxXMeasurePreview::SvxXMeasurePreview(vcl::Window* pParent, WinBits nStyle) SetMapMode(aMapMode); Size aSize = GetOutputSize(); - Point aPt1 = Point(aSize.Width() / 5, (long) (aSize.Height() / 2)); - Point aPt2 = Point(aSize.Width() * 4 / 5, (long) (aSize.Height() / 2)); + Point aPt1 = Point(aSize.Width() / 5, static_cast<long>(aSize.Height() / 2)); + Point aPt2 = Point(aSize.Width() * 4 / 5, static_cast<long>(aSize.Height() / 2)); pMeasureObj = new SdrMeasureObj(aPt1, aPt2); pModel = new SdrModel(); @@ -57,9 +57,9 @@ void SvxXMeasurePreview::Resize() Control::Resize(); Size aSize = GetOutputSize(); - Point aPt1 = Point(aSize.Width() / 5, (long) (aSize.Height() / 2)); + Point aPt1 = Point(aSize.Width() / 5, static_cast<long>(aSize.Height() / 2)); pMeasureObj->SetPoint(aPt1, 0); - Point aPt2 = Point(aSize.Width() * 4 / 5, (long) (aSize.Height() / 2)); + Point aPt2 = Point(aSize.Width() * 4 / 5, static_cast<long>(aSize.Height() / 2)); pMeasureObj->SetPoint(aPt2, 1); } diff --git a/svx/source/dialog/optgrid.cxx b/svx/source/dialog/optgrid.cxx index bf5c831640ea..ff05b66a15ff 100644 --- a/svx/source/dialog/optgrid.cxx +++ b/svx/source/dialog/optgrid.cxx @@ -200,8 +200,8 @@ bool SvxGridTabPage::FillItemSet( SfxItemSet* rCoreSet ) long nX =GetCoreValue( *pMtrFldDrawX, eUnit ); long nY = GetCoreValue( *pMtrFldDrawY, eUnit ); - aGridItem.nFldDrawX = (sal_uInt32) nX; - aGridItem.nFldDrawY = (sal_uInt32) nY; + aGridItem.nFldDrawX = static_cast<sal_uInt32>(nX); + aGridItem.nFldDrawY = static_cast<sal_uInt32>(nY); aGridItem.nFldDivisionX = static_cast<long>(pNumFldDivisionX->GetValue()-1); aGridItem.nFldDivisionY = static_cast<long>(pNumFldDivisionY->GetValue()-1); @@ -256,7 +256,7 @@ void SvxGridTabPage::ActivatePage( const SfxItemSet& rSet ) { const SfxUInt16Item* pItem = static_cast<const SfxUInt16Item*>(pAttr); - FieldUnit eFUnit = (FieldUnit)(long)pItem->GetValue(); + FieldUnit eFUnit = (FieldUnit)static_cast<long>(pItem->GetValue()); if( eFUnit != pMtrFldDrawX->GetUnit() ) { diff --git a/svx/source/dialog/pagenumberlistbox.cxx b/svx/source/dialog/pagenumberlistbox.cxx index 3c40fe73ee33..ade3baa6d0e0 100644 --- a/svx/source/dialog/pagenumberlistbox.cxx +++ b/svx/source/dialog/pagenumberlistbox.cxx @@ -42,7 +42,7 @@ PageNumberListBox::PageNumberListBox(vcl::Window* pParent) { OUString aStr = SvxResId(RID_SVXSTRARY_NUMBERINGTYPE[i].first); sal_Int32 nPos = InsertEntry( aStr ); - SetEntryData( nPos, reinterpret_cast<void*>((sal_uLong)nData) ); + SetEntryData( nPos, reinterpret_cast<void*>(static_cast<sal_uLong>(nData)) ); } } } @@ -58,7 +58,7 @@ void PageNumberListBox::SetSelection( sal_uInt16 nPos ) for (sal_Int32 i = 0; i < nEntryCount; ++i ) { - sal_uInt16 nTmp = (sal_uInt16)reinterpret_cast<sal_uLong>(GetEntryData(i)); + sal_uInt16 nTmp = static_cast<sal_uInt16>(reinterpret_cast<sal_uLong>(GetEntryData(i))); if ( nTmp == nPos ) { diff --git a/svx/source/dialog/papersizelistbox.cxx b/svx/source/dialog/papersizelistbox.cxx index 1ec9c17c0da4..9dda16736d40 100644 --- a/svx/source/dialog/papersizelistbox.cxx +++ b/svx/source/dialog/papersizelistbox.cxx @@ -43,7 +43,7 @@ void PaperSizeListBox::FillPaperSizeEntries( PaperSizeApp eApp ) OUString aStr = SvxResId(pPaperAry[i].first); Paper eSize = (Paper)pPaperAry[i].second; sal_Int32 nPos = InsertEntry( aStr ); - SetEntryData( nPos, reinterpret_cast<void*>((sal_uLong)eSize) ); + SetEntryData( nPos, reinterpret_cast<void*>(static_cast<sal_uLong>(eSize)) ); } } diff --git a/svx/source/dialog/rulritem.cxx b/svx/source/dialog/rulritem.cxx index 8dc6c275dec5..a8e373d7d516 100644 --- a/svx/source/dialog/rulritem.cxx +++ b/svx/source/dialog/rulritem.cxx @@ -467,7 +467,7 @@ bool SvxColumnItem::QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId ) const rVal <<= bOrtho; break; case MID_ACTUAL: - rVal <<= (sal_Int32) nActColumn; + rVal <<= static_cast<sal_Int32>(nActColumn); break; case MID_TABLE: rVal <<= bTable; @@ -499,15 +499,15 @@ bool SvxColumnItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) break; case MID_ORTHO: rVal >>= nVal; - bOrtho = (bool) nVal; + bOrtho = static_cast<bool>(nVal); break; case MID_ACTUAL: rVal >>= nVal; - nActColumn = (sal_uInt16) nVal; + nActColumn = static_cast<sal_uInt16>(nVal); break; case MID_TABLE: rVal >>= nVal; - bTable = (bool) nVal; + bTable = static_cast<bool>(nVal); break; default: OSL_FAIL("Wrong MemberId!"); diff --git a/svx/source/dialog/samecontentlistbox.cxx b/svx/source/dialog/samecontentlistbox.cxx index 2f27e5d210bf..29e72df42e73 100644 --- a/svx/source/dialog/samecontentlistbox.cxx +++ b/svx/source/dialog/samecontentlistbox.cxx @@ -30,7 +30,7 @@ SameContentListBox::SameContentListBox(vcl::Window* pParent) OUString aStr = SvxResId(RID_SVXSTRARY_SAMECONTENT[i].first); sal_uInt16 nData = RID_SVXSTRARY_SAMECONTENT[i].second; sal_Int32 nPos = InsertEntry( aStr ); - SetEntryData( nPos, reinterpret_cast<void*>((sal_uLong)nData) ); + SetEntryData( nPos, reinterpret_cast<void*>(static_cast<sal_uLong>(nData)) ); } SetDropDownLineCount(8); SelectEntryPos(0); diff --git a/svx/source/dialog/spacinglistbox.cxx b/svx/source/dialog/spacinglistbox.cxx index c20569de019f..db238a415178 100644 --- a/svx/source/dialog/spacinglistbox.cxx +++ b/svx/source/dialog/spacinglistbox.cxx @@ -30,7 +30,7 @@ SpacingListBox::SpacingListBox(vcl::Window* pParent) OUString aStr = SvxResId(RID_SVXSTRARY_SPACING[i].first); sal_uInt16 nData = RID_SVXSTRARY_SPACING[i].second; sal_Int32 nPos = InsertEntry( aStr ); - SetEntryData( nPos, reinterpret_cast<void*>((sal_uLong)nData) ); + SetEntryData( nPos, reinterpret_cast<void*>(static_cast<sal_uLong>(nData)) ); } SetDropDownLineCount(8); SelectEntryPos(0); diff --git a/svx/source/dialog/svxbmpnumvalueset.cxx b/svx/source/dialog/svxbmpnumvalueset.cxx index 61dddbfcde3b..6e5c52aa1484 100644 --- a/svx/source/dialog/svxbmpnumvalueset.cxx +++ b/svx/source/dialog/svxbmpnumvalueset.cxx @@ -219,7 +219,7 @@ void SvxNumValueSet::UserDraw( const UserDrawEvent& rUDEvt ) aLevel.realloc(aLevel.getLength() + 1); PropertyValue& rValue = aLevel.getArray()[aLevel.getLength() - 1]; rValue.Name = sValue; - rValue.Value <<= (sal_Int32)(i + 1); + rValue.Value <<= static_cast<sal_Int32>(i + 1); sText = xFormatter->makeNumberingString( aLevel, aLocale ); } catch(Exception&) @@ -291,7 +291,7 @@ void SvxNumValueSet::UserDraw( const UserDrawEvent& rUDEvt ) pProperties[0].Name = "NumberingType"; pProperties[0].Value <<= aNumberingTypes[i]; pProperties[1].Name = "Value"; - pProperties[1].Value <<= (sal_Int32)1; + pProperties[1].Value <<= sal_Int32(1); try { sLevelTexts[i] = xFormatter->makeNumberingString( aProperties, aLocale ); @@ -312,7 +312,7 @@ void SvxNumValueSet::UserDraw( const UserDrawEvent& rUDEvt ) if(aParentNumberings[i]) { //insert old numberings here - sal_Int32 nStartLevel = std::min((sal_Int32)aParentNumberings[i], i); + sal_Int32 nStartLevel = std::min(static_cast<sal_Int32>(aParentNumberings[i]), i); for(sal_Int32 nParentLevel = i - nStartLevel; nParentLevel < i; nParentLevel++) { OUString sTmp(sLevelTexts[nParentLevel]); diff --git a/svx/source/dialog/svxruler.cxx b/svx/source/dialog/svxruler.cxx index 0cded751496f..616f6eec9b34 100644 --- a/svx/source/dialog/svxruler.cxx +++ b/svx/source/dialog/svxruler.cxx @@ -570,8 +570,8 @@ void SvxRuler::UpdateFrame() if(mxColumnItem.get()) { - mxRulerImpl->nColLeftPix = (sal_uInt16) ConvertSizePixel(mxColumnItem->GetLeft()); - mxRulerImpl->nColRightPix = (sal_uInt16) ConvertSizePixel(mxColumnItem->GetRight()); + mxRulerImpl->nColLeftPix = static_cast<sal_uInt16>(ConvertSizePixel(mxColumnItem->GetLeft())); + mxRulerImpl->nColRightPix = static_cast<sal_uInt16>(ConvertSizePixel(mxColumnItem->GetRight())); } } @@ -1094,7 +1094,7 @@ void SvxRuler::UpdateTabs() const sal_uInt16 nDefTabBuf = lPosPixel > lRightIndent || lLastTab > lRightIndent ? 0 - : (sal_uInt16)( (lRightIndent - lPosPixel) / nDefTabDist ); + : static_cast<sal_uInt16>( (lRightIndent - lPosPixel) / nDefTabDist ); if(mxTabStopItem->Count() + TAB_GAP + nDefTabBuf > nTabBufSize) { @@ -2000,7 +2000,7 @@ void SvxRuler::ApplyMargins() } else { - nRight = std::max((long)0, + nRight = std::max(long(0), mxPagePosItem->GetWidth() - mxLRSpaceItem->GetLeft() - (ConvertHPosLogic(GetMargin2()) - lAppNullOffset)); @@ -2029,7 +2029,7 @@ void SvxRuler::ApplyMargins() } mxULSpaceItem->SetLower( PixelVAdjust( - std::max((long)0, mxPagePosItem->GetHeight() - + std::max(long(0), mxPagePosItem->GetHeight() - mxULSpaceItem->GetUpper() - (ConvertVPosLogic(GetMargin2()) - lAppNullOffset)), mxULSpaceItem->GetLower())); @@ -2052,7 +2052,7 @@ long SvxRuler::RoundToCurrentMapMode(long lValue) const double aRoundingFactor = aUnitData.nTickUnit / aUnitData.nTick1; long lNewValue = OutputDevice::LogicToLogic(Size(lValue, 0), pEditWin->GetMapMode(), GetCurrentMapMode()).Width(); - lNewValue = (rtl::math::round(lNewValue / (double) aUnitData.nTickUnit * aRoundingFactor) / aRoundingFactor) * aUnitData.nTickUnit; + lNewValue = (rtl::math::round(lNewValue / static_cast<double>(aUnitData.nTickUnit) * aRoundingFactor) / aRoundingFactor) * aUnitData.nTickUnit; return OutputDevice::LogicToLogic(Size(lNewValue, 0), GetCurrentMapMode(), pEditWin->GetMapMode()).Width(); } @@ -2414,9 +2414,9 @@ void SvxRuler::PrepareProportional_Impl(RulerType eType) } else lActWidth = mpBorders[i].nPos; - mxRulerImpl->pPercBuf[i] = (sal_uInt16)((lActWidth * 1000) + mxRulerImpl->pPercBuf[i] = static_cast<sal_uInt16>((lActWidth * 1000) / mxRulerImpl->nTotalDist); - mxRulerImpl->pBlockBuf[i] = (sal_uInt16)lActBorderSum; + mxRulerImpl->pBlockBuf[i] = static_cast<sal_uInt16>(lActBorderSum); lActBorderSum += mpBorders[i].nWidth; } } @@ -2437,9 +2437,9 @@ void SvxRuler::PrepareProportional_Impl(RulerType eType) { lActWidth += mpBorders[i].nPos - lPos; lPos = mpBorders[i].nPos + mpBorders[i].nWidth; - mxRulerImpl->pPercBuf[i] = (sal_uInt16)((lActWidth * 1000) + mxRulerImpl->pPercBuf[i] = static_cast<sal_uInt16>((lActWidth * 1000) / mxRulerImpl->nTotalDist); - mxRulerImpl->pBlockBuf[i] = (sal_uInt16)lActBorderSum; + mxRulerImpl->pBlockBuf[i] = static_cast<sal_uInt16>(lActBorderSum); lActBorderSum += mpBorders[i].nWidth; } } @@ -2454,7 +2454,7 @@ void SvxRuler::PrepareProportional_Impl(RulerType eType) for(sal_uInt16 i = nIdx+1; i < nTabCount; ++i) { const long nDelta = mpTabs[i].nPos - mpTabs[nIdx].nPos; - mxRulerImpl->pPercBuf[i] = (sal_uInt16)((nDelta * 1000) / mxRulerImpl->nTotalDist); + mxRulerImpl->pPercBuf[i] = static_cast<sal_uInt16>((nDelta * 1000) / mxRulerImpl->nTotalDist); } break; } @@ -3573,7 +3573,7 @@ long SvxRuler::CalcPropMaxRight(sal_uInt16 nCol) const } } - _nMaxRight -= (long)(lFences + lMinFrame / (float) lMinSpace * lColumns); + _nMaxRight -= static_cast<long>(lFences + lMinFrame / static_cast<float>(lMinSpace) * lColumns); return _nMaxRight; } else diff --git a/svx/source/dialog/swframeexample.cxx b/svx/source/dialog/swframeexample.cxx index 895cb993afaa..28464f64f47a 100644 --- a/svx/source/dialog/swframeexample.cxx +++ b/svx/source/dialog/swframeexample.cxx @@ -149,7 +149,7 @@ void SvxSwFrameExample::InitAllRects_Impl(vcl::RenderContext& rRenderContext) aTextLine.Move(0, nTTxtBorder); // Rectangle to edges including paragraph - sal_uInt16 nLines = (sal_uInt16)((aPagePrtArea.GetHeight() / 2 - nTTxtBorder - nBTxtBorder) + sal_uInt16 nLines = static_cast<sal_uInt16>((aPagePrtArea.GetHeight() / 2 - nTTxtBorder - nBTxtBorder) / (aTextLine.GetHeight() + 2)); aPara = aPagePrtArea; aPara.SetSize(Size(aPara.GetWidth(), @@ -224,7 +224,7 @@ void SvxSwFrameExample::InitAllRects_Impl(vcl::RenderContext& rRenderContext) sal_uInt32 nFreeWidth = aPagePrtArea.GetWidth() - GetTextWidth(DEMOTEXT); aFrmSize = Size(nFreeWidth / 2, (aTextLine.GetHeight() + 2) * 3); - aDrawObj.SetSize(Size(std::max(5L, (long)nFreeWidth / 3L), std::max(5L, aFrmSize.Height() * 3L))); + aDrawObj.SetSize(Size(std::max(5L, static_cast<long>(nFreeWidth) / 3L), std::max(5L, aFrmSize.Height() * 3L))); aDrawObj.SetPos(Point(aParaPrtArea.Right() + 1, aParaPrtArea.Bottom() / 2)); aParaPrtArea.Right() = aDrawObj.Right(); } @@ -619,13 +619,13 @@ void SvxSwFrameExample::Paint(vcl::RenderContext& rRenderContext, const tools::R aTxt.Bottom() = aTxt.Top() + aTextLine.GetHeight() - 1; nStep = aTxt.GetHeight() + 2; - nLines = (sal_uInt16)(((aFrameAtFrame.GetHeight() - 2 * FLYINFLY_BORDER) * 2 / 3) + nLines = static_cast<sal_uInt16>(((aFrameAtFrame.GetHeight() - 2 * FLYINFLY_BORDER) * 2 / 3) / (aTxt.GetHeight() + 2)); } else { nStep = aTxt.GetHeight() + 2; - nLines = (sal_uInt16)(aParaPrtArea.GetHeight() / (aTextLine.GetHeight() + 2)); + nLines = static_cast<sal_uInt16>(aParaPrtArea.GetHeight() / (aTextLine.GetHeight() + 2)); } if (nAnchor != RndStdIds::FLY_AS_CHAR) diff --git a/svx/source/engine3d/dragmt3d.cxx b/svx/source/engine3d/dragmt3d.cxx index 1f9c9f92c634..e55931b568f5 100644 --- a/svx/source/engine3d/dragmt3d.cxx +++ b/svx/source/engine3d/dragmt3d.cxx @@ -281,7 +281,7 @@ E3dDragRotate::E3dDragRotate(SdrDragView &_rView, // Divide by the number if(nCnt > 1) { - maGlobalCenter /= (double)nCnt; + maGlobalCenter /= static_cast<double>(nCnt); } // get rotate center and transform to 3D eye coordinates @@ -337,7 +337,7 @@ void E3dDragRotate::MoveSdrDrag(const Point& rPnt) { fWAngle = NormAngle360(GetAngle(rPnt - DragStat().GetRef1()) - rCandidate.mnStartAngle) - rCandidate.mnLastAngle; - rCandidate.mnLastAngle = (long)fWAngle + rCandidate.mnLastAngle; + rCandidate.mnLastAngle = static_cast<long>(fWAngle) + rCandidate.mnLastAngle; fWAngle /= 100.0; fHAngle = 0.0; } @@ -345,10 +345,10 @@ void E3dDragRotate::MoveSdrDrag(const Point& rPnt) { if ((maFullBound.GetWidth() == 0) || (maFullBound.GetHeight() == 0)) throw o3tl::divide_by_zero(); - fWAngle = 90.0 * (double)(rPnt.X() - maLastPos.X()) - / (double)maFullBound.GetWidth(); - fHAngle = 90.0 * (double)(rPnt.Y() - maLastPos.Y()) - / (double)maFullBound.GetHeight(); + fWAngle = 90.0 * static_cast<double>(rPnt.X() - maLastPos.X()) + / static_cast<double>(maFullBound.GetWidth()); + fHAngle = 90.0 * static_cast<double>(rPnt.Y() - maLastPos.Y()) + / static_cast<double>(maFullBound.GetHeight()); } long nSnap = 0; @@ -357,8 +357,8 @@ void E3dDragRotate::MoveSdrDrag(const Point& rPnt) if(nSnap != 0) { - fWAngle = (double)(((long) fWAngle + nSnap/2) / nSnap * nSnap); - fHAngle = (double)(((long) fHAngle + nSnap/2) / nSnap * nSnap); + fWAngle = static_cast<double>((static_cast<long>(fWAngle) + nSnap/2) / nSnap * nSnap); + fHAngle = static_cast<double>((static_cast<long>(fHAngle) + nSnap/2) / nSnap * nSnap); } // to radians @@ -508,7 +508,7 @@ void E3dDragMove::MoveSdrDrag(const Point& rPnt) const drawinglayer::geometry::ViewInformation3D& aViewInfo3D(rVCScene.getViewInformation3D()); // move coor from 2d world to 3d Eye - basegfx::B2DPoint aGlobalMoveHead2D((double)(rPnt.X() - maLastPos.X()), (double)(rPnt.Y() - maLastPos.Y())); + basegfx::B2DPoint aGlobalMoveHead2D(static_cast<double>(rPnt.X() - maLastPos.X()), static_cast<double>(rPnt.Y() - maLastPos.Y())); basegfx::B2DPoint aGlobalMoveTail2D(0.0, 0.0); basegfx::B2DHomMatrix aInverseSceneTransform(rVCScene.getObjectTransformation()); @@ -581,9 +581,9 @@ void E3dDragMove::MoveSdrDrag(const Point& rPnt) const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(rCandidate.mp3DObj->GetScene()->GetViewContact()); const drawinglayer::geometry::ViewInformation3D& aViewInfo3D(rVCScene.getViewInformation3D()); - basegfx::B2DPoint aGlobalScaleStart2D((double)(aStartPos.X()), (double)(aStartPos.Y())); - basegfx::B2DPoint aGlobalScaleNext2D((double)(rPnt.X()), (double)(rPnt.Y())); - basegfx::B2DPoint aGlobalScaleFixPos2D((double)(maScaleFixPos.X()), (double)(maScaleFixPos.Y())); + basegfx::B2DPoint aGlobalScaleStart2D(static_cast<double>(aStartPos.X()), static_cast<double>(aStartPos.Y())); + basegfx::B2DPoint aGlobalScaleNext2D(static_cast<double>(rPnt.X()), static_cast<double>(rPnt.Y())); + basegfx::B2DPoint aGlobalScaleFixPos2D(static_cast<double>(maScaleFixPos.X()), static_cast<double>(maScaleFixPos.Y())); basegfx::B2DHomMatrix aInverseSceneTransform(rVCScene.getObjectTransformation()); aInverseSceneTransform.invert(); diff --git a/svx/source/engine3d/extrud3d.cxx b/svx/source/engine3d/extrud3d.cxx index c873a30f1f4f..8a4e829454fb 100644 --- a/svx/source/engine3d/extrud3d.cxx +++ b/svx/source/engine3d/extrud3d.cxx @@ -68,7 +68,7 @@ E3dExtrudeObj::E3dExtrudeObj(E3dDefaultAttributes& rDefault, const basegfx::B2DP SetDefaultAttributes(rDefault); // set extrude depth - GetProperties().SetObjectItemDirect(makeSvx3DDepthItem((sal_uInt32)(fDepth + 0.5))); + GetProperties().SetObjectItemDirect(makeSvx3DDepthItem(static_cast<sal_uInt32>(fDepth + 0.5))); } E3dExtrudeObj::E3dExtrudeObj() @@ -184,7 +184,7 @@ SdrAttrObj* E3dExtrudeObj::GetBreakObj() } // translate by extrude depth - aTransform.translate(0.0, 0.0, (double)GetExtrudeDepth()); + aTransform.translate(0.0, 0.0, static_cast<double>(GetExtrudeDepth())); aBackSide.transform(aTransform); } diff --git a/svx/source/engine3d/float3d.cxx b/svx/source/engine3d/float3d.cxx index 7d1664cc7b8e..49ce01bb778e 100644 --- a/svx/source/engine3d/float3d.cxx +++ b/svx/source/engine3d/float3d.cxx @@ -581,7 +581,7 @@ void Svx3DWin::Update( SfxItemSet const & rAttrs ) if(eState != SfxItemState::DONTCARE) { sal_uInt32 nValue = rAttrs.Get(SDRATTR_3DOBJ_HORZ_SEGS).GetValue(); - if(nValue != (sal_uInt32 )m_pNumHorizontal->GetValue()) + if(nValue != static_cast<sal_uInt32>(m_pNumHorizontal->GetValue())) { m_pNumHorizontal->SetValue( nValue ); bUpdate = true; @@ -606,7 +606,7 @@ void Svx3DWin::Update( SfxItemSet const & rAttrs ) if( eState != SfxItemState::DONTCARE ) { sal_uInt32 nValue = rAttrs.Get(SDRATTR_3DOBJ_VERT_SEGS).GetValue(); - if( nValue != (sal_uInt32) m_pNumVertical->GetValue() ) + if( nValue != static_cast<sal_uInt32>(m_pNumVertical->GetValue()) ) { m_pNumVertical->SetValue( nValue ); bUpdate = true; @@ -1736,7 +1736,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs ) // Edge rounding if( !m_pMtrPercentDiagonal->IsEmptyFieldValue() ) { - sal_uInt16 nValue = (sal_uInt16) m_pMtrPercentDiagonal->GetValue(); + sal_uInt16 nValue = static_cast<sal_uInt16>(m_pMtrPercentDiagonal->GetValue()); rAttrs.Put(makeSvx3DPercentDiagonalItem(nValue)); } else @@ -1745,7 +1745,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs ) // Depth scale if( !m_pMtrBackscale->IsEmptyFieldValue() ) { - sal_uInt16 nValue = (sal_uInt16)m_pMtrBackscale->GetValue(); + sal_uInt16 nValue = static_cast<sal_uInt16>(m_pMtrBackscale->GetValue()); rAttrs.Put(makeSvx3DBackscaleItem(nValue)); } else @@ -1754,7 +1754,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs ) // End angle if( !m_pMtrEndAngle->IsEmptyFieldValue() ) { - sal_uInt16 nValue = (sal_uInt16)m_pMtrEndAngle->GetValue(); + sal_uInt16 nValue = static_cast<sal_uInt16>(m_pMtrEndAngle->GetValue()); rAttrs.Put(makeSvx3DEndAngleItem(nValue)); } else @@ -1821,7 +1821,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs ) // Slant (Shadow) if( !m_pMtrSlant->IsEmptyFieldValue() ) { - sal_uInt16 nValue2 = (sal_uInt16) m_pMtrSlant->GetValue(); + sal_uInt16 nValue2 = static_cast<sal_uInt16>(m_pMtrSlant->GetValue()); rAttrs.Put(makeSvx3DShadowSlantItem(nValue2)); } else @@ -2150,7 +2150,7 @@ void Svx3DWin::GetAttr( SfxItemSet& rAttrs ) // Specular intensity if( !m_pMtrMatSpecularIntensity->IsEmptyFieldValue() ) { - sal_uInt16 nValue2 = (sal_uInt16) m_pMtrMatSpecularIntensity->GetValue(); + sal_uInt16 nValue2 = static_cast<sal_uInt16>(m_pMtrMatSpecularIntensity->GetValue()); rAttrs.Put(makeSvx3DMaterialSpecularIntensityItem(nValue2)); } else diff --git a/svx/source/engine3d/obj3d.cxx b/svx/source/engine3d/obj3d.cxx index c740c9369367..bd8ddd511c44 100644 --- a/svx/source/engine3d/obj3d.cxx +++ b/svx/source/engine3d/obj3d.cxx @@ -329,7 +329,7 @@ void E3dObject::NbcResize(const Point& rRef, const Fraction& xFact, const Fracti // transform pos from 2D world to 3D eye const sdr::contact::ViewContactOfE3dScene& rVCScene = static_cast< sdr::contact::ViewContactOfE3dScene& >(pScene->GetViewContact()); const drawinglayer::geometry::ViewInformation3D& aViewInfo3D(rVCScene.getViewInformation3D()); - basegfx::B2DPoint aScaleCenter2D((double)rRef.X(), (double)rRef.Y()); + basegfx::B2DPoint aScaleCenter2D(static_cast<double>(rRef.X()), static_cast<double>(rRef.Y())); basegfx::B2DHomMatrix aInverseSceneTransform(rVCScene.getObjectTransformation()); aInverseSceneTransform.invert(); @@ -399,8 +399,8 @@ void E3dObject::NbcMove(const Size& rSize) // build relative movement vector in eye coordinates basegfx::B3DPoint aMove( - (double)rSize.Width() * aEyeVol.getWidth() / (double)aRect.GetWidth(), - (double)-rSize.Height() * aEyeVol.getHeight() / (double)aRect.GetHeight(), + static_cast<double>(rSize.Width()) * aEyeVol.getWidth() / static_cast<double>(aRect.GetWidth()), + static_cast<double>(-rSize.Height()) * aEyeVol.getHeight() / static_cast<double>(aRect.GetHeight()), 0.0); basegfx::B3DPoint aPos(0.0, 0.0, 0.0); diff --git a/svx/source/engine3d/scene3d.cxx b/svx/source/engine3d/scene3d.cxx index 1e3739005fa1..7646a2357d51 100644 --- a/svx/source/engine3d/scene3d.cxx +++ b/svx/source/engine3d/scene3d.cxx @@ -545,8 +545,8 @@ void E3dScene::RotateScene (const Point& rRef, double sn, double cs) // ynew = x * sin(alpha) + y * cos(alpha) // Bottom Right is not rotated: the pages of aOutRect must // remain parallel to the coordinate axes. - NewCenter.X() = (long) (Center.X() * cs - Center.Y() * sn); - NewCenter.Y() = (long) (Center.X() * sn + Center.Y() * cs); + NewCenter.X() = static_cast<long>(Center.X() * cs - Center.Y() * sn); + NewCenter.Y() = static_cast<long>(Center.X() * sn + Center.Y() * cs); } Size Differenz; diff --git a/svx/source/engine3d/view3d.cxx b/svx/source/engine3d/view3d.cxx index f880ad4b854b..8f06e623118e 100644 --- a/svx/source/engine3d/view3d.cxx +++ b/svx/source/engine3d/view3d.cxx @@ -853,8 +853,8 @@ void E3dView::ConvertMarkedObjTo3D(bool bExtrude, const basegfx::B2DPoint& rPnt1 if(bExtrude) { - double fW = (double)aRect.GetWidth(); - double fH = (double)aRect.GetHeight(); + double fW = static_cast<double>(aRect.GetWidth()); + double fH = static_cast<double>(aRect.GetHeight()); fDepth = sqrt(fW*fW + fH*fH) / 6.0; } if(!bExtrude) @@ -884,7 +884,7 @@ void E3dView::ConvertMarkedObjTo3D(bool bExtrude, const basegfx::B2DPoint& rPnt1 } else { - aLatheMat.translate((double)-aRect.Left(), 0.0); + aLatheMat.translate(static_cast<double>(-aRect.Left()), 0.0); } // Form the inverse matrix to determine the target expansion @@ -904,28 +904,28 @@ void E3dView::ConvertMarkedObjTo3D(bool bExtrude, const basegfx::B2DPoint& rPnt1 aRot *= aLatheMat; aRot.setX(-aRot.getX()); aRot *= aInvLatheMat; - aRotPnt = Point((long)(aRot.getX() + 0.5), (long)(-aRot.getY() - 0.5)); + aRotPnt = Point(static_cast<long>(aRot.getX() + 0.5), static_cast<long>(-aRot.getY() - 0.5)); aRect.Union(tools::Rectangle(aRotPnt, aRotPnt)); aRot = basegfx::B2DPoint(aTurnRect.Left(), -aTurnRect.Bottom()); aRot *= aLatheMat; aRot.setX(-aRot.getX()); aRot *= aInvLatheMat; - aRotPnt = Point((long)(aRot.getX() + 0.5), (long)(-aRot.getY() - 0.5)); + aRotPnt = Point(static_cast<long>(aRot.getX() + 0.5), static_cast<long>(-aRot.getY() - 0.5)); aRect.Union(tools::Rectangle(aRotPnt, aRotPnt)); aRot = basegfx::B2DPoint(aTurnRect.Right(), -aTurnRect.Top()); aRot *= aLatheMat; aRot.setX(-aRot.getX()); aRot *= aInvLatheMat; - aRotPnt = Point((long)(aRot.getX() + 0.5), (long)(-aRot.getY() - 0.5)); + aRotPnt = Point(static_cast<long>(aRot.getX() + 0.5), static_cast<long>(-aRot.getY() - 0.5)); aRect.Union(tools::Rectangle(aRotPnt, aRotPnt)); aRot = basegfx::B2DPoint(aTurnRect.Right(), -aTurnRect.Bottom()); aRot *= aLatheMat; aRot.setX(-aRot.getX()); aRot *= aInvLatheMat; - aRotPnt = Point((long)(aRot.getX() + 0.5), (long)(-aRot.getY() - 0.5)); + aRotPnt = Point(static_cast<long>(aRot.getX() + 0.5), static_cast<long>(-aRot.getY() - 0.5)); aRect.Union(tools::Rectangle(aRotPnt, aRotPnt)); } } @@ -956,7 +956,7 @@ void E3dView::ConvertMarkedObjTo3D(bool bExtrude, const basegfx::B2DPoint& rPnt1 // Initialize scene pScene->NbcSetSnapRect(aRect); basegfx::B3DRange aBoundVol = pScene->GetBoundVolume(); - InitScene(pScene, (double)aRect.GetWidth(), (double)aRect.GetHeight(), aBoundVol.getDepth()); + InitScene(pScene, static_cast<double>(aRect.GetWidth()), static_cast<double>(aRect.GetHeight()), aBoundVol.getDepth()); // Insert scene instead of the first selected object and throw away // all the old objects @@ -1139,7 +1139,7 @@ void E3dView::DoDepthArrange(E3dScene const * pScene, double fDepth) { // need to be arranged double fMinDepth = fDepth * 0.8; - double fStep = (fDepth - fMinDepth) / (double)nNumLayers; + double fStep = (fDepth - fMinDepth) / static_cast<double>(nNumLayers); pLayer = pBaseLayer; while(pLayer) @@ -1294,7 +1294,7 @@ E3dScene* E3dView::SetCurrent3DObj(E3dObject* p3DObj) double fW(aVolume.getWidth()); double fH(aVolume.getHeight()); - tools::Rectangle aRect(0,0, (long) fW, (long) fH); + tools::Rectangle aRect(0,0, static_cast<long>(fW), static_cast<long>(fH)); E3dScene* pScene = new E3dScene; diff --git a/svx/source/engine3d/view3d1.cxx b/svx/source/engine3d/view3d1.cxx index bfa2db5bc489..1fe0e022a59c 100644 --- a/svx/source/engine3d/view3d1.cxx +++ b/svx/source/engine3d/view3d1.cxx @@ -175,12 +175,12 @@ void E3dView::Set3DAttributes( const SfxItemSet& rAttr) double E3dView::GetDefaultCamPosZ() { - return (double) mpModel->GetItemPool().GetDefaultItem(SDRATTR_3DSCENE_DISTANCE).GetValue(); + return static_cast<double>(mpModel->GetItemPool().GetDefaultItem(SDRATTR_3DSCENE_DISTANCE).GetValue()); } double E3dView::GetDefaultCamFocal() { - return (double) mpModel->GetItemPool().GetDefaultItem(SDRATTR_3DSCENE_FOCAL_LENGTH).GetValue(); + return static_cast<double>(mpModel->GetItemPool().GetDefaultItem(SDRATTR_3DSCENE_FOCAL_LENGTH).GetValue()); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svx/source/fmcomp/fmgridcl.cxx b/svx/source/fmcomp/fmgridcl.cxx index 0ed000716416..ba9bef83935d 100644 --- a/svx/source/fmcomp/fmgridcl.cxx +++ b/svx/source/fmcomp/fmgridcl.cxx @@ -590,7 +590,7 @@ IMPL_LINK_NOARG( FmGridHeader, OnAsyncExecuteDrop, void*, void ) if (bDateNTimeCol) { aElement <<= xSecondCol; - xCols->insertByIndex(nPos == (sal_uInt16)-1 ? nPos : ++nPos, aElement); + xCols->insertByIndex(nPos == sal_uInt16(-1) ? nPos : ++nPos, aElement); } // is the component::Form tied to the database? @@ -613,13 +613,13 @@ IMPL_LINK_NOARG( FmGridHeader, OnAsyncExecuteDrop, void*, void ) switch (nCommandType) { case CommandType::TABLE: - aCommandType <<= (sal_Int32)CommandType::TABLE; + aCommandType <<= sal_Int32(CommandType::TABLE); break; case CommandType::QUERY: - aCommandType <<= (sal_Int32)CommandType::QUERY; + aCommandType <<= sal_Int32(CommandType::QUERY); break; default: - aCommandType <<= (sal_Int32)CommandType::COMMAND; + aCommandType <<= sal_Int32(CommandType::COMMAND); xForm->setPropertyValue(FM_PROP_ESCAPE_PROCESSING, css::uno::Any(2 == nCommandType)); break; } @@ -756,7 +756,7 @@ void FmGridHeader::PreExecuteColumnContextMenu(sal_uInt16 nColId, PopupMenu& rMe // allow the 'hide column' item ? bool bAllowHide = bMarked; // a column is marked - bAllowHide = bAllowHide || (!bDesignMode && (nPos != (sal_uInt16)-1)); // OR we are in alive mode and have hit a column + bAllowHide = bAllowHide || (!bDesignMode && (nPos != sal_uInt16(-1))); // OR we are in alive mode and have hit a column bAllowHide = bAllowHide && xCols.is(); // AND we have a column container bAllowHide = bAllowHide && (xCols->getCount()-nHiddenCols > 1); // AND there are at least two visible columns rMenu.EnableItem(rMenu.GetItemId("hide"), bAllowHide); @@ -1516,7 +1516,7 @@ void FmGridControl::ColumnResized(sal_uInt16 nId) sal_Int32 nColumnWidth = GetColumnWidth(nId); nColumnWidth = CalcReverseZoom(nColumnWidth); // convert to 10THMM - aWidth <<= (sal_Int32)PixelToLogic(Point(nColumnWidth, 0), MapMode(MapUnit::Map10thMM)).X(); + aWidth <<= static_cast<sal_Int32>(PixelToLogic(Point(nColumnWidth, 0), MapMode(MapUnit::Map10thMM)).X()); xColModel->setPropertyValue(FM_PROP_WIDTH, aWidth); } } @@ -1611,7 +1611,7 @@ void FmGridControl::InitColumnsByModels(const Reference< css::container::XIndexC if (aWidth >>= nWidth) nWidth = LogicToPixel(Point(nWidth, 0), MapMode(MapUnit::Map10thMM)).X(); - AppendColumn(aName, (sal_uInt16)nWidth); + AppendColumn(aName, static_cast<sal_uInt16>(nWidth)); DbGridColumn* pCol = DbGridControl::GetColumns().at( i ); pCol->setModel(xCol); } @@ -1626,7 +1626,7 @@ void FmGridControl::InitColumnsByModels(const Reference< css::container::XIndexC Reference< css::beans::XPropertySet > xCol( xColumns->getByIndex(i), css::uno::UNO_QUERY); aHidden = xCol->getPropertyValue(FM_PROP_HIDDEN); if (::comphelper::getBOOL(aHidden)) - HideColumn(GetColumnIdFromModelPos((sal_uInt16)i)); + HideColumn(GetColumnIdFromModelPos(static_cast<sal_uInt16>(i))); } SetUpdateMode(true); @@ -1685,7 +1685,7 @@ void FmGridControl::InitColumnByField( if ( bIllegalType ) { - _pColumn->SetObject( (sal_Int16)nFieldPos ); + _pColumn->SetObject( static_cast<sal_Int16>(nFieldPos) ); return; } } @@ -1733,7 +1733,7 @@ void FmGridControl::HideColumn(sal_uInt16 nId) DbGridControl::HideColumn(nId); sal_uInt16 nPos = GetModelColumnPos(nId); - if (nPos == (sal_uInt16)-1) + if (nPos == sal_uInt16(-1)) return; DbGridColumn* pColumn = GetColumns().at( nPos ); @@ -1741,7 +1741,7 @@ void FmGridControl::HideColumn(sal_uInt16 nId) GetPeer()->columnHidden(pColumn); if (nId == m_nMarkedColumnId) - m_nMarkedColumnId = (sal_uInt16)-1; + m_nMarkedColumnId = sal_uInt16(-1); } bool FmGridControl::isColumnSelected(DbGridColumn const * _pColumn) @@ -1764,7 +1764,7 @@ void FmGridControl::ShowColumn(sal_uInt16 nId) DbGridControl::ShowColumn(nId); sal_uInt16 nPos = GetModelColumnPos(nId); - if (nPos == (sal_uInt16)-1) + if (nPos == sal_uInt16(-1)) return; DbGridColumn* pColumn = GetColumns().at( nPos ); @@ -1843,7 +1843,7 @@ Sequence< Any> FmGridControl::getSelectionBookmarks() while (nIdx != BROWSER_ENDOFSELECTION) { // (we misuse the bookmarks array for this ...) - pBookmarks[i++] <<= (sal_Int32)nIdx; + pBookmarks[i++] <<= static_cast<sal_Int32>(nIdx); nIdx = NextSelectedRow(); } DBG_ASSERT(i == nSelectedRows, "FmGridControl::DeleteSelectedRows : could not collect the row indices !"); diff --git a/svx/source/fmcomp/fmgridif.cxx b/svx/source/fmcomp/fmgridif.cxx index ddd58019718d..c4ec732dcc93 100644 --- a/svx/source/fmcomp/fmgridif.cxx +++ b/svx/source/fmcomp/fmgridif.cxx @@ -84,16 +84,16 @@ css::awt::FontDescriptor ImplCreateFontDescriptor( const vcl::Font& rFont ) css::awt::FontDescriptor aFD; aFD.Name = rFont.GetFamilyName(); aFD.StyleName = rFont.GetStyleName(); - aFD.Height = (sal_Int16)rFont.GetFontSize().Height(); - aFD.Width = (sal_Int16)rFont.GetFontSize().Width(); - aFD.Family = (sal_Int16)rFont.GetFamilyType(); + aFD.Height = static_cast<sal_Int16>(rFont.GetFontSize().Height()); + aFD.Width = static_cast<sal_Int16>(rFont.GetFontSize().Width()); + aFD.Family = static_cast<sal_Int16>(rFont.GetFamilyType()); aFD.CharSet = rFont.GetCharSet(); - aFD.Pitch = (sal_Int16)rFont.GetPitch(); + aFD.Pitch = static_cast<sal_Int16>(rFont.GetPitch()); aFD.CharacterWidth = vcl::unohelper::ConvertFontWidth( rFont.GetWidthType() ); aFD.Weight= vcl::unohelper::ConvertFontWeight( rFont.GetWeight() ); aFD.Slant = vcl::unohelper::ConvertFontSlant( rFont.GetItalic() ); - aFD.Underline = (sal_Int16)rFont.GetUnderline(); - aFD.Strikeout = (sal_Int16)rFont.GetStrikeout(); + aFD.Underline = static_cast<sal_Int16>(rFont.GetUnderline()); + aFD.Strikeout = static_cast<sal_Int16>(rFont.GetStrikeout()); aFD.Orientation = rFont.GetOrientation(); aFD.Kerning = rFont.IsKerning(); aFD.WordLineMode = rFont.IsWordLineMode(); @@ -109,14 +109,14 @@ vcl::Font ImplCreateFont( const css::awt::FontDescriptor& rDescr ) aFont.SetStyleName( rDescr.StyleName ); aFont.SetFontSize( ::Size( rDescr.Width, rDescr.Height ) ); aFont.SetFamily( (FontFamily)rDescr.Family ); - aFont.SetCharSet( (rtl_TextEncoding)rDescr.CharSet ); + aFont.SetCharSet( static_cast<rtl_TextEncoding>(rDescr.CharSet) ); aFont.SetPitch( (FontPitch)rDescr.Pitch ); aFont.SetWidthType( vcl::unohelper::ConvertFontWidth( rDescr.CharacterWidth ) ); aFont.SetWeight( vcl::unohelper::ConvertFontWeight( rDescr.Weight ) ); aFont.SetItalic( (FontItalic)rDescr.Slant ); aFont.SetUnderline( (::FontLineStyle)rDescr.Underline ); aFont.SetStrikeout( (::FontStrikeout)rDescr.Strikeout ); - aFont.SetOrientation( (sal_Int16)rDescr.Orientation ); + aFont.SetOrientation( static_cast<sal_Int16>(rDescr.Orientation) ); aFont.SetKerning( static_cast<FontKerning>(rDescr.Kerning) ); aFont.SetWordLineMode( rDescr.WordLineMode ); return aFont; @@ -1243,8 +1243,8 @@ Sequence< sal_Bool > SAL_CALL FmXGridPeer::queryFieldDataType( const Type& xType pReturnArray[i] = false; - sal_uInt16 nModelPos = pGrid->GetModelColumnPos(pGrid->GetColumnIdFromViewPos((sal_uInt16)i)); - DBG_ASSERT(nModelPos != (sal_uInt16)-1, "FmXGridPeer::queryFieldDataType : no model pos !"); + sal_uInt16 nModelPos = pGrid->GetModelColumnPos(pGrid->GetColumnIdFromViewPos(static_cast<sal_uInt16>(i))); + DBG_ASSERT(nModelPos != sal_uInt16(-1), "FmXGridPeer::queryFieldDataType : no model pos !"); pCol = aColumns[ nModelPos ]; const DbGridRowRef xRow = pGrid->GetSeekRow(); @@ -1303,8 +1303,8 @@ Sequence< Any > SAL_CALL FmXGridPeer::queryFieldData( sal_Int32 nRow, const Type Reference< css::sdb::XColumn > xFieldContent; for (sal_Int32 i=0; i < nColumnCount; ++i) { - sal_uInt16 nModelPos = pGrid->GetModelColumnPos(pGrid->GetColumnIdFromViewPos((sal_uInt16)i)); - DBG_ASSERT(nModelPos != (sal_uInt16)-1, "FmXGridPeer::queryFieldData : invalid model pos !"); + sal_uInt16 nModelPos = pGrid->GetModelColumnPos(pGrid->GetColumnIdFromViewPos(static_cast<sal_uInt16>(i))); + DBG_ASSERT(nModelPos != sal_uInt16(-1), "FmXGridPeer::queryFieldData : invalid model pos !"); // don't use GetCurrentFieldValue to determine the field content as this isn't affected by the above SeekRow // FS - 30.09.99 - 68644 @@ -1335,10 +1335,10 @@ Sequence< Any > SAL_CALL FmXGridPeer::queryFieldData( sal_Int32 nRow, const Type // everything else is requested in the DatabaseVariant case TypeClass_FLOAT : pReturnArray[i] <<= xFieldContent->getFloat(); break; case TypeClass_DOUBLE : pReturnArray[i] <<= xFieldContent->getDouble(); break; - case TypeClass_SHORT : pReturnArray[i] <<= (sal_Int16)xFieldContent->getShort(); break; - case TypeClass_LONG : pReturnArray[i] <<= (sal_Int32)xFieldContent->getLong(); break; - case TypeClass_UNSIGNED_SHORT : pReturnArray[i] <<= (sal_uInt16)xFieldContent->getShort(); break; - case TypeClass_UNSIGNED_LONG : pReturnArray[i] <<= (sal_uInt32)xFieldContent->getLong(); break; + case TypeClass_SHORT : pReturnArray[i] <<= static_cast<sal_Int16>(xFieldContent->getShort()); break; + case TypeClass_LONG : pReturnArray[i] <<= static_cast<sal_Int32>(xFieldContent->getLong()); break; + case TypeClass_UNSIGNED_SHORT : pReturnArray[i] <<= static_cast<sal_uInt16>(xFieldContent->getShort()); break; + case TypeClass_UNSIGNED_LONG : pReturnArray[i] <<= static_cast<sal_uInt32>(xFieldContent->getLong()); break; case TypeClass_BOOLEAN : pReturnArray[i] <<= xFieldContent->getBoolean(); break; default: { @@ -1391,7 +1391,7 @@ void FmXGridPeer::propertyChange(const PropertyChangeEvent& evt) // this is valid because we are listening at the cursor, too (RecordCount, -status, edit mode) return; - sal_uInt16 nId = pGrid->GetColumnIdFromModelPos((sal_uInt16)i); + sal_uInt16 nId = pGrid->GetColumnIdFromModelPos(static_cast<sal_uInt16>(i)); bool bInvalidateColumn = false; if (evt.PropertyName == FM_PROP_LABEL) @@ -1716,7 +1716,7 @@ void FmXGridPeer::elementInserted(const ContainerEvent& evt) VclPtr< FmGridControl > pGrid = GetAs< FmGridControl >(); // take handle column into account - if (!pGrid || !m_xColumns.is() || pGrid->IsInColumnMove() || m_xColumns->getCount() == ((sal_Int32)pGrid->GetModelColCount())) + if (!pGrid || !m_xColumns.is() || pGrid->IsInColumnMove() || m_xColumns->getCount() == static_cast<sal_Int32>(pGrid->GetModelColCount())) return; Reference< XPropertySet > xNewColumn(evt.Element, css::uno::UNO_QUERY); @@ -1728,7 +1728,7 @@ void FmXGridPeer::elementInserted(const ContainerEvent& evt) if (aWidth >>= nWidth) nWidth = pGrid->LogicToPixel(Point(nWidth, 0), MapMode(MapUnit::Map10thMM)).X(); - pGrid->AppendColumn(aName, (sal_uInt16)nWidth, (sal_Int16)::comphelper::getINT32(evt.Accessor)); + pGrid->AppendColumn(aName, static_cast<sal_uInt16>(nWidth), static_cast<sal_Int16>(::comphelper::getINT32(evt.Accessor))); // now set the column DbGridColumn* pCol = pGrid->GetColumns().at( ::comphelper::getINT32(evt.Accessor) ); @@ -1760,7 +1760,7 @@ void FmXGridPeer::elementReplaced(const ContainerEvent& evt) if (bWasEditing) pGrid->DeactivateCell(); - pGrid->RemoveColumn(pGrid->GetColumnIdFromModelPos((sal_uInt16)::comphelper::getINT32(evt.Accessor))); + pGrid->RemoveColumn(pGrid->GetColumnIdFromModelPos(static_cast<sal_uInt16>(::comphelper::getINT32(evt.Accessor)))); removeColumnListeners(xOldColumn); addColumnListeners(xNewColumn); @@ -1770,7 +1770,7 @@ void FmXGridPeer::elementReplaced(const ContainerEvent& evt) sal_Int32 nWidth = 0; if (aWidth >>= nWidth) nWidth = pGrid->LogicToPixel(Point(nWidth, 0), MapMode(MapUnit::Map10thMM)).X(); - sal_uInt16 nNewId = pGrid->AppendColumn(aName, (sal_uInt16)nWidth, (sal_Int16)::comphelper::getINT32(evt.Accessor)); + sal_uInt16 nNewId = pGrid->AppendColumn(aName, static_cast<sal_uInt16>(nWidth), static_cast<sal_Int16>(::comphelper::getINT32(evt.Accessor))); sal_uInt16 nNewPos = pGrid->GetModelColumnPos(nNewId); // set the model of the new column @@ -1804,10 +1804,10 @@ void FmXGridPeer::elementRemoved(const ContainerEvent& evt) VclPtr< FmGridControl > pGrid = GetAs< FmGridControl >(); // take handle column into account - if (!pGrid || !m_xColumns.is() || pGrid->IsInColumnMove() || m_xColumns->getCount() == ((sal_Int32)pGrid->GetModelColCount())) + if (!pGrid || !m_xColumns.is() || pGrid->IsInColumnMove() || m_xColumns->getCount() == static_cast<sal_Int32>(pGrid->GetModelColCount())) return; - pGrid->RemoveColumn(pGrid->GetColumnIdFromModelPos((sal_uInt16)::comphelper::getINT32(evt.Accessor))); + pGrid->RemoveColumn(pGrid->GetColumnIdFromModelPos(static_cast<sal_uInt16>(::comphelper::getINT32(evt.Accessor)))); Reference< XPropertySet > xOldColumn(evt.Element, css::uno::UNO_QUERY); removeColumnListeners(xOldColumn); @@ -2041,18 +2041,18 @@ Any FmXGridPeer::getProperty( const OUString& _rPropertyName ) } else if ( _rPropertyName == FM_PROP_TEXTCOLOR ) { - aProp <<= (sal_Int32)pDataWindow->GetControlForeground().GetColor(); + aProp <<= static_cast<sal_Int32>(pDataWindow->GetControlForeground().GetColor()); } else if ( _rPropertyName == FM_PROP_BACKGROUNDCOLOR ) { - aProp <<= (sal_Int32)pDataWindow->GetControlBackground().GetColor(); + aProp <<= static_cast<sal_Int32>(pDataWindow->GetControlBackground().GetColor()); } else if ( _rPropertyName == FM_PROP_ROWHEIGHT ) { sal_Int32 nPixelHeight = pGrid->GetDataRowHeight(); // take the zoom factor into account nPixelHeight = pGrid->CalcReverseZoom(nPixelHeight); - aProp <<= (sal_Int32)pGrid->PixelToLogic(Point(0, nPixelHeight), MapMode(MapUnit::Map10thMM)).Y(); + aProp <<= static_cast<sal_Int32>(pGrid->PixelToLogic(Point(0, nPixelHeight), MapMode(MapUnit::Map10thMM)).Y()); } else if ( _rPropertyName == FM_PROP_HASNAVIGATION ) { @@ -2266,7 +2266,7 @@ void FmXGridPeer::selectionChanged(const EventObject& evt) m_xColumns->getByIndex(i) >>= xCol; if ( xCol == xSelection ) { - pGrid->markColumn(pGrid->GetColumnIdFromModelPos((sal_uInt16)i)); + pGrid->markColumn(pGrid->GetColumnIdFromModelPos(static_cast<sal_uInt16>(i))); break; } } @@ -2276,7 +2276,7 @@ void FmXGridPeer::selectionChanged(const EventObject& evt) { // (if this does not take effect, the selectionChanged was implicitly triggered by the control itself) if ( i < nColCount ) { - pGrid->SelectColumnPos(pGrid->GetViewColumnPos(pGrid->GetColumnIdFromModelPos( (sal_uInt16)i )) + 1); + pGrid->SelectColumnPos(pGrid->GetViewColumnPos(pGrid->GetColumnIdFromModelPos( static_cast<sal_uInt16>(i) )) + 1); // SelectColumnPos has led to an implicit ActivateCell again if (pGrid->IsEditing()) pGrid->DeactivateCell(); @@ -2331,7 +2331,7 @@ Any FmXGridPeer::getByIndex(sal_Int32 _nIndex) Any aElement; // get the columnid - sal_uInt16 nId = pGrid->GetColumnIdFromViewPos((sal_uInt16)_nIndex); + sal_uInt16 nId = pGrid->GetColumnIdFromViewPos(static_cast<sal_uInt16>(_nIndex)); // get the list position sal_uInt16 nPos = pGrid->GetModelColumnPos(nId); @@ -2818,7 +2818,7 @@ IMPL_LINK(FmXGridPeer, OnExecuteGridSlot, DbGridControlNavigationBarState, nSlot const std::vector<DbGridControlNavigationBarState>& aSlots = getSupportedGridSlots(); - DBG_ASSERT((sal_Int32)aSlots.size() == aUrls.getLength(), "FmXGridPeer::OnExecuteGridSlot : inconsistent data returned by getSupportedURLs/getSupportedGridSlots!"); + DBG_ASSERT(static_cast<sal_Int32>(aSlots.size()) == aUrls.getLength(), "FmXGridPeer::OnExecuteGridSlot : inconsistent data returned by getSupportedURLs/getSupportedGridSlots!"); for (size_t i=0; i<aSlots.size(); ++i, ++pUrls) { diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx index 7da52af19012..49722fa6487a 100644 --- a/svx/source/fmcomp/gridcell.cxx +++ b/svx/source/fmcomp/gridcell.cxx @@ -142,16 +142,16 @@ void DbGridColumn::CreateControl(sal_Int32 _nFieldPos, const Reference< css::bea { Clear(); - m_nTypeId = (sal_Int16)nTypeId; + m_nTypeId = static_cast<sal_Int16>(nTypeId); if (xField != m_xField) { // initial setting m_xField = xField; xField->getPropertyValue(FM_PROP_FORMATKEY) >>= m_nFormatKey; - m_nFieldPos = (sal_Int16)_nFieldPos; + m_nFieldPos = static_cast<sal_Int16>(_nFieldPos); m_bReadOnly = ::comphelper::getBOOL(xField->getPropertyValue(FM_PROP_ISREADONLY)); m_bAutoValue = ::comphelper::getBOOL(xField->getPropertyValue(FM_PROP_AUTOINCREMENT)); - m_nFieldType = (sal_Int16)::comphelper::getINT32(xField->getPropertyValue(FM_PROP_FIELDTYPE)); + m_nFieldType = static_cast<sal_Int16>(::comphelper::getINT32(xField->getPropertyValue(FM_PROP_FIELDTYPE))); switch (m_nFieldType) { @@ -1694,7 +1694,7 @@ void DbCheckBox::updateFromModel( Reference< XPropertySet > _rxModel ) bool DbCheckBox::commitControl() { m_rColumn.getModel()->setPropertyValue( FM_PROP_STATE, - makeAny( (sal_Int16)( static_cast< CheckBoxControl* >( m_pWindow.get() )->GetBox().GetState() ) ) ); + makeAny( static_cast<sal_Int16>( static_cast< CheckBoxControl* >( m_pWindow.get() )->GetBox().GetState() ) ) ); return true; } @@ -1868,9 +1868,9 @@ void DbNumericField::implAdjustGenericFieldSetting( const Reference< XPropertySe if ( !m_pWindow || !_rxModel.is() ) return; - sal_Int32 nMin = (sal_Int32)getDouble( _rxModel->getPropertyValue( FM_PROP_VALUEMIN ) ); - sal_Int32 nMax = (sal_Int32)getDouble( _rxModel->getPropertyValue( FM_PROP_VALUEMAX ) ); - sal_Int32 nStep = (sal_Int32)getDouble( _rxModel->getPropertyValue( FM_PROP_VALUESTEP ) ); + sal_Int32 nMin = static_cast<sal_Int32>(getDouble( _rxModel->getPropertyValue( FM_PROP_VALUEMIN ) )); + sal_Int32 nMax = static_cast<sal_Int32>(getDouble( _rxModel->getPropertyValue( FM_PROP_VALUEMAX ) )); + sal_Int32 nStep = static_cast<sal_Int32>(getDouble( _rxModel->getPropertyValue( FM_PROP_VALUESTEP ) )); bool bStrict = getBOOL( _rxModel->getPropertyValue( FM_PROP_STRICTFORMAT ) ); sal_Int16 nScale = getINT16( _rxModel->getPropertyValue( FM_PROP_DECIMAL_ACCURACY ) ); bool bThousand = getBOOL( _rxModel->getPropertyValue( FM_PROP_SHOWTHOUSANDSEP ) ); @@ -2641,7 +2641,7 @@ bool DbListBox::commitControl() if (static_cast<ListBox*>(m_pWindow.get())->GetSelectedEntryCount()) { aSelectSeq.realloc(1); - *aSelectSeq.getArray() = (sal_Int16)static_cast<ListBox*>(m_pWindow.get())->GetSelectedEntryPos(); + *aSelectSeq.getArray() = static_cast<sal_Int16>(static_cast<ListBox*>(m_pWindow.get())->GetSelectedEntryPos()); } aVal <<= aSelectSeq; m_rColumn.getModel()->setPropertyValue(FM_PROP_SELECT_SEQ, aVal); @@ -2852,7 +2852,7 @@ bool DbFilterField::commitControl() aText.clear(); if (static_cast<ListBox*>(m_pWindow.get())->GetSelectedEntryCount()) { - sal_Int16 nPos = (sal_Int16)static_cast<ListBox*>(m_pWindow.get())->GetSelectedEntryPos(); + sal_Int16 nPos = static_cast<sal_Int16>(static_cast<ListBox*>(m_pWindow.get())->GetSelectedEntryPos()); if ( ( nPos >= 0 ) && ( nPos < m_aValueList.getLength() ) ) aText = m_aValueList.getConstArray()[nPos]; } @@ -3895,7 +3895,7 @@ short SAL_CALL FmXCheckBoxCell::getState() if (m_pBox) { UpdateFromColumn(); - return (short)m_pBox->GetState(); + return static_cast<short>(m_pBox->GetState()); } return TRISTATE_INDET; } @@ -4212,8 +4212,8 @@ void SAL_CALL FmXListBoxCell::selectItemsPos(const Sequence< sal_Int16 >& aPosit if (m_pBox) { - for ( sal_uInt16 n = (sal_uInt16)aPositions.getLength(); n; ) - m_pBox->SelectEntryPos( (sal_uInt16) aPositions.getConstArray()[--n], bSelect ); + for ( sal_uInt16 n = static_cast<sal_uInt16>(aPositions.getLength()); n; ) + m_pBox->SelectEntryPos( static_cast<sal_uInt16>(aPositions.getConstArray()[--n]), bSelect ); } } diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx index 036b6472a19b..7d75fa5a1a0d 100644 --- a/svx/source/fmcomp/gridctrl.cxx +++ b/svx/source/fmcomp/gridctrl.cxx @@ -416,7 +416,7 @@ namespace { _rButton.SetPosPixel( _rPos ); _rButton.SetSizePixel( _rSize ); - _rPos.X() += (sal_uInt16)_rSize.Width(); + _rPos.X() += static_cast<sal_uInt16>(_rSize.Width()); } } @@ -959,7 +959,7 @@ DbGridControl::DbGridControl( ,m_nDeleteEvent(nullptr) ,m_nOptions(DbGridControlOptions::Readonly) ,m_nOptionMask(DbGridControlOptions::Insert | DbGridControlOptions::Update | DbGridControlOptions::Delete) - ,m_nLastColId((sal_uInt16)-1) + ,m_nLastColId(sal_uInt16(-1)) ,m_nLastRowId(-1) ,m_bDesignMode(false) ,m_bRecordCountFinal(false) @@ -1061,8 +1061,8 @@ void DbGridControl::StateChanged( StateChangedType nType ) // and give it a chance to rearrange Point aPoint = GetControlArea().TopLeft(); - sal_uInt16 nX = (sal_uInt16)aPoint.X(); - ArrangeControls(nX, (sal_uInt16)aPoint.Y()); + sal_uInt16 nX = static_cast<sal_uInt16>(aPoint.X()); + ArrangeControls(nX, static_cast<sal_uInt16>(aPoint.Y())); ReserveControlArea(nX); } break; @@ -1266,9 +1266,9 @@ void DbGridControl::EnableNavigationBar(bool bEnable) // get size of the reserved ControlArea Point aPoint = GetControlArea().TopLeft(); - sal_uInt16 nX = (sal_uInt16)aPoint.X(); + sal_uInt16 nX = static_cast<sal_uInt16>(aPoint.X()); - ArrangeControls(nX, (sal_uInt16)aPoint.Y()); + ArrangeControls(nX, static_cast<sal_uInt16>(aPoint.Y())); ReserveControlArea(nX); } else @@ -1720,7 +1720,7 @@ void DbGridControl::ColumnMoved(sal_uInt16 nId) // remove the col from the model sal_uInt16 nOldModelPos = GetModelColumnPos(nId); #ifdef DBG_UTIL - DbGridColumn* pCol = m_aColumns[ (sal_uInt32)nOldModelPos ]; + DbGridColumn* pCol = m_aColumns[ static_cast<sal_uInt32>(nOldModelPos) ]; DBG_ASSERT(!pCol->IsHidden(), "DbGridControl::ColumnMoved : moved a hidden col ? how this ?"); #endif @@ -1976,7 +1976,7 @@ void DbGridControl::AdjustRows() if (nRecordCount != GetRowCount()) { - long nDelta = GetRowCount() - (long)nRecordCount; + long nDelta = GetRowCount() - static_cast<long>(nRecordCount); if (nDelta > 0) // too many { RowRemoved(GetRowCount() - nDelta, nDelta, false); @@ -2542,7 +2542,7 @@ void DbGridControl::MoveToPosition(sal_uInt32 nPos) if (!m_pSeekCursor) return; - if (m_nTotalCount < 0 && (long)nPos >= GetRowCount()) + if (m_nTotalCount < 0 && static_cast<long>(nPos) >= GetRowCount()) { try { @@ -2812,9 +2812,9 @@ void DbGridControl::executeRowContextMenu( long _nRow, const Point& _rPreferredP VclBuilder aBuilder(nullptr, VclBuilderContainer::getUIRootDir(), "svx/ui/rowsmenu.ui", ""); VclPtr<PopupMenu> aContextMenu(aBuilder.get_menu("menu")); - PreExecuteRowContextMenu( (sal_uInt16)_nRow, *aContextMenu.get() ); + PreExecuteRowContextMenu( static_cast<sal_uInt16>(_nRow), *aContextMenu.get() ); aContextMenu->RemoveDisabledEntries( true, true ); - PostExecuteRowContextMenu( (sal_uInt16)_nRow, *aContextMenu.get(), aContextMenu->Execute( this, _rPreferredPos ) ); + PostExecuteRowContextMenu( static_cast<sal_uInt16>(_nRow), *aContextMenu.get(), aContextMenu->Execute( this, _rPreferredPos ) ); } void DbGridControl::Command(const CommandEvent& rEvt) @@ -3561,7 +3561,7 @@ void DbGridControl::DisconnectFromFields() { sal_Int32 nOldSize = pListeners->size(); pListeners->begin()->second->dispose(); - DBG_ASSERT(nOldSize > (sal_Int32)pListeners->size(), "DbGridControl::DisconnectFromFields : dispose on a listener should result in a removal from my list !"); + DBG_ASSERT(nOldSize > static_cast<sal_Int32>(pListeners->size()), "DbGridControl::DisconnectFromFields : dispose on a listener should result in a removal from my list !"); } delete pListeners; diff --git a/svx/source/form/filtnav.cxx b/svx/source/form/filtnav.cxx index 99c725eef48d..3591a25cc18e 100644 --- a/svx/source/form/filtnav.cxx +++ b/svx/source/form/filtnav.cxx @@ -426,7 +426,7 @@ void SAL_CALL FmFilterAdapter::disjunctiveTermRemoved( const FilterEvent& Event return; ::std::vector< FmFilterData* >& rTermItems = pFormItem->GetChildren(); - const bool bValidIndex = ( Event.DisjunctiveTerm >= 0 ) && ( (size_t)Event.DisjunctiveTerm < rTermItems.size() ); + const bool bValidIndex = ( Event.DisjunctiveTerm >= 0 ) && ( static_cast<size_t>(Event.DisjunctiveTerm) < rTermItems.size() ); OSL_ENSURE( bValidIndex, "FmFilterAdapter::disjunctiveTermRemoved: invalid term index!" ); if ( !bValidIndex ) return; @@ -461,7 +461,7 @@ void SAL_CALL FmFilterAdapter::disjunctiveTermAdded( const FilterEvent& Event ) return; const sal_Int32 nInsertPos = Event.DisjunctiveTerm; - bool bValidIndex = ( nInsertPos >= 0 ) && ( (size_t)nInsertPos <= pFormItem->GetChildren().size() ); + bool bValidIndex = ( nInsertPos >= 0 ) && ( static_cast<size_t>(nInsertPos) <= pFormItem->GetChildren().size() ); if ( !bValidIndex ) { OSL_FAIL( "FmFilterAdapter::disjunctiveTermAdded: invalid index!" ); @@ -671,7 +671,7 @@ void FmFilterModel::SetCurrentController(const Reference< XFormController > & xC { Reference< XFilterController > xFilterController( m_xController, UNO_QUERY_THROW ); const sal_Int32 nActiveTerm( xFilterController->getActiveTerm() ); - if ( pItem->GetChildren().size() > (size_t)nActiveTerm ) + if ( pItem->GetChildren().size() > static_cast<size_t>(nActiveTerm) ) { SetCurrentItems( static_cast< FmFilterItems* >( pItem->GetChildren()[ nActiveTerm ] ) ); } diff --git a/svx/source/form/fmcontrollayout.cxx b/svx/source/form/fmcontrollayout.cxx index 4ba08f31c67a..22dfb220feb4 100644 --- a/svx/source/form/fmcontrollayout.cxx +++ b/svx/source/form/fmcontrollayout.cxx @@ -263,7 +263,7 @@ namespace svxform && ( xPSI->hasPropertyByName( FM_PROP_BORDERCOLOR ) ) ) // light gray flat border - _rxControlModel->setPropertyValue( FM_PROP_BORDERCOLOR, makeAny( (sal_Int32)0x00C0C0C0 ) ); + _rxControlModel->setPropertyValue( FM_PROP_BORDERCOLOR, makeAny( sal_Int32(0x00C0C0C0) ) ); } } if ( xPSI->hasPropertyByName( FM_PROP_VISUALEFFECT ) ) diff --git a/svx/source/form/fmobj.cxx b/svx/source/form/fmobj.cxx index 10a0644669e0..98180032ebbf 100644 --- a/svx/source/form/fmobj.cxx +++ b/svx/source/form/fmobj.cxx @@ -456,7 +456,7 @@ Reference< XInterface > FmFormObj::ensureModelEnv(const Reference< XInterface > do { OUString aToken = sAccessPath.getToken( 0, '\\', nTokIndex ); - sal_uInt16 nIndex = (sal_uInt16)aToken.toInt32(); + sal_uInt16 nIndex = static_cast<sal_uInt16>(aToken.toInt32()); // get the DSS of the source form (we have to find an equivalent for) DBG_ASSERT(nIndex<xSourceContainer->getCount(), "FmFormObj::ensureModelEnv : invalid access path !"); diff --git a/svx/source/form/fmobjfac.cxx b/svx/source/form/fmobjfac.cxx index 3244daa434a8..22c9feb11499 100644 --- a/svx/source/form/fmobjfac.cxx +++ b/svx/source/form/fmobjfac.cxx @@ -202,12 +202,12 @@ IMPL_STATIC_LINK( case OBJ_FM_SCROLLBAR: sServiceSpecifier = FM_SUN_COMPONENT_SCROLLBAR; - aInitialProperties.emplace_back( FM_PROP_BORDER, makeAny( (sal_Int16)0 ) ); + aInitialProperties.emplace_back( FM_PROP_BORDER, makeAny( sal_Int16(0) ) ); break; case OBJ_FM_SPINBUTTON: sServiceSpecifier = FM_SUN_COMPONENT_SPINBUTTON; - aInitialProperties.emplace_back( FM_PROP_BORDER, makeAny( (sal_Int16)0 ) ); + aInitialProperties.emplace_back( FM_PROP_BORDER, makeAny( sal_Int16(0) ) ); break; } diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx index 3f72b3a7a1f5..6eb3385291cd 100644 --- a/svx/source/form/fmshimp.cxx +++ b/svx/source/form/fmshimp.cxx @@ -1486,7 +1486,7 @@ void FmXFormShell::ExecuteSearch_Lock() { if (m_aSearchForms.at(i) == xActiveForm) { - nInitialContext = (sal_Int16)i; + nInitialContext = static_cast<sal_Int16>(i); break; } } @@ -2194,7 +2194,7 @@ IMPL_LINK(FmXFormShell, OnFoundData_Lock, FmFoundRecordInformation&, rfriWhere, if (impl_checkDisposed_Lock()) return; - DBG_ASSERT((rfriWhere.nContext >= 0) && (rfriWhere.nContext < (sal_Int16)m_aSearchForms.size()), + DBG_ASSERT((rfriWhere.nContext >= 0) && (rfriWhere.nContext < static_cast<sal_Int16>(m_aSearchForms.size())), "FmXFormShell::OnFoundData : invalid context!"); Reference< XForm> xForm( m_aSearchForms.at(rfriWhere.nContext)); DBG_ASSERT(xForm.is(), "FmXFormShell::OnFoundData : invalid form!"); @@ -2259,7 +2259,7 @@ IMPL_LINK(FmXFormShell, OnFoundData_Lock, FmFoundRecordInformation&, rfriWhere, m_xLastGridFound = xControlModel; if ( xGrid.is() ) - xGrid->setCurrentColumnPosition((sal_Int16)nGridColumn); + xGrid->setCurrentColumnPosition(static_cast<sal_Int16>(nGridColumn)); } // As the cursor has been repositioned, I have (in positioned) invalidated @@ -2277,7 +2277,7 @@ IMPL_LINK(FmXFormShell, OnCanceledNotFound_Lock, FmFoundRecordInformation&, rfri if (impl_checkDisposed_Lock()) return; - DBG_ASSERT((rfriWhere.nContext >= 0) && (rfriWhere.nContext < (sal_Int16)m_aSearchForms.size()), + DBG_ASSERT((rfriWhere.nContext >= 0) && (rfriWhere.nContext < static_cast<sal_Int16>(m_aSearchForms.size())), "FmXFormShell::OnCanceledNotFound : invalid context!"); Reference< XForm> xForm( m_aSearchForms.at(rfriWhere.nContext)); DBG_ASSERT(xForm.is(), "FmXFormShell::OnCanceledNotFound : invalid form!"); @@ -2306,7 +2306,7 @@ IMPL_LINK(FmXFormShell, OnSearchContextRequest_Lock, FmSearchContext&, rfmscCont if (impl_checkDisposed_Lock()) return 0; - DBG_ASSERT(rfmscContextInfo.nContext < (sal_Int16)m_aSearchForms.size(), "FmXFormShell::OnSearchContextRequest : invalid parameter !"); + DBG_ASSERT(rfmscContextInfo.nContext < static_cast<sal_Int16>(m_aSearchForms.size()), "FmXFormShell::OnSearchContextRequest : invalid parameter !"); Reference< XForm> xForm( m_aSearchForms.at(rfmscContextInfo.nContext)); DBG_ASSERT(xForm.is(), "FmXFormShell::OnSearchContextRequest : unexpected : invalid context !"); @@ -3426,7 +3426,7 @@ void FmXFormShell::CreateExternalView_Lock() // bound column pListBoxDescription->Name = FM_PROP_BOUNDCOLUMN; - pListBoxDescription->Value <<= (sal_Int16)1; + pListBoxDescription->Value <<= sal_Int16(1); ++pListBoxDescription; // content type diff --git a/svx/source/form/fmsrcimp.cxx b/svx/source/form/fmsrcimp.cxx index 9d14412dde93..4612f2563f68 100644 --- a/svx/source/form/fmsrcimp.cxx +++ b/svx/source/form/fmsrcimp.cxx @@ -280,7 +280,7 @@ void FmSearchEngine::BuildAndInsertFieldInfo(const Reference< css::container::XI OUString FmSearchEngine::FormatField(sal_Int32 nWhich) { - DBG_ASSERT((sal_uInt32)nWhich < m_aControlTexts.size(), "FmSearchEngine::FormatField(sal_Int32) : invalid position !"); + DBG_ASSERT(static_cast<sal_uInt32>(nWhich) < m_aControlTexts.size(), "FmSearchEngine::FormatField(sal_Int32) : invalid position !"); DBG_ASSERT(m_aControlTexts[nWhich], "FmSearchEngine::FormatField(sal_Int32) : invalid object in array !"); DBG_ASSERT(m_aControlTexts[nWhich]->getControl().is(), "FmSearchEngine::FormatField : invalid control !"); @@ -291,7 +291,7 @@ OUString FmSearchEngine::FormatField(sal_Int32 nWhich) nWhich = m_nCurrentFieldIndex; } - DBG_ASSERT((nWhich >= 0) && ((sal_uInt32)nWhich < m_aControlTexts.size()), + DBG_ASSERT((nWhich >= 0) && (static_cast<sal_uInt32>(nWhich) < m_aControlTexts.size()), "FmSearchEngine::FormatField : invalid argument nWhich !"); return m_aControlTexts[m_nCurrentFieldIndex == -1 ? nWhich : m_nCurrentFieldIndex]->getCurrentText(); } diff --git a/svx/source/form/fmview.cxx b/svx/source/form/fmview.cxx index cc952a1948f7..ed3a1da307b7 100644 --- a/svx/source/form/fmview.cxx +++ b/svx/source/form/fmview.cxx @@ -404,7 +404,7 @@ SdrObject* FmFormView::CreateFieldControl(const OUString& rFieldDesc) const { OUString sDataSource = rFieldDesc.getToken(0,u'\x000B'); OUString sObjectName = rFieldDesc.getToken(1,u'\x000B'); - sal_uInt16 nObjectType = (sal_uInt16)rFieldDesc.getToken(2,u'\x000B').toInt32(); + sal_uInt16 nObjectType = static_cast<sal_uInt16>(rFieldDesc.getToken(2,u'\x000B').toInt32()); OUString sFieldName = rFieldDesc.getToken(3,u'\x000B'); if (sFieldName.isEmpty() || sObjectName.isEmpty() || sDataSource.isEmpty()) diff --git a/svx/source/form/formcontrolfactory.cxx b/svx/source/form/formcontrolfactory.cxx index bd5a1596764a..f0512d2e85b3 100644 --- a/svx/source/form/formcontrolfactory.cxx +++ b/svx/source/form/formcontrolfactory.cxx @@ -602,7 +602,7 @@ namespace svxform // both the minimum and the maximum value properties can be either Long or Double Property aProperty = xModelPSI->getPropertyByName( FM_PROP_VALUEMIN ); if ( aProperty.Type.getTypeClass() == TypeClass_DOUBLE ) - aValue <<= (double)nMinValue; + aValue <<= static_cast<double>(nMinValue); else if ( aProperty.Type.getTypeClass() == TypeClass_LONG ) aValue <<= nMinValue; else @@ -614,7 +614,7 @@ namespace svxform // both the minimum and the maximum value properties can be either Long or Double aProperty = xModelPSI->getPropertyByName( FM_PROP_VALUEMAX ); if ( aProperty.Type.getTypeClass() == TypeClass_DOUBLE ) - aValue <<= (double)nMaxValue; + aValue <<= static_cast<double>(nMaxValue); else if ( aProperty.Type.getTypeClass() == TypeClass_LONG ) aValue <<= nMaxValue; else diff --git a/svx/source/form/formcontroller.cxx b/svx/source/form/formcontroller.cxx index 3a7524ec8f33..9e68d5601186 100644 --- a/svx/source/form/formcontroller.cxx +++ b/svx/source/form/formcontroller.cxx @@ -741,10 +741,10 @@ void FormController::impl_setTextOnAllFilter_throw() return; // set the text for all filters - OSL_ENSURE( m_aFilterRows.size() > (size_t)m_nCurrentFilterPosition, + OSL_ENSURE( m_aFilterRows.size() > static_cast<size_t>(m_nCurrentFilterPosition), "FormController::impl_setTextOnAllFilter_throw: m_nCurrentFilterPosition too big" ); - if ( (size_t)m_nCurrentFilterPosition < m_aFilterRows.size() ) + if ( static_cast<size_t>(m_nCurrentFilterPosition) < m_aFilterRows.size() ) { FmFilterRow& rRow = m_aFilterRows[ m_nCurrentFilterPosition ]; for ( FmFilterRow::const_iterator iter2 = rRow.begin(); @@ -1083,7 +1083,7 @@ Any SAL_CALL FormController::getByIndex(sal_Int32 Index) { ::osl::MutexGuard aGuard( m_aMutex ); if (Index < 0 || - Index >= (sal_Int32)m_aChildren.size()) + Index >= static_cast<sal_Int32>(m_aChildren.size())) throw IndexOutOfBoundsException(); return makeAny( m_aChildren[ Index ] ); @@ -1452,7 +1452,7 @@ void SAL_CALL FormController::textChanged(const TextEvent& e) appendEmptyDisjunctiveTerm(); // find the current row - if ( ( (size_t)m_nCurrentFilterPosition >= m_aFilterRows.size() ) || ( m_nCurrentFilterPosition < 0 ) ) + if ( ( static_cast<size_t>(m_nCurrentFilterPosition) >= m_aFilterRows.size() ) || ( m_nCurrentFilterPosition < 0 ) ) { OSL_ENSURE( false, "FormController::textChanged: m_nCurrentFilterPosition is wrong!" ); return; @@ -1582,7 +1582,7 @@ void FormController::impl_appendEmptyFilterRow( ::osl::ClearableMutexGuard& _rCl // notify the listeners FilterEvent aEvent; aEvent.Source = *this; - aEvent.DisjunctiveTerm = (sal_Int32)m_aFilterRows.size() - 1; + aEvent.DisjunctiveTerm = static_cast<sal_Int32>(m_aFilterRows.size()) - 1; _rClearBeforeNotify.clear(); // <-- SYNCHRONIZED m_aFilterListeners.notifyEach( &XFilterControllerListener::disjunctiveTermAdded, aEvent ); @@ -3087,8 +3087,8 @@ void FormController::setFilter(::std::vector<FmFieldInfo>& rFieldInfos) * works for ASCII separators, but * pParseNode->parseNodeToPredicateStr() expects a sal_Char. Fix it * there. */ - sal_Char cDecimalSeparator = (sal_Char)rLocaleWrapper.getNumDecimalSep()[0]; - SAL_WARN_IF( (sal_Unicode)cDecimalSeparator != rLocaleWrapper.getNumDecimalSep()[0], + sal_Char cDecimalSeparator = static_cast<sal_Char>(rLocaleWrapper.getNumDecimalSep()[0]); + SAL_WARN_IF( static_cast<sal_Unicode>(cDecimalSeparator) != rLocaleWrapper.getNumDecimalSep()[0], "svx.form", "FormController::setFilter: wrong cast of decimal separator to sal_Char!"); // retrieving the filter diff --git a/svx/source/form/navigatortreemodel.cxx b/svx/source/form/navigatortreemodel.cxx index 4d19f399f470..c7f08f09d6d0 100644 --- a/svx/source/form/navigatortreemodel.cxx +++ b/svx/source/form/navigatortreemodel.cxx @@ -281,8 +281,8 @@ namespace svxform m_pFormModel->BegUndo(aUndoStr); } - if (nRelPos >= (sal_uInt32)xContainer->getCount()) - nRelPos = (sal_uInt32)xContainer->getCount(); + if (nRelPos >= static_cast<sal_uInt32>(xContainer->getCount())) + nRelPos = static_cast<sal_uInt32>(xContainer->getCount()); // UndoAction if ( bUndo && m_pPropChangeList->CanUndo()) diff --git a/svx/source/gallery2/galbrws2.cxx b/svx/source/gallery2/galbrws2.cxx index ed027773324b..d713593d9bff 100644 --- a/svx/source/gallery2/galbrws2.cxx +++ b/svx/source/gallery2/galbrws2.cxx @@ -893,7 +893,7 @@ void GalleryBrowser2::ImplUpdateViews( sal_uInt16 nSelectionId ) for (sal_uInt32 i = 0, nCount = mpCurTheme->GetObjectCount(); i < nCount;) { mpListView->RowInserted( i++ ); - mpIconView->InsertItem( (sal_uInt16) i ); + mpIconView->InsertItem( static_cast<sal_uInt16>(i) ); } ImplSelectItemId( ( nSelectionId > mpCurTheme->GetObjectCount() ) ? mpCurTheme->GetObjectCount() : nSelectionId ); @@ -955,7 +955,7 @@ sal_uInt32 GalleryBrowser2::ImplGetSelectedItemId( const Point* pSelPos, Point& else { nRet = mpListView->FirstSelectedRow() + 1; - rSelPos = mpListView->GetFieldRectPixel( (sal_uInt16) nRet, 1 ).Center(); + rSelPos = mpListView->GetFieldRectPixel( static_cast<sal_uInt16>(nRet), 1 ).Center(); } } diff --git a/svx/source/gallery2/galctrl.cxx b/svx/source/gallery2/galctrl.cxx index dd84637954e7..4a9799c4a087 100644 --- a/svx/source/gallery2/galctrl.cxx +++ b/svx/source/gallery2/galctrl.cxx @@ -102,18 +102,18 @@ bool GalleryPreview::ImplGetGraphicCenterRect( const Graphic& rGraphic, tools::R if( aNewSize.Width() && aNewSize.Height() ) { // scale to fit window - const double fGrfWH = (double) aNewSize.Width() / aNewSize.Height(); - const double fWinWH = (double) aWinSize.Width() / aWinSize.Height(); + const double fGrfWH = static_cast<double>(aNewSize.Width()) / aNewSize.Height(); + const double fWinWH = static_cast<double>(aWinSize.Width()) / aWinSize.Height(); if ( fGrfWH < fWinWH ) { - aNewSize.Width() = (long) ( aWinSize.Height() * fGrfWH ); + aNewSize.Width() = static_cast<long>( aWinSize.Height() * fGrfWH ); aNewSize.Height()= aWinSize.Height(); } else { aNewSize.Width() = aWinSize.Width(); - aNewSize.Height()= (long) ( aWinSize.Width() / fGrfWH); + aNewSize.Height()= static_cast<long>( aWinSize.Width() / fGrfWH); } const Point aNewPos( ( aWinSize.Width() - aNewSize.Width() ) >> 1, diff --git a/svx/source/gallery2/galmisc.cxx b/svx/source/gallery2/galmisc.cxx index 2cd6376557c0..5681b1a7c487 100644 --- a/svx/source/gallery2/galmisc.cxx +++ b/svx/source/gallery2/galmisc.cxx @@ -372,7 +372,7 @@ GalleryProgress::~GalleryProgress() void GalleryProgress::Update( sal_Int32 nVal, sal_Int32 nMaxVal ) { if( mxProgressBar.is() && nMaxVal ) - mxProgressBar->setValue( std::min<sal_Int32>( (double) nVal / nMaxVal * GALLERY_PROGRESS_RANGE, + mxProgressBar->setValue( std::min<sal_Int32>( static_cast<double>(nVal) / nMaxVal * GALLERY_PROGRESS_RANGE, GALLERY_PROGRESS_RANGE ) ); } diff --git a/svx/source/gallery2/galobj.cxx b/svx/source/gallery2/galobj.cxx index 4bf26f7a13de..15810448ba84 100644 --- a/svx/source/gallery2/galobj.cxx +++ b/svx/source/gallery2/galobj.cxx @@ -75,8 +75,8 @@ BitmapEx SgaObject::createPreviewBitmapEx(const Size& rSizePixel) const if(!aRetval.IsEmpty()) { const Size aCurrentSizePixel(aRetval.GetSizePixel()); - const double fScaleX((double)rSizePixel.Width() / (double)aCurrentSizePixel.Width()); - const double fScaleY((double)rSizePixel.Height() / (double)aCurrentSizePixel.Height()); + const double fScaleX(static_cast<double>(rSizePixel.Width()) / static_cast<double>(aCurrentSizePixel.Width())); + const double fScaleY(static_cast<double>(rSizePixel.Height()) / static_cast<double>(aCurrentSizePixel.Height())); const double fScale(std::min(fScaleX, fScaleY)); // only scale when need to decrease, no need to make bigger as original. Also @@ -132,12 +132,12 @@ bool SgaObject::CreateThumb( const Graphic& rGraphic ) } else { - const float fFactor = (float) aBmpSize.Width() / aBmpSize.Height(); - const Size aNewSize( std::max( (long) (fFactor < 1. ? S_THUMB * fFactor : S_THUMB), 8L ), - std::max( (long) (fFactor < 1. ? S_THUMB : S_THUMB / fFactor), 8L ) ); + const float fFactor = static_cast<float>(aBmpSize.Width()) / aBmpSize.Height(); + const Size aNewSize( std::max( static_cast<long>(fFactor < 1. ? S_THUMB * fFactor : S_THUMB), 8L ), + std::max( static_cast<long>(fFactor < 1. ? S_THUMB : S_THUMB / fFactor), 8L ) ); if(aThumbBmp.Scale( - (double) aNewSize.Width() / aBmpSize.Width(), - (double) aNewSize.Height() / aBmpSize.Height(), + static_cast<double>(aNewSize.Width()) / aBmpSize.Width(), + static_cast<double>(aNewSize.Height()) / aBmpSize.Height(), BmpScaleFlag::BestQuality ) ) { aThumbBmp.Convert( BmpConversion::N8BitColors ); @@ -149,12 +149,12 @@ bool SgaObject::CreateThumb( const Graphic& rGraphic ) else if( rGraphic.GetType() == GraphicType::GdiMetafile ) { const Size aPrefSize( rGraphic.GetPrefSize() ); - const double fFactor = (double)aPrefSize.Width() / (double)aPrefSize.Height(); + const double fFactor = static_cast<double>(aPrefSize.Width()) / static_cast<double>(aPrefSize.Height()); Size aSize( S_THUMB, S_THUMB ); if ( fFactor < 1.0 ) - aSize.Width() = (sal_Int32)( S_THUMB * fFactor ); + aSize.Width() = static_cast<sal_Int32>( S_THUMB * fFactor ); else - aSize.Height() = (sal_Int32)( S_THUMB / fFactor ); + aSize.Height() = static_cast<sal_Int32>( S_THUMB / fFactor ); const GraphicConversionParameters aParameters(aSize, false, true, true /*TODO: extra ", true" post-#i121194#*/); aThumbBmp = rGraphic.GetBitmapEx(aParameters); diff --git a/svx/source/gallery2/galtheme.cxx b/svx/source/gallery2/galtheme.cxx index 6e8b16c4ba1d..9c6cdf8dfbec 100644 --- a/svx/source/gallery2/galtheme.cxx +++ b/svx/source/gallery2/galtheme.cxx @@ -1352,7 +1352,7 @@ SvStream& GalleryTheme::WriteData( SvStream& rOStm ) const pCompat.reset(); // Fill the rest of the buffer. - const long nRest = std::max( 512L - ( (long) rOStm.Tell() - nReservePos ), 0L ); + const long nRest = std::max( 512L - ( static_cast<long>(rOStm.Tell()) - nReservePos ), 0L ); if( nRest ) { diff --git a/svx/source/items/algitem.cxx b/svx/source/items/algitem.cxx index c8c3623dce5d..a6464bf11161 100644 --- a/svx/source/items/algitem.cxx +++ b/svx/source/items/algitem.cxx @@ -201,31 +201,31 @@ bool SvxMarginItem::GetPresentation { case SfxItemPresentation::Nameless: { - rText = GetMetricText( (long)nLeftMargin, eCoreUnit, ePresUnit, &rIntl ) + + rText = GetMetricText( static_cast<long>(nLeftMargin), eCoreUnit, ePresUnit, &rIntl ) + cpDelimTmp + - GetMetricText( (long)nTopMargin, eCoreUnit, ePresUnit, &rIntl ) + + GetMetricText( static_cast<long>(nTopMargin), eCoreUnit, ePresUnit, &rIntl ) + cpDelimTmp + - GetMetricText( (long)nRightMargin, eCoreUnit, ePresUnit, &rIntl ) + + GetMetricText( static_cast<long>(nRightMargin), eCoreUnit, ePresUnit, &rIntl ) + cpDelimTmp + - GetMetricText( (long)nBottomMargin, eCoreUnit, ePresUnit, &rIntl ); + GetMetricText( static_cast<long>(nBottomMargin), eCoreUnit, ePresUnit, &rIntl ); return true; } case SfxItemPresentation::Complete: { rText = SvxResId(RID_SVXITEMS_MARGIN_LEFT) + - GetMetricText( (long)nLeftMargin, eCoreUnit, ePresUnit, &rIntl ) + + GetMetricText( static_cast<long>(nLeftMargin), eCoreUnit, ePresUnit, &rIntl ) + " " + EditResId(GetMetricId(ePresUnit)) + cpDelimTmp + SvxResId(RID_SVXITEMS_MARGIN_TOP) + - GetMetricText( (long)nTopMargin, eCoreUnit, ePresUnit, &rIntl ) + + GetMetricText( static_cast<long>(nTopMargin), eCoreUnit, ePresUnit, &rIntl ) + " " + EditResId(GetMetricId(ePresUnit)) + cpDelimTmp + SvxResId(RID_SVXITEMS_MARGIN_RIGHT) + - GetMetricText( (long)nRightMargin, eCoreUnit, ePresUnit, &rIntl ) + + GetMetricText( static_cast<long>(nRightMargin), eCoreUnit, ePresUnit, &rIntl ) + " " + EditResId(GetMetricId(ePresUnit)) + cpDelimTmp + SvxResId(RID_SVXITEMS_MARGIN_BOTTOM) + - GetMetricText( (long)nBottomMargin, eCoreUnit, ePresUnit, &rIntl ) + + GetMetricText( static_cast<long>(nBottomMargin), eCoreUnit, ePresUnit, &rIntl ) + " " + EditResId(GetMetricId(ePresUnit)); return true; } @@ -284,16 +284,16 @@ bool SvxMarginItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const { // now sign everything case MID_MARGIN_L_MARGIN: - rVal <<= (sal_Int32)( bConvert ? convertTwipToMm100(nLeftMargin) : nLeftMargin ); + rVal <<= static_cast<sal_Int32>( bConvert ? convertTwipToMm100(nLeftMargin) : nLeftMargin ); break; case MID_MARGIN_R_MARGIN: - rVal <<= (sal_Int32)( bConvert ? convertTwipToMm100(nRightMargin) : nRightMargin ); + rVal <<= static_cast<sal_Int32>( bConvert ? convertTwipToMm100(nRightMargin) : nRightMargin ); break; case MID_MARGIN_UP_MARGIN: - rVal <<= (sal_Int32)( bConvert ? convertTwipToMm100(nTopMargin) : nTopMargin ); + rVal <<= static_cast<sal_Int32>( bConvert ? convertTwipToMm100(nTopMargin) : nTopMargin ); break; case MID_MARGIN_LO_MARGIN: - rVal <<= (sal_Int32)( bConvert ? convertTwipToMm100(nBottomMargin) : nBottomMargin ); + rVal <<= static_cast<sal_Int32>( bConvert ? convertTwipToMm100(nBottomMargin) : nBottomMargin ); break; default: OSL_FAIL("unknown MemberId"); @@ -314,16 +314,16 @@ bool SvxMarginItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId ) switch ( nMemberId & ~CONVERT_TWIPS ) { case MID_MARGIN_L_MARGIN: - nLeftMargin = (sal_Int16)( bConvert ? convertMm100ToTwip(nVal) : nVal ); + nLeftMargin = static_cast<sal_Int16>( bConvert ? convertMm100ToTwip(nVal) : nVal ); break; case MID_MARGIN_R_MARGIN: - nRightMargin = (sal_Int16)( bConvert ? convertMm100ToTwip(nVal) : nVal ); + nRightMargin = static_cast<sal_Int16>( bConvert ? convertMm100ToTwip(nVal) : nVal ); break; case MID_MARGIN_UP_MARGIN: - nTopMargin = (sal_Int16)( bConvert ? convertMm100ToTwip(nVal) : nVal ); + nTopMargin = static_cast<sal_Int16>( bConvert ? convertMm100ToTwip(nVal) : nVal ); break; case MID_MARGIN_LO_MARGIN: - nBottomMargin = (sal_Int16)( bConvert ? convertMm100ToTwip(nVal) : nVal ); + nBottomMargin = static_cast<sal_Int16>( bConvert ? convertMm100ToTwip(nVal) : nVal ); break; default: OSL_FAIL("unknown MemberId"); diff --git a/svx/source/items/hlnkitem.cxx b/svx/source/items/hlnkitem.cxx index 1783f1245f3d..4585b270d2d0 100644 --- a/svx/source/items/hlnkitem.cxx +++ b/svx/source/items/hlnkitem.cxx @@ -136,7 +136,7 @@ bool SvxHyperlinkItem::QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId ) co rVal <<= sTarget; break; case MID_HLINK_TYPE: - rVal <<= (sal_Int32) eType; + rVal <<= static_cast<sal_Int32>(eType); break; default: return false; @@ -175,7 +175,7 @@ bool SvxHyperlinkItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId case MID_HLINK_TYPE: if(!(rVal >>= nVal)) return false; - eType = (SvxLinkInsertMode) (sal_uInt16) nVal; + eType = (SvxLinkInsertMode) static_cast<sal_uInt16>(nVal); break; default: return false; diff --git a/svx/source/items/numfmtsh.cxx b/svx/source/items/numfmtsh.cxx index 94d3df1cb181..6a23dd3b9d97 100644 --- a/svx/source/items/numfmtsh.cxx +++ b/svx/source/items/numfmtsh.cxx @@ -95,7 +95,7 @@ SvxNumberFormatShell::SvxNumberFormatShell( SvNumberFormatter* pNumFormatter, , eCurLanguage (LANGUAGE_NONE) , pCurCurrencyEntry(nullptr) , bBankingSymbol (false) - , nCurCurrencyEntryPos((sal_uInt16) SELPOS_NONE) + , nCurCurrencyEntryPos(sal_uInt16(SELPOS_NONE)) , bUseStarFormat (false) , bIsDefaultValNum (true) { @@ -132,7 +132,7 @@ SvxNumberFormatShell::SvxNumberFormatShell( SvNumberFormatter* pNumFormatter, , eCurLanguage (LANGUAGE_NONE) , pCurCurrencyEntry(nullptr) , bBankingSymbol (false) - , nCurCurrencyEntryPos((sal_uInt16) SELPOS_NONE) + , nCurCurrencyEntryPos(sal_uInt16(SELPOS_NONE)) , bUseStarFormat (false) , bIsDefaultValNum (false) { @@ -555,7 +555,7 @@ void SvxNumberFormatShell::GetInitSettings( sal_uInt16& nCatLbPos, DBG_ASSERT( nSelPos != SELPOS_NONE, "Leere Formatliste!" ); - nFmtLbSelPos = (nSelPos != SELPOS_NONE) ? (sal_uInt16)nSelPos : 0; + nFmtLbSelPos = (nSelPos != SELPOS_NONE) ? static_cast<sal_uInt16>(nSelPos) : 0; GetPreviewString_Impl( rPrevString, rpPrevColor ); } @@ -1242,7 +1242,7 @@ short SvxNumberFormatShell::GetCategory4Entry(short nEntry) const SvNumFormatType nMyCat=pNumEntry->GetMaskedType(); CategoryToPos_Impl(nMyCat,nMyType); - return (short) nMyType; + return static_cast<short>(nMyType); } return 0; } @@ -1388,7 +1388,7 @@ void SvxNumberFormatShell::GetCurrencySymbols(std::vector<OUString>& rList, sal_ for(size_t i=1;i<nCount;i++) { const sal_uInt16 j = aCurCurrencyList[i]; - if (j != (sal_uInt16)-1 && j < nTableCount && + if (j != sal_uInt16(-1) && j < nTableCount && pTmpCurrencyEntry == &rCurrencyTable[j]) { *pPos=static_cast<sal_uInt16>(i); @@ -1412,7 +1412,7 @@ void SvxNumberFormatShell::SetCurrencySymbol(sal_uInt32 nPos) if(nPos<aCurCurrencyList.size()) { sal_uInt16 nCurrencyPos=aCurCurrencyList[nPos]; - if(nCurrencyPos!=(sal_uInt16)-1) + if(nCurrencyPos!=sal_uInt16(-1)) { pCurCurrencyEntry=const_cast<NfCurrencyEntry*>(&rCurrencyTable[nCurrencyPos]); nCurCurrencyEntryPos=nPos; @@ -1449,7 +1449,7 @@ sal_uInt16 SvxNumberFormatShell::FindCurrencyFormat( const OUString& rFmtString sal_uInt16 nPos=FindCurrencyTableEntry(rFmtString, bTestBanking); - if(nPos!=(sal_uInt16)-1) + if(nPos!=sal_uInt16(-1)) { sal_uInt16 nStart=0; if(bTestBanking && aCurCurrencyList.size()>nPos) @@ -1461,12 +1461,12 @@ sal_uInt16 SvxNumberFormatShell::FindCurrencyFormat( const OUString& rFmtString if(aCurCurrencyList[j]==nPos) return j; } } - return (sal_uInt16) -1; + return sal_uInt16(-1); } sal_uInt16 SvxNumberFormatShell::FindCurrencyTableEntry( const OUString& rFmtString, bool &bTestBanking ) { - sal_uInt16 nPos=(sal_uInt16) -1; + sal_uInt16 nPos=sal_uInt16(-1); const NfCurrencyTable& rCurrencyTable=SvNumberFormatter::GetTheCurrencyTable(); sal_uInt16 nCount=rCurrencyTable.size(); @@ -1543,7 +1543,7 @@ sal_uInt16 SvxNumberFormatShell::FindCurrencyFormat(const NfCurrencyEntry* pTmpC { if(aCurCurrencyList[j]==nPos) return j; } - return (sal_uInt16) -1; + return sal_uInt16(-1); } bool SvxNumberFormatShell::IsInTable(sal_uInt16 const nPos, @@ -1551,7 +1551,7 @@ bool SvxNumberFormatShell::IsInTable(sal_uInt16 const nPos, { bool bFlag=false; - if(nPos!=(sal_uInt16)-1) + if(nPos!=sal_uInt16(-1)) { const NfCurrencyTable& rCurrencyTable=SvNumberFormatter::GetTheCurrencyTable(); sal_uInt16 nCount=rCurrencyTable.size(); diff --git a/svx/source/items/pageitem.cxx b/svx/source/items/pageitem.cxx index 1da923284439..f18e4fe50037 100644 --- a/svx/source/items/pageitem.cxx +++ b/svx/source/items/pageitem.cxx @@ -162,7 +162,7 @@ bool SvxPageItem::QueryValue( uno::Any& rVal, sal_uInt8 nMemberId ) const case MID_PAGE_NUMTYPE: { //! constants aren't in IDLs any more ?!? - rVal <<= (sal_Int16)( eNumType ); + rVal <<= static_cast<sal_Int16>( eNumType ); } break; case MID_PAGE_ORIENTATION: diff --git a/svx/source/items/viewlayoutitem.cxx b/svx/source/items/viewlayoutitem.cxx index 8310933e1d7c..95f749d9bcb2 100644 --- a/svx/source/items/viewlayoutitem.cxx +++ b/svx/source/items/viewlayoutitem.cxx @@ -89,7 +89,7 @@ bool SvxViewLayoutItem::QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId ) c } break; - case MID_VIEWLAYOUT_COLUMNS : rVal <<= (sal_Int32) GetValue(); break; + case MID_VIEWLAYOUT_COLUMNS : rVal <<= static_cast<sal_Int32>(GetValue()); break; case MID_VIEWLAYOUT_BOOKMODE: rVal <<= mbBookMode; break; default: OSL_FAIL("svx::SvxViewLayoutItem::QueryValue(), Wrong MemberId!"); @@ -129,7 +129,7 @@ bool SvxViewLayoutItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId if ( bAllConverted && nConvertedCount == VIEWLAYOUT_PARAMS ) { - SetValue( (sal_uInt16)nColumns ); + SetValue( static_cast<sal_uInt16>(nColumns) ); mbBookMode = bBookMode; return true; } @@ -143,7 +143,7 @@ bool SvxViewLayoutItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId sal_Int32 nVal = 0; if ( rVal >>= nVal ) { - SetValue( (sal_uInt16)nVal ); + SetValue( static_cast<sal_uInt16>(nVal) ); return true; } else diff --git a/svx/source/items/zoomslideritem.cxx b/svx/source/items/zoomslideritem.cxx index ed261b781b91..67e40294c448 100644 --- a/svx/source/items/zoomslideritem.cxx +++ b/svx/source/items/zoomslideritem.cxx @@ -78,7 +78,7 @@ bool SvxZoomSliderItem::QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId ) c case MID_ZOOMSLIDER_CURRENTZOOM : { - rVal <<= (sal_Int32) GetValue(); + rVal <<= static_cast<sal_Int32>(GetValue()); } break; case MID_ZOOMSLIDER_SNAPPINGPOINTS: @@ -147,7 +147,7 @@ bool SvxZoomSliderItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId if ( bAllConverted && nConvertedCount == ZOOMSLIDER_PARAMS ) { - SetValue( (sal_uInt16)nCurrentZoom ); + SetValue( static_cast<sal_uInt16>(nCurrentZoom) ); maValues = aValues; mnMinZoom = sal::static_int_cast< sal_uInt16 >( nMinZoom ); mnMaxZoom = sal::static_int_cast< sal_uInt16 >( nMaxZoom ); @@ -164,7 +164,7 @@ bool SvxZoomSliderItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId sal_Int32 nVal = 0; if ( rVal >>= nVal ) { - SetValue( (sal_uInt16)nVal ); + SetValue( static_cast<sal_uInt16>(nVal) ); return true; } else @@ -187,7 +187,7 @@ bool SvxZoomSliderItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId sal_Int32 nVal = 0; if( rVal >>= nVal ) { - mnMinZoom = (sal_uInt16)nVal; + mnMinZoom = static_cast<sal_uInt16>(nVal); return true; } else @@ -198,7 +198,7 @@ bool SvxZoomSliderItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId sal_Int32 nVal = 0; if( rVal >>= nVal ) { - mnMaxZoom = (sal_uInt16)nVal; + mnMaxZoom = static_cast<sal_uInt16>(nVal); return true; } else diff --git a/svx/source/sdr/animation/animationstate.cxx b/svx/source/sdr/animation/animationstate.cxx index e271e2f586a0..f0e67cfcec07 100644 --- a/svx/source/sdr/animation/animationstate.cxx +++ b/svx/source/sdr/animation/animationstate.cxx @@ -80,7 +80,7 @@ namespace sdr // next time point exists, use it sal_uInt32 nNextTime; - if(fNextTime >= (double)0xffffff00) + if(fNextTime >= double(0xffffff00)) { // take care for very late points in time, e.g. when a text animation stops // in a defined AnimationEntryFixed with endless (0xffffffff) duration @@ -88,12 +88,12 @@ namespace sdr } else { - nNextTime = (sal_uInt32)fNextTime; + nNextTime = static_cast<sal_uInt32>(fNextTime); } // ensure step forward in integer timing, the floating step difference maybe smaller than 1.0. Use // at least 25ms for next step - const sal_uInt32 nMinimumStepTime((sal_uInt32)fCurrentTime + 25); + const sal_uInt32 nMinimumStepTime(static_cast<sal_uInt32>(fCurrentTime) + 25); if(nNextTime <= nMinimumStepTime) { diff --git a/svx/source/sdr/attribute/sdrformtextattribute.cxx b/svx/source/sdr/attribute/sdrformtextattribute.cxx index e0801737d599..bc0d690edca0 100644 --- a/svx/source/sdr/attribute/sdrformtextattribute.cxx +++ b/svx/source/sdr/attribute/sdrformtextattribute.cxx @@ -82,11 +82,11 @@ namespace if(bShadow) { - nRetval = (sal_uInt8)((rSet.Get(SDRATTR_SHADOWTRANSPARENCE).GetValue() * 255) / 100); + nRetval = static_cast<sal_uInt8>((rSet.Get(SDRATTR_SHADOWTRANSPARENCE).GetValue() * 255) / 100); } else { - nRetval = (sal_uInt8)((rSet.Get(XATTR_LINETRANSPARENCE).GetValue() * 255) / 100); + nRetval = static_cast<sal_uInt8>((rSet.Get(XATTR_LINETRANSPARENCE).GetValue() * 255) / 100); } return nRetval; @@ -113,7 +113,7 @@ namespace return drawinglayer::attribute::LineAttribute( aColorAttribute, - (double)nLineWidth, + static_cast<double>(nLineWidth), impGetB2DLineJoin(eLineJoint), eLineCap); } @@ -131,7 +131,7 @@ namespace if(rDash.GetDots() || rDash.GetDashes()) { const sal_uInt32 nLineWidth = rSet.Get(XATTR_LINEWIDTH).GetValue(); - fFullDotDashLen = rDash.CreateDotDashArray(aDotDashArray, (double)nLineWidth); + fFullDotDashLen = rDash.CreateDotDashArray(aDotDashArray, static_cast<double>(nLineWidth)); } } diff --git a/svx/source/sdr/contact/viewcontactofe3dextrude.cxx b/svx/source/sdr/contact/viewcontactofe3dextrude.cxx index 71b973bdb7f9..fa2d7645991c 100644 --- a/svx/source/sdr/contact/viewcontactofe3dextrude.cxx +++ b/svx/source/sdr/contact/viewcontactofe3dextrude.cxx @@ -60,9 +60,9 @@ namespace sdr const basegfx::B2DVector aTextureSize(aRange.getWidth(), aRange.getHeight()); // get more data - const double fDepth((double)GetE3dExtrudeObj().GetExtrudeDepth()); - const double fDiagonal((double)GetE3dExtrudeObj().GetPercentDiagonal() / 100.0); - const double fBackScale((double)GetE3dExtrudeObj().GetPercentBackScale() / 100.0); + const double fDepth(static_cast<double>(GetE3dExtrudeObj().GetExtrudeDepth())); + const double fDiagonal(static_cast<double>(GetE3dExtrudeObj().GetPercentDiagonal()) / 100.0); + const double fBackScale(static_cast<double>(GetE3dExtrudeObj().GetPercentBackScale()) / 100.0); const bool bSmoothNormals(GetE3dExtrudeObj().GetSmoothNormals()); // Plane itself const bool bSmoothLids(GetE3dExtrudeObj().GetSmoothLids()); // Front/back const bool bCharacterMode(GetE3dExtrudeObj().GetCharacterMode()); diff --git a/svx/source/sdr/contact/viewcontactofe3dlathe.cxx b/svx/source/sdr/contact/viewcontactofe3dlathe.cxx index 695edc001e4a..d3bba8823edf 100644 --- a/svx/source/sdr/contact/viewcontactofe3dlathe.cxx +++ b/svx/source/sdr/contact/viewcontactofe3dlathe.cxx @@ -74,9 +74,9 @@ namespace sdr // get more data const sal_uInt32 nHorizontalSegments(GetE3dLatheObj().GetHorizontalSegments()); const sal_uInt32 nVerticalSegments(GetE3dLatheObj().GetVerticalSegments()); - const double fDiagonal((double)GetE3dLatheObj().GetPercentDiagonal() / 100.0); - const double fBackScale((double)GetE3dLatheObj().GetBackScale() / 100.0); - const double fRotation(((double)GetE3dLatheObj().GetEndAngle() / 1800.0) * F_PI); + const double fDiagonal(static_cast<double>(GetE3dLatheObj().GetPercentDiagonal()) / 100.0); + const double fBackScale(static_cast<double>(GetE3dLatheObj().GetBackScale()) / 100.0); + const double fRotation((static_cast<double>(GetE3dLatheObj().GetEndAngle()) / 1800.0) * F_PI); const bool bSmoothNormals(GetE3dLatheObj().GetSmoothNormals()); // Plane itself const bool bSmoothLids(GetE3dLatheObj().GetSmoothLids()); // Front/back const bool bCharacterMode(GetE3dLatheObj().GetCharacterMode()); diff --git a/svx/source/sdr/contact/viewcontactofgraphic.cxx b/svx/source/sdr/contact/viewcontactofgraphic.cxx index 79e5900f4f40..488b69beb941 100644 --- a/svx/source/sdr/contact/viewcontactofgraphic.cxx +++ b/svx/source/sdr/contact/viewcontactofgraphic.cxx @@ -306,7 +306,7 @@ namespace sdr aLocalGrafInfo.SetChannelG(rItemSet.Get(SDRATTR_GRAFGREEN).GetValue()); aLocalGrafInfo.SetChannelB(rItemSet.Get(SDRATTR_GRAFBLUE).GetValue()); aLocalGrafInfo.SetGamma(rItemSet.Get(SDRATTR_GRAFGAMMA).GetValue() * 0.01); - aLocalGrafInfo.SetTransparency((sal_uInt8)::basegfx::fround(std::min(nTrans, (sal_uInt16)100) * 2.55)); + aLocalGrafInfo.SetTransparency(static_cast<sal_uInt8>(::basegfx::fround(std::min(nTrans, sal_uInt16(100)) * 2.55))); aLocalGrafInfo.SetInvert(rItemSet.Get(SDRATTR_GRAFINVERT).GetValue()); aLocalGrafInfo.SetDrawMode(rItemSet.Get(SDRATTR_GRAFMODE).GetValue()); aLocalGrafInfo.SetCrop(rCrop.GetLeft(), rCrop.GetTop(), rCrop.GetRight(), rCrop.GetBottom()); diff --git a/svx/source/sdr/contact/viewcontactofsdrobj.cxx b/svx/source/sdr/contact/viewcontactofsdrobj.cxx index 44a29e487257..14a7efed54c6 100644 --- a/svx/source/sdr/contact/viewcontactofsdrobj.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrobj.cxx @@ -155,7 +155,7 @@ drawinglayer::primitive2d::Primitive2DContainer ViewContactOfSdrObj::createGlueP // create GluePoint primitives. ATM these are relative to the SnapRect for(sal_uInt32 a(0); a < nCount; a++) { - const SdrGluePoint& rCandidate = (*pGluePointList)[(sal_uInt16)a]; + const SdrGluePoint& rCandidate = (*pGluePointList)[static_cast<sal_uInt16>(a)]; const Point aPosition(rCandidate.GetAbsolutePos(GetSdrObject())); aGluepointVector.emplace_back(aPosition.X(), aPosition.Y()); diff --git a/svx/source/sdr/contact/viewcontactofsdrpage.cxx b/svx/source/sdr/contact/viewcontactofsdrpage.cxx index fd49657dd723..26616111848a 100644 --- a/svx/source/sdr/contact/viewcontactofsdrpage.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrpage.cxx @@ -106,8 +106,8 @@ drawinglayer::primitive2d::Primitive2DContainer ViewContactOfPageShadow::createV static bool bUseOldPageShadow(false); const SdrPage& rPage = getPage(); basegfx::B2DHomMatrix aPageMatrix; - aPageMatrix.set(0, 0, (double)rPage.GetWidth()); - aPageMatrix.set(1, 1, (double)rPage.GetHeight()); + aPageMatrix.set(0, 0, static_cast<double>(rPage.GetWidth())); + aPageMatrix.set(1, 1, static_cast<double>(rPage.GetHeight())); if(bUseOldPageShadow) { @@ -246,7 +246,7 @@ ViewObjectContact& ViewContactOfPageFill::CreateObjectSpecificViewObjectContact( drawinglayer::primitive2d::Primitive2DContainer ViewContactOfPageFill::createViewIndependentPrimitive2DSequence() const { const SdrPage& rPage = getPage(); - const basegfx::B2DRange aPageFillRange(0.0, 0.0, (double)rPage.GetWidth(), (double)rPage.GetHeight()); + const basegfx::B2DRange aPageFillRange(0.0, 0.0, static_cast<double>(rPage.GetWidth()), static_cast<double>(rPage.GetHeight())); const basegfx::B2DPolygon aPageFillPolygon(basegfx::utils::createPolygonFromRect(aPageFillRange)); // We have only the page information, not the view information. Use the @@ -282,11 +282,11 @@ drawinglayer::primitive2d::Primitive2DContainer ViewContactOfOuterPageBorder::cr { drawinglayer::primitive2d::Primitive2DContainer xRetval; const SdrPage& rPage = getPage(); - const basegfx::B2DRange aPageBorderRange(0.0, 0.0, (double)rPage.GetWidth(), (double)rPage.GetHeight()); + const basegfx::B2DRange aPageBorderRange(0.0, 0.0, static_cast<double>(rPage.GetWidth()), static_cast<double>(rPage.GetHeight())); // Changed to 0x949599 for renaissance, before svtools::FONTCOLOR was used. // Added old case as fallback for HighContrast. - basegfx::BColor aRGBBorderColor(0x94 / (double)0xff, 0x95 / (double)0xff, 0x99 / (double)0xff); + basegfx::BColor aRGBBorderColor(0x94 / double(0xff), 0x95 / double(0xff), 0x99 / double(0xff)); if(Application::GetSettings().GetStyleSettings().GetHighContrastMode()) { @@ -343,8 +343,8 @@ drawinglayer::primitive2d::Primitive2DContainer ViewContactOfInnerPageBorder::cr { const SdrPage& rPage = getPage(); const basegfx::B2DRange aPageBorderRange( - (double)rPage.GetLeftBorder(), (double)rPage.GetUpperBorder(), - (double)(rPage.GetWidth() - rPage.GetRightBorder()), (double)(rPage.GetHeight() - rPage.GetLowerBorder())); + static_cast<double>(rPage.GetLeftBorder()), static_cast<double>(rPage.GetUpperBorder()), + static_cast<double>(rPage.GetWidth() - rPage.GetRightBorder()), static_cast<double>(rPage.GetHeight() - rPage.GetLowerBorder())); const basegfx::B2DPolygon aPageBorderPolygon(basegfx::utils::createPolygonFromRect(aPageBorderRange)); // We have only the page information, not the view information. Use the diff --git a/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx b/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx index ccdf9c2a9940..db64344e0447 100644 --- a/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofpageobj.cxx @@ -164,7 +164,7 @@ void PagePrimitiveExtractor::InvalidatePartOfView(const basegfx::B2DRange& rRang if(pStartPage && !rRange.isEmpty()) { - const basegfx::B2DRange aPageRange(0.0, 0.0, (double)pStartPage->GetWidth(), (double)pStartPage->GetHeight()); + const basegfx::B2DRange aPageRange(0.0, 0.0, static_cast<double>(pStartPage->GetWidth()), static_cast<double>(pStartPage->GetHeight())); if(rRange.overlaps(aPageRange)) { diff --git a/svx/source/sdr/contact/viewobjectcontactofsdrmediaobj.cxx b/svx/source/sdr/contact/viewobjectcontactofsdrmediaobj.cxx index 8b6915259ada..ec1df67520cb 100644 --- a/svx/source/sdr/contact/viewobjectcontactofsdrmediaobj.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofsdrmediaobj.cxx @@ -107,8 +107,8 @@ void ViewObjectContactOfSdrMediaObj::updateMediaItem( ::avmedia::MediaItem& rIte aViewRange.transform(GetObjectContact().getViewInformation2D().getViewTransformation()); const tools::Rectangle aViewRectangle( - (sal_Int32)floor(aViewRange.getMinX()), (sal_Int32)floor(aViewRange.getMinY()), - (sal_Int32)ceil(aViewRange.getMaxX()), (sal_Int32)ceil(aViewRange.getMaxY())); + static_cast<sal_Int32>(floor(aViewRange.getMinX())), static_cast<sal_Int32>(floor(aViewRange.getMinY())), + static_cast<sal_Int32>(ceil(aViewRange.getMaxX())), static_cast<sal_Int32>(ceil(aViewRange.getMaxY()))); mpMediaWindow->setPosSize(aViewRectangle); mpMediaWindow->show(); diff --git a/svx/source/sdr/contact/viewobjectcontactofsdrpage.cxx b/svx/source/sdr/contact/viewobjectcontactofsdrpage.cxx index 1022a51f16f7..6760043bdc08 100644 --- a/svx/source/sdr/contact/viewobjectcontactofsdrpage.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofsdrpage.cxx @@ -215,7 +215,7 @@ drawinglayer::primitive2d::Primitive2DContainer ViewObjectContactOfPageFill::cre { const SdrPage& rPage = getPage(); - const basegfx::B2DRange aPageFillRange(0.0, 0.0, (double)rPage.GetWidth(), (double)rPage.GetHeight()); + const basegfx::B2DRange aPageFillRange(0.0, 0.0, static_cast<double>(rPage.GetWidth()), static_cast<double>(rPage.GetHeight())); const basegfx::B2DPolygon aPageFillPolygon(basegfx::utils::createPolygonFromRect(aPageFillRange)); Color aPageFillColor; @@ -454,10 +454,10 @@ drawinglayer::primitive2d::Primitive2DContainer ViewObjectContactOfPageGrid::cre const basegfx::BColor aRGBGridColor(aGridColor.getBColor()); basegfx::B2DHomMatrix aGridMatrix; - aGridMatrix.set(0, 0, (double)(rPage.GetWidth() - (rPage.GetRightBorder() + rPage.GetLeftBorder()))); - aGridMatrix.set(1, 1, (double)(rPage.GetHeight() - (rPage.GetLowerBorder() + rPage.GetUpperBorder()))); - aGridMatrix.set(0, 2, (double)rPage.GetLeftBorder()); - aGridMatrix.set(1, 2, (double)rPage.GetUpperBorder()); + aGridMatrix.set(0, 0, static_cast<double>(rPage.GetWidth() - (rPage.GetRightBorder() + rPage.GetLeftBorder()))); + aGridMatrix.set(1, 1, static_cast<double>(rPage.GetHeight() - (rPage.GetLowerBorder() + rPage.GetUpperBorder()))); + aGridMatrix.set(0, 2, static_cast<double>(rPage.GetLeftBorder())); + aGridMatrix.set(1, 2, static_cast<double>(rPage.GetUpperBorder())); const Size aRaw(rView.GetGridCoarse()); const Size aFine(rView.GetGridFine()); @@ -537,8 +537,8 @@ drawinglayer::primitive2d::Primitive2DContainer ViewObjectContactOfPageHelplines for(sal_uInt32 a(0); a < nCount; a++) { - const SdrHelpLine& rHelpLine = rHelpLineList[(sal_uInt16)a]; - const basegfx::B2DPoint aPosition((double)rHelpLine.GetPos().X(), (double)rHelpLine.GetPos().Y()); + const SdrHelpLine& rHelpLine = rHelpLineList[static_cast<sal_uInt16>(a)]; + const basegfx::B2DPoint aPosition(static_cast<double>(rHelpLine.GetPos().X()), static_cast<double>(rHelpLine.GetPos().Y())); const double fDiscreteDashLength(4.0); switch(rHelpLine.GetKind()) diff --git a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx index ad7415abc495..c9a3d29f0ef5 100644 --- a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx @@ -236,7 +236,7 @@ namespace sdr { namespace contact { void ControlHolder::setZoom( const ::basegfx::B2DVector& _rScale ) const { // no check whether we're valid, this is the responsibility of the caller - m_xControlView->setZoom( (float)_rScale.getX(), (float)_rScale.getY() ); + m_xControlView->setZoom( static_cast<float>(_rScale.getX()), static_cast<float>(_rScale.getY()) ); } @@ -265,8 +265,8 @@ namespace sdr { namespace contact { if ( pWindow ) { const Fraction& rZoom( pWindow->GetZoom() ); - aZoom.setX( (double)rZoom ); - aZoom.setY( (double)rZoom ); + aZoom.setX( static_cast<double>(rZoom) ); + aZoom.setY( static_cast<double>(rZoom) ); } return aZoom; } @@ -298,7 +298,7 @@ namespace sdr { namespace contact { ::basegfx::B2DPoint aBottomRight( _rLogicBoundingRect.Right(), _rLogicBoundingRect.Bottom() ); aBottomRight *= _rViewTransformation; - const tools::Rectangle aPaintRectPixel( (long)aTopLeft.getX(), (long)aTopLeft.getY(), (long)aBottomRight.getX(), (long)aBottomRight.getY() ); + const tools::Rectangle aPaintRectPixel( static_cast<long>(aTopLeft.getX()), static_cast<long>(aTopLeft.getY()), static_cast<long>(aBottomRight.getX()), static_cast<long>(aBottomRight.getY()) ); _rControl.setPosSize( aPaintRectPixel ); // determine the scale from the current view transformation, and the normalization matrix @@ -840,8 +840,8 @@ namespace sdr { namespace contact { ::basegfx::B2DHomMatrix aScaleNormalization; const MapMode& aCurrentDeviceMapMode( rPageViewDevice.GetMapMode() ); - aScaleNormalization.set( 0, 0, (double)aCurrentDeviceMapMode.GetScaleX() ); - aScaleNormalization.set( 1, 1, (double)aCurrentDeviceMapMode.GetScaleY() ); + aScaleNormalization.set( 0, 0, static_cast<double>(aCurrentDeviceMapMode.GetScaleX()) ); + aScaleNormalization.set( 1, 1, static_cast<double>(aCurrentDeviceMapMode.GetScaleY()) ); m_aZoomLevelNormalization *= aScaleNormalization; #if OSL_DEBUG_LEVEL > 0 diff --git a/svx/source/sdr/overlay/overlaymanager.cxx b/svx/source/sdr/overlay/overlaymanager.cxx index 083e7692f7cb..bde49aff6ed2 100644 --- a/svx/source/sdr/overlay/overlaymanager.cxx +++ b/svx/source/sdr/overlay/overlaymanager.cxx @@ -304,10 +304,10 @@ namespace sdr // assume AA needs one pixel more and invalidate one pixel more const double fDiscreteOne(getDiscreteOne()); const tools::Rectangle aInvalidateRectangle( - (sal_Int32)floor(rRange.getMinX() - fDiscreteOne), - (sal_Int32)floor(rRange.getMinY() - fDiscreteOne), - (sal_Int32)ceil(rRange.getMaxX() + fDiscreteOne), - (sal_Int32)ceil(rRange.getMaxY() + fDiscreteOne)); + static_cast<sal_Int32>(floor(rRange.getMinX() - fDiscreteOne)), + static_cast<sal_Int32>(floor(rRange.getMinY() - fDiscreteOne)), + static_cast<sal_Int32>(ceil(rRange.getMaxX() + fDiscreteOne)), + static_cast<sal_Int32>(ceil(rRange.getMaxY() + fDiscreteOne))); // simply invalidate static_cast<vcl::Window&>(getOutputDevice()).Invalidate(aInvalidateRectangle, InvalidateFlags::NoErase); @@ -317,8 +317,8 @@ namespace sdr // #i77674# transform to rectangle. Use floor/ceil to get all covered // discrete pixels, see #i75163# and OverlayManagerBuffered::invalidateRange const tools::Rectangle aInvalidateRectangle( - (sal_Int32)floor(rRange.getMinX()), (sal_Int32)floor(rRange.getMinY()), - (sal_Int32)ceil(rRange.getMaxX()), (sal_Int32)ceil(rRange.getMaxY())); + static_cast<sal_Int32>(floor(rRange.getMinX())), static_cast<sal_Int32>(floor(rRange.getMinY())), + static_cast<sal_Int32>(ceil(rRange.getMaxX())), static_cast<sal_Int32>(ceil(rRange.getMaxY()))); // simply invalidate static_cast<vcl::Window&>(getOutputDevice()).Invalidate(aInvalidateRectangle, InvalidateFlags::NoErase); diff --git a/svx/source/sdr/overlay/overlaymanagerbuffered.cxx b/svx/source/sdr/overlay/overlaymanagerbuffered.cxx index a2bc553580c7..ab2e8216f139 100644 --- a/svx/source/sdr/overlay/overlaymanagerbuffered.cxx +++ b/svx/source/sdr/overlay/overlaymanagerbuffered.cxx @@ -457,19 +457,19 @@ namespace sdr // assume AA needs one pixel more and invalidate one pixel more const double fDiscreteOne(getDiscreteOne()); const basegfx::B2IPoint aTopLeft( - (sal_Int32)floor(aDiscreteRange.getMinX() - fDiscreteOne), - (sal_Int32)floor(aDiscreteRange.getMinY() - fDiscreteOne)); + static_cast<sal_Int32>(floor(aDiscreteRange.getMinX() - fDiscreteOne)), + static_cast<sal_Int32>(floor(aDiscreteRange.getMinY() - fDiscreteOne))); const basegfx::B2IPoint aBottomRight( - (sal_Int32)ceil(aDiscreteRange.getMaxX() + fDiscreteOne), - (sal_Int32)ceil(aDiscreteRange.getMaxY() + fDiscreteOne)); + static_cast<sal_Int32>(ceil(aDiscreteRange.getMaxX() + fDiscreteOne)), + static_cast<sal_Int32>(ceil(aDiscreteRange.getMaxY() + fDiscreteOne))); maBufferRememberedRangePixel.expand(aTopLeft); maBufferRememberedRangePixel.expand(aBottomRight); } else { - const basegfx::B2IPoint aTopLeft((sal_Int32)floor(aDiscreteRange.getMinX()), (sal_Int32)floor(aDiscreteRange.getMinY())); - const basegfx::B2IPoint aBottomRight((sal_Int32)ceil(aDiscreteRange.getMaxX()), (sal_Int32)ceil(aDiscreteRange.getMaxY())); + const basegfx::B2IPoint aTopLeft(static_cast<sal_Int32>(floor(aDiscreteRange.getMinX())), static_cast<sal_Int32>(floor(aDiscreteRange.getMinY()))); + const basegfx::B2IPoint aBottomRight(static_cast<sal_Int32>(ceil(aDiscreteRange.getMaxX())), static_cast<sal_Int32>(ceil(aDiscreteRange.getMaxY()))); maBufferRememberedRangePixel.expand(aTopLeft); maBufferRememberedRangePixel.expand(aBottomRight); diff --git a/svx/source/sdr/overlay/overlayobjectlist.cxx b/svx/source/sdr/overlay/overlayobjectlist.cxx index 813a01205b90..706bc692c6e6 100644 --- a/svx/source/sdr/overlay/overlayobjectlist.cxx +++ b/svx/source/sdr/overlay/overlayobjectlist.cxx @@ -126,7 +126,7 @@ namespace sdr const basegfx::B2DPoint aPosition(aPosLogic.X(), aPosLogic.Y()); const Size aSizeLogic(pManager->getOutputDevice().PixelToLogic(Size(nDiscreteTolerance, nDiscreteTolerance))); - return isHitLogic(aPosition, (double)aSizeLogic.Width()); + return isHitLogic(aPosition, static_cast<double>(aSizeLogic.Width())); } } diff --git a/svx/source/sdr/primitive2d/sdrattributecreator.cxx b/svx/source/sdr/primitive2d/sdrattributecreator.cxx index 41988f65d70f..60e130c8b949 100644 --- a/svx/source/sdr/primitive2d/sdrattributecreator.cxx +++ b/svx/source/sdr/primitive2d/sdrattributecreator.cxx @@ -247,14 +247,14 @@ namespace drawinglayer if(rDash.GetDots() || rDash.GetDashes()) { - fFullDotDashLen = rDash.CreateDotDashArray(aDotDashArray, (double)nWidth); + fFullDotDashLen = rDash.CreateDotDashArray(aDotDashArray, static_cast<double>(nWidth)); } } return attribute::SdrLineAttribute( LineJointToB2DLineJoin(eJoint), - (double)nWidth, - (double)nTransparence * 0.01, + static_cast<double>(nWidth), + static_cast<double>(nTransparence) * 0.01, aColor.getBColor(), eCap, aDotDashArray, @@ -284,11 +284,11 @@ namespace drawinglayer { if(nTempStartWidth < 0) { - fStartWidth = ((double)(-nTempStartWidth) * fWidth) * 0.01; + fStartWidth = (static_cast<double>(-nTempStartWidth) * fWidth) * 0.01; } else { - fStartWidth = (double)nTempStartWidth; + fStartWidth = static_cast<double>(nTempStartWidth); } if(0.0 != fStartWidth) @@ -307,11 +307,11 @@ namespace drawinglayer { if(nTempEndWidth < 0) { - fEndWidth = ((double)(-nTempEndWidth) * fWidth) * 0.01; + fEndWidth = (static_cast<double>(-nTempEndWidth) * fWidth) * 0.01; } else { - fEndWidth = (double)nTempEndWidth; + fEndWidth = static_cast<double>(nTempEndWidth); } if(0.0 != fEndWidth) @@ -371,11 +371,11 @@ namespace drawinglayer if(100 != nTransparence) { const basegfx::B2DVector aOffset( - (double)rSet.Get(SDRATTR_SHADOWXDIST).GetValue(), - (double)rSet.Get(SDRATTR_SHADOWYDIST).GetValue()); + static_cast<double>(rSet.Get(SDRATTR_SHADOWXDIST).GetValue()), + static_cast<double>(rSet.Get(SDRATTR_SHADOWYDIST).GetValue())); const Color aColor(rSet.Get(SDRATTR_SHADOWCOLOR).GetColorValue()); - return attribute::SdrShadowAttribute(aOffset, (double)nTransparence * 0.01, aColor.getBColor()); + return attribute::SdrShadowAttribute(aOffset, static_cast<double>(nTransparence) * 0.01, aColor.getBColor()); } } @@ -440,7 +440,7 @@ namespace drawinglayer if(nStartIntens != 100) { const basegfx::BColor aBlack; - aStart = interpolate(aBlack, aStart, (double)nStartIntens * 0.01); + aStart = interpolate(aBlack, aStart, static_cast<double>(nStartIntens) * 0.01); } const Color aEndColor(aXGradient.GetEndColor()); @@ -450,15 +450,15 @@ namespace drawinglayer if(nEndIntens != 100) { const basegfx::BColor aBlack; - aEnd = interpolate(aBlack, aEnd, (double)nEndIntens * 0.01); + aEnd = interpolate(aBlack, aEnd, static_cast<double>(nEndIntens) * 0.01); } aGradient = attribute::FillGradientAttribute( XGradientStyleToGradientStyle(aXGradient.GetGradientStyle()), - (double)aXGradient.GetBorder() * 0.01, - (double)aXGradient.GetXOffset() * 0.01, - (double)aXGradient.GetYOffset() * 0.01, - (double)aXGradient.GetAngle() * F_PI1800, + static_cast<double>(aXGradient.GetBorder()) * 0.01, + static_cast<double>(aXGradient.GetXOffset()) * 0.01, + static_cast<double>(aXGradient.GetYOffset()) * 0.01, + static_cast<double>(aXGradient.GetAngle()) * F_PI1800, aStart, aEnd, rSet.Get(XATTR_GRADIENTSTEPCOUNT).GetValue()); @@ -472,8 +472,8 @@ namespace drawinglayer aHatch = attribute::FillHatchAttribute( XHatchStyleToHatchStyle(rHatch.GetHatchStyle()), - (double)rHatch.GetDistance(), - (double)rHatch.GetAngle() * F_PI1800, + static_cast<double>(rHatch.GetDistance()), + static_cast<double>(rHatch.GetAngle()) * F_PI1800, aColorB.getBColor(), 3, // same default as VCL, a minimum of three discrete units (pixels) offset rSet.Get(XATTR_FILLBACKGROUND).GetValue()); @@ -488,7 +488,7 @@ namespace drawinglayer } return attribute::SdrFillAttribute( - (double)nTransparence * 0.01, + static_cast<double>(nTransparence) * 0.01, aColor.getBColor(), aGradient, aHatch, @@ -617,10 +617,10 @@ namespace drawinglayer return attribute::FillGradientAttribute( XGradientStyleToGradientStyle(rGradient.GetGradientStyle()), - (double)rGradient.GetBorder() * 0.01, - (double)rGradient.GetXOffset() * 0.01, - (double)rGradient.GetYOffset() * 0.01, - (double)rGradient.GetAngle() * F_PI1800, + static_cast<double>(rGradient.GetBorder()) * 0.01, + static_cast<double>(rGradient.GetXOffset()) * 0.01, + static_cast<double>(rGradient.GetYOffset()) * 0.01, + static_cast<double>(rGradient.GetAngle()) * F_PI1800, basegfx::BColor(fStartLum, fStartLum, fStartLum), basegfx::BColor(fEndLum, fEndLum, fEndLum), 0); @@ -691,14 +691,14 @@ namespace drawinglayer // get size const basegfx::B2DVector aSize( - (double) rSet.Get(XATTR_FILLBMP_SIZEX).GetValue(), - (double) rSet.Get(XATTR_FILLBMP_SIZEY).GetValue()); + static_cast<double>(rSet.Get(XATTR_FILLBMP_SIZEX).GetValue()), + static_cast<double>(rSet.Get(XATTR_FILLBMP_SIZEY).GetValue())); const basegfx::B2DVector aOffset( - (double) rSet.Get(XATTR_FILLBMP_TILEOFFSETX).GetValue(), - (double) rSet.Get(XATTR_FILLBMP_TILEOFFSETY).GetValue()); + static_cast<double>(rSet.Get(XATTR_FILLBMP_TILEOFFSETX).GetValue()), + static_cast<double>(rSet.Get(XATTR_FILLBMP_TILEOFFSETY).GetValue())); const basegfx::B2DVector aOffsetPosition( - (double) rSet.Get(XATTR_FILLBMP_POSOFFSETX).GetValue(), - (double) rSet.Get(XATTR_FILLBMP_POSOFFSETY).GetValue()); + static_cast<double>(rSet.Get(XATTR_FILLBMP_POSOFFSETX).GetValue()), + static_cast<double>(rSet.Get(XATTR_FILLBMP_POSOFFSETY).GetValue())); return attribute::SdrFillGraphicAttribute( aGraphic, @@ -992,7 +992,7 @@ namespace drawinglayer void calculateRelativeCornerRadius(sal_Int32 nRadius, const basegfx::B2DRange& rObjectRange, double& rfCornerRadiusX, double& rfCornerRadiusY) { - rfCornerRadiusX = rfCornerRadiusY = (double)nRadius; + rfCornerRadiusX = rfCornerRadiusY = static_cast<double>(nRadius); if(0.0 != rfCornerRadiusX) { diff --git a/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx b/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx index 943775beed68..176eb95e6d86 100644 --- a/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx +++ b/svx/source/sdr/primitive2d/sdrtextprimitive2d.cxx @@ -74,7 +74,7 @@ namespace else { const sal_uInt16 nPageCount(pPage->GetModel()->GetPageCount()); - nRetval = ((sal_Int16)nPageCount - 1) / 2; + nRetval = (static_cast<sal_Int16>(nPageCount) - 1) / 2; } } diff --git a/svx/source/sdr/properties/e3dsceneproperties.cxx b/svx/source/sdr/properties/e3dsceneproperties.cxx index 2639a96d9e7a..1b3bdbf486b6 100644 --- a/svx/source/sdr/properties/e3dsceneproperties.cxx +++ b/svx/source/sdr/properties/e3dsceneproperties.cxx @@ -304,10 +304,10 @@ namespace sdr mpItemSet->Put(Svx3DPerspectiveItem(aSceneCam.GetProjection())); // CamPos - mpItemSet->Put(makeSvx3DDistanceItem((sal_uInt32)(aSceneCam.GetPosition().getZ() + 0.5))); + mpItemSet->Put(makeSvx3DDistanceItem(static_cast<sal_uInt32>(aSceneCam.GetPosition().getZ() + 0.5))); // FocalLength - mpItemSet->Put(makeSvx3DFocalLengthItem((sal_uInt32)((aSceneCam.GetFocalLength() * 100.0) + 0.5))); + mpItemSet->Put(makeSvx3DFocalLengthItem(static_cast<sal_uInt32>((aSceneCam.GetFocalLength() * 100.0) + 0.5))); } } // end of namespace properties } // end of namespace sdr diff --git a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx index 9e74d3315f07..56a1d67ceeb5 100644 --- a/svx/source/sidebar/area/AreaPropertyPanelBase.cxx +++ b/svx/source/sidebar/area/AreaPropertyPanelBase.cxx @@ -437,7 +437,7 @@ IMPL_LINK_NOARG(AreaPropertyPanelBase, SelectFillTypeHdl, ListBox&, void) } } - meLastXFS = (sal_uInt16)nPos; + meLastXFS = static_cast<sal_uInt16>(nPos); if(eFillStyle::NONE != (eFillStyle)nPos) { @@ -1229,7 +1229,7 @@ void AreaPropertyPanelBase::Update() if(pSh && pSh->GetItem(SID_BITMAP_LIST) && eXFS == BITMAP) { mpBmpImport->Show(); - mpLbFillType->SelectEntryPos((sal_uInt32)BITMAP); + mpLbFillType->SelectEntryPos(sal_uInt32(BITMAP)); const SvxBitmapListItem aItem(*static_cast<const SvxBitmapListItem*>(pSh->GetItem(SID_BITMAP_LIST))); mpLbFillAttr->Fill(aItem.GetBitmapList()); @@ -1239,7 +1239,7 @@ void AreaPropertyPanelBase::Update() else if(pSh && pSh->GetItem(SID_PATTERN_LIST) && eXFS == PATTERN) { mpBmpImport->Hide(); - mpLbFillType->SelectEntryPos((sal_uInt32)PATTERN); + mpLbFillType->SelectEntryPos(sal_uInt32(PATTERN)); const SvxPatternListItem aItem(*static_cast<const SvxPatternListItem*>(pSh->GetItem(SID_PATTERN_LIST))); mpLbFillAttr->Fill(aItem.GetPatternList()); @@ -1374,7 +1374,7 @@ IMPL_LINK_NOARG(AreaPropertyPanelBase, ChangeTrgrTypeHdl_Impl, ListBox&, void) IMPL_LINK_NOARG(AreaPropertyPanelBase, ModifyTransparentHdl_Impl, Edit&, void) { - const sal_uInt16 nTrans = (sal_uInt16)mpMTRTransparent->GetValue(); + const sal_uInt16 nTrans = static_cast<sal_uInt16>(mpMTRTransparent->GetValue()); mnLastTransSolid = nTrans; SetTransparency(nTrans); const sal_Int32 nSelectType = mpLBTransType->GetSelectedEntryPos(); diff --git a/svx/source/sidebar/area/AreaTransparencyGradientPopup.cxx b/svx/source/sidebar/area/AreaTransparencyGradientPopup.cxx index b358160d4760..eef6cca757f6 100644 --- a/svx/source/sidebar/area/AreaTransparencyGradientPopup.cxx +++ b/svx/source/sidebar/area/AreaTransparencyGradientPopup.cxx @@ -65,9 +65,9 @@ void AreaTransparencyGradientPopup::InitStatus(XFillFloatTransparenceItem const if (rGradient.GetXOffset() == AreaPropertyPanelBase::DEFAULT_CENTERX && rGradient.GetYOffset() == AreaPropertyPanelBase::DEFAULT_CENTERY && (rGradient.GetAngle() / 10) == AreaPropertyPanelBase::DEFAULT_ANGLE - && ((sal_uInt16)((((sal_uInt16)rGradient.GetStartColor().GetRed() + 1) * 100) / 255)) + && static_cast<sal_uInt16>(((static_cast<sal_uInt16>(rGradient.GetStartColor().GetRed()) + 1) * 100) / 255) == AreaPropertyPanelBase::DEFAULT_STARTVALUE - && ((sal_uInt16)((((sal_uInt16)rGradient.GetEndColor().GetRed() + 1) * 100) / 255)) + && static_cast<sal_uInt16>(((static_cast<sal_uInt16>(rGradient.GetEndColor().GetRed()) + 1) * 100) / 255) == AreaPropertyPanelBase::DEFAULT_ENDVALUE && rGradient.GetBorder() == AreaPropertyPanelBase::DEFAULT_BORDER) { @@ -80,8 +80,8 @@ void AreaTransparencyGradientPopup::InitStatus(XFillFloatTransparenceItem const maMtrTrgrCenterX->SetValue(aGradient.GetXOffset()); maMtrTrgrCenterY->SetValue(aGradient.GetYOffset()); maMtrTrgrAngle->SetValue(aGradient.GetAngle() / 10); - maMtrTrgrStartValue->SetValue((sal_uInt16)((((sal_uInt16)aGradient.GetStartColor().GetRed() + 1) * 100) / 255)); - maMtrTrgrEndValue->SetValue((sal_uInt16)((((sal_uInt16)aGradient.GetEndColor().GetRed() + 1) * 100) / 255)); + maMtrTrgrStartValue->SetValue(static_cast<sal_uInt16>(((static_cast<sal_uInt16>(aGradient.GetStartColor().GetRed()) + 1) * 100) / 255)); + maMtrTrgrEndValue->SetValue(static_cast<sal_uInt16>(((static_cast<sal_uInt16>(aGradient.GetEndColor().GetRed()) + 1) * 100) / 255)); maMtrTrgrBorder->SetValue(aGradient.GetBorder()); } @@ -116,7 +116,7 @@ void AreaTransparencyGradientPopup::Rearrange(XFillFloatTransparenceItem const * void AreaTransparencyGradientPopup::ExecuteValueModify(sal_uInt8 nStartCol, sal_uInt8 nEndCol) { //Added - sal_Int16 aMtrValue = (sal_Int16)maMtrTrgrAngle->GetValue(); + sal_Int16 aMtrValue = static_cast<sal_Int16>(maMtrTrgrAngle->GetValue()); while(aMtrValue<0) aMtrValue += 360; sal_uInt16 nVal = aMtrValue/360; @@ -127,10 +127,10 @@ void AreaTransparencyGradientPopup::ExecuteValueModify(sal_uInt8 nStartCol, sal_ Color(nStartCol, nStartCol, nStartCol), Color(nEndCol, nEndCol, nEndCol), (css::awt::GradientStyle)(mrAreaPropertyPanel.GetSelectedTransparencyTypeIndex()-2), - (sal_uInt16)maMtrTrgrAngle->GetValue() * 10, - (sal_uInt16)maMtrTrgrCenterX->GetValue(), - (sal_uInt16)maMtrTrgrCenterY->GetValue(), - (sal_uInt16)maMtrTrgrBorder->GetValue(), + static_cast<sal_uInt16>(maMtrTrgrAngle->GetValue()) * 10, + static_cast<sal_uInt16>(maMtrTrgrCenterX->GetValue()), + static_cast<sal_uInt16>(maMtrTrgrCenterY->GetValue()), + static_cast<sal_uInt16>(maMtrTrgrBorder->GetValue()), 100, 100); mrAreaPropertyPanel.SetGradient(aTmpGradient); @@ -142,16 +142,16 @@ void AreaTransparencyGradientPopup::ExecuteValueModify(sal_uInt8 nStartCol, sal_ IMPL_LINK_NOARG(AreaTransparencyGradientPopup, ModifiedTrgrHdl_Impl, Edit&, void) { - sal_uInt8 nStartCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrStartValue->GetValue() * 255) / 100); - sal_uInt8 nEndCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrEndValue->GetValue() * 255) / 100); + sal_uInt8 nStartCol = static_cast<sal_uInt8>((static_cast<sal_uInt16>(maMtrTrgrStartValue->GetValue()) * 255) / 100); + sal_uInt8 nEndCol = static_cast<sal_uInt8>((static_cast<sal_uInt16>(maMtrTrgrEndValue->GetValue()) * 255) / 100); ExecuteValueModify( nStartCol, nEndCol ); } IMPL_LINK_NOARG(AreaTransparencyGradientPopup, Left_Click45_Impl, ToolBox *, void) { - sal_uInt8 nStartCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrStartValue->GetValue() * 255) / 100); - sal_uInt8 nEndCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrEndValue->GetValue() * 255) / 100); - sal_uInt16 nTemp = (sal_uInt16)maMtrTrgrAngle->GetValue(); + sal_uInt8 nStartCol = static_cast<sal_uInt8>((static_cast<sal_uInt16>(maMtrTrgrStartValue->GetValue()) * 255) / 100); + sal_uInt8 nEndCol = static_cast<sal_uInt8>((static_cast<sal_uInt16>(maMtrTrgrEndValue->GetValue()) * 255) / 100); + sal_uInt16 nTemp = static_cast<sal_uInt16>(maMtrTrgrAngle->GetValue()); if (nTemp>=315) nTemp -= 360; nTemp += 45; @@ -161,9 +161,9 @@ IMPL_LINK_NOARG(AreaTransparencyGradientPopup, Left_Click45_Impl, ToolBox *, voi IMPL_LINK_NOARG(AreaTransparencyGradientPopup, Right_Click45_Impl, ToolBox *, void) { - sal_uInt8 nStartCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrStartValue->GetValue() * 255) / 100); - sal_uInt8 nEndCol = (sal_uInt8)(((sal_uInt16)maMtrTrgrEndValue->GetValue() * 255) / 100); - sal_uInt16 nTemp = (sal_uInt16)maMtrTrgrAngle->GetValue(); + sal_uInt8 nStartCol = static_cast<sal_uInt8>((static_cast<sal_uInt16>(maMtrTrgrStartValue->GetValue()) * 255) / 100); + sal_uInt8 nEndCol = static_cast<sal_uInt8>((static_cast<sal_uInt16>(maMtrTrgrEndValue->GetValue()) * 255) / 100); + sal_uInt16 nTemp = static_cast<sal_uInt16>(maMtrTrgrAngle->GetValue()); if (nTemp<45) nTemp += 360; nTemp -= 45; diff --git a/svx/source/sidebar/line/LinePropertyPanelBase.cxx b/svx/source/sidebar/line/LinePropertyPanelBase.cxx index 6e98dcc87885..715c51696733 100644 --- a/svx/source/sidebar/line/LinePropertyPanelBase.cxx +++ b/svx/source/sidebar/line/LinePropertyPanelBase.cxx @@ -559,7 +559,7 @@ IMPL_LINK_NOARG(LinePropertyPanelBase, ChangeLineStyleHdl, ListBox&, void) setLineStyle(aItem); } - else if (mxLineStyleList.is() && mxLineStyleList->Count() > (long)(nPos - 2)) + else if (mxLineStyleList.is() && mxLineStyleList->Count() > static_cast<long>(nPos - 2)) { // drawing::LineStyle_DASH const XLineStyleItem aItemA(drawing::LineStyle_DASH); @@ -585,7 +585,7 @@ IMPL_LINK_NOARG(LinePropertyPanelBase, ChangeStartHdl, ListBox&, void) std::unique_ptr<XLineStartItem> pItem; if( nPos == 0 ) pItem.reset(new XLineStartItem()); - else if( mxLineEndList.is() && mxLineEndList->Count() > (long) ( nPos - 1 ) ) + else if( mxLineEndList.is() && mxLineEndList->Count() > static_cast<long>( nPos - 1 ) ) pItem.reset(new XLineStartItem( mpLBStart->GetSelectedEntry(),mxLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() )); setLineStartStyle(pItem.get()); } @@ -599,7 +599,7 @@ IMPL_LINK_NOARG(LinePropertyPanelBase, ChangeEndHdl, ListBox&, void) std::unique_ptr<XLineEndItem> pItem; if( nPos == 0 ) pItem.reset(new XLineEndItem()); - else if( mxLineEndList.is() && mxLineEndList->Count() > (long) ( nPos - 1 ) ) + else if( mxLineEndList.is() && mxLineEndList->Count() > static_cast<long>( nPos - 1 ) ) pItem.reset(new XLineEndItem( mpLBEnd->GetSelectedEntry(), mxLineEndList->GetLineEnd( nPos - 1 )->GetLineEnd() )); setLineEndStyle(pItem.get()); } @@ -683,7 +683,7 @@ IMPL_LINK(LinePropertyPanelBase, ToolboxWidthSelectHdl,ToolBox*, pToolBox, void) IMPL_LINK_NOARG( LinePropertyPanelBase, ChangeTransparentHdl, Edit&, void ) { - sal_uInt16 nVal = (sal_uInt16)mpMFTransparent->GetValue(); + sal_uInt16 nVal = static_cast<sal_uInt16>(mpMFTransparent->GetValue()); XLineTransparenceItem aItem( nVal ); setLineTransparency(aItem); diff --git a/svx/source/sidebar/line/LineWidthPopup.cxx b/svx/source/sidebar/line/LineWidthPopup.cxx index bb9df56b2afa..72516cdc59d7 100644 --- a/svx/source/sidebar/line/LineWidthPopup.cxx +++ b/svx/source/sidebar/line/LineWidthPopup.cxx @@ -161,7 +161,7 @@ IMPL_LINK(LineWidthPopup, MFModifyHdl, Edit&, /*rControl*/, void) } long nTmp = static_cast<long>(m_xMFWidth->GetValue()); long nVal = LogicToLogic( nTmp, MapUnit::MapPoint, m_eMapUnit ); - sal_Int32 nNewWidth = (short)m_xMFWidth->Denormalize( nVal ); + sal_Int32 nNewWidth = static_cast<short>(m_xMFWidth->Denormalize( nVal )); XLineWidthItem aWidthItem(nNewWidth); m_rParent.setLineWidth(aWidthItem); } @@ -185,7 +185,7 @@ void LineWidthPopup::SetWidthSelect(long lValue, bool bValuable, MapUnit eMapUni m_xVSWidth->SetImage(m_aIMGCus); m_xVSWidth->SetCusEnable(true); - OUString aStrTip( OUString::number( (double)m_nCustomWidth / 10)); + OUString aStrTip( OUString::number( static_cast<double>(m_nCustomWidth) / 10)); aStrTip += m_sPt; m_xVSWidth->SetItemText(9, aStrTip); } diff --git a/svx/source/sidebar/nbdtmg.cxx b/svx/source/sidebar/nbdtmg.cxx index 540e65387d7d..3a4f7d62d9c2 100644 --- a/svx/source/sidebar/nbdtmg.cxx +++ b/svx/source/sidebar/nbdtmg.cxx @@ -127,7 +127,7 @@ NumSettings_Impl* lcl_CreateNumberingSettingsPtr(const Sequence<PropertyValue>& sal_uInt16 NBOTypeMgrBase:: IsSingleLevel(sal_uInt16 nCurLevel) { - sal_uInt16 nLv = (sal_uInt16)0xFFFF; + sal_uInt16 nLv = sal_uInt16(0xFFFF); sal_uInt16 nCount = 0; sal_uInt16 nMask = 1; for( sal_uInt16 i = 0; i < SVX_MAX_NUM; i++ ) @@ -143,7 +143,7 @@ sal_uInt16 NBOTypeMgrBase:: IsSingleLevel(sal_uInt16 nCurLevel) if ( nCount == 1) return nLv; else - return (sal_uInt16)0xFFFF; + return sal_uInt16(0xFFFF); } void NBOTypeMgrBase::SetItems(const SfxItemSet* pArg) { @@ -276,14 +276,14 @@ void BulletsTypeMgr::Init() } sal_uInt16 BulletsTypeMgr::GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLevel,sal_uInt16 nFromIndex) { - if ( mLevel == (sal_uInt16)0xFFFF || mLevel == 0) - return (sal_uInt16)0xFFFF; + if ( mLevel == sal_uInt16(0xFFFF) || mLevel == 0) + return sal_uInt16(0xFFFF); //if ( !lcl_IsNumFmtSet(pNR, mLevel) ) return (sal_uInt16)0xFFFF; sal_uInt16 nActLv = IsSingleLevel(mLevel); - if ( nActLv == (sal_uInt16)0xFFFF ) - return (sal_uInt16)0xFFFF; + if ( nActLv == sal_uInt16(0xFFFF) ) + return sal_uInt16(0xFFFF); SvxNumberFormat aFmt(aNum.GetLevel(nActLv)); sal_Unicode cChar = aFmt.GetBulletChar(); @@ -297,20 +297,20 @@ sal_uInt16 BulletsTypeMgr::GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLe } } - return (sal_uInt16)0xFFFF; + return sal_uInt16(0xFFFF); } void BulletsTypeMgr::RelplaceNumRule(SvxNumRule& aNum, sal_uInt16 nIndex, sal_uInt16 mLevel) { - if ( mLevel == (sal_uInt16)0xFFFF || mLevel == 0) + if ( mLevel == sal_uInt16(0xFFFF) || mLevel == 0) return; - if ( GetNBOIndexForNumRule(aNum,mLevel) != (sal_uInt16)0xFFFF ) + if ( GetNBOIndexForNumRule(aNum,mLevel) != sal_uInt16(0xFFFF) ) return; sal_uInt16 nActLv = IsSingleLevel(mLevel); - if ( nActLv == (sal_uInt16)0xFFFF ) + if ( nActLv == sal_uInt16(0xFFFF) ) return; SvxNumberFormat aFmt(aNum.GetLevel(nActLv)); @@ -439,13 +439,13 @@ void NumberingTypeMgr::Init() sal_uInt16 NumberingTypeMgr::GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 mLevel,sal_uInt16 nFromIndex) { - if ( mLevel == (sal_uInt16)0xFFFF || mLevel > aNum.GetLevelCount() || mLevel == 0) - return (sal_uInt16)0xFFFF; + if ( mLevel == sal_uInt16(0xFFFF) || mLevel > aNum.GetLevelCount() || mLevel == 0) + return sal_uInt16(0xFFFF); sal_uInt16 nActLv = IsSingleLevel(mLevel); - if ( nActLv == (sal_uInt16)0xFFFF ) - return (sal_uInt16)0xFFFF; + if ( nActLv == sal_uInt16(0xFFFF) ) + return sal_uInt16(0xFFFF); SvxNumberFormat aFmt(aNum.GetLevel(nActLv)); //sal_Unicode cPrefix = rtl::OUString(aFmt.GetPrefix())[0]; @@ -470,14 +470,14 @@ sal_uInt16 NumberingTypeMgr::GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 m } - return (sal_uInt16)0xFFFF; + return sal_uInt16(0xFFFF); } void NumberingTypeMgr::RelplaceNumRule(SvxNumRule& aNum, sal_uInt16 nIndex, sal_uInt16 mLevel) { sal_uInt16 nActLv = IsSingleLevel(mLevel); - if ( nActLv == (sal_uInt16)0xFFFF ) + if ( nActLv == sal_uInt16(0xFFFF) ) return; SvxNumberFormat aFmt(aNum.GetLevel(nActLv)); @@ -700,7 +700,7 @@ sal_uInt16 OutlineTypeMgr::GetNBOIndexForNumRule(SvxNumRule& aNum,sal_uInt16 /*m } - return (sal_uInt16)0xFFFF; + return sal_uInt16(0xFFFF); } void OutlineTypeMgr::RelplaceNumRule(SvxNumRule& aNum, sal_uInt16 nIndex, sal_uInt16 mLevel) @@ -789,7 +789,7 @@ void OutlineTypeMgr::ApplyNumRule(SvxNumRule& aNum, sal_uInt16 nIndex, sal_uInt1 const vcl::Font& rActBulletFont = lcl_GetDefaultBulletFont(); if (pLevelSettings->nNumberType !=aFmt.GetNumberingType()) isResetSize=true; aFmt.SetNumberingType( pLevelSettings->nNumberType ); - sal_uInt16 nUpperLevelOrChar = (sal_uInt16)pLevelSettings->nParentNumbering; + sal_uInt16 nUpperLevelOrChar = static_cast<sal_uInt16>(pLevelSettings->nParentNumbering); if(aFmt.GetNumberingType() == SVX_NUM_CHAR_SPECIAL) { if( pLevelSettings->sBulletFont.getLength() && diff --git a/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx b/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx index b5e54801dde7..7b05cde25876 100644 --- a/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx +++ b/svx/source/sidebar/paragraph/ParaLineSpacingControl.cxx @@ -352,7 +352,7 @@ void ParaLineSpacingControl::ExecuteLineSpace() break; case LLINESPACE_PROP: - SetLineSpace(aSpacing, nPos, mpLineDistAtPercentBox->Denormalize((long)mpLineDistAtPercentBox->GetValue())); + SetLineSpace(aSpacing, nPos, mpLineDistAtPercentBox->Denormalize(static_cast<long>(mpLineDistAtPercentBox->GetValue()))); break; case LLINESPACE_MIN: @@ -395,21 +395,21 @@ void ParaLineSpacingControl::SetLineSpace(SvxLineSpacingItem& rLineSpace, sal_In case LLINESPACE_PROP: rLineSpace.SetLineSpaceRule( SvxLineSpaceRule::Auto ); - rLineSpace.SetPropLineSpace( (sal_uInt8)lValue ); + rLineSpace.SetPropLineSpace( static_cast<sal_uInt8>(lValue) ); break; case LLINESPACE_MIN: - rLineSpace.SetLineHeight( (sal_uInt16)lValue ); + rLineSpace.SetLineHeight( static_cast<sal_uInt16>(lValue) ); rLineSpace.SetInterLineSpaceRule( SvxInterLineSpaceRule::Off ); break; case LLINESPACE_DURCH: rLineSpace.SetLineSpaceRule( SvxLineSpaceRule::Auto ); - rLineSpace.SetInterLineSpace( (sal_uInt16)lValue ); + rLineSpace.SetInterLineSpace( static_cast<sal_uInt16>(lValue) ); break; case LLINESPACE_FIX: - rLineSpace.SetLineHeight((sal_uInt16)lValue); + rLineSpace.SetLineHeight(static_cast<sal_uInt16>(lValue)); rLineSpace.SetLineSpaceRule( SvxLineSpaceRule::Fix ); rLineSpace.SetInterLineSpaceRule( SvxInterLineSpaceRule::Off ); break; diff --git a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx index 3fceef172b1e..1222396830c5 100644 --- a/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx +++ b/svx/source/sidebar/paragraph/ParaPropertyPanel.cxx @@ -172,7 +172,7 @@ IMPL_LINK_NOARG( ParaPropertyPanel, ModifyIndentHdl_Impl, Edit&, void) SvxLRSpaceItem aMargin( SID_ATTR_PARA_LRSPACE ); aMargin.SetTextLeft( GetCoreValue( *mpLeftIndent, m_eLRSpaceUnit ) ); aMargin.SetRight( GetCoreValue( *mpRightIndent, m_eLRSpaceUnit ) ); - aMargin.SetTextFirstLineOfst( (short)GetCoreValue( *mpFLineIndent, m_eLRSpaceUnit ) ); + aMargin.SetTextFirstLineOfst( static_cast<short>(GetCoreValue( *mpFLineIndent, m_eLRSpaceUnit )) ); GetBindings()->GetDispatcher()->ExecuteList( SID_ATTR_PARA_LRSPACE, SfxCallMode::RECORD, { &aMargin }); @@ -183,8 +183,8 @@ IMPL_LINK_NOARG( ParaPropertyPanel, ModifyIndentHdl_Impl, Edit&, void) IMPL_LINK_NOARG( ParaPropertyPanel, ULSpaceHdl_Impl, Edit&, void) { SvxULSpaceItem aMargin( SID_ATTR_PARA_ULSPACE ); - aMargin.SetUpper( (sal_uInt16)GetCoreValue( *mpTopDist, m_eULSpaceUnit ) ); - aMargin.SetLower( (sal_uInt16)GetCoreValue( *mpBottomDist, m_eULSpaceUnit ) ); + aMargin.SetUpper( static_cast<sal_uInt16>(GetCoreValue( *mpTopDist, m_eULSpaceUnit )) ); + aMargin.SetLower( static_cast<sal_uInt16>(GetCoreValue( *mpBottomDist, m_eULSpaceUnit )) ); GetBindings()->GetDispatcher()->ExecuteList( SID_ATTR_PARA_ULSPACE, SfxCallMode::RECORD, { &aMargin }); @@ -270,7 +270,7 @@ void ParaPropertyPanel::StateChangedIndentImpl( SfxItemState eState, const SfxPo aTxtFirstLineOfst = OutputDevice::LogicToLogic( aTxtFirstLineOfst, MapUnit::Map100thMM, MapUnit::MapTwip ); long nVal = OutputDevice::LogicToLogic( maTxtLeft, MapUnit::MapTwip, MapUnit::Map100thMM ); - nVal = (long)mpLeftIndent->Normalize( nVal ); + nVal = static_cast<long>(mpLeftIndent->Normalize( nVal )); if ( maContext.GetCombinedContext_DI() != CombinedEnumContext(Application::WriterVariants, Context::Text) && maContext.GetCombinedContext_DI() != CombinedEnumContext(Application::WriterVariants, Context::Default) @@ -280,7 +280,7 @@ void ParaPropertyPanel::StateChangedIndentImpl( SfxItemState eState, const SfxPo } long nrVal = OutputDevice::LogicToLogic( aTxtRight, MapUnit::MapTwip, MapUnit::Map100thMM ); - nrVal = (long)mpRightIndent->Normalize( nrVal ); + nrVal = static_cast<long>(mpRightIndent->Normalize( nrVal )); switch (maContext.GetCombinedContext_DI()) { @@ -311,7 +311,7 @@ void ParaPropertyPanel::StateChangedIndentImpl( SfxItemState eState, const SfxPo mpRightIndent->SetValue( nrVal, FUNIT_100TH_MM ); long nfVal = OutputDevice::LogicToLogic( aTxtFirstLineOfst, MapUnit::MapTwip, MapUnit::Map100thMM ); - nfVal = (long)mpFLineIndent->Normalize( nfVal ); + nfVal = static_cast<long>(mpFLineIndent->Normalize( nfVal )); mpFLineIndent->SetValue( nfVal, FUNIT_100TH_MM ); } else if( eState == SfxItemState::DISABLED ) diff --git a/svx/source/sidebar/paragraph/ParaSpacingWindow.cxx b/svx/source/sidebar/paragraph/ParaSpacingWindow.cxx index 4d3f2b147d17..90153f18d8a2 100644 --- a/svx/source/sidebar/paragraph/ParaSpacingWindow.cxx +++ b/svx/source/sidebar/paragraph/ParaSpacingWindow.cxx @@ -99,8 +99,8 @@ IMPL_LINK_NOARG(ParaULSpacingWindow, ModifySpacingHdl, Edit&, void) if(pDisp) { SvxULSpaceItem aMargin(SID_ATTR_PARA_ULSPACE); - aMargin.SetUpper((sal_uInt16)GetCoreValue(*m_pAboveSpacing, m_eUnit)); - aMargin.SetLower((sal_uInt16)GetCoreValue(*m_pBelowSpacing, m_eUnit)); + aMargin.SetUpper(static_cast<sal_uInt16>(GetCoreValue(*m_pAboveSpacing, m_eUnit))); + aMargin.SetLower(static_cast<sal_uInt16>(GetCoreValue(*m_pBelowSpacing, m_eUnit))); pDisp->ExecuteList(SID_ATTR_PARA_ULSPACE, SfxCallMode::RECORD, {&aMargin}); } } @@ -211,7 +211,7 @@ void ParaLRSpacingWindow::SetValue(SfxItemState eState, const SfxPoolItem* pStat long aTxtRight = pSpace->GetRight(); long aTxtFirstLineOfst = pSpace->GetTextFirstLineOfst(); - aTxtLeft = (long)m_pBeforeSpacing->Normalize(aTxtLeft); + aTxtLeft = static_cast<long>(m_pBeforeSpacing->Normalize(aTxtLeft)); if(m_aContext.GetCombinedContext_DI() != CombinedEnumContext(Application::WriterVariants, Context::Text) && m_aContext.GetCombinedContext_DI() != CombinedEnumContext(Application::WriterVariants, Context::Default) @@ -220,7 +220,7 @@ void ParaLRSpacingWindow::SetValue(SfxItemState eState, const SfxPoolItem* pStat m_pFLSpacing->SetMin(aTxtLeft*-1, FUNIT_100TH_MM); } - aTxtRight = (long)m_pAfterSpacing->Normalize(aTxtRight); + aTxtRight = static_cast<long>(m_pAfterSpacing->Normalize(aTxtRight)); switch(m_aContext.GetCombinedContext_DI()) { @@ -250,7 +250,7 @@ void ParaLRSpacingWindow::SetValue(SfxItemState eState, const SfxPoolItem* pStat m_pBeforeSpacing->SetValue(aTxtLeft, FUNIT_100TH_MM); m_pAfterSpacing->SetValue(aTxtRight, FUNIT_100TH_MM); - aTxtFirstLineOfst = (long)m_pFLSpacing->Normalize(aTxtFirstLineOfst); + aTxtFirstLineOfst = static_cast<long>(m_pFLSpacing->Normalize(aTxtFirstLineOfst)); m_pFLSpacing->SetValue(aTxtFirstLineOfst, FUNIT_100TH_MM); } else if(eState == SfxItemState::DISABLED) @@ -286,7 +286,7 @@ IMPL_LINK_NOARG(ParaLRSpacingWindow, ModifySpacingHdl, Edit&, void) SvxLRSpaceItem aMargin(SID_ATTR_PARA_LRSPACE); aMargin.SetTextLeft(GetCoreValue(*m_pBeforeSpacing, m_eUnit)); aMargin.SetRight(GetCoreValue(*m_pAfterSpacing, m_eUnit)); - aMargin.SetTextFirstLineOfst((short)GetCoreValue(*m_pFLSpacing, m_eUnit)); + aMargin.SetTextFirstLineOfst(static_cast<short>(GetCoreValue(*m_pFLSpacing, m_eUnit))); pDisp->ExecuteList(SID_ATTR_PARA_LRSPACE, SfxCallMode::RECORD, {&aMargin}); } diff --git a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx index 89e3584bba40..fd1e2b055d60 100644 --- a/svx/source/sidebar/possize/PosSizePropertyPanel.cxx +++ b/svx/source/sidebar/possize/PosSizePropertyPanel.cxx @@ -324,16 +324,16 @@ IMPL_LINK_NOARG( PosSizePropertyPanel, ChangeWidthHdl, Edit&, void ) if( mpCbxScale->IsChecked() && mpCbxScale->IsEnabled() ) { - long nHeight = (long) ( ((double) mlOldHeight * (double) mpMtrWidth->GetValue()) / (double) mlOldWidth ); + long nHeight = static_cast<long>( (static_cast<double>(mlOldHeight) * static_cast<double>(mpMtrWidth->GetValue())) / static_cast<double>(mlOldWidth) ); if( nHeight <= mpMtrHeight->GetMax( FUNIT_NONE ) ) { mpMtrHeight->SetUserValue( nHeight, FUNIT_NONE ); } else { - nHeight = (long)mpMtrHeight->GetMax( FUNIT_NONE ); + nHeight = static_cast<long>(mpMtrHeight->GetMax( FUNIT_NONE )); mpMtrHeight->SetUserValue( nHeight ); - const long nWidth = (long) ( ((double) mlOldWidth * (double) nHeight) / (double) mlOldHeight ); + const long nWidth = static_cast<long>( (static_cast<double>(mlOldWidth) * static_cast<double>(nHeight)) / static_cast<double>(mlOldHeight) ); mpMtrWidth->SetUserValue( nWidth, FUNIT_NONE ); } } @@ -346,16 +346,16 @@ IMPL_LINK_NOARG( PosSizePropertyPanel, ChangeHeightHdl, Edit&, void ) if( mpCbxScale->IsChecked() && mpCbxScale->IsEnabled() ) { - long nWidth = (long) ( ((double)mlOldWidth * (double)mpMtrHeight->GetValue()) / (double)mlOldHeight ); + long nWidth = static_cast<long>( (static_cast<double>(mlOldWidth) * static_cast<double>(mpMtrHeight->GetValue())) / static_cast<double>(mlOldHeight) ); if( nWidth <= mpMtrWidth->GetMax( FUNIT_NONE ) ) { mpMtrWidth->SetUserValue( nWidth, FUNIT_NONE ); } else { - nWidth = (long)mpMtrWidth->GetMax( FUNIT_NONE ); + nWidth = static_cast<long>(mpMtrWidth->GetMax( FUNIT_NONE )); mpMtrWidth->SetUserValue( nWidth ); - const long nHeight = (long) ( ((double)mlOldHeight * (double)nWidth) / (double)mlOldWidth ); + const long nHeight = static_cast<long>( (static_cast<double>(mlOldHeight) * static_cast<double>(nWidth)) / static_cast<double>(mlOldWidth) ); mpMtrHeight->SetUserValue( nHeight, FUNIT_NONE ); } } @@ -373,7 +373,7 @@ IMPL_LINK_NOARG( PosSizePropertyPanel, ChangePosXHdl, Edit&, void ) lX += maAnchorPos.X(); lX = long( lX * aUIScale ); - SfxInt32Item aPosXItem( SID_ATTR_TRANSFORM_POS_X,(sal_uInt32) lX); + SfxInt32Item aPosXItem( SID_ATTR_TRANSFORM_POS_X,static_cast<sal_uInt32>(lX)); GetBindings()->GetDispatcher()->ExecuteList( SID_ATTR_TRANSFORM, SfxCallMode::RECORD, { &aPosXItem }); @@ -391,7 +391,7 @@ IMPL_LINK_NOARG( PosSizePropertyPanel, ChangePosYHdl, Edit&, void ) lY += maAnchorPos.Y(); lY = long( lY * aUIScale ); - SfxInt32Item aPosYItem( SID_ATTR_TRANSFORM_POS_Y,(sal_uInt32) lY); + SfxInt32Item aPosYItem( SID_ATTR_TRANSFORM_POS_Y,static_cast<sal_uInt32>(lY)); GetBindings()->GetDispatcher()->ExecuteList( SID_ATTR_TRANSFORM, SfxCallMode::RECORD, { &aPosYItem }); @@ -448,7 +448,7 @@ IMPL_LINK_NOARG( PosSizePropertyPanel, AngleModifiedHdl, Edit&, void ) // #i123993# Need to take UIScale into account when executing rotations const double fUIScale(mpView && mpView->GetModel() ? double(mpView->GetModel()->GetUIScale()) : 1.0); - SfxInt32Item aAngleItem( SID_ATTR_TRANSFORM_ANGLE,(sal_uInt32) nTmp); + SfxInt32Item aAngleItem( SID_ATTR_TRANSFORM_ANGLE,static_cast<sal_uInt32>(nTmp)); SfxInt32Item aRotXItem( SID_ATTR_TRANSFORM_ROT_X, basegfx::fround(mlRotX * fUIScale)); SfxInt32Item aRotYItem( SID_ATTR_TRANSFORM_ROT_Y, basegfx::fround(mlRotY * fUIScale)); @@ -463,7 +463,7 @@ IMPL_LINK_NOARG( PosSizePropertyPanel, RotationHdl, DialControl*, void ) // #i123993# Need to take UIScale into account when executing rotations const double fUIScale(mpView && mpView->GetModel() ? double(mpView->GetModel()->GetUIScale()) : 1.0); - SfxInt32Item aAngleItem( SID_ATTR_TRANSFORM_ANGLE,(sal_uInt32) nTmp); + SfxInt32Item aAngleItem( SID_ATTR_TRANSFORM_ANGLE,static_cast<sal_uInt32>(nTmp)); SfxInt32Item aRotXItem( SID_ATTR_TRANSFORM_ROT_X, basegfx::fround(mlRotX * fUIScale)); SfxInt32Item aRotYItem( SID_ATTR_TRANSFORM_ROT_Y, basegfx::fround(mlRotY * fUIScale)); @@ -807,7 +807,7 @@ void PosSizePropertyPanel::NotifyItemUpdate( ::rtl::OUString aTemp; if ( aUserItem >>= aTemp ) sUserData = aTemp; - mpCbxScale->Check( (bool)sUserData.toInt32() ); + mpCbxScale->Check( static_cast<bool>(sUserData.toInt32()) ); } @@ -819,22 +819,22 @@ void PosSizePropertyPanel::executeSize() Fraction aUIScale = mpView->GetModel()->GetUIScale(); // get Width - double nWidth = (double)mpMtrWidth->GetValue( meDlgUnit ); + double nWidth = static_cast<double>(mpMtrWidth->GetValue( meDlgUnit )); nWidth = MetricField::ConvertDoubleValue( nWidth, mpMtrWidth->GetBaseValue(), mpMtrWidth->GetDecimalDigits(), meDlgUnit, FUNIT_100TH_MM ); - long lWidth = (long)(nWidth * (double)aUIScale); + long lWidth = static_cast<long>(nWidth * static_cast<double>(aUIScale)); lWidth = OutputDevice::LogicToLogic( lWidth, MapUnit::Map100thMM, mePoolUnit ); - lWidth = (long)mpMtrWidth->Denormalize( lWidth ); + lWidth = static_cast<long>(mpMtrWidth->Denormalize( lWidth )); // get Height - double nHeight = (double)mpMtrHeight->GetValue( meDlgUnit ); + double nHeight = static_cast<double>(mpMtrHeight->GetValue( meDlgUnit )); nHeight = MetricField::ConvertDoubleValue( nHeight, mpMtrHeight->GetBaseValue(), mpMtrHeight->GetDecimalDigits(), meDlgUnit, FUNIT_100TH_MM ); - long lHeight = (long)(nHeight * (double)aUIScale); + long lHeight = static_cast<long>(nHeight * static_cast<double>(aUIScale)); lHeight = OutputDevice::LogicToLogic( lHeight, MapUnit::Map100thMM, mePoolUnit ); - lHeight = (long)mpMtrWidth->Denormalize( lHeight ); + lHeight = static_cast<long>(mpMtrWidth->Denormalize( lHeight )); // put Width & Height to itemset - SfxUInt32Item aWidthItem( SID_ATTR_TRANSFORM_WIDTH, (sal_uInt32) lWidth); - SfxUInt32Item aHeightItem( SID_ATTR_TRANSFORM_HEIGHT, (sal_uInt32) lHeight); + SfxUInt32Item aWidthItem( SID_ATTR_TRANSFORM_WIDTH, static_cast<sal_uInt32>(lWidth)); + SfxUInt32Item aHeightItem( SID_ATTR_TRANSFORM_HEIGHT, static_cast<sal_uInt32>(lHeight)); SfxAllEnumItem aPointItem (SID_ATTR_TRANSFORM_SIZE_POINT, (sal_uInt16)RectPoint::LT); const sal_Int32 nCombinedContext(maContext.GetCombinedContext_DI()); @@ -1047,7 +1047,7 @@ void PosSizePropertyPanel::SetPosSizeMinMax() fRight -= maRect.getWidth(); fBottom -= maRect.getHeight(); - const double fMaxLong((double)(MetricField::ConvertValue( LONG_MAX, 0, MapUnit::Map100thMM, meDlgUnit ) - 1)); + const double fMaxLong(static_cast<double>(MetricField::ConvertValue( LONG_MAX, 0, MapUnit::Map100thMM, meDlgUnit ) - 1)); fLeft = basegfx::clamp(fLeft, -fMaxLong, fMaxLong); fRight = basegfx::clamp(fRight, -fMaxLong, fMaxLong); fTop = basegfx::clamp(fTop, - fMaxLong, fMaxLong); diff --git a/svx/source/sidebar/text/TextCharacterSpacingControl.cxx b/svx/source/sidebar/text/TextCharacterSpacingControl.cxx index aee423d0b99e..b71caa2b964d 100644 --- a/svx/source/sidebar/text/TextCharacterSpacingControl.cxx +++ b/svx/source/sidebar/text/TextCharacterSpacingControl.cxx @@ -151,7 +151,7 @@ void TextCharacterSpacingControl::ExecuteCharacterSpacing(long nValue, bool bClo nValue = nValue * nSign; long nVal = LogicToLogic(nValue, MapUnit::MapPoint, eUnit); - short nKern = (nValue == 0) ? 0 : (short)maEditKerning->Denormalize(nVal); + short nKern = (nValue == 0) ? 0 : static_cast<short>(maEditKerning->Denormalize(nVal)); SvxKerningItem aKernItem(nSign * nKern, SID_ATTR_CHAR_KERNING); diff --git a/svx/source/stbctrls/zoomsliderctrl.cxx b/svx/source/stbctrls/zoomsliderctrl.cxx index 53ad2619b4b4..bba6dd21e1f9 100644 --- a/svx/source/stbctrls/zoomsliderctrl.cxx +++ b/svx/source/stbctrls/zoomsliderctrl.cxx @@ -183,7 +183,7 @@ void SvxZoomSliderControl::StateChanged( sal_uInt16 /*nSID*/, SfxItemState eStat mxImpl->mbValuesSet = true; if ( mxImpl->mnSliderCenter == mxImpl->mnMaxZoom ) - mxImpl->mnSliderCenter = mxImpl->mnMinZoom + (sal_uInt16)((mxImpl->mnMaxZoom - mxImpl->mnMinZoom) * 0.5); + mxImpl->mnSliderCenter = mxImpl->mnMinZoom + static_cast<sal_uInt16>((mxImpl->mnMaxZoom - mxImpl->mnMinZoom) * 0.5); DBG_ASSERT( mxImpl->mnMinZoom <= mxImpl->mnCurrentZoom && @@ -201,7 +201,7 @@ void SvxZoomSliderControl::StateChanged( sal_uInt16 /*nSID*/, SfxItemState eStat 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/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) diff --git a/svx/source/table/accessibletableshape.cxx b/svx/source/table/accessibletableshape.cxx index 2427c36ed3f6..f856d6b6e3d5 100644 --- a/svx/source/table/accessibletableshape.cxx +++ b/svx/source/table/accessibletableshape.cxx @@ -768,8 +768,8 @@ sal_Int32 SAL_CALL AccessibleTableShape::getSelectedAccessibleChildCount() CellPos aFirstPos, aLastPos; pController->getSelectedCells( aFirstPos, aLastPos ); - const sal_Int32 nSelectedColumns = std::max( (sal_Int32)0, aLastPos.mnCol - aFirstPos.mnCol ) + 1; - const sal_Int32 nSelectedRows = std::max( (sal_Int32)0, aLastPos.mnRow - aFirstPos.mnRow ) + 1; + const sal_Int32 nSelectedColumns = std::max( sal_Int32(0), aLastPos.mnCol - aFirstPos.mnCol ) + 1; + const sal_Int32 nSelectedRows = std::max( sal_Int32(0), aLastPos.mnRow - aFirstPos.mnRow ) + 1; return nSelectedRows * nSelectedColumns; } diff --git a/svx/source/table/cell.cxx b/svx/source/table/cell.cxx index fec8b197b43c..4cb9eae98fa0 100644 --- a/svx/source/table/cell.cxx +++ b/svx/source/table/cell.cxx @@ -998,7 +998,7 @@ Any Cell::GetAnyForItem( SfxItemSet const & aSet, const SfxItemPropertySimpleEnt { sal_Int32 nValue = 0; aAny >>= nValue; - aAny <<= (sal_Int16)nValue; + aAny <<= static_cast<sal_Int16>(nValue); } else { @@ -1433,7 +1433,7 @@ PropertyState SAL_CALL Cell::getPropertyState( const OUString& PropertyName ) case XATTR_FILLHATCH: case XATTR_LINEDASH: { - const NameOrIndex* pItem = rSet.GetItem<NameOrIndex>((sal_uInt16)pMap->nWID); + const NameOrIndex* pItem = rSet.GetItem<NameOrIndex>(static_cast<sal_uInt16>(pMap->nWID)); if( ( pItem == nullptr ) || pItem->GetName().isEmpty() ) eState = PropertyState_DEFAULT_VALUE; } @@ -1448,7 +1448,7 @@ PropertyState SAL_CALL Cell::getPropertyState( const OUString& PropertyName ) case XATTR_LINESTART: case XATTR_FILLFLOATTRANSPARENCE: { - const NameOrIndex* pItem = rSet.GetItem<NameOrIndex>((sal_uInt16)pMap->nWID); + const NameOrIndex* pItem = rSet.GetItem<NameOrIndex>(static_cast<sal_uInt16>(pMap->nWID)); if( pItem == nullptr ) eState = PropertyState_DEFAULT_VALUE; } diff --git a/svx/source/table/svdotable.cxx b/svx/source/table/svdotable.cxx index 441b4a01fbbb..d8b3ec449414 100644 --- a/svx/source/table/svdotable.cxx +++ b/svx/source/table/svdotable.cxx @@ -535,7 +535,7 @@ void SdrTableObjImpl::DragEdge( bool mbHorizontal, int nEdge, sal_Int32 nOffset if( (bRTL && (nEdge >= 0)) || (!bRTL && (nEdge < mxTable->getColumnCount())) ) { nWidth = mpLayouter->getColumnWidth( nEdge ); - nWidth = std::max( (sal_Int32)(nWidth - nOffset), (sal_Int32)0 ); + nWidth = std::max( static_cast<sal_Int32>(nWidth - nOffset), sal_Int32(0) ); Reference< XPropertySet > xColSet( xCols->getByIndex( nEdge ), UNO_QUERY_THROW ); xColSet->setPropertyValue( sSize, Any( nWidth ) ); diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx index 37e267b2eea4..59dec64df181 100644 --- a/svx/source/table/tablecontroller.cxx +++ b/svx/source/table/tablecontroller.cxx @@ -2446,7 +2446,7 @@ void SvxTableController::ApplyBorderAttr( const SfxItemSet& rAttr ) const sal_Int32 nLastRow = std::min( aEnd.mnRow + 2, nRowCount ); const sal_Int32 nLastCol = std::min( aEnd.mnCol + 2, nColCount ); - for( sal_Int32 nRow = std::max( aStart.mnRow - 1, (sal_Int32)0 ); nRow < nLastRow; nRow++ ) + for( sal_Int32 nRow = std::max( aStart.mnRow - 1, sal_Int32(0) ); nRow < nLastRow; nRow++ ) { CellPosFlag nRowFlags = CellPosFlag::NONE; nRowFlags |= (nRow == aStart.mnRow) ? CellPosFlag::Top : CellPosFlag::NONE; @@ -2454,7 +2454,7 @@ void SvxTableController::ApplyBorderAttr( const SfxItemSet& rAttr ) nRowFlags |= (nRow < aStart.mnRow) ? CellPosFlag::Upper : CellPosFlag::NONE; nRowFlags |= (nRow > aEnd.mnRow) ? CellPosFlag::Lower : CellPosFlag::NONE; - for( sal_Int32 nCol = std::max( aStart.mnCol - 1, (sal_Int32)0 ); nCol < nLastCol; nCol++ ) + for( sal_Int32 nCol = std::max( aStart.mnCol - 1, sal_Int32(0) ); nCol < nLastCol; nCol++ ) { CellRef xCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nRow ).get() ) ); if( !xCell.is() ) @@ -2921,10 +2921,10 @@ void lcl_MergeCommonBorderAttr(LinesState& rLinesState, const SvxBoxItem& rCellB { // current cell is inside the selection - lcl_MergeBorderOrInnerLine(rLinesState, rCellBoxItem.GetTop(), SvxBoxItemLine::TOP, SvxBoxInfoItemValidFlags::TOP, (bool)(nCellPosFlags & CellPosFlag::Top)); - lcl_MergeBorderOrInnerLine(rLinesState, rCellBoxItem.GetBottom(), SvxBoxItemLine::BOTTOM, SvxBoxInfoItemValidFlags::BOTTOM, (bool)(nCellPosFlags & CellPosFlag::Bottom)); - lcl_MergeBorderOrInnerLine(rLinesState, rCellBoxItem.GetLeft(), SvxBoxItemLine::LEFT, SvxBoxInfoItemValidFlags::LEFT, (bool)(nCellPosFlags & CellPosFlag::Left)); - lcl_MergeBorderOrInnerLine(rLinesState, rCellBoxItem.GetRight(), SvxBoxItemLine::RIGHT, SvxBoxInfoItemValidFlags::RIGHT, (bool)(nCellPosFlags & CellPosFlag::Right)); + lcl_MergeBorderOrInnerLine(rLinesState, rCellBoxItem.GetTop(), SvxBoxItemLine::TOP, SvxBoxInfoItemValidFlags::TOP, static_cast<bool>(nCellPosFlags & CellPosFlag::Top)); + lcl_MergeBorderOrInnerLine(rLinesState, rCellBoxItem.GetBottom(), SvxBoxItemLine::BOTTOM, SvxBoxInfoItemValidFlags::BOTTOM, static_cast<bool>(nCellPosFlags & CellPosFlag::Bottom)); + lcl_MergeBorderOrInnerLine(rLinesState, rCellBoxItem.GetLeft(), SvxBoxItemLine::LEFT, SvxBoxInfoItemValidFlags::LEFT, static_cast<bool>(nCellPosFlags & CellPosFlag::Left)); + lcl_MergeBorderOrInnerLine(rLinesState, rCellBoxItem.GetRight(), SvxBoxItemLine::RIGHT, SvxBoxInfoItemValidFlags::RIGHT, static_cast<bool>(nCellPosFlags & CellPosFlag::Right)); lcl_MergeDistance(rLinesState, SvxBoxItemLine::TOP, rCellBoxItem.GetDistance(SvxBoxItemLine::TOP)); lcl_MergeDistance(rLinesState, SvxBoxItemLine::BOTTOM, rCellBoxItem.GetDistance(SvxBoxItemLine::BOTTOM)); @@ -2963,7 +2963,7 @@ void SvxTableController::FillCommonBorderAttrFromSelectedCells( SvxBoxItem& rBox * it will be set to indeterminate state (SetValid() on * rBoxInfoItem). */ - for( sal_Int32 nRow = std::max( aStart.mnRow - 1, (sal_Int32)0 ); nRow < nLastRow; nRow++ ) + for( sal_Int32 nRow = std::max( aStart.mnRow - 1, sal_Int32(0) ); nRow < nLastRow; nRow++ ) { CellPosFlag nRowFlags = CellPosFlag::NONE; nRowFlags |= (nRow == aStart.mnRow) ? CellPosFlag::Top : CellPosFlag::NONE; @@ -2971,7 +2971,7 @@ void SvxTableController::FillCommonBorderAttrFromSelectedCells( SvxBoxItem& rBox nRowFlags |= (nRow < aStart.mnRow) ? CellPosFlag::Upper : CellPosFlag::NONE; nRowFlags |= (nRow > aEnd.mnRow) ? CellPosFlag::Lower : CellPosFlag::NONE; - for( sal_Int32 nCol = std::max( aStart.mnCol - 1, (sal_Int32)0 ); nCol < nLastCol; nCol++ ) + for( sal_Int32 nCol = std::max( aStart.mnCol - 1, sal_Int32(0) ); nCol < nLastCol; nCol++ ) { CellRef xCell( dynamic_cast< Cell* >( mxTable->getCellByPosition( nCol, nRow ).get() ) ); if( !xCell.is() ) diff --git a/svx/source/table/tablelayouter.cxx b/svx/source/table/tablelayouter.cxx index d1de33c1b464..9a31f56288cc 100644 --- a/svx/source/table/tablelayouter.cxx +++ b/svx/source/table/tablelayouter.cxx @@ -79,10 +79,10 @@ basegfx::B2ITuple TableLayouter::getCellSize( const CellRef& xCell, const CellPo CellPos aPos( rPos ); sal_Int32 nRowCount = getRowCount(); - sal_Int32 nRowSpan = std::max( xCell->getRowSpan(), (sal_Int32)1 ); + sal_Int32 nRowSpan = std::max( xCell->getRowSpan(), sal_Int32(1) ); while( nRowSpan && (aPos.mnRow < nRowCount) ) { - if( ((sal_Int32)maRows.size()) <= aPos.mnRow ) + if( static_cast<sal_Int32>(maRows.size()) <= aPos.mnRow ) break; height = o3tl::saturating_add(height, maRows[aPos.mnRow++].mnSize); @@ -90,10 +90,10 @@ basegfx::B2ITuple TableLayouter::getCellSize( const CellRef& xCell, const CellPo } sal_Int32 nColCount = getColumnCount(); - sal_Int32 nColSpan = std::max( xCell->getColumnSpan(), (sal_Int32)1 ); + sal_Int32 nColSpan = std::max( xCell->getColumnSpan(), sal_Int32(1) ); while( nColSpan && (aPos.mnCol < nColCount ) ) { - if( ((sal_Int32)maColumns.size()) <= aPos.mnCol ) + if( static_cast<sal_Int32>(maColumns.size()) <= aPos.mnCol ) break; width = o3tl::saturating_add(width, maColumns[aPos.mnCol++].mnSize); @@ -119,7 +119,7 @@ bool TableLayouter::getCellArea( const CellRef& xCell, const CellPos& rPos, base const basegfx::B2ITuple aCellSize( getCellSize( xCell, rPos ) ); const bool bRTL = (mxTable->getSdrTableObj()->GetWritingMode() == WritingMode_RL_TB); - if( (rPos.mnCol < ((sal_Int32)maColumns.size())) && (rPos.mnRow < ((sal_Int32)maRows.size()) ) ) + if( (rPos.mnCol < static_cast<sal_Int32>(maColumns.size())) && (rPos.mnRow < static_cast<sal_Int32>(maRows.size()) ) ) { const sal_Int32 y = maRows[rPos.mnRow].mnPos; @@ -220,7 +220,7 @@ sal_Int32 TableLayouter::getHorizontalEdge( int nEdgeY, sal_Int32* pnMin /*= 0*/ sal_Int32 nRet = 0; const sal_Int32 nRowCount = getRowCount(); if( (nEdgeY >= 0) && (nEdgeY <= nRowCount ) ) - nRet = maRows[std::min((sal_Int32)nEdgeY,nRowCount-1)].mnPos; + nRet = maRows[std::min(static_cast<sal_Int32>(nEdgeY),nRowCount-1)].mnPos; if( nEdgeY == nRowCount ) nRet += maRows[nEdgeY - 1].mnSize; @@ -251,7 +251,7 @@ sal_Int32 TableLayouter::getVerticalEdge( int nEdgeX, sal_Int32* pnMin /*= 0*/, const sal_Int32 nColCount = getColumnCount(); if( (nEdgeX >= 0) && (nEdgeX <= nColCount ) ) - nRet = maColumns[std::min((sal_Int32)nEdgeX,nColCount-1)].mnPos; + nRet = maColumns[std::min(static_cast<sal_Int32>(nEdgeX),nColCount-1)].mnPos; const bool bRTL = (mxTable->getSdrTableObj()->GetWritingMode() == WritingMode_RL_TB); if( bRTL ) diff --git a/svx/source/table/tablertfimporter.cxx b/svx/source/table/tablertfimporter.cxx index 07c2e0395600..3860bf1759b2 100644 --- a/svx/source/table/tablertfimporter.cxx +++ b/svx/source/table/tablertfimporter.cxx @@ -298,12 +298,12 @@ void SdrTableRTFParser::FillTable() xRows->insertByIndex( nRowCount, mnRowCnt - nRowCount ); } - for( sal_Int32 nRow = 0; nRow < (sal_Int32)maRows.size(); nRow++ ) + for( sal_Int32 nRow = 0; nRow < static_cast<sal_Int32>(maRows.size()); nRow++ ) { RTFColumnVectorPtr xColumn( maRows[nRow] ); nCol = 0; auto aEdge = maColumnEdges.begin(); - for( sal_Int32 nIdx = 0; nCol < nColMax && nIdx < (sal_Int32)xColumn->size(); nIdx++ ) + for( sal_Int32 nIdx = 0; nCol < nColMax && nIdx < static_cast<sal_Int32>(xColumn->size()); nIdx++ ) { RTFCellInfoPtr xCellInfo( (*xColumn)[nIdx] ); diff --git a/svx/source/table/viewcontactoftableobj.cxx b/svx/source/table/viewcontactoftableobj.cxx index 2f818e5ee7f2..7ca200fc0e6e 100644 --- a/svx/source/table/viewcontactoftableobj.cxx +++ b/svx/source/table/viewcontactoftableobj.cxx @@ -277,10 +277,10 @@ namespace sdr { // create cell transformation matrix basegfx::B2DHomMatrix aCellMatrix; - aCellMatrix.set(0, 0, (double)aCellArea.getWidth()); - aCellMatrix.set(1, 1, (double)aCellArea.getHeight()); - aCellMatrix.set(0, 2, (double)aCellArea.getMinX() + aObjectRange.getMinX()); - aCellMatrix.set(1, 2, (double)aCellArea.getMinY() + aObjectRange.getMinY()); + aCellMatrix.set(0, 0, static_cast<double>(aCellArea.getWidth())); + aCellMatrix.set(1, 1, static_cast<double>(aCellArea.getHeight())); + aCellMatrix.set(0, 2, static_cast<double>(aCellArea.getMinX()) + aObjectRange.getMinX()); + aCellMatrix.set(1, 2, static_cast<double>(aCellArea.getMinY()) + aObjectRange.getMinY()); // handle cell fillings and text const SfxItemSet& rCellItemSet = xCurrentCell->GetItemSet(); diff --git a/svx/source/tbxctrls/colrctrl.cxx b/svx/source/tbxctrls/colrctrl.cxx index 032af70d3a6e..d77fa2c729c9 100644 --- a/svx/source/tbxctrls/colrctrl.cxx +++ b/svx/source/tbxctrls/colrctrl.cxx @@ -279,7 +279,7 @@ void SvxColorDockingWindow::FillValueSet() Bitmap aBmp( pVD->GetBitmap( Point(), aColorSize ) ); - aColorSet->InsertItem( (sal_uInt16)1, Image(aBmp), SvxResId( RID_SVXSTR_INVISIBLE ) ); + aColorSet->InsertItem( sal_uInt16(1), Image(aBmp), SvxResId( RID_SVXSTR_INVISIBLE ) ); aColorSet->addEntriesForXColorList(*pColorList, 2); } @@ -292,8 +292,8 @@ void SvxColorDockingWindow::SetSize() aSize.Height() -= 4; // calculate rows and columns - nCols = (sal_uInt16) ( aSize.Width() / aItemSize.Width() ); - nLines = (sal_uInt16) ( (float) aSize.Height() / (float) aItemSize.Height() /*+ 0.35*/ ); + nCols = static_cast<sal_uInt16>( aSize.Width() / aItemSize.Width() ); + nLines = static_cast<sal_uInt16>( static_cast<float>(aSize.Height()) / static_cast<float>(aItemSize.Height()) /*+ 0.35*/ ); if( nLines == 0 ) nLines++; @@ -310,7 +310,7 @@ void SvxColorDockingWindow::SetSize() if( nScrollWidth > 0 ) { // calculate columns with scroll bar - nCols = (sal_uInt16) ( ( aSize.Width() - nScrollWidth ) / aItemSize.Width() ); + nCols = static_cast<sal_uInt16>( ( aSize.Width() - nScrollWidth ) / aItemSize.Width() ); } aColorSet->SetColCount( nCols ); @@ -440,8 +440,8 @@ void SvxColorDockingWindow::Resizing( Size& rNewSize ) rNewSize.Height() -= 4; // determine columns and rows - nCols = (sal_uInt16) ( (float) rNewSize.Width() / (float) aItemSize.Width() + 0.5 ); - nLines = (sal_uInt16) ( (float) rNewSize.Height() / (float) aItemSize.Height() + 0.5 ); + nCols = static_cast<sal_uInt16>( static_cast<float>(rNewSize.Width()) / static_cast<float>(aItemSize.Width()) + 0.5 ); + nLines = static_cast<sal_uInt16>( static_cast<float>(rNewSize.Height()) / static_cast<float>(aItemSize.Height()) + 0.5 ); if( nLines == 0 ) nLines = 1; @@ -458,8 +458,8 @@ void SvxColorDockingWindow::Resizing( Size& rNewSize ) if( nScrollWidth > 0 ) { // calculate columns with scroll bar - nCols = (sal_uInt16) ( ( (float) rNewSize.Width() - (float) nScrollWidth ) - / (float) aItemSize.Width() + 0.5 ); + nCols = static_cast<sal_uInt16>( ( static_cast<float>(rNewSize.Width()) - static_cast<float>(nScrollWidth) ) + / static_cast<float>(aItemSize.Width()) + 0.5 ); } if( nCols <= 1 ) nCols = 2; diff --git a/svx/source/tbxctrls/extrusioncontrols.cxx b/svx/source/tbxctrls/extrusioncontrols.cxx index b1e9eaec9b39..b2ac8546c4d9 100644 --- a/svx/source/tbxctrls/extrusioncontrols.cxx +++ b/svx/source/tbxctrls/extrusioncontrols.cxx @@ -271,7 +271,7 @@ void ExtrusionDirectionWindow::SelectHdl(void const * pControl) { Sequence< PropertyValue > aArgs( 1 ); aArgs[0].Name = OUString(g_sExtrusionDirection).copy(5); - aArgs[0].Value <<= (sal_Int32)gSkewList[mpDirectionSet->GetSelectItemId()-1]; + aArgs[0].Value <<= static_cast<sal_Int32>(gSkewList[mpDirectionSet->GetSelectItemId()-1]); mrController.dispatchCommand( g_sExtrusionDirection, aArgs ); } @@ -282,7 +282,7 @@ void ExtrusionDirectionWindow::SelectHdl(void const * pControl) { Sequence< PropertyValue > aArgs( 1 ); aArgs[0].Name = OUString(g_sExtrusionProjection).copy(5); - aArgs[0].Value <<= (sal_Int32)nProjection; + aArgs[0].Value <<= static_cast<sal_Int32>(nProjection); mrController.dispatchCommand( g_sExtrusionProjection, aArgs ); implSetProjection( nProjection, true ); @@ -357,7 +357,7 @@ ExtrusionDepthDialog::ExtrusionDepthDialog( vcl::Window* pParent, double fDepth, { get(m_pMtrDepth, "depth"); m_pMtrDepth->SetUnit( eDefaultUnit ); - m_pMtrDepth->SetValue( (int) fDepth * 100, FUNIT_100TH_MM ); + m_pMtrDepth->SetValue( static_cast<int>(fDepth) * 100, FUNIT_100TH_MM ); } ExtrusionDepthDialog::~ExtrusionDepthDialog() @@ -373,7 +373,7 @@ void ExtrusionDepthDialog::dispose() double ExtrusionDepthDialog::getDepth() const { - return (double)( m_pMtrDepth->GetValue( FUNIT_100TH_MM ) ) / 100.0; + return static_cast<double>( m_pMtrDepth->GetValue( FUNIT_100TH_MM ) ) / 100.0; } double const aDepthListInch[] = { 0, 1270,2540,5080,10160 }; @@ -697,7 +697,7 @@ void ExtrusionLightingWindow::implSetDirection( int nDirection, bool bEnabled ) { mpLightingSet->SetItemImage( nItemId + 1, - (sal_uInt16)nDirection == nItemId ? maImgLightingOn[nItemId] : maImgLightingOff[nItemId] + static_cast<sal_uInt16>(nDirection) == nItemId ? maImgLightingOn[nItemId] : maImgLightingOff[nItemId] ); } } @@ -775,7 +775,7 @@ void ExtrusionLightingWindow::SelectHdl(void const * pControl) { Sequence< PropertyValue > aArgs( 1 ); aArgs[0].Name = OUString(g_sExtrusionLightingIntensity).copy(5); - aArgs[0].Value <<= (sal_Int32)nLevel; + aArgs[0].Value <<= static_cast<sal_Int32>(nLevel); mrController.dispatchCommand( g_sExtrusionLightingIntensity, aArgs ); diff --git a/svx/source/tbxctrls/fontworkgallery.cxx b/svx/source/tbxctrls/fontworkgallery.cxx index ba77ccd5beed..51d71a102b0b 100644 --- a/svx/source/tbxctrls/fontworkgallery.cxx +++ b/svx/source/tbxctrls/fontworkgallery.cxx @@ -174,7 +174,7 @@ void FontWorkGalleryDialog::fillFavorites(sal_uInt16 nThemeId) aStr += " "; aStr += OUString::number(nFavorite); Image aThumbImage( maFavoritesHorizontal[nFavorite-1] ); - mpCtlFavorites->InsertItem( (sal_uInt16)nFavorite, aThumbImage, aStr ); + mpCtlFavorites->InsertItem( static_cast<sal_uInt16>(nFavorite), aThumbImage, aStr ); } } @@ -651,7 +651,7 @@ void FontworkCharacterSpacingDialog::dispose() sal_Int32 FontworkCharacterSpacingDialog::getScale() const { - return (sal_Int32)m_pMtrScale->GetValue(); + return static_cast<sal_Int32>(m_pMtrScale->GetValue()); } } diff --git a/svx/source/tbxctrls/layctrl.cxx b/svx/source/tbxctrls/layctrl.cxx index 3b460fb8ec09..ed6b6fcf0883 100644 --- a/svx/source/tbxctrls/layctrl.cxx +++ b/svx/source/tbxctrls/layctrl.cxx @@ -484,7 +484,7 @@ void ColumnsWindow::UpdateSize_Impl( long nNewCol ) } while ( nWidth > 0 && - (short)(aWinPos.X()+(nMX*nWidth-1)) >= aMaxPos.X()-3 ) + static_cast<short>(aWinPos.X()+(nMX*nWidth-1)) >= aMaxPos.X()-3 ) nWidth--; if ( nNewCol > nWidth ) diff --git a/svx/source/tbxctrls/linectrl.cxx b/svx/source/tbxctrls/linectrl.cxx index 1e1734ae331f..d562abf9b4ca 100644 --- a/svx/source/tbxctrls/linectrl.cxx +++ b/svx/source/tbxctrls/linectrl.cxx @@ -401,12 +401,12 @@ void SvxLineEndWindow::FillValueSet() OSL_ENSURE( !aBmp.IsEmpty(), "UI bitmap was not created" ); pVD->DrawBitmap( aPt0, aBmp ); - mpLineEndSet->InsertItem((sal_uInt16)((i+1)*2L+1), + mpLineEndSet->InsertItem(static_cast<sal_uInt16>((i+1)*2L+1), Image(pVD->GetBitmap(aPt0, maBmpSize)), pEntry->GetName()); - mpLineEndSet->InsertItem((sal_uInt16)((i+2)*2L), + mpLineEndSet->InsertItem(static_cast<sal_uInt16>((i+2)*2L), Image(pVD->GetBitmap(aPt1, maBmpSize)), pEntry->GetName()); } - mnLines = std::min( (sal_uInt16)(nCount + 1), (sal_uInt16) MAX_LINES ); + mnLines = std::min( static_cast<sal_uInt16>(nCount + 1), sal_uInt16(MAX_LINES) ); mpLineEndSet->SetLineCount( mnLines ); SetSize(); diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx b/svx/source/tbxctrls/tbunosearchcontrollers.cxx index 5f68bbd228ff..1522525bb0f7 100644 --- a/svx/source/tbxctrls/tbunosearchcontrollers.cxx +++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx @@ -127,11 +127,11 @@ void impl_executeSearch( const css::uno::Reference< css::uno::XComponentContext auto aArgs( comphelper::InitPropertySequence( { { "SearchItem.SearchString", css::uno::makeAny( sFindText ) }, { "SearchItem.Backward", css::uno::makeAny( aSearchBackwards ) }, - { "SearchItem.SearchFlags", css::uno::makeAny( (sal_Int32)0 ) }, + { "SearchItem.SearchFlags", css::uno::makeAny( sal_Int32(0) ) }, { "SearchItem.TransliterateFlags", css::uno::makeAny( (sal_Int32)nFlags ) }, { "SearchItem.Command", css::uno::makeAny( (sal_Int16)(aFindAll ?SvxSearchCmd::FIND_ALL : SvxSearchCmd::FIND ) ) }, { "SearchItem.AlgorithmType", css::uno::makeAny( (sal_Int16)css::util::SearchAlgorithms_ABSOLUTE ) }, - { "SearchItem.AlgorithmType2", css::uno::makeAny( (sal_Int16)css::util::SearchAlgorithms2::ABSOLUTE ) }, + { "SearchItem.AlgorithmType2", css::uno::makeAny( sal_Int16(css::util::SearchAlgorithms2::ABSOLUTE) ) }, { "SearchItem.SearchFormatted", css::uno::makeAny( bSearchFormatted ) } } ) ); diff --git a/svx/source/toolbars/extrusionbar.cxx b/svx/source/toolbars/extrusionbar.cxx index 22321bbb1aab..e08c6e5604d2 100644 --- a/svx/source/toolbars/extrusionbar.cxx +++ b/svx/source/toolbars/extrusionbar.cxx @@ -750,7 +750,7 @@ void getExtrusionDirectionState( SdrView const * pSdrView, SfxItemSet& rSet ) } if( bHasCustomShape ) - rSet.Put( SfxInt32Item( SID_EXTRUSION_DIRECTION, (sal_Int32)fFinalSkewAngle ) ); + rSet.Put( SfxInt32Item( SID_EXTRUSION_DIRECTION, static_cast<sal_Int32>(fFinalSkewAngle) ) ); else rSet.DisableItem( SID_EXTRUSION_DIRECTION ); } @@ -949,7 +949,7 @@ void getExtrusionDepthState( SdrView const * pSdrView, SfxItemSet& rSet ) if( pSdrView->GetModel() ) { FieldUnit eUnit = pSdrView->GetModel()->GetUIUnit(); - rSet.Put( SfxUInt16Item( SID_ATTR_METRIC, (sal_uInt16)eUnit ) ); + rSet.Put( SfxUInt16Item( SID_ATTR_METRIC, static_cast<sal_uInt16>(eUnit) ) ); } if( bHasCustomShape ) @@ -1048,7 +1048,7 @@ void getExtrusionLightingDirectionState( SdrView const * pSdrView, SfxItemSet& r } if( bHasCustomShape ) - rSet.Put( SfxInt32Item( SID_EXTRUSION_LIGHTING_DIRECTION, (sal_Int32)nFinalDirection ) ); + rSet.Put( SfxInt32Item( SID_EXTRUSION_LIGHTING_DIRECTION, static_cast<sal_Int32>(nFinalDirection) ) ); else rSet.DisableItem( SID_EXTRUSION_LIGHTING_DIRECTION ); } diff --git a/svx/source/toolbars/fontworkbar.cxx b/svx/source/toolbars/fontworkbar.cxx index af8117c7f7d2..338907dc1096 100644 --- a/svx/source/toolbars/fontworkbar.cxx +++ b/svx/source/toolbars/fontworkbar.cxx @@ -300,7 +300,7 @@ static void impl_execute( SfxRequest const & rReq, SdrCustomShapeGeometryItem& r if( rReq.GetArgs() && ( rReq.GetArgs()->GetItemState( SID_FONTWORK_CHARACTER_SPACING ) == SfxItemState::SET ) ) { sal_Int32 nCharSpacing = rReq.GetArgs()->GetItem<SfxInt32Item>(SID_FONTWORK_CHARACTER_SPACING)->GetValue(); - pObj->SetMergedItem( SvxCharScaleWidthItem( (sal_uInt16)nCharSpacing, EE_CHAR_FONTWIDTH ) ); + pObj->SetMergedItem( SvxCharScaleWidthItem( static_cast<sal_uInt16>(nCharSpacing), EE_CHAR_FONTWIDTH ) ); pObj->BroadcastObjectChange(); } } diff --git a/svx/source/unodraw/UnoGraphicExporter.cxx b/svx/source/unodraw/UnoGraphicExporter.cxx index 981e378a381b..093afe13308e 100644 --- a/svx/source/unodraw/UnoGraphicExporter.cxx +++ b/svx/source/unodraw/UnoGraphicExporter.cxx @@ -388,7 +388,7 @@ VclPtr<VirtualDevice> GraphicExporter::CreatePageVDev( SdrPage* pPage, sal_uIntP // use scaling? if( nWidthPixel ) { - const Fraction aFrac( (long) nWidthPixel, pVDev->LogicToPixel( aPageSize, aMM ).Width() ); + const Fraction aFrac( static_cast<long>(nWidthPixel), pVDev->LogicToPixel( aPageSize, aMM ).Width() ); aMM.SetScaleX( aFrac ); @@ -398,7 +398,7 @@ VclPtr<VirtualDevice> GraphicExporter::CreatePageVDev( SdrPage* pPage, sal_uIntP if( nHeightPixel ) { - const Fraction aFrac( (long) nHeightPixel, pVDev->LogicToPixel( aPageSize, aMM ).Height() ); + const Fraction aFrac( static_cast<long>(nHeightPixel), pVDev->LogicToPixel( aPageSize, aMM ).Height() ); if( nWidthPixel == 0 ) aMM.SetScaleX( aFrac ); @@ -667,8 +667,8 @@ bool GraphicExporter::GetGraphic( ExportSettings const & rSettings, Graphic& aGr else nHeightPix = aSizePix.Height(); - double fWidthDif = (double)aSizePix.Width() / nWidthPix; - double fHeightDif = (double)aSizePix.Height() / nHeightPix; + double fWidthDif = static_cast<double>(aSizePix.Width()) / nWidthPix; + double fHeightDif = static_cast<double>(aSizePix.Height()) / nHeightPix; if (fWidthDif > fHeightDif) nHeightPix = static_cast<long>(aSizePix.Height() / fWidthDif); diff --git a/svx/source/unodraw/XPropertyTable.cxx b/svx/source/unodraw/XPropertyTable.cxx index ce2134dbf3d0..24093e8ba0de 100644 --- a/svx/source/unodraw/XPropertyTable.cxx +++ b/svx/source/unodraw/XPropertyTable.cxx @@ -255,7 +255,7 @@ uno::Reference< uno::XInterface > SvxUnoXColorTable_createInstance( XPropertyLis // SvxUnoXPropertyTable uno::Any SvxUnoXColorTable::getAny( const XPropertyEntry* pEntry ) const throw() { - return uno::Any( (sal_Int32)static_cast<const XColorEntry*>(pEntry)->GetColor().GetColor() ); + return uno::Any( static_cast<sal_Int32>(static_cast<const XColorEntry*>(pEntry)->GetColor().GetColor()) ); } std::unique_ptr<XPropertyEntry> SvxUnoXColorTable::createEntry(const OUString& rName, const uno::Any& rAny) const @@ -264,7 +264,7 @@ std::unique_ptr<XPropertyEntry> SvxUnoXColorTable::createEntry(const OUString& r if( !(rAny >>= nColor) ) return std::unique_ptr<XPropertyEntry>(); - const Color aColor( (ColorData)nColor ); + const Color aColor( static_cast<ColorData>(nColor) ); return o3tl::make_unique<XColorEntry>(aColor, rName); } @@ -533,9 +533,9 @@ uno::Any SvxUnoXGradientTable::getAny( const XPropertyEntry* pEntry ) const thro awt::Gradient aGradient; aGradient.Style = aXGradient.GetGradientStyle(); - aGradient.StartColor = (sal_Int32)aXGradient.GetStartColor().GetColor(); - aGradient.EndColor = (sal_Int32)aXGradient.GetEndColor().GetColor(); - aGradient.Angle = (short)aXGradient.GetAngle(); + aGradient.StartColor = static_cast<sal_Int32>(aXGradient.GetStartColor().GetColor()); + aGradient.EndColor = static_cast<sal_Int32>(aXGradient.GetEndColor().GetColor()); + aGradient.Angle = static_cast<short>(aXGradient.GetAngle()); aGradient.Border = aXGradient.GetBorder(); aGradient.XOffset = aXGradient.GetXOffset(); aGradient.YOffset = aXGradient.GetYOffset(); diff --git a/svx/source/unodraw/gluepts.cxx b/svx/source/unodraw/gluepts.cxx index 9a2a7ab66d39..e934b3e8bf89 100644 --- a/svx/source/unodraw/gluepts.cxx +++ b/svx/source/unodraw/gluepts.cxx @@ -217,7 +217,7 @@ sal_Int32 SAL_CALL SvxUnoGluePointAccess::insert( const uno::Any& aElement ) mpObject->ActionChanged(); // mpObject->BroadcastObjectChange(); - return (sal_Int32)((*pList)[nId].GetId() + NON_USER_DEFINED_GLUE_POINTS) - 1; + return static_cast<sal_Int32>((*pList)[nId].GetId() + NON_USER_DEFINED_GLUE_POINTS) - 1; } throw lang::IllegalArgumentException(); @@ -231,7 +231,7 @@ void SAL_CALL SvxUnoGluePointAccess::removeByIdentifier( sal_Int32 Identifier ) { if( mpObject.is() && ( Identifier >= NON_USER_DEFINED_GLUE_POINTS )) { - const sal_uInt16 nId = (sal_uInt16)(Identifier - NON_USER_DEFINED_GLUE_POINTS) + 1; + const sal_uInt16 nId = static_cast<sal_uInt16>(Identifier - NON_USER_DEFINED_GLUE_POINTS) + 1; SdrGluePointList* pList = const_cast<SdrGluePointList*>(mpObject->GetGluePointList()); const sal_uInt16 nCount = pList ? pList->GetCount() : 0; @@ -264,7 +264,7 @@ void SAL_CALL SvxUnoGluePointAccess::replaceByIdentifer( sal_Int32 Identifier, c if( (Identifier < NON_USER_DEFINED_GLUE_POINTS) || !(aElement >>= aGluePoint)) throw lang::IllegalArgumentException(); - const sal_uInt16 nId = (sal_uInt16)( Identifier - NON_USER_DEFINED_GLUE_POINTS ) + 1; + const sal_uInt16 nId = static_cast<sal_uInt16>( Identifier - NON_USER_DEFINED_GLUE_POINTS ) + 1; SdrGluePointList* pList = const_cast< SdrGluePointList* >( mpObject->GetGluePointList() ); const sal_uInt16 nCount = pList ? pList->GetCount() : 0; @@ -298,14 +298,14 @@ uno::Any SAL_CALL SvxUnoGluePointAccess::getByIdentifier( sal_Int32 Identifier ) if( Identifier < NON_USER_DEFINED_GLUE_POINTS ) // default glue point? { - SdrGluePoint aTempPoint = mpObject->GetVertexGluePoint( (sal_uInt16)Identifier ); + SdrGluePoint aTempPoint = mpObject->GetVertexGluePoint( static_cast<sal_uInt16>(Identifier) ); aGluePoint.IsUserDefined = false; convert( aTempPoint, aGluePoint ); return uno::makeAny( aGluePoint ); } else { - const sal_uInt16 nId = (sal_uInt16)( Identifier - NON_USER_DEFINED_GLUE_POINTS ) + 1; + const sal_uInt16 nId = static_cast<sal_uInt16>( Identifier - NON_USER_DEFINED_GLUE_POINTS ) + 1; const SdrGluePointList* pList = mpObject->GetGluePointList(); const sal_uInt16 nCount = pList ? pList->GetCount() : 0; @@ -343,10 +343,10 @@ uno::Sequence< sal_Int32 > SAL_CALL SvxUnoGluePointAccess::getIdentifiers() sal_Int32 *pIdentifier = aIdSequence.getArray(); for( i = 0; i < NON_USER_DEFINED_GLUE_POINTS; i++ ) - *pIdentifier++ = (sal_Int32)i; + *pIdentifier++ = static_cast<sal_Int32>(i); for( i = 0; i < nCount; i++ ) - *pIdentifier++ = (sal_Int32) ( (*pList)[i].GetId() + NON_USER_DEFINED_GLUE_POINTS ) - 1; + *pIdentifier++ = static_cast<sal_Int32>( (*pList)[i].GetId() + NON_USER_DEFINED_GLUE_POINTS ) - 1; return aIdSequence; } @@ -399,7 +399,7 @@ void SAL_CALL SvxUnoGluePointAccess::removeByIndex( sal_Int32 Index ) Index -= 4; if( Index >= 0 && Index < pList->GetCount() ) { - pList->Delete( (sal_uInt16)Index ); + pList->Delete( static_cast<sal_uInt16>(Index) ); // only repaint, no objectchange mpObject->ActionChanged(); @@ -426,7 +426,7 @@ void SAL_CALL SvxUnoGluePointAccess::replaceByIndex( sal_Int32 Index, const uno: SdrGluePointList* pList = const_cast< SdrGluePointList* >( mpObject->GetGluePointList() ); if( pList && Index < pList->GetCount() ) { - SdrGluePoint& rGlue = (*pList)[(sal_uInt16)Index]; + SdrGluePoint& rGlue = (*pList)[static_cast<sal_uInt16>(Index)]; convert( aUnoGlue, rGlue ); // only repaint, no objectchange @@ -467,7 +467,7 @@ uno::Any SAL_CALL SvxUnoGluePointAccess::getByIndex( sal_Int32 Index ) if( Index < 4 ) // default glue point? { - SdrGluePoint aTempPoint = mpObject->GetVertexGluePoint( (sal_uInt16)Index ); + SdrGluePoint aTempPoint = mpObject->GetVertexGluePoint( static_cast<sal_uInt16>(Index) ); aGluePoint.IsUserDefined = false; convert( aTempPoint, aGluePoint ); return uno::Any(aGluePoint); @@ -478,7 +478,7 @@ uno::Any SAL_CALL SvxUnoGluePointAccess::getByIndex( sal_Int32 Index ) const SdrGluePointList* pList = mpObject->GetGluePointList(); if( pList && Index < pList->GetCount() ) { - const SdrGluePoint& rTempPoint = (*pList)[(sal_uInt16)Index]; + const SdrGluePoint& rTempPoint = (*pList)[static_cast<sal_uInt16>(Index)]; aGluePoint.IsUserDefined = true; convert( rTempPoint, aGluePoint ); return uno::Any(aGluePoint); diff --git a/svx/source/unodraw/unobrushitemhelper.cxx b/svx/source/unodraw/unobrushitemhelper.cxx index 8a19f5d1c510..6992e3d61ce3 100644 --- a/svx/source/unodraw/unobrushitemhelper.cxx +++ b/svx/source/unodraw/unobrushitemhelper.cxx @@ -129,7 +129,7 @@ void setSvxBrushItemAsFillAttributesToTargetSet(const SvxBrushItem& rBrush, SfxI // #125189# nTransparency is in range [0..254], convert to [0..100] which is used in // XFillTransparenceItem (caution with the range which is in an *item-specific* range) - rToSet.Put(XFillTransparenceItem((((sal_Int32)nTransparency * 100) + 127) / 254)); + rToSet.Put(XFillTransparenceItem(((static_cast<sal_Int32>(nTransparency) * 100) + 127) / 254)); } else { @@ -269,7 +269,7 @@ SvxBrushItem getSvxBrushItemFromSourceSet(const SfxItemSet& rSourceSet, sal_uInt sal_uInt16 nFillTransparence(getTransparenceForSvxBrushItem(rSourceSet, bSearchInParents)); // take half orig transparence, add half transparent, clamp result - nFillTransparence = basegfx::clamp((sal_uInt16)((nFillTransparence / 2) + 50), (sal_uInt16)0, (sal_uInt16)255); + nFillTransparence = basegfx::clamp(static_cast<sal_uInt16>((nFillTransparence / 2) + 50), sal_uInt16(0), sal_uInt16(255)); // #i125189# nFillTransparence is in range [0..100] and needs to be in [0..254] unsigned // It is necessary to use the maximum of 0xfe for transparence for the SvxBrushItem diff --git a/svx/source/unodraw/unoctabl.cxx b/svx/source/unodraw/unoctabl.cxx index 17e0817c2621..677809a5b39e 100644 --- a/svx/source/unodraw/unoctabl.cxx +++ b/svx/source/unodraw/unoctabl.cxx @@ -98,7 +98,7 @@ void SAL_CALL SvxUnoColorTable::insertByName( const OUString& aName, const uno:: if( pList.is() ) { - pList->Insert(o3tl::make_unique<XColorEntry>(Color((ColorData)nColor), aName)); + pList->Insert(o3tl::make_unique<XColorEntry>(Color(static_cast<ColorData>(nColor)), aName)); } } @@ -122,7 +122,7 @@ void SAL_CALL SvxUnoColorTable::replaceByName( const OUString& aName, const uno: if( nIndex == -1 ) throw container::NoSuchElementException(); - pList->Replace(nIndex, o3tl::make_unique<XColorEntry>(Color((ColorData)nColor), aName )); + pList->Replace(nIndex, o3tl::make_unique<XColorEntry>(Color(static_cast<ColorData>(nColor)), aName )); } // XNameAccess @@ -133,7 +133,7 @@ uno::Any SAL_CALL SvxUnoColorTable::getByName( const OUString& aName ) throw container::NoSuchElementException(); const XColorEntry* pEntry = pList->GetColor(nIndex); - return uno::Any( (sal_Int32) pEntry->GetColor().GetRGBColor() ); + return uno::Any( static_cast<sal_Int32>(pEntry->GetColor().GetRGBColor()) ); } uno::Sequence< OUString > SAL_CALL SvxUnoColorTable::getElementNames() diff --git a/svx/source/unodraw/unomod.cxx b/svx/source/unodraw/unomod.cxx index aa52fb535b3a..4f0ea1fcddab 100644 --- a/svx/source/unodraw/unomod.cxx +++ b/svx/source/unodraw/unomod.cxx @@ -174,7 +174,7 @@ css::uno::Reference<css::uno::XInterface> create( sal_uInt32 nType = UHashMap::getId( rServiceSpecifier ); if( nType != UHASHMAP_NOTFOUND ) { - sal_uInt16 nT = (sal_uInt16)(nType & ~E3D_INVENTOR_FLAG); + sal_uInt16 nT = static_cast<sal_uInt16>(nType & ~E3D_INVENTOR_FLAG); SdrInventor nI = (nType & E3D_INVENTOR_FLAG) ? SdrInventor::E3d : SdrInventor::Default; return uno::Reference< uno::XInterface >( static_cast<drawing::XShape*>(SvxDrawPage::CreateShapeByTypeAndInventor( nT, nI, nullptr, nullptr, referer )) ); @@ -589,7 +589,7 @@ uno::Any SAL_CALL SvxUnoDrawPagesAccess::getByIndex( sal_Int32 Index ) if( (Index < 0) || (Index >= mrModel.mpDoc->GetPageCount() ) ) throw lang::IndexOutOfBoundsException(); - SdrPage* pPage = mrModel.mpDoc->GetPage( (sal_uInt16)Index ); + SdrPage* pPage = mrModel.mpDoc->GetPage( static_cast<sal_uInt16>(Index) ); if( pPage ) { uno::Reference< uno::XInterface > xPage( pPage->mxUnoPage ); @@ -640,7 +640,7 @@ uno::Reference< drawing::XDrawPage > SAL_CALL SvxUnoDrawPagesAccess::insertNewBy else pPage = new SdrPage(*mrModel.mpDoc); - mrModel.mpDoc->InsertPage( pPage, (sal_uInt16)nIndex ); + mrModel.mpDoc->InsertPage( pPage, static_cast<sal_uInt16>(nIndex) ); xDrawPage.set( pPage->getUnoPage(), uno::UNO_QUERY ); } diff --git a/svx/source/unodraw/unopage.cxx b/svx/source/unodraw/unopage.cxx index 0860ff9c6e6f..20acc6c4bdd8 100644 --- a/svx/source/unodraw/unopage.cxx +++ b/svx/source/unodraw/unopage.cxx @@ -488,8 +488,8 @@ SdrObject *SvxDrawPage::CreateSdrObject_(const Reference< drawing::XShape > & xS { // initialise scene - double fW = (double)aSize.Width; - double fH = (double)aSize.Height; + double fW = static_cast<double>(aSize.Width); + double fH = static_cast<double>(aSize.Height); Camera3D aCam(pScene->GetCamera()); aCam.SetAutoAdjustProjection(false); @@ -556,12 +556,12 @@ void SvxDrawPage::GetTypeAndInventor( sal_uInt16& rType, SdrInventor& rInventor, else if(nTempType & E3D_INVENTOR_FLAG) { rInventor = SdrInventor::E3d; - rType = (sal_uInt16)(nTempType & ~E3D_INVENTOR_FLAG); + rType = static_cast<sal_uInt16>(nTempType & ~E3D_INVENTOR_FLAG); } else { rInventor = SdrInventor::Default; - rType = (sal_uInt16)nTempType; + rType = static_cast<sal_uInt16>(nTempType); switch( rType ) { diff --git a/svx/source/unodraw/unopool.cxx b/svx/source/unodraw/unopool.cxx index 7294394dd7e5..a3d0a4cbe479 100644 --- a/svx/source/unodraw/unopool.cxx +++ b/svx/source/unodraw/unopool.cxx @@ -115,7 +115,7 @@ void SvxUnoDrawPool::getAny( SfxItemPool const * pPool, const comphelper::Proper } default: { - const MapUnit eMapUnit = pPool->GetMetric((sal_uInt16)pEntry->mnHandle); + const MapUnit eMapUnit = pPool->GetMetric(static_cast<sal_uInt16>(pEntry->mnHandle)); sal_uInt8 nMemberId = pEntry->mnMemberId & (~SFX_METRIC_ITEM); if( eMapUnit == MapUnit::Map100thMM ) @@ -124,13 +124,13 @@ void SvxUnoDrawPool::getAny( SfxItemPool const * pPool, const comphelper::Proper // DVO, OD 10.10.2003 #i18732# // Assure, that ID is a Which-ID (it could be a Slot-ID.) // Thus, convert handle to Which-ID. - pPool->GetDefaultItem( pPool->GetWhich( (sal_uInt16)pEntry->mnHandle ) ).QueryValue( rValue, nMemberId ); + pPool->GetDefaultItem( pPool->GetWhich( static_cast<sal_uInt16>(pEntry->mnHandle) ) ).QueryValue( rValue, nMemberId ); } } // check for needed metric translation - const MapUnit eMapUnit = pPool->GetMetric((sal_uInt16)pEntry->mnHandle); + const MapUnit eMapUnit = pPool->GetMetric(static_cast<sal_uInt16>(pEntry->mnHandle)); if(pEntry->mnMemberId & SFX_METRIC_ITEM && eMapUnit != MapUnit::Map100thMM) { SvxUnoConvertToMM( eMapUnit, rValue ); @@ -149,7 +149,7 @@ void SvxUnoDrawPool::putAny( SfxItemPool* pPool, const comphelper::PropertyMapEn { uno::Any aValue( rValue ); - const MapUnit eMapUnit = pPool->GetMetric((sal_uInt16)pEntry->mnHandle); + const MapUnit eMapUnit = pPool->GetMetric(static_cast<sal_uInt16>(pEntry->mnHandle)); if(pEntry->mnMemberId & SFX_METRIC_ITEM && eMapUnit != MapUnit::Map100thMM) { SvxUnoConvertFromMM( eMapUnit, aValue ); @@ -158,7 +158,7 @@ void SvxUnoDrawPool::putAny( SfxItemPool* pPool, const comphelper::PropertyMapEn // DVO, OD 10.10.2003 #i18732# // Assure, that ID is a Which-ID (it could be a Slot-ID.) // Thus, convert handle to Which-ID. - const sal_uInt16 nWhich = pPool->GetWhich( (sal_uInt16)pEntry->mnHandle ); + const sal_uInt16 nWhich = pPool->GetWhich( static_cast<sal_uInt16>(pEntry->mnHandle) ); switch( nWhich ) { case OWN_ATTR_FILLBMP_MODE: @@ -236,7 +236,7 @@ void SvxUnoDrawPool::_getPropertyStates( const comphelper::PropertyMapEntry** pp // OD 13.10.2003 #i18732# // Assure, that ID is a Which-ID (it could be a Slot-ID.) // Thus, convert handle to Which-ID. - const sal_uInt16 nWhich = pPool->GetWhich( ((sal_uInt16)(*ppEntries)->mnHandle) ); + const sal_uInt16 nWhich = pPool->GetWhich( static_cast<sal_uInt16>((*ppEntries)->mnHandle) ); switch( nWhich ) { @@ -294,7 +294,7 @@ void SvxUnoDrawPool::_setPropertyToDefault( const comphelper::PropertyMapEntry* // OD 10.10.2003 #i18732# // Assure, that ID is a Which-ID (it could be a Slot-ID.) // Thus, convert handle to Which-ID. - const sal_uInt16 nWhich = pPool->GetWhich( (sal_uInt16)pEntry->mnHandle ); + const sal_uInt16 nWhich = pPool->GetWhich( static_cast<sal_uInt16>(pEntry->mnHandle) ); if ( pPool && pPool != mpDefaultsPool ) { // OD 13.10.2003 #i18732# - use method <ResetPoolDefaultItem(..)> @@ -311,7 +311,7 @@ uno::Any SvxUnoDrawPool::_getPropertyDefault( const comphelper::PropertyMapEntry // using probably incompatible item pool <mpDefaultsPool> uno::Any aAny; SfxItemPool* pPool = getModelPool( true ); - const sal_uInt16 nWhich = pPool->GetWhich( (sal_uInt16)pEntry->mnHandle ); + const sal_uInt16 nWhich = pPool->GetWhich( static_cast<sal_uInt16>(pEntry->mnHandle) ); const SfxPoolItem *pItem = pPool->GetPoolDefaultItem ( nWhich ); if (pItem) { diff --git a/svx/source/unodraw/unoshap2.cxx b/svx/source/unodraw/unoshap2.cxx index 668e7f4a8c77..35a07a496348 100644 --- a/svx/source/unodraw/unoshap2.cxx +++ b/svx/source/unodraw/unoshap2.cxx @@ -665,11 +665,11 @@ namespace // note that order matters: // lcl_convertTextAlignmentToParaAdjustment and lcl_convertParaAdjustmentToTextAlignment search this map from the _beginning_ // and use the first matching entry - {style::ParagraphAdjust_LEFT, (sal_Int16)awt::TextAlign::LEFT}, - {style::ParagraphAdjust_CENTER, (sal_Int16)awt::TextAlign::CENTER}, - {style::ParagraphAdjust_RIGHT, (sal_Int16)awt::TextAlign::RIGHT}, - {style::ParagraphAdjust_BLOCK, (sal_Int16)awt::TextAlign::RIGHT}, - {style::ParagraphAdjust_STRETCH, (sal_Int16)awt::TextAlign::LEFT}, + {style::ParagraphAdjust_LEFT, sal_Int16(awt::TextAlign::LEFT)}, + {style::ParagraphAdjust_CENTER, sal_Int16(awt::TextAlign::CENTER)}, + {style::ParagraphAdjust_RIGHT, sal_Int16(awt::TextAlign::RIGHT)}, + {style::ParagraphAdjust_BLOCK, sal_Int16(awt::TextAlign::RIGHT)}, + {style::ParagraphAdjust_STRETCH, sal_Int16(awt::TextAlign::LEFT)}, {(style::ParagraphAdjust)-1,-1} }; @@ -1031,7 +1031,7 @@ bool SvxShapePolyPolygon::setPropertyValueImpl( const OUString& rName, const Sfx void B2DPolyPolygonToSvxPointSequenceSequence( const basegfx::B2DPolyPolygon& rPolyPoly, drawing::PointSequenceSequence& rRetval ) { - if( (sal_uInt32)rRetval.getLength() != rPolyPoly.count() ) + if( static_cast<sal_uInt32>(rRetval.getLength()) != rPolyPoly.count() ) rRetval.realloc( rPolyPoly.count() ); // get pointer to external arrays @@ -1907,7 +1907,7 @@ bool SvxCustomShape::getPropertyValueImpl( const OUString& rName, const SfxItemP { double fAngle = static_cast<SdrObjCustomShape*>(mpObj.get())->GetObjectRotation(); fAngle *= 100; - rValue <<= (sal_Int32)fAngle; + rValue <<= static_cast<sal_Int32>(fAngle); return true; } default: diff --git a/svx/source/unodraw/unoshap3.cxx b/svx/source/unodraw/unoshap3.cxx index 9b9897ee8a5f..4f6bae7a7e8f 100644 --- a/svx/source/unodraw/unoshap3.cxx +++ b/svx/source/unodraw/unoshap3.cxx @@ -341,9 +341,9 @@ bool Svx3DSceneObject::setPropertyValueImpl( const OUString& rName, const SfxIte const SfxItemSet& rSceneSet = pScene->GetMergedItemSet(); double fCamPosZ = - (double)rSceneSet.Get(SDRATTR_3DSCENE_DISTANCE).GetValue(); + static_cast<double>(rSceneSet.Get(SDRATTR_3DSCENE_DISTANCE).GetValue()); double fCamFocal = - (double)rSceneSet.Get(SDRATTR_3DSCENE_FOCAL_LENGTH).GetValue(); + static_cast<double>(rSceneSet.Get(SDRATTR_3DSCENE_FOCAL_LENGTH).GetValue()); aCam.SetAutoAdjustProjection(false); aCam.SetViewWindow(- fW / 2, - fH / 2, fW, fH); @@ -352,7 +352,7 @@ bool Svx3DSceneObject::setPropertyValueImpl( const OUString& rName, const SfxIte aCam.SetPosAndLookAt(aCamPos, aLookAt); aCam.SetFocalLength(fCamFocal / 100.0); aCam.SetDefaults(basegfx::B3DPoint(0.0, 0.0, fCamPosZ), aLookAt); - aCam.SetDeviceWindow(tools::Rectangle(0, 0, (long)fW, (long)fH)); + aCam.SetDeviceWindow(tools::Rectangle(0, 0, static_cast<long>(fW), static_cast<long>(fH))); // set at scene pScene->SetCamera(aCam); diff --git a/svx/source/unodraw/unoshap4.cxx b/svx/source/unodraw/unoshap4.cxx index 5a0de83053eb..11d2f62e35b3 100644 --- a/svx/source/unodraw/unoshap4.cxx +++ b/svx/source/unodraw/unoshap4.cxx @@ -233,7 +233,7 @@ bool SvxOle2Shape::getPropertyValueImpl( const OUString& rName, const SfxItemPro if ( aLnk.GetType() == GfxLinkType::NativeWmf ) { bIsWMF = true; - uno::Sequence<sal_Int8> aSeq(reinterpret_cast<sal_Int8 const *>(aLnk.GetData()), (sal_Int32) aLnk.GetDataSize()); + uno::Sequence<sal_Int8> aSeq(reinterpret_cast<sal_Int8 const *>(aLnk.GetData()), static_cast<sal_Int32>(aLnk.GetDataSize())); rValue <<= aSeq; } } diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx index f61d4e384976..c1b9c4cbc52a 100644 --- a/svx/source/unodraw/unoshape.cxx +++ b/svx/source/unodraw/unoshape.cxx @@ -1954,7 +1954,7 @@ uno::Any SvxShape::GetAnyForItem( SfxItemSet const & aSet, const SfxItemProperty { sal_Int32 nValue = 0; aAny >>= nValue; - aAny <<= (sal_Int16)nValue; + aAny <<= static_cast<sal_Int16>(nValue); } else { @@ -2023,7 +2023,7 @@ beans::PropertyState SvxShape::_getPropertyState( const OUString& PropertyName ) case XATTR_FILLHATCH: case XATTR_LINEDASH: { - const NameOrIndex* pItem = rSet.GetItem<NameOrIndex>((sal_uInt16)pMap->nWID); + const NameOrIndex* pItem = rSet.GetItem<NameOrIndex>(static_cast<sal_uInt16>(pMap->nWID)); if( ( pItem == nullptr ) || pItem->GetName().isEmpty() ) eState = beans::PropertyState_DEFAULT_VALUE; } @@ -2038,7 +2038,7 @@ beans::PropertyState SvxShape::_getPropertyState( const OUString& PropertyName ) case XATTR_LINESTART: case XATTR_FILLFLOATTRANSPARENCE: { - const NameOrIndex* pItem = rSet.GetItem<NameOrIndex>((sal_uInt16)pMap->nWID); + const NameOrIndex* pItem = rSet.GetItem<NameOrIndex>(static_cast<sal_uInt16>(pMap->nWID)); if ( pItem == nullptr ) eState = beans::PropertyState_DEFAULT_VALUE; } @@ -2443,7 +2443,7 @@ bool SvxShape::setPropertyValueImpl( const OUString&, const SfxItemPropertySimpl { SdrModel* pModel = pPageObj->GetModel(); SdrPage* pNewPage = nullptr; - const sal_uInt16 nDestinationPageNum((sal_uInt16)((nPageNum << 1) - 1)); + const sal_uInt16 nDestinationPageNum(static_cast<sal_uInt16>((nPageNum << 1) - 1)); if(pModel) { @@ -2546,7 +2546,7 @@ bool SvxShape::getPropertyValueImpl( const OUString&, const SfxItemPropertySimpl case OWN_ATTR_ZORDER: { - rValue <<= (sal_Int32)mpObj->GetOrdNum(); + rValue <<= static_cast<sal_Int32>(mpObj->GetOrdNum()); break; } @@ -2756,11 +2756,11 @@ bool SvxShape::getPropertyValueImpl( const OUString&, const SfxItemPropertySimpl } case SDRATTR_ROTATEANGLE: - rValue <<= (sal_Int32)mpObj->GetRotateAngle(); + rValue <<= static_cast<sal_Int32>(mpObj->GetRotateAngle()); break; case SDRATTR_SHEARANGLE: - rValue <<= (sal_Int32)mpObj->GetShearAngle(); + rValue <<= static_cast<sal_Int32>(mpObj->GetShearAngle()); break; case OWN_ATTR_INTEROPGRABBAG: @@ -2847,7 +2847,7 @@ bool SvxShape::getPropertyValueImpl( const OUString&, const SfxItemPropertySimpl if ( aLnk.GetType() == GfxLinkType::NativeWmf ) { bIsWMF = true; - uno::Sequence<sal_Int8> aSeq(reinterpret_cast<sal_Int8 const *>(aLnk.GetData()), (sal_Int32) aLnk.GetDataSize()); + uno::Sequence<sal_Int8> aSeq(reinterpret_cast<sal_Int8 const *>(aLnk.GetData()), static_cast<sal_Int32>(aLnk.GetDataSize())); rValue <<= aSeq; } } @@ -3786,7 +3786,7 @@ void SAL_CALL SvxShape::setActionLocks( sal_Int16 nLock ) if( (mnLockCount != 0) && (nLock == 0) ) lock(); - mnLockCount = (sal_uInt16)nLock; + mnLockCount = static_cast<sal_uInt16>(nLock); } @@ -3797,7 +3797,7 @@ sal_Int16 SAL_CALL SvxShape::resetActionLocks( ) if( mnLockCount != 0 ) unlock(); - sal_Int16 nOldLocks = (sal_Int16)mnLockCount; + sal_Int16 nOldLocks = static_cast<sal_Int16>(mnLockCount); mnLockCount = 0; return nOldLocks; diff --git a/svx/source/xoutdev/_xoutbmp.cxx b/svx/source/xoutdev/_xoutbmp.cxx index bd16f0113c65..94f8d3f2cc5b 100644 --- a/svx/source/xoutdev/_xoutbmp.cxx +++ b/svx/source/xoutdev/_xoutbmp.cxx @@ -463,7 +463,7 @@ Bitmap XOutBitmap::DetectEdges( const Bitmap& rBmp, const sal_uInt8 cThreshold ) const long nWidth2 = nWidth - 2; const long nHeight = aSize.Height(); const long nHeight2 = nHeight - 2; - const long lThres2 = (long) cThreshold * cThreshold; + const long lThres2 = static_cast<long>(cThreshold) * cThreshold; const sal_uInt8 nWhitePalIdx(static_cast< sal_uInt8 >(pWriteAcc->GetBestPaletteIndex(Color(COL_WHITE)))); const sal_uInt8 nBlackPalIdx(static_cast< sal_uInt8 >(pWriteAcc->GetBestPaletteIndex(Color(COL_BLACK)))); long nSum1; @@ -484,17 +484,17 @@ Bitmap XOutBitmap::DetectEdges( const Bitmap& rBmp, const sal_uInt8 cThreshold ) nXTmp = nX; nSum1 = -( nSum2 = lGray = pReadAcc->GetPixelIndex( nY, nXTmp++ ) ); - nSum2 += ( (long) pReadAcc->GetPixelIndex( nY, nXTmp++ ) ) << 1; + nSum2 += static_cast<long>(pReadAcc->GetPixelIndex( nY, nXTmp++ )) << 1; nSum1 += ( lGray = pReadAcc->GetPixelIndex( nY, nXTmp ) ); nSum2 += lGray; - nSum1 += ( (long) pReadAcc->GetPixelIndex( nY1, nXTmp ) ) << 1; - nSum1 -= ( (long) pReadAcc->GetPixelIndex( nY1, nXTmp -= 2 ) ) << 1; + nSum1 += static_cast<long>(pReadAcc->GetPixelIndex( nY1, nXTmp )) << 1; + nSum1 -= static_cast<long>(pReadAcc->GetPixelIndex( nY1, nXTmp -= 2 )) << 1; - nSum1 += ( lGray = -(long) pReadAcc->GetPixelIndex( nY2, nXTmp++ ) ); + nSum1 += ( lGray = -static_cast<long>(pReadAcc->GetPixelIndex( nY2, nXTmp++ )) ); nSum2 += lGray; - nSum2 -= ( (long) pReadAcc->GetPixelIndex( nY2, nXTmp++ ) ) << 1; - nSum1 += ( lGray = (long) pReadAcc->GetPixelIndex( nY2, nXTmp ) ); + nSum2 -= static_cast<long>(pReadAcc->GetPixelIndex( nY2, nXTmp++ )) << 1; + nSum1 += ( lGray = static_cast<long>(pReadAcc->GetPixelIndex( nY2, nXTmp )) ); nSum2 -= lGray; if( ( nSum1 * nSum1 + nSum2 * nSum2 ) < lThres2 ) @@ -556,8 +556,8 @@ tools::Polygon XOutBitmap::GetContour( const Bitmap& rBmp, const XOutFlags nFlag if (pAcc && nWidth && nHeight) { const Size& rPrefSize = aWorkBmp.GetPrefSize(); - const double fFactorX = (double) rPrefSize.Width() / nWidth; - const double fFactorY = (double) rPrefSize.Height() / nHeight; + const double fFactorX = static_cast<double>(rPrefSize.Width()) / nWidth; + const double fFactorY = static_cast<double>(rPrefSize.Height()) / nHeight; const long nStartX1 = aWorkRect.Left() + 1; const long nEndX1 = aWorkRect.Right(); const long nStartX2 = nEndX1 - 1; diff --git a/svx/source/xoutdev/_xpoly.cxx b/svx/source/xoutdev/_xpoly.cxx index 2fdc6f028ab5..4718a873228e 100644 --- a/svx/source/xoutdev/_xpoly.cxx +++ b/svx/source/xoutdev/_xpoly.cxx @@ -244,8 +244,8 @@ XPolygon::XPolygon(const tools::Rectangle& rRect, long nRx, long nRy) nRx = -nRx; // factor for control points of the Bézier curve: 8/3 * (sin(45g) - 0.5) - long nXHdl = (long)(0.552284749 * nRx); - long nYHdl = (long)(0.552284749 * nRy); + long nXHdl = static_cast<long>(0.552284749 * nRx); + long nYHdl = static_cast<long>(0.552284749 * nRy); sal_uInt16 nPos = 0; if ( nRx && nRy ) @@ -300,8 +300,8 @@ XPolygon::XPolygon(const Point& rCenter, long nRx, long nRy, bool bFull = (nStartAngle == 0 && nEndAngle == 3600); // factor for control points of the Bézier curve: 8/3 * (sin(45g) - 0.5) - long nXHdl = (long)(0.552284749 * nRx); - long nYHdl = (long)(0.552284749 * nRy); + long nXHdl = static_cast<long>(0.552284749 * nRx); + long nYHdl = static_cast<long>(0.552284749 * nRy); sal_uInt16 nPos = 0; bool bLoopEnd = false; @@ -532,27 +532,27 @@ void XPolygon::SubdivideBezier(sal_uInt16 nPos, bool bCalcFirst, double fT) nPosInc = 1; nIdxInc = 1; } - pPoints[nPos].X() = (long) (fU3 * pPoints[nIdx ].X() + + pPoints[nPos].X() = static_cast<long>(fU3 * pPoints[nIdx ].X() + fT * fU2 * pPoints[nIdx+1].X() * 3 + fT2 * fU * pPoints[nIdx+2].X() * 3 + fT3 * pPoints[nIdx+3].X()); - pPoints[nPos].Y() = (long) (fU3 * pPoints[nIdx ].Y() + + pPoints[nPos].Y() = static_cast<long>(fU3 * pPoints[nIdx ].Y() + fT * fU2 * pPoints[nIdx+1].Y() * 3 + fT2 * fU * pPoints[nIdx+2].Y() * 3 + fT3 * pPoints[nIdx+3].Y()); nPos = nPos + nPosInc; nIdx = nIdx + nIdxInc; - pPoints[nPos].X() = (long) (fU2 * pPoints[nIdx ].X() + + pPoints[nPos].X() = static_cast<long>(fU2 * pPoints[nIdx ].X() + fT * fU * pPoints[nIdx+1].X() * 2 + fT2 * pPoints[nIdx+2].X()); - pPoints[nPos].Y() = (long) (fU2 * pPoints[nIdx ].Y() + + pPoints[nPos].Y() = static_cast<long>(fU2 * pPoints[nIdx ].Y() + fT * fU * pPoints[nIdx+1].Y() * 2 + fT2 * pPoints[nIdx+2].Y()); nPos = nPos + nPosInc; nIdx = nIdx + nIdxInc; - pPoints[nPos].X() = (long) (fU * pPoints[nIdx ].X() + + pPoints[nPos].X() = static_cast<long>(fU * pPoints[nIdx ].X() + fT * pPoints[nIdx+1].X()); - pPoints[nPos].Y() = (long) (fU * pPoints[nIdx ].Y() + + pPoints[nPos].Y() = static_cast<long>(fU * pPoints[nIdx ].Y() + fT * pPoints[nIdx+1].Y()); } @@ -594,9 +594,9 @@ void XPolygon::GenBezArc(const Point& rCenter, long nRx, long nRy, pPoints[nFirst+1].X() += nXHdl; pPoints[nFirst+2].Y() += nYHdl; } if ( nStart > 0 ) - SubdivideBezier(nFirst, false, (double)nStart / 900); + SubdivideBezier(nFirst, false, static_cast<double>(nStart) / 900); if ( nEnd < 900 ) - SubdivideBezier(nFirst, true, (double)(nEnd-nStart) / (900-nStart)); + SubdivideBezier(nFirst, true, static_cast<double>(nEnd-nStart) / (900-nStart)); SetFlags(nFirst+1, PolyFlags::Control); SetFlags(nFirst+2, PolyFlags::Control); } @@ -649,8 +649,8 @@ void XPolygon::CalcSmoothJoin(sal_uInt16 nCenter, sal_uInt16 nDrag, sal_uInt16 n // keep the length if SMOOTH if ( GetFlags(nCenter) == PolyFlags::Smooth || !IsControl(nDrag) ) { - aDiff.X() = (long) (fRatio * aDiff.X()); - aDiff.Y() = (long) (fRatio * aDiff.Y()); + aDiff.X() = static_cast<long>(fRatio * aDiff.X()); + aDiff.Y() = static_cast<long>(fRatio * aDiff.Y()); } pPoints[nPnt] = pPoints[nCenter] - aDiff; } @@ -682,10 +682,10 @@ void XPolygon::CalcTangent(sal_uInt16 nCenter, sal_uInt16 nPrev, sal_uInt16 nNex fPrevLen = (fNextLen + fPrevLen) / 2; fNextLen = fPrevLen; } - rNext.X() = rCenter.X() + (long) (fNextLen * aDiff.X()); - rNext.Y() = rCenter.Y() + (long) (fNextLen * aDiff.Y()); - rPrev.X() = rCenter.X() - (long) (fPrevLen * aDiff.X()); - rPrev.Y() = rCenter.Y() - (long) (fPrevLen * aDiff.Y()); + rNext.X() = rCenter.X() + static_cast<long>(fNextLen * aDiff.X()); + rNext.Y() = rCenter.Y() + static_cast<long>(fNextLen * aDiff.Y()); + rPrev.X() = rCenter.X() - static_cast<long>(fPrevLen * aDiff.X()); + rPrev.Y() = rCenter.Y() - static_cast<long>(fPrevLen * aDiff.Y()); } /// convert four polygon points into a Bézier curve @@ -749,8 +749,8 @@ void XPolygon::PointsToBezier(sal_uInt16 nFirst) fY2 -= fY1 * fU2 / fT2; fY2 -= fY3 * fT2 / (fU2 * 3); - pPoints[nFirst+1] = Point((long) fX1, (long) fY1); - pPoints[nFirst+2] = Point((long) fX2, (long) fY2); + pPoints[nFirst+1] = Point(static_cast<long>(fX1), static_cast<long>(fY1)); + pPoints[nFirst+2] = Point(static_cast<long>(fX2), static_cast<long>(fY2)); SetFlags(nFirst+1, PolyFlags::Control); SetFlags(nFirst+2, PolyFlags::Control); } @@ -765,8 +765,8 @@ void XPolygon::Scale(double fSx, double fSy) for (sal_uInt16 i = 0; i < nPntCnt; i++) { Point& rPnt = pImpXPolygon->pPointAry[i]; - rPnt.X() = (long)(fSx * rPnt.X()); - rPnt.Y() = (long)(fSy * rPnt.Y()); + rPnt.X() = static_cast<long>(fSx * rPnt.X()); + rPnt.Y() = static_cast<long>(fSy * rPnt.Y()); } } @@ -817,14 +817,14 @@ void XPolygon::Distort(const tools::Rectangle& rRefRect, double fTx, fTy, fUx, fUy; Point& rPnt = pImpXPolygon->pPointAry[i]; - fTx = (double)(rPnt.X() - Xr) / Wr; - fTy = (double)(rPnt.Y() - Yr) / Hr; + fTx = static_cast<double>(rPnt.X() - Xr) / Wr; + fTy = static_cast<double>(rPnt.Y() - Yr) / Hr; fUx = 1.0 - fTx; fUy = 1.0 - fTy; - rPnt.X() = (long) ( fUy * (fUx * X1 + fTx * X2) + + rPnt.X() = static_cast<long>( fUy * (fUx * X1 + fTx * X2) + fTy * (fUx * X3 + fTx * X4) ); - rPnt.Y() = (long) ( fUx * (fUy * Y1 + fTy * Y3) + + rPnt.Y() = static_cast<long>( fUx * (fUy * Y1 + fTy * Y3) + fTx * (fUy * Y2 + fTy * Y4) ); } } @@ -928,7 +928,7 @@ void XPolyPolygon::Clear() sal_uInt16 XPolyPolygon::Count() const { - return (sal_uInt16)(pImpXPolyPolygon->aXPolyList.size()); + return static_cast<sal_uInt16>(pImpXPolyPolygon->aXPolyList.size()); } tools::Rectangle XPolyPolygon::GetBoundRect() const diff --git a/svx/source/xoutdev/xattr.cxx b/svx/source/xoutdev/xattr.cxx index 024f41d93d2f..452f8b3fb5f4 100644 --- a/svx/source/xoutdev/xattr.cxx +++ b/svx/source/xoutdev/xattr.cxx @@ -294,7 +294,7 @@ const Color& XColorItem::GetColorValue() const bool XColorItem::QueryValue( css::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const { - rVal <<= (sal_Int32)GetColorValue().GetRGBColor(); + rVal <<= static_cast<sal_Int32>(GetColorValue().GetRGBColor()); return true; } @@ -411,9 +411,9 @@ double XDash::CreateDotDashArray(::std::vector< double >& rDotDashArray, double rDotDashArray.resize( nNumDotDashArray, 0.0 ); sal_uInt16 a; sal_uInt16 nIns(0); - double fDashDotDistance = (double)GetDistance(); - double fSingleDashLen = (double)GetDashLen(); - double fSingleDotLen = (double)GetDotLen(); + double fDashDotDistance = static_cast<double>(GetDistance()); + double fSingleDashLen = static_cast<double>(GetDashLen()); + double fSingleDotLen = static_cast<double>(GetDotLen()); if (fLineWidth == 0.0) fLineWidth = SMALLEST_DASH_WIDTH; @@ -789,7 +789,7 @@ bool XLineDashItem::PutValue( const css::uno::Any& rVal, sal_uInt8 nMemberId ) return false; XDash aXDash = GetDashValue(); - aXDash.SetDashStyle((css::drawing::DashStyle)((sal_uInt16)nVal)); + aXDash.SetDashStyle((css::drawing::DashStyle)static_cast<sal_uInt16>(nVal)); if((0 == aXDash.GetDots()) && (0 == aXDash.GetDashes())) aXDash.SetDots(1); @@ -888,7 +888,7 @@ bool XLineWidthItem::GetPresentation OUString& rText, const IntlWrapper& rIntl ) const { - rText = GetMetricText( (long) GetValue(), + rText = GetMetricText( static_cast<long>(GetValue()), eCoreUnit, ePresUnit, &rIntl) + " " + EditResId( GetMetricId( ePresUnit) ); return true; @@ -946,7 +946,7 @@ bool XLineColorItem::GetPresentation bool XLineColorItem::QueryValue( css::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const { - rVal <<= (sal_Int32)GetColorValue().GetRGBColor(); + rVal <<= static_cast<sal_Int32>(GetColorValue().GetRGBColor()); return true; } @@ -1603,7 +1603,7 @@ bool XLineStartWidthItem::GetPresentation OUString& rText, const IntlWrapper& rIntl ) const { - rText = GetMetricText( (long) GetValue(), + rText = GetMetricText( static_cast<long>(GetValue()), eCoreUnit, ePresUnit, &rIntl) + " " + EditResId( GetMetricId( ePresUnit) ); return true; @@ -1641,7 +1641,7 @@ bool XLineEndWidthItem::GetPresentation OUString& rText, const IntlWrapper& rIntl ) const { - rText = GetMetricText( (long) GetValue(), + rText = GetMetricText( static_cast<long>(GetValue()), eCoreUnit, ePresUnit, &rIntl) + " " + EditResId( GetMetricId( ePresUnit) ); return true; @@ -1868,7 +1868,7 @@ bool XFillColorItem::GetPresentation bool XFillColorItem::QueryValue( css::uno::Any& rVal, sal_uInt8 /*nMemberId*/) const { - rVal <<= (sal_Int32)GetColorValue().GetRGBColor(); + rVal <<= static_cast<sal_Int32>(GetColorValue().GetRGBColor()); return true; } @@ -2046,9 +2046,9 @@ bool XFillGradientItem::QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId ) c const XGradient& aXGradient = GetGradientValue(); aGradient2.Style = aXGradient.GetGradientStyle(); - aGradient2.StartColor = (sal_Int32)aXGradient.GetStartColor().GetColor(); - aGradient2.EndColor = (sal_Int32)aXGradient.GetEndColor().GetColor(); - aGradient2.Angle = (short)aXGradient.GetAngle(); + aGradient2.StartColor = static_cast<sal_Int32>(aXGradient.GetStartColor().GetColor()); + aGradient2.EndColor = static_cast<sal_Int32>(aXGradient.GetEndColor().GetColor()); + aGradient2.Angle = static_cast<short>(aXGradient.GetAngle()); aGradient2.Border = aXGradient.GetBorder(); aGradient2.XOffset = aXGradient.GetXOffset(); aGradient2.YOffset = aXGradient.GetYOffset(); @@ -2070,9 +2070,9 @@ bool XFillGradientItem::QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId ) c css::awt::Gradient aGradient2; aGradient2.Style = aXGradient.GetGradientStyle(); - aGradient2.StartColor = (sal_Int32)aXGradient.GetStartColor().GetColor(); - aGradient2.EndColor = (sal_Int32)aXGradient.GetEndColor().GetColor(); - aGradient2.Angle = (short)aXGradient.GetAngle(); + aGradient2.StartColor = static_cast<sal_Int32>(aXGradient.GetStartColor().GetColor()); + aGradient2.EndColor = static_cast<sal_Int32>(aXGradient.GetEndColor().GetColor()); + aGradient2.Angle = static_cast<short>(aXGradient.GetAngle()); aGradient2.Border = aXGradient.GetBorder(); aGradient2.XOffset = aXGradient.GetXOffset(); aGradient2.YOffset = aXGradient.GetYOffset(); @@ -2091,9 +2091,9 @@ bool XFillGradientItem::QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId ) c } case MID_GRADIENT_STYLE: rVal <<= (sal_Int16)GetGradientValue().GetGradientStyle(); break; - case MID_GRADIENT_STARTCOLOR: rVal <<= (sal_Int32)GetGradientValue().GetStartColor().GetColor(); break; - case MID_GRADIENT_ENDCOLOR: rVal <<= (sal_Int32)GetGradientValue().GetEndColor().GetColor(); break; - case MID_GRADIENT_ANGLE: rVal <<= (sal_Int16)GetGradientValue().GetAngle(); break; + case MID_GRADIENT_STARTCOLOR: rVal <<= static_cast<sal_Int32>(GetGradientValue().GetStartColor().GetColor()); break; + case MID_GRADIENT_ENDCOLOR: rVal <<= static_cast<sal_Int32>(GetGradientValue().GetEndColor().GetColor()); break; + case MID_GRADIENT_ANGLE: rVal <<= static_cast<sal_Int16>(GetGradientValue().GetAngle()); break; case MID_GRADIENT_BORDER: rVal <<= GetGradientValue().GetBorder(); break; case MID_GRADIENT_XOFFSET: rVal <<= GetGradientValue().GetXOffset(); break; case MID_GRADIENT_YOFFSET: rVal <<= GetGradientValue().GetYOffset(); break; @@ -2496,7 +2496,7 @@ bool XFillHatchItem::QueryValue( css::uno::Any& rVal, sal_uInt8 nMemberId ) cons case MID_HATCH_STYLE: rVal <<= aHatch.GetHatchStyle(); break; case MID_HATCH_COLOR: - rVal <<= (sal_Int32)aHatch.GetColor().GetColor(); break; + rVal <<= static_cast<sal_Int32>(aHatch.GetColor().GetColor()); break; case MID_HATCH_DISTANCE: rVal <<= aHatch.GetDistance(); break; case MID_HATCH_ANGLE: diff --git a/svx/source/xoutdev/xexch.cxx b/svx/source/xoutdev/xexch.cxx index 68f7d5bb1818..d0ead7dfa21a 100644 --- a/svx/source/xoutdev/xexch.cxx +++ b/svx/source/xoutdev/xexch.cxx @@ -61,7 +61,7 @@ SvStream& WriteXFillExchangeData( SvStream& rOStm, const XFillExchangeData& rDat if( SfxItemState::SET == rData.pXFillAttrSetItem->GetItemSet().GetItemState( nWhich, false, &pItem ) ) { VersionCompat aCompat( rOStm, StreamMode::WRITE ); - const sal_uInt16 nItemVersion2 = pItem->GetVersion( (sal_uInt16) rOStm.GetVersion() ); + const sal_uInt16 nItemVersion2 = pItem->GetVersion( static_cast<sal_uInt16>(rOStm.GetVersion()) ); rOStm.WriteUInt16( nWhich ).WriteUInt16( nItemVersion2 ); pItem->Store( rOStm, nItemVersion2 ); diff --git a/svx/source/xoutdev/xtabgrdt.cxx b/svx/source/xoutdev/xtabgrdt.cxx index f8257a6bfbcf..c068547c4c01 100644 --- a/svx/source/xoutdev/xtabgrdt.cxx +++ b/svx/source/xoutdev/xtabgrdt.cxx @@ -104,7 +104,7 @@ Bitmap XGradientList::CreateBitmap( long nIndex, const Size& rSize ) const if(nStartIntens != 100) { const basegfx::BColor aBlack; - aStart = interpolate(aBlack, aStart, (double)nStartIntens * 0.01); + aStart = interpolate(aBlack, aStart, static_cast<double>(nStartIntens) * 0.01); } const sal_uInt16 nEndIntens(rGradient.GetEndIntens()); @@ -113,7 +113,7 @@ Bitmap XGradientList::CreateBitmap( long nIndex, const Size& rSize ) const if(nEndIntens != 100) { const basegfx::BColor aBlack; - aEnd = interpolate(aBlack, aEnd, (double)nEndIntens * 0.01); + aEnd = interpolate(aBlack, aEnd, static_cast<double>(nEndIntens) * 0.01); } drawinglayer::attribute::GradientStyle aGradientStyle(drawinglayer::attribute::GradientStyle::Rect); @@ -155,10 +155,10 @@ Bitmap XGradientList::CreateBitmap( long nIndex, const Size& rSize ) const const sal_uInt16 nSteps((rSize.Width() + rSize.Height()) / 3); const drawinglayer::attribute::FillGradientAttribute aFillGradient( aGradientStyle, - (double)rGradient.GetBorder() * 0.01, - (double)rGradient.GetXOffset() * 0.01, - (double)rGradient.GetYOffset() * 0.01, - (double)rGradient.GetAngle() * F_PI1800, + static_cast<double>(rGradient.GetBorder()) * 0.01, + static_cast<double>(rGradient.GetXOffset()) * 0.01, + static_cast<double>(rGradient.GetYOffset()) * 0.01, + static_cast<double>(rGradient.GetAngle()) * F_PI1800, aStart, aEnd, nSteps); diff --git a/svx/source/xoutdev/xtabhtch.cxx b/svx/source/xoutdev/xtabhtch.cxx index 8d0dcaeb9800..788f80e328a1 100644 --- a/svx/source/xoutdev/xtabhtch.cxx +++ b/svx/source/xoutdev/xtabhtch.cxx @@ -118,8 +118,8 @@ Bitmap XHatchList::CreateBitmap( long nIndex, const Size& rSize) const const drawinglayer::attribute::FillHatchAttribute aFillHatch( aHatchStyle, - (double)rHatch.GetDistance() * fScaleValue, - (double)rHatch.GetAngle() * F_PI1800, + static_cast<double>(rHatch.GetDistance()) * fScaleValue, + static_cast<double>(rHatch.GetAngle()) * F_PI1800, rHatch.GetColor().getBColor(), 3, // same default as VCL, a minimum of three discrete units (pixels) offset false); diff --git a/svx/source/xoutdev/xtable.cxx b/svx/source/xoutdev/xtable.cxx index 7d0f1c149d28..b77c250e9553 100644 --- a/svx/source/xoutdev/xtable.cxx +++ b/svx/source/xoutdev/xtable.cxx @@ -126,7 +126,7 @@ XPropertyList::XPropertyList( bool XPropertyList::isValidIdx(long nIndex) const { - return ((size_t)nIndex < maList.size() && nIndex >= 0); + return (static_cast<size_t>(nIndex) < maList.size() && nIndex >= 0); } |