diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2015-03-26 15:30:40 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2015-03-26 15:33:35 +0100 |
commit | 1a9e23609b56f2c45d7fbdf32d9f8a43bc3908ea (patch) | |
tree | 10a7e9e62eb6e1d0e153fed6471e1ca5b2e0af17 | |
parent | 8571707e5e7988c8a10e7578c8f56409f0adb2d5 (diff) |
const_cast: convert some C-style casts and remove some redundant ones
Change-Id: Iad769ac61d17f6e348681a38ae11c832f75f6353
-rw-r--r-- | sd/source/core/drawdoc.cxx | 4 | ||||
-rw-r--r-- | sd/source/core/sdpage.cxx | 2 | ||||
-rw-r--r-- | sd/source/core/sdpage2.cxx | 4 | ||||
-rw-r--r-- | sd/source/filter/html/htmlex.cxx | 2 | ||||
-rw-r--r-- | sd/source/filter/ppt/pptin.cxx | 6 | ||||
-rw-r--r-- | sd/source/ui/app/optsitem.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/app/sdxfer.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/dlg/custsdlg.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/dlg/inspagob.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/dlg/navigatr.cxx | 4 | ||||
-rw-r--r-- | sd/source/ui/dlg/sdtreelb.cxx | 4 | ||||
-rw-r--r-- | sd/source/ui/docshell/docshell.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/func/futhes.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/inc/sdxfer.hxx | 2 | ||||
-rw-r--r-- | sd/source/ui/slideshow/slideshowimpl.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/view/drtxtob1.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/view/drviewsc.cxx | 2 | ||||
-rw-r--r-- | sd/source/ui/view/sdview2.cxx | 4 | ||||
-rw-r--r-- | sd/source/ui/view/sdview3.cxx | 8 |
19 files changed, 29 insertions, 29 deletions
diff --git a/sd/source/core/drawdoc.cxx b/sd/source/core/drawdoc.cxx index 0cf966ee201d..877eeb89e9c7 100644 --- a/sd/source/core/drawdoc.cxx +++ b/sd/source/core/drawdoc.cxx @@ -473,7 +473,7 @@ SdDrawDocument* SdDrawDocument::AllocSdDrawDocument() const for (sal_uInt16 i = 0; i < GetMasterSdPageCount(PK_STANDARD); i++) { // Move with all of the master page's layouts - OUString aOldLayoutName(((SdDrawDocument*) this)->GetMasterSdPage(i, PK_STANDARD)->GetLayoutName()); + OUString aOldLayoutName(const_cast<SdDrawDocument*>(this)->GetMasterSdPage(i, PK_STANDARD)->GetLayoutName()); aOldLayoutName = aOldLayoutName.copy( 0, aOldLayoutName.indexOf( SD_LT_SEPARATOR ) ); SdStyleSheetVector aCreatedSheets; pNewStylePool->CopyLayoutSheets(aOldLayoutName, *pOldStylePool, aCreatedSheets ); @@ -484,7 +484,7 @@ SdDrawDocument* SdDrawDocument::AllocSdDrawDocument() const else if( mbAllocDocSh ) { // Create a DocShell which is then returned with GetAllocedDocSh() - SdDrawDocument* pDoc = (SdDrawDocument*) this; + SdDrawDocument* pDoc = const_cast<SdDrawDocument*>(this); pDoc->SetAllocDocSh(false); pDoc->mxAllocedDocShRef = new ::sd::DrawDocShell( SFX_CREATE_MODE_EMBEDDED, true, meDocType); diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx index c04884f3ba23..faf30f3418e3 100644 --- a/sd/source/core/sdpage.cxx +++ b/sd/source/core/sdpage.cxx @@ -698,7 +698,7 @@ void SdPage::Changed(const SdrObject& rObj, SdrUserCallType eType, const Rectang if (!pModel || pModel->isLocked()) break; - SdrObject* pObj = (SdrObject*) &rObj; + SdrObject* pObj = const_cast<SdrObject*>(&rObj); if (pObj) { diff --git a/sd/source/core/sdpage2.cxx b/sd/source/core/sdpage2.cxx index b5fcdb47ad10..cd02cdea2c48 100644 --- a/sd/source/core/sdpage2.cxx +++ b/sd/source/core/sdpage2.cxx @@ -465,10 +465,10 @@ SdrPage* SdPage::Clone(SdrModel* pNewModel) const SfxStyleSheet* SdPage::GetTextStyleSheetForObject( SdrObject* pObj ) const { - const PresObjKind eKind = ((SdPage*)this)->GetPresObjKind(pObj); + const PresObjKind eKind = GetPresObjKind(pObj); if( eKind != PRESOBJ_NONE ) { - return ((SdPage*)this)->GetStyleSheetForPresObj(eKind); + return GetStyleSheetForPresObj(eKind); } return FmFormPage::GetTextStyleSheetForObject( pObj ); diff --git a/sd/source/filter/html/htmlex.cxx b/sd/source/filter/html/htmlex.cxx index 83e8ddb196d3..025249bb31d4 100644 --- a/sd/source/filter/html/htmlex.cxx +++ b/sd/source/filter/html/htmlex.cxx @@ -1413,7 +1413,7 @@ OUString HtmlExport::ParagraphToHTMLString( SdrOutliner* pOutliner, sal_Int32 nP return OUString(); // TODO: MALTE!!! - EditEngine& rEditEngine = *(EditEngine*)&pOutliner->GetEditEngine(); + EditEngine& rEditEngine = *const_cast<EditEngine*>(&pOutliner->GetEditEngine()); bool bOldUpdateMode = rEditEngine.GetUpdateMode(); rEditEngine.SetUpdateMode(true); diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx index ce15ed3b0381..17a37fe15699 100644 --- a/sd/source/filter/ppt/pptin.cxx +++ b/sd/source/filter/ppt/pptin.cxx @@ -110,7 +110,7 @@ SdPPTImport::SdPPTImport( SdDrawDocument* pDocument, SvStream& rDocStream, SvSto { 0xe0, 0x85, 0x9f, 0xf2, 0xf9, 0x4f, 0x68, 0x10, 0xab, 0x91, 0x08, 0x00, 0x2b, 0x27, 0xb3, 0xd9 }; - Section* pSection = (Section*)pSummaryInformation->GetSection( aPropSetGUID ); + Section* pSection = const_cast<Section*>(pSummaryInformation->GetSection( aPropSetGUID )); if ( pSection ) { PropItem aPropItem; @@ -265,7 +265,7 @@ bool ImplSdPPTImport::Import() { 0x02, 0xd5, 0xcd, 0xd5, 0x9c, 0x2e, 0x1b, 0x10, 0x93, 0x97, 0x08, 0x00, 0x2b, 0x2c, 0xf9, 0xae }; - Section* pSection = (Section*)pDInfoSec2->GetSection( aPropSetGUID ); + Section* pSection = const_cast<Section*>(pDInfoSec2->GetSection( aPropSetGUID )); if ( pSection ) { if ( pSection->GetProperty( PID_SLIDECOUNT, aPropItem ) ) @@ -347,7 +347,7 @@ bool ImplSdPPTImport::Import() { 0x05, 0xd5, 0xcd, 0xd5, 0x9c, 0x2e, 0x1b, 0x10, 0x93, 0x97, 0x08, 0x00, 0x2b, 0x2c, 0xf9, 0xae }; - pSection = (Section*)pDInfoSec2->GetSection( aUserPropSetGUID ); + pSection = const_cast<Section*>(pDInfoSec2->GetSection( aUserPropSetGUID )); if ( pSection ) { Dictionary aDict; diff --git a/sd/source/ui/app/optsitem.cxx b/sd/source/ui/app/optsitem.cxx index 95b303a11ed6..fdee1af5a3d2 100644 --- a/sd/source/ui/app/optsitem.cxx +++ b/sd/source/ui/app/optsitem.cxx @@ -126,7 +126,7 @@ void SdOptionsGeneric::Commit( SdOptionsItem& rCfgItem ) const if( aNames.getLength() && ( aValues.getLength() == aNames.getLength() ) ) { - if( (const_cast<SdOptionsGeneric*>(this))->WriteData( aValues.getArray() ) ) + if( WriteData( aValues.getArray() ) ) rCfgItem.PutProperties( aNames, aValues ); else { diff --git a/sd/source/ui/app/sdxfer.cxx b/sd/source/ui/app/sdxfer.cxx index 9aa0b42344cf..ac6c4f7ef298 100644 --- a/sd/source/ui/app/sdxfer.cxx +++ b/sd/source/ui/app/sdxfer.cxx @@ -658,7 +658,7 @@ bool SdTransferable::WriteObject( SotStorageStreamRef& rxOStm, void* pObject, So void SdTransferable::DragFinished( sal_Int8 nDropAction ) { if( mpSdView ) - ( (::sd::View*) mpSdView )->DragFinished( nDropAction ); + const_cast<::sd::View*>(mpSdView)->DragFinished( nDropAction ); } void SdTransferable::ObjectReleased() diff --git a/sd/source/ui/dlg/custsdlg.cxx b/sd/source/ui/dlg/custsdlg.cxx index 91e46b5fd039..6e996ddcdfa5 100644 --- a/sd/source/ui/dlg/custsdlg.cxx +++ b/sd/source/ui/dlg/custsdlg.cxx @@ -316,7 +316,7 @@ SdDefineCustomShowDlg::SdDefineCustomShowDlg( vcl::Window* pWindow, it != rpCustomShow->PagesVector().end(); ++it ) { SvTreeListEntry* pEntry = m_pLbCustomPages->InsertEntry( (*it)->GetName() ); - pEntry->SetUserData( (SdPage*) (*it) ); + pEntry->SetUserData( const_cast<SdPage*>(*it) ); } } else diff --git a/sd/source/ui/dlg/inspagob.cxx b/sd/source/ui/dlg/inspagob.cxx index 473c9d4018de..5593562947c1 100644 --- a/sd/source/ui/dlg/inspagob.cxx +++ b/sd/source/ui/dlg/inspagob.cxx @@ -42,7 +42,7 @@ SdInsertPagesObjsDlg::SdInsertPagesObjsDlg( m_pLbTree->set_width_request(m_pLbTree->approximate_char_width() * 50); m_pLbTree->set_height_request(m_pLbTree->GetTextHeight() * 12); - m_pLbTree->SetViewFrame( ( (SdDrawDocument*) pInDoc )->GetDocSh()->GetViewShell()->GetViewFrame() ); + m_pLbTree->SetViewFrame( pInDoc->GetDocSh()->GetViewShell()->GetViewFrame() ); m_pLbTree->SetSelectHdl( LINK( this, SdInsertPagesObjsDlg, SelectObjectHdl ) ); diff --git a/sd/source/ui/dlg/navigatr.cxx b/sd/source/ui/dlg/navigatr.cxx index 0f12f3018010..c1bf56d1e661 100644 --- a/sd/source/ui/dlg/navigatr.cxx +++ b/sd/source/ui/dlg/navigatr.cxx @@ -159,7 +159,7 @@ SdNavigatorWin::~SdNavigatorWin() //when object is marked , fresh the corresponding entry tree . void SdNavigatorWin::FreshTree( const SdDrawDocument* pDoc ) { - SdDrawDocument* pNonConstDoc = (SdDrawDocument*) pDoc; // const as const can... + SdDrawDocument* pNonConstDoc = const_cast<SdDrawDocument*>(pDoc); // const as const can... sd::DrawDocShell* pDocShell = pNonConstDoc->GetDocSh(); OUString aDocShName( pDocShell->GetName() ); OUString aDocName = pDocShell->GetMedium()->GetName(); @@ -178,7 +178,7 @@ void SdNavigatorWin::FreshEntry( ) void SdNavigatorWin::InitTreeLB( const SdDrawDocument* pDoc ) { - SdDrawDocument* pNonConstDoc = (SdDrawDocument*) pDoc; // const as const can... + SdDrawDocument* pNonConstDoc = const_cast<SdDrawDocument*>(pDoc); // const as const can... ::sd::DrawDocShell* pDocShell = pNonConstDoc->GetDocSh(); OUString aDocShName( pDocShell->GetName() ); ::sd::ViewShell* pViewShell = pDocShell->GetViewShell(); diff --git a/sd/source/ui/dlg/sdtreelb.cxx b/sd/source/ui/dlg/sdtreelb.cxx index 5a7a0a8031c9..e478adf69c77 100644 --- a/sd/source/ui/dlg/sdtreelb.cxx +++ b/sd/source/ui/dlg/sdtreelb.cxx @@ -1000,7 +1000,7 @@ SdDrawDocument* SdPageObjsTLB::GetBookmarkDoc(SfxMedium* pMed) // in this mode the document is owned and controlled by the SdDrawDocument // it can be released by calling the corresponding CloseBookmarkDoc method // successful creation of a document makes this the owner of the medium - mpBookmarkDoc = ((SdDrawDocument*) mpDoc)->OpenBookmarkDoc(*mpMedium); + mpBookmarkDoc = const_cast<SdDrawDocument*>(mpDoc)->OpenBookmarkDoc(*mpMedium); if ( !mpBookmarkDoc ) { @@ -1032,7 +1032,7 @@ void SdPageObjsTLB::CloseBookmarkDoc() if ( mpDoc ) { // The document owns the Medium, so the Medium will be invalid after closing the document - ((SdDrawDocument*) mpDoc)->CloseBookmarkDoc(); + const_cast<SdDrawDocument*>(mpDoc)->CloseBookmarkDoc(); mpMedium = 0; } } diff --git a/sd/source/ui/docshell/docshell.cxx b/sd/source/ui/docshell/docshell.cxx index ebe60de7acb2..c5108a360a64 100644 --- a/sd/source/ui/docshell/docshell.cxx +++ b/sd/source/ui/docshell/docshell.cxx @@ -382,7 +382,7 @@ void DrawDocShell::ApplySlotFilter() const while( pTestViewShell ) { if( pTestViewShell->GetObjectShell() - == const_cast<DrawDocShell*>( this ) + == this && pTestViewShell->GetViewFrame() && pTestViewShell->GetViewFrame()->GetDispatcher() ) { diff --git a/sd/source/ui/func/futhes.cxx b/sd/source/ui/func/futhes.cxx index 7ce18a54100b..327e58fea3cc 100644 --- a/sd/source/ui/func/futhes.cxx +++ b/sd/source/ui/func/futhes.cxx @@ -108,7 +108,7 @@ void FuThesaurus::DoExecute( SfxRequest& ) pOutliner->SetDefaultLanguage( mpDoc->GetLanguage( EE_CHAR_LANGUAGE ) ); } - EESpellState eState = ( (OutlinerView*) pOutlView)->StartThesaurus(); + EESpellState eState = const_cast<OutlinerView*>(pOutlView)->StartThesaurus(); DBG_ASSERT(eState != EE_SPELL_NOSPELLER, "No SpellChecker"); if (eState == EE_SPELL_NOLANGUAGE) diff --git a/sd/source/ui/inc/sdxfer.hxx b/sd/source/ui/inc/sdxfer.hxx index 917395f88356..136c3838de29 100644 --- a/sd/source/ui/inc/sdxfer.hxx +++ b/sd/source/ui/inc/sdxfer.hxx @@ -47,7 +47,7 @@ public: void SetDocShell( const SfxObjectShellRef& rRef ) { maDocShellRef = rRef; } const SfxObjectShellRef& GetDocShell() const { return maDocShellRef; } - void SetWorkDocument( const SdDrawDocument* pWorkDoc ) { mpSdDrawDocument = mpSdDrawDocumentIntern = (SdDrawDocument*) pWorkDoc; } + void SetWorkDocument( const SdDrawDocument* pWorkDoc ) { mpSdDrawDocument = mpSdDrawDocumentIntern = const_cast<SdDrawDocument*>(pWorkDoc); } const SdDrawDocument* GetWorkDocument() const { return mpSdDrawDocument; } void SetView(const ::sd::View* pView); diff --git a/sd/source/ui/slideshow/slideshowimpl.cxx b/sd/source/ui/slideshow/slideshowimpl.cxx index fdbff3f78d68..4e9959bf978e 100644 --- a/sd/source/ui/slideshow/slideshowimpl.cxx +++ b/sd/source/ui/slideshow/slideshowimpl.cxx @@ -2489,7 +2489,7 @@ void SlideshowImpl::createSlideList( bool bAll, const OUString& rPresSlide ) for( SdCustomShow::PageVec::iterator it = pCustomShow->PagesVector().begin(); it != pCustomShow->PagesVector().end(); ++it, nSlideIndex++ ) { - const sal_uInt16 nSdSlide = ( ( (SdPage*) (*it) )->GetPageNum() - 1 ) / 2; + const sal_uInt16 nSdSlide = ( const_cast<SdPage*>(*it)->GetPageNum() - 1 ) / 2; if( !( mpDoc->GetSdPage( nSdSlide, PK_STANDARD ) )->IsExcluded()) mpSlideController->insertSlideNumber( nSdSlide ); diff --git a/sd/source/ui/view/drtxtob1.cxx b/sd/source/ui/view/drtxtob1.cxx index a3e850cd82e5..7b5460d1c4fc 100644 --- a/sd/source/ui/view/drtxtob1.cxx +++ b/sd/source/ui/view/drtxtob1.cxx @@ -353,7 +353,7 @@ void TextObjectBar::Execute( SfxRequest &rReq ) if (pItem ) { - SvxNumRule aNewRule(*((SvxNumBulletItem*)pItem)->GetNumRule()); + SvxNumRule aNewRule(*pItem->GetNumRule()); ESelection aSel = pOLV->GetSelection(); aSel.Adjust(); sal_Int32 nStartPara = aSel.nStartPara; diff --git a/sd/source/ui/view/drviewsc.cxx b/sd/source/ui/view/drviewsc.cxx index 6a3a269c0ade..d3508a692f97 100644 --- a/sd/source/ui/view/drviewsc.cxx +++ b/sd/source/ui/view/drviewsc.cxx @@ -337,7 +337,7 @@ void DrawViewShell::UpdateIMapDlg( SdrObject* pObj ) if ( pIMapInfo ) { - pIMap = (ImageMap*) &pIMapInfo->GetImageMap(); + pIMap = const_cast<ImageMap*>(&pIMapInfo->GetImageMap()); pTargetList = new TargetList; GetViewFrame()->GetTargetList( *pTargetList ); } diff --git a/sd/source/ui/view/sdview2.cxx b/sd/source/ui/view/sdview2.cxx index 6899e061aac0..0cb06ef6b2b3 100644 --- a/sd/source/ui/view/sdview2.cxx +++ b/sd/source/ui/view/sdview2.cxx @@ -250,7 +250,7 @@ void View::DoCut(vcl::Window* ) const OutlinerView* pOLV = GetTextEditOutlinerView(); if( pOLV ) - ( (OutlinerView*) pOLV)->Cut(); + const_cast<OutlinerView*>(pOLV)->Cut(); else if( AreObjectsMarked() ) { OUString aStr(SD_RESSTR(STR_UNDO_CUT)); @@ -267,7 +267,7 @@ void View::DoCopy (vcl::Window* pWindow) const OutlinerView* pOLV = GetTextEditOutlinerView(); if( pOLV ) - ( (OutlinerView*) pOLV)->Copy(); + const_cast<OutlinerView*>(pOLV)->Copy(); else if( AreObjectsMarked() ) { BrkAction(); diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx index ba6dc816b9f7..90c9cc07157c 100644 --- a/sd/source/ui/view/sdview3.cxx +++ b/sd/source/ui/view/sdview3.cxx @@ -624,7 +624,7 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, } else { - SdDrawDocument* pWorkModel = (SdDrawDocument*) pOwnData->GetWorkDocument(); + SdDrawDocument* pWorkModel = const_cast<SdDrawDocument*>(pOwnData->GetWorkDocument()); SdPage* pWorkPage = (SdPage*) pWorkModel->GetSdPage( 0, PK_STANDARD ); pWorkPage->SetRectsDirty(); @@ -1192,7 +1192,7 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, if( pOwnData && pOwnData->GetWorkDocument() ) { const SdDrawDocument* pWorkModel = pOwnData->GetWorkDocument(); - SdrPage* pWorkPage = (SdrPage*) ( ( pWorkModel->GetPageCount() > 1 ) ? + SdrPage* pWorkPage = const_cast<SdrPage*>( ( pWorkModel->GetPageCount() > 1 ) ? pWorkModel->GetSdPage( 0, PK_STANDARD ) : pWorkModel->GetPage( 0 ) ); @@ -1224,7 +1224,7 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, { const SdDrawDocument* pWorkModel = pOwnData->GetWorkDocument(); - SdrPage* pWorkPage = (SdrPage*) ( ( pWorkModel->GetPageCount() > 1 ) ? + SdrPage* pWorkPage = const_cast<SdrPage*>( ( pWorkModel->GetPageCount() > 1 ) ? pWorkModel->GetSdPage( 0, PK_STANDARD ) : pWorkModel->GetPage( 0 ) ); @@ -1273,7 +1273,7 @@ bool View::InsertData( const TransferableDataHelper& rDataHelper, if( pOwnData && pOwnData->GetWorkDocument() ) { const SdDrawDocument* pWorkModel = pOwnData->GetWorkDocument(); - SdrPage* pWorkPage = (SdrPage*) ( ( pWorkModel->GetPageCount() > 1 ) ? + SdrPage* pWorkPage = const_cast<SdrPage*>( ( pWorkModel->GetPageCount() > 1 ) ? pWorkModel->GetSdPage( 0, PK_STANDARD ) : pWorkModel->GetPage( 0 ) ); |