diff options
author | Noel Grandin <noel@peralex.com> | 2014-11-24 10:40:18 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-11-25 10:09:53 +0200 |
commit | 9409b2eb454118eab93542d4dfb464b723b219e2 (patch) | |
tree | b143ccfb63af30b3e47637e096d03261f2586065 /sw | |
parent | 88aaa3496161339d504876a2e84dc03e4d6191d9 (diff) |
loplugin: cstylecast
Change-Id: I030208a86a60609b0379c00957538677fac15ccf
Diffstat (limited to 'sw')
30 files changed, 133 insertions, 133 deletions
diff --git a/sw/source/uibase/ribbar/concustomshape.cxx b/sw/source/uibase/ribbar/concustomshape.cxx index 0c21879ed15a..10f85f6240de 100644 --- a/sw/source/uibase/ribbar/concustomshape.cxx +++ b/sw/source/uibase/ribbar/concustomshape.cxx @@ -83,7 +83,7 @@ bool ConstCustomShape::MouseButtonDown(const MouseEvent& rMEvt) { SetAttributes( pObj ); bool bForceNoFillStyle = false; - if ( ((SdrObjCustomShape*)pObj)->UseNoFillStyle() ) + if ( static_cast<SdrObjCustomShape*>(pObj)->UseNoFillStyle() ) bForceNoFillStyle = true; SfxItemSet aAttr( m_pView->GetPool() ); @@ -169,7 +169,7 @@ void ConstCustomShape::SetAttributes( SdrObject* pObj ) pObj->SetMergedItem( SdrTextVertAdjustItem( SDRTEXTVERTADJUST_CENTER ) ); pObj->SetMergedItem( SdrTextHorzAdjustItem( SDRTEXTHORZADJUST_BLOCK ) ); pObj->SetMergedItem( makeSdrTextAutoGrowHeightItem( false ) ); - ((SdrObjCustomShape*)pObj)->MergeDefaultAttributes( &aCustomShape ); + static_cast<SdrObjCustomShape*>(pObj)->MergeDefaultAttributes( &aCustomShape ); } } diff --git a/sw/source/uibase/ribbar/inputwin.cxx b/sw/source/uibase/ribbar/inputwin.cxx index c9cd78a4753b..46f5a15a3267 100644 --- a/sw/source/uibase/ribbar/inputwin.cxx +++ b/sw/source/uibase/ribbar/inputwin.cxx @@ -260,7 +260,7 @@ void SwInputWindow::ShowWin() SfxItemSet aSet( pWrtShell->GetAttrPool(), RES_BOXATR_FORMULA, RES_BOXATR_FORMULA ); if( pWrtShell->GetTblBoxFormulaAttrs( aSet )) - sEdit += ((SwTblBoxFormula&)aSet.Get( RES_BOXATR_FORMULA )).GetFormula(); + sEdit += static_cast<const SwTblBoxFormula&>(aSet.Get( RES_BOXATR_FORMULA )).GetFormula(); } } @@ -506,9 +506,9 @@ void InputEdit::KeyInput(const KeyEvent& rEvent) { const vcl::KeyCode aCode = rEvent.GetKeyCode(); if(aCode == KEY_RETURN || aCode == KEY_F2 ) - ((SwInputWindow*)GetParent())->ApplyFormula(); + static_cast<SwInputWindow*>(GetParent())->ApplyFormula(); else if(aCode == KEY_ESCAPE ) - ((SwInputWindow*)GetParent())->CancelFormula(); + static_cast<SwInputWindow*>(GetParent())->CancelFormula(); else Edit::KeyInput(rEvent); } @@ -617,7 +617,7 @@ SwInputChild::SwInputChild(vcl::Window* _pParent, { pDispatch = pBindings->GetDispatcher(); pWindow = new SwInputWindow( _pParent, pBindings ); - ((SwInputWindow*)pWindow)->ShowWin(); + static_cast<SwInputWindow*>(pWindow)->ShowWin(); eChildAlignment = SFX_ALIGN_LOWESTTOP; } diff --git a/sw/source/uibase/ribbar/workctrl.cxx b/sw/source/uibase/ribbar/workctrl.cxx index d191cfdcf394..5cf01617207f 100644 --- a/sw/source/uibase/ribbar/workctrl.cxx +++ b/sw/source/uibase/ribbar/workctrl.cxx @@ -331,7 +331,7 @@ void SwTbxFieldCtrl::StateChanged( sal_uInt16, GetToolBox().EnableItem( GetId(), (GetItemState(pState) != SfxItemState::DISABLED) ); if (eState >= SfxItemState::DEFAULT) { - GetToolBox().CheckItem( GetId(), ((SfxBoolItem*)pState)->GetValue() ); + GetToolBox().CheckItem( GetId(), static_cast<const SfxBoolItem*>(pState)->GetValue() ); } } @@ -502,8 +502,8 @@ IMPL_LINK(SwScrollNaviPopup, SelectHdl, ToolBox*, pSet) void SwScrollNaviToolBox::MouseButtonUp( const MouseEvent& rMEvt ) { ToolBox::MouseButtonUp(rMEvt); - if ( ((SwScrollNaviPopup*)GetParent())->IsInPopupMode() ) - ((SwScrollNaviPopup*)GetParent())->EndPopupMode( FLOATWIN_POPUPMODEEND_CLOSEALL ); + if ( static_cast<SwScrollNaviPopup*>(GetParent())->IsInPopupMode() ) + static_cast<SwScrollNaviPopup*>(GetParent())->EndPopupMode( FLOATWIN_POPUPMODEEND_CLOSEALL ); } void SwScrollNaviToolBox::RequestHelp( const HelpEvent& rHEvt ) diff --git a/sw/source/uibase/shells/annotsh.cxx b/sw/source/uibase/shells/annotsh.cxx index 172bd26c62cf..b746f48f4e5b 100644 --- a/sw/source/uibase/shells/annotsh.cxx +++ b/sw/source/uibase/shells/annotsh.cxx @@ -1455,7 +1455,7 @@ void SwAnnotationShell::ExecUndo(SfxRequest &rReq) sal_uInt16 nCnt = 1; const SfxPoolItem* pItem=0; if( pArgs && SfxItemState::SET == pArgs->GetItemState( nId, false, &pItem ) ) - nCnt = ((SfxUInt16Item*)pItem)->GetValue(); + nCnt = static_cast<const SfxUInt16Item*>(pItem)->GetValue(); switch( nId ) { case SID_UNDO: diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx index 9002984956a5..16b666ef46fb 100644 --- a/sw/source/uibase/shells/basesh.cxx +++ b/sw/source/uibase/shells/basesh.cxx @@ -300,7 +300,7 @@ void SwBaseShell::ExecClpbrd(SfxRequest &rReq) SwView* pView = &rView; SwTransferable::PasteFormat( rSh, aDataHelper, - ((SfxUInt32Item*)pFmt)->GetValue() ); + static_cast<const SfxUInt32Item*>(pFmt)->GetValue() ); //Done() has to be called before the shell has been removed rReq.Done(); @@ -463,7 +463,7 @@ void SwBaseShell::ExecUndo(SfxRequest &rReq) const SfxItemSet* pArgs = rReq.GetArgs(); const SfxPoolItem* pItem; if( pArgs && SfxItemState::SET == pArgs->GetItemState( nId, false, &pItem )) - nCnt = ((SfxUInt16Item*)pItem)->GetValue(); + nCnt = static_cast<const SfxUInt16Item*>(pItem)->GetValue(); // #i106349#: save pointer: undo/redo may delete the shell, i.e., this! SfxViewFrame *const pViewFrame( GetView().GetViewFrame() ); @@ -1552,7 +1552,7 @@ void SwBaseShell::GetState( SfxItemSet &rSet ) rSh.GetObjAttr(aSet); else rSh.GetFlyFrmAttr(aSet); - RndStdIds eSet = ((SwFmtAnchor&)aSet.Get(RES_ANCHOR)).GetAnchorId(); + RndStdIds eSet = static_cast<const SwFmtAnchor&>(aSet.Get(RES_ANCHOR)).GetAnchorId(); const bool bSet = ((nWhich == FN_TOOL_ANCHOR_PAGE) && (eSet == FLY_AT_PAGE)) @@ -1627,7 +1627,7 @@ void SwBaseShell::GetState( SfxItemSet &rSet ) else { rSh.GetFlyFrmAttr(aSet); - nAnchorType = ((SwFmtAnchor&)aSet.Get(RES_ANCHOR)).GetAnchorId(); + nAnchorType = static_cast<const SwFmtAnchor&>(aSet.Get(RES_ANCHOR)).GetAnchorId(); } const SwFmtSurround& rWrap = (const SwFmtSurround&)aSet.Get(RES_SURROUND); diff --git a/sw/source/uibase/shells/drwtxtex.cxx b/sw/source/uibase/shells/drwtxtex.cxx index c3059ebdc172..0b8a4da5823e 100644 --- a/sw/source/uibase/shells/drwtxtex.cxx +++ b/sw/source/uibase/shells/drwtxtex.cxx @@ -663,7 +663,7 @@ ASK_ADJUST: if( !pAdjust || IsInvalidItem( pAdjust )) rSet.InvalidateItem( nSlotId ), nSlotId = 0; else - bFlag = eAdjust == ((SvxAdjustItem*)pAdjust)->GetAdjust(); + bFlag = eAdjust == static_cast<const SvxAdjustItem*>(pAdjust)->GetAdjust(); } break; diff --git a/sw/source/uibase/shells/drwtxtsh.cxx b/sw/source/uibase/shells/drwtxtsh.cxx index 3ec5c14a34b6..a3807e81996c 100644 --- a/sw/source/uibase/shells/drwtxtsh.cxx +++ b/sw/source/uibase/shells/drwtxtsh.cxx @@ -527,7 +527,7 @@ void SwDrawTextShell::ExecUndo(SfxRequest &rReq) case SID_UNDO: case SID_REDO: if( SfxItemState::SET == pArgs->GetItemState( nId, false, &pItem ) && - 1 < (nCnt = ((SfxUInt16Item*)pItem)->GetValue()) ) + 1 < (nCnt = static_cast<const SfxUInt16Item*>(pItem)->GetValue()) ) { // then we make by ourself. ::svl::IUndoManager* pUndoManager = GetUndoManager(); diff --git a/sw/source/uibase/shells/grfsh.cxx b/sw/source/uibase/shells/grfsh.cxx index 7407d7f1bbbc..4fb574449078 100644 --- a/sw/source/uibase/shells/grfsh.cxx +++ b/sw/source/uibase/shells/grfsh.cxx @@ -356,14 +356,14 @@ void SwGrfShell::Execute(SfxRequest &rReq) SID_ATTR_GRAF_FRMSIZE, false, &pItem )) { SwFmtFrmSize aSize; - const Size& rSz = ((SvxSizeItem*)pItem)->GetSize(); + const Size& rSz = static_cast<const SvxSizeItem*>(pItem)->GetSize(); aSize.SetWidth( rSz.Width() ); aSize.SetHeight( rSz.Height() ); if( SfxItemState::SET == pSet->GetItemState( SID_ATTR_GRAF_FRMSIZE_PERCENT, false, &pItem )) { - const Size& rRelativeSize = ((SvxSizeItem*)pItem)->GetSize(); + const Size& rRelativeSize = static_cast<const SvxSizeItem*>(pItem)->GetSize(); aSize.SetWidthPercent( static_cast< sal_uInt8 >( rRelativeSize.Width() ) ); aSize.SetHeightPercent( static_cast< sal_uInt8 >( rRelativeSize.Height() ) ); } @@ -412,13 +412,13 @@ void SwGrfShell::Execute(SfxRequest &rReq) if( SfxItemState::SET == pSet->GetItemState( SID_ATTR_GRAF_GRAPHIC, true, &pItem )) { - if( !((SvxBrushItem*)pItem)->GetGraphicLink().isEmpty() ) - sGrfNm = ((SvxBrushItem*)pItem)->GetGraphicLink(); + if( !static_cast<const SvxBrushItem*>(pItem)->GetGraphicLink().isEmpty() ) + sGrfNm = static_cast<const SvxBrushItem*>(pItem)->GetGraphicLink(); else sGrfNm = ""; - if( !((SvxBrushItem*)pItem)->GetGraphicFilter().isEmpty() ) - sFilterNm = ((SvxBrushItem*)pItem)->GetGraphicFilter(); + if( !static_cast<const SvxBrushItem*>(pItem)->GetGraphicFilter().isEmpty() ) + sFilterNm = static_cast<const SvxBrushItem*>(pItem)->GetGraphicFilter(); else sFilterNm = ""; @@ -527,37 +527,37 @@ void SwGrfShell::ExecAttr( SfxRequest &rReq ) case SID_ATTR_GRAF_LUMINANCE: if( pItem ) aGrfSet.Put( SwLuminanceGrf( - ((SfxInt16Item*)pItem)->GetValue() )); + static_cast<const SfxInt16Item*>(pItem)->GetValue() )); break; case SID_ATTR_GRAF_CONTRAST: if( pItem ) aGrfSet.Put( SwContrastGrf( - ((SfxInt16Item*)pItem)->GetValue() )); + static_cast<const SfxInt16Item*>(pItem)->GetValue() )); break; case SID_ATTR_GRAF_RED: if( pItem ) aGrfSet.Put( SwChannelRGrf( - ((SfxInt16Item*)pItem)->GetValue() )); + static_cast<const SfxInt16Item*>(pItem)->GetValue() )); break; case SID_ATTR_GRAF_GREEN: if( pItem ) aGrfSet.Put( SwChannelGGrf( - ((SfxInt16Item*)pItem)->GetValue() )); + static_cast<const SfxInt16Item*>(pItem)->GetValue() )); break; case SID_ATTR_GRAF_BLUE: if( pItem ) aGrfSet.Put( SwChannelBGrf( - ((SfxInt16Item*)pItem)->GetValue() )); + static_cast<const SfxInt16Item*>(pItem)->GetValue() )); break; case SID_ATTR_GRAF_GAMMA: if( pItem ) { - double fVal = ((SfxUInt32Item*)pItem)->GetValue(); + double fVal = static_cast<const SfxUInt32Item*>(pItem)->GetValue(); aGrfSet.Put( SwGammaGrf(fVal/100. )); } break; @@ -571,13 +571,13 @@ void SwGrfShell::ExecAttr( SfxRequest &rReq ) case SID_ATTR_GRAF_INVERT: if( pItem ) aGrfSet.Put( SwInvertGrf( - ((SfxBoolItem*)pItem)->GetValue() )); + static_cast<const SfxBoolItem*>(pItem)->GetValue() )); break; case SID_ATTR_GRAF_MODE: if( pItem ) aGrfSet.Put( SwDrawModeGrf( - ((SfxUInt16Item*)pItem)->GetValue() )); + static_cast<const SfxUInt16Item*>(pItem)->GetValue() )); break; case SID_COLOR_SETTINGS: @@ -695,31 +695,31 @@ void SwGrfShell::GetAttrState(SfxItemSet &rSet) case SID_ATTR_GRAF_LUMINANCE: if( !bParentCntProt ) - rSet.Put( SfxInt16Item( nWhich, ((SwLuminanceGrf&) + rSet.Put( SfxInt16Item( nWhich, static_cast<const SwLuminanceGrf&>( aCoreSet.Get(RES_GRFATR_LUMINANCE)).GetValue() )); break; case SID_ATTR_GRAF_CONTRAST: if( !bParentCntProt ) - rSet.Put( SfxInt16Item( nWhich, ((SwContrastGrf&) + rSet.Put( SfxInt16Item( nWhich, static_cast<const SwContrastGrf&>( aCoreSet.Get(RES_GRFATR_CONTRAST)).GetValue() )); break; case SID_ATTR_GRAF_RED: if( !bParentCntProt ) - rSet.Put( SfxInt16Item( nWhich, ((SwChannelRGrf&) + rSet.Put( SfxInt16Item( nWhich, static_cast<const SwChannelRGrf&>( aCoreSet.Get(RES_GRFATR_CHANNELR)).GetValue() )); break; case SID_ATTR_GRAF_GREEN: if( !bParentCntProt ) - rSet.Put( SfxInt16Item( nWhich, ((SwChannelGGrf&) + rSet.Put( SfxInt16Item( nWhich, static_cast<const SwChannelGGrf&>( aCoreSet.Get(RES_GRFATR_CHANNELG)).GetValue() )); break; case SID_ATTR_GRAF_BLUE: if( !bParentCntProt ) - rSet.Put( SfxInt16Item( nWhich, ((SwChannelBGrf&) + rSet.Put( SfxInt16Item( nWhich, static_cast<const SwChannelBGrf&>( aCoreSet.Get(RES_GRFATR_CHANNELB)).GetValue() )); break; @@ -740,7 +740,7 @@ void SwGrfShell::GetAttrState(SfxItemSet &rSet) GRAPHIC_GDIMETAFILE == pGrafObj->GetType() ) bDisable = true; else - rSet.Put( SfxUInt16Item( nWhich, ((SwTransparencyGrf&) + rSet.Put( SfxUInt16Item( nWhich, static_cast<const SwTransparencyGrf&>( aCoreSet.Get(RES_GRFATR_TRANSPARENCY)).GetValue() )); } } @@ -748,13 +748,13 @@ void SwGrfShell::GetAttrState(SfxItemSet &rSet) case SID_ATTR_GRAF_INVERT: if( !bParentCntProt ) - rSet.Put( SfxBoolItem( nWhich, ((SwInvertGrf&) + rSet.Put( SfxBoolItem( nWhich, static_cast<const SwInvertGrf&>( aCoreSet.Get(RES_GRFATR_INVERT)).GetValue() )); break; case SID_ATTR_GRAF_MODE: if( !bParentCntProt ) - rSet.Put( SfxUInt16Item( nWhich, ((SwDrawModeGrf&) + rSet.Put( SfxUInt16Item( nWhich, static_cast<const SwDrawModeGrf&>( aCoreSet.Get(RES_GRFATR_DRAWMODE)).GetValue() )); break; diff --git a/sw/source/uibase/shells/tabsh.cxx b/sw/source/uibase/shells/tabsh.cxx index d6992baa967f..d4fe26b330ee 100644 --- a/sw/source/uibase/shells/tabsh.cxx +++ b/sw/source/uibase/shells/tabsh.cxx @@ -279,7 +279,7 @@ void ItemSetToTableParam( const SfxItemSet& rSet, if(SfxItemState::SET == rSet.GetItemState(SID_BACKGRND_DESTINATION, false, &pItem)) { SwViewOption aUsrPref( *rSh.GetViewOptions() ); - aUsrPref.SetTblDest((sal_uInt8)((SfxUInt16Item*)pItem)->GetValue()); + aUsrPref.SetTblDest((sal_uInt8)static_cast<const SfxUInt16Item*>(pItem)->GetValue()); SW_MOD()->ApplyUsrPref(aUsrPref, &rSh.GetView()); } bool bBorder = ( SfxItemState::SET == rSet.GetItemState( RES_BOX ) || @@ -389,7 +389,7 @@ void ItemSetToTableParam( const SfxItemSet& rSet, // The item must only be recorded while manual alignment, so that the // alignment is not overwritten by the distances while recording. if(eOrient != text::HoriOrientation::NONE) - ((SfxItemSet&)rSet).ClearItem( SID_ATTR_LRSPACE ); + const_cast<SfxItemSet&>(static_cast<const SfxItemSet&>(rSet)).ClearItem( SID_ATTR_LRSPACE ); if(pRep->HasColsChanged()) { @@ -398,10 +398,10 @@ void ItemSetToTableParam( const SfxItemSet& rSet, } if( SfxItemState::SET == rSet.GetItemState( FN_PARAM_TABLE_HEADLINE, false, &pItem)) - rSh.SetRowsToRepeat( ((SfxUInt16Item*)pItem)->GetValue() ); + rSh.SetRowsToRepeat( static_cast<const SfxUInt16Item*>(pItem)->GetValue() ); if( SfxItemState::SET == rSet.GetItemState( FN_TABLE_SET_VERT_ALIGN, false, &pItem)) - rSh.SetBoxAlign(((SfxUInt16Item*)(pItem))->GetValue()); + rSh.SetBoxAlign(static_cast<const SfxUInt16Item*>((pItem))->GetValue()); if( SfxItemState::SET == rSet.GetItemState( FN_PARAM_TABLE_NAME, false, &pItem )) rSh.SetTableName( *pFmt, ((const SfxStringItem*)pItem)->GetValue() ); @@ -636,12 +636,12 @@ void SwTableShell::Execute(SfxRequest &rReq) } else aCoreSet.Put( SfxUInt32Item( SID_ATTR_NUMBERFORMAT_VALUE, - ((SwTblBoxNumFormat&)aBoxSet.Get( + static_cast<const SwTblBoxNumFormat&>(aBoxSet.Get( RES_BOXATR_FORMAT )).GetValue() )); OUString sCurText( rSh.GetTableBoxText() ); aCoreSet.Put( SvxNumberInfoItem( pFormatter, - ((SwTblBoxValue&)aBoxSet.Get( + static_cast<const SwTblBoxValue&>(aBoxSet.Get( RES_BOXATR_VALUE)).GetValue(), sCurText, SID_ATTR_NUMBERFORMAT_INFO )); @@ -658,13 +658,13 @@ void SwTableShell::Execute(SfxRequest &rReq) const SfxPoolItem* pNumberFormatItem = GetView().GetDocShell()-> GetItem( SID_ATTR_NUMBERFORMAT_INFO ); - if( pNumberFormatItem && 0 != ((SvxNumberInfoItem*)pNumberFormatItem)->GetDelCount() ) + if( pNumberFormatItem && 0 != static_cast<const SvxNumberInfoItem*>(pNumberFormatItem)->GetDelCount() ) { - const sal_uInt32* pDelArr = ((SvxNumberInfoItem*) + const sal_uInt32* pDelArr = static_cast<const SvxNumberInfoItem*>( pNumberFormatItem)->GetDelArray(); - for ( sal_uInt32 i = 0; i < ((SvxNumberInfoItem*)pNumberFormatItem)->GetDelCount(); i++ ) - ((SvxNumberInfoItem*)pNumberFormatItem)-> + for ( sal_uInt32 i = 0; i < static_cast<const SvxNumberInfoItem*>(pNumberFormatItem)->GetDelCount(); i++ ) + static_cast<const SvxNumberInfoItem*>(pNumberFormatItem)-> GetNumberFormatter()->DeleteEntry( pDelArr[i] ); } @@ -674,7 +674,7 @@ void SwTableShell::Execute(SfxRequest &rReq) SfxItemSet aBoxFormatSet( *aCoreSet.GetPool(), RES_BOXATR_FORMAT, RES_BOXATR_FORMAT ); aBoxFormatSet.Put( SwTblBoxNumFormat( - ((SfxUInt32Item*)pNumberFormatItem)->GetValue() )); + static_cast<const SfxUInt32Item*>(pNumberFormatItem)->GetValue() )); rSh.SetTblBoxFormulaAttrs( aBoxFormatSet ); } @@ -710,7 +710,7 @@ void SwTableShell::Execute(SfxRequest &rReq) { bool bAppendLine = true; if( pItem ) - bAppendLine = ((SfxBoolItem*)pItem)->GetValue(); + bAppendLine = static_cast<const SfxBoolItem*>(pItem)->GetValue(); rReq.SetReturnValue( SfxBoolItem( nSlot, rSh.GoNextCell( bAppendLine ) ) ); bCallDone = true; diff --git a/sw/source/uibase/shells/textfld.cxx b/sw/source/uibase/shells/textfld.cxx index e4ba7d82454a..c38a45ec7eb8 100644 --- a/sw/source/uibase/shells/textfld.cxx +++ b/sw/source/uibase/shells/textfld.cxx @@ -134,7 +134,7 @@ void SwTextShell::ExecField(SfxRequest &rReq) { case TYP_DDEFLD: { - ::sfx2::SvBaseLink& rLink = ((SwDDEFieldType*)pFld->GetTyp())-> + ::sfx2::SvBaseLink& rLink = static_cast<SwDDEFieldType*>(pFld->GetTyp())-> GetBaseLink(); if(rLink.IsVisible()) { @@ -166,7 +166,7 @@ void SwTextShell::ExecField(SfxRequest &rReq) if(pFld && pFld->GetTyp()->Which() == RES_MACROFLD) { - const OUString& rMacro = ((SwMacroField*)pFld)->GetMacro(); + const OUString& rMacro = static_cast<SwMacroField*>(pFld)->GetMacro(); sal_Int32 nPos = rMacro.indexOf('.'); if(nPos != -1) { @@ -240,7 +240,7 @@ void SwTextShell::ExecField(SfxRequest &rReq) } if( SfxItemState::SET == pArgs->GetItemState( FN_PARAM_3, false, &pItem )) - nCommand = ((SfxInt32Item*)pItem)->GetValue(); + nCommand = static_cast<const SfxInt32Item*>(pItem)->GetValue(); aPar1 += OUString(DB_DELIM); aPar1 += OUString::number(nCommand); aPar1 += OUString(DB_DELIM); @@ -542,7 +542,7 @@ void SwTextShell::ExecField(SfxRequest &rReq) SwFldMgr aMgr; if ( pItem ) { - aText = ((SfxStringItem*)pItem)->GetValue(); + aText = static_cast<const SfxStringItem*>(pItem)->GetValue(); SFX_REQUEST_ARG( rReq, pType, SfxStringItem, FN_PARAM_2 , false ); SFX_REQUEST_ARG( rReq, pIsUrl, SfxBoolItem, FN_PARAM_1 , false ); if ( pType ) @@ -685,7 +685,7 @@ void SwTextShell::StateField( SfxItemSet &rSet ) RES_AUTHORITY == nTempWhich ) rSet.DisableItem( nWhich ); else if( RES_DDEFLD == nTempWhich && - !((SwDDEFieldType*)pField->GetTyp())->GetBaseLink().IsVisible()) + !static_cast<SwDDEFieldType*>(pField->GetTyp())->GetBaseLink().IsVisible()) { // nested links cannot be edited rSet.DisableItem( nWhich ); diff --git a/sw/source/uibase/shells/textidx.cxx b/sw/source/uibase/shells/textidx.cxx index 601883ed072b..5f635ecb178a 100644 --- a/sw/source/uibase/shells/textidx.cxx +++ b/sw/source/uibase/shells/textidx.cxx @@ -125,7 +125,7 @@ void SwTextShell::ExecIdx(SfxRequest &rReq) bool bGlobal = false; if(pItem) { - pCurTOX = (const SwTOXBase* )((SwPtrItem*)pItem)->GetValue(); + pCurTOX = (const SwTOXBase* )static_cast<const SwPtrItem*>(pItem)->GetValue(); bGlobal = true; } else diff --git a/sw/source/uibase/shells/textsh.cxx b/sw/source/uibase/shells/textsh.cxx index ea9e96f730d0..3d7bf34209e7 100644 --- a/sw/source/uibase/shells/textsh.cxx +++ b/sw/source/uibase/shells/textsh.cxx @@ -451,7 +451,7 @@ void SwTextShell::ExecInsert(SfxRequest &rReq) svt::EmbeddedObjectRef& xObj = rSh.GetOLEObject(); if(pItem && xObj.is()) { - Size aSize(((SvxSizeItem*)pItem)->GetSize()); + Size aSize(static_cast<const SvxSizeItem*>(pItem)->GetSize()); aSize = OutputDevice::LogicToLogic ( aSize, MapMode( MAP_TWIP ), MapMode( MAP_100TH_MM ) ); diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index 51d9a9d030aa..2e679e8aed9c 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -526,7 +526,7 @@ void SwTextShell::Execute(SfxRequest &rReq) OUString aTemplateName; if ( pItem ) { - nKind = ((SfxInt16Item*)pItem)->GetValue(); + nKind = static_cast<const SfxInt16Item*>(pItem)->GetValue(); SFX_REQUEST_ARG( rReq, pTemplate, SfxStringItem, FN_PARAM_1 , false ); SFX_REQUEST_ARG( rReq, pNumber, SfxUInt16Item, FN_PARAM_2 , false ); SFX_REQUEST_ARG( rReq, pIsNumberFilled, SfxBoolItem, FN_PARAM_3, false ); @@ -590,7 +590,7 @@ void SwTextShell::Execute(SfxRequest &rReq) { if ( pItem ) { - OUString sName = ((SfxStringItem*)pItem)->GetValue(); + OUString sName = static_cast<const SfxStringItem*>(pItem)->GetValue(); rWrtSh.SetBookmark( vcl::KeyCode(), sName, OUString() ); } else @@ -610,7 +610,7 @@ void SwTextShell::Execute(SfxRequest &rReq) if ( pItem ) { IDocumentMarkAccess* const pMarkAccess = rWrtSh.getIDocumentMarkAccess(); - pMarkAccess->deleteMark( pMarkAccess->findMark(((SfxStringItem*)pItem)->GetValue()) ); + pMarkAccess->deleteMark( pMarkAccess->findMark(static_cast<const SfxStringItem*>(pItem)->GetValue()) ); } break; } @@ -730,9 +730,9 @@ void SwTextShell::Execute(SfxRequest &rReq) if(pFld && pFld->GetTypeId() == TYP_GETREFFLD) { rWrtSh.StartAllAction(); - rWrtSh.SwCrsrShell::GotoRefMark( ((SwGetRefField*)pFld)->GetSetRefName(), - ((SwGetRefField*)pFld)->GetSubType(), - ((SwGetRefField*)pFld)->GetSeqNo() ); + rWrtSh.SwCrsrShell::GotoRefMark( static_cast<SwGetRefField*>(pFld)->GetSetRefName(), + static_cast<SwGetRefField*>(pFld)->GetSubType(), + static_cast<SwGetRefField*>(pFld)->GetSeqNo() ); rWrtSh.EndAllAction(); rReq.Done(); } @@ -953,7 +953,7 @@ void SwTextShell::Execute(SfxRequest &rReq) // Left border as offset //#i24363# tab stops relative to indent const long nOff = rWrtSh.getIDocumentSettingAccess()->get(IDocumentSettingAccess::TABS_RELATIVE_TO_INDENT) ? - ((SvxLRSpaceItem&)aCoreSet.Get( RES_LR_SPACE )).GetTxtLeft() : 0; + static_cast<const SvxLRSpaceItem&>(aCoreSet.Get( RES_LR_SPACE )).GetTxtLeft() : 0; SfxInt32Item aOff( SID_ATTR_TABSTOP_OFFSET, nOff ); aCoreSet.Put( aOff ); @@ -1006,7 +1006,7 @@ void SwTextShell::Execute(SfxRequest &rReq) pSet = (SfxItemSet*)pDlg->GetOutputItemSet(); sal_uInt16 nNewDist; if( SfxItemState::SET == pSet->GetItemState( SID_ATTR_TABSTOP_DEFAULTS, false, &pItem ) && - nDefDist != (nNewDist = ((SfxUInt16Item*)pItem)->GetValue()) ) + nDefDist != (nNewDist = static_cast<const SfxUInt16Item*>(pItem)->GetValue()) ) { SvxTabStopItem aDefTabs( 0, 0, SVX_TAB_ADJUST_DEFAULT, RES_PARATR_TABSTOP ); MakeDefTabs( nNewDist, aDefTabs ); @@ -1048,8 +1048,8 @@ void SwTextShell::Execute(SfxRequest &rReq) rWrtSh.StartAction(); if ( SfxItemState::SET == pSet->GetItemState(FN_DROP_TEXT, false, &pItem) ) { - if ( !((SfxStringItem*)pItem)->GetValue().isEmpty() ) - rWrtSh.ReplaceDropTxt(((SfxStringItem*)pItem)->GetValue(), pPaM); + if ( !static_cast<const SfxStringItem*>(pItem)->GetValue().isEmpty() ) + rWrtSh.ReplaceDropTxt(static_cast<const SfxStringItem*>(pItem)->GetValue(), pPaM); } rWrtSh.SetAttrSet( *pSet, 0, pPaM ); rWrtSh.EndAction(); @@ -1067,7 +1067,7 @@ void SwTextShell::Execute(SfxRequest &rReq) //otherwise the SetNodeNumStart() value determines the start //if it's set to something different than USHRT_MAX - bool bStart = ((SfxBoolItem&)pSet->Get(FN_NUMBER_NEWSTART)).GetValue(); + bool bStart = static_cast<const SfxBoolItem&>(pSet->Get(FN_NUMBER_NEWSTART)).GetValue(); // Default value for restart value has to be USHRT_MAX // in order to indicate that the restart value of the list @@ -1075,14 +1075,14 @@ void SwTextShell::Execute(SfxRequest &rReq) sal_uInt16 nNumStart = USHRT_MAX; if( SfxItemState::SET == pSet->GetItemState(FN_NUMBER_NEWSTART_AT) ) { - nNumStart = ((SfxUInt16Item&)pSet->Get(FN_NUMBER_NEWSTART_AT)).GetValue(); + nNumStart = static_cast<const SfxUInt16Item&>(pSet->Get(FN_NUMBER_NEWSTART_AT)).GetValue(); } rWrtSh.SetNumRuleStart(bStart, pPaM); rWrtSh.SetNodeNumStart(nNumStart); } else if( SfxItemState::SET == pSet->GetItemState(FN_NUMBER_NEWSTART_AT) ) { - rWrtSh.SetNodeNumStart(((SfxUInt16Item&)pSet->Get(FN_NUMBER_NEWSTART_AT)).GetValue()); + rWrtSh.SetNodeNumStart(static_cast<const SfxUInt16Item&>(pSet->Get(FN_NUMBER_NEWSTART_AT)).GetValue()); rWrtSh.SetNumRuleStart(false, pPaM); } // #i56253# diff --git a/sw/source/uibase/shells/textsh2.cxx b/sw/source/uibase/shells/textsh2.cxx index d1fcb65f0c36..8e1f349e6320 100644 --- a/sw/source/uibase/shells/textsh2.cxx +++ b/sw/source/uibase/shells/textsh2.cxx @@ -102,7 +102,7 @@ void SwTextShell::ExecDB(SfxRequest &rReq) Sequence<Any> aSelection; if(pSelectionItem) - ((SfxUsrAnyItem*)pSelectionItem)->GetValue() >>= aSelection; + static_cast<const SfxUsrAnyItem*>(pSelectionItem)->GetValue() >>= aSelection; // get the data source name pArgs->GetItemState(FN_DB_DATA_SOURCE_ANY, false, &pSourceItem); @@ -196,7 +196,7 @@ void SwTextShell::ExecDB(SfxRequest &rReq) OUString sColumnName; if(pColumnNameItem) - ((SfxUsrAnyItem*)pColumnNameItem)->GetValue() >>= sColumnName; + static_cast<const SfxUsrAnyItem*>(pColumnNameItem)->GetValue() >>= sColumnName; OUString sDBName = sSourceArg; sDBName += OUString(DB_DELIM); sDBName += sCommandArg; @@ -208,9 +208,9 @@ void SwTextShell::ExecDB(SfxRequest &rReq) SwFldMgr aFldMgr(GetShellPtr()); SwInsertFld_Data aData(TYP_DBFLD, 0, sDBName, OUString(), 0); if(pConnectionItem) - aData.aDBConnection = ((SfxUsrAnyItem*)pConnectionItem)->GetValue(); + aData.aDBConnection = static_cast<const SfxUsrAnyItem*>(pConnectionItem)->GetValue(); if(pColumnItem) - aData.aDBColumn = ((SfxUsrAnyItem*)pColumnItem)->GetValue(); + aData.aDBColumn = static_cast<const SfxUsrAnyItem*>(pColumnItem)->GetValue(); aFldMgr.InsertFld(aData); SfxViewFrame* pViewFrame = GetView().GetViewFrame(); uno::Reference< XDispatchRecorder > xRecorder = diff --git a/sw/source/uibase/shells/txtattr.cxx b/sw/source/uibase/shells/txtattr.cxx index 9c9adcb30258..bd8baeb442af 100644 --- a/sw/source/uibase/shells/txtattr.cxx +++ b/sw/source/uibase/shells/txtattr.cxx @@ -471,8 +471,8 @@ void SwTextShell::ExecParaAttrArgs(SfxRequest &rReq) rSh.StartUndo( UNDO_START ); if ( SfxItemState::SET == aSet.GetItemState(HINT_END,false,&pItem) ) { - if ( !((SfxStringItem*)pItem)->GetValue().isEmpty() ) - rSh.ReplaceDropTxt(((SfxStringItem*)pItem)->GetValue()); + if ( !static_cast<const SfxStringItem*>(pItem)->GetValue().isEmpty() ) + rSh.ReplaceDropTxt(static_cast<const SfxStringItem*>(pItem)->GetValue()); } rSh.SetAttrSet(*pDlg->GetOutputItemSet()); rSh.StartUndo( UNDO_END ); diff --git a/sw/source/uibase/uiview/formatclipboard.cxx b/sw/source/uibase/uiview/formatclipboard.cxx index 4815149ebdd9..5540680ac9e6 100644 --- a/sw/source/uibase/uiview/formatclipboard.cxx +++ b/sw/source/uibase/uiview/formatclipboard.cxx @@ -159,7 +159,7 @@ void lcl_setTableAttributes( const SfxItemSet& rSet, SwWrtShell &rSh ) rSh.SetTabBorders( rSet ); if( SfxItemState::SET == rSet.GetItemState( FN_PARAM_TABLE_HEADLINE, false, &pItem) ) - rSh.SetRowsToRepeat( ((SfxUInt16Item*)pItem)->GetValue() ); + rSh.SetRowsToRepeat( static_cast<const SfxUInt16Item*>(pItem)->GetValue() ); SwFrmFmt* pFrmFmt = rSh.GetTableFmt(); if(pFrmFmt) @@ -209,7 +209,7 @@ void lcl_setTableAttributes( const SfxItemSet& rSet, SwWrtShell &rSh ) } if( SfxItemState::SET == rSet.GetItemState( FN_TABLE_SET_VERT_ALIGN, false, &pItem)) - rSh.SetBoxAlign(((SfxUInt16Item*)(pItem))->GetValue()); + rSh.SetBoxAlign(static_cast<const SfxUInt16Item*>((pItem))->GetValue()); if( SfxItemState::SET == rSet.GetItemState( RES_ROW_SPLIT, false, &pItem) ) rSh.SetRowSplit(*static_cast<const SwFmtRowSplit*>(pItem)); diff --git a/sw/source/uibase/uiview/pview.cxx b/sw/source/uibase/uiview/pview.cxx index 22efb9c11a4e..f97978286f9e 100644 --- a/sw/source/uibase/uiview/pview.cxx +++ b/sw/source/uibase/uiview/pview.cxx @@ -166,7 +166,7 @@ SwPreviewZoomDlg::SwPreviewZoomDlg( SwPagePreviewWin& rParent ) void SwPreviewZoomDlg::Apply() { - ((SwPagePreviewWin*)GetParent())->CalcWish( + static_cast<SwPagePreviewWin*>(GetParent())->CalcWish( sal_uInt8(m_pRowEdit->GetValue()), sal_uInt8(m_pColEdit->GetValue()) ); } @@ -1052,7 +1052,7 @@ void SwPagePreview::GetState( SfxItemSet& rSet ) else if( SfxItemState::SET == aSet.GetItemState( SID_PRINTDOC, false, &pItem )) { - ((SfxPoolItem*)pItem)->SetWhich( FN_PRINT_PAGEPREVIEW ); + const_cast<SfxPoolItem*>(pItem)->SetWhich( FN_PRINT_PAGEPREVIEW ); rSet.Put( *pItem ); } } @@ -1175,12 +1175,12 @@ SwPagePreview::SwPagePreview(SfxViewFrame *pViewFrame, SfxViewShell* pOldSh): SwViewShell *pVS, *pNew; if( pOldSh && pOldSh->IsA( TYPE( SwPagePreview ) ) ) - pVS = ((SwPagePreview*)pOldSh)->GetViewShell(); + pVS = static_cast<SwPagePreview*>(pOldSh)->GetViewShell(); else { if( pOldSh && pOldSh->IsA( TYPE( SwView ) ) ) { - pVS = ((SwView*)pOldSh)->GetWrtShellPtr(); + pVS = static_cast<SwView*>(pOldSh)->GetWrtShellPtr(); // save the current ViewData of the previous SwView pOldSh->WriteUserData( sSwViewData, false ); } @@ -1190,7 +1190,7 @@ SwPagePreview::SwPagePreview(SfxViewFrame *pViewFrame, SfxViewShell* pOldSh): { // Set the current page as the first. sal_uInt16 nPhysPg, nVirtPg; - ((SwCrsrShell*)pVS)->GetPageNum( nPhysPg, nVirtPg, true, false ); + static_cast<SwCrsrShell*>(pVS)->GetPageNum( nPhysPg, nVirtPg, true, false ); if( 1 != pViewWin->GetCol() && 1 == nPhysPg ) --nPhysPg; pViewWin->SetSttPage( nPhysPg ); @@ -1209,7 +1209,7 @@ SwPagePreview::SwPagePreview(SfxViewFrame *pViewFrame, SfxViewShell* pOldSh): pNew = new SwViewShell( *pVS, pViewWin, 0, VSHELLFLAG_ISPREVIEW ); else pNew = new SwViewShell( - *((SwDocShell*)pViewFrame->GetObjectShell())->GetDoc(), + *static_cast<SwDocShell*>(pViewFrame->GetObjectShell())->GetDoc(), pViewWin, 0, 0, VSHELLFLAG_ISPREVIEW ); pViewWin->SetViewShell( pNew ); diff --git a/sw/source/uibase/uiview/srcview.cxx b/sw/source/uibase/uiview/srcview.cxx index 2a4c45522123..15e7c05a3ed6 100644 --- a/sw/source/uibase/uiview/srcview.cxx +++ b/sw/source/uibase/uiview/srcview.cxx @@ -232,7 +232,7 @@ SwSrcView::~SwSrcView() SwDocShell* pDocShell = GetDocShell(); OSL_ENSURE(PTR_CAST(SwWebDocShell, pDocShell), "Why no WebDocShell?"); const TextSelection& rSel = aEditWin.GetTextView()->GetSelection(); - ((SwWebDocShell*)pDocShell)->SetSourcePara( static_cast< sal_uInt16 >( rSel.GetStart().GetPara() ) ); + static_cast<SwWebDocShell*>(pDocShell)->SetSourcePara( static_cast< sal_uInt16 >( rSel.GetStart().GetPara() ) ); uno::Reference<document::XDocumentPropertiesSupplier> xDPS( pDocShell->GetModel(), uno::UNO_QUERY_THROW); @@ -871,7 +871,7 @@ void SwSrcView::Load(SwDocShell* pDocShell) // Disable AutoLoad pDocShell->SetAutoLoad(INetURLObject(), 0, false); OSL_ENSURE(PTR_CAST(SwWebDocShell, pDocShell), "Why no WebDocShell?"); - sal_uInt16 nLine = ((SwWebDocShell*)pDocShell)->GetSourcePara(); + sal_uInt16 nLine = static_cast<SwWebDocShell*>(pDocShell)->GetSourcePara(); aEditWin.SetStartLine(nLine); aEditWin.GetTextEngine()->ResetUndo(); aEditWin.GetOutWin()->GrabFocus(); diff --git a/sw/source/uibase/uiview/swcli.cxx b/sw/source/uibase/uiview/swcli.cxx index 71b57499ddb2..826f0843c96a 100644 --- a/sw/source/uibase/uiview/swcli.cxx +++ b/sw/source/uibase/uiview/swcli.cxx @@ -49,7 +49,7 @@ void SwOleClient::RequestNewObjectArea( Rectangle& aLogRect ) // If the Ole-Frm is formatted, then the CalcAndSetScale() of the WrtShell // will be called. There the scaling of the SwOleClient is set if necessary. - SwWrtShell &rSh = ((SwView*)GetViewShell())->GetWrtShell(); + SwWrtShell &rSh = static_cast<SwView*>(GetViewShell())->GetWrtShell(); rSh.StartAllAction(); @@ -85,7 +85,7 @@ void SwOleClient::RequestNewObjectArea( Rectangle& aLogRect ) void SwOleClient::ObjectAreaChanged() { - SwWrtShell &rSh = ((SwView*)GetViewShell())->GetWrtShell(); + SwWrtShell &rSh = static_cast<SwView*>(GetViewShell())->GetWrtShell(); SwRect aFrm( rSh.GetAnyCurRect( RECT_FLY_EMBEDDED, 0, GetObject() )); if ( !aFrm.IsOver( rSh.VisArea() ) ) rSh.MakeVisible( aFrm ); @@ -105,7 +105,7 @@ void SwOleClient::ViewChanged() return; } - SwWrtShell &rSh = ((SwView*)GetViewShell())->GetWrtShell(); + SwWrtShell &rSh = static_cast<SwView*>(GetViewShell())->GetWrtShell(); // Adjust the size of the object in the core. The Scaling must // be considered. Repercussions on the object are considered by @@ -154,7 +154,7 @@ void SwOleClient::ViewChanged() void SwOleClient::MakeVisible() { - const SwWrtShell &rSh = ((SwView*)GetViewShell())->GetWrtShell(); + const SwWrtShell &rSh = static_cast<SwView*>(GetViewShell())->GetWrtShell(); rSh.MakeObjVisible( GetObject() ); } diff --git a/sw/source/uibase/uiview/uivwimp.cxx b/sw/source/uibase/uiview/uivwimp.cxx index 3a66ec64e2ab..93853c2f41a7 100644 --- a/sw/source/uibase/uiview/uivwimp.cxx +++ b/sw/source/uibase/uiview/uivwimp.cxx @@ -87,7 +87,7 @@ SwView_Impl::~SwView_Impl() pInterceptor->Invalidate(); } view::XSelectionSupplier* pTextView = pxXTextView->get(); - ((SwXTextView*)pTextView)->Invalidate(); + static_cast<SwXTextView*>(pTextView)->Invalidate(); delete pxXTextView; if( xScanEvtLstnr.is() ) pScanEvtLstnr->ViewDestroyed(); @@ -116,7 +116,7 @@ view::XSelectionSupplier* SwView_Impl::GetUNOObject() SwXTextView* SwView_Impl::GetUNOObject_Impl() { view::XSelectionSupplier* pTextView = pxXTextView->get(); - return ((SwXTextView*)pTextView); + return static_cast<SwXTextView*>(pTextView); } void SwView_Impl::ExecuteScan( SfxRequest& rReq ) diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx index 358937f267cb..346c9e124618 100644 --- a/sw/source/uibase/uiview/view.cxx +++ b/sw/source/uibase/uiview/view.cxx @@ -498,7 +498,7 @@ IMPL_LINK_NOARG(SwView, AttrChangedNotify) const SfxPoolItem *pItem; if ( SfxItemState::SET != GetObjectShell()->GetMedium()->GetItemSet()-> GetItemState( SID_HIDDEN, false, &pItem ) || - !((SfxBoolItem*)pItem)->GetValue() ) + !static_cast<const SfxBoolItem*>(pItem)->GetValue() ) { GetViewFrame()->GetBindings().ENTERREGISTRATIONS(); m_bAttrChgNotifiedWithRegistrations = true; @@ -783,9 +783,9 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh ) // determine type of existing view if( pExistingSh->IsA( TYPE( SwPagePreview ) ) ) { - m_sSwViewData = ((SwPagePreview*)pExistingSh)->GetPrevSwViewData(); - m_sNewCrsrPos = ((SwPagePreview*)pExistingSh)->GetNewCrsrPos(); - m_nNewPage = ((SwPagePreview*)pExistingSh)->GetNewPage(); + m_sSwViewData = static_cast<SwPagePreview*>(pExistingSh)->GetPrevSwViewData(); + m_sNewCrsrPos = static_cast<SwPagePreview*>(pExistingSh)->GetNewCrsrPos(); + m_nNewPage = static_cast<SwPagePreview*>(pExistingSh)->GetNewPage(); m_bOldShellWasPagePreview = true; m_bIsPreviewDoubleClick = !m_sNewCrsrPos.isEmpty() || m_nNewPage != USHRT_MAX; } @@ -796,7 +796,7 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh ) SAL_INFO( "sw.ui", "before create WrtShell" ); if(PTR_CAST( SwView, pExistingSh)) { - m_pWrtShell = new SwWrtShell( *((SwView*)pExistingSh)->m_pWrtShell, + m_pWrtShell = new SwWrtShell( *static_cast<SwView*>(pExistingSh)->m_pWrtShell, m_pEditWin, *this); } else if( dynamic_cast<SwWrtShell*>( pDocSh->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell() ) ) @@ -806,7 +806,7 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh ) } else { - SwDoc& rDoc = *((SwDocShell*)pDocSh)->GetDoc(); + SwDoc& rDoc = *static_cast<SwDocShell*>(pDocSh)->GetDoc(); if( !bOldShellWasSrcView && bWebDShell && !m_bOldShellWasPagePreview ) aUsrPref.setBrowseMode( true ); @@ -830,7 +830,7 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh ) // add the SwViewShell to the ring of the other SwViewShell(s) if(m_bOldShellWasPagePreview) { - SwViewShell& rPreviewViewShell = *((SwPagePreview*)pExistingSh)->GetViewShell(); + SwViewShell& rPreviewViewShell = *static_cast<SwPagePreview*>(pExistingSh)->GetViewShell(); m_pWrtShell->MoveTo(&rPreviewViewShell); // to update the field command et.al. if necessary const SwViewOption* pPreviewOpt = rPreviewViewShell.GetViewOptions(); @@ -841,11 +841,11 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh ) rPreviewViewShell.ApplyViewOptions(aUsrPref); // reset design mode at draw view for form // shell, if needed. - if ( ((SwPagePreview*)pExistingSh)->ResetFormDesignMode() && + if ( static_cast<SwPagePreview*>(pExistingSh)->ResetFormDesignMode() && m_pWrtShell->HasDrawView() ) { SdrView* pDrawView = m_pWrtShell->GetDrawView(); - pDrawView->SetDesignMode( ((SwPagePreview*)pExistingSh)->FormDesignModeToReset() ); + pDrawView->SetDesignMode( static_cast<SwPagePreview*>(pExistingSh)->FormDesignModeToReset() ); } } } @@ -1590,7 +1590,7 @@ void SwView::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) bool bCallBase = true; if ( dynamic_cast<const SfxSimpleHint*>(&rHint) ) { - sal_uInt32 nId = ((SfxSimpleHint&)rHint).GetId(); + sal_uInt32 nId = static_cast<const SfxSimpleHint&>(rHint).GetId(); switch ( nId ) { // sub shells will be destroyed by the @@ -1662,7 +1662,7 @@ void SwView::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) } else if(dynamic_cast<const FmDesignModeChangedHint*>(&rHint)) { - bool bDesignMode = ((FmDesignModeChangedHint&)rHint).GetDesignMode(); + bool bDesignMode = static_cast<const FmDesignModeChangedHint&>(rHint).GetDesignMode(); if (!bDesignMode && GetDrawFuncPtr()) { GetDrawFuncPtr()->Deactivate(); diff --git a/sw/source/uibase/uiview/view0.cxx b/sw/source/uibase/uiview/view0.cxx index 7424cf91fead..4777d66d01df 100644 --- a/sw/source/uibase/uiview/view0.cxx +++ b/sw/source/uibase/uiview/view0.cxx @@ -362,7 +362,7 @@ void SwView::ExecViewOptions(SfxRequest &rReq) if( pArgs && SfxItemState::SET == pArgs->GetItemState( nSlot , false, &pAttr )) { - bSet = ((SfxBoolItem*)pAttr)->GetValue(); + bSet = static_cast<const SfxBoolItem*>(pAttr)->GetValue(); eState = bSet ? STATE_ON : STATE_OFF; } diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx index 7dcde992313a..83470b960b3e 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -614,7 +614,7 @@ void SwView::Execute(SfxRequest &rReq) IDocumentRedlineAccess* pIDRA = m_pWrtShell->getIDocumentRedlineAccess(); Sequence <sal_Int8> aPasswd = pIDRA->GetRedlinePassword(); if( pArgs && SfxItemState::SET == pArgs->GetItemState(nSlot, false, &pItem ) - && ((SfxBoolItem*)pItem)->GetValue() == ( aPasswd.getLength() != 0 ) ) + && static_cast<const SfxBoolItem*>(pItem)->GetValue() == ( aPasswd.getLength() != 0 ) ) break; // xmlsec05: new password dialog @@ -822,7 +822,7 @@ void SwView::Execute(SfxRequest &rReq) if(pSdrView && pSdrView->AreObjectsMarked() && pSdrView->GetHdlList().GetFocusHdl()) { - ((SdrHdlList&)pSdrView->GetHdlList()).ResetFocusHdl(); + const_cast<SdrHdlList&>(pSdrView->GetHdlList()).ResetFocusHdl(); } else { @@ -843,7 +843,7 @@ void SwView::Execute(SfxRequest &rReq) { GetEditWin().SetApplyTemplate(SwApplyTemplate()); } - else if( ((SfxObjectShell*)GetDocShell())->IsInPlaceActive() ) + else if( static_cast<SfxObjectShell*>(GetDocShell())->IsInPlaceActive() ) { Escape(); } @@ -902,7 +902,7 @@ void SwView::Execute(SfxRequest &rReq) pCh = pVFrame->GetChildWindow( SID_NAVIGATOR ); } - ((SwNavigationPI*) pCh->GetContextWindow(SW_MOD()))->GotoPage(); + static_cast<SwNavigationPI*>( pCh->GetContextWindow(SW_MOD()))->GotoPage(); } break; case FN_EDIT_CURRENT_TOX: @@ -995,7 +995,7 @@ void SwView::Execute(SfxRequest &rReq) { if(pArgs && SfxItemState::SET == pArgs->GetItemState(nSlot, false, &pItem)) { - const sal_uInt16 nValue = ((SfxUInt16Item*)pItem)->GetValue(); + const sal_uInt16 nValue = static_cast<const SfxUInt16Item*>(pItem)->GetValue(); switch ( nSlot ) { case FN_INSERT_CTRL: @@ -1035,7 +1035,7 @@ void SwView::Execute(SfxRequest &rReq) case SID_ATTR_LANGUAGE : if(pArgs && SfxItemState::SET == pArgs->GetItemState(SID_ATTR_LANGUAGE, false, &pItem)) { - SvxLanguageItem aLang(((SvxLanguageItem*)pItem)->GetLanguage(), RES_CHRATR_LANGUAGE); + SvxLanguageItem aLang(static_cast<const SvxLanguageItem*>(pItem)->GetLanguage(), RES_CHRATR_LANGUAGE); m_pWrtShell->SetDefault( aLang ); lcl_SetAllTextToDefaultLanguage( *m_pWrtShell, RES_CHRATR_LANGUAGE ); } @@ -1074,7 +1074,7 @@ void SwView::Execute(SfxRequest &rReq) pVFrame->ToggleChildWindow( SID_NAVIGATOR ); pCh = pVFrame->GetChildWindow( SID_NAVIGATOR ); } - ((SwNavigationPI*) pCh->GetContextWindow(SW_MOD()))->CreateNavigationTool( + static_cast<SwNavigationPI*>( pCh->GetContextWindow(SW_MOD()))->CreateNavigationTool( GetVisArea(), true, &pVFrame->GetWindow()); } break; @@ -2028,9 +2028,9 @@ static sal_uInt16 lcl_PageDescWithHeader( const SwDoc& rDoc ) const SwFrmFmt& rMaster = rPageDesc.GetMaster(); const SfxPoolItem* pItem; if( ( SfxItemState::SET == rMaster.GetAttrSet().GetItemState( RES_HEADER, false, &pItem ) && - ((SwFmtHeader*)pItem)->IsActive() ) || + static_cast<const SwFmtHeader*>(pItem)->IsActive() ) || ( SfxItemState::SET == rMaster.GetAttrSet().GetItemState( RES_FOOTER, false, &pItem ) && - ((SwFmtFooter*)pItem)->IsActive()) ) + static_cast<const SwFmtFooter*>(pItem)->IsActive()) ) ++nRet; } return nRet; // number of page styles with active header/footer @@ -2223,9 +2223,9 @@ long SwView::InsertMedium( sal_uInt16 nSlotId, SfxMedium* pMedium, sal_Int16 nVe m_pWrtShell->EnterStdMode(); // delete selections if( bCompare ) - nFound = m_pWrtShell->CompareDoc( *((SwDocShell*)&xDocSh)->GetDoc() ); + nFound = m_pWrtShell->CompareDoc( *static_cast<SwDocShell*>(&xDocSh)->GetDoc() ); else - nFound = m_pWrtShell->MergeDoc( *((SwDocShell*)&xDocSh)->GetDoc() ); + nFound = m_pWrtShell->MergeDoc( *static_cast<SwDocShell*>(&xDocSh)->GetDoc() ); m_pWrtShell->EndAllAction(); diff --git a/sw/source/uibase/uiview/viewcoll.cxx b/sw/source/uibase/uiview/viewcoll.cxx index 2a4c521e214c..8f379b56ece3 100644 --- a/sw/source/uibase/uiview/viewcoll.cxx +++ b/sw/source/uibase/uiview/viewcoll.cxx @@ -49,11 +49,11 @@ void SwView::ExecColl(SfxRequest &rReq) if (pArgs && SfxItemState::SET == pArgs->GetItemState( nWhich , true, &pItem )) { - if( ((SfxStringItem*)pItem)->GetValue() != + if( static_cast<const SfxStringItem*>(pItem)->GetValue() != GetWrtShell().GetCurPageStyle(false) ) { SfxStringItem aName(SID_STYLE_APPLY, - ((SfxStringItem*)pItem)->GetValue()); + static_cast<const SfxStringItem*>(pItem)->GetValue()); SfxUInt16Item aFamItem( SID_STYLE_FAMILY, SFX_STYLE_FAMILY_PAGE); SwPtrItem aShell(FN_PARAM_WRTSHELL, GetWrtShellPtr()); diff --git a/sw/source/uibase/uiview/viewdlg2.cxx b/sw/source/uibase/uiview/viewdlg2.cxx index e3edf280d74b..59633e69980a 100644 --- a/sw/source/uibase/uiview/viewdlg2.cxx +++ b/sw/source/uibase/uiview/viewdlg2.cxx @@ -172,7 +172,7 @@ void SwView::InsertCaption(const InsCaptionOpt *pOpt) pOpt->CopyAttributes() ); // Set Number Format if(pType) - ((SwSetExpFieldType*)pType)->SetSeqFormat(pOpt->GetNumType()); + static_cast<SwSetExpFieldType*>(pType)->SetSeqFormat(pOpt->GetNumType()); rSh.UpdateExpFlds( true ); diff --git a/sw/source/uibase/uiview/viewdraw.cxx b/sw/source/uibase/uiview/viewdraw.cxx index 4e2bfe22d0c5..0d3661e80ed2 100644 --- a/sw/source/uibase/uiview/viewdraw.cxx +++ b/sw/source/uibase/uiview/viewdraw.cxx @@ -151,7 +151,7 @@ void SwView::ExecDraw(SfxRequest& rReq) //determine the size of the object if(pObj->IsGroupObject()) { - const Rectangle& rBoundRect = ((SdrObjGroup*)pObj)->GetCurrentBoundRect(); + const Rectangle& rBoundRect = static_cast<SdrObjGroup*>(pObj)->GetCurrentBoundRect(); aStartPos.X() -= rBoundRect.GetWidth()/2; aStartPos.Y() -= rBoundRect.GetHeight()/2; } @@ -490,7 +490,7 @@ bool SwView::EnterDrawTextMode(const Point& aDocPos) // To allow SwDrawVirtObj text objects to be activated, allow their type, too. ( pObj->ISA( SdrTextObj ) || ( pObj->ISA(SwDrawVirtObj) && - ((SwDrawVirtObj*)pObj)->GetReferencedObj().ISA(SdrTextObj) ) ) && + static_cast<SwDrawVirtObj*>(pObj)->GetReferencedObj().ISA(SdrTextObj) ) ) && !m_pWrtShell->IsSelObjProtected(FLYPROTECT_CONTENT)) { @@ -564,12 +564,12 @@ bool SwView::BeginTextEdit(SdrObject* pObj, SdrPageView* pPV, vcl::Window* pWin, if(pObj->ISA(SwDrawVirtObj)) { SwDrawVirtObj* pVirtObj = (SwDrawVirtObj*)pObj; - pToBeActivated = &((SdrObject&)pVirtObj->GetReferencedObj()); + pToBeActivated = &const_cast<SdrObject&>(pVirtObj->GetReferencedObj()); aNewTextEditOffset = pVirtObj->GetOffset(); } // set in each case, thus it will be correct for all objects - ((SdrTextObj*)pToBeActivated)->SetTextEditOffset(aNewTextEditOffset); + static_cast<SdrTextObj*>(pToBeActivated)->SetTextEditOffset(aNewTextEditOffset); bool bRet(pSdrView->SdrBeginTextEdit( pToBeActivated, pPV, pWin, true, pOutliner, 0, false, false, false )); diff --git a/sw/source/uibase/uiview/viewling.cxx b/sw/source/uibase/uiview/viewling.cxx index 8a880767c819..b9938c2691b4 100644 --- a/sw/source/uibase/uiview/viewling.cxx +++ b/sw/source/uibase/uiview/viewling.cxx @@ -242,7 +242,7 @@ void SwView::StartTextConversion( bool bOldIns = m_pWrtShell->IsInsMode(); m_pWrtShell->SetInsMode( true ); - const bool bSelection = ((SwCrsrShell*)m_pWrtShell)->HasSelection() || + const bool bSelection = static_cast<SwCrsrShell*>(m_pWrtShell)->HasSelection() || m_pWrtShell->GetCrsr() != m_pWrtShell->GetCrsr()->GetNext(); const bool bStart = bSelection || m_pWrtShell->IsStartOfDoc(); @@ -450,7 +450,7 @@ void SwView::HyphenateDocument() m_pWrtShell->StartUndo(UNDO_INSATTR); // valid later bool bHyphSpecial = xProp.is() && xProp->getIsHyphSpecial(); - bool bSelection = ((SwCrsrShell*)m_pWrtShell)->HasSelection() || + bool bSelection = static_cast<SwCrsrShell*>(m_pWrtShell)->HasSelection() || m_pWrtShell->GetCrsr() != m_pWrtShell->GetCrsr()->GetNext(); bool bOther = m_pWrtShell->HasOtherCnt() && bHyphSpecial && !bSelection; bool bStart = bSelection || ( !bOther && m_pWrtShell->IsStartOfDoc() ); @@ -488,7 +488,7 @@ bool SwView::IsValidSelectionForThesaurus() const // to be within a single paragraph const bool bMultiSel = m_pWrtShell->GetCrsr() != m_pWrtShell->GetCrsr()->GetNext(); - const bool bSelection = ((SwCrsrShell*)m_pWrtShell)->HasSelection(); + const bool bSelection = static_cast<SwCrsrShell*>(m_pWrtShell)->HasSelection(); return !bMultiSel && (!bSelection || m_pWrtShell->IsSelOnePara() ); } @@ -565,7 +565,7 @@ void SwView::StartThesaurus() pVOpt->SetIdle( false ); // get initial LookUp text - const bool bSelection = ((SwCrsrShell*)m_pWrtShell)->HasSelection(); + const bool bSelection = static_cast<SwCrsrShell*>(m_pWrtShell)->HasSelection(); OUString aTmp = GetThesaurusLookUpText( bSelection ); Reference< XThesaurus > xThes( ::GetThesaurus() ); @@ -708,8 +708,8 @@ bool SwView::ExecSpellPopup(const Point& rPt) //! 'custom made' menu... *sigh* (code copied from sfx2 and framework) if ( pMenu ) { - const sal_uInt16 nId = ((PopupMenu*)pMenu)->Execute(m_pEditWin, aPixPos); - OUString aCommand = ((PopupMenu*)pMenu)->GetItemCommand(nId); + const sal_uInt16 nId = static_cast<PopupMenu*>(pMenu)->Execute(m_pEditWin, aPixPos); + OUString aCommand = static_cast<PopupMenu*>(pMenu)->GetItemCommand(nId); if (aCommand.isEmpty() ) { if(!ExecuteMenuCommand(dynamic_cast<PopupMenu&>(*pMenu), *GetViewFrame(), nId )) diff --git a/sw/source/uibase/uiview/viewmdi.cxx b/sw/source/uibase/uiview/viewmdi.cxx index 0a1aba02f4f6..c49c8317e006 100644 --- a/sw/source/uibase/uiview/viewmdi.cxx +++ b/sw/source/uibase/uiview/viewmdi.cxx @@ -183,7 +183,7 @@ void SwView::_SetZoom( const Size &rEditSize, SvxZoomType eZoomType, } // Compromise solution - Under certain circumstances SetZoom is called // in CalcVisAreas again and thus be set wrong values. - ((SwViewOption*)m_pWrtShell->GetViewOptions())->SetZoomType( eZoomType ); + const_cast<SwViewOption*>(m_pWrtShell->GetViewOptions())->SetZoomType( eZoomType ); CalcVisArea( rEditSize ); // for the recalculation of the viewable area } else if ( nZoomFac != pOpt->GetZoom() ) @@ -197,7 +197,7 @@ void SwView::_SetZoom( const Size &rEditSize, SvxZoomType eZoomType, m_pVRuler->ForceUpdate(); m_pHRuler->SetZoom( aFrac ); m_pHRuler->ForceUpdate(); - ((SwViewOption*)m_pWrtShell->GetViewOptions())->SetZoomType( eZoomType ); + const_cast<SwViewOption*>(m_pWrtShell->GetViewOptions())->SetZoomType( eZoomType ); } // end of SwActContext scope m_pWrtShell->UnlockPaint(); diff --git a/sw/source/uibase/uiview/viewprt.cxx b/sw/source/uibase/uiview/viewprt.cxx index 59f18ac037c4..cfde02812e5b 100644 --- a/sw/source/uibase/uiview/viewprt.cxx +++ b/sw/source/uibase/uiview/viewprt.cxx @@ -290,7 +290,7 @@ void SetAppPrintOptions( SwViewShell* pSh, bool bWeb ) if(bWeb) aSet.Put(SfxUInt16Item(SID_HTML_MODE, - ::GetHtmlMode(((SwWrtShell*)pSh)->GetView().GetDocShell()))); + ::GetHtmlMode(static_cast<SwWrtShell*>(pSh)->GetView().GetDocShell()))); aSet.Put(SfxBoolItem(SID_PRINTER_NOTFOUND_WARN, aMisc.IsNotFoundWarning() )); aSet.Put(aAddPrinterItem); diff --git a/sw/source/uibase/uiview/viewtab.cxx b/sw/source/uibase/uiview/viewtab.cxx index ae8bf5be1409..506de8d35a15 100644 --- a/sw/source/uibase/uiview/viewtab.cxx +++ b/sw/source/uibase/uiview/viewtab.cxx @@ -261,7 +261,7 @@ void SwView::ExecTabWin( SfxRequest& rReq ) SvxLRSpaceItem aLR(RES_LR_SPACE); if ( !bSect && (bFrmSelection || nFrmType & FRMTYPE_FLY_ANY) ) { - SwFrmFmt* pFmt = ((SwFrmFmt*)rSh.GetFlyFrmFmt()); + SwFrmFmt* pFmt = static_cast<SwFrmFmt*>(rSh.GetFlyFrmFmt()); const SwRect &rRect = rSh.GetAnyCurRect(RECT_FLY_EMBEDDED); bool bVerticalFrame(false); @@ -420,7 +420,7 @@ void SwView::ExecTabWin( SfxRequest& rReq ) if( bFrmSelection || nFrmType & FRMTYPE_FLY_ANY ) { - SwFrmFmt* pFmt = ((SwFrmFmt*)rSh.GetFlyFrmFmt()); + SwFrmFmt* pFmt = static_cast<SwFrmFmt*>(rSh.GetFlyFrmFmt()); const SwRect &rRect = rSh.GetAnyCurRect(RECT_FLY_EMBEDDED); const long nDeltaY = rPageRect.Top() + aLongULSpace.GetUpper() - rRect.Top(); const long nHeight = nPageHeight - (aLongULSpace.GetUpper() + aLongULSpace.GetLower()); |