diff options
32 files changed, 116 insertions, 114 deletions
diff --git a/include/sfx2/childwin.hxx b/include/sfx2/childwin.hxx index 74818e24ac85..4fe4c008ee6a 100644 --- a/include/sfx2/childwin.hxx +++ b/include/sfx2/childwin.hxx @@ -320,7 +320,7 @@ public: SfxChildWinInfo Class::GetInfo() const \ { \ SfxChildWinInfo aInfo = SfxChildWindow::GetInfo(); \ - ((SfxFloatingWindow*)GetWindow())->FillInfo( aInfo ); \ + static_cast<SfxFloatingWindow*>(GetWindow())->FillInfo( aInfo ); \ return aInfo; } #define SFX_IMPL_FLOATINGWINDOW_WITHID(Class, MyID) \ @@ -328,7 +328,7 @@ public: SfxChildWinInfo Class::GetInfo() const \ { \ SfxChildWinInfo aInfo = SfxChildWindow::GetInfo(); \ - ((SfxFloatingWindow*)GetWindow())->FillInfo( aInfo ); \ + static_cast<SfxFloatingWindow*>(GetWindow())->FillInfo( aInfo ); \ return aInfo; } #define SFX_IMPL_MODELESSDIALOG_WITHID(Class, MyID) \ @@ -336,7 +336,7 @@ public: SfxChildWinInfo Class::GetInfo() const \ { \ SfxChildWinInfo aInfo = SfxChildWindow::GetInfo(); \ - ((SfxModelessDialog*)GetWindow())->FillInfo( aInfo ); \ + static_cast<SfxModelessDialog*>(GetWindow())->FillInfo( aInfo ); \ return aInfo; } @@ -345,7 +345,7 @@ public: SfxChildWinInfo Class::GetInfo() const \ { \ SfxChildWinInfo aInfo = SfxChildWindow::GetInfo(); \ - ((SfxDockingWindow*)GetWindow())->FillInfo( aInfo ); \ + static_cast<SfxDockingWindow*>(GetWindow())->FillInfo( aInfo ); \ return aInfo; } #define SFX_IMPL_DOCKINGWINDOW_WITHID(Class, MyID) \ @@ -353,7 +353,7 @@ public: SfxChildWinInfo Class::GetInfo() const \ { \ SfxChildWinInfo aInfo = SfxChildWindow::GetInfo(); \ - ((SfxDockingWindow*)GetWindow())->FillInfo( aInfo ); \ + static_cast<SfxDockingWindow*>(GetWindow())->FillInfo( aInfo ); \ return aInfo; } #define SFX_IMPL_TOOLBOX(Class, MyID) \ @@ -361,7 +361,7 @@ public: SfxChildWinInfo Class::GetInfo() const \ { \ SfxChildWinInfo aInfo = SfxChildWindow::GetInfo(); \ - ((SfxToolbox*)GetWindow())->FillInfo( aInfo ); \ + static_cast<SfxToolbox*>(GetWindow())->FillInfo( aInfo ); \ return aInfo; } bool GetPosSizeFromString( const OUString& rStr, Point& rPos, Size& rSize ); diff --git a/include/svl/itemset.hxx b/include/svl/itemset.hxx index f2598ef842c5..aab9fb7224f2 100644 --- a/include/svl/itemset.hxx +++ b/include/svl/itemset.hxx @@ -34,8 +34,8 @@ typedef SfxPoolItem const** SfxItemArray; #define USHORT_ARG int #define SFX_ITEMSET_GET( rSet, pItem, ItemType, nSlotId, bDeep ) \ - const ItemType *pItem = (const ItemType*) \ - (rSet).GetItem( nSlotId, bDeep, TYPE(ItemType) ) + const ItemType *pItem = static_cast<const ItemType*>( \ + (rSet).GetItem( nSlotId, bDeep, TYPE(ItemType) ) ) class SVL_DLLPUBLIC SfxItemSet { diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx index cf9aab2da3f5..f8d60b1b03d7 100644 --- a/sfx2/source/dialog/dinfdlg.cxx +++ b/sfx2/source/dialog/dinfdlg.cxx @@ -987,12 +987,12 @@ bool SfxDocumentPage::FillItemSet( SfxItemSet* rSet ) void SfxDocumentPage::Reset( const SfxItemSet* rSet ) { // Determine the document information - const SfxDocumentInfoItem *m_pInfoItem = - &(const SfxDocumentInfoItem &)rSet->Get(SID_DOCINFO); + const SfxDocumentInfoItem& rInfoItem = + static_cast<const SfxDocumentInfoItem &>(rSet->Get(SID_DOCINFO)); // template data - if ( m_pInfoItem->HasTemplate() ) - m_pTemplValFt->SetText( m_pInfoItem->getTemplateName() ); + if ( rInfoItem.HasTemplate() ) + m_pTemplValFt->SetText( rInfoItem.getTemplateName() ); else { m_pTemplFt->Hide(); @@ -1000,7 +1000,7 @@ void SfxDocumentPage::Reset( const SfxItemSet* rSet ) } // determine file name - OUString aFile( m_pInfoItem->GetValue() ); + OUString aFile( rInfoItem.GetValue() ); OUString aFactory( aFile ); if ( aFile.getLength() > 2 && aFile[0] == '[' ) { @@ -1023,7 +1023,7 @@ void SfxDocumentPage::Reset( const SfxItemSet* rSet ) else { DBG_ASSERT( pItem->IsA( TYPE( SfxStringItem ) ), "SfxDocumentPage:<SfxStringItem> expected" ); - aName = ( ( SfxStringItem* ) pItem )->GetValue(); + aName = static_cast<const SfxStringItem*>( pItem )->GetValue(); } m_pNameED->SetText( aName ); m_pNameED->ClearModifyFlag(); @@ -1078,31 +1078,31 @@ void SfxDocumentPage::Reset( const SfxItemSet* rSet ) m_pFileValFt->SetText( aURL.GetPartBeforeLastName() ); // handle access data - bool m_bUseUserData = m_pInfoItem->IsUseUserData(); + bool m_bUseUserData = rInfoItem.IsUseUserData(); const LocaleDataWrapper& rLocaleWrapper( Application::GetSettings().GetLocaleDataWrapper() ); - m_pCreateValFt->SetText( ConvertDateTime_Impl( m_pInfoItem->getAuthor(), - m_pInfoItem->getCreationDate(), rLocaleWrapper ) ); - util::DateTime aTime( m_pInfoItem->getModificationDate() ); + m_pCreateValFt->SetText( ConvertDateTime_Impl( rInfoItem.getAuthor(), + rInfoItem.getCreationDate(), rLocaleWrapper ) ); + util::DateTime aTime( rInfoItem.getModificationDate() ); if ( aTime.Month > 0 ) m_pChangeValFt->SetText( ConvertDateTime_Impl( - m_pInfoItem->getModifiedBy(), aTime, rLocaleWrapper ) ); - aTime = m_pInfoItem->getPrintDate(); + rInfoItem.getModifiedBy(), aTime, rLocaleWrapper ) ); + aTime = rInfoItem.getPrintDate(); if ( aTime.Month > 0 ) - m_pPrintValFt->SetText( ConvertDateTime_Impl( m_pInfoItem->getPrintedBy(), + m_pPrintValFt->SetText( ConvertDateTime_Impl( rInfoItem.getPrintedBy(), aTime, rLocaleWrapper ) ); - const long nTime = m_pInfoItem->getEditingDuration(); + const long nTime = rInfoItem.getEditingDuration(); if ( m_bUseUserData ) { const tools::Time aT( nTime/3600, (nTime%3600)/60, nTime%60 ); m_pTimeLogValFt->SetText( rLocaleWrapper.getDuration( aT ) ); m_pDocNoValFt->SetText( OUString::number( - m_pInfoItem->getEditingCycles() ) ); + rInfoItem.getEditingCycles() ) ); } // Check for cmis properties where otherwise unavailable - if ( m_pInfoItem->isCmisDocument( ) ) + if ( rInfoItem.isCmisDocument( ) ) { - uno::Sequence< document::CmisProperty > aCmisProps = m_pInfoItem->GetCmisProperties(); + uno::Sequence< document::CmisProperty > aCmisProps = rInfoItem.GetCmisProperties(); for ( sal_Int32 i = 0; i < aCmisProps.getLength(); i++ ) { if ( aCmisProps[i].Id == "cmis:contentStreamLength" && @@ -1162,8 +1162,8 @@ SfxDocumentInfoDialog::SfxDocumentInfoDialog( vcl::Window* pParent, "sfx/ui/documentpropertiesdialog.ui", &rItemSet) , m_nDocInfoId(0) { - const SfxDocumentInfoItem* m_pInfoItem = - &(const SfxDocumentInfoItem &)rItemSet.Get( SID_DOCINFO ); + const SfxDocumentInfoItem& rInfoItem = + static_cast<const SfxDocumentInfoItem &>(rItemSet.Get( SID_DOCINFO )); #ifdef DBG_UTIL SFX_ITEMSET_ARG( &rItemSet, pURLItem, SfxStringItem, SID_BASEURL, false ); @@ -1177,7 +1177,7 @@ SfxDocumentInfoDialog::SfxDocumentInfoDialog( vcl::Window* pParent, rItemSet.GetItemState( SID_EXPLORER_PROPS_START, false, &pItem ) ) { // File name - OUString aFile( m_pInfoItem->GetValue() ); + OUString aFile( rInfoItem.GetValue() ); INetURLObject aURL; aURL.SetSmartProtocol( INET_PROT_FILE ); @@ -1214,7 +1214,7 @@ SfxDocumentInfoDialog::SfxDocumentInfoDialog( vcl::Window* pParent, void SfxDocumentInfoDialog::PageCreated( sal_uInt16 nId, SfxTabPage &rPage ) { if ( m_nDocInfoId == nId ) - ( (SfxDocumentPage&)rPage ).EnableUseUserData(); + static_cast<SfxDocumentPage&>(rPage).EnableUseUserData(); } void SfxDocumentInfoDialog::AddFontTabPage() diff --git a/sfx2/source/dialog/dockwin.cxx b/sfx2/source/dialog/dockwin.cxx index f4a1293164a2..5124b47a8db2 100644 --- a/sfx2/source/dialog/dockwin.cxx +++ b/sfx2/source/dialog/dockwin.cxx @@ -206,7 +206,7 @@ SfxDockingWrapper::SfxDockingWrapper( vcl::Window* pParentWnd , pWindow->SetOutputSizePixel( Size( 270, 240 ) ); - ( ( SfxDockingWindow* ) pWindow )->Initialize( pInfo ); + static_cast<SfxDockingWindow*>( pWindow )->Initialize( pInfo ); SetHideNotDelete( true ); } @@ -233,7 +233,7 @@ void SfxDockingWrapper::RegisterChildWindow (bool bVis, SfxModule *pMod, sal_uIn SfxChildWinInfo SfxDockingWrapper::GetInfo() const { SfxChildWinInfo aInfo = SfxChildWindow::GetInfo(); - ((SfxDockingWindow*)GetWindow())->FillInfo( aInfo ); + static_cast<SfxDockingWindow*>(GetWindow())->FillInfo( aInfo ); return aInfo; }; diff --git a/sfx2/source/dialog/infobar.cxx b/sfx2/source/dialog/infobar.cxx index b6baf00e0452..f7b91518eeea 100644 --- a/sfx2/source/dialog/infobar.cxx +++ b/sfx2/source/dialog/infobar.cxx @@ -224,7 +224,7 @@ void SfxInfoBarWindow::Resize( ) IMPL_LINK_NOARG( SfxInfoBarWindow, CloseHandler ) { - ((SfxInfoBarContainerWindow*)GetParent())->removeInfoBar( this ); + static_cast<SfxInfoBarContainerWindow*>(GetParent())->removeInfoBar( this ); return 0; } diff --git a/sfx2/source/dialog/mgetempl.cxx b/sfx2/source/dialog/mgetempl.cxx index d09b7cd3227b..10bec557a1cf 100644 --- a/sfx2/source/dialog/mgetempl.cxx +++ b/sfx2/source/dialog/mgetempl.cxx @@ -45,7 +45,7 @@ */ SfxManageStyleSheetPage::SfxManageStyleSheetPage(vcl::Window* pParent, const SfxItemSet& rAttrSet) : SfxTabPage(pParent, "ManageStylePage", "sfx/ui/managestylepage.ui", &rAttrSet) - , pStyle(&((SfxStyleDialog*)GetParentDialog())->GetStyleSheet()) + , pStyle(&static_cast<SfxStyleDialog*>(GetParentDialog())->GetStyleSheet()) , pItem(0) , bModified(false) , aName(pStyle->GetName()) @@ -191,7 +191,7 @@ SfxManageStyleSheetPage::SfxManageStyleSheetPage(vcl::Window* pParent, const Sfx pTupel->nFlags != SFXSTYLEBIT_ALL ) { m_pFilterLb->InsertEntry( pTupel->aName, nIdx ); - m_pFilterLb->SetEntryData(nIdx, (void*)(sal_IntPtr)i); + m_pFilterLb->SetEntryData(nIdx, reinterpret_cast<void*>(i)); if ( ( pTupel->nFlags & nMask ) == nMask ) nStyleFilterIdx = nIdx; @@ -288,7 +288,7 @@ void SfxManageStyleSheetPage::SetDescriptionText_Impl() { const SfxPoolItem* pPoolItem = pModule->GetItem( SID_ATTR_METRIC ); if ( pPoolItem ) - eFieldUnit = (FieldUnit)( (SfxUInt16Item*)pPoolItem )->GetValue(); + eFieldUnit = (FieldUnit) static_cast<const SfxUInt16Item*>( pPoolItem )->GetValue(); } switch ( eFieldUnit ) @@ -380,7 +380,7 @@ bool SfxManageStyleSheetPage::FillItemSet( SfxItemSet* rSet ) bModified = true; OSL_ENSURE( pItem, "No Item" ); // is only possibly for user templates - sal_uInt16 nMask = pItem->GetFilterList()[ (size_t)m_pFilterLb->GetEntryData( nFilterIdx ) ]->nFlags | SFXSTYLEBIT_USERDEF; + sal_uInt16 nMask = pItem->GetFilterList()[ reinterpret_cast<size_t>(m_pFilterLb->GetEntryData( nFilterIdx )) ]->nFlags | SFXSTYLEBIT_USERDEF; pStyle->SetMask( nMask ); } if(m_pAutoCB->IsVisible() && @@ -506,7 +506,7 @@ void SfxManageStyleSheetPage::ActivatePage( const SfxItemSet& rSet) if ( SfxItemState::SET == rSet.GetItemState( SID_ATTR_AUTO_STYLE_UPDATE, false, &pPoolItem ) ) - m_pAutoCB->Check( ( (const SfxBoolItem*)pPoolItem )->GetValue() ); + m_pAutoCB->Check( static_cast<const SfxBoolItem*>(pPoolItem)->GetValue() ); m_pAutoCB->SaveValue(); } diff --git a/sfx2/source/dialog/navigat.cxx b/sfx2/source/dialog/navigat.cxx index 334e7771a786..eb3c76e97ba9 100644 --- a/sfx2/source/dialog/navigat.cxx +++ b/sfx2/source/dialog/navigat.cxx @@ -41,7 +41,7 @@ SfxNavigatorWrapper::SfxNavigatorWrapper( vcl::Window* pParentWnd , pWindow->SetHelpId ( HID_NAVIGATOR_WINDOW ); pWindow->SetOutputSizePixel( Size( 270, 240 ) ); - ( ( SfxDockingWindow* ) pWindow )->Initialize( pInfo ); + static_cast<SfxDockingWindow*>( pWindow )->Initialize( pInfo ); SetHideNotDelete( true ); } diff --git a/sfx2/source/dialog/partwnd.cxx b/sfx2/source/dialog/partwnd.cxx index 8e34b5cb4919..245dd612308f 100644 --- a/sfx2/source/dialog/partwnd.cxx +++ b/sfx2/source/dialog/partwnd.cxx @@ -65,10 +65,10 @@ SfxPartChildWnd_Impl::SfxPartChildWnd_Impl assert(pInfo); pInfo->nFlags |= SFX_CHILDWIN_FORCEDOCK; - ((SfxDockingWindow*)pWindow)->SetFloatingSize( Size( 175, 175 ) ); + static_cast<SfxDockingWindow*>(pWindow)->SetFloatingSize( Size( 175, 175 ) ); pWindow->SetSizePixel( Size( 175, 175 ) ); - ( ( SfxDockingWindow* ) pWindow )->Initialize( pInfo ); + static_cast<SfxDockingWindow*>(pWindow)->Initialize( pInfo ); SetHideNotDelete( true ); } @@ -82,7 +82,7 @@ SfxPartChildWnd_Impl::~SfxPartChildWnd_Impl() // But don't do it, if xFrame already exist. Then dispose() must come from inside ... // and we need a valid pMgr for further operations ... - SfxPartDockWnd_Impl* pWin = (SfxPartDockWnd_Impl*) pWindow; + SfxPartDockWnd_Impl* pWin = static_cast<SfxPartDockWnd_Impl*>(pWindow); if ( pWin && xFrame == pWin->GetBindings().GetActiveFrame() ) pWin->GetBindings().SetActiveFrame( NULL ); @@ -90,7 +90,7 @@ SfxPartChildWnd_Impl::~SfxPartChildWnd_Impl() bool SfxPartChildWnd_Impl::QueryClose() { - return ( (SfxPartDockWnd_Impl*)pWindow )->QueryClose(); + return static_cast<SfxPartDockWnd_Impl*>(pWindow)->QueryClose(); } diff --git a/sfx2/source/dialog/recfloat.cxx b/sfx2/source/dialog/recfloat.cxx index 12f3540ad0a1..981cd9ca6dc7 100644 --- a/sfx2/source/dialog/recfloat.cxx +++ b/sfx2/source/dialog/recfloat.cxx @@ -134,7 +134,7 @@ SfxRecordingFloatWrapper_Impl::SfxRecordingFloatWrapper_Impl( vcl::Window* pPare pWindow = new SfxRecordingFloat_Impl( pBindings, this, pParentWnd ); SetWantsFocus( false ); eChildAlignment = SFX_ALIGN_NOALIGNMENT; - ( ( SfxFloatingWindow* ) pWindow )->Initialize( pInfo ); + static_cast<SfxFloatingWindow*>(pWindow)->Initialize( pInfo ); } SfxRecordingFloatWrapper_Impl::~SfxRecordingFloatWrapper_Impl() diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx index 45db4a656934..855e9b74263f 100644 --- a/sfx2/source/dialog/templdlg.cxx +++ b/sfx2/source/dialog/templdlg.cxx @@ -1258,13 +1258,13 @@ void SfxCommonTemplateDialog_Impl::UpdateStyles_Impl(sal_uInt16 nFlags) aFilterLb.Clear(); //insert hierarchical at the beginning sal_uInt16 nPos = aFilterLb.InsertEntry(SfxResId(STR_STYLE_FILTER_HIERARCHICAL).toString(), 0); - aFilterLb.SetEntryData( nPos, (void*)(sal_uIntPtr)SFXSTYLEBIT_ALL ); + aFilterLb.SetEntryData( nPos, reinterpret_cast<void*>(SFXSTYLEBIT_ALL) ); const SfxStyleFilter& rFilter = pItem->GetFilterList(); for( size_t i = 0; i < rFilter.size(); ++i) { sal_uIntPtr nFilterFlags = rFilter[ i ]->nFlags; nPos = aFilterLb.InsertEntry( rFilter[ i ]->aName ); - aFilterLb.SetEntryData( nPos, (void*)nFilterFlags ); + aFilterLb.SetEntryData( nPos, reinterpret_cast<void*>(nFilterFlags) ); } if(nActFilter < aFilterLb.GetEntryCount() - 1) aFilterLb.SelectEntryPos(nActFilter + 1); diff --git a/sfx2/source/dialog/tplpitem.cxx b/sfx2/source/dialog/tplpitem.cxx index 19836f2a124a..c31ac82b117b 100644 --- a/sfx2/source/dialog/tplpitem.cxx +++ b/sfx2/source/dialog/tplpitem.cxx @@ -60,7 +60,7 @@ SfxTemplateItem::SfxTemplateItem( const SfxTemplateItem& rCopy ) : bool SfxTemplateItem::operator==( const SfxPoolItem& rCmp ) const { return ( SfxFlagItem::operator==( rCmp ) && - aStyle == ( (const SfxTemplateItem&)rCmp ).aStyle ); + aStyle == static_cast<const SfxTemplateItem&>(rCmp).aStyle ); } diff --git a/sfx2/source/doc/docfile.cxx b/sfx2/source/doc/docfile.cxx index e48a5cff78f6..88582457bc06 100644 --- a/sfx2/source/doc/docfile.cxx +++ b/sfx2/source/doc/docfile.cxx @@ -2348,7 +2348,7 @@ void SfxMedium::GetMedium_Impl() pImp->bDownloadDone = true; pImp->aDoneLink.ClearPendingCall(); sal_uIntPtr nError = GetError(); - pImp->aDoneLink.Call( (void*)nError ); + pImp->aDoneLink.Call( reinterpret_cast<void*>(nError) ); } } diff --git a/sfx2/source/doc/frmdescr.cxx b/sfx2/source/doc/frmdescr.cxx index 66c0329faed1..7066374169db 100644 --- a/sfx2/source/doc/frmdescr.cxx +++ b/sfx2/source/doc/frmdescr.cxx @@ -186,7 +186,7 @@ bool SfxFrameDescriptorItem::operator==( const SfxPoolItem& rAttr ) const { DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" ); - return aProperties == ((SfxFrameDescriptorItem&)rAttr).aProperties; + return aProperties == static_cast<const SfxFrameDescriptorItem&>(rAttr).aProperties; } diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index f96ae3de4fce..de61da83e613 100644 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -1202,7 +1202,7 @@ void SfxObjectShell::FinishedLoading( sal_uInt16 nFlags ) && !(pImp->nFlagsInProgress & SFX_LOADED_MAINDOCUMENT )) { pImp->nFlagsInProgress |= SFX_LOADED_MAINDOCUMENT; - ((SfxHeaderAttributes_Impl*)GetHeaderAttributes())->SetAttributes(); + static_cast<SfxHeaderAttributes_Impl*>(GetHeaderAttributes())->SetAttributes(); pImp->bImportDone = true; if( !IsAbortingImport() ) PositionView_Impl(); @@ -1669,19 +1669,19 @@ SvKeyValueIterator* SfxObjectShell::GetHeaderAttributes() DBG_ASSERT( pMedium, "No Medium" ); pImp->xHeaderAttributes = new SfxHeaderAttributes_Impl( this ); } - return ( SvKeyValueIterator*) &pImp->xHeaderAttributes; + return static_cast<SvKeyValueIterator*>( &pImp->xHeaderAttributes ); } void SfxObjectShell::ClearHeaderAttributesForSourceViewHack() { - ((SfxHeaderAttributes_Impl*)GetHeaderAttributes()) + static_cast<SfxHeaderAttributes_Impl*>(GetHeaderAttributes()) ->ClearForSourceView(); } void SfxObjectShell::SetHeaderAttributesForSourceViewHack() { - ((SfxHeaderAttributes_Impl*)GetHeaderAttributes()) + static_cast<SfxHeaderAttributes_Impl*>(GetHeaderAttributes()) ->SetAttributes(); } diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index 22779e4a051b..e5d547753695 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -1125,33 +1125,33 @@ void SfxObjectShell::ExecProps_Impl(SfxRequest &rReq) { case SID_MODIFIED: { - SetModified( ( (SfxBoolItem&) rReq.GetArgs()->Get(SID_MODIFIED)).GetValue() ); + SetModified( static_cast<const SfxBoolItem&>(rReq.GetArgs()->Get(SID_MODIFIED)).GetValue() ); rReq.Done(); break; } case SID_DOCTITLE: - SetTitle( ( (SfxStringItem&) rReq.GetArgs()->Get(SID_DOCTITLE)).GetValue() ); + SetTitle( static_cast<const SfxStringItem&>(rReq.GetArgs()->Get(SID_DOCTITLE)).GetValue() ); rReq.Done(); break; case SID_DOCINFO_AUTHOR : { - OUString aStr = ( (SfxStringItem&)rReq.GetArgs()->Get(rReq.GetSlot())).GetValue(); + OUString aStr = static_cast<const SfxStringItem&>(rReq.GetArgs()->Get(rReq.GetSlot())).GetValue(); getDocProperties()->setAuthor( aStr ); break; } case SID_DOCINFO_COMMENTS : { - OUString aStr = ( (SfxStringItem&)rReq.GetArgs()->Get(rReq.GetSlot())).GetValue(); + OUString aStr = static_cast<const SfxStringItem&>(rReq.GetArgs()->Get(rReq.GetSlot())).GetValue(); getDocProperties()->setDescription( aStr ); break; } case SID_DOCINFO_KEYWORDS : { - OUString aStr = ( (SfxStringItem&)rReq.GetArgs()->Get(rReq.GetSlot())).GetValue(); + OUString aStr = static_cast<const SfxStringItem&>(rReq.GetArgs()->Get(rReq.GetSlot())).GetValue(); getDocProperties()->setKeywords( ::comphelper::string::convertCommaSeparated(aStr) ); break; diff --git a/sfx2/source/doc/objstor.cxx b/sfx2/source/doc/objstor.cxx index a5cef0d70616..f5b7f11915d4 100644 --- a/sfx2/source/doc/objstor.cxx +++ b/sfx2/source/doc/objstor.cxx @@ -1420,8 +1420,9 @@ bool SfxObjectShell::SaveTo_Impl pFilter = rMedium.GetFilter(); - const SfxStringItem *pVersionItem = ( !rMedium.IsInCheckIn( ) && pSet ) ? (const SfxStringItem*) - SfxRequest::GetItem( pSet, SID_DOCINFO_COMMENTS, false, TYPE(SfxStringItem) ) : NULL; + const SfxStringItem *pVersionItem = ( !rMedium.IsInCheckIn( ) && pSet ) + ? static_cast<const SfxStringItem*>( SfxRequest::GetItem( pSet, SID_DOCINFO_COMMENTS, false, TYPE(SfxStringItem) ) ) + : NULL; OUString aTmpVersionURL; if ( bOk ) @@ -1509,8 +1510,9 @@ bool SfxObjectShell::SaveTo_Impl if ( bOk && pVersionItem && !rMedium.IsInCheckIn() ) { // store a version also - const SfxStringItem *pAuthorItem = pSet ? (const SfxStringItem*) - SfxRequest::GetItem( pSet, SID_DOCINFO_AUTHOR, false, TYPE(SfxStringItem) ) : NULL; + const SfxStringItem *pAuthorItem = pSet + ? static_cast<const SfxStringItem*>( SfxRequest::GetItem( pSet, SID_DOCINFO_AUTHOR, false, TYPE(SfxStringItem) ) ) + : NULL; // version comment util::RevisionTag aInfo; diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx index 2b4112bb4945..92c5a1d60e79 100644 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -664,7 +664,7 @@ bool SfxObjectShell::PrepareClose pPoolItem = pFrame->GetBindings().ExecuteSynchron( IsReadOnlyMedium() ? SID_SAVEASDOC : SID_SAVEDOC, ppArgs ); } - if ( !pPoolItem || pPoolItem->ISA(SfxVoidItem) || ( pPoolItem->ISA(SfxBoolItem) && !( (const SfxBoolItem*) pPoolItem )->GetValue() ) ) + if ( !pPoolItem || pPoolItem->ISA(SfxVoidItem) || ( pPoolItem->ISA(SfxBoolItem) && !static_cast<const SfxBoolItem*>( pPoolItem )->GetValue() ) ) return false; } else if ( RET_CANCEL == nRet ) diff --git a/sfx2/source/doc/printhelper.cxx b/sfx2/source/doc/printhelper.cxx index ab3c4049a932..56a64a56a07f 100644 --- a/sfx2/source/doc/printhelper.cxx +++ b/sfx2/source/doc/printhelper.cxx @@ -819,7 +819,7 @@ void IMPL_PrintListener_DataContainer::Notify( SfxBroadcaster& rBC, const SfxHin ::cppu::OInterfaceIteratorHelper pIterator(*pContainer); while (pIterator.hasMoreElements()) - ((view::XPrintJobListener*)pIterator.next())->printJobEvent( aEvent ); + static_cast<view::XPrintJobListener*>(pIterator.next())->printJobEvent( aEvent ); } void SAL_CALL SfxPrintHelper::addPrintJobListener( const ::com::sun::star::uno::Reference< ::com::sun::star::view::XPrintJobListener >& xListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index e6fcb91053d5..743f42792b94 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -338,7 +338,7 @@ void SAL_CALL SfxPrintHelperListener_Impl::printJobEvent( const view::PrintJobEv { ::cppu::OInterfaceIteratorHelper pIterator(*pContainer); while (pIterator.hasMoreElements()) - ((view::XPrintJobListener*)pIterator.next())->printJobEvent( rEvent ); + static_cast<view::XPrintJobListener*>(pIterator.next())->printJobEvent( rEvent ); } } @@ -1374,7 +1374,7 @@ void SAL_CALL SfxBaseModel::close( sal_Bool bDeliverOwnership ) throw (util::Clo { try { - ((util::XCloseListener*)pIterator.next())->queryClosing( aSource, bDeliverOwnership ); + static_cast<util::XCloseListener*>(pIterator.next())->queryClosing( aSource, bDeliverOwnership ); } catch( RuntimeException& ) { @@ -1402,7 +1402,7 @@ void SAL_CALL SfxBaseModel::close( sal_Bool bDeliverOwnership ) throw (util::Clo { try { - ((util::XCloseListener*)pCloseIterator.next())->notifyClosing( aSource ); + static_cast<util::XCloseListener*>(pCloseIterator.next())->notifyClosing( aSource ); } catch( RuntimeException& ) { @@ -3270,7 +3270,7 @@ void SfxBaseModel::notifyEvent( const document::EventObject& aEvent ) const { try { - ((document::XEventListener *)aIt.next())->notifyEvent( aEvent ); + static_cast<document::XEventListener *>(aIt.next())->notifyEvent( aEvent ); } catch( RuntimeException& ) { @@ -3326,9 +3326,9 @@ sal_Int64 SAL_CALL SfxBaseModel::getSomething( const Sequence< sal_Int8 >& aIden { // SO3_GLOBAL_CLASSID is apparently used by binfilter :( if ( aName == SvGlobalName( SO3_GLOBAL_CLASSID ) ) - return (sal_Int64)(sal_IntPtr)(SvObject*) pObjectShell; + return reinterpret_cast<sal_Int64>((SvObject*) pObjectShell); else if ( aName == SvGlobalName( SFX_GLOBAL_CLASSID ) ) - return (sal_Int64)(sal_IntPtr)(SfxObjectShell*) pObjectShell; + return reinterpret_cast<sal_Int64>((SfxObjectShell*) pObjectShell); } } diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx index ba10d497e736..fd3fa77df054 100644 --- a/sfx2/source/doc/templatedlg.cxx +++ b/sfx2/source/doc/templatedlg.cxx @@ -916,7 +916,7 @@ void SfxTemplateManagerDlg::OnTemplateImport () for (pIter = maSelFolders.begin(); pIter != maSelFolders.end(); ++pIter) { OUString aTemplateList; - TemplateContainerItem *pFolder = (TemplateContainerItem*)(*pIter); + TemplateContainerItem *pFolder = const_cast<TemplateContainerItem*>(static_cast<const TemplateContainerItem*>(*pIter)); for (size_t i = 0, n = aFiles.getLength(); i < n; ++i) { @@ -1329,7 +1329,7 @@ void SfxTemplateManagerDlg::OnTemplateSaveAs() std::set<const ThumbnailViewItem*,selection_cmp_fn>::const_iterator pIter; for (pIter = maSelFolders.begin(); pIter != maSelFolders.end(); ++pIter) { - TemplateContainerItem *pItem = (TemplateContainerItem*)(*pIter); + TemplateContainerItem *pItem = const_cast<TemplateContainerItem*>(static_cast<const TemplateContainerItem*>(*pIter)); if (!mpLocalView->isTemplateNameUnique(pItem->mnId,aName)) { diff --git a/sfx2/source/doc/zoomitem.cxx b/sfx2/source/doc/zoomitem.cxx index 96bba6f39aac..c776698c00c8 100644 --- a/sfx2/source/doc/zoomitem.cxx +++ b/sfx2/source/doc/zoomitem.cxx @@ -98,7 +98,7 @@ bool SvxZoomItem::operator==( const SfxPoolItem& rAttr ) const { DBG_ASSERT( SfxPoolItem::operator==(rAttr), "unequal types" ); - SvxZoomItem& rItem = (SvxZoomItem&)rAttr; + const SvxZoomItem& rItem = static_cast<const SvxZoomItem&>(rAttr); return ( GetValue() == rItem.GetValue() && nValueSet == rItem.GetValueSet() && diff --git a/sfx2/source/inet/inettbc.cxx b/sfx2/source/inet/inettbc.cxx index 9c22a053a5ce..92249fa8adbb 100644 --- a/sfx2/source/inet/inettbc.cxx +++ b/sfx2/source/inet/inettbc.cxx @@ -73,7 +73,7 @@ SfxURLToolBoxControl_Impl::~SfxURLToolBoxControl_Impl() SvtURLBox* SfxURLToolBoxControl_Impl::GetURLBox() const { - return (SvtURLBox*)GetToolBox().GetItemWindow( GetId() ); + return static_cast<SvtURLBox*>(GetToolBox().GetItemWindow( GetId() )); } diff --git a/sfx2/source/menu/mnuitem.cxx b/sfx2/source/menu/mnuitem.cxx index 69799c96c55e..838d1298c370 100644 --- a/sfx2/source/menu/mnuitem.cxx +++ b/sfx2/source/menu/mnuitem.cxx @@ -199,24 +199,24 @@ void SfxMenuControl::StateChanged // BoolItem for check DBG_ASSERT( GetId() < SID_OBJECTMENU0 || GetId() > SID_OBJECTMENU_LAST, "SfxBoolItem not allowed for SID_OBJECTMENUx" ); - bCheck = ((const SfxBoolItem*)pState)->GetValue(); + bCheck = static_cast<const SfxBoolItem*>(pState)->GetValue(); Menu* pMenu = pOwnMenu->GetSVMenu(); pMenu->SetItemBits( GetId() , pMenu->GetItemBits( GetId() ) | MIB_CHECKABLE); } else if ( pState->ISA(SfxEnumItemInterface) && - ((SfxEnumItemInterface *)pState)->HasBoolValue() ) + static_cast<const SfxEnumItemInterface *>(pState)->HasBoolValue() ) { // Treat EnumItem as Bool DBG_ASSERT( GetId() < SID_OBJECTMENU0 || GetId() > SID_OBJECTMENU_LAST, "SfxEnumItem not allowed for SID_OBJECTMENUx" ); - bCheck = ((SfxEnumItemInterface *)pState)->GetBoolValue(); + bCheck = static_cast<const SfxEnumItemInterface *>(pState)->GetBoolValue(); Menu* pMenu = pOwnMenu->GetSVMenu(); pMenu->SetItemBits( GetId() , pMenu->GetItemBits( GetId() ) | MIB_CHECKABLE); } else if ( ( b_ShowStrings || bIsObjMenu ) && pState->ISA(SfxStringItem) ) { // Get MenuText from SfxStringItem - OUString aStr( ((const SfxStringItem*)pState)->GetValue() ); + OUString aStr( static_cast<const SfxStringItem*>(pState)->GetValue() ); if ( aStr.startsWith("($1)") ) { OUString aEntry(SfxResId(STR_UPDATEDOC).toString()); @@ -294,7 +294,7 @@ SfxMenuControl* SfxMenuControl::CreateControl( sal_uInt16 nId, Menu &rMenu, SfxB PopupMenu* SfxMenuControl::GetPopup () const { if (GetPopupMenu()) - return (PopupMenu*)GetPopupMenu()->GetSVMenu(); + return static_cast<PopupMenu*>(GetPopupMenu()->GetSVMenu()); else return 0; } @@ -353,7 +353,7 @@ IMPL_LINK( SfxAppMenuControl_Impl, Activate, Menu *, pActMenu ) bool bImageSet = false; OUString aImageId; ::framework::MenuConfiguration::Attributes* pMenuAttributes = - (::framework::MenuConfiguration::Attributes*)pMenu->GetUserValue( nItemId ); + reinterpret_cast< ::framework::MenuConfiguration::Attributes*>(pMenu->GetUserValue( nItemId )); if ( pMenuAttributes ) aImageId = pMenuAttributes->aImageId; // Retrieve image id from menu attributes @@ -439,7 +439,7 @@ long Select_Impl( void* /*pHdl*/, void* pVoid ) { OUString aTargetFrame( "_blank" ); ::framework::MenuConfiguration::Attributes* pMenuAttributes = - (::framework::MenuConfiguration::Attributes*)pMenu->GetUserValue( pMenu->GetCurItemId() ); + reinterpret_cast< ::framework::MenuConfiguration::Attributes*>(pMenu->GetUserValue( pMenu->GetCurItemId() )); if ( pMenuAttributes ) aTargetFrame = pMenuAttributes->aTargetFrame; diff --git a/sfx2/source/menu/mnumgr.cxx b/sfx2/source/menu/mnumgr.cxx index 55eb9884c7b3..6ff82a83a061 100644 --- a/sfx2/source/menu/mnumgr.cxx +++ b/sfx2/source/menu/mnumgr.cxx @@ -254,7 +254,7 @@ void SfxPopupMenuManager::RemoveDisabledEntries() sal_uInt16 SfxPopupMenuManager::Execute( const Point& rPos, vcl::Window* pWindow ) { - sal_uInt16 nVal = ( (PopupMenu*) GetMenu()->GetSVMenu() )->Execute( pWindow, rPos ); + sal_uInt16 nVal = static_cast<PopupMenu*>( GetMenu()->GetSVMenu() )->Execute( pWindow, rPos ); delete pStaticThesSubMenu; pStaticThesSubMenu = NULL; return nVal; } @@ -319,7 +319,7 @@ SfxPopupMenuManager* SfxPopupMenuManager::Popup( const ResId& rResId, SfxViewFra if ( pMenu ) { delete pSVMenu; - pSVMenu = (PopupMenu*) pMenu; + pSVMenu = static_cast<PopupMenu*>( pMenu ); } SfxPopupMenuManager* aMgr = new SfxPopupMenuManager( pSVMenu, pFrame->GetBindings()); @@ -369,7 +369,7 @@ void SfxPopupMenuManager::ExecutePopup( const ResId& rResId, SfxViewFrame* pFram if ( pMenu ) { delete pSVMenu; - pSVMenu = (PopupMenu*) pMenu; + pSVMenu = static_cast<PopupMenu*>( pMenu ); } SfxPopupMenuManager aPop( pSVMenu, pFrame->GetBindings() ); diff --git a/sfx2/source/menu/virtmenu.cxx b/sfx2/source/menu/virtmenu.cxx index 4c46417c7338..bd81d699a48c 100644 --- a/sfx2/source/menu/virtmenu.cxx +++ b/sfx2/source/menu/virtmenu.cxx @@ -295,12 +295,12 @@ void SfxVirtualMenu::CreateFromSVMenu() if ( nPos != MENU_ITEM_NOTFOUND && xFrame.is() ) { // Retrieve addon popup menus and add them to our menu bar - framework::AddonMenuManager::MergeAddonPopupMenus( xFrame, nPos, (MenuBar *)pSVMenu, xContext ); + framework::AddonMenuManager::MergeAddonPopupMenus( xFrame, nPos, static_cast<MenuBar *>(pSVMenu), xContext ); } // Merge the Add-Ons help menu items into the Office help menu if ( xFrame.is() ) - framework::AddonMenuManager::MergeAddonHelpMenu( xFrame, (MenuBar *)pSVMenu, xContext ); + framework::AddonMenuManager::MergeAddonHelpMenu( xFrame, static_cast<MenuBar *>(pSVMenu), xContext ); // Set addon menu pointer here to avoid problems. When accessibility is enabled, the whole menu // is created immediately! @@ -440,7 +440,7 @@ void SfxVirtualMenu::CreateFromSVMenu() OUString aImageId; ::framework::MenuConfiguration::Attributes* pMenuAttributes = - (::framework::MenuConfiguration::Attributes*)pSVMenu->GetUserValue( nSlotId ); + reinterpret_cast< ::framework::MenuConfiguration::Attributes*>(pSVMenu->GetUserValue( nSlotId )); if ( pMenuAttributes ) aImageId = pMenuAttributes->aImageId; // Retrieve image id from menu attributes @@ -512,7 +512,7 @@ IMPL_LINK_NOARG(SfxVirtualMenu, SettingsChanged) OUString aImageId; ::framework::MenuConfiguration::Attributes* pMenuAttributes = - (::framework::MenuConfiguration::Attributes*)pSVMenu->GetUserValue( nSlotId ); + reinterpret_cast< ::framework::MenuConfiguration::Attributes*>(pSVMenu->GetUserValue( nSlotId )); if ( pMenuAttributes ) aImageId = pMenuAttributes->aImageId; // Retrieve image id from menu attributes @@ -580,7 +580,7 @@ void SfxVirtualMenu::UpdateImages( Menu* pMenu ) OUString aImageId; ::framework::MenuConfiguration::Attributes* pMenuAttributes = - (::framework::MenuConfiguration::Attributes*)pMenu->GetUserValue( nSlotId ); + reinterpret_cast< ::framework::MenuConfiguration::Attributes*>(pMenu->GetUserValue( nSlotId )); if ( pMenuAttributes ) aImageId = pMenuAttributes->aImageId; // Retrieve image id from menu attributes diff --git a/sfx2/source/toolbox/tbxitem.cxx b/sfx2/source/toolbox/tbxitem.cxx index d0486dbbda6c..9544b388f677 100644 --- a/sfx2/source/toolbox/tbxitem.cxx +++ b/sfx2/source/toolbox/tbxitem.cxx @@ -119,7 +119,7 @@ static vcl::Window* GetTopMostParentSystemWindow( vcl::Window* pWindow ) while ( pWindow ) { if ( pWindow->IsSystemWindow() ) - pTopMostSysWin = (SystemWindow*)pWindow; + pTopMostSysWin = static_cast<SystemWindow*>(pWindow); pWindow = pWindow->GetParent(); } pWindow = pTopMostSysWin; @@ -204,7 +204,7 @@ IMPL_LINK( SfxToolBoxControl_Impl, WindowEventListener, VclSimpleEvent*, pEvent (( pEvent->GetId() == VCLEVENT_WINDOW_MOVE ) || ( pEvent->GetId() == VCLEVENT_WINDOW_ACTIVATE ))) { - vcl::Window* pWindow( ((VclWindowEvent*)pEvent)->GetWindow() ); + vcl::Window* pWindow( static_cast<VclWindowEvent*>(pEvent)->GetWindow() ); if (( pWindow == mpFloatingWindow ) && ( mpPopupWindow != 0 )) { @@ -826,7 +826,7 @@ void SfxToolBoxControl::createAndPositionSubToolBar( const OUString& rSubToolBar vcl::Window* pTbxWindow = VCLUnoHelper::GetWindow( xSubToolBar ); ToolBox* pToolBar( 0 ); if ( pTbxWindow && pTbxWindow->GetType() == WINDOW_TOOLBOX ) - pToolBar = (ToolBox *)pTbxWindow; + pToolBar = static_cast<ToolBox *>(pTbxWindow); if ( pToolBar ) { @@ -921,20 +921,20 @@ void SfxToolBoxControl::StateChanged if ( pState->ISA(SfxBoolItem) ) { // BoolItem for checking - if ( ((const SfxBoolItem*)pState)->GetValue() ) + if ( static_cast<const SfxBoolItem*>(pState)->GetValue() ) eTri = TRISTATE_TRUE; nItemBits |= TIB_CHECKABLE; } else if ( pState->ISA(SfxEnumItemInterface) && - ((SfxEnumItemInterface *)pState)->HasBoolValue()) + static_cast<const SfxEnumItemInterface *>(pState)->HasBoolValue()) { // EnumItem is handled as Bool - if ( ((const SfxEnumItemInterface *)pState)->GetBoolValue() ) + if ( static_cast<const SfxEnumItemInterface *>(pState)->GetBoolValue() ) eTri = TRISTATE_TRUE; nItemBits |= TIB_CHECKABLE; } else if ( pImpl->bShowString && pState->ISA(SfxStringItem) ) - pImpl->pBox->SetItemText(nId, ((const SfxStringItem*)pState)->GetValue() ); + pImpl->pBox->SetItemText(nId, static_cast<const SfxStringItem*>(pState)->GetValue() ); } break; @@ -1150,7 +1150,7 @@ SfxPopupWindow::SfxPopupWindow( { vcl::Window* pWindow = GetTopMostParentSystemWindow( this ); if ( pWindow ) - ((SystemWindow *)pWindow)->GetTaskPaneList()->AddWindow( this ); + static_cast<SystemWindow *>(pWindow)->GetTaskPaneList()->AddWindow( this ); } SfxPopupWindow::SfxPopupWindow(sal_uInt16 nId, const OString& rID, const OUString& rUIXMLDescription, @@ -1164,7 +1164,7 @@ SfxPopupWindow::SfxPopupWindow(sal_uInt16 nId, const OString& rID, const OUStrin { vcl::Window* pWindow = GetTopMostParentSystemWindow( this ); if ( pWindow ) - ((SystemWindow *)pWindow)->GetTaskPaneList()->AddWindow( this ); + static_cast<SystemWindow *>(pWindow)->GetTaskPaneList()->AddWindow( this ); } SfxPopupWindow::SfxPopupWindow( @@ -1181,7 +1181,7 @@ SfxPopupWindow::SfxPopupWindow( { vcl::Window* pWindow = GetTopMostParentSystemWindow( this ); if ( pWindow ) - ((SystemWindow *)pWindow)->GetTaskPaneList()->AddWindow( this ); + static_cast<SystemWindow *>(pWindow)->GetTaskPaneList()->AddWindow( this ); } SfxPopupWindow::SfxPopupWindow( @@ -1198,7 +1198,7 @@ SfxPopupWindow::SfxPopupWindow( { vcl::Window* pWindow = GetTopMostParentSystemWindow( this ); if ( pWindow ) - ((SystemWindow *)pWindow)->GetTaskPaneList()->AddWindow( this ); + static_cast<SystemWindow *>(pWindow)->GetTaskPaneList()->AddWindow( this ); } SfxPopupWindow::~SfxPopupWindow() @@ -1211,7 +1211,7 @@ SfxPopupWindow::~SfxPopupWindow() vcl::Window* pWindow = GetTopMostParentSystemWindow( this ); if ( pWindow ) - ((SystemWindow *)pWindow)->GetTaskPaneList()->RemoveWindow( this ); + static_cast<SystemWindow *>(pWindow)->GetTaskPaneList()->RemoveWindow( this ); } diff --git a/sfx2/source/view/frame.cxx b/sfx2/source/view/frame.cxx index 2fd824cc147e..054abf843993 100644 --- a/sfx2/source/view/frame.cxx +++ b/sfx2/source/view/frame.cxx @@ -544,8 +544,8 @@ SfxFrameItem::SfxFrameItem( SfxFrame *p ): bool SfxFrameItem::operator==( const SfxPoolItem &rItem ) const { - return ((SfxFrameItem&)rItem).pFrame == pFrame && - ((SfxFrameItem&)rItem).wFrame == wFrame; + return static_cast<const SfxFrameItem&>(rItem).pFrame == pFrame && + static_cast<const SfxFrameItem&>(rItem).wFrame == wFrame; } diff --git a/sfx2/source/view/frame2.cxx b/sfx2/source/view/frame2.cxx index 4a9cb220a4f1..5701c33ed695 100644 --- a/sfx2/source/view/frame2.cxx +++ b/sfx2/source/view/frame2.cxx @@ -349,7 +349,7 @@ SystemWindow* SfxFrame::GetSystemWindow() const SystemWindow* SfxFrame::GetTopWindow_Impl() const { if ( pImp->pExternalContainerWindow->IsSystemWindow() ) - return (SystemWindow*) pImp->pExternalContainerWindow; + return static_cast<SystemWindow*>( pImp->pExternalContainerWindow ); else return NULL; } diff --git a/sfx2/source/view/sfxbasecontroller.cxx b/sfx2/source/view/sfxbasecontroller.cxx index f62610a79ee0..0d08a0d5ea30 100644 --- a/sfx2/source/view/sfxbasecontroller.cxx +++ b/sfx2/source/view/sfxbasecontroller.cxx @@ -951,7 +951,7 @@ void SfxBaseController::BorderWidthsChanged_Impl() { try { - ((frame::XBorderResizeListener*)pIterator.next())->borderWidthsChanged( xThis, aBWidths ); + static_cast<frame::XBorderResizeListener*>(pIterator.next())->borderWidthsChanged( xThis, aBWidths ); } catch (const RuntimeException&) { diff --git a/sfx2/source/view/viewfrm.cxx b/sfx2/source/view/viewfrm.cxx index e4e44d166bde..0dac4a7f7d0c 100644 --- a/sfx2/source/view/viewfrm.cxx +++ b/sfx2/source/view/viewfrm.cxx @@ -251,7 +251,7 @@ void SfxViewNotificatedFrameList_Impl::Notify( SfxBroadcaster& rBC, const SfxHin switch( pSimpleHint->GetId() ) { case SFX_HINT_DYING: - SfxViewFrame* pFrame = (SfxViewFrame*) &rBC; + SfxViewFrame* pFrame = dynamic_cast<SfxViewFrame*>(&rBC); if( pFrame ) { iterator it = std::find( begin(), end(), pFrame ); @@ -964,7 +964,7 @@ void SfxViewFrame::ExecHistory_Impl( SfxRequest &rReq ) // The SW has its own undo in the View const SfxPoolItem *pRet = GetViewShell()->ExecuteSlot( rReq ); if ( pRet ) - bOK = ((SfxBoolItem*)pRet)->GetValue(); + bOK = static_cast<const SfxBoolItem*>(pRet)->GetValue(); } rReq.SetReturnValue( SfxBoolItem( rReq.GetSlot(), bOK ) ); @@ -2608,7 +2608,7 @@ void SfxViewFrame::AddDispatchMacroToBasic_Impl( const OUString& sMacro ) const SfxPoolItem* pRet = SfxGetpApp()->ExecuteSlot( aReq ); OUString aScriptURL; if ( pRet ) - aScriptURL = ((SfxStringItem*)pRet)->GetValue(); + aScriptURL = static_cast<const SfxStringItem*>(pRet)->GetValue(); if ( !aScriptURL.isEmpty() ) { // parse scriptURL @@ -2658,7 +2658,7 @@ void SfxViewFrame::AddDispatchMacroToBasic_Impl( const OUString& sMacro ) SbModule* pModule = pBasic->FindModule( aModuleName ); if ( pModule ) { - SbMethod* pMethod = (SbMethod*)pModule->GetMethods()->Find( aMacroName, SbxCLASS_METHOD ); + SbMethod* pMethod = static_cast<SbMethod*>(pModule->GetMethods()->Find( aMacroName, SbxCLASS_METHOD )); aOUSource = pModule->GetSource32(); sal_uInt16 nStart, nEnd; pMethod->GetLineRange( nStart, nEnd ); @@ -2898,7 +2898,7 @@ void SfxViewFrame::MiscExec_Impl( SfxRequest& rReq ) SfxViewFrame *pTop = GetTopViewFrame(); if ( pTop ) { - WorkWindow* pWork = (WorkWindow*) pTop->GetFrame().GetTopWindow_Impl(); + WorkWindow* pWork = static_cast<WorkWindow*>( pTop->GetFrame().GetTopWindow_Impl() ); if ( pWork ) { com::sun::star::uno::Reference< com::sun::star::frame::XFrame > xFrame( @@ -3049,7 +3049,7 @@ void SfxViewFrame::MiscState_Impl(SfxItemSet &rSet) SfxViewFrame* pTop = GetTopViewFrame(); if ( pTop ) { - WorkWindow* pWork = (WorkWindow*) pTop->GetFrame().GetTopWindow_Impl(); + WorkWindow* pWork = static_cast<WorkWindow*>( pTop->GetFrame().GetTopWindow_Impl() ); if ( pWork ) { rSet.Put( SfxBoolItem( nWhich, pWork->IsFullScreenMode() ) ); @@ -3358,7 +3358,7 @@ void SfxViewFrame::AppendInfoBar( const OUString& sId, const OUString& sMessage, SfxChildWindow* pChild = GetChildWindow( nId ); if ( pChild ) { - SfxInfoBarContainerWindow* pInfoBars = ( SfxInfoBarContainerWindow* )pChild->GetWindow(); + SfxInfoBarContainerWindow* pInfoBars = static_cast<SfxInfoBarContainerWindow*>( pChild->GetWindow() ); pInfoBars->appendInfoBar( sId, sMessage, aButtons ); ShowChildWindow( nId ); } @@ -3382,7 +3382,7 @@ void SfxViewFrame::RemoveInfoBar( const OUString& sId ) SfxChildWindow* pChild = GetChildWindow( nId ); if ( pChild ) { - SfxInfoBarContainerWindow* pInfoBars = ( SfxInfoBarContainerWindow* )pChild->GetWindow(); + SfxInfoBarContainerWindow* pInfoBars = static_cast<SfxInfoBarContainerWindow*>( pChild->GetWindow() ); SfxInfoBarWindow* pInfoBar = pInfoBars->getInfoBar( sId ); pInfoBars->removeInfoBar( pInfoBar ); ShowChildWindow( nId ); diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx index 9ae83cda38a0..5dbdc3b0ffc4 100644 --- a/sfx2/source/view/viewprn.cxx +++ b/sfx2/source/view/viewprn.cxx @@ -445,7 +445,7 @@ IMPL_LINK_NOARG(SfxDialogExecutor_Impl, Execute) { DBG_ASSERT( _pSetupParent, "no dialog parent" ); if( _pSetupParent ) - _pOptions = ( (SfxPrinter*)_pSetupParent->GetPrinter() )->GetOptions().Clone(); + _pOptions = static_cast<SfxPrinter*>( _pSetupParent->GetPrinter() )->GetOptions().Clone(); } assert(_pOptions); diff --git a/sfx2/source/view/viewsh.cxx b/sfx2/source/view/viewsh.cxx index 6151d72da919..35b947e5ee81 100644 --- a/sfx2/source/view/viewsh.cxx +++ b/sfx2/source/view/viewsh.cxx @@ -1980,7 +1980,7 @@ bool SfxViewShell::TryContextMenuInterception( Menu& rIn, const OUString& rMenuI try { ui::ContextMenuInterceptorAction eAction = - ((ui::XContextMenuInterceptor*)aIt.next())->notifyContextMenuExecute( aEvent ); + static_cast<ui::XContextMenuInterceptor*>(aIt.next())->notifyContextMenuExecute( aEvent ); switch ( eAction ) { case ui::ContextMenuInterceptorAction_CANCELLED : |