From 4923ac72aaca2f0671aed98de33902eac0810131 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 30 Sep 2014 09:02:35 +0200 Subject: loplugin: cstylecast Change-Id: I58582059495f7c50880038e2174ea2de026aa1c9 --- editeng/source/uno/unofdesc.cxx | 4 ++-- editeng/source/uno/unofield.cxx | 50 ++++++++++++++++++++--------------------- editeng/source/uno/unonrule.cxx | 2 +- editeng/source/uno/unotext.cxx | 8 +++---- 4 files changed, 32 insertions(+), 32 deletions(-) (limited to 'editeng/source/uno') diff --git a/editeng/source/uno/unofdesc.cxx b/editeng/source/uno/unofdesc.cxx index f375fcaa668f..4505bf94c070 100644 --- a/editeng/source/uno/unofdesc.cxx +++ b/editeng/source/uno/unofdesc.cxx @@ -133,7 +133,7 @@ void SvxUnoFontDescriptor::FillFromItemSet( const SfxItemSet& rSet, awt::FontDes { const SfxPoolItem* pItem = NULL; { - SvxFontItem* pFontItem = (SvxFontItem*)&rSet.Get( EE_CHAR_FONTINFO, true ); + const SvxFontItem* pFontItem = static_cast(&rSet.Get( EE_CHAR_FONTINFO, true )); rDesc.Name = pFontItem->GetFamilyName(); rDesc.StyleName = pFontItem->GetStyleName(); rDesc.Family = sal::static_int_cast< sal_Int16 >( @@ -173,7 +173,7 @@ void SvxUnoFontDescriptor::FillFromItemSet( const SfxItemSet& rSet, awt::FontDes aStrikeOut >>= rDesc.Strikeout; } { - SvxWordLineModeItem* pWLMItem = (SvxWordLineModeItem*)&rSet.Get( EE_CHAR_WLM, true ); + const SvxWordLineModeItem* pWLMItem = static_cast(&rSet.Get( EE_CHAR_WLM, true )); rDesc.WordLineMode = pWLMItem->GetValue(); } } diff --git a/editeng/source/uno/unofield.cxx b/editeng/source/uno/unofield.cxx index 8d46c15f8729..ca91283f380b 100644 --- a/editeng/source/uno/unofield.cxx +++ b/editeng/source/uno/unofield.cxx @@ -317,11 +317,11 @@ SvxUnoTextField::SvxUnoTextField( uno::Reference< text::XTextRange > xAnchor, co mpImpl->mbBoolean2 = true; // #i35416# for variable date field, don't use invalid "0000-00-00" date, // use current date instead - bool bFixed = ((SvxDateField*)pData)->GetType() == SVXDATETYPE_FIX; + bool bFixed = static_cast(pData)->GetType() == SVXDATETYPE_FIX; mpImpl->maDateTime = getDate( bFixed ? - ((SvxDateField*)pData)->GetFixDate() : + static_cast(pData)->GetFixDate() : Date( Date::SYSTEM ).GetDate() ); - mpImpl->mnInt32 = ((SvxDateField*)pData)->GetFormat(); + mpImpl->mnInt32 = static_cast(pData)->GetFormat(); mpImpl->mbBoolean1 = bFixed; } break; @@ -334,36 +334,36 @@ SvxUnoTextField::SvxUnoTextField( uno::Reference< text::XTextRange > xAnchor, co case text::textfield::Type::EXTENDED_TIME: mpImpl->mbBoolean2 = false; - mpImpl->maDateTime = getTime( ((SvxExtTimeField*)pData)->GetFixTime() ); - mpImpl->mbBoolean1 = ((SvxExtTimeField*)pData)->GetType() == SVXTIMETYPE_FIX; - mpImpl->mnInt32 = ((SvxExtTimeField*)pData)->GetFormat(); + mpImpl->maDateTime = getTime( static_cast(pData)->GetFixTime() ); + mpImpl->mbBoolean1 = static_cast(pData)->GetType() == SVXTIMETYPE_FIX; + mpImpl->mnInt32 = static_cast(pData)->GetFormat(); break; case text::textfield::Type::URL: - mpImpl->msString1 = ((SvxURLField*)pData)->GetRepresentation(); - mpImpl->msString2 = ((SvxURLField*)pData)->GetTargetFrame(); - mpImpl->msString3 = ((SvxURLField*)pData)->GetURL(); + mpImpl->msString1 = static_cast(pData)->GetRepresentation(); + mpImpl->msString2 = static_cast(pData)->GetTargetFrame(); + mpImpl->msString3 = static_cast(pData)->GetURL(); mpImpl->mnInt16 = sal::static_int_cast< sal_Int16 >( - ((SvxURLField*)pData)->GetFormat()); + static_cast(pData)->GetFormat()); break; case text::textfield::Type::EXTENDED_FILE: - mpImpl->msString1 = ((SvxExtFileField*)pData)->GetFile(); - mpImpl->mbBoolean1 = ((SvxExtFileField*)pData)->GetType() == SVXFILETYPE_FIX; - mpImpl->mnInt16 = getFileNameDisplayFormat(((SvxExtFileField*)pData)->GetFormat()); + mpImpl->msString1 = static_cast(pData)->GetFile(); + mpImpl->mbBoolean1 = static_cast(pData)->GetType() == SVXFILETYPE_FIX; + mpImpl->mnInt16 = getFileNameDisplayFormat(static_cast(pData)->GetFormat()); break; case text::textfield::Type::AUTHOR: - mpImpl->msString1 = ((SvxAuthorField*)pData)->GetFormatted(); - mpImpl->msString2 = ((SvxAuthorField*)pData)->GetFormatted(); + mpImpl->msString1 = static_cast(pData)->GetFormatted(); + mpImpl->msString2 = static_cast(pData)->GetFormatted(); mpImpl->mnInt16 = sal::static_int_cast< sal_Int16 >( - ((SvxAuthorField*)pData)->GetFormat()); - mpImpl->mbBoolean1 = ((SvxAuthorField*)pData)->GetType() == SVXAUTHORTYPE_FIX; - mpImpl->mbBoolean2 = ((SvxAuthorField*)pData)->GetFormat() != SVXAUTHORFORMAT_SHORTNAME; + static_cast(pData)->GetFormat()); + mpImpl->mbBoolean1 = static_cast(pData)->GetType() == SVXAUTHORTYPE_FIX; + mpImpl->mbBoolean2 = static_cast(pData)->GetFormat() != SVXAUTHORFORMAT_SHORTNAME; break; case text::textfield::Type::MEASURE: - mpImpl->mnInt16 = sal::static_int_cast< sal_Int16 >(((SdrMeasureField*)pData)->GetMeasureFieldKind()); + mpImpl->mnInt16 = sal::static_int_cast< sal_Int16 >(static_cast(pData)->GetMeasureFieldKind()); break; } } @@ -392,7 +392,7 @@ SvxFieldData* SvxUnoTextField::CreateFieldData() const throw() Date aDate( setDate( mpImpl->maDateTime ) ); pData = new SvxDateField( aDate, mpImpl->mbBoolean1?SVXDATETYPE_FIX:SVXDATETYPE_VAR ); if( mpImpl->mnInt32 >= SVXDATEFORMAT_APPDEFAULT && mpImpl->mnInt32 <= SVXDATEFORMAT_F ) - ((SvxDateField*)pData)->SetFormat( (SvxDateFormat)mpImpl->mnInt32 ); + static_cast(pData)->SetFormat( (SvxDateFormat)mpImpl->mnInt32 ); } else { @@ -402,7 +402,7 @@ SvxFieldData* SvxUnoTextField::CreateFieldData() const throw() pData = new SvxExtTimeField( aTime, mpImpl->mbBoolean1?SVXTIMETYPE_FIX:SVXTIMETYPE_VAR ); if( mpImpl->mnInt32 >= SVXTIMEFORMAT_APPDEFAULT && mpImpl->mnInt32 <= SVXTIMEFORMAT_AM_HMSH ) - ((SvxExtTimeField*)pData)->SetFormat( (SvxTimeFormat)mpImpl->mnInt32 ); + static_cast(pData)->SetFormat( (SvxTimeFormat)mpImpl->mnInt32 ); } else { @@ -415,9 +415,9 @@ SvxFieldData* SvxUnoTextField::CreateFieldData() const throw() case text::textfield::Type::URL: pData = new SvxURLField( mpImpl->msString3, mpImpl->msString1, !mpImpl->msString1.isEmpty() ? SVXURLFORMAT_REPR : SVXURLFORMAT_URL ); - ((SvxURLField*)pData)->SetTargetFrame( mpImpl->msString2 ); + static_cast(pData)->SetTargetFrame( mpImpl->msString2 ); if( mpImpl->mnInt16 >= SVXURLFORMAT_APPDEFAULT && mpImpl->mnInt16 <= SVXURLFORMAT_REPR ) - ((SvxURLField*)pData)->SetFormat( (SvxURLFormat)mpImpl->mnInt16 ); + static_cast(pData)->SetFormat( (SvxURLFormat)mpImpl->mnInt16 ); break; case text::textfield::Type::PAGE: @@ -478,11 +478,11 @@ SvxFieldData* SvxUnoTextField::CreateFieldData() const throw() if( !mpImpl->mbBoolean2 ) { - ((SvxAuthorField*)pData)->SetFormat( SVXAUTHORFORMAT_SHORTNAME ); + static_cast(pData)->SetFormat( SVXAUTHORFORMAT_SHORTNAME ); } else if( mpImpl->mnInt16 >= SVXAUTHORFORMAT_FULLNAME || mpImpl->mnInt16 <= SVXAUTHORFORMAT_SHORTNAME ) { - ((SvxAuthorField*)pData)->SetFormat( (SvxAuthorFormat) mpImpl->mnInt16 ); + static_cast(pData)->SetFormat( (SvxAuthorFormat) mpImpl->mnInt16 ); } break; diff --git a/editeng/source/uno/unonrule.cxx b/editeng/source/uno/unonrule.cxx index 2b0ce3824fd4..78c4d17b5391 100644 --- a/editeng/source/uno/unonrule.cxx +++ b/editeng/source/uno/unonrule.cxx @@ -429,7 +429,7 @@ void SvxUnoNumberingRules::setNumberingRuleByIndex( const Sequence< beans::Prope sal_Int32 nColor = 0; if( aVal >>= nColor ) { - aFmt.SetBulletColor( (Color) nColor ); + aFmt.SetBulletColor( static_cast(nColor) ); continue; } } diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx index 77b9267a7180..9fd17d2d83b6 100644 --- a/editeng/source/uno/unotext.cxx +++ b/editeng/source/uno/unotext.cxx @@ -646,7 +646,7 @@ void SvxUnoTextRangeBase::getPropertyValue( const SfxItemPropertySimpleEntry* pM case EE_FEATURE_FIELD: if ( rSet.GetItemState( EE_FEATURE_FIELD, false ) == SfxItemState::SET ) { - SvxFieldItem* pItem = (SvxFieldItem*)rSet.GetItem( EE_FEATURE_FIELD ); + const SvxFieldItem* pItem = static_cast(rSet.GetItem( EE_FEATURE_FIELD )); const SvxFieldData* pData = pItem->GetField(); uno::Reference< text::XTextRange > xAnchor( this ); @@ -703,7 +703,7 @@ bool SvxUnoTextRangeBase::GetPropertyValueHelper( SfxItemSet& rSet, const SfxIt if( eState != SfxItemState::SET && eState != SfxItemState::DEFAULT) throw uno::RuntimeException(); - SvxNumBulletItem* pBulletItem = (SvxNumBulletItem*)rSet.GetItem( EE_PARA_NUMBULLET, true ); + const SvxNumBulletItem* pBulletItem = static_cast(rSet.GetItem( EE_PARA_NUMBULLET, true )); if( pBulletItem == NULL ) throw uno::RuntimeException(); @@ -744,8 +744,8 @@ bool SvxUnoTextRangeBase::GetPropertyValueHelper( SfxItemSet& rSet, const SfxIt SfxItemState eState = rSet.GetItemState( EE_PARA_BULLETSTATE, true ); if( eState == SfxItemState::SET || eState == SfxItemState::DEFAULT ) { - SfxBoolItem* pItem = (SfxBoolItem*)rSet.GetItem( EE_PARA_BULLETSTATE, true ); - bState = pItem->GetValue() ? sal_True : sal_False; + const SfxBoolItem* pItem = static_cast(rSet.GetItem( EE_PARA_BULLETSTATE, true )); + bState = pItem->GetValue(); } aAny <<= bState; -- cgit