From 08857f1401d85562cd34619c3b4eec15b23769eb Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Mon, 15 Jan 2018 09:02:04 +0100 Subject: More loplugin:cstylecast: toolkit Change-Id: I65b3c17c516d364326ce6dc3f7ba90c885a3e5e3 --- toolkit/source/awt/vclxgraphics.cxx | 4 ++-- toolkit/source/awt/vclxmenu.cxx | 4 ++-- toolkit/source/awt/vclxpointer.cxx | 4 ++-- toolkit/source/awt/vclxwindow.cxx | 8 ++++---- toolkit/source/awt/vclxwindows.cxx | 10 +++++----- toolkit/source/controls/unocontrolmodel.cxx | 12 ++++++------ toolkit/source/helper/vclunohelper.cxx | 20 ++++++++++---------- 7 files changed, 31 insertions(+), 31 deletions(-) (limited to 'toolkit') diff --git a/toolkit/source/awt/vclxgraphics.cxx b/toolkit/source/awt/vclxgraphics.cxx index a250142a5952..fac87df6f571 100644 --- a/toolkit/source/awt/vclxgraphics.cxx +++ b/toolkit/source/awt/vclxgraphics.cxx @@ -220,7 +220,7 @@ void VCLXGraphics::setRasterOp( awt::RasterOperation eROP ) { SolarMutexGuard aGuard; - meRasterOp = (RasterOp)eROP; + meRasterOp = static_cast(eROP); } void VCLXGraphics::setClipRegion( const uno::Reference< awt::XRegion >& rxRegion ) @@ -460,7 +460,7 @@ void VCLXGraphics::drawGradient( sal_Int32 x, sal_Int32 y, sal_Int32 width, sal_ if( mpOutputDevice ) { InitOutputDevice( InitOutDevFlags::COLORS ); - Gradient aGradient((GradientStyle)rGradient.Style, rGradient.StartColor, rGradient.EndColor); + Gradient aGradient(static_cast(rGradient.Style), rGradient.StartColor, rGradient.EndColor); aGradient.SetAngle(rGradient.Angle); aGradient.SetBorder(rGradient.Border); aGradient.SetOfsX(rGradient.XOffset); diff --git a/toolkit/source/awt/vclxmenu.cxx b/toolkit/source/awt/vclxmenu.cxx index 1aeb497bfa8f..02006e87de31 100644 --- a/toolkit/source/awt/vclxmenu.cxx +++ b/toolkit/source/awt/vclxmenu.cxx @@ -309,7 +309,7 @@ void VCLXMenu::insertItem( ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); if ( mpMenu ) - mpMenu->InsertItem(nItemId, aText, (MenuItemBits)nItemStyle, OString(), nPos); + mpMenu->InsertItem(nItemId, aText, static_cast(nItemStyle), OString(), nPos); } void VCLXMenu::removeItem( @@ -657,7 +657,7 @@ css::awt::MenuItemType SAL_CALL VCLXMenu::getItemType( css::awt::MenuItemType_DONTKNOW; if ( mpMenu ) { - aMenuItemType = ( (css::awt::MenuItemType) mpMenu->GetItemType( nItemPos ) ); + aMenuItemType = static_cast(mpMenu->GetItemType( nItemPos )); } return aMenuItemType; diff --git a/toolkit/source/awt/vclxpointer.cxx b/toolkit/source/awt/vclxpointer.cxx index 018c335afc18..19cc2735f963 100644 --- a/toolkit/source/awt/vclxpointer.cxx +++ b/toolkit/source/awt/vclxpointer.cxx @@ -37,14 +37,14 @@ void VCLXPointer::setType( sal_Int32 nType ) { ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - maPointer = Pointer( (PointerStyle)nType ); + maPointer = Pointer( static_cast(nType) ); } sal_Int32 VCLXPointer::getType() { ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); - return (sal_Int32)maPointer.GetStyle(); + return static_cast(maPointer.GetStyle()); } OUString VCLXPointer::getImplementationName() diff --git a/toolkit/source/awt/vclxwindow.cxx b/toolkit/source/awt/vclxwindow.cxx index fb1fdb11a1cb..6142b15140a3 100644 --- a/toolkit/source/awt/vclxwindow.cxx +++ b/toolkit/source/awt/vclxwindow.cxx @@ -1551,7 +1551,7 @@ void VCLXWindow::setProperty( const OUString& PropertyName, const css::uno::Any& if ( Value >>= n ) { vcl::Font aFont = pWindow->GetControlFont(); - aFont.SetRelief( (FontRelief)n ); + aFont.SetRelief( static_cast(n) ); pWindow->SetControlFont( aFont ); } } @@ -1562,7 +1562,7 @@ void VCLXWindow::setProperty( const OUString& PropertyName, const css::uno::Any& if ( Value >>= n ) { vcl::Font aFont = pWindow->GetControlFont(); - aFont.SetEmphasisMark( (FontEmphasisMark)n ); + aFont.SetEmphasisMark( static_cast(n) ); pWindow->SetControlFont( aFont ); } } @@ -2007,10 +2007,10 @@ css::uno::Any VCLXWindow::getProperty( const OUString& PropertyName ) aProp <<= static_cast(GetWindow()->GetDisplayBackground().GetColor().GetColor()); break; case BASEPROPERTY_FONTRELIEF: - aProp <<= (sal_Int16) GetWindow()->GetControlFont().GetRelief(); + aProp <<= static_cast(GetWindow()->GetControlFont().GetRelief()); break; case BASEPROPERTY_FONTEMPHASISMARK: - aProp <<= (sal_Int16) GetWindow()->GetControlFont().GetEmphasisMark(); + aProp <<= static_cast(GetWindow()->GetControlFont().GetEmphasisMark()); break; case BASEPROPERTY_TEXTCOLOR: aProp <<= static_cast(GetWindow()->GetControlForeground().GetColor()); diff --git a/toolkit/source/awt/vclxwindows.cxx b/toolkit/source/awt/vclxwindows.cxx index 70bea4148914..d984f94f66a1 100644 --- a/toolkit/source/awt/vclxwindows.cxx +++ b/toolkit/source/awt/vclxwindows.cxx @@ -517,7 +517,7 @@ void VCLXButton::setProperty( const OUString& PropertyName, const css::uno::Any& { sal_Int16 n = sal_Int16(); if ( Value >>= n ) - static_cast(pButton.get())->SetState( (TriState)n ); + static_cast(pButton.get())->SetState( static_cast(n) ); } } break; @@ -4813,7 +4813,7 @@ void VCLXDateField::setProperty( const OUString& PropertyName, const css::uno::A { sal_Int16 n = sal_Int16(); if ( Value >>= n ) - GetAs< DateField >()->SetExtDateFormat( (ExtDateFieldFormat) n ); + GetAs< DateField >()->SetExtDateFormat( static_cast(n) ); } break; case BASEPROPERTY_DATESHOWCENTURY: @@ -5296,7 +5296,7 @@ void VCLXTimeField::setProperty( const OUString& PropertyName, const css::uno::A { sal_Int16 n = sal_Int16(); if ( Value >>= n ) - GetAs< TimeField >()->SetExtFormat( (ExtTimeFieldFormat) n ); + GetAs< TimeField >()->SetExtFormat( static_cast(n) ); } break; case BASEPROPERTY_ENFORCE_FORMAT: @@ -5772,7 +5772,7 @@ IMPL_XTYPEPROVIDER_START( VCLXMetricField ) IMPL_XTYPEPROVIDER_END // FIXME: later ... -#define MetricUnitUnoToVcl(a) ((FieldUnit)(a)) +#define MetricUnitUnoToVcl(a) (static_cast(a)) #define METRIC_MAP_PAIR(method,parent) \ sal_Int64 VCLXMetricField::get##method( sal_Int16 nUnit ) \ @@ -5896,7 +5896,7 @@ void VCLXMetricField::setProperty( const OUString& PropertyName, const css::uno: { sal_uInt16 nVal = 0; if ( Value >>= nVal ) - GetAs< MetricField >()->SetUnit( (FieldUnit) nVal ); + GetAs< MetricField >()->SetUnit( static_cast(nVal) ); break; } case BASEPROPERTY_CUSTOMUNITTEXT: diff --git a/toolkit/source/controls/unocontrolmodel.cxx b/toolkit/source/controls/unocontrolmodel.cxx index 642575a5a2ea..d767dec09e11 100644 --- a/toolkit/source/controls/unocontrolmodel.cxx +++ b/toolkit/source/controls/unocontrolmodel.cxx @@ -85,7 +85,7 @@ static void lcl_ImplMergeFontProperty( FontDescriptor& rFD, sal_uInt16 nPropId, case BASEPROPERTY_FONTDESCRIPTORPART_WEIGHT: rValue >>= rFD.Weight; break; case BASEPROPERTY_FONTDESCRIPTORPART_SLANT: if ( rValue >>= nExtractShort ) - rFD.Slant = (css::awt::FontSlant)nExtractShort; + rFD.Slant = static_cast(nExtractShort); else rValue >>= rFD.Slant; break; @@ -176,7 +176,7 @@ css::uno::Any UnoControlModel::ImplGetDefaultValue( sal_uInt16 nPropId ) const case BASEPROPERTY_FONTDESCRIPTORPART_CHARSET: aDefault <<= aFD.CharSet; break; case BASEPROPERTY_FONTDESCRIPTORPART_HEIGHT: aDefault <<= static_cast(aFD.Height); break; case BASEPROPERTY_FONTDESCRIPTORPART_WEIGHT: aDefault <<= aFD.Weight; break; - case BASEPROPERTY_FONTDESCRIPTORPART_SLANT: aDefault <<= (sal_Int16)aFD.Slant; break; + case BASEPROPERTY_FONTDESCRIPTORPART_SLANT: aDefault <<= static_cast(aFD.Slant); break; case BASEPROPERTY_FONTDESCRIPTORPART_UNDERLINE: aDefault <<= aFD.Underline; break; case BASEPROPERTY_FONTDESCRIPTORPART_STRIKEOUT: aDefault <<= aFD.Strikeout; break; case BASEPROPERTY_FONTDESCRIPTORPART_WIDTH: aDefault <<= aFD.Width; break; @@ -840,7 +840,7 @@ void UnoControlModel::read( const css::uno::Reference< css::io::XObjectInputStre aFD.Pitch = InStream->readShort(); aFD.CharacterWidth = static_cast(InStream->readDouble()); aFD.Weight = static_cast(InStream->readDouble()); - aFD.Slant = (css::awt::FontSlant)InStream->readShort(); + aFD.Slant = static_cast(InStream->readShort()); aFD.Underline = InStream->readShort(); aFD.Strikeout = InStream->readShort(); aFD.Orientation = static_cast(InStream->readDouble()); @@ -951,8 +951,8 @@ void UnoControlModel::read( const css::uno::Reference< css::io::XObjectInputStre if ( maData.find(BASEPROPERTY_FONTDESCRIPTOR) != maData.end() ) // due to defaults... maData[BASEPROPERTY_FONTDESCRIPTOR] >>= *pFD; } - pFD->Weight = vcl::unohelper::ConvertFontWeight((FontWeight) InStream->readShort()); - pFD->Slant = (css::awt::FontSlant)InStream->readShort(); + pFD->Weight = vcl::unohelper::ConvertFontWeight(static_cast(InStream->readShort())); + pFD->Slant = static_cast(InStream->readShort()); pFD->Underline = InStream->readShort(); pFD->Strikeout = InStream->readShort(); pFD->Orientation = static_cast(static_cast(InStream->readShort())) / 10; @@ -1201,7 +1201,7 @@ void UnoControlModel::getFastPropertyValue( css::uno::Any& rValue, sal_Int32 nPr break; case BASEPROPERTY_FONTDESCRIPTORPART_WEIGHT: rValue <<= aFD.Weight; break; - case BASEPROPERTY_FONTDESCRIPTORPART_SLANT: rValue <<= (sal_Int16)aFD.Slant; + case BASEPROPERTY_FONTDESCRIPTORPART_SLANT: rValue <<= static_cast(aFD.Slant); break; case BASEPROPERTY_FONTDESCRIPTORPART_UNDERLINE: rValue <<= aFD.Underline; break; diff --git a/toolkit/source/helper/vclunohelper.cxx b/toolkit/source/helper/vclunohelper.cxx index c65a04976f1c..cd8a2e5c4e25 100644 --- a/toolkit/source/helper/vclunohelper.cxx +++ b/toolkit/source/helper/vclunohelper.cxx @@ -228,22 +228,22 @@ vcl::Font VCLUnoHelper::CreateFont( const css::awt::FontDescriptor& rDescr, cons aFont.SetStyleName( rDescr.StyleName ); if ( rDescr.Height ) aFont.SetFontSize( Size( rDescr.Width, rDescr.Height ) ); - if ( (FontFamily)rDescr.Family != FAMILY_DONTKNOW ) - aFont.SetFamily( (FontFamily)rDescr.Family ); + if ( static_cast(rDescr.Family) != FAMILY_DONTKNOW ) + aFont.SetFamily( static_cast(rDescr.Family) ); if ( static_cast(rDescr.CharSet) != RTL_TEXTENCODING_DONTKNOW ) aFont.SetCharSet( static_cast(rDescr.CharSet) ); - if ( (FontPitch)rDescr.Pitch != PITCH_DONTKNOW ) - aFont.SetPitch( (FontPitch)rDescr.Pitch ); + if ( static_cast(rDescr.Pitch) != PITCH_DONTKNOW ) + aFont.SetPitch( static_cast(rDescr.Pitch) ); if ( rDescr.CharacterWidth ) aFont.SetWidthType(vcl::unohelper::ConvertFontWidth(rDescr.CharacterWidth)); if ( rDescr.Weight ) aFont.SetWeight(vcl::unohelper::ConvertFontWeight(rDescr.Weight)); if ( rDescr.Slant != css::awt::FontSlant_DONTKNOW ) aFont.SetItalic(vcl::unohelper::ConvertFontSlant(rDescr.Slant)); - if ( (FontLineStyle)rDescr.Underline != LINESTYLE_DONTKNOW ) - aFont.SetUnderline( (FontLineStyle)rDescr.Underline ); - if ( (FontStrikeout)rDescr.Strikeout != STRIKEOUT_DONTKNOW ) - aFont.SetStrikeout( (FontStrikeout)rDescr.Strikeout ); + if ( static_cast(rDescr.Underline) != LINESTYLE_DONTKNOW ) + aFont.SetUnderline( static_cast(rDescr.Underline) ); + if ( static_cast(rDescr.Strikeout) != STRIKEOUT_DONTKNOW ) + aFont.SetStrikeout( static_cast(rDescr.Strikeout) ); // Not DONTKNOW aFont.SetOrientation( static_cast(rDescr.Orientation) ); @@ -385,7 +385,7 @@ namespace { if ( eDirection == FieldUnitToMeasurementUnit ) { - if ( ( aUnit.eFieldUnit == (FieldUnit)_nUnit ) && ( aUnit.nFieldToMeasureFactor == _rFieldToUNOValueFactor ) ) + if ( ( aUnit.eFieldUnit == static_cast(_nUnit) ) && ( aUnit.nFieldToMeasureFactor == _rFieldToUNOValueFactor ) ) return aUnit.nMeasurementUnit; } else @@ -416,7 +416,7 @@ sal_Int16 VCLUnoHelper::ConvertToMeasurementUnit( FieldUnit _nFieldUnit, sal_Int FieldUnit VCLUnoHelper::ConvertToFieldUnit( sal_Int16 _nMeasurementUnit, sal_Int16& _rFieldToUNOValueFactor ) { - return (FieldUnit)convertMeasurementUnit( _nMeasurementUnit, MeasurementUnitToFieldUnit, _rFieldToUNOValueFactor ); + return static_cast(convertMeasurementUnit( _nMeasurementUnit, MeasurementUnitToFieldUnit, _rFieldToUNOValueFactor )); } -- cgit