From aeb6c0ed64a76c722158bf91313b42561cd66071 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 1 Dec 2014 10:17:54 +0200 Subject: loplugin: cstylecast Change-Id: Id70cf0a2412de5d9b202b8209f0376c2f62a0669 --- sw/source/uibase/shells/annotsh.cxx | 64 ++++++++++++++++++------------------ sw/source/uibase/shells/basesh.cxx | 42 +++++++++++------------ sw/source/uibase/shells/beziersh.cxx | 2 +- sw/source/uibase/shells/drawsh.cxx | 6 ++-- sw/source/uibase/shells/drformsh.cxx | 2 +- sw/source/uibase/shells/drwbassh.cxx | 14 ++++---- sw/source/uibase/shells/drwtxtex.cxx | 54 +++++++++++++++--------------- sw/source/uibase/shells/drwtxtsh.cxx | 10 +++--- sw/source/uibase/shells/frmsh.cxx | 44 ++++++++++++------------- sw/source/uibase/shells/grfsh.cxx | 24 +++++++------- sw/source/uibase/shells/listsh.cxx | 2 +- sw/source/uibase/shells/tabsh.cxx | 54 +++++++++++++++--------------- sw/source/uibase/shells/textfld.cxx | 30 ++++++++--------- sw/source/uibase/shells/textglos.cxx | 12 +++---- sw/source/uibase/shells/textidx.cxx | 4 +-- sw/source/uibase/shells/textsh.cxx | 34 ++++++++++--------- sw/source/uibase/shells/textsh1.cxx | 36 ++++++++++---------- sw/source/uibase/shells/txtattr.cxx | 36 ++++++++++---------- sw/source/uibase/shells/txtnum.cxx | 4 +-- 19 files changed, 238 insertions(+), 236 deletions(-) (limited to 'sw') diff --git a/sw/source/uibase/shells/annotsh.cxx b/sw/source/uibase/shells/annotsh.cxx index 8c38710ab2bb..250b73b1c58a 100644 --- a/sw/source/uibase/shells/annotsh.cxx +++ b/sw/source/uibase/shells/annotsh.cxx @@ -195,8 +195,8 @@ void SwAnnotationShell::Exec( SfxRequest &rReq ) { case SID_ATTR_PARA_LRSPACE: { - SvxLRSpaceItem aParaMargin((const SvxLRSpaceItem&)rReq. - GetArgs()->Get(nSlot)); + SvxLRSpaceItem aParaMargin(static_cast(rReq. + GetArgs()->Get(nSlot))); aParaMargin.SetWhich( EE_PARA_LRSPACE ); aNewAttr.Put(aParaMargin); @@ -205,8 +205,8 @@ void SwAnnotationShell::Exec( SfxRequest &rReq ) } case SID_ATTR_PARA_LINESPACE: { - SvxLineSpacingItem aParaMargin = (const SvxLineSpacingItem&)pNewAttrs->Get( - GetPool().GetWhich(nSlot)); + SvxLineSpacingItem aParaMargin = static_cast(pNewAttrs->Get( + GetPool().GetWhich(nSlot))); aParaMargin.SetWhich( EE_PARA_SBL ); aNewAttr.Put(aParaMargin); @@ -215,8 +215,8 @@ void SwAnnotationShell::Exec( SfxRequest &rReq ) } case SID_ATTR_PARA_ULSPACE: { - SvxULSpaceItem aULSpace = (const SvxULSpaceItem&)pNewAttrs->Get( - GetPool().GetWhich(nSlot)); + SvxULSpaceItem aULSpace = static_cast(pNewAttrs->Get( + GetPool().GetWhich(nSlot))); aULSpace.SetWhich( EE_PARA_ULSPACE ); aNewAttr.Put( aULSpace ); rReq.Done(); @@ -248,7 +248,7 @@ void SwAnnotationShell::Exec( SfxRequest &rReq ) } else { - FontUnderline eFU = ( (const SvxUnderlineItem&) aEditAttr.Get( EE_CHAR_UNDERLINE ) ).GetLineStyle(); + FontUnderline eFU = static_cast( aEditAttr.Get( EE_CHAR_UNDERLINE ) ).GetLineStyle(); aNewAttr.Put( SvxUnderlineItem( eFU != UNDERLINE_NONE ?UNDERLINE_NONE : UNDERLINE_SINGLE, EE_CHAR_UNDERLINE ) ); } } @@ -256,7 +256,7 @@ void SwAnnotationShell::Exec( SfxRequest &rReq ) } case SID_ATTR_CHAR_OVERLINE: { - FontUnderline eFO = ((const SvxOverlineItem&)aEditAttr.Get(EE_CHAR_OVERLINE)).GetLineStyle(); + FontUnderline eFO = static_cast(aEditAttr.Get(EE_CHAR_OVERLINE)).GetLineStyle(); aNewAttr.Put(SvxOverlineItem(eFO == UNDERLINE_SINGLE ? UNDERLINE_NONE : UNDERLINE_SINGLE, EE_CHAR_OVERLINE)); break; } @@ -324,7 +324,7 @@ void SwAnnotationShell::Exec( SfxRequest &rReq ) case FN_SET_SUPER_SCRIPT: { SvxEscapementItem aItem(EE_CHAR_ESCAPEMENT); - SvxEscapement eEsc = (SvxEscapement ) ( (const SvxEscapementItem&) + SvxEscapement eEsc = (SvxEscapement ) static_cast( aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue(); if( eEsc == SVX_ESCAPEMENT_SUPERSCRIPT ) @@ -337,7 +337,7 @@ void SwAnnotationShell::Exec( SfxRequest &rReq ) case FN_SET_SUB_SCRIPT: { SvxEscapementItem aItem(EE_CHAR_ESCAPEMENT); - SvxEscapement eEsc = (SvxEscapement ) ( (const SvxEscapementItem&) + SvxEscapement eEsc = (SvxEscapement ) static_cast( aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue(); if( eEsc == SVX_ESCAPEMENT_SUBSCRIPT ) @@ -355,7 +355,7 @@ void SwAnnotationShell::Exec( SfxRequest &rReq ) if(pItem) { - const SvxHyperlinkItem& rHLinkItem = *(const SvxHyperlinkItem *)pItem; + const SvxHyperlinkItem& rHLinkItem = *static_cast(pItem); SvxURLField aFld(rHLinkItem.GetURL(), rHLinkItem.GetName(), SVXURLFORMAT_APPDEFAULT); aFld.SetTargetFrame(rHLinkItem.GetTargetFrame()); @@ -408,7 +408,7 @@ void SwAnnotationShell::Exec( SfxRequest &rReq ) if(pNewAttrs) pNewAttrs->GetItemState(nSlot, false, &pItem ); if (pPostItMgr->GetActiveSidebarWin()->GetLayoutStatus()!=SwPostItHelper::DELETED) - pOLV->InsertText(((const SfxStringItem *)pItem)->GetValue()); + pOLV->InsertText(static_cast(pItem)->GetValue()); break; } @@ -456,7 +456,7 @@ void SwAnnotationShell::Exec( SfxRequest &rReq ) pVFrame->ToggleChildWindow(FN_WORDCOUNT_DIALOG); Invalidate(rReq.GetSlot()); - SwWordCountWrapper *pWrdCnt = (SwWordCountWrapper*)pVFrame->GetChildWindow(SwWordCountWrapper::GetChildWindowId()); + SwWordCountWrapper *pWrdCnt = static_cast(pVFrame->GetChildWindow(SwWordCountWrapper::GetChildWindowId())); if (pWrdCnt) pWrdCnt->UpdateCounts(); } @@ -568,7 +568,7 @@ void SwAnnotationShell::Exec( SfxRequest &rReq ) const SfxPoolItem* pPoolItem; if( pNewAttrs && SfxItemState::SET == pNewAttrs->GetItemState( nSlot, true, &pPoolItem ) ) { - if( !( (SfxBoolItem*)pPoolItem)->GetValue() ) + if( !static_cast(pPoolItem)->GetValue() ) bLeftToRight = !bLeftToRight; } SfxItemSet aAttr( *aNewAttr.GetPool(), @@ -578,7 +578,7 @@ void SwAnnotationShell::Exec( SfxRequest &rReq ) sal_uInt16 nAdjust = SVX_ADJUST_LEFT; if( SfxItemState::SET == aEditAttr.GetItemState(EE_PARA_JUST, true, &pPoolItem ) ) - nAdjust = ( (SvxAdjustItem*)pPoolItem)->GetEnumValue(); + nAdjust = static_cast(pPoolItem)->GetEnumValue(); if( bLeftToRight ) { @@ -638,7 +638,7 @@ void SwAnnotationShell::GetState(SfxItemSet& rSet) SfxItemState eState = aEditAttr.GetItemState( EE_PARA_LRSPACE ); if( eState >= SfxItemState::DEFAULT ) { - SvxLRSpaceItem aLR = ( (const SvxLRSpaceItem&) aEditAttr.Get( EE_PARA_LRSPACE ) ); + SvxLRSpaceItem aLR = static_cast( aEditAttr.Get( EE_PARA_LRSPACE ) ); aLR.SetWhich(SID_ATTR_PARA_LRSPACE); rSet.Put(aLR); } @@ -651,7 +651,7 @@ void SwAnnotationShell::GetState(SfxItemSet& rSet) SfxItemState eState = aEditAttr.GetItemState( EE_PARA_SBL ); if( eState >= SfxItemState::DEFAULT ) { - SvxLineSpacingItem aLR = ( (const SvxLineSpacingItem&) aEditAttr.Get( EE_PARA_SBL ) ); + SvxLineSpacingItem aLR = static_cast( aEditAttr.Get( EE_PARA_SBL ) ); rSet.Put(aLR); } else @@ -663,7 +663,7 @@ void SwAnnotationShell::GetState(SfxItemSet& rSet) SfxItemState eState = aEditAttr.GetItemState( EE_PARA_ULSPACE ); if( eState >= SfxItemState::DEFAULT ) { - SvxULSpaceItem aULSpace = (const SvxULSpaceItem&) aEditAttr.Get( EE_PARA_ULSPACE ); + SvxULSpaceItem aULSpace = static_cast( aEditAttr.Get( EE_PARA_ULSPACE ) ); aULSpace.SetWhich(SID_ATTR_PARA_ULSPACE); rSet.Put(aULSpace); } @@ -711,7 +711,7 @@ void SwAnnotationShell::GetState(SfxItemSet& rSet) if( !pEscItem ) pEscItem = &aEditAttr.Get( EE_CHAR_ESCAPEMENT ); - if( nEsc == ((const SvxEscapementItem*)pEscItem)->GetEnumValue() ) + if( nEsc == static_cast(pEscItem)->GetEnumValue() ) rSet.Put( SfxBoolItem( nWhich, true )); else rSet.InvalidateItem( nWhich ); @@ -741,7 +741,7 @@ void SwAnnotationShell::GetState(SfxItemSet& rSet) rSet.InvalidateItem( nSlotId ), nSlotId = 0; else { - if ( eAdjust == ((const SvxAdjustItem*)pAdjust)->GetAdjust()) + if ( eAdjust == static_cast(pAdjust)->GetAdjust()) rSet.Put( SfxBoolItem( nWhich, true )); else rSet.InvalidateItem( nWhich ); @@ -769,7 +769,7 @@ void SwAnnotationShell::GetState(SfxItemSet& rSet) rSet.InvalidateItem( nSlotId ), nSlotId = 0; else { - if( nLSpace == ((const SvxLineSpacingItem*)pLSpace)->GetPropLineSpace() ) + if( nLSpace == static_cast(pLSpace)->GetPropLineSpace() ) rSet.Put( SfxBoolItem( nWhich, true )); else rSet.InvalidateItem( nWhich ); @@ -780,7 +780,7 @@ void SwAnnotationShell::GetState(SfxItemSet& rSet) { const SfxPoolItem* pState = rView.GetSlotState(nWhich); if (pState) - rSet.Put(SfxBoolItem(nWhich, ((const SfxBoolItem*)pState)->GetValue())); + rSet.Put(SfxBoolItem(nWhich, static_cast(pState)->GetValue())); else rSet.DisableItem( nWhich ); break; @@ -797,7 +797,7 @@ void SwAnnotationShell::GetState(SfxItemSet& rSet) else { bool bFlag = false; - switch( ( ( (SvxFrameDirectionItem&) aEditAttr.Get( EE_PARA_WRITINGDIR ) ) ).GetValue() ) + switch( static_cast( aEditAttr.Get( EE_PARA_WRITINGDIR ) ).GetValue() ) { case FRMDIR_HORI_LEFT_TOP: { @@ -920,7 +920,7 @@ void SwAnnotationShell::ExecClpbrd(SfxRequest &rReq) if ( rReq.GetArgs() && rReq.GetArgs()->GetItemState(nSlot, true, &pItem) == SfxItemState::SET && pItem->ISA(SfxUInt32Item) ) { - nFormat = ((const SfxUInt32Item*)pItem)->GetValue(); + nFormat = static_cast(pItem)->GetValue(); } if ( nFormat ) @@ -1044,9 +1044,9 @@ void SwAnnotationShell::StateInsert(SfxItemSet &rSet) if (pField->ISA(SvxURLField)) { - aHLinkItem.SetName(((const SvxURLField*) pField)->GetRepresentation()); - aHLinkItem.SetURL(((const SvxURLField*) pField)->GetURL()); - aHLinkItem.SetTargetFrame(((const SvxURLField*) pField)->GetTargetFrame()); + aHLinkItem.SetName(static_cast( pField)->GetRepresentation()); + aHLinkItem.SetURL(static_cast( pField)->GetURL()); + aHLinkItem.SetTargetFrame(static_cast( pField)->GetTargetFrame()); } } else @@ -1342,7 +1342,7 @@ void SwAnnotationShell::GetLinguState(SfxItemSet &rSet) const SfxPoolItem &rItem = rView.GetWrtShell().GetDoc()->GetDefault( GetWhichOfScript( RES_CHRATR_LANGUAGE, GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage())) ); - LanguageType nLang = ((const SvxLanguageItem &) + LanguageType nLang = static_cast( rItem).GetLanguage(); uno::Reference< linguistic2::XThesaurus > xThes( ::GetThesaurus() ); if (!xThes.is() || nLang == LANGUAGE_NONE || @@ -1645,7 +1645,7 @@ void SwAnnotationShell::InsertSymbol(SfxRequest& rReq) OUString sFontName; if ( pItem ) { - sSym = ((const SfxStringItem*)pItem)->GetValue(); + sSym = static_cast(pItem)->GetValue(); const SfxPoolItem* pFtItem = NULL; pArgs->GetItemState( GetPool().GetWhich(SID_ATTR_SPECIALCHAR), false, &pFtItem); const SfxStringItem* pFontItem = PTR_CAST( SfxStringItem, pFtItem ); @@ -1661,11 +1661,11 @@ void SwAnnotationShell::InsertSymbol(SfxRequest& rReq) aSetItem.GetItemSet().Put( aSet, false ); const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScript ); if( pI ) - aSetDlgFont = *(SvxFontItem*)pI; + aSetDlgFont = *static_cast(pI); else - aSetDlgFont = (SvxFontItem&)aSet.Get( GetWhichOfScript( + aSetDlgFont = static_cast(aSet.Get( GetWhichOfScript( SID_ATTR_CHAR_FONT, - GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage() ) )); + GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage() ) ))); if (sFontName.isEmpty()) sFontName = aSetDlgFont.GetFamilyName(); } diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx index 4bbccb4b2eaa..7a5b68bd26df 100644 --- a/sw/source/uibase/shells/basesh.cxx +++ b/sw/source/uibase/shells/basesh.cxx @@ -131,11 +131,11 @@ static sal_uInt8 nFooterPos; #include #include "swslots.hxx" -#define SWCONTOURDLG(rView) ( (SvxContourDlg*) ( rView.GetViewFrame()->GetChildWindow( \ +#define SWCONTOURDLG(rView) ( static_cast( rView.GetViewFrame()->GetChildWindow( \ SvxContourDlgChildWindow::GetChildWindowId() )-> \ GetWindow() ) ) -#define SWIMAPDLG(rView) ( (SvxIMapDlg*) ( rView.GetViewFrame()->GetChildWindow( \ +#define SWIMAPDLG(rView) ( static_cast( rView.GetViewFrame()->GetChildWindow( \ SvxIMapDlgChildWindow::GetChildWindowId() )-> \ GetWindow() ) ) @@ -165,7 +165,7 @@ static void lcl_UpdateIMapDlg( SwWrtShell& rSh ) SfxItemSet aSet( rSh.GetAttrPool(), RES_URL, RES_URL ); rSh.GetFlyFrmAttr( aSet ); - const SwFmtURL &rURL = (SwFmtURL&)aSet.Get( RES_URL ); + const SwFmtURL &rURL = static_cast(aSet.Get( RES_URL )); SvxIMapDlgChildWindow::UpdateIMapDlg( aGrf, rURL.GetMap(), pList.get(), pEditObj ); } @@ -740,9 +740,9 @@ void SwBaseShell::Execute(SfxRequest &rReq) sal_uInt16 nCount; if(SfxItemState::SET == pArgs->GetItemState(nSlot)) - nCount = ((SfxUInt16Item &)pArgs->Get(nSlot)).GetValue(); + nCount = static_cast(pArgs->Get(nSlot)).GetValue(); else - nCount = ((SfxUInt16Item &)pArgs->Get(SID_ATTR_COLUMNS)).GetValue(); + nCount = static_cast(pArgs->Get(SID_ATTR_COLUMNS)).GetValue(); sal_uInt16 nGutterWidth = DEF_GUTTER_WIDTH; aFmtCol.Init(nCount ? nCount : 1, nGutterWidth, USHRT_MAX); @@ -918,7 +918,7 @@ void SwBaseShell::Execute(SfxRequest &rReq) { SfxItemSet aSet( rSh.GetAttrPool(), RES_URL, RES_URL ); rSh.GetFlyFrmAttr( aSet ); - SwFmtURL aURL( (SwFmtURL&)aSet.Get( RES_URL ) ); + SwFmtURL aURL( static_cast(aSet.Get( RES_URL )) ); aURL.SetMap( &pDlg->GetImageMap() ); aSet.Put( aURL ); rSh.SetFlyFrmAttr( aSet ); @@ -953,7 +953,7 @@ void SwBaseShell::Execute(SfxRequest &rReq) rSh.StartAction(); SfxItemSet aSet( rSh.GetAttrPool(), RES_SURROUND, RES_SURROUND); rSh.GetFlyFrmAttr( aSet ); - SwFmtSurround aSur( (SwFmtSurround&)aSet.Get( RES_SURROUND ) ); + SwFmtSurround aSur( static_cast(aSet.Get( RES_SURROUND )) ); if ( !aSur.IsContour() ) { aSur.SetContour( true ); @@ -1022,9 +1022,9 @@ void SwBaseShell::Execute(SfxRequest &rReq) SfxItemSet aSet(GetPool(), RES_SURROUND, RES_HORI_ORIENT); rSh.GetFlyFrmAttr(aSet); - const SwFmtSurround& rSurround = (const SwFmtSurround&)aSet.Get(RES_SURROUND); - const SwFmtVertOrient& rVert = (const SwFmtVertOrient&)aSet.Get(RES_VERT_ORIENT); - const SwFmtHoriOrient& rHori = (const SwFmtHoriOrient&)aSet.Get(RES_HORI_ORIENT); + const SwFmtSurround& rSurround = static_cast(aSet.Get(RES_SURROUND)); + const SwFmtVertOrient& rVert = static_cast(aSet.Get(RES_VERT_ORIENT)); + const SwFmtHoriOrient& rHori = static_cast(aSet.Get(RES_HORI_ORIENT)); sal_Int16 eVOrient = rVert.GetVertOrient(); sal_Int16 eHOrient = rHori.GetHoriOrient(); SwSurround eSurround = rSurround.GetSurround(); @@ -1233,7 +1233,7 @@ IMPL_LINK_NOARG(SwBaseShell, GraphicArrivedHdl) { sal_uInt16 nId = SvxIMapDlgChildWindow::GetChildWindowId(); SvxIMapDlg *pDlg = pVFrame->HasChildWindow( nId ) ? - (SvxIMapDlg*) ( pVFrame->GetChildWindow( nId ) + static_cast( pVFrame->GetChildWindow( nId ) ->GetWindow()) : 0; if( pDlg && ( SID_IMAP_EXEC == nSlot || @@ -1251,7 +1251,7 @@ IMPL_LINK_NOARG(SwBaseShell, GraphicArrivedHdl) { sal_uInt16 nId = SvxContourDlgChildWindow::GetChildWindowId(); SvxIMapDlg *pDlg = pVFrame->HasChildWindow( nId ) ? - (SvxIMapDlg*) ( pVFrame->GetChildWindow( nId ) + static_cast( pVFrame->GetChildWindow( nId ) ->GetWindow()) : 0; if( pDlg && pDlg->GetEditingObject() != rSh.GetIMapInventor() ) @@ -1267,7 +1267,7 @@ IMPL_LINK_NOARG(SwBaseShell, GraphicArrivedHdl) { SfxItemSet aSet(GetPool(), RES_SURROUND, RES_SURROUND); rSh.GetFlyFrmAttr(aSet); - const SwFmtSurround& rWrap = (const SwFmtSurround&)aSet.Get(RES_SURROUND); + const SwFmtSurround& rWrap = static_cast(aSet.Get(RES_SURROUND)); bSetState = true; bState = rWrap.IsContour(); } @@ -1381,7 +1381,7 @@ void SwBaseShell::GetState( SfxItemSet &rSet ) else rSh.GetCurAttr( aSet ); - const SvxShadowItem& rShItem = (const SvxShadowItem&)aSet.Get(nWhich); + const SvxShadowItem& rShItem = static_cast(aSet.Get(nWhich)); rSet.Put(rShItem); } break; @@ -1629,9 +1629,9 @@ void SwBaseShell::GetState( SfxItemSet &rSet ) rSh.GetFlyFrmAttr(aSet); nAnchorType = static_cast(aSet.Get(RES_ANCHOR)).GetAnchorId(); } - const SwFmtSurround& rWrap = (const SwFmtSurround&)aSet.Get(RES_SURROUND); + const SwFmtSurround& rWrap = static_cast(aSet.Get(RES_SURROUND)); - const SvxOpaqueItem& rOpaque = (const SvxOpaqueItem&)aSet.Get(RES_OPAQUE); + const SvxOpaqueItem& rOpaque = static_cast(aSet.Get(RES_OPAQUE)); bool bOpaque = rOpaque.GetValue(); SwSurround nSurround = rWrap.GetSurround(); bool bSet = false; @@ -1798,7 +1798,7 @@ void SwBaseShell::SetWrapMode( sal_uInt16 nSlot ) rSh.GetObjAttr(aSet); else rSh.GetFlyFrmAttr(aSet); - SwFmtSurround aWrap( (SwFmtSurround&)aSet.Get(RES_SURROUND) ); + SwFmtSurround aWrap( static_cast(aSet.Get(RES_SURROUND)) ); SwSurround nOldSurround(aWrap.GetSurround()); SwSurround nSurround = SURROUND_PARALLEL; @@ -2226,7 +2226,7 @@ void SwBaseShell::ExecBckCol(SfxRequest& rReq) if(pArgs) { - const SvxColorItem& rNewColorItem = (const SvxColorItem&)pArgs->Get(SID_BACKGROUND_COLOR); + const SvxColorItem& rNewColorItem = static_cast(pArgs->Get(SID_BACKGROUND_COLOR)); const Color& rNewColor = rNewColorItem.GetValue(); aBrushItem.SetColor(rNewColor); GetView().GetViewFrame()->GetBindings().SetState(rNewColorItem); @@ -2242,7 +2242,7 @@ void SwBaseShell::ExecBckCol(SfxRequest& rReq) case SID_ATTR_BRUSH: case RES_BACKGROUND: { - const SvxBrushItem& rNewBrushItem = (const SvxBrushItem&)pArgs->Get(GetPool().GetWhich(nSlot)); + const SvxBrushItem& rNewBrushItem = static_cast(pArgs->Get(GetPool().GetWhich(nSlot))); aBrushItem = rNewBrushItem; break; } @@ -2471,8 +2471,8 @@ void SwBaseShell::ExecDlg(SfxRequest &rReq) if ( pDlg->Execute() == RET_OK ) { - rSh.SetBoxBackground( (SvxBrushItem&) - pDlg->GetOutputItemSet()->Get( RES_BACKGROUND )); + rSh.SetBoxBackground( static_cast( + pDlg->GetOutputItemSet()->Get( RES_BACKGROUND ))); pOutSet = pDlg->GetOutputItemSet(); } } diff --git a/sw/source/uibase/shells/beziersh.cxx b/sw/source/uibase/shells/beziersh.cxx index f272e32d9998..301a98e17434 100644 --- a/sw/source/uibase/shells/beziersh.cxx +++ b/sw/source/uibase/shells/beziersh.cxx @@ -197,7 +197,7 @@ void SwBezierShell::Execute(SfxRequest &rReq) case SID_BEZIER_CLOSE: { - SdrPathObj* pPathObj = (SdrPathObj*) rMarkList.GetMark(0)->GetMarkedSdrObj(); + SdrPathObj* pPathObj = static_cast( rMarkList.GetMark(0)->GetMarkedSdrObj() ); pSdrView->UnmarkAllPoints(); // Size aDist(GetView().GetEditWin().PixelToLogic(Size(8,8))); pPathObj->ToggleClosed(); // aDist.Width()); diff --git a/sw/source/uibase/shells/drawsh.cxx b/sw/source/uibase/shells/drawsh.cxx index 7102206994ba..7ea637ec7976 100644 --- a/sw/source/uibase/shells/drawsh.cxx +++ b/sw/source/uibase/shells/drawsh.cxx @@ -148,7 +148,7 @@ void SwDrawShell::InsertPictureFromFile(SdrObject& rObject) if(dynamic_cast< SdrGrafObj* >(&rObject)) { - SdrGrafObj* pNewGrafObj = (SdrGrafObj*)rObject.Clone(); + SdrGrafObj* pNewGrafObj = static_cast(rObject.Clone()); pNewGrafObj->SetGraphic(aGraphic); @@ -344,7 +344,7 @@ void SwDrawShell::Execute(SfxRequest &rReq) pVFrame->ToggleChildWindow(FN_WORDCOUNT_DIALOG); Invalidate(rReq.GetSlot()); - SwWordCountWrapper *pWrdCnt = (SwWordCountWrapper*)pVFrame->GetChildWindow(SwWordCountWrapper::GetChildWindowId()); + SwWordCountWrapper *pWrdCnt = static_cast(pVFrame->GetChildWindow(SwWordCountWrapper::GetChildWindowId())); if (pWrdCnt) pWrdCnt->UpdateCounts(); } @@ -613,7 +613,7 @@ void SwDrawShell::GetFormTextState(SfxItemSet& rSet) SfxViewFrame* pVFrame = GetView().GetViewFrame(); if ( pVFrame->HasChildWindow(nId) ) - pDlg = (SvxFontWorkDialog*)(pVFrame->GetChildWindow(nId)->GetWindow()); + pDlg = static_cast(pVFrame->GetChildWindow(nId)->GetWindow()); if ( rMarkList.GetMarkCount() == 1 ) pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); diff --git a/sw/source/uibase/shells/drformsh.cxx b/sw/source/uibase/shells/drformsh.cxx index 9d2916dd53d4..35d2991ddbba 100644 --- a/sw/source/uibase/shells/drformsh.cxx +++ b/sw/source/uibase/shells/drformsh.cxx @@ -83,7 +83,7 @@ void SwDrawFormShell::Execute(SfxRequest &rReq) if(pItem) { SdrView *pSdrView = rSh.GetDrawView(); - const SvxHyperlinkItem& rHLinkItem = *(const SvxHyperlinkItem *)pItem; + const SvxHyperlinkItem& rHLinkItem = *static_cast(pItem); bool bConvertToText = rHLinkItem.GetInsertMode() == HLINK_DEFAULT || rHLinkItem.GetInsertMode() == HLINK_FIELD; const SdrMarkList& rMarkList = pSdrView->GetMarkedObjectList(); diff --git a/sw/source/uibase/shells/drwbassh.cxx b/sw/source/uibase/shells/drwbassh.cxx index a2a6c72c930a..75f4c6ad4132 100644 --- a/sw/source/uibase/shells/drwbassh.cxx +++ b/sw/source/uibase/shells/drwbassh.cxx @@ -114,7 +114,7 @@ void SwDrawBaseShell::Execute(SfxRequest &rReq) if(pItem && nSlotId == SID_OBJECT_ALIGN) { OSL_ENSURE(PTR_CAST(SfxEnumItem, pItem),"SfxEnumItem expected"); - nSlotId = nSlotId + ((const SfxEnumItem*)pItem)->GetValue(); + nSlotId = nSlotId + static_cast(pItem)->GetValue(); nSlotId++; } @@ -160,7 +160,7 @@ void SwDrawBaseShell::Execute(SfxRequest &rReq) const SfxItemSet* pOutSet = pDlg->GetOutputItemSet(); if(SfxItemState::SET == pOutSet->GetItemState(FN_DRAW_WRAP_DLG, false, &pWrapItem)) { - short nLayer = ((const SfxInt16Item*)pWrapItem)->GetValue(); + short nLayer = static_cast(pWrapItem)->GetValue(); if (nLayer == 1) pSh->SelectionToHeaven(); else @@ -237,12 +237,12 @@ void SwDrawBaseShell::Execute(SfxRequest &rReq) aSet.Put( pFrmFmt->GetFmtAttr(RES_FOLLOW_TEXT_FLOW) ); - SwFmtVertOrient aVOrient((const SwFmtVertOrient&)pFrmFmt->GetFmtAttr(RES_VERT_ORIENT)); + SwFmtVertOrient aVOrient(static_cast(pFrmFmt->GetFmtAttr(RES_VERT_ORIENT))); aSet.Put(SfxInt16Item(SID_ATTR_TRANSFORM_VERT_ORIENT, aVOrient.GetVertOrient())); aSet.Put(SfxInt16Item(SID_ATTR_TRANSFORM_VERT_RELATION, aVOrient.GetRelationOrient() )); aSet.Put(SfxInt32Item(SID_ATTR_TRANSFORM_VERT_POSITION, aVOrient.GetPos())); - SwFmtHoriOrient aHOrient((const SwFmtHoriOrient&)pFrmFmt->GetFmtAttr(RES_HORI_ORIENT)); + SwFmtHoriOrient aHOrient(static_cast(pFrmFmt->GetFmtAttr(RES_HORI_ORIENT))); aSet.Put(SfxInt16Item(SID_ATTR_TRANSFORM_HORI_ORIENT, aHOrient.GetHoriOrient())); aSet.Put(SfxInt16Item(SID_ATTR_TRANSFORM_HORI_RELATION, aHOrient.GetRelationOrient() )); aSet.Put(SfxBoolItem(SID_ATTR_TRANSFORM_HORI_MIRROR, aHOrient.IsPosToggle())); @@ -280,12 +280,12 @@ void SwDrawBaseShell::Execute(SfxRequest &rReq) SID_ATTR_TRANSFORM_ANCHOR, false, &pAnchorItem)) { if(!bSingleSelection) - pSh->ChgAnchor(((const SfxInt16Item*)pAnchorItem) + pSh->ChgAnchor(static_cast(pAnchorItem) ->GetValue(), false, bPosCorr ); else { SwFmtAnchor aAnchor(pFrmFmt->GetAnchor()); - aAnchor.SetType((RndStdIds)((const SfxInt16Item*)pAnchorItem)->GetValue()); + aAnchor.SetType((RndStdIds)static_cast(pAnchorItem)->GetValue()); aFrmAttrSet.Put( aAnchor ); } } @@ -460,7 +460,7 @@ void SwDrawBaseShell::Execute(SfxRequest &rReq) pSh->StartAction(); SdrObject* pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); SwFrmFmt* pFrmFmt = FindFrmFmt( pObj ); - SwFmtVertOrient aVOrient((SwFmtVertOrient&)pFrmFmt->GetFmtAttr(RES_VERT_ORIENT)); + SwFmtVertOrient aVOrient(static_cast(pFrmFmt->GetFmtAttr(RES_VERT_ORIENT))); aVOrient.SetVertOrient( nVertOrient ); pFrmFmt->SetFmtAttr(aVOrient); pSh->EndAction(); diff --git a/sw/source/uibase/shells/drwtxtex.cxx b/sw/source/uibase/shells/drwtxtex.cxx index 0b8a4da5823e..1104ea63bdb6 100644 --- a/sw/source/uibase/shells/drwtxtex.cxx +++ b/sw/source/uibase/shells/drwtxtex.cxx @@ -180,7 +180,7 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) } else { - FontUnderline eFU = ((const SvxUnderlineItem&)aEditAttr.Get(EE_CHAR_UNDERLINE)).GetLineStyle(); + FontUnderline eFU = static_cast(aEditAttr.Get(EE_CHAR_UNDERLINE)).GetLineStyle(); aNewAttr.Put( SvxUnderlineItem(eFU == UNDERLINE_SINGLE ? UNDERLINE_NONE : UNDERLINE_SINGLE, EE_CHAR_UNDERLINE) ); } } @@ -188,7 +188,7 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) case SID_ATTR_CHAR_OVERLINE: { - FontUnderline eFO = ((const SvxOverlineItem&)aEditAttr.Get(EE_CHAR_OVERLINE)).GetLineStyle(); + FontUnderline eFO = static_cast(aEditAttr.Get(EE_CHAR_OVERLINE)).GetLineStyle(); aNewAttr.Put(SvxOverlineItem(eFO == UNDERLINE_SINGLE ? UNDERLINE_NONE : UNDERLINE_SINGLE, EE_CHAR_OVERLINE)); } break; @@ -217,8 +217,8 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) break; case SID_ATTR_PARA_LRSPACE: { - SvxLRSpaceItem aParaMargin((const SvxLRSpaceItem&)rReq. - GetArgs()->Get(nSlot)); + SvxLRSpaceItem aParaMargin(static_cast(rReq. + GetArgs()->Get(nSlot))); aParaMargin.SetWhich( EE_PARA_LRSPACE ); aNewAttr.Put(aParaMargin); rReq.Done(); @@ -226,8 +226,8 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) break; case SID_ATTR_PARA_LINESPACE: { - SvxLineSpacingItem aLineSpace = (const SvxLineSpacingItem&)pNewAttrs->Get( - GetPool().GetWhich(nSlot)); + SvxLineSpacingItem aLineSpace = static_cast(pNewAttrs->Get( + GetPool().GetWhich(nSlot))); aLineSpace.SetWhich( EE_PARA_SBL ); aNewAttr.Put( aLineSpace ); rReq.Done(); @@ -235,8 +235,8 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) break; case SID_ATTR_PARA_ULSPACE: { - SvxULSpaceItem aULSpace = (const SvxULSpaceItem&)pNewAttrs->Get( - GetPool().GetWhich(nSlot)); + SvxULSpaceItem aULSpace = static_cast(pNewAttrs->Get( + GetPool().GetWhich(nSlot))); aULSpace.SetWhich( EE_PARA_ULSPACE ); aNewAttr.Put( aULSpace ); rReq.Done(); @@ -268,7 +268,7 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) case FN_SET_SUPER_SCRIPT: { SvxEscapementItem aItem(EE_CHAR_ESCAPEMENT); - SvxEscapement eEsc = (SvxEscapement ) ( (const SvxEscapementItem&) + SvxEscapement eEsc = (SvxEscapement ) static_cast( aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue(); if( eEsc == SVX_ESCAPEMENT_SUPERSCRIPT ) @@ -281,7 +281,7 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) case FN_SET_SUB_SCRIPT: { SvxEscapementItem aItem(EE_CHAR_ESCAPEMENT); - SvxEscapement eEsc = (SvxEscapement ) ( (const SvxEscapementItem&) + SvxEscapement eEsc = (SvxEscapement ) static_cast( aEditAttr.Get( EE_CHAR_ESCAPEMENT ) ).GetEnumValue(); if( eEsc == SVX_ESCAPEMENT_SUBSCRIPT ) @@ -395,7 +395,7 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) pVFrame->ToggleChildWindow(FN_WORDCOUNT_DIALOG); Invalidate(rReq.GetSlot()); - SwWordCountWrapper *pWrdCnt = (SwWordCountWrapper*)pVFrame->GetChildWindow(SwWordCountWrapper::GetChildWindowId()); + SwWordCountWrapper *pWrdCnt = static_cast(pVFrame->GetChildWindow(SwWordCountWrapper::GetChildWindowId())); if (pWrdCnt) pWrdCnt->UpdateCounts(); } @@ -451,7 +451,7 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) SdrOutliner * pOutliner = pSdrView->GetTextEditOutliner(); sal_uInt32 nCtrl = pOutliner->GetControlWord(); - bool bSet = ((const SfxBoolItem&)rReq.GetArgs()->Get( + bool bSet = static_cast(rReq.GetArgs()->Get( nSlot)).GetValue(); if(bSet) nCtrl |= EE_CNTRL_ONLINESPELLING|EE_CNTRL_ALLOWBIGOBJS; @@ -470,7 +470,7 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) if(pItem) { - const SvxHyperlinkItem& rHLinkItem = *(const SvxHyperlinkItem *)pItem; + const SvxHyperlinkItem& rHLinkItem = *static_cast(pItem); SvxURLField aFld(rHLinkItem.GetURL(), rHLinkItem.GetName(), SVXURLFORMAT_APPDEFAULT); aFld.SetTargetFrame(rHLinkItem.GetTargetFrame()); @@ -526,7 +526,7 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) const SfxPoolItem* pPoolItem; if( pNewAttrs && SfxItemState::SET == pNewAttrs->GetItemState( nSlot, true, &pPoolItem ) ) { - if( !( (SfxBoolItem*)pPoolItem)->GetValue() ) + if( !static_cast(pPoolItem)->GetValue() ) bLeftToRight = !bLeftToRight; } SfxItemSet aAttr( *aNewAttr.GetPool(), @@ -536,7 +536,7 @@ void SwDrawTextShell::Execute( SfxRequest &rReq ) sal_uInt16 nAdjust = SVX_ADJUST_LEFT; if( SfxItemState::SET == aEditAttr.GetItemState(EE_PARA_JUST, true, &pPoolItem ) ) - nAdjust = ( (SvxAdjustItem*)pPoolItem)->GetEnumValue(); + nAdjust = static_cast(pPoolItem)->GetEnumValue(); if( bLeftToRight ) { @@ -672,7 +672,7 @@ ASK_ADJUST: SfxItemState eState = aEditAttr.GetItemState(EE_PARA_LRSPACE); if( eState >= SfxItemState::DEFAULT ) { - SvxLRSpaceItem aLR = (const SvxLRSpaceItem&) aEditAttr.Get( EE_PARA_LRSPACE ); + SvxLRSpaceItem aLR = static_cast( aEditAttr.Get( EE_PARA_LRSPACE ) ); aLR.SetWhich(SID_ATTR_PARA_LRSPACE); rSet.Put(aLR); } @@ -686,7 +686,7 @@ ASK_ADJUST: SfxItemState eState = aEditAttr.GetItemState(EE_PARA_SBL); if( eState >= SfxItemState::DEFAULT ) { - SvxLineSpacingItem aLR = (const SvxLineSpacingItem&) aEditAttr.Get( EE_PARA_SBL ); + SvxLineSpacingItem aLR = static_cast( aEditAttr.Get( EE_PARA_SBL ) ); rSet.Put(aLR); } else @@ -699,7 +699,7 @@ ASK_ADJUST: SfxItemState eState = aEditAttr.GetItemState(EE_PARA_ULSPACE); if( eState >= SfxItemState::DEFAULT ) { - SvxULSpaceItem aULSpace = (const SvxULSpaceItem&) aEditAttr.Get( EE_PARA_ULSPACE ); + SvxULSpaceItem aULSpace = static_cast( aEditAttr.Get( EE_PARA_ULSPACE ) ); aULSpace.SetWhich(SID_ATTR_PARA_ULSPACE); rSet.Put(aULSpace); } @@ -719,7 +719,7 @@ ASK_LINESPACE: if( !pLSpace || IsInvalidItem( pLSpace )) rSet.InvalidateItem( nSlotId ), nSlotId = 0; - else if( nLSpace == ((const SvxLineSpacingItem*)pLSpace)-> + else if( nLSpace == static_cast(pLSpace)-> GetPropLineSpace() ) bFlag = true; else @@ -736,7 +736,7 @@ ASK_ESCAPE: if( !pEscItem ) pEscItem = &aEditAttr.Get( EE_CHAR_ESCAPEMENT ); - if( nEsc == ((const SvxEscapementItem*) + if( nEsc == static_cast( pEscItem)->GetEnumValue() ) bFlag = true; else @@ -750,7 +750,7 @@ ASK_ESCAPE: const SfxPoolItem &rItem = GetShell().GetDoc()->GetDefault( GetWhichOfScript( RES_CHRATR_LANGUAGE, GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage())) ); - LanguageType nLang = ((const SvxLanguageItem &) rItem).GetLanguage(); + LanguageType nLang = static_cast(rItem).GetLanguage(); uno::Reference< linguistic2::XThesaurus > xThes( ::GetThesaurus() ); if (!xThes.is() || nLang == LANGUAGE_NONE || !xThes->hasLocale( LanguageTag::convertToLocale( nLang ) )) @@ -787,7 +787,7 @@ ASK_ESCAPE: else { text::WritingMode eMode = (text::WritingMode) - ( (const SvxWritingModeItem&) aEditAttr.Get( SDRATTR_TEXTDIRECTION ) ).GetValue(); + static_cast( aEditAttr.Get( SDRATTR_TEXTDIRECTION ) ).GetValue(); if( nSlotId == SID_TEXTDIRECTION_LEFT_TO_RIGHT ) { @@ -818,7 +818,7 @@ ASK_ESCAPE: } else { - switch( ( ( (SvxFrameDirectionItem&) aEditAttr.Get( EE_PARA_WRITINGDIR ) ) ).GetValue() ) + switch( static_cast( aEditAttr.Get( EE_PARA_WRITINGDIR ) ).GetValue() ) { case FRMDIR_HORI_LEFT_TOP: bFlag = nWhich == SID_ATTR_PARA_LEFT_TO_RIGHT; @@ -915,7 +915,7 @@ void SwDrawTextShell::GetDrawTxtCtrlState(SfxItemSet& rSet) { const SfxPoolItem* pState = rView.GetSlotState(nWhich); if (pState) - rSet.Put(SfxBoolItem(nWhich, ((const SfxBoolItem*)pState)->GetValue())); + rSet.Put(SfxBoolItem(nWhich, static_cast(pState)->GetValue())); else rSet.DisableItem( nWhich ); break; @@ -1063,9 +1063,9 @@ void SwDrawTextShell::StateInsert(SfxItemSet &rSet) if (pField->ISA(SvxURLField)) { - aHLinkItem.SetName(((const SvxURLField*) pField)->GetRepresentation()); - aHLinkItem.SetURL(((const SvxURLField*) pField)->GetURL()); - aHLinkItem.SetTargetFrame(((const SvxURLField*) pField)->GetTargetFrame()); + aHLinkItem.SetName(static_cast( pField)->GetRepresentation()); + aHLinkItem.SetURL(static_cast( pField)->GetURL()); + aHLinkItem.SetTargetFrame(static_cast( pField)->GetTargetFrame()); } } else diff --git a/sw/source/uibase/shells/drwtxtsh.cxx b/sw/source/uibase/shells/drwtxtsh.cxx index ebcb72d99b03..2fe29bd8d735 100644 --- a/sw/source/uibase/shells/drwtxtsh.cxx +++ b/sw/source/uibase/shells/drwtxtsh.cxx @@ -245,7 +245,7 @@ void SwDrawTextShell::GetFormTextState(SfxItemSet& rSet) SfxViewFrame* pVFrame = GetView().GetViewFrame(); if ( pVFrame->HasChildWindow(nId) ) - pDlg = (SvxFontWorkDialog*)(pVFrame->GetChildWindow(nId)->GetWindow()); + pDlg = static_cast(pVFrame->GetChildWindow(nId)->GetWindow()); if ( rMarkList.GetMarkCount() == 1 ) pObj = rMarkList.GetMark(0)->GetMarkedSdrObj(); @@ -716,11 +716,11 @@ void SwDrawTextShell::InsertSymbol(SfxRequest& rReq) aSetItem.GetItemSet().Put( aSet, false ); const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScript ); if( pI ) - aSetDlgFont = *(SvxFontItem*)pI; + aSetDlgFont = *static_cast(pI); else - aSetDlgFont = (SvxFontItem&)aSet.Get( GetWhichOfScript( + aSetDlgFont = static_cast(aSet.Get( GetWhichOfScript( SID_ATTR_CHAR_FONT, - GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage() ) )); + GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage() ) ))); if (sFontName.isEmpty()) sFontName = aSetDlgFont.GetFamilyName(); } @@ -850,7 +850,7 @@ void SwDrawTextShell::GetStatePropPanelAttr(SfxItemSet &rSet) SfxItemState eConState = aAttrs.GetItemState( SDRATTR_TEXT_CONTOURFRAME ); if( eConState != SfxItemState::DONTCARE ) { - bContour = ( ( const SdrOnOffItem& )aAttrs.Get( SDRATTR_TEXT_CONTOURFRAME ) ).GetValue(); + bContour = static_cast( aAttrs.Get( SDRATTR_TEXT_CONTOURFRAME ) ).GetValue(); } if (bContour) break; diff --git a/sw/source/uibase/shells/frmsh.cxx b/sw/source/uibase/shells/frmsh.cxx index 678d5f724852..9bae91524b67 100644 --- a/sw/source/uibase/shells/frmsh.cxx +++ b/sw/source/uibase/shells/frmsh.cxx @@ -166,11 +166,11 @@ void SwFrameShell::Execute(SfxRequest &rReq) // Frame already exists, only the number of columns will be changed. sal_uInt16 nCols = 1; if(pArgs->GetItemState(SID_ATTR_COLUMNS, false, &pItem) == SfxItemState::SET) - nCols = ((SfxUInt16Item *)pItem)->GetValue(); + nCols = static_cast(pItem)->GetValue(); SfxItemSet aSet(GetPool(),RES_COL,RES_COL); rSh.GetFlyFrmAttr( aSet ); - SwFmtCol aCol((const SwFmtCol&)aSet.Get(RES_COL)); + SwFmtCol aCol(static_cast(aSet.Get(RES_COL))); // GutterWidth will not always passed, hence get firstly // (see view2: Execute on this slot) sal_uInt16 nGutterWidth = aCol.GetGutterWidth(); @@ -199,13 +199,13 @@ void SwFrameShell::Execute(SfxRequest &rReq) { if(pArgs && SfxItemState::SET == pArgs->GetItemState(SID_HYPERLINK_SETLINK, false, &pItem)) { - const SvxHyperlinkItem& rHLinkItem = *(const SvxHyperlinkItem *)pItem; + const SvxHyperlinkItem& rHLinkItem = *static_cast(pItem); const OUString& rURL = rHLinkItem.GetURL(); const OUString& rTarget = rHLinkItem.GetTargetFrame(); SfxItemSet aSet( rSh.GetAttrPool(), RES_URL, RES_URL ); rSh.GetFlyFrmAttr( aSet ); - SwFmtURL aURL( (SwFmtURL&)aSet.Get( RES_URL ) ); + SwFmtURL aURL( static_cast(aSet.Get( RES_URL )) ); OUString sOldName(rHLinkItem.GetName().toAsciiUpperCase()); OUString sFlyName(rSh.GetFlyName().toAsciiUpperCase()); @@ -282,7 +282,7 @@ void SwFrameShell::Execute(SfxRequest &rReq) pVFrame->ToggleChildWindow(FN_WORDCOUNT_DIALOG); Invalidate(rReq.GetSlot()); - SwWordCountWrapper *pWrdCnt = (SwWordCountWrapper*)pVFrame->GetChildWindow(SwWordCountWrapper::GetChildWindowId()); + SwWordCountWrapper *pWrdCnt = static_cast(pVFrame->GetChildWindow(SwWordCountWrapper::GetChildWindowId())); if (pWrdCnt) pWrdCnt->UpdateCounts(); } @@ -352,7 +352,7 @@ void SwFrameShell::Execute(SfxRequest &rReq) case FN_SET_FRM_POSITION: { - aMgr.SetAbsPos(((SfxPointItem &)pArgs->Get + aMgr.SetAbsPos(static_cast(pArgs->Get (FN_SET_FRM_POSITION)).GetValue()); } break; @@ -478,7 +478,7 @@ void SwFrameShell::Execute(SfxRequest &rReq) aSet.SetParent( aMgr.GetAttrSet().GetParent() ); // On % values initialize size - SwFmtFrmSize& rSize = (SwFmtFrmSize&)aSet.Get(RES_FRM_SIZE); + SwFmtFrmSize& rSize = const_cast(static_cast(aSet.Get(RES_FRM_SIZE))); if (rSize.GetWidthPercent() && rSize.GetWidthPercent() != 0xff) rSize.SetWidth(rSh.GetAnyCurRect(RECT_FLY_EMBEDDED).Width()); if (rSize.GetHeightPercent() && rSize.GetHeightPercent() != 0xff) @@ -492,7 +492,7 @@ void SwFrameShell::Execute(SfxRequest &rReq) OString sDefPage; if(pArgs && pArgs->GetItemState(FN_FORMAT_FRAME_DLG, false, &pItem) == SfxItemState::SET) - sDefPage = OUStringToOString(((SfxStringItem *)pItem)->GetValue(), RTL_TEXTENCODING_UTF8); + sDefPage = OUStringToOString(static_cast(pItem)->GetValue(), RTL_TEXTENCODING_UTF8); aSet.Put(SfxFrameItem( SID_DOCFRAME, &GetView().GetViewFrame()->GetTopFrame())); FieldUnit eMetric = ::GetDfltMetric(0 != PTR_CAST(SwWebView, &GetView())); @@ -525,13 +525,13 @@ void SwFrameShell::Execute(SfxRequest &rReq) SfxItemState::SET == pOutSet->GetItemState(FN_KEEP_ASPECT_RATIO, true, &pItem)) { SwViewOption aUsrPref( *pVOpt ); - aUsrPref.SetKeepRatio(((const SfxBoolItem*)pItem)->GetValue()); + aUsrPref.SetKeepRatio(static_cast(pItem)->GetValue()); SW_MOD()->ApplyUsrPref(aUsrPref, &GetView()); } if (SfxItemState::SET == pOutSet->GetItemState(FN_SET_FRM_ALT_NAME, true, &pItem)) { // #i73249# - rSh.SetObjTitle(((const SfxStringItem*)pItem)->GetValue()); + rSh.SetObjTitle(static_cast(pItem)->GetValue()); } // Template AutoUpdate SwFrmFmt* pFmt = rSh.GetCurFrmFmt(); @@ -540,7 +540,7 @@ void SwFrameShell::Execute(SfxRequest &rReq) rSh.AutoUpdateFrame(pFmt, *pOutSet); // Anything which is not supported by the format must be set hard. if(SfxItemState::SET == pOutSet->GetItemState(FN_SET_FRM_NAME, false, &pItem)) - rSh.SetFlyName(((SfxStringItem*)pItem)->GetValue()); + rSh.SetFlyName(static_cast(pItem)->GetValue()); SfxItemSet aShellSet(GetPool(), RES_FRM_SIZE, RES_FRM_SIZE, RES_SURROUND, RES_SURROUND, RES_ANCHOR, RES_ANCHOR, @@ -549,7 +549,7 @@ void SwFrameShell::Execute(SfxRequest &rReq) aShellSet.Put(*pOutSet); aMgr.SetAttrSet(aShellSet); if(SfxItemState::SET == pOutSet->GetItemState(FN_SET_FRM_NAME, false, &pItem)) - rSh.SetFlyName(((SfxStringItem*)pItem)->GetValue()); + rSh.SetFlyName(static_cast(pItem)->GetValue()); } else aMgr.SetAttrSet( *pOutSet ); @@ -562,7 +562,7 @@ void SwFrameShell::Execute(SfxRequest &rReq) rSh.HideChainMarker(); OUString sPrevName = - ((const SfxStringItem*)pItem)->GetValue(); + static_cast(pItem)->GetValue(); const SwFmtChain &rChain = pCurrFlyFmt->GetChain(); //needs cast - no non-const method available SwFlyFrmFmt* pFlyFmt = @@ -596,7 +596,7 @@ void SwFrameShell::Execute(SfxRequest &rReq) { rSh.HideChainMarker(); OUString sNextName = - ((const SfxStringItem*)pItem)->GetValue(); + static_cast(pItem)->GetValue(); const SwFmtChain &rChain = pCurrFlyFmt->GetChain(); //needs cast - no non-const method available SwFlyFrmFmt* pFlyFmt = @@ -605,7 +605,7 @@ void SwFrameShell::Execute(SfxRequest &rReq) { if (pFlyFmt->GetName() != sNextName) { - rSh.Unchain(*((SwFlyFrmFmt*) pCurrFlyFmt)); + rSh.Unchain(*const_cast(static_cast( pCurrFlyFmt))); } else sNextName.clear(); @@ -841,7 +841,7 @@ void SwFrameShell::GetState(SfxItemSet& rSet) if(SfxItemState::SET == aURLSet.GetItemState(RES_URL, true, &pItem)) { - const SwFmtURL* pFmtURL = (const SwFmtURL*)pItem; + const SwFmtURL* pFmtURL = static_cast(pItem); aHLinkItem.SetURL(pFmtURL->GetURL()); aHLinkItem.SetTargetFrame(pFmtURL->GetTargetFrameName()); aHLinkItem.SetName(rSh.GetFlyName()); @@ -989,13 +989,13 @@ void SwFrameShell::ExecFrameStyle(SfxRequest& rReq) // At first pick the default BoxItem out of the pool. // If unequal to regular box item, then it has already // been changed (New one is no default). - const SvxBoxItem* pPoolBoxItem = (const SvxBoxItem*)::GetDfltAttr(RES_BOX); + const SvxBoxItem* pPoolBoxItem = static_cast(::GetDfltAttr(RES_BOX)); const SfxItemSet *pArgs = rReq.GetArgs(); SfxItemSet aFrameSet(rSh.GetAttrPool(), RES_BOX, RES_BOX); rSh.GetFlyFrmAttr( aFrameSet ); - const SvxBoxItem& rBoxItem = (const SvxBoxItem&)aFrameSet.Get(RES_BOX); + const SvxBoxItem& rBoxItem = static_cast(aFrameSet.Get(RES_BOX)); if (pPoolBoxItem == &rBoxItem) bDefault = true; @@ -1013,7 +1013,7 @@ void SwFrameShell::ExecFrameStyle(SfxRequest& rReq) { if (pArgs->GetItemState(RES_BOX, true, &pItem) == SfxItemState::SET) { - SvxBoxItem aNewBox(*((SvxBoxItem *)pItem)); + SvxBoxItem aNewBox(*static_cast(pItem)); const SvxBorderLine* pBorderLine; if ((pBorderLine = aBoxItem.GetTop()) != NULL) @@ -1060,7 +1060,7 @@ void SwFrameShell::ExecFrameStyle(SfxRequest& rReq) if (pArgs->GetItemState(SID_FRAME_LINESTYLE, false, &pItem) == SfxItemState::SET) { const SvxLineItem* pLineItem = - (const SvxLineItem*)pItem; + static_cast(pItem); if ( pLineItem->GetLine() ) { @@ -1113,7 +1113,7 @@ void SwFrameShell::ExecFrameStyle(SfxRequest& rReq) { if (pArgs->GetItemState(SID_FRAME_LINECOLOR, false, &pItem) == SfxItemState::SET) { - const Color& rNewColor = ((const SvxColorItem*)pItem)->GetValue(); + const Color& rNewColor = static_cast(pItem)->GetValue(); if (!aBoxItem.GetTop() && !aBoxItem.GetBottom() && !aBoxItem.GetLeft() && !aBoxItem.GetRight()) @@ -1187,7 +1187,7 @@ void SwFrameShell::GetLineStyleState(SfxItemSet &rSet) rSh.GetFlyFrmAttr(aFrameSet); - const SvxBorderLine* pLine = ((const SvxBoxItem&)aFrameSet.Get(RES_BOX)).GetTop(); + const SvxBorderLine* pLine = static_cast(aFrameSet.Get(RES_BOX)).GetTop(); rSet.Put(SvxColorItem(pLine ? pLine->GetColor() : Color(), SID_FRAME_LINECOLOR)); } } diff --git a/sw/source/uibase/shells/grfsh.cxx b/sw/source/uibase/shells/grfsh.cxx index 140ed1d2146d..31652274c3dd 100644 --- a/sw/source/uibase/shells/grfsh.cxx +++ b/sw/source/uibase/shells/grfsh.cxx @@ -143,7 +143,7 @@ void SwGrfShell::Execute(SfxRequest &rReq) SfxItemSet aSet( rSh.GetAttrPool(), RES_GRFATR_CROPGRF, RES_GRFATR_CROPGRF ); rSh.GetCurAttr( aSet ); - SwCropGrf aCrop( (const SwCropGrf&) aSet.Get(RES_GRFATR_CROPGRF) ); + SwCropGrf aCrop( static_cast( aSet.Get(RES_GRFATR_CROPGRF)) ); Rectangle aCropRectangle( convertTwipToMm100(aCrop.GetLeft()), @@ -269,7 +269,7 @@ void SwGrfShell::Execute(SfxRequest &rReq) aSet.SetParent( aMgr.GetAttrSet().GetParent() ); // At percentage values initialize size - SwFmtFrmSize aSizeCopy = (const SwFmtFrmSize&)aSet.Get(RES_FRM_SIZE); + SwFmtFrmSize aSizeCopy = static_cast(aSet.Get(RES_FRM_SIZE)); if (aSizeCopy.GetWidthPercent() && aSizeCopy.GetWidthPercent() != 0xff) aSizeCopy.SetWidth(rSh.GetAnyCurRect(RECT_FLY_EMBEDDED).Width()); if (aSizeCopy.GetHeightPercent() && aSizeCopy.GetHeightPercent() != 0xff) @@ -394,14 +394,14 @@ void SwGrfShell::Execute(SfxRequest &rReq) FN_KEEP_ASPECT_RATIO, true, &pItem )) { aUsrPref.SetKeepRatio( - ((const SfxBoolItem*)pItem)->GetValue() ); + static_cast(pItem)->GetValue() ); bApplyUsrPref = true; } if( SfxItemState::SET == pSet->GetItemState( SID_ATTR_GRAF_KEEP_ZOOM, true, &pItem )) { aUsrPref.SetGrfKeepZoom( - ((const SfxBoolItem*)pItem)->GetValue() ); + static_cast(pItem)->GetValue() ); bApplyUsrPref = true; } @@ -440,7 +440,7 @@ void SwGrfShell::Execute(SfxRequest &rReq) FN_SET_FRM_ALT_NAME, true, &pItem )) { // #i73249# - rSh.SetObjTitle( ((const SfxStringItem*)pItem)->GetValue() ); + rSh.SetObjTitle( static_cast(pItem)->GetValue() ); } SfxItemSet aGrfSet( rSh.GetAttrPool(), RES_GRFATR_BEGIN, @@ -459,7 +459,7 @@ void SwGrfShell::Execute(SfxRequest &rReq) { SfxItemSet aSet(rSh.GetAttrPool(), RES_GRFATR_MIRRORGRF, RES_GRFATR_MIRRORGRF); rSh.GetCurAttr( aSet ); - SwMirrorGrf aGrf((const SwMirrorGrf &)aSet.Get(RES_GRFATR_MIRRORGRF)); + SwMirrorGrf aGrf(static_cast(aSet.Get(RES_GRFATR_MIRRORGRF))); aGrf.SetGrfToggle(!aGrf.IsGrfToggle()); rSh.SetAttrItem(aGrf); } @@ -492,7 +492,7 @@ void SwGrfShell::ExecAttr( SfxRequest &rReq ) case SID_FLIP_HORIZONTAL: { GetShell().GetCurAttr( aGrfSet ); - SwMirrorGrf aMirror( (SwMirrorGrf&)aGrfSet.Get( RES_GRFATR_MIRRORGRF ) ); + SwMirrorGrf aMirror( static_cast(aGrfSet.Get( RES_GRFATR_MIRRORGRF )) ); sal_uInt16 nMirror = aMirror.GetValue(); if ( nSlot==SID_FLIP_HORIZONTAL ) switch( nMirror ) @@ -565,7 +565,7 @@ void SwGrfShell::ExecAttr( SfxRequest &rReq ) case SID_ATTR_GRAF_TRANSPARENCE: if( pItem ) aGrfSet.Put( SwTransparencyGrf( - static_cast< sal_Int8 >( ( (SfxUInt16Item*)pItem )->GetValue() ) ) ); + static_cast< sal_Int8 >( static_cast(pItem )->GetValue() ) ) ); break; case SID_ATTR_GRAF_INVERT: @@ -674,7 +674,7 @@ void SwGrfShell::GetAttrState(SfxItemSet &rSet) case SID_FLIP_HORIZONTAL: if( !bParentCntProt ) { - MirrorGraph nState = static_cast< MirrorGraph >(((const SwMirrorGrf &) aCoreSet.Get( + MirrorGraph nState = static_cast< const MirrorGraph >(static_cast( aCoreSet.Get( RES_GRFATR_MIRRORGRF )).GetValue()); rSet.Put(SfxBoolItem( nWhich, nState == RES_MIRROR_GRAPH_VERT || @@ -685,7 +685,7 @@ void SwGrfShell::GetAttrState(SfxItemSet &rSet) case SID_FLIP_VERTICAL: if( !bParentCntProt ) { - MirrorGraph nState = static_cast< MirrorGraph >(((const SwMirrorGrf &) aCoreSet.Get( + MirrorGraph nState = static_cast< MirrorGraph >(static_cast( aCoreSet.Get( RES_GRFATR_MIRRORGRF )).GetValue()); rSet.Put(SfxBoolItem( nWhich, nState == RES_MIRROR_GRAPH_HOR || @@ -726,7 +726,7 @@ void SwGrfShell::GetAttrState(SfxItemSet &rSet) case SID_ATTR_GRAF_GAMMA: if( !bParentCntProt ) rSet.Put( SfxUInt32Item( nWhich, static_cast< sal_uInt32 >( - ( (SwGammaGrf&)aCoreSet.Get( RES_GRFATR_GAMMA ) ).GetValue() * 100 ) ) ); + static_cast(aCoreSet.Get( RES_GRFATR_GAMMA ) ).GetValue() * 100 ) ) ); break; case SID_ATTR_GRAF_TRANSPARENCE: @@ -840,7 +840,7 @@ void SwGrfShell::ExecuteRotation(SfxRequest &rReq) SfxItemSet aSet( rShell.GetAttrPool(), RES_GRFATR_CROPGRF, RES_GRFATR_CROPGRF ); rShell.GetCurAttr( aSet ); - SwCropGrf aCrop( (const SwCropGrf&) aSet.Get(RES_GRFATR_CROPGRF) ); + SwCropGrf aCrop( static_cast( aSet.Get(RES_GRFATR_CROPGRF) ) ); Rectangle aCropRectangle(aCrop.GetLeft(), aCrop.GetTop(), aCrop.GetRight(), aCrop.GetBottom()); if (rReq.GetSlot() == SID_ROTATE_GRAPHIC_LEFT) diff --git a/sw/source/uibase/shells/listsh.cxx b/sw/source/uibase/shells/listsh.cxx index ad16286fe139..a92c5e850170 100644 --- a/sw/source/uibase/shells/listsh.cxx +++ b/sw/source/uibase/shells/listsh.cxx @@ -216,7 +216,7 @@ void SwListShell::Execute(SfxRequest &rReq) bool bApi = rReq.IsAPI(); bool bDelete = !rSh.IsNoNum(!bApi); if(pArgs ) - bDelete = ((SfxBoolItem &)pArgs->Get(rReq.GetSlot())).GetValue(); + bDelete = static_cast(pArgs->Get(rReq.GetSlot())).GetValue(); rSh.NumOrNoNum( bDelete, !bApi ); rReq.AppendItem( SfxBoolItem( nSlot, bDelete ) ); rReq.Done(); diff --git a/sw/source/uibase/shells/tabsh.cxx b/sw/source/uibase/shells/tabsh.cxx index e7962dde182b..3267c5bffbab 100644 --- a/sw/source/uibase/shells/tabsh.cxx +++ b/sw/source/uibase/shells/tabsh.cxx @@ -304,16 +304,16 @@ void ItemSetToTableParam( const SfxItemSet& rSet, if(bBackground) { if(pItem) - rSh.SetBoxBackground( *(const SvxBrushItem*)pItem ); + rSh.SetBoxBackground( *static_cast(pItem) ); if(pRowItem) { - SvxBrushItem aBrush(*(const SvxBrushItem*)pRowItem); + SvxBrushItem aBrush(*static_cast(pRowItem)); aBrush.SetWhich(RES_BACKGROUND); rSh.SetRowBackground(aBrush); } if(pTableItem) { - SvxBrushItem aBrush(*(const SvxBrushItem*)pTableItem); + SvxBrushItem aBrush(*static_cast(pTableItem)); aBrush.SetWhich(RES_BACKGROUND); rSh.SetTabBackground( aBrush ); } @@ -359,7 +359,7 @@ void ItemSetToTableParam( const SfxItemSet& rSet, SfxItemSet aSet( rSh.GetAttrPool(), RES_FRMATR_BEGIN, RES_FRMATR_END-1 ); if(SfxItemState::SET == rSet.GetItemState( FN_TABLE_REP, false, &pItem )) { - pRep = (SwTableRep*)((const SwPtrItem*)pItem)->GetValue(); + pRep = (SwTableRep*)static_cast(pItem)->GetValue(); const SwTwips nWidth = pRep->GetWidth(); if ( text::HoriOrientation::FULL == pRep->GetAlign() ) @@ -404,7 +404,7 @@ void ItemSetToTableParam( const SfxItemSet& rSet, rSh.SetBoxAlign(static_cast((pItem))->GetValue()); if( SfxItemState::SET == rSet.GetItemState( FN_PARAM_TABLE_NAME, false, &pItem )) - rSh.SetTableName( *pFmt, ((const SfxStringItem*)pItem)->GetValue() ); + rSh.SetTableName( *pFmt, static_cast(pItem)->GetValue() ); // Copy the chosen attributes in the ItemSet. static const sal_uInt16 aIds[] = @@ -475,12 +475,12 @@ void SwTableShell::Execute(SfxRequest &rReq) SvxBoxInfoItem aCoreInfo( SID_ATTR_BORDER_INNER ); aCoreSet.Put(aCoreInfo); rSh.GetTabBorders( aCoreSet ); - const SvxBoxItem& rCoreBox = (const SvxBoxItem&) - aCoreSet.Get(RES_BOX); + const SvxBoxItem& rCoreBox = static_cast( + aCoreSet.Get(RES_BOX)); const SfxPoolItem *pBoxItem = 0; if ( pArgs->GetItemState(RES_BOX, true, &pBoxItem) == SfxItemState::SET ) { - aBox = *(SvxBoxItem*)pBoxItem; + aBox = *static_cast(pBoxItem); if ( !rReq.IsAPI() ) aBox.SetDistance( std::max(rCoreBox.GetDistance(),sal_uInt16(55)) ); else if ( aBox.GetDistance() < MIN_BORDER_DIST ) @@ -492,10 +492,10 @@ void SwTableShell::Execute(SfxRequest &rReq) //since the drawing layer also supports borders the which id might be a different one SvxBoxInfoItem aInfo( SID_ATTR_BORDER_INNER ); if (pArgs->GetItemState(SID_ATTR_BORDER_INNER, true, &pBoxItem) == SfxItemState::SET) - aInfo = *(SvxBoxInfoItem*)pBoxItem; + aInfo = *static_cast(pBoxItem); else if( pArgs->GetItemState(SDRATTR_TABLE_BORDER_INNER, true, &pBoxItem) == SfxItemState::SET ) { - aInfo = *(SvxBoxInfoItem*)pBoxItem; + aInfo = *static_cast(pBoxItem); aInfo.SetWhich(SID_ATTR_BORDER_INNER); } @@ -572,7 +572,7 @@ void SwTableShell::Execute(SfxRequest &rReq) OSL_ENSURE(pDlg, "Dialog creation failed!"); if (pItem) - pDlg->SetCurPageId(OUStringToOString(((SfxStringItem *)pItem)->GetValue(), RTL_TEXTENCODING_UTF8)); + pDlg->SetCurPageId(OUStringToOString(static_cast(pItem)->GetValue(), RTL_TEXTENCODING_UTF8)); } aCoreSet.Put(SfxUInt16Item(SID_HTML_MODE, ::GetHtmlMode(GetView().GetDocShell()))); rSh.GetTblAttr(aCoreSet); @@ -826,9 +826,9 @@ void SwTableShell::Execute(SfxRequest &rReq) bool bAfter = true; if (pItem) { - nCount = ((const SfxInt16Item* )pItem)->GetValue(); + nCount = static_cast(pItem)->GetValue(); if(SfxItemState::SET == pArgs->GetItemState(FN_PARAM_INSERT_AFTER, true, &pItem)) - bAfter = ((const SfxBoolItem* )pItem)->GetValue(); + bAfter = static_cast(pItem)->GetValue(); } else if( !rReq.IsAPI() ) ++nCount; @@ -861,8 +861,8 @@ void SwTableShell::Execute(SfxRequest &rReq) // -->after inserting,reset the inner table borders if ( bSetInnerBorders ) { - const SvxBoxInfoItem aBoxInfo((const SvxBoxInfoItem&) - aCoreSet.Get(SID_ATTR_BORDER_INNER)); + const SvxBoxInfoItem aBoxInfo(static_cast( + aCoreSet.Get(SID_ATTR_BORDER_INNER))); SfxItemSet aSet( GetPool(), SID_ATTR_BORDER_INNER, SID_ATTR_BORDER_INNER, 0); aSet.Put( aBoxInfo ); @@ -1019,8 +1019,8 @@ void SwTableShell::Execute(SfxRequest &rReq) SfxViewFrame* pVFrame = GetView().GetViewFrame(); pVFrame->GetDispatcher()->Execute(FN_EDIT_FORMULA, SfxCallMode::SYNCHRON); const sal_uInt16 nId = SwInputChild::GetChildWindowId(); - SwInputChild* pChildWin = (SwInputChild*)pVFrame-> - GetChildWindow( nId ); + SwInputChild* pChildWin = static_cast(pVFrame-> + GetChildWindow( nId )); OUString sSum; GetShell().GetAutoSum(sSum); if( pChildWin ) @@ -1066,7 +1066,7 @@ void SwTableShell::Execute(SfxRequest &rReq) case SID_ATTR_ULSPACE: if(pItem) { - SvxULSpaceItem aULSpace( *(const SvxULSpaceItem*)pItem ); + SvxULSpaceItem aULSpace( *static_cast(pItem) ); aULSpace.SetWhich( RES_UL_SPACE ); ::lcl_SetAttr( rSh, aULSpace ); } @@ -1077,7 +1077,7 @@ void SwTableShell::Execute(SfxRequest &rReq) { SfxItemSet aSet( GetPool(), RES_LR_SPACE, RES_LR_SPACE, RES_HORI_ORIENT, RES_HORI_ORIENT, 0 ); - SvxLRSpaceItem aLRSpace( *(const SvxLRSpaceItem*)pItem ); + SvxLRSpaceItem aLRSpace( *static_cast(pItem) ); aLRSpace.SetWhich( RES_LR_SPACE ); aSet.Put( aLRSpace ); SwFmtHoriOrient aHori( pFmt->GetHoriOrient() ); @@ -1109,7 +1109,7 @@ void SwTableShell::Execute(SfxRequest &rReq) case SID_ATTR_PARA_SPLIT: if ( pItem ) { - SwFmtLayoutSplit aSplit( ((const SvxFmtSplitItem*)pItem)->GetValue()); + SwFmtLayoutSplit aSplit( static_cast(pItem)->GetValue()); SfxItemSet aSet(GetPool(), RES_LAYOUT_SPLIT, RES_LAYOUT_SPLIT, 0 ); aSet.Put(aSplit); rSh.SetTblAttr(aSet); @@ -1119,7 +1119,7 @@ void SwTableShell::Execute(SfxRequest &rReq) case SID_ATTR_PARA_KEEP: if ( pItem ) { - SvxFmtKeepItem aKeep( *(const SvxFmtKeepItem*)pItem ); + SvxFmtKeepItem aKeep( *static_cast(pItem) ); aKeep.SetWhich( RES_KEEP ); SfxItemSet aSet(GetPool(), RES_KEEP, RES_KEEP, 0 ); aSet.Put(aKeep); @@ -1364,15 +1364,15 @@ void SwTableShell::ExecTableStyle(SfxRequest& rReq) case SID_FRAME_LINECOLOR: if ( rReq.GetSlot() == SID_FRAME_LINESTYLE ) { - const SvxLineItem &rLineItem = (const SvxLineItem&)pArgs-> - Get( SID_FRAME_LINESTYLE ); + const SvxLineItem &rLineItem = static_cast(pArgs-> + Get( SID_FRAME_LINESTYLE )); const SvxBorderLine* pBorderLine = rLineItem.GetLine(); rSh.SetTabLineStyle( 0, true, pBorderLine); } else { - const SvxColorItem &rNewColorItem = (const SvxColorItem&)pArgs-> - Get( SID_FRAME_LINECOLOR ); + const SvxColorItem &rNewColorItem = static_cast(pArgs-> + Get( SID_FRAME_LINECOLOR )); rSh.SetTabLineStyle( &rNewColorItem.GetValue() ); } @@ -1391,7 +1391,7 @@ void SwTableShell::GetLineStyleState(SfxItemSet &rSet) aCoreSet.Put(aCoreInfo); GetShell().GetTabBorders( aCoreSet ); - const SvxBoxItem& rBoxItem = (const SvxBoxItem&)aCoreSet.Get( RES_BOX ); + const SvxBoxItem& rBoxItem = static_cast(aCoreSet.Get( RES_BOX )); const SvxBorderLine* pLine = rBoxItem.GetTop(); rSet.Put( SvxColorItem( pLine ? pLine->GetColor() : Color(), SID_FRAME_LINECOLOR ) ); @@ -1423,7 +1423,7 @@ void SwTableShell::ExecNumberFormat(SfxRequest& rReq) if( pItem ) { // Determine index for string. - OUString aCode( ((const SfxStringItem*)pItem)->GetValue() ); + OUString aCode( static_cast(pItem)->GetValue() ); nNumberFormat = pFormatter->GetEntryKey( aCode, eLang ); if( NUMBERFORMAT_ENTRY_NOT_FOUND == nNumberFormat ) { diff --git a/sw/source/uibase/shells/textfld.cxx b/sw/source/uibase/shells/textfld.cxx index 8aa84b57dfeb..b6aac7c7f8e0 100644 --- a/sw/source/uibase/shells/textfld.cxx +++ b/sw/source/uibase/shells/textfld.cxx @@ -225,18 +225,18 @@ void SwTextShell::ExecField(SfxRequest &rReq) { sal_uLong nFormat = 0; sal_uInt16 nType = 0; - OUString aPar1 = ((SfxStringItem *)pItem)->GetValue(); + OUString aPar1 = static_cast(pItem)->GetValue(); OUString aPar2; sal_Int32 nCommand = 0; if( SfxItemState::SET == pArgs->GetItemState( FN_PARAM_FIELD_TYPE, false, &pItem )) - nType = ((SfxUInt16Item *)pItem)->GetValue(); + nType = static_cast(pItem)->GetValue(); aPar1 += OUString(DB_DELIM); if( SfxItemState::SET == pArgs->GetItemState( FN_PARAM_1, false, &pItem )) { - aPar1 += ((SfxStringItem *)pItem)->GetValue(); + aPar1 += static_cast(pItem)->GetValue(); } if( SfxItemState::SET == pArgs->GetItemState( FN_PARAM_3, false, &pItem )) @@ -247,14 +247,14 @@ void SwTextShell::ExecField(SfxRequest &rReq) if( SfxItemState::SET == pArgs->GetItemState( FN_PARAM_2, false, &pItem )) { - aPar1 += ((SfxStringItem *)pItem)->GetValue(); + aPar1 += static_cast(pItem)->GetValue(); } if( SfxItemState::SET == pArgs->GetItemState( FN_PARAM_FIELD_CONTENT, false, &pItem )) - aPar2 = ((SfxStringItem *)pItem)->GetValue(); + aPar2 = static_cast(pItem)->GetValue(); if( SfxItemState::SET == pArgs->GetItemState( FN_PARAM_FIELD_FORMAT, false, &pItem )) - nFormat = ((SfxUInt32Item *)pItem)->GetValue(); + nFormat = static_cast(pItem)->GetValue(); OSL_FAIL("Command is not yet used"); sal_Unicode cSeparator = ' '; SwInsertFld_Data aData(nType, 0, aPar1, aPar2, nFormat, GetShellPtr(), cSeparator ); @@ -272,26 +272,26 @@ void SwTextShell::ExecField(SfxRequest &rReq) sal_uLong nFormat = 0; sal_uInt16 nType = 0; sal_uInt16 nSubType = 0; - OUString aPar1 = ((SfxStringItem *)pItem)->GetValue(); + OUString aPar1 = static_cast(pItem)->GetValue(); OUString aPar2; sal_Unicode cSeparator = ' '; if( SfxItemState::SET == pArgs->GetItemState( FN_PARAM_FIELD_TYPE, false, &pItem )) - nType = ((SfxUInt16Item *)pItem)->GetValue(); + nType = static_cast(pItem)->GetValue(); if( SfxItemState::SET == pArgs->GetItemState( FN_PARAM_FIELD_SUBTYPE, false, &pItem )) - nSubType = ((SfxUInt16Item *)pItem)->GetValue(); + nSubType = static_cast(pItem)->GetValue(); if( SfxItemState::SET == pArgs->GetItemState( FN_PARAM_FIELD_CONTENT, false, &pItem )) - aPar2 = ((SfxStringItem *)pItem)->GetValue(); + aPar2 = static_cast(pItem)->GetValue(); if( SfxItemState::SET == pArgs->GetItemState( FN_PARAM_FIELD_FORMAT, false, &pItem )) - nFormat = ((SfxUInt32Item *)pItem)->GetValue(); + nFormat = static_cast(pItem)->GetValue(); if( SfxItemState::SET == pArgs->GetItemState( FN_PARAM_3, false, &pItem )) { - OUString sTmp = ((SfxStringItem *)pItem)->GetValue(); + OUString sTmp = static_cast(pItem)->GetValue(); if(!sTmp.isEmpty()) cSeparator = sTmp[0]; } @@ -321,7 +321,7 @@ void SwTextShell::ExecField(SfxRequest &rReq) // Switch Flddlg at a new TabPage sal_uInt16 nId = SwFldDlgWrapper::GetChildWindowId(); - SwFldDlgWrapper *pWrp = (SwFldDlgWrapper*)pVFrame->GetChildWindow(nId); + SwFldDlgWrapper *pWrp = static_cast(pVFrame->GetChildWindow(nId)); if (pWrp) pWrp->ShowReferencePage(); rReq.Ignore(); @@ -407,7 +407,7 @@ void SwTextShell::ExecField(SfxRequest &rReq) rSh.Push(); rSh.SwCrsrShell::Left(1, CRSR_SKIP_CHARS, false); - pPostIt = (SwPostItField*)aFldMgr.GetCurFld(); + pPostIt = static_cast(aFldMgr.GetCurFld()); rSh.Pop(false); // Restore cursor position } @@ -550,7 +550,7 @@ void SwTextShell::ExecField(SfxRequest &rReq) if ( pIsUrl ) bIsUrl = pIsUrl->GetValue(); - SwScriptField* pFld = (SwScriptField*)aMgr.GetCurFld(); + SwScriptField* pFld = static_cast(aMgr.GetCurFld()); bNew = !pFld || !(pFld->GetTyp()->Which() == RES_SCRIPTFLD); bUpdate = pFld && ( bIsUrl != (bool)pFld->GetFormat() || pFld->GetPar2() != aType || pFld->GetPar1() != aText ); } diff --git a/sw/source/uibase/shells/textglos.cxx b/sw/source/uibase/shells/textglos.cxx index 75c765da7613..525b3e94ee64 100644 --- a/sw/source/uibase/shells/textglos.cxx +++ b/sw/source/uibase/shells/textglos.cxx @@ -63,13 +63,13 @@ void SwTextShell::ExecGlossary(SfxRequest &rReq) case FN_NEW_GLOSSARY: if(pItem && pArgs->Count() == 3 ) { - OUString aGroup = (( const SfxStringItem *)pItem)->GetValue(); + OUString aGroup = static_cast(pItem)->GetValue(); OUString aName; if(SfxItemState::SET == pArgs->GetItemState(FN_PARAM_1, false, &pItem )) - aName = (( const SfxStringItem *)pItem)->GetValue(); + aName = static_cast(pItem)->GetValue(); OUString aShortName; if(SfxItemState::SET == pArgs->GetItemState(FN_PARAM_2, false, &pItem )) - aShortName = (( const SfxStringItem *)pItem)->GetValue(); + aShortName = static_cast(pItem)->GetValue(); SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); OSL_ENSURE(pFact, "Dialog creation failed!"); @@ -86,7 +86,7 @@ void SwTextShell::ExecGlossary(SfxRequest &rReq) case FN_SET_ACT_GLOSSARY: if(pItem) { - OUString aGroup = (( const SfxStringItem *)pItem)->GetValue(); + OUString aGroup = static_cast(pItem)->GetValue(); SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); OSL_ENSURE(pFact, "Dialog creation failed!"); ::GlossarySetActGroup fnSetActGroup = pFact->SetGlossaryActGroupFunc(); @@ -99,10 +99,10 @@ void SwTextShell::ExecGlossary(SfxRequest &rReq) { if(pItem && pArgs->Count() > 1) { - OUString aGroup = (( const SfxStringItem *)pItem)->GetValue(); + OUString aGroup = static_cast(pItem)->GetValue(); OUString aName; if(SfxItemState::SET == pArgs->GetItemState(FN_PARAM_1, false, &pItem )) - aName = (( const SfxStringItem *)pItem)->GetValue(); + aName = static_cast(pItem)->GetValue(); SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); OSL_ENSURE(pFact, "Dialog creation failed!"); ::GlossarySetActGroup fnSetActGroup = pFact->SetGlossaryActGroupFunc(); diff --git a/sw/source/uibase/shells/textidx.cxx b/sw/source/uibase/shells/textidx.cxx index 5f635ecb178a..05c4ef1bd3fa 100644 --- a/sw/source/uibase/shells/textidx.cxx +++ b/sw/source/uibase/shells/textidx.cxx @@ -164,8 +164,8 @@ void SwTextShell::GetIdxState(SfxItemSet &rSet) { SwWrtShell& rSh = GetShell(); SfxViewFrame* pVFrame = GetView().GetViewFrame(); - SwInsertIdxMarkWrapper *pIdxMrk = (SwInsertIdxMarkWrapper*) - pVFrame->GetChildWindow(FN_INSERT_IDX_ENTRY_DLG); + SwInsertIdxMarkWrapper *pIdxMrk = static_cast( + pVFrame->GetChildWindow(FN_INSERT_IDX_ENTRY_DLG)); SfxChildWindow* pAuthMark = pVFrame->GetChildWindow(FN_INSERT_AUTH_ENTRY_DLG); diff --git a/sw/source/uibase/shells/textsh.cxx b/sw/source/uibase/shells/textsh.cxx index e7d655cfa73c..610952bdc42e 100644 --- a/sw/source/uibase/shells/textsh.cxx +++ b/sw/source/uibase/shells/textsh.cxx @@ -490,9 +490,9 @@ void SwTextShell::ExecInsert(SfxRequest &rReq) { if(FN_INSERT_FRAME_INTERACT_NOCOL != nSlot && pArgs->GetItemState(SID_ATTR_COLUMNS, false, &pItem) == SfxItemState::SET) - nCols = ((SfxUInt16Item *)pItem)->GetValue(); + nCols = static_cast(pItem)->GetValue(); if(pArgs->GetItemState(SID_MODIFIER, false, &pItem) == SfxItemState::SET) - bModifier1 |= KEY_MOD1 == ((SfxUInt16Item *)pItem)->GetValue(); + bModifier1 |= KEY_MOD1 == static_cast(pItem)->GetValue(); } if(bModifier1 ) { @@ -544,14 +544,14 @@ void SwTextShell::ExecInsert(SfxRequest &rReq) Point aPos = aMgr.GetPos(); RndStdIds eAnchor = FLY_AT_PARA; if(pArgs->GetItemState(nSlot, false, &pItem) == SfxItemState::SET) - eAnchor = (RndStdIds)((SfxUInt16Item *)pItem)->GetValue(); + eAnchor = (RndStdIds)static_cast(pItem)->GetValue(); if(pArgs->GetItemState(FN_PARAM_1, false, &pItem) == SfxItemState::SET) - aPos = ((SfxPointItem *)pItem)->GetValue(); + aPos = static_cast(pItem)->GetValue(); if(pArgs->GetItemState(FN_PARAM_2, false, &pItem) == SfxItemState::SET) - aSize = ((SvxSizeItem *)pItem)->GetSize(); + aSize = static_cast(pItem)->GetSize(); if(pArgs->GetItemState(SID_ATTR_COLUMNS, false, &pItem) == SfxItemState::SET) { - const sal_uInt16 nCols = ((SfxUInt16Item *)pItem)->GetValue(); + const sal_uInt16 nCols = static_cast(pItem)->GetValue(); if( !bSingleCol && 1 < nCols ) { SwFmtCol aFmtCol; @@ -598,8 +598,8 @@ void SwTextShell::ExecInsert(SfxRequest &rReq) aSet.SetParent( aMgr.GetAttrSet().GetParent() ); // Delete minimum size in columns. - SvxBoxInfoItem aBoxInfo((SvxBoxInfoItem &)aSet.Get(SID_ATTR_BORDER_INNER)); - const SvxBoxItem& rBox = (const SvxBoxItem&)aSet.Get(RES_BOX); + SvxBoxInfoItem aBoxInfo(static_cast(aSet.Get(SID_ATTR_BORDER_INNER))); + const SvxBoxItem& rBox = static_cast(aSet.Get(RES_BOX)); aBoxInfo.SetMinDist(false); aBoxInfo.SetDefDist(rBox.GetDistance(BOX_LINE_LEFT)); aSet.Put(aBoxInfo); @@ -773,7 +773,7 @@ void SwTextShell::StateInsert( SfxItemSet &rSet ) const SfxPoolItem* pItem; if(SfxItemState::SET == aSet.GetItemState(RES_TXTATR_INETFMT, false, &pItem)) { - const SwFmtINetFmt* pINetFmt = (const SwFmtINetFmt*)pItem; + const SwFmtINetFmt* pINetFmt = static_cast(pItem); aHLinkItem.SetURL(pINetFmt->GetValue()); aHLinkItem.SetTargetFrame(pINetFmt->GetTargetFrame()); aHLinkItem.SetIntName(pINetFmt->GetName()); @@ -995,11 +995,13 @@ void SwTextShell::InsertSymbol( SfxRequest& rReq ) aSetItem.GetItemSet().Put( aSet, false ); const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScript ); if( pI ) - aFont = *(SvxFontItem*)pI; + aFont = *static_cast(pI); else - aFont = (SvxFontItem&)aSet.Get( GetWhichOfScript( - RES_CHRATR_FONT, - GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage() ) )); + aFont = static_cast( + aSet.Get( + GetWhichOfScript( + RES_CHRATR_FONT, + GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage() ) ))); if (aFontName.isEmpty()) aFontName = aFont.GetFamilyName(); } @@ -1061,11 +1063,11 @@ void SwTextShell::InsertSymbol( SfxRequest& rReq ) aSetItem.GetItemSet().Put( aSet, false ); const SfxPoolItem* pI = aSetItem.GetItemOfScript( nScript ); if( pI ) - aFont = *(SvxFontItem*)pI; + aFont = *static_cast(pI); else - aFont = (SvxFontItem&)aSet.Get( GetWhichOfScript( + aFont = static_cast(aSet.Get( GetWhichOfScript( RES_CHRATR_FONT, - GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage() ) )); + GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage() ) ))); } // Insert character. diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx index 2e679e8aed9c..4c3db828888b 100644 --- a/sw/source/uibase/shells/textsh1.cxx +++ b/sw/source/uibase/shells/textsh1.cxx @@ -214,7 +214,7 @@ void sw_CharDialog( SwWrtShell &rWrtSh, bool bUseDialog, sal_uInt16 nSlot,const // The old item is for unknown reasons back in the set again. if( !bSelectionPut && SfxItemState::SET == aTmpSet.GetItemState(FN_PARAM_SELECTION, false, &pSelectionItem) ) { - OUString sInsert = ((const SfxStringItem*)pSelectionItem)->GetValue(); + OUString sInsert = static_cast(pSelectionItem)->GetValue(); bInsert = !sInsert.isEmpty(); if(bInsert) { @@ -439,7 +439,7 @@ void SwTextShell::Execute(SfxRequest &rReq) rWrtSh.Left( CRSR_SKIP_CHARS, true, 1, false ); SfxItemSet aSet( rWrtSh.GetAttrPool(), RES_CHRATR_FONT, RES_CHRATR_FONT ); rWrtSh.GetCurAttr( aSet ); - SvxFontItem &rFont = (SvxFontItem &) aSet.Get( RES_CHRATR_FONT ); + const SvxFontItem &rFont = static_cast( aSet.Get( RES_CHRATR_FONT )); SvxFontItem aFont( rFont.GetFamily(), pFont->GetValue(), rFont.GetStyleName(), rFont.GetPitch(), RTL_TEXTENCODING_DONTKNOW, RES_CHRATR_FONT ); rWrtSh.SetAttrSet( aSet, nsSetAttrMode::SETATTR_DONTEXPAND ); @@ -669,7 +669,7 @@ void SwTextShell::Execute(SfxRequest &rReq) case FN_AUTOFORMAT_AUTO: { SvxAutoCorrCfg& rACfg = SvxAutoCorrCfg::Get(); - bool bSet = pItem ? ((const SfxBoolItem*)pItem)->GetValue() : !rACfg.IsAutoFmtByInput(); + bool bSet = pItem ? static_cast(pItem)->GetValue() : !rACfg.IsAutoFmtByInput(); if( bSet != rACfg.IsAutoFmtByInput() ) { rACfg.SetAutoFmtByInput( bSet ); @@ -751,7 +751,7 @@ void SwTextShell::Execute(SfxRequest &rReq) pVFrame->GetBindings().InvalidateAll( true ); } - OUString sFormula(((const SfxStringItem*)pItem)->GetValue()); + OUString sFormula(static_cast(pItem)->GetValue()); SwFldMgr aFldMgr; rWrtSh.StartAllAction(); bool bDelSel; @@ -939,8 +939,8 @@ void SwTextShell::Execute(SfxRequest &rReq) ::GetHtmlMode(GetView().GetDocShell()))); // Tabulators: Put DefaultTabs into ItemSet - const SvxTabStopItem& rDefTabs = (const SvxTabStopItem&) - GetPool().GetDefaultItem(RES_PARATR_TABSTOP); + const SvxTabStopItem& rDefTabs = static_cast( + GetPool().GetDefaultItem(RES_PARATR_TABSTOP)); const sal_uInt16 nDefDist = static_cast(::GetTabDist( rDefTabs )); SfxUInt16Item aDefDistItem( SID_ATTR_TABSTOP_DEFAULTS, nDefDist ); @@ -978,7 +978,7 @@ void SwTextShell::Execute(SfxRequest &rReq) { OString sDefPage; if (pItem) - sDefPage = OUStringToOString(((const SfxStringItem*)pItem)->GetValue(), RTL_TEXTENCODING_UTF8); + sDefPage = OUStringToOString(static_cast(pItem)->GetValue(), RTL_TEXTENCODING_UTF8); SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); OSL_ENSURE(pFact, "SwAbstractDialogFactory fail!"); @@ -991,7 +991,7 @@ void SwTextShell::Execute(SfxRequest &rReq) { if ( nSlot == SID_ATTR_PARA_LRSPACE) { - SvxLRSpaceItem aParaMargin((const SvxLRSpaceItem&)pArgs->Get(nSlot)); + SvxLRSpaceItem aParaMargin(static_cast(pArgs->Get(nSlot))); aParaMargin.SetWhich( RES_LR_SPACE); aCoreSet.Put(aParaMargin); pSet = &aCoreSet; @@ -1016,15 +1016,15 @@ void SwTextShell::Execute(SfxRequest &rReq) if ( SfxItemState::SET == pSet->GetItemState(FN_PARAM_1,false,&pItem) ) { - pSet->Put(SfxStringItem(FN_DROP_TEXT, ((const SfxStringItem*)pItem)->GetValue())); + pSet->Put(SfxStringItem(FN_DROP_TEXT, static_cast(pItem)->GetValue())); pSet->ClearItem(FN_PARAM_1); } if( SfxItemState::SET == pSet->GetItemState( RES_PARATR_DROP, false, &pItem )) { OUString sCharStyleName; - if(((const SwFmtDrop*)pItem)->GetCharFmt()) - sCharStyleName = ((const SwFmtDrop*)pItem)->GetCharFmt()->GetName(); + if(static_cast(pItem)->GetCharFmt()) + sCharStyleName = static_cast(pItem)->GetCharFmt()->GetName(); pSet->Put(SfxStringItem(FN_DROP_CHAR_STYLE_NAME, sCharStyleName)); } } @@ -1160,7 +1160,7 @@ void SwTextShell::Execute(SfxRequest &rReq) { if(pItem) { - Color aSet = ((const SvxColorItem*)pItem)->GetValue(); + Color aSet = static_cast(pItem)->GetValue(); SwEditWin& rEditWin = GetView().GetEditWin(); rEditWin.SetTextColor(aSet); SwApplyTemplate* pApply = rEditWin.GetApplyTemplate(); @@ -1180,7 +1180,7 @@ void SwTextShell::Execute(SfxRequest &rReq) { Color aSet; if(pItem) - aSet = ((const SvxColorItem*)pItem)->GetValue(); + aSet = static_cast(pItem)->GetValue(); else aSet = COL_TRANSPARENT; @@ -1210,7 +1210,7 @@ void SwTextShell::Execute(SfxRequest &rReq) { // The reason we need this argument here is that when a toolbar is closed // and reopened, its color resets, while SwEditWin still holds the old one. - Color aSet = ((const SvxColorItem*)pItem)->GetValue(); + Color aSet = static_cast(pItem)->GetValue(); if( nSlot == SID_ATTR_CHAR_COLOR_BACKGROUND_EXT ) rEdtWin.SetTextBackColor(aSet); else @@ -1266,10 +1266,10 @@ void SwTextShell::Execute(SfxRequest &rReq) { OUString sStyleName; if(pItem) - sStyleName = ((const SfxStringItem*)pItem)->GetValue(); + sStyleName = static_cast(pItem)->GetValue(); bool bOn = true; if( SfxItemState::SET == pArgs->GetItemState(FN_PARAM_1, false, &pItem)) - bOn = ((const SfxBoolItem*)pItem)->GetValue(); + bOn = static_cast(pItem)->GetValue(); rWrtSh.ChangeHeaderOrFooter(sStyleName, FN_INSERT_PAGEHEADER == nSlot, bOn, !rReq.IsAPI()); rReq.Done(); } @@ -1287,7 +1287,7 @@ void SwTextShell::Execute(SfxRequest &rReq) { bool bSetBlockMode = !rWrtSh.IsBlockMode(); if( pArgs && SfxItemState::SET == pArgs->GetItemState(nSlot, false, &pItem)) - bSetBlockMode = ((const SfxBoolItem*)pItem)->GetValue(); + bSetBlockMode = static_cast(pItem)->GetValue(); if( ( nSlot == FN_SELECTION_MODE_DEFAULT ) != bSetBlockMode ) rWrtSh.EnterBlockMode(); else @@ -1360,7 +1360,7 @@ void SwTextShell::Execute(SfxRequest &rReq) pVFrame->ToggleChildWindow(FN_WORDCOUNT_DIALOG); Invalidate(rReq.GetSlot()); - SwWordCountWrapper *pWrdCnt = (SwWordCountWrapper*)pVFrame->GetChildWindow(SwWordCountWrapper::GetChildWindowId()); + SwWordCountWrapper *pWrdCnt = static_cast(pVFrame->GetChildWindow(SwWordCountWrapper::GetChildWindowId())); if (pWrdCnt) pWrdCnt->UpdateCounts(); } diff --git a/sw/source/uibase/shells/txtattr.cxx b/sw/source/uibase/shells/txtattr.cxx index bd8baeb442af..0fb0e58e0056 100644 --- a/sw/source/uibase/shells/txtattr.cxx +++ b/sw/source/uibase/shells/txtattr.cxx @@ -71,7 +71,7 @@ void SwTextShell::ExecCharAttr(SfxRequest &rReq) { const SfxPoolItem* pItem; pArgs->GetItemState(nWhich, false, &pItem); - eState = ((const SfxBoolItem &) pArgs-> + eState = static_cast( pArgs-> Get( nWhich )).GetValue() ? STATE_ON : STATE_OFF; } @@ -89,7 +89,7 @@ void SwTextShell::ExecCharAttr(SfxRequest &rReq) { case STATE_TOGGLE: { - short nTmpEsc = ((const SvxEscapementItem&) + short nTmpEsc = static_cast( aSet.Get( RES_CHRATR_ESCAPEMENT )).GetEsc(); eEscape = nWhich == FN_SET_SUPER_SCRIPT ? SVX_ESCAPEMENT_SUPERSCRIPT: @@ -134,7 +134,7 @@ void SwTextShell::ExecCharAttr(SfxRequest &rReq) break; case FN_UNDERLINE_DOUBLE: { - FontUnderline eUnderline = ((const SvxUnderlineItem&) + FontUnderline eUnderline = static_cast( aSet.Get(RES_CHRATR_UNDERLINE)).GetLineStyle(); switch( eState ) { @@ -191,7 +191,7 @@ void SwTextShell::ExecCharAttrArgs(SfxRequest &rReq) { const SfxPoolItem& rItem = pArgs->Get( nWhich ); - SwFmtINetFmt aINetFmt( (const SwFmtINetFmt&) rItem ); + SwFmtINetFmt aINetFmt( static_cast(rItem) ); if ( USHRT_MAX == aINetFmt.GetVisitedFmtId() ) { OSL_ENSURE( false, " - unexpected visited character format ID at hyperlink attribute" ); @@ -299,7 +299,7 @@ void SwTextShell::ExecParaAttr(SfxRequest &rReq) { if( pArgs && SfxItemState::SET == pArgs->GetItemState(RES_PARATR_ADJUST) ) { - const SvxAdjustItem& rAdj = (const SvxAdjustItem&) pArgs->Get(RES_PARATR_ADJUST); + const SvxAdjustItem& rAdj = static_cast( pArgs->Get(RES_PARATR_ADJUST) ); SvxAdjustItem aAdj( rAdj.GetAdjust(), RES_PARATR_ADJUST ); if ( rAdj.GetAdjust() == SVX_ADJUST_BLOCK ) { @@ -325,8 +325,8 @@ SET_ADJUST: case SID_ATTR_PARA_LINESPACE: if(pArgs && SfxItemState::SET == pArgs->GetItemState( GetPool().GetWhich(nSlot) )) { - SvxLineSpacingItem aLineSpace = (const SvxLineSpacingItem&)pArgs->Get( - GetPool().GetWhich(nSlot)); + SvxLineSpacingItem aLineSpace = static_cast( pArgs->Get( + GetPool().GetWhich(nSlot))); aSet.Put( aLineSpace ); } break; @@ -357,7 +357,7 @@ SET_LINESPACE: SfxItemState eAdjustState = aAdjustSet.GetItemState(RES_PARATR_ADJUST, false); if(eAdjustState >= SfxItemState::DEFAULT) { - int eAdjust = (int)(( const SvxAdjustItem& ) + int eAdjust = (int)static_cast( aAdjustSet.Get(RES_PARATR_ADJUST)).GetAdjust(); bChgAdjust = (SVX_ADJUST_LEFT == eAdjust && SID_ATTR_PARA_RIGHT_TO_LEFT == nSlot) || (SVX_ADJUST_RIGHT == eAdjust && SID_ATTR_PARA_LEFT_TO_RIGHT == nSlot); @@ -435,10 +435,10 @@ void SwTextShell::ExecParaAttrArgs(SfxRequest &rReq) case FN_DROP_CHAR_STYLE_NAME: if( pItem ) { - OUString sCharStyleName = ((const SfxStringItem*)pItem)->GetValue(); + OUString sCharStyleName = static_cast(pItem)->GetValue(); SfxItemSet aSet(GetPool(), RES_PARATR_DROP, RES_PARATR_DROP, 0L); rSh.GetCurAttr(aSet); - SwFmtDrop aDropItem((const SwFmtDrop&)aSet.Get(RES_PARATR_DROP)); + SwFmtDrop aDropItem(static_cast(aSet.Get(RES_PARATR_DROP))); SwCharFmt* pFmt = 0; if(!sCharStyleName.isEmpty()) pFmt = rSh.FindCharFmtByName( sCharStyleName ); @@ -530,27 +530,27 @@ void SwTextShell::GetAttrState(SfxItemSet &rSet) if( SfxItemState::DEFAULT == eState ) pItem = &rPool.GetDefaultItem(RES_PARATR_ADJUST); if( SfxItemState::DEFAULT <= eState ) - eAdjust = (int)(( SvxAdjustItem* ) pItem)->GetAdjust(); + eAdjust = (int)static_cast( pItem)->GetAdjust(); short nEsc = 0; eState = aCoreSet.GetItemState(RES_CHRATR_ESCAPEMENT, false, &pItem); if( SfxItemState::DEFAULT == eState ) pItem = &rPool.GetDefaultItem(RES_CHRATR_ESCAPEMENT); if( eState >= SfxItemState::DEFAULT ) - nEsc = ((SvxEscapementItem* )pItem)->GetEsc(); + nEsc = static_cast(pItem)->GetEsc(); sal_uInt16 nLineSpace = 0; eState = aCoreSet.GetItemState(RES_PARATR_LINESPACING, false, &pItem); if( SfxItemState::DEFAULT == eState ) pItem = &rPool.GetDefaultItem(RES_PARATR_LINESPACING); if( SfxItemState::DEFAULT <= eState && - ((SvxLineSpacingItem* )pItem)->GetLineSpaceRule() == SVX_LINE_SPACE_AUTO ) + static_cast(pItem)->GetLineSpaceRule() == SVX_LINE_SPACE_AUTO ) { if(SVX_INTER_LINE_SPACE_OFF == - ((SvxLineSpacingItem* )pItem)->GetInterLineSpaceRule()) + static_cast(pItem)->GetInterLineSpaceRule()) nLineSpace = 100; else - nLineSpace = ((SvxLineSpacingItem* )pItem)->GetPropLineSpace(); + nLineSpace = static_cast(pItem)->GetPropLineSpace(); } while (nSlot) @@ -650,7 +650,7 @@ void SwTextShell::GetAttrState(SfxItemSet &rSet) eState = aCoreSet.GetItemState(RES_CHRATR_UNDERLINE); if( eState >= SfxItemState::DEFAULT ) { - FontUnderline eUnderline = ((const SvxUnderlineItem&) + FontUnderline eUnderline = static_cast( aCoreSet.Get(RES_CHRATR_UNDERLINE)).GetLineStyle(); rSet.Put(SfxBoolItem(nSlot, eUnderline == UNDERLINE_DOUBLE)); } @@ -671,7 +671,7 @@ void SwTextShell::GetAttrState(SfxItemSet &rSet) eState = aCoreSet.GetItemState(RES_LR_SPACE); if( eState >= SfxItemState::DEFAULT ) { - SvxLRSpaceItem aLR = ( (const SvxLRSpaceItem&) aCoreSet.Get( RES_LR_SPACE ) ); + SvxLRSpaceItem aLR = static_cast( aCoreSet.Get( RES_LR_SPACE ) ); aLR.SetWhich(SID_ATTR_PARA_LRSPACE); rSet.Put(aLR); } @@ -697,7 +697,7 @@ void SwTextShell::GetAttrState(SfxItemSet &rSet) aCoreSet.GetItemState( RES_FRAMEDIR, false ) >= SfxItemState::DEFAULT) { SvxFrameDirection eFrmDir = (SvxFrameDirection) - ((const SvxFrameDirectionItem& )aCoreSet.Get(RES_FRAMEDIR)).GetValue(); + static_cast(aCoreSet.Get(RES_FRAMEDIR)).GetValue(); if (FRMDIR_ENVIRONMENT == eFrmDir) { eFrmDir = rSh.IsInRightToLeftText() ? diff --git a/sw/source/uibase/shells/txtnum.cxx b/sw/source/uibase/shells/txtnum.cxx index 359ff14ec4ef..14c975bfe40c 100644 --- a/sw/source/uibase/shells/txtnum.cxx +++ b/sw/source/uibase/shells/txtnum.cxx @@ -197,7 +197,7 @@ void SwTextShell::ExecEnterNum(SfxRequest &rReq) { rReq.AppendItem( *pItem ); rReq.Done(); - SvxNumRule* pSetRule = ( (SvxNumBulletItem*) pItem )->GetNumRule(); + SvxNumRule* pSetRule = static_cast( pItem )->GetNumRule(); pSetRule->UnLinkGraphics(); SwNumRule aSetRule( pNumRuleAtCurrentSelection != NULL ? pNumRuleAtCurrentSelection->GetName() @@ -217,7 +217,7 @@ void SwTextShell::ExecEnterNum(SfxRequest &rReq) { rReq.AppendItem( *pItem ); rReq.Done(); - SvxNumRule* pSetRule = ( (SvxNumBulletItem*) pItem )->GetNumRule(); + SvxNumRule* pSetRule = static_cast( pItem )->GetNumRule(); SwNumRule aSetRule( GetShell().GetUniqueNumRuleName(), numfunc::GetDefaultPositionAndSpaceMode() ); -- cgit v1.2.3