summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2014-11-24 10:40:08 +0200
committerNoel Grandin <noel@peralex.com>2014-11-25 10:09:52 +0200
commit88aaa3496161339d504876a2e84dc03e4d6191d9 (patch)
tree5ffc860b837f28737c85f182af1360d111fd3693
parent1f1c7a4b0d582dffa920c7a51a55ea32c4d203fe (diff)
loplugin: cstylecast
Change-Id: I0607afad59068e3d94494f971990fb45c2b79443
-rw-r--r--sw/source/ui/table/tabledlg.cxx6
-rw-r--r--sw/source/ui/table/tautofmt.cxx2
-rw-r--r--sw/source/uibase/app/appopt.cxx2
-rw-r--r--sw/source/uibase/app/docsh.cxx8
-rw-r--r--sw/source/uibase/app/docsh2.cxx18
-rw-r--r--sw/source/uibase/app/docshini.cxx8
-rw-r--r--sw/source/uibase/app/docst.cxx8
-rw-r--r--sw/source/uibase/app/docstyle.cxx54
-rw-r--r--sw/source/uibase/app/swmodul1.cxx2
-rw-r--r--sw/source/uibase/cctrl/popbox.cxx4
-rw-r--r--sw/source/uibase/config/cfgitems.cxx4
-rw-r--r--sw/source/uibase/config/uinums.cxx4
-rw-r--r--sw/source/uibase/config/usrpref.cxx2
-rw-r--r--sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx2
-rw-r--r--sw/source/uibase/dialog/swwrtshitem.cxx2
-rw-r--r--sw/source/uibase/dochdl/swdtflvr.cxx14
-rw-r--r--sw/source/uibase/docvw/PostItMgr.cxx4
-rw-r--r--sw/source/uibase/docvw/SidebarTxtControl.cxx6
-rw-r--r--sw/source/uibase/docvw/edtdd.cxx2
-rw-r--r--sw/source/uibase/docvw/edtwin.cxx18
-rw-r--r--sw/source/uibase/docvw/edtwin2.cxx14
-rw-r--r--sw/source/uibase/docvw/edtwin3.cxx2
-rw-r--r--sw/source/uibase/docvw/romenu.cxx2
-rw-r--r--sw/source/uibase/docvw/srcedtw.cxx6
-rw-r--r--sw/source/uibase/fldui/fldmgr.cxx36
-rw-r--r--sw/source/uibase/frmdlg/colex.cxx4
-rw-r--r--sw/source/uibase/frmdlg/frmmgr.cxx4
-rw-r--r--sw/source/uibase/inc/frmmgr.hxx14
-rw-r--r--sw/source/uibase/inc/inputwin.hxx4
-rw-r--r--sw/source/uibase/inc/view.hxx2
-rw-r--r--sw/source/uibase/misc/redlndlg.cxx4
31 files changed, 131 insertions, 131 deletions
diff --git a/sw/source/ui/table/tabledlg.cxx b/sw/source/ui/table/tabledlg.cxx
index 221211fd3446..d70b4fdbff50 100644
--- a/sw/source/ui/table/tabledlg.cxx
+++ b/sw/source/ui/table/tabledlg.cxx
@@ -555,7 +555,7 @@ void SwFormatTablePage::Reset( const SfxItemSet* )
//Text direction
if( SfxItemState::SET == rSet.GetItemState( RES_FRAMEDIR, true, &pItem ) )
{
- sal_uIntPtr nVal = ((SvxFrameDirectionItem*)pItem)->GetValue();
+ sal_uIntPtr nVal = static_cast<const SvxFrameDirectionItem*>(pItem)->GetValue();
const sal_Int32 nPos = m_pTextDirectionLB->GetEntryPos( (void*) nVal );
m_pTextDirectionLB->SelectEntryPos( nPos );
m_pTextDirectionLB->SaveValue();
@@ -1236,10 +1236,10 @@ void SwTableTabDlg::PageCreated(sal_uInt16 nId, SfxTabPage& rPage)
}
else if (nId == m_nTextFlowId)
{
- ((SwTextFlowPage&)rPage).SetShell(pShell);
+ static_cast<SwTextFlowPage&>(rPage).SetShell(pShell);
const sal_uInt16 eType = pShell->GetFrmType(0,true);
if( !(FRMTYPE_BODY & eType) )
- ((SwTextFlowPage&)rPage).DisablePageBreak();
+ static_cast<SwTextFlowPage&>(rPage).DisablePageBreak();
}
}
diff --git a/sw/source/ui/table/tautofmt.cxx b/sw/source/ui/table/tautofmt.cxx
index b0ef74f3c451..763208a5a3d3 100644
--- a/sw/source/ui/table/tautofmt.cxx
+++ b/sw/source/ui/table/tautofmt.cxx
@@ -254,7 +254,7 @@ void SwAutoFormatDlg::FillAutoFmtOfIndex( SwTableAutoFmt*& rToFill ) const
IMPL_LINK( SwAutoFormatDlg, CheckHdl, Button *, pBtn )
{
SwTableAutoFmt* pData = &(*pTableTbl)[nIndex];
- bool bCheck = ((CheckBox*)pBtn)->IsChecked(), bDataChgd = true;
+ bool bCheck = static_cast<CheckBox*>(pBtn)->IsChecked(), bDataChgd = true;
if( pBtn == m_pBtnNumFormat )
pData->SetValueFormat( bCheck );
diff --git a/sw/source/uibase/app/appopt.cxx b/sw/source/uibase/app/appopt.cxx
index cb6a1652a23c..f1aef7182750 100644
--- a/sw/source/uibase/app/appopt.cxx
+++ b/sw/source/uibase/app/appopt.cxx
@@ -388,7 +388,7 @@ void SwModule::ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet )
if( SfxItemState::SET == rSet.GetItemState( FN_PARAM_SHADOWCURSOR, false, &pItem ))
{
- ((SwShadowCursorItem*)pItem)->FillViewOptions( aViewOpt );
+ static_cast<const SwShadowCursorItem*>(pItem)->FillViewOptions( aViewOpt );
if(pBindings)
pBindings->Invalidate(FN_SHADOWCURSOR);
}
diff --git a/sw/source/uibase/app/docsh.cxx b/sw/source/uibase/app/docsh.cxx
index 1879e7e00d5c..23e315555c50 100644
--- a/sw/source/uibase/app/docsh.cxx
+++ b/sw/source/uibase/app/docsh.cxx
@@ -956,7 +956,7 @@ void SwDocShell::GetState(SfxItemSet& rSet)
while (pTmpFrm) // Look for Preview
{
if ( PTR_CAST(SwView, pTmpFrm->GetViewShell()) &&
- ((SwView*)pTmpFrm->GetViewShell())->GetWrtShell().GetViewOptions()->getBrowseMode() )
+ static_cast<SwView*>(pTmpFrm->GetViewShell())->GetWrtShell().GetViewOptions()->getBrowseMode() )
{
bDisable = true;
break;
@@ -1120,7 +1120,7 @@ void SwDocShell::LoadingFinished()
{
SfxViewShell* pShell = pVFrame->GetViewShell();
if(PTR_CAST(SwSrcView, pShell))
- ((SwSrcView*)pShell)->Load(this);
+ static_cast<SwSrcView*>(pShell)->Load(this);
}
// #i38810#
@@ -1294,7 +1294,7 @@ bool SwDocShell::SetProtectionPassword( const OUString &rNewPassword )
IDocumentRedlineAccess* pIDRA = mpWrtShell->getIDocumentRedlineAccess();
Sequence< sal_Int8 > aPasswd = pIDRA->GetRedlinePassword();
if (pArgs && SfxItemState::SET == pArgs->GetItemState( FN_REDLINE_PROTECT, false, &pItem )
- && ((SfxBoolItem*)pItem)->GetValue() == (aPasswd.getLength() > 0))
+ && static_cast<const SfxBoolItem*>(pItem)->GetValue() == (aPasswd.getLength() > 0))
return false;
bool bRes = false;
@@ -1329,7 +1329,7 @@ bool SwDocShell::GetProtectionHash( /*out*/ ::com::sun::star::uno::Sequence< sal
IDocumentRedlineAccess* pIDRA = mpWrtShell->getIDocumentRedlineAccess();
Sequence< sal_Int8 > aPasswdHash( pIDRA->GetRedlinePassword() );
if (pArgs && SfxItemState::SET == pArgs->GetItemState( FN_REDLINE_PROTECT, false, &pItem )
- && ((SfxBoolItem*)pItem)->GetValue() == (aPasswdHash.getLength() != 0))
+ && static_cast<const SfxBoolItem*>(pItem)->GetValue() == (aPasswdHash.getLength() != 0))
return false;
rPasswordHash = aPasswdHash;
bRes = true;
diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx
index a554ebd78ccf..bab7224ae7e8 100644
--- a/sw/source/uibase/app/docsh2.cxx
+++ b/sw/source/uibase/app/docsh2.cxx
@@ -184,7 +184,7 @@ void SwDocShell::ToggleBrowserMode(bool bSet, SwView* _pView )
{
const SvxZoomType eType = (SvxZoomType)rViewOptions.GetZoomType();
if ( SVX_ZOOM_PERCENT != eType)
- ((SwView*)GetView())->SetZoom( eType );
+ static_cast<SwView*>(GetView())->SetZoom( eType );
}
pTempView->InvalidateBorder();
pTempView->SetNewWindowAllowed(!bSet);
@@ -220,7 +220,7 @@ static void lcl_processCompatibleSfxHint( const uno::Reference< script::vba::XVB
if ( dynamic_cast<const SfxEventHint*>(&rHint) )
{
uno::Sequence< uno::Any > aArgs;
- sal_uLong nEventId = ((SfxEventHint&)rHint).GetEventId();
+ sal_uLong nEventId = static_cast<const SfxEventHint&>(rHint).GetEventId();
switch( nEventId )
{
case SFX_EVENT_CREATEDOC:
@@ -249,7 +249,7 @@ void SwDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
if( dynamic_cast<const SfxSimpleHint*>(&rHint) )
{
// switch for more actions
- switch( ((SfxSimpleHint&) rHint).GetId() )
+ switch( static_cast<const SfxSimpleHint&>( rHint).GetId() )
{
case SFX_HINT_TITLECHANGED:
if( GetMedium() )
@@ -258,7 +258,7 @@ void SwDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
}
}
else if( dynamic_cast<const SfxEventHint*>(&rHint) &&
- ((SfxEventHint&) rHint).GetEventId() == SFX_EVENT_LOADFINISHED )
+ static_cast<const SfxEventHint&>( rHint).GetEventId() == SFX_EVENT_LOADFINISHED )
{
// #i38126# - own action id
nAction = 3;
@@ -429,7 +429,7 @@ void SwDocShell::Execute(SfxRequest& rReq)
if( pArgs && SfxItemState::SET ==
pArgs->GetItemState( SID_PRINTPREVIEW, false, &pItem ))
- bSet = ((SfxBoolItem*)pItem)->GetValue();
+ bSet = static_cast<const SfxBoolItem*>(pItem)->GetValue();
else
bSet = !bCurrent;
@@ -1100,7 +1100,7 @@ void SwDocShell::Execute(SfxRequest& rReq)
if ( pArgs && SfxItemState::SET == pArgs->GetItemState( nWhich , false, &pItem ))
{
OSL_ENSURE(pItem->ISA(SfxUInt16Item), "wrong Item");
- sal_uInt16 nYear2K = ((SfxUInt16Item*)pItem)->GetValue();
+ sal_uInt16 nYear2K = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
// iterate over Views and put the State to FormShells
SfxViewFrame* pVFrame = SfxViewFrame::GetFirst( this );
@@ -1146,7 +1146,7 @@ void lcl_processCompatibleSfxHint( const uno::Reference< document::XVbaEventsHel
if ( rHint.ISA( SfxEventHint ) )
{
uno::Sequence< uno::Any > aArgs;
- sal_uLong nEventId = ((SfxEventHint&)rHint).GetEventId();
+ sal_uLong nEventId = static_cast<SfxEventHint&>(rHint).GetEventId();
switch( nEventId )
{
case SFX_EVENT_CREATEDOC:
@@ -1338,7 +1338,7 @@ void SwDocShell::ReloadFromHtml( const OUString& rStreamName, SwSrcView* pSrcVie
// now also the UNO-Model has to be informed about the new Doc #51535#
uno::Reference<text::XTextDocument> xDoc(GetBaseModel(), uno::UNO_QUERY);
text::XTextDocument* pxDoc = xDoc.get();
- ((SwXTextDocument*)pxDoc)->InitNewDoc();
+ static_cast<SwXTextDocument*>(pxDoc)->InitNewDoc();
AddLink();
//#116402# update font list when new document is created
@@ -1533,7 +1533,7 @@ int SwFindDocShell( SfxObjectShellRef& xDocSh,
const SfxPoolItem* pItem;
if( ( SfxItemState::SET == pMed->GetItemSet()->GetItemState(
SID_VERSION, false, &pItem ) )
- ? (nVersion == ((SfxInt16Item*)pItem)->GetValue())
+ ? (nVersion == static_cast<const SfxInt16Item*>(pItem)->GetValue())
: !nVersion )
{
// Found, thus return
diff --git a/sw/source/uibase/app/docshini.cxx b/sw/source/uibase/app/docshini.cxx
index 3f978cf981fc..6c35085c71cf 100644
--- a/sw/source/uibase/app/docshini.cxx
+++ b/sw/source/uibase/app/docshini.cxx
@@ -412,7 +412,7 @@ void SwDocShell::AddLink()
mpDoc->acquire();
mpDoc->SetDocShell( this ); // set the DocShell-Pointer for Doc
uno::Reference< text::XTextDocument > xDoc(GetBaseModel(), uno::UNO_QUERY);
- ((SwXTextDocument*)xDoc.get())->Reactivate(this);
+ static_cast<SwXTextDocument*>(xDoc.get())->Reactivate(this);
SetPool(&mpDoc->GetAttrPool());
@@ -441,7 +441,7 @@ void SwDocShell::RemoveLink()
{
// disconnect Uno-Object
uno::Reference< text::XTextDocument > xDoc(GetBaseModel(), uno::UNO_QUERY);
- ((SwXTextDocument*)xDoc.get())->Invalidate();
+ static_cast<SwXTextDocument*>(xDoc.get())->Invalidate();
aFinishedTimer.Stop();
if (mpDoc)
{
@@ -462,13 +462,13 @@ void SwDocShell::InvalidateModel()
{
// disconnect Uno-Object
uno::Reference< text::XTextDocument > xDoc(GetBaseModel(), uno::UNO_QUERY);
- ((SwXTextDocument*)xDoc.get())->Invalidate();
+ static_cast<SwXTextDocument*>(xDoc.get())->Invalidate();
}
void SwDocShell::ReactivateModel()
{
// disconnect Uno-Object
uno::Reference< text::XTextDocument > xDoc(GetBaseModel(), uno::UNO_QUERY);
- ((SwXTextDocument*)xDoc.get())->Reactivate(this);
+ static_cast<SwXTextDocument*>(xDoc.get())->Reactivate(this);
}
// Load, Default-Format
diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx
index 8307399540e2..aebf6ede5e90 100644
--- a/sw/source/uibase/app/docst.cxx
+++ b/sw/source/uibase/app/docst.cxx
@@ -415,7 +415,7 @@ void SwDocShell::ExecStyleSheet( SfxRequest& rReq )
nMask = ((const SfxUInt16Item*)pItem)->GetValue();
if( SfxItemState::SET == pArgs->GetItemState(FN_PARAM_WRTSHELL,
false, &pItem ))
- pActShell = pShell = (SwWrtShell*)((SwPtrItem*)pItem)->GetValue();
+ pActShell = pShell = (SwWrtShell*)static_cast<const SwPtrItem*>(pItem)->GetValue();
if( nSlot == SID_STYLE_UPDATE_BY_EXAMPLE )
{
@@ -1258,7 +1258,7 @@ void SwDocShell::_LoadStyles( SfxObjectShell& rSource, bool bPreserveCurrentDocu
// of the template, update all the Source's
// FixFields once.
if(!bPreserveCurrentDocument)
- ((SwDocShell&)rSource).mpDoc->getIDocumentFieldsAccess().SetFixFields(false, NULL);
+ static_cast<SwDocShell&>(rSource).mpDoc->getIDocumentFieldsAccess().SetFixFields(false, NULL);
if( mpWrtShell )
{
// rhbz#818557, fdo#58893: EndAllAction will call SelectShell(),
@@ -1267,13 +1267,13 @@ void SwDocShell::_LoadStyles( SfxObjectShell& rSource, bool bPreserveCurrentDocu
// setting bNoInterrupt appears to avoid the problem.
::comphelper::FlagRestorationGuard g(bNoInterrupt, true);
mpWrtShell->StartAllAction();
- mpDoc->ReplaceStyles( *((SwDocShell&)rSource).mpDoc );
+ mpDoc->ReplaceStyles( *static_cast<SwDocShell&>(rSource).mpDoc );
mpWrtShell->EndAllAction();
}
else
{
bool bModified = mpDoc->getIDocumentState().IsModified();
- mpDoc->ReplaceStyles( *((SwDocShell&)rSource).mpDoc );
+ mpDoc->ReplaceStyles( *static_cast<SwDocShell&>(rSource).mpDoc );
if( !bModified && mpDoc->getIDocumentState().IsModified() && !mpView )
{
// the View is created later, but overwrites the Modify-Flag.
diff --git a/sw/source/uibase/app/docstyle.cxx b/sw/source/uibase/app/docstyle.cxx
index 92c8dabb4c97..64602029cb70 100644
--- a/sw/source/uibase/app/docstyle.cxx
+++ b/sw/source/uibase/app/docstyle.cxx
@@ -1007,7 +1007,7 @@ bool SwDocStyleSheet::SetName(const OUString& rStr, bool bReindexNow)
// Set PageDesc - copy with earlier one - probably not
// necessary for setting the name. So here we allow a
// cast.
- SwPageDesc aPageDesc(*((SwPageDesc*)pDesc));
+ SwPageDesc aPageDesc(*const_cast<SwPageDesc*>(pDesc));
const OUString aOldName(aPageDesc.GetName());
aPageDesc.SetName( rStr );
@@ -1042,7 +1042,7 @@ bool SwDocStyleSheet::SetName(const OUString& rStr, bool bReindexNow)
else
{
// #i91400#
- ((SwNumRule*)pNumRule)->SetName( rStr, rDoc.getIDocumentListsAccess() );
+ const_cast<SwNumRule*>(pNumRule)->SetName( rStr, rDoc.getIDocumentListsAccess() );
rDoc.getIDocumentState().SetModified();
bChg = true;
@@ -1240,7 +1240,7 @@ SfxItemSet& SwDocStyleSheet::GetItemSet()
}
OSL_ENSURE(pDesc, "No PageDescriptor");
- ::PageDescToItemSet(*((SwPageDesc*)pDesc), aCoreSet);
+ ::PageDescToItemSet(*const_cast<SwPageDesc*>(pDesc), aCoreSet);
}
break;
@@ -1344,7 +1344,7 @@ void SwDocStyleSheet::SetItemSet( const SfxItemSet& rSet,
for(sal_uInt16 i = 0; i < COND_COMMAND_COUNT; i++)
{
SwCollCondition aCond( 0, pCmds[ i ].nCnd, pCmds[ i ].nSubCond );
- ((SwConditionTxtFmtColl*)pColl)->RemoveCondition( aCond );
+ static_cast<SwConditionTxtFmtColl*>(pColl)->RemoveCondition( aCond );
const OUString sStyle = pCondItem->GetStyle( i );
if (sStyle.isEmpty())
continue;
@@ -1352,7 +1352,7 @@ void SwDocStyleSheet::SetItemSet( const SfxItemSet& rSet,
if (pFindFmt)
{
aCond.RegisterToFormat( *pFindFmt );
- ((SwConditionTxtFmtColl*)pColl)->InsertCondition( aCond );
+ static_cast<SwConditionTxtFmtColl*>(pColl)->InsertCondition( aCond );
}
}
@@ -1406,7 +1406,7 @@ void SwDocStyleSheet::SetItemSet( const SfxItemSet& rSet,
const SfxPoolItem* pNumRuleItem = 0;
if( SfxItemState::SET == rSet.GetItemState( RES_PARATR_NUMRULE, false, &pNumRuleItem ) )
{ // Setting a numbering rule?
- const OUString sNumRule = ((SwNumRuleItem*)pNumRuleItem)->GetValue();
+ const OUString sNumRule = static_cast<const SwNumRuleItem*>(pNumRuleItem)->GetValue();
if (!sNumRule.isEmpty())
{
SwNumRule* pRule = rDoc.FindNumRulePtr( sNumRule );
@@ -1490,7 +1490,7 @@ void SwDocStyleSheet::SetItemSet( const SfxItemSet& rSet,
{
case SfxItemState::SET:
{
- SvxNumRule* pSetRule = ((SvxNumBulletItem*)pItem)->GetNumRule();
+ SvxNumRule* pSetRule = static_cast<const SvxNumBulletItem*>(pItem)->GetNumRule();
pSetRule->UnLinkGraphics();
SwNumRule aSetRule(*pNumRule);
aSetRule.SetSvxRule(*pSetRule, &rDoc);
@@ -2169,13 +2169,13 @@ void SwDocStyleSheet::SetHelpId( const OUString& r, sal_uLong nId )
case SFX_STYLE_FAMILY_PARA : pTmpFmt = pColl; break;
case SFX_STYLE_FAMILY_FRAME: pTmpFmt = pFrmFmt; break;
case SFX_STYLE_FAMILY_PAGE :
- ((SwPageDesc*)pDesc)->SetPoolHelpId( nHId );
- ((SwPageDesc*)pDesc)->SetPoolHlpFileId( nFileId );
+ const_cast<SwPageDesc*>(pDesc)->SetPoolHelpId( nHId );
+ const_cast<SwPageDesc*>(pDesc)->SetPoolHlpFileId( nFileId );
break;
case SFX_STYLE_FAMILY_PSEUDO:
- ((SwNumRule*)pNumRule)->SetPoolHelpId( nHId );
- ((SwNumRule*)pNumRule)->SetPoolHlpFileId( nFileId );
+ const_cast<SwNumRule*>(pNumRule)->SetPoolHelpId( nHId );
+ const_cast<SwNumRule*>(pNumRule)->SetPoolHlpFileId( nFileId );
break;
default:
@@ -2272,9 +2272,9 @@ void SwDocStyleSheetPool::Replace( SfxStyleSheetBase& rSource,
{
// deal with separately!
SwPageDesc* pDestDsc =
- (SwPageDesc*)((SwDocStyleSheet&)rTarget).GetPageDesc();
+ (SwPageDesc*)static_cast<SwDocStyleSheet&>(rTarget).GetPageDesc();
SwPageDesc* pCpyDsc =
- (SwPageDesc*)((SwDocStyleSheet&)rSource).GetPageDesc();
+ (SwPageDesc*)static_cast<SwDocStyleSheet&>(rSource).GetPageDesc();
rDoc.CopyPageDesc( *pCpyDsc, *pDestDsc );
}
else
@@ -2286,23 +2286,23 @@ void SwDocStyleSheetPool::Replace( SfxStyleSheetBase& rSource,
{
case SFX_STYLE_FAMILY_CHAR :
if( bSwSrcPool )
- pSourceFmt = ((SwDocStyleSheet&)rSource).GetCharFmt();
- pTargetFmt = ((SwDocStyleSheet&)rTarget).GetCharFmt();
+ pSourceFmt = static_cast<SwDocStyleSheet&>(rSource).GetCharFmt();
+ pTargetFmt = static_cast<SwDocStyleSheet&>(rTarget).GetCharFmt();
break;
case SFX_STYLE_FAMILY_PARA :
if( bSwSrcPool )
- pSourceFmt = ((SwDocStyleSheet&)rSource).GetCollection();
- pTargetFmt = ((SwDocStyleSheet&)rTarget).GetCollection();
+ pSourceFmt = static_cast<SwDocStyleSheet&>(rSource).GetCollection();
+ pTargetFmt = static_cast<SwDocStyleSheet&>(rTarget).GetCollection();
break;
case SFX_STYLE_FAMILY_FRAME:
if( bSwSrcPool )
- pSourceFmt = ((SwDocStyleSheet&)rSource).GetFrmFmt();
- pTargetFmt = ((SwDocStyleSheet&)rTarget).GetFrmFmt();
+ pSourceFmt = static_cast<SwDocStyleSheet&>(rSource).GetFrmFmt();
+ pTargetFmt = static_cast<SwDocStyleSheet&>(rTarget).GetFrmFmt();
break;
case SFX_STYLE_FAMILY_PAGE:
{
SwPageDesc *pDesc = rDoc.FindPageDesc(
- ((SwDocStyleSheet&)rTarget).GetPageDesc()->GetName(),
+ static_cast<SwDocStyleSheet&>(rTarget).GetPageDesc()->GetName(),
&nPgDscPos );
if( pDesc )
@@ -2331,7 +2331,7 @@ void SwDocStyleSheetPool::Replace( SfxStyleSheetBase& rSource,
rDoc.ChgPageDesc( nPgDscPos,
rDoc.GetPageDesc(nPgDscPos) );
}
- ((SwDocStyleSheet&)rTarget).SetItemSet( rSource.GetItemSet() );
+ static_cast<SwDocStyleSheet&>(rTarget).SetItemSet( rSource.GetItemSet() );
}
}
@@ -2443,7 +2443,7 @@ bool SwDocStyleSheetPool::SetParent( SfxStyleFamily eFam,
mxStyleSheet->PresetName( rStyle );
mxStyleSheet->PresetParent( rParent );
if( SFX_STYLE_FAMILY_PARA == eFam )
- mxStyleSheet->PresetFollow( ((SwTxtFmtColl*)pFmt)->
+ mxStyleSheet->PresetFollow( static_cast<SwTxtFmtColl*>(pFmt)->
GetNextTxtFmtColl().GetName() );
else
mxStyleSheet->PresetFollow( OUString() );
@@ -2522,8 +2522,8 @@ SfxStyleSheetBase* SwDocStyleSheetPool::Find( const OUString& rName,
if( pMod && !bSearchUsed )
{
const sal_uInt16 nId = SFX_STYLE_FAMILY_PAGE == eFam
- ? ((SwPageDesc*)pMod)->GetPoolFmtId()
- : ((SwFmt*)pMod)->GetPoolFmtId();
+ ? static_cast<const SwPageDesc*>(pMod)->GetPoolFmtId()
+ : static_cast<const SwFmt*>(pMod)->GetPoolFmtId();
if( ( nSMask & ~SFXSTYLEBIT_USED) == SFXSTYLEBIT_USERDEF
? !(nId & USER_FMT)
@@ -2580,14 +2580,14 @@ SfxStyleSheetBase* SwStyleSheetIterator::First()
// Delete current
mxIterSheet->Reset();
- SwDoc& rDoc = ((SwDocStyleSheetPool*)pBasePool)->GetDoc();
+ SwDoc& rDoc = static_cast<SwDocStyleSheetPool*>(pBasePool)->GetDoc();
const sal_uInt16 nSrchMask = nMask;
const bool bIsSearchUsed = SearchUsed();
bool bSearchHidden = ( nMask & SFXSTYLEBIT_HIDDEN );
bool bOnlyHidden = nMask == SFXSTYLEBIT_HIDDEN;
- const bool bOrganizer = ((SwDocStyleSheetPool*)pBasePool)->IsOrganizerMode();
+ const bool bOrganizer = static_cast<SwDocStyleSheetPool*>(pBasePool)->IsOrganizerMode();
bool bAll = ( nSrchMask & SFXSTYLEBIT_ALL_VISIBLE ) == SFXSTYLEBIT_ALL_VISIBLE;
if( nSearchFamily == SFX_STYLE_FAMILY_CHAR
@@ -2967,7 +2967,7 @@ void SwStyleSheetIterator::AppendStyleList(const ::std::vector<OUString>& rList,
bool bTestUsed, bool bTestHidden, bool bOnlyHidden,
sal_uInt16 nSection, char cType )
{
- SwDoc& rDoc = ((SwDocStyleSheetPool*)pBasePool)->GetDoc();
+ SwDoc& rDoc = static_cast<SwDocStyleSheetPool*>(pBasePool)->GetDoc();
bool bUsed = false;
for ( sal_uInt16 i=0; i < rList.size(); ++i )
{
diff --git a/sw/source/uibase/app/swmodul1.cxx b/sw/source/uibase/app/swmodul1.cxx
index bf80bc0e9733..7d58b43f8d0a 100644
--- a/sw/source/uibase/app/swmodul1.cxx
+++ b/sw/source/uibase/app/swmodul1.cxx
@@ -194,7 +194,7 @@ void SwModule::ApplyUsrPref(const SwViewOption &rUsrPref, SwView* pActView,
//is maybe only a SwViewShell
pSh->StartAction();
pSh->ApplyViewOptions( *xViewOpt );
- ((SwWrtShell*)pSh)->SetReadOnlyAvailable(xViewOpt->IsCursorInProtectedArea());
+ static_cast<SwWrtShell*>(pSh)->SetReadOnlyAvailable(xViewOpt->IsCursorInProtectedArea());
pSh->EndAction();
}
if ( pSh->GetViewOptions()->IsReadonly() != bReadonly )
diff --git a/sw/source/uibase/cctrl/popbox.cxx b/sw/source/uibase/cctrl/popbox.cxx
index 4ebf98d738df..0711ca0eba6d 100644
--- a/sw/source/uibase/cctrl/popbox.cxx
+++ b/sw/source/uibase/cctrl/popbox.cxx
@@ -52,12 +52,12 @@ SwHelpToolBox::~SwHelpToolBox() {}
sal_Int8 SwHelpToolBox::AcceptDrop( const AcceptDropEvent& rEvt )
{
- return ((SwNavigationPI*)GetParent())->AcceptDrop( rEvt );
+ return static_cast<SwNavigationPI*>(GetParent())->AcceptDrop( rEvt );
}
sal_Int8 SwHelpToolBox::ExecuteDrop( const ExecuteDropEvent& rEvt )
{
- return ((SwNavigationPI*)GetParent())->ExecuteDrop( rEvt );
+ return static_cast<SwNavigationPI*>(GetParent())->ExecuteDrop( rEvt );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/config/cfgitems.cxx b/sw/source/uibase/config/cfgitems.cxx
index 2f2138b9b95f..7bad6ea65e95 100644
--- a/sw/source/uibase/config/cfgitems.cxx
+++ b/sw/source/uibase/config/cfgitems.cxx
@@ -288,8 +288,8 @@ SfxPoolItem* SwShadowCursorItem::Clone( SfxItemPool* ) const
bool SwShadowCursorItem::operator==( const SfxPoolItem& rCmp ) const
{
- return IsOn() == ((SwShadowCursorItem&)rCmp).IsOn() &&
- GetMode() == ((SwShadowCursorItem&)rCmp).GetMode();
+ return IsOn() == static_cast<const SwShadowCursorItem&>(rCmp).IsOn() &&
+ GetMode() == static_cast<const SwShadowCursorItem&>(rCmp).GetMode();
}
void SwShadowCursorItem::operator=( const SwShadowCursorItem& rCpy )
diff --git a/sw/source/uibase/config/uinums.cxx b/sw/source/uibase/config/uinums.cxx
index d48b6cbb689e..5cd64bf7578c 100644
--- a/sw/source/uibase/config/uinums.cxx
+++ b/sw/source/uibase/config/uinums.cxx
@@ -264,10 +264,10 @@ void SwNumRulesWithName::_SwNumFmtGlobal::ChgNumFmt( SwWrtShell& rSh,
pFmt->SetFmtAttr( aItems[ --n ] );
}
}
- ((SwNumFmt&)aFmt).SetCharFmt( pFmt );
+ const_cast<SwNumFmt&>(aFmt).SetCharFmt( pFmt );
rNew = aFmt;
if( pFmt )
- ((SwNumFmt&)aFmt).SetCharFmt( 0 );
+ const_cast<SwNumFmt&>(aFmt).SetCharFmt( 0 );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/source/uibase/config/usrpref.cxx b/sw/source/uibase/config/usrpref.cxx
index 88aa1f3df64a..03a7ebd9cae2 100644
--- a/sw/source/uibase/config/usrpref.cxx
+++ b/sw/source/uibase/config/usrpref.cxx
@@ -39,7 +39,7 @@ using namespace ::com::sun::star::uno;
void SwMasterUsrPref::SetUsrPref(const SwViewOption &rCopy)
{
- *((SwViewOption*)this) = rCopy;
+ *static_cast<SwViewOption*>(this) = rCopy;
}
SwMasterUsrPref::SwMasterUsrPref(bool bWeb) :
diff --git a/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx b/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx
index 01b1772d9066..4c7afd931c1f 100644
--- a/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx
+++ b/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx
@@ -704,7 +704,7 @@ bool SwSpellDialogChildWindow::MakeTextSelection_Impl(SwWrtShell& rShell, ShellM
if(pSdrView && pSdrView->AreObjectsMarked() &&
pSdrView->GetHdlList().GetFocusHdl())
{
- ((SdrHdlList&)pSdrView->GetHdlList()).ResetFocusHdl();
+ const_cast<SdrHdlList&>(pSdrView->GetHdlList()).ResetFocusHdl();
}
else
{
diff --git a/sw/source/uibase/dialog/swwrtshitem.cxx b/sw/source/uibase/dialog/swwrtshitem.cxx
index 591a6b5403f5..2918c8972f65 100644
--- a/sw/source/uibase/dialog/swwrtshitem.cxx
+++ b/sw/source/uibase/dialog/swwrtshitem.cxx
@@ -32,7 +32,7 @@ SwWrtShellItem::SwWrtShellItem( const SwWrtShellItem& rItem) :
bool SwWrtShellItem::operator==( const SfxPoolItem& rItem) const
{
- return ((SwWrtShellItem&)rItem).pWrtSh == pWrtSh;
+ return static_cast<const SwWrtShellItem&>(rItem).pWrtSh == pWrtSh;
}
SfxPoolItem* SwWrtShellItem::Clone( SfxItemPool * /*pPool*/ ) const
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx
index 7d458b21c945..4d18acb8021d 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -240,7 +240,7 @@ SwTransferable::~SwTransferable()
// the DDELink still needs the WrtShell!
if( refDdeLink.Is() )
{
- ((SwTrnsfrDdeLink*)&refDdeLink)->Disconnect( true );
+ static_cast<SwTrnsfrDdeLink*>(&refDdeLink)->Disconnect( true );
refDdeLink.Clear();
}
@@ -330,8 +330,8 @@ uno::Reference < embed::XEmbeddedObject > SwTransferable::FindOLEObj( sal_Int64&
for( SwCntntNode* pNd = aIter.First(); pNd; pNd = aIter.Next() )
if( ND_OLENODE == pNd->GetNodeType() )
{
- xObj = ((SwOLENode*)pNd)->GetOLEObj().GetOleRef();
- nAspect = ((SwOLENode*)pNd)->GetAspect();
+ xObj = static_cast<SwOLENode*>(pNd)->GetOLEObj().GetOleRef();
+ nAspect = static_cast<SwOLENode*>(pNd)->GetAspect();
break;
}
}
@@ -346,7 +346,7 @@ const Graphic* SwTransferable::FindOLEReplacementGraphic() const
for( SwCntntNode* pNd = aIter.First(); pNd; pNd = aIter.Next() )
if( ND_OLENODE == pNd->GetNodeType() )
{
- return ((SwOLENode*)pNd)->GetGraphic();
+ return static_cast<SwOLENode*>(pNd)->GetGraphic();
}
}
@@ -463,7 +463,7 @@ bool SwTransferable::GetData( const DataFlavor& rFlavor, const OUString& rDestDo
if( pWrtShell->GetContentAtPos( aPos, aCntntAtPos, bSelect ) )
{
pBkmk = new INetBookmark(
- ((SwFmtINetFmt*)aCntntAtPos.aFnd.pAttr)->GetValue(),
+ static_cast<const SwFmtINetFmt*>(aCntntAtPos.aFnd.pAttr)->GetValue(),
aCntntAtPos.sStr );
eBufferType = TRNSFR_INETFLD;
if( bSelect )
@@ -2118,9 +2118,9 @@ bool SwTransferable::_PasteDDE( TransferableDataHelper& rData,
pTyp = rWrtShell.GetFldType( j );
if( RES_DDEFLD == pTyp->Which() )
{
- OUString sTmp( ((SwDDEFieldType*)pTyp)->GetCmd() );
+ OUString sTmp( static_cast<SwDDEFieldType*>(pTyp)->GetCmd() );
if( rColl.isEqual( sTmp, aCmd ) &&
- sfx2::LINKUPDATE_ALWAYS == ((SwDDEFieldType*)pTyp)->GetType() )
+ sfx2::LINKUPDATE_ALWAYS == static_cast<SwDDEFieldType*>(pTyp)->GetType() )
{
aName = pTyp->GetName();
bDoublePaste = true;
diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx
index a2221feb49fa..b44883e12ca6 100644
--- a/sw/source/uibase/docvw/PostItMgr.cxx
+++ b/sw/source/uibase/docvw/PostItMgr.cxx
@@ -257,7 +257,7 @@ void SwPostItMgr::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
{
if ( dynamic_cast<const SfxEventHint*>(&rHint) )
{
- sal_uInt32 nId = ((SfxEventHint&)rHint).GetEventId();
+ sal_uInt32 nId = static_cast<const SfxEventHint&>(rHint).GetEventId();
if ( nId == SW_EVENT_LAYOUT_FINISHED )
{
if ( !mbWaitingForCalcRects && !mvPostItFlds.empty())
@@ -269,7 +269,7 @@ void SwPostItMgr::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
}
else if ( dynamic_cast<const SfxSimpleHint*>(&rHint) )
{
- sal_uInt32 nId = ((SfxSimpleHint&)rHint).GetId();
+ sal_uInt32 nId = static_cast<const SfxSimpleHint&>(rHint).GetId();
switch ( nId )
{
case SFX_HINT_MODECHANGED:
diff --git a/sw/source/uibase/docvw/SidebarTxtControl.cxx b/sw/source/uibase/docvw/SidebarTxtControl.cxx
index 360590604d1a..918586e8ee4f 100644
--- a/sw/source/uibase/docvw/SidebarTxtControl.cxx
+++ b/sw/source/uibase/docvw/SidebarTxtControl.cxx
@@ -348,14 +348,14 @@ void SidebarTxtControl::Command( const CommandEvent& rCEvt )
else
{
boost::scoped_ptr<SfxPopupMenuManager> pMgr(SfxDispatcher::Popup(0, this,&rCEvt.GetMousePosPixel()));
- ((PopupMenu*)pMgr->GetSVMenu())->SetSelectHdl( LINK(this, SidebarTxtControl, Select) );
+ static_cast<PopupMenu*>(pMgr->GetSVMenu())->SetSelectHdl( LINK(this, SidebarTxtControl, Select) );
{
- OUString aText = ((PopupMenu*)pMgr->GetSVMenu())->GetItemText( FN_DELETE_NOTE_AUTHOR );
+ OUString aText = static_cast<PopupMenu*>(pMgr->GetSVMenu())->GetItemText( FN_DELETE_NOTE_AUTHOR );
SwRewriter aRewriter;
aRewriter.AddRule(UndoArg1, mrSidebarWin.GetAuthor());
aText = aRewriter.Apply(aText);
- ((PopupMenu*)pMgr->GetSVMenu())->SetItemText(FN_DELETE_NOTE_AUTHOR,aText);
+ static_cast<PopupMenu*>(pMgr->GetSVMenu())->SetItemText(FN_DELETE_NOTE_AUTHOR,aText);
}
Point aPos;
diff --git a/sw/source/uibase/docvw/edtdd.cxx b/sw/source/uibase/docvw/edtdd.cxx
index 13d5af0bcc78..92534d3e9fee 100644
--- a/sw/source/uibase/docvw/edtdd.cxx
+++ b/sw/source/uibase/docvw/edtdd.cxx
@@ -160,7 +160,7 @@ void SwEditWin::DropCleanup()
bNoInterrupt = false;
if ( m_bOldIdleSet )
{
- ((SwViewOption*)rSh.GetViewOptions())->SetIdle( m_bOldIdle );
+ const_cast<SwViewOption*>(rSh.GetViewOptions())->SetIdle( m_bOldIdle );
m_bOldIdleSet = false;
}
if ( m_pUserMarker )
diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx
index d10edecc9d48..c90740c9ca5f 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -996,7 +996,7 @@ void SwEditWin::ChangeFly( sal_uInt8 nDir, bool bWeb )
RES_PROTECT, RES_PROTECT,
RES_FOLLOW_TEXT_FLOW, RES_FOLLOW_TEXT_FLOW, 0);
rSh.GetFlyFrmAttr( aSet );
- RndStdIds eAnchorId = ((SwFmtAnchor&)aSet.Get(RES_ANCHOR)).GetAnchorId();
+ RndStdIds eAnchorId = static_cast<const SwFmtAnchor&>(aSet.Get(RES_ANCHOR)).GetAnchorId();
Size aSnap;
bool bHuge(MOVE_LEFT_HUGE == nDir ||
MOVE_UP_HUGE == nDir ||
@@ -1035,7 +1035,7 @@ void SwEditWin::ChangeFly( sal_uInt8 nDir, bool bWeb )
SwFmtVertOrient aVert( (SwFmtVertOrient&)aSet.Get(RES_VERT_ORIENT) );
const bool bFollowTextFlow =
static_cast<const SwFmtFollowTextFlow&>(aSet.Get(RES_FOLLOW_TEXT_FLOW)).GetValue();
- const SwPosition* pToCharCntntPos = ((SwFmtAnchor&)aSet.Get(RES_ANCHOR)).GetCntntAnchor();
+ const SwPosition* pToCharCntntPos = static_cast<const SwFmtAnchor&>(aSet.Get(RES_ANCHOR)).GetCntntAnchor();
rSh.CalcBoundRect( aBoundRect, eAnchorId,
text::RelOrientation::FRAME, aVert.GetRelationOrient(),
pToCharCntntPos, bFollowTextFlow,
@@ -1292,7 +1292,7 @@ void SwEditWin::ChangeDrawing( sal_uInt8 nDir )
// switch snapping off
if(!bWasNoSnap)
- ((SdrDragStat&)rDragStat).SetNoSnap(true);
+ const_cast<SdrDragStat&>(rDragStat).SetNoSnap(true);
if(bWasSnapEnabled)
pSdrView->SetSnapEnabled(false);
@@ -1302,7 +1302,7 @@ void SwEditWin::ChangeDrawing( sal_uInt8 nDir )
// restore snap
if(!bWasNoSnap)
- ((SdrDragStat&)rDragStat).SetNoSnap(bWasNoSnap);
+ const_cast<SdrDragStat&>(rDragStat).SetNoSnap(bWasNoSnap);
if(bWasSnapEnabled)
pSdrView->SetSnapEnabled(bWasSnapEnabled);
}
@@ -2277,7 +2277,7 @@ KEYINPUT_CHECKTABLE_INSDEL:
{
EnterDrawTextMode(pObj->GetLogicRect().Center());
if ( m_rView.GetCurShell()->ISA(SwDrawTextShell) )
- ((SwDrawTextShell*)m_rView.GetCurShell())->Init();
+ static_cast<SwDrawTextShell*>(m_rView.GetCurShell())->Init();
rSh.GetDrawView()->KeyInput( rKEvt, this );
}
}
@@ -2320,7 +2320,7 @@ KEYINPUT_CHECKTABLE_INSDEL:
{
EnterDrawTextMode(pObj->GetLogicRect().Center());
if ( m_rView.GetCurShell()->ISA(SwDrawTextShell) )
- ((SwDrawTextShell*)m_rView.GetCurShell())->Init();
+ static_cast<SwDrawTextShell*>(m_rView.GetCurShell())->Init();
}
eKeyState = KS_End;
}
@@ -2330,7 +2330,7 @@ KEYINPUT_CHECKTABLE_INSDEL:
const SdrHdlList& rHdlList = rSh.GetDrawView()->GetHdlList();
bool bForward(!aKeyEvent.GetKeyCode().IsShift());
- ((SdrHdlList&)rHdlList).TravelFocusHdl(bForward);
+ const_cast<SdrHdlList&>(rHdlList).TravelFocusHdl(bForward);
eKeyState = KS_End;
}
break;
@@ -3349,7 +3349,7 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt)
RstMBDownFlags();
EnterDrawTextMode(aDocPos);
if ( m_rView.GetCurShell()->ISA(SwDrawTextShell) )
- ((SwDrawTextShell*)m_rView.GetCurShell())->Init();
+ static_cast<SwDrawTextShell*>(m_rView.GetCurShell())->Init();
return;
}
}
@@ -5203,7 +5203,7 @@ void SwEditWin::Command( const CommandEvent& rCEvt )
{
if ( pMenu )
{
- sal_uInt16 nExecId = ((PopupMenu*)pMenu)->Execute(this, aPixPos);
+ sal_uInt16 nExecId = static_cast<PopupMenu*>(pMenu)->Execute(this, aPixPos);
if( !::ExecuteMenuCommand( *static_cast<PopupMenu*>(pMenu), *m_rView.GetViewFrame(), nExecId ))
pROPopup->Execute(this, nExecId);
}
diff --git a/sw/source/uibase/docvw/edtwin2.cxx b/sw/source/uibase/docvw/edtwin2.cxx
index a0e87aa24fbc..7cdc9d6e4f5a 100644
--- a/sw/source/uibase/docvw/edtwin2.cxx
+++ b/sw/source/uibase/docvw/edtwin2.cxx
@@ -124,7 +124,7 @@ void SwEditWin::RequestHelp(const HelpEvent &rEvt)
if( pSdrView )
{
SdrPageView* pPV = pSdrView->GetSdrPageView();
- SwDPage* pPage = pPV ? ((SwDPage*)pPV->GetPage()) : 0;
+ SwDPage* pPage = pPV ? static_cast<SwDPage*>(pPV->GetPage()) : 0;
bContinue = pPage && pPage->RequestHelp(this, pSdrView, rEvt);
}
}
@@ -152,13 +152,13 @@ void SwEditWin::RequestHelp(const HelpEvent &rEvt)
{
case SwContentAtPos::SW_TABLEBOXFML:
sTxt = "= ";
- sTxt += ((SwTblBoxFormula*)aCntntAtPos.aFnd.pAttr)->GetFormula();
+ sTxt += static_cast<const SwTblBoxFormula*>(aCntntAtPos.aFnd.pAttr)->GetFormula();
break;
#ifdef DBG_UTIL
case SwContentAtPos::SW_TABLEBOXVALUE:
{
sTxt = OStringToOUString(OString::number(
- ((SwTblBoxValue*)aCntntAtPos.aFnd.pAttr)->GetValue()),
+ static_cast<const SwTblBoxValue*>(aCntntAtPos.aFnd.pAttr)->GetValue()),
osl_getThreadTextEncoding());
}
break;
@@ -169,7 +169,7 @@ void SwEditWin::RequestHelp(const HelpEvent &rEvt)
case SwContentAtPos::SW_INETATTR:
{
- sTxt = ((SfxStringItem*)aCntntAtPos.aFnd.pAttr)->GetValue();
+ sTxt = static_cast<const SfxStringItem*>(aCntntAtPos.aFnd.pAttr)->GetValue();
sTxt = URIHelper::removePassword( sTxt,
INetURLObject::WAS_ENCODED,
INetURLObject::DECODE_UNAMBIGUOUS);
@@ -298,9 +298,9 @@ void SwEditWin::RequestHelp(const HelpEvent &rEvt)
case RES_GETEXPFLD:
{
sal_uInt16 nOldSubType = pFld->GetSubType();
- ((SwField*)pFld)->SetSubType(nsSwExtendedSubType::SUB_CMD);
+ const_cast<SwField*>(pFld)->SetSubType(nsSwExtendedSubType::SUB_CMD);
sTxt = pFld->ExpandField(true);
- ((SwField*)pFld)->SetSubType(nOldSubType);
+ const_cast<SwField*>(pFld)->SetSubType(nOldSubType);
}
break;
@@ -350,7 +350,7 @@ void SwEditWin::RequestHelp(const HelpEvent &rEvt)
}
else
{
- sTxt = ((SwGetRefField*)pFld)->GetSetRefName();
+ sTxt = static_cast<const SwGetRefField*>(pFld)->GetSetRefName();
}
}
}
diff --git a/sw/source/uibase/docvw/edtwin3.cxx b/sw/source/uibase/docvw/edtwin3.cxx
index c627b7772ef1..f199a9e6fbee 100644
--- a/sw/source/uibase/docvw/edtwin3.cxx
+++ b/sw/source/uibase/docvw/edtwin3.cxx
@@ -72,7 +72,7 @@ void PageNumNotify( SwViewShell* pVwSh, sal_uInt16 nPhyNum, sal_uInt16 nVirtNum,
{
SfxViewShell *pSfxVwSh = pVwSh->GetSfxViewShell();
if ( pSfxVwSh && pSfxVwSh->ISA(SwView) &&
- ((SwView*)pSfxVwSh)->GetCurShell() )
+ static_cast<SwView*>(pSfxVwSh)->GetCurShell() )
((SwView *)pSfxVwSh)->UpdatePageNums(nPhyNum, nVirtNum, rPgStr);
}
diff --git a/sw/source/uibase/docvw/romenu.cxx b/sw/source/uibase/docvw/romenu.cxx
index 310a5a9054f4..803000404bdc 100644
--- a/sw/source/uibase/docvw/romenu.cxx
+++ b/sw/source/uibase/docvw/romenu.cxx
@@ -68,7 +68,7 @@ void SwReadOnlyPopup::Check( sal_uInt16 nMID, sal_uInt16 nSID, SfxDispatcher &rD
{
CheckItem ( nMID, !_pItem->ISA(SfxVoidItem) &&
_pItem->ISA(SfxBoolItem) &&
- ((SfxBoolItem*)_pItem)->GetValue());
+ static_cast<SfxBoolItem*>(_pItem)->GetValue());
//remove full screen entry when not in full screen mode
if( SID_WIN_FULLSCREEN == nSID && !IsItemChecked(SID_WIN_FULLSCREEN) )
EnableItem(nMID, false);
diff --git a/sw/source/uibase/docvw/srcedtw.cxx b/sw/source/uibase/docvw/srcedtw.cxx
index 39e51cce24de..fb0fc1a7054f 100644
--- a/sw/source/uibase/docvw/srcedtw.cxx
+++ b/sw/source/uibase/docvw/srcedtw.cxx
@@ -393,7 +393,7 @@ void TextViewOutWin::MouseButtonUp( const MouseEvent &rEvt )
if ( pTextView )
{
pTextView->MouseButtonUp( rEvt );
- SfxBindings& rBindings = ((SwSrcEditWindow*)GetParent())->GetSrcView()->GetViewFrame()->GetBindings();
+ SfxBindings& rBindings = static_cast<SwSrcEditWindow*>(GetParent())->GetSrcView()->GetViewFrame()->GetBindings();
rBindings.Invalidate( SID_TABLE_CELL );
rBindings.Invalidate( SID_CUT );
rBindings.Invalidate( SID_COPY );
@@ -421,7 +421,7 @@ void TextViewOutWin::Command( const CommandEvent& rCEvt )
const CommandWheelData* pWData = rCEvt.GetWheelData();
if( !pWData || CommandWheelMode::ZOOM != pWData->GetMode() )
{
- ((SwSrcEditWindow*)GetParent())->HandleWheelCommand( rCEvt );
+ static_cast<SwSrcEditWindow*>(GetParent())->HandleWheelCommand( rCEvt );
}
}
break;
@@ -442,7 +442,7 @@ void TextViewOutWin::KeyInput( const KeyEvent& rKEvt )
if(bChange)
bDone = pTextView->KeyInput( rKEvt );
- SfxBindings& rBindings = ((SwSrcEditWindow*)GetParent())->GetSrcView()->GetViewFrame()->GetBindings();
+ SfxBindings& rBindings = static_cast<SwSrcEditWindow*>(GetParent())->GetSrcView()->GetViewFrame()->GetBindings();
if ( !bDone )
{
if ( !SfxViewShell::Current()->KeyInput( rKEvt ) )
diff --git a/sw/source/uibase/fldui/fldmgr.cxx b/sw/source/uibase/fldui/fldmgr.cxx
index 887fb91fe033..c197ebcb1667 100644
--- a/sw/source/uibase/fldui/fldmgr.cxx
+++ b/sw/source/uibase/fldui/fldmgr.cxx
@@ -466,18 +466,18 @@ bool SwFldMgr::GetSubTypes(sal_uInt16 nTypeId, std::vector<OUString>& rToFill)
(nTypeId == TYP_USERFLD && nWhich == RES_USERFLD) ||
(nTypeId == TYP_GETFLD && nWhich == RES_SETEXPFLD &&
- !(((SwSetExpFieldType*)pFldType)->GetType() & nsSwGetSetExpType::GSE_SEQ)) ||
+ !(static_cast<SwSetExpFieldType*>(pFldType)->GetType() & nsSwGetSetExpType::GSE_SEQ)) ||
(nTypeId == TYP_SETFLD && nWhich == RES_SETEXPFLD &&
- !(((SwSetExpFieldType*)pFldType)->GetType() & nsSwGetSetExpType::GSE_SEQ)) ||
+ !(static_cast<SwSetExpFieldType*>(pFldType)->GetType() & nsSwGetSetExpType::GSE_SEQ)) ||
(nTypeId == TYP_SEQFLD && nWhich == RES_SETEXPFLD &&
- (((SwSetExpFieldType*)pFldType)->GetType() & nsSwGetSetExpType::GSE_SEQ)) ||
+ (static_cast<SwSetExpFieldType*>(pFldType)->GetType() & nsSwGetSetExpType::GSE_SEQ)) ||
((nTypeId == TYP_INPUTFLD || nTypeId == TYP_FORMELFLD) &&
(nWhich == RES_USERFLD ||
(nWhich == RES_SETEXPFLD &&
- !(((SwSetExpFieldType*)pFldType)->GetType() & nsSwGetSetExpType::GSE_SEQ))) ) )
+ !(static_cast<SwSetExpFieldType*>(pFldType)->GetType() & nsSwGetSetExpType::GSE_SEQ))) ) )
{
rToFill.push_back(pFldType->GetName());
}
@@ -853,7 +853,7 @@ bool SwFldMgr::InsertFld(
nByte = std::max(sal_uInt16(1), nByte);
nByte = std::min(nByte, sal_uInt16(MAXLEVEL));
nByte -= 1;
- ((SwChapterField*)pFld)->SetLevel((sal_uInt8)nByte);
+ static_cast<SwChapterField*>(pFld)->SetLevel((sal_uInt8)nByte);
break;
}
@@ -888,7 +888,7 @@ bool SwFldMgr::InsertFld(
if( SVX_NUM_CHAR_SPECIAL == nFormatId &&
( PG_PREV == nSubType || PG_NEXT == nSubType ) )
- ((SwPageNumberField*)pFld)->SetUserString( rData.sPar2 );
+ static_cast<SwPageNumberField*>(pFld)->SetUserString( rData.sPar2 );
break;
}
@@ -1314,8 +1314,8 @@ bool SwFldMgr::InsertFld(
OUString* pArray = aEntries.getArray();
for(sal_Int32 nToken = 0; nToken < nTokenCount; nToken++)
pArray[nToken] = rData.sPar2.getToken(nToken, DB_DELIM);
- ((SwDropDownField*)pFld)->SetItems(aEntries);
- ((SwDropDownField*)pFld)->SetName(rData.sPar1);
+ static_cast<SwDropDownField*>(pFld)->SetItems(aEntries);
+ static_cast<SwDropDownField*>(pFld)->SetName(rData.sPar1);
}
break;
default:
@@ -1345,7 +1345,7 @@ bool SwFldMgr::InsertFld(
pCurShell->Right(CRSR_SKIP_CHARS, false, 1, false );
}
else if( bPageVar )
- ((SwRefPageGetFieldType*)pCurShell->GetFldType( 0, RES_REFPAGEGETFLD ))->UpdateFlds();
+ static_cast<SwRefPageGetFieldType*>(pCurShell->GetFldType( 0, RES_REFPAGEGETFLD ))->UpdateFlds();
else if( TYP_GETREFFLD == rData.nTypeId )
pFld->GetTyp()->ModifyNotification( 0, 0 );
@@ -1413,19 +1413,19 @@ void SwFldMgr::UpdateCurFld(sal_uLong nFormat,
nByte = std::max(sal_uInt16(1), nByte);
nByte = std::min(nByte, sal_uInt16(MAXLEVEL));
nByte -= 1;
- ((SwChapterField*)pTmpFld)->SetLevel((sal_uInt8)nByte);
+ static_cast<SwChapterField*>(pTmpFld)->SetLevel((sal_uInt8)nByte);
bSetPar2 = false;
break;
}
case TYP_SCRIPTFLD:
- ((SwScriptField*)pTmpFld)->SetCodeURL((bool)nFormat);
+ static_cast<SwScriptField*>(pTmpFld)->SetCodeURL((bool)nFormat);
break;
case TYP_NEXTPAGEFLD:
if( SVX_NUM_CHAR_SPECIAL == nFormat )
{
- ((SwPageNumberField*)pCurFld)->SetUserString( sPar2 );
+ static_cast<SwPageNumberField*>(pCurFld)->SetUserString( sPar2 );
sPar2 = "1";
}
else
@@ -1441,7 +1441,7 @@ void SwFldMgr::UpdateCurFld(sal_uLong nFormat,
case TYP_PREVPAGEFLD:
if( SVX_NUM_CHAR_SPECIAL == nFormat )
{
- ((SwPageNumberField*)pCurFld)->SetUserString( sPar2 );
+ static_cast<SwPageNumberField*>(pCurFld)->SetUserString( sPar2 );
sPar2 = "-1";
}
else
@@ -1463,10 +1463,10 @@ void SwFldMgr::UpdateCurFld(sal_uLong nFormat,
case TYP_GETREFFLD:
{
bSetPar2 = false;
- ((SwGetRefField*)pTmpFld)->SetSubType( (sal_uInt16)rPar2.toInt32() );
+ static_cast<SwGetRefField*>(pTmpFld)->SetSubType( (sal_uInt16)rPar2.toInt32() );
const sal_Int32 nPos = rPar2.indexOf( '|' );
if( nPos>=0 )
- ((SwGetRefField*)pTmpFld)->SetSeqNo( (sal_uInt16)rPar2.copy( nPos + 1 ).toInt32());
+ static_cast<SwGetRefField*>(pTmpFld)->SetSeqNo( (sal_uInt16)rPar2.copy( nPos + 1 ).toInt32());
}
break;
case TYP_DROPDOWN:
@@ -1476,8 +1476,8 @@ void SwFldMgr::UpdateCurFld(sal_uLong nFormat,
OUString* pArray = aEntries.getArray();
for(sal_Int32 nToken = 0; nToken < nTokenCount; nToken++)
pArray[nToken] = sPar2.getToken(nToken, DB_DELIM);
- ((SwDropDownField*)pTmpFld)->SetItems(aEntries);
- ((SwDropDownField*)pTmpFld)->SetName(sPar1);
+ static_cast<SwDropDownField*>(pTmpFld)->SetItems(aEntries);
+ static_cast<SwDropDownField*>(pTmpFld)->SetName(sPar1);
bSetPar1 = bSetPar2 = false;
}
break;
@@ -1705,7 +1705,7 @@ Reference<XNumberingTypeInfo> SwFldMgr::GetNumberingInfo() const
{
Reference<XComponentContext> xContext( ::comphelper::getProcessComponentContext() );
Reference<XDefaultNumberingProvider> xDefNum = text::DefaultNumberingProvider::create(xContext);
- ((SwFldMgr*)this)->xNumberingInfo = Reference<XNumberingTypeInfo>(xDefNum, UNO_QUERY);
+ const_cast<SwFldMgr*>(this)->xNumberingInfo = Reference<XNumberingTypeInfo>(xDefNum, UNO_QUERY);
}
return xNumberingInfo;
}
diff --git a/sw/source/uibase/frmdlg/colex.cxx b/sw/source/uibase/frmdlg/colex.cxx
index f5e5b054d5e8..59bc6f9fb77b 100644
--- a/sw/source/uibase/frmdlg/colex.cxx
+++ b/sw/source/uibase/frmdlg/colex.cxx
@@ -98,7 +98,7 @@ void SwPageExample::UpdateExample( const SfxItemSet& rSet )
if( SfxItemState::SET == rSet.GetItemState( pPool->GetWhich( SID_ATTR_PAGE_HEADERSET),
false, &pItem ) )
{
- const SfxItemSet& rHeaderSet = ((SvxSetItem*)pItem)->GetItemSet();
+ const SfxItemSet& rHeaderSet = static_cast<const SvxSetItem*>(pItem)->GetItemSet();
const SfxBoolItem& rHeaderOn =
(const SfxBoolItem&)rHeaderSet.Get( pPool->GetWhich( SID_ATTR_PAGE_ON ) );
@@ -145,7 +145,7 @@ void SwPageExample::UpdateExample( const SfxItemSet& rSet )
if( SfxItemState::SET == rSet.GetItemState( pPool->GetWhich( SID_ATTR_PAGE_FOOTERSET),
false, &pItem ) )
{
- const SfxItemSet& rFooterSet = ((SvxSetItem*)pItem)->GetItemSet();
+ const SfxItemSet& rFooterSet = static_cast<const SvxSetItem*>(pItem)->GetItemSet();
const SfxBoolItem& rFooterOn =
(const SfxBoolItem&)rFooterSet.Get( SID_ATTR_PAGE_ON );
diff --git a/sw/source/uibase/frmdlg/frmmgr.cxx b/sw/source/uibase/frmdlg/frmmgr.cxx
index 241cf8c03c85..b4285c82731e 100644
--- a/sw/source/uibase/frmdlg/frmmgr.cxx
+++ b/sw/source/uibase/frmdlg/frmmgr.cxx
@@ -142,8 +142,8 @@ void SwFlyFrmAttrMgr::UpdateFlyFrm()
SfxItemSet aGetSet( *m_aSet.GetPool(), RES_ANCHOR, RES_ANCHOR );
if( m_pOwnSh->GetFlyFrmAttr( aGetSet ) && 1 == aGetSet.Count() &&
SfxItemState::SET == aGetSet.GetItemState( RES_ANCHOR, false, &pGItem )
- && ((SwFmtAnchor*)pGItem)->GetAnchorId() ==
- ((SwFmtAnchor*)pItem)->GetAnchorId() )
+ && static_cast<const SwFmtAnchor*>(pGItem)->GetAnchorId() ==
+ static_cast<const SwFmtAnchor*>(pItem)->GetAnchorId() )
m_aSet.ClearItem( RES_ANCHOR );
}
diff --git a/sw/source/uibase/inc/frmmgr.hxx b/sw/source/uibase/inc/frmmgr.hxx
index a28d2ff04451..2f8c56c3596a 100644
--- a/sw/source/uibase/inc/frmmgr.hxx
+++ b/sw/source/uibase/inc/frmmgr.hxx
@@ -140,12 +140,12 @@ public:
inline const Size& SwFlyFrmAttrMgr::GetSize() const
{
- return ((SwFmtFrmSize&)m_aSet.Get(RES_FRM_SIZE)).GetSize();
+ return static_cast<const SwFmtFrmSize&>(m_aSet.Get(RES_FRM_SIZE)).GetSize();
}
inline const SwFmtVertOrient &SwFlyFrmAttrMgr::GetVertOrient() const
{
- return ((SwFmtVertOrient&)m_aSet.Get(RES_VERT_ORIENT));
+ return static_cast<const SwFmtVertOrient&>(m_aSet.Get(RES_VERT_ORIENT));
}
inline const SwFmtHoriOrient &SwFlyFrmAttrMgr::GetHoriOrient() const
{
@@ -153,19 +153,19 @@ inline const SwFmtHoriOrient &SwFlyFrmAttrMgr::GetHoriOrient() const
}
inline const SwFmtFrmSize& SwFlyFrmAttrMgr::GetFrmSize() const
{
- return ((SwFmtFrmSize&)m_aSet.Get(RES_FRM_SIZE));
+ return static_cast<const SwFmtFrmSize&>(m_aSet.Get(RES_FRM_SIZE));
}
inline const SvxShadowItem &SwFlyFrmAttrMgr::GetShadow() const
{
- return ((SvxShadowItem&)m_aSet.Get(RES_SHADOW));
+ return static_cast<const SvxShadowItem&>(m_aSet.Get(RES_SHADOW));
}
inline const SvxBoxItem &SwFlyFrmAttrMgr::GetBox() const
{
- return ((SvxBoxItem&)m_aSet.Get(RES_BOX));
+ return static_cast<const SvxBoxItem&>(m_aSet.Get(RES_BOX));
}
inline const SwFmtSurround &SwFlyFrmAttrMgr::GetSurround() const
{
- return ((SwFmtSurround&)m_aSet.Get(RES_SURROUND));
+ return static_cast<const SwFmtSurround&>(m_aSet.Get(RES_SURROUND));
}
inline Point SwFlyFrmAttrMgr::GetPos() const
@@ -175,7 +175,7 @@ inline Point SwFlyFrmAttrMgr::GetPos() const
inline RndStdIds SwFlyFrmAttrMgr::GetAnchor() const
{
- return ((SwFmtAnchor&)m_aSet.Get(RES_ANCHOR)).GetAnchorId();
+ return static_cast<const SwFmtAnchor&>(m_aSet.Get(RES_ANCHOR)).GetAnchorId();
}
inline sal_uInt16 SwFlyFrmAttrMgr::GetHeightPercent() const
diff --git a/sw/source/uibase/inc/inputwin.hxx b/sw/source/uibase/inc/inputwin.hxx
index 291868ef5012..f5a9e28d050b 100644
--- a/sw/source/uibase/inc/inputwin.hxx
+++ b/sw/source/uibase/inc/inputwin.hxx
@@ -108,9 +108,9 @@ public:
virtual ~SwInputChild();
SFX_DECL_CHILDWINDOW_WITHID( SwInputChild );
void SetFormula( const OUString& rFormula, bool bDelSel = true )
- { ((SwInputWindow*)pWindow)->SetFormula(
+ { static_cast<SwInputWindow*>(pWindow)->SetFormula(
rFormula, bDelSel ); }
- const SwView* GetView() const{return ((SwInputWindow*)pWindow)->GetView();}
+ const SwView* GetView() const{return static_cast<SwInputWindow*>(pWindow)->GetView();}
};
diff --git a/sw/source/uibase/inc/view.hxx b/sw/source/uibase/inc/view.hxx
index e624560e071f..cc2948642478 100644
--- a/sw/source/uibase/inc/view.hxx
+++ b/sw/source/uibase/inc/view.hxx
@@ -673,7 +673,7 @@ inline long SwView::GetYScroll() const
inline const SwDocShell *SwView::GetDocShell() const
{
- return ((SwView*)this)->GetDocShell();
+ return const_cast<SwView*>(this)->GetDocShell();
}
SfxTabPage* CreatePrintOptionsPage( vcl::Window *pParent,
diff --git a/sw/source/uibase/misc/redlndlg.cxx b/sw/source/uibase/misc/redlndlg.cxx
index fc993a8c32eb..f4f754d71ccd 100644
--- a/sw/source/uibase/misc/redlndlg.cxx
+++ b/sw/source/uibase/misc/redlndlg.cxx
@@ -78,7 +78,7 @@ bool SwRedlineAcceptChild::ReInitDlg(SwDocShell *pDocSh)
bool bRet;
if ((bRet = SwChildWinWrapper::ReInitDlg(pDocSh))) // update immediately, doc switch!
- ((SwModelessRedlineAcceptDlg*)GetWindow())->Activate();
+ static_cast<SwModelessRedlineAcceptDlg*>(GetWindow())->Activate();
return bRet;
}
@@ -846,7 +846,7 @@ void SwRedlineAcceptDlg::CallAcceptReject( bool bSelect, bool bAccept )
sal_uInt16 SwRedlineAcceptDlg::GetRedlinePos( const SvTreeListEntry& rEntry ) const
{
SwWrtShell* pSh = ::GetActiveView()->GetWrtShellPtr();
- return pSh->FindRedlineOfData( *((SwRedlineDataParent*)((RedlinData *)
+ return pSh->FindRedlineOfData( *static_cast<SwRedlineDataParent*>(((RedlinData *)
rEntry.GetUserData())->pData)->pData );
}