From 0d05f417c3a7dcde89f5e15b29f39ce2db65b543 Mon Sep 17 00:00:00 2001 From: Stephan Bergmann Date: Thu, 26 Mar 2015 15:31:36 +0100 Subject: const_cast: convert some C-style casts and remove some redundant ones Change-Id: Iabe2ecce65a91b003fe042a22630131449968fd8 --- include/svtools/fmtfield.hxx | 2 +- include/svtools/treelist.hxx | 12 ++++++------ svtools/source/brwbox/brwbox1.cxx | 2 +- svtools/source/brwbox/editbrowsebox.cxx | 2 +- svtools/source/contnr/imivctl1.cxx | 14 +++++++------- svtools/source/contnr/ivctrl.cxx | 6 +++--- svtools/source/contnr/simptabl.cxx | 4 ++-- svtools/source/contnr/svimpbox.cxx | 4 ++-- svtools/source/contnr/treelist.cxx | 4 ++-- svtools/source/contnr/treelistbox.cxx | 2 +- svtools/source/control/calendar.cxx | 8 ++++---- svtools/source/control/ctrltool.cxx | 18 +++++++++--------- svtools/source/control/fmtfield.cxx | 4 ++-- svtools/source/control/tabbar.cxx | 2 +- svtools/source/graphic/descriptor.cxx | 2 +- svtools/source/graphic/grfcache.cxx | 10 +++++----- svtools/source/graphic/grfmgr.cxx | 2 +- svtools/source/graphic/grfmgr2.cxx | 2 +- svtools/source/misc/embedtransfer.cxx | 2 +- 19 files changed, 51 insertions(+), 51 deletions(-) diff --git a/include/svtools/fmtfield.hxx b/include/svtools/fmtfield.hxx index efce83a940c0..bda86e2f4447 100644 --- a/include/svtools/fmtfield.hxx +++ b/include/svtools/fmtfield.hxx @@ -244,7 +244,7 @@ protected: // SetFormatKey without FormatChanged notification SvNumberFormatter* CreateFormatter() { SetFormatter(StandardFormatter()); return m_pFormatter; } - SvNumberFormatter* ImplGetFormatter() const { return m_pFormatter ? m_pFormatter : ((FormattedField*)this)->CreateFormatter(); } + SvNumberFormatter* ImplGetFormatter() const { return m_pFormatter ? m_pFormatter : const_cast(this)->CreateFormatter(); } bool PreNotify(NotifyEvent& rNEvt) SAL_OVERRIDE; diff --git a/include/svtools/treelist.hxx b/include/svtools/treelist.hxx index cad50fc71040..79b6ff640c19 100644 --- a/include/svtools/treelist.hxx +++ b/include/svtools/treelist.hxx @@ -286,7 +286,7 @@ public: ); sal_uLong GetVisibleCount() const - { return pModel->GetVisibleCount( (SvListView*)this ); } + { return pModel->GetVisibleCount( const_cast(this) ); } SvTreeListEntry* FirstVisible() const { return pModel->FirstVisible(); } @@ -324,26 +324,26 @@ public: { return pModel->GetEntryAtAbsPos(nAbsPos); } SvTreeListEntry* GetEntryAtVisPos( sal_uLong nVisPos ) const - { return pModel->GetEntryAtVisPos((SvListView*)this,nVisPos); } + { return pModel->GetEntryAtVisPos(this,nVisPos); } sal_uLong GetAbsPos( SvTreeListEntry* pEntry ) const { return pModel->GetAbsPos(pEntry); } sal_uLong GetVisiblePos( SvTreeListEntry* pEntry ) const - { return pModel->GetVisiblePos((SvListView*)this,pEntry); } + { return pModel->GetVisiblePos(this,pEntry); } sal_uLong GetVisibleChildCount(SvTreeListEntry* pParent ) const - { return pModel->GetVisibleChildCount((SvListView*)this,pParent); } + { return pModel->GetVisibleChildCount(this,pParent); } sal_uLong GetChildSelectionCount( SvTreeListEntry* pParent ) const - { return pModel->GetChildSelectionCount((SvListView*)this,pParent); } + { return pModel->GetChildSelectionCount(this,pParent); } // Does not call the Select Handler virtual void SelectAll( bool bSelect, bool ) { pModel->SelectAll((SvListView*)this, bSelect); } bool IsEntryVisible( SvTreeListEntry* pEntry ) const - { return pModel->IsEntryVisible((SvListView*)this,pEntry); } + { return pModel->IsEntryVisible(this,pEntry); } bool IsExpanded( SvTreeListEntry* pEntry ) const; bool IsSelected( SvTreeListEntry* pEntry ) const; diff --git a/svtools/source/brwbox/brwbox1.cxx b/svtools/source/brwbox/brwbox1.cxx index 8d4127f4ce20..67353f473e22 100644 --- a/svtools/source/brwbox/brwbox1.cxx +++ b/svtools/source/brwbox/brwbox1.cxx @@ -872,7 +872,7 @@ sal_uInt16 BrowseBox::ColCount() const long BrowseBox::ImpGetDataRowHeight() const { - BrowseBox *pThis = (BrowseBox*)this; + BrowseBox *pThis = const_cast(this); pThis->nDataRowHeight = pThis->CalcReverseZoom(pDataWin->GetTextHeight() + 2); pThis->Resize(); getDataWindow()->Invalidate(); diff --git a/svtools/source/brwbox/editbrowsebox.cxx b/svtools/source/brwbox/editbrowsebox.cxx index bcb227145ec2..c48a0a924943 100644 --- a/svtools/source/brwbox/editbrowsebox.cxx +++ b/svtools/source/brwbox/editbrowsebox.cxx @@ -880,7 +880,7 @@ namespace svt return true; // save the cell content - if (IsEditing() && aController->IsModified() && !((EditBrowseBox *) this)->SaveModified()) + if (IsEditing() && aController->IsModified() && !const_cast(this)->SaveModified()) { // maybe we're not visible ... EnableAndShow(); diff --git a/svtools/source/contnr/imivctl1.cxx b/svtools/source/contnr/imivctl1.cxx index 7e2c61033d1a..0e3d008cdce7 100644 --- a/svtools/source/contnr/imivctl1.cxx +++ b/svtools/source/contnr/imivctl1.cxx @@ -2079,9 +2079,9 @@ long SvxIconChoiceCtrl_Impl::CalcBoundingHeight( SvxIconChoiceCtrlEntry* pEntry } if( nHeight > nMaxBoundHeight ) { - ((SvxIconChoiceCtrl_Impl*)this)->nMaxBoundHeight = nHeight; - ((SvxIconChoiceCtrl_Impl*)this)->aHorSBar.SetLineSize( GetScrollBarLineSize() ); - ((SvxIconChoiceCtrl_Impl*)this)->aVerSBar.SetLineSize( GetScrollBarLineSize() ); + const_cast(this)->nMaxBoundHeight = nHeight; + const_cast(this)->aHorSBar.SetLineSize( GetScrollBarLineSize() ); + const_cast(this)->aVerSBar.SetLineSize( GetScrollBarLineSize() ); } return nHeight; } @@ -2521,7 +2521,7 @@ void SvxIconChoiceCtrl_Impl::SetGrid( const Size& rSize ) { const SvxIconChoiceCtrlColumnInfo* pCol = GetColumn( 0 ); if( pCol ) - ((SvxIconChoiceCtrlColumnInfo*)pCol)->SetWidth( nGridDX ); + const_cast(pCol)->SetWidth( nGridDX ); } nGridDY = aSize.Height(); SetDefaultTextSize(); @@ -2540,8 +2540,8 @@ Rectangle SvxIconChoiceCtrl_Impl::CalcMaxTextRect( const SvxIconChoiceCtrlEntry* else aBoundRect = pEntry->aGridRect; - Rectangle aBmpRect( ((SvxIconChoiceCtrl_Impl*)this)->CalcBmpRect( - (SvxIconChoiceCtrlEntry*)pEntry ) ); + Rectangle aBmpRect( const_cast(this)->CalcBmpRect( + const_cast(pEntry) ) ); if( nWinBits & WB_ICON ) { aBoundRect.Top() = aBmpRect.Bottom(); @@ -3369,7 +3369,7 @@ void IcnViewEdit_Impl::StopEditing( bool bCancel ) sal_uLong SvxIconChoiceCtrl_Impl::GetEntryListPos( SvxIconChoiceCtrlEntry* pEntry ) const { if( !(nFlags & F_ENTRYLISTPOS_VALID )) - ((SvxIconChoiceCtrl_Impl*)this)->SetListPositions(); + const_cast(this)->SetListPositions(); return pEntry->nPos; } diff --git a/svtools/source/contnr/ivctrl.cxx b/svtools/source/contnr/ivctrl.cxx index 0ced60f2dfd3..ce1c05c49f64 100644 --- a/svtools/source/contnr/ivctrl.cxx +++ b/svtools/source/contnr/ivctrl.cxx @@ -231,7 +231,7 @@ SvxIconChoiceCtrlEntry* SvtIconChoiceCtrl::GetEntry( const Point& rPixPos, bool { Point aPos( rPixPos ); aPos -= GetMapMode().GetOrigin(); - return ((SvtIconChoiceCtrl*)this)->_pImp->GetEntry( aPos, bHit ); + return const_cast(this)->_pImp->GetEntry( aPos, bHit ); } void SvtIconChoiceCtrl::SetStyle( WinBits nWinStyle ) @@ -296,7 +296,7 @@ void SvtIconChoiceCtrl::KeyInput( const KeyEvent& rKEvt ) bool bKeyUsed = DoKeyInput( rKEvt ); if ( !bKeyUsed ) { - _pCurKeyEvent = (KeyEvent*)&rKEvt; + _pCurKeyEvent = const_cast(&rKEvt); Control::KeyInput( rKEvt ); _pCurKeyEvent = NULL; } @@ -306,7 +306,7 @@ bool SvtIconChoiceCtrl::DoKeyInput( const KeyEvent& rKEvt ) // under OS/2, we get key up/down even while editing if( IsEntryEditing() ) return true; - _pCurKeyEvent = (KeyEvent*)&rKEvt; + _pCurKeyEvent = const_cast(&rKEvt); bool bHandled = _pImp->KeyInput( rKEvt ); _pCurKeyEvent = NULL; return bHandled; diff --git a/svtools/source/contnr/simptabl.cxx b/svtools/source/contnr/simptabl.cxx index 8e7d7ad0d127..a6e07c52d7fc 100644 --- a/svtools/source/contnr/simptabl.cxx +++ b/svtools/source/contnr/simptabl.cxx @@ -466,8 +466,8 @@ sal_Int32 SvSimpleTable::ColCompare(SvTreeListEntry* pLeft,SvTreeListEntry* pRig IMPL_LINK( SvSimpleTable, CompareHdl, SvSortData*, pData) { - SvTreeListEntry* pLeft = (SvTreeListEntry*)(pData->pLeft ); - SvTreeListEntry* pRight = (SvTreeListEntry*)(pData->pRight ); + SvTreeListEntry* pLeft = const_cast(pData->pLeft); + SvTreeListEntry* pRight = const_cast(pData->pRight); return (long) ColCompare(pLeft,pRight); } diff --git a/svtools/source/contnr/svimpbox.cxx b/svtools/source/contnr/svimpbox.cxx index e16f38ec44ed..c069bef5b569 100644 --- a/svtools/source/contnr/svimpbox.cxx +++ b/svtools/source/contnr/svimpbox.cxx @@ -3388,8 +3388,8 @@ void SvImpLBox::ShowFocusRect( const SvTreeListEntry* pEntry ) { if( pEntry ) { - long nY = GetEntryLine( (SvTreeListEntry*)pEntry ); - Rectangle aRect = pView->GetFocusRect( (SvTreeListEntry*)pEntry, nY ); + long nY = GetEntryLine( const_cast(pEntry) ); + Rectangle aRect = pView->GetFocusRect( const_cast(pEntry), nY ); vcl::Region aOldClip( pView->GetClipRegion()); vcl::Region aClipRegion( GetClipRegionRect() ); pView->SetClipRegion( aClipRegion ); diff --git a/svtools/source/contnr/treelist.cxx b/svtools/source/contnr/treelist.cxx index 1a9bc8d858b4..d684e4b3fd7b 100644 --- a/svtools/source/contnr/treelist.cxx +++ b/svtools/source/contnr/treelist.cxx @@ -587,7 +587,7 @@ sal_uLong SvTreeList::GetVisiblePos( const SvListView* pView, SvTreeListEntry* p if ( !pView->bVisPositionsValid ) { // to make GetVisibleCount refresh the positions - ((SvListView*)pView)->nVisibleCount = 0; + const_cast(pView)->nVisibleCount = 0; GetVisibleCount( const_cast(pView) ); } const SvViewDataEntry* pViewData = pView->GetViewData( pEntry ); @@ -911,7 +911,7 @@ sal_uLong SvTreeList::Insert( SvTreeListEntry* pEntry,SvTreeListEntry* pParent,s sal_uLong SvTreeList::GetAbsPos( const SvTreeListEntry* pEntry) const { if ( !bAbsPositionsValid ) - ((SvTreeList*)this)->SetAbsolutePositions(); + const_cast(this)->SetAbsolutePositions(); return pEntry->nAbsPos; } diff --git a/svtools/source/contnr/treelistbox.cxx b/svtools/source/contnr/treelistbox.cxx index 3cce392c8ba5..a3f04834e15e 100644 --- a/svtools/source/contnr/treelistbox.cxx +++ b/svtools/source/contnr/treelistbox.cxx @@ -921,7 +921,7 @@ sal_uLong SvTreeListBox::GetLevelChildCount( SvTreeListEntry* _pParent ) const SvViewDataEntry* SvTreeListBox::GetViewDataEntry( SvTreeListEntry* pEntry ) const { - return (SvViewDataEntry*)SvListView::GetViewData(pEntry); + return const_cast(SvListView::GetViewData(pEntry)); } SvViewDataItem* SvTreeListBox::GetViewDataItem(SvTreeListEntry* pEntry, SvLBoxItem* pItem) diff --git a/svtools/source/control/calendar.cxx b/svtools/source/control/calendar.cxx index 72f2966fa0b6..1d02dc34ab09 100644 --- a/svtools/source/control/calendar.cxx +++ b/svtools/source/control/calendar.cxx @@ -2132,9 +2132,9 @@ Size Calendar::CalcWindowSizePixel( long nCalcMonthPerLine, { vcl::Font aTempFont = aOldFont; ImplGetWeekFont( aTempFont ); - ((Calendar*)this)->SetFont( aTempFont ); + const_cast(this)->SetFont( aTempFont ); nWeekWidth = GetTextWidth( a99Text )+WEEKNUMBER_OFFX; - ((Calendar*)this)->SetFont( aOldFont ); + const_cast(this)->SetFont( aOldFont ); } else nWeekWidth = 0; @@ -2146,7 +2146,7 @@ Size Calendar::CalcWindowSizePixel( long nCalcMonthPerLine, aFont.SetWeight( WEIGHT_BOLD ); else aFont.SetWeight( WEIGHT_NORMAL ); - ((Calendar*)this)->SetFont( aFont ); + const_cast(this)->SetFont( aFont ); } Size aSize; @@ -2154,7 +2154,7 @@ Size Calendar::CalcWindowSizePixel( long nCalcMonthPerLine, long nTextHeight = GetTextHeight(); if ( mnWinStyle & WB_BOLDTEXT ) - ((Calendar*)this)->SetFont( aOldFont ); + const_cast(this)->SetFont( aOldFont ); aSize.Width() += ((n99TextWidth+DAY_OFFX)*7) + nWeekWidth; aSize.Width() += MONTH_BORDERX*2; diff --git a/svtools/source/control/ctrltool.cxx b/svtools/source/control/ctrltool.cxx index 92dbaf63f64f..e0c327bc06b6 100644 --- a/svtools/source/control/ctrltool.cxx +++ b/svtools/source/control/ctrltool.cxx @@ -510,7 +510,7 @@ OUString FontList::GetFontMapText( const vcl::FontInfo& rInfo ) const if ( !bNotSynthetic ) { if (maMapStyleNotAvailable.isEmpty()) - ((FontList*)this)->maMapStyleNotAvailable = SVT_RESSTR(STR_SVT_FONTMAP_STYLENOTAVAILABLE); + const_cast(this)->maMapStyleNotAvailable = SVT_RESSTR(STR_SVT_FONTMAP_STYLENOTAVAILABLE); return maMapStyleNotAvailable; } } @@ -519,7 +519,7 @@ OUString FontList::GetFontMapText( const vcl::FontInfo& rInfo ) const if ( (nType & (FONTLIST_FONTNAMETYPE_PRINTER | FONTLIST_FONTNAMETYPE_SCREEN)) == FONTLIST_FONTNAMETYPE_PRINTER ) { if (maMapPrinterOnly.isEmpty()) - ((FontList*)this)->maMapPrinterOnly = SVT_RESSTR(STR_SVT_FONTMAP_PRINTERONLY); + const_cast(this)->maMapPrinterOnly = SVT_RESSTR(STR_SVT_FONTMAP_PRINTERONLY); return maMapPrinterOnly; } // Only Screen-Font? @@ -527,13 +527,13 @@ OUString FontList::GetFontMapText( const vcl::FontInfo& rInfo ) const && rInfo.GetType() == TYPE_RASTER ) { if (maMapScreenOnly.isEmpty()) - ((FontList*)this)->maMapScreenOnly = SVT_RESSTR(STR_SVT_FONTMAP_SCREENONLY); + const_cast(this)->maMapScreenOnly = SVT_RESSTR(STR_SVT_FONTMAP_SCREENONLY); return maMapScreenOnly; } else { if (maMapBoth.isEmpty()) - ((FontList*)this)->maMapBoth = SVT_RESSTR(STR_SVT_FONTMAP_BOTH); + const_cast(this)->maMapBoth = SVT_RESSTR(STR_SVT_FONTMAP_BOTH); return maMapBoth; } } @@ -718,8 +718,8 @@ const sal_IntPtr* FontList::GetSizeAry( const vcl::FontInfo& rInfo ) const // first delete Size-Array if ( mpSizeAry ) { - delete[] ((FontList*)this)->mpSizeAry; - ((FontList*)this)->mpSizeAry = NULL; + delete[] const_cast(this)->mpSizeAry; + const_cast(this)->mpSizeAry = NULL; } // use standarad sizes if no name @@ -744,18 +744,18 @@ const sal_IntPtr* FontList::GetSizeAry( const vcl::FontInfo& rInfo ) const sal_uInt16 i; sal_uInt16 nRealCount = 0; long nOldHeight = 0; - ((FontList*)this)->mpSizeAry = new sal_IntPtr[nDevSizeCount+1]; + const_cast(this)->mpSizeAry = new sal_IntPtr[nDevSizeCount+1]; for ( i = 0; i < nDevSizeCount; i++ ) { Size aSize = pDevice->GetDevFontSize( rInfo, i ); if ( aSize.Height() != nOldHeight ) { nOldHeight = aSize.Height(); - ((FontList*)this)->mpSizeAry[nRealCount] = nOldHeight; + const_cast(this)->mpSizeAry[nRealCount] = nOldHeight; nRealCount++; } } - ((FontList*)this)->mpSizeAry[nRealCount] = 0; + const_cast(this)->mpSizeAry[nRealCount] = 0; pDevice->SetMapMode( aOldMapMode ); return mpSizeAry; diff --git a/svtools/source/control/fmtfield.cxx b/svtools/source/control/fmtfield.cxx index 1b43103b4e9b..d021fc900ca6 100644 --- a/svtools/source/control/fmtfield.cxx +++ b/svtools/source/control/fmtfield.cxx @@ -418,8 +418,8 @@ OUString FormattedField::GetTextValue() const { if (m_bValueDirty) { - ((FormattedField*)this)->m_sCurrentTextValue = GetText(); - ((FormattedField*)this)->m_bValueDirty = false; + const_cast(this)->m_sCurrentTextValue = GetText(); + const_cast(this)->m_bValueDirty = false; } return m_sCurrentTextValue; } diff --git a/svtools/source/control/tabbar.cxx b/svtools/source/control/tabbar.cxx index 2e071de0b707..ad9345f3dd70 100644 --- a/svtools/source/control/tabbar.cxx +++ b/svtools/source/control/tabbar.cxx @@ -2620,7 +2620,7 @@ Size TabBar::CalcWindowSizePixel() const if (mpImpl->mpItemList.size() > 0) { - ((TabBar*)this)->ImplCalcWidth(); + const_cast(this)->ImplCalcWidth(); for (size_t i = 0; i < mpImpl->mpItemList.size(); ++i) { ImplTabBarItem* pItem = mpImpl->mpItemList[i]; diff --git a/svtools/source/graphic/descriptor.cxx b/svtools/source/graphic/descriptor.cxx index d73cd740a82d..f0020618878c 100644 --- a/svtools/source/graphic/descriptor.cxx +++ b/svtools/source/graphic/descriptor.cxx @@ -334,7 +334,7 @@ void GraphicDescriptor::_getPropertyValues( const comphelper::PropertyMapEntry** { const char* pMimeType; - switch( const_cast< Graphic* >( mpGraphic )->GetLink().GetType() ) + switch( mpGraphic->GetLink().GetType() ) { case( GFX_LINK_TYPE_NATIVE_GIF ): pMimeType = MIMETYPE_GIF; break; diff --git a/svtools/source/graphic/grfcache.cxx b/svtools/source/graphic/grfcache.cxx index d6d04fcc78c7..81eefd14759d 100644 --- a/svtools/source/graphic/grfcache.cxx +++ b/svtools/source/graphic/grfcache.cxx @@ -184,7 +184,7 @@ GraphicCacheEntry::GraphicCacheEntry( const GraphicObject& rObj ) : mbSwappedAll ( true ) { mbSwappedAll = !ImplInit( rObj ); - maGraphicObjectList.push_back( (GraphicObject*)&rObj ); + maGraphicObjectList.push_back( const_cast(&rObj) ); } GraphicCacheEntry::~GraphicCacheEntry() @@ -314,7 +314,7 @@ void GraphicCacheEntry::AddGraphicObjectReference( const GraphicObject& rObj, Gr mbSwappedAll = !ImplInit( rObj ); ImplFillSubstitute( rSubstitute ); - maGraphicObjectList.push_back( (GraphicObject*) &rObj ); + maGraphicObjectList.push_back( const_cast(&rObj) ); } bool GraphicCacheEntry::ReleaseGraphicObjectReference( const GraphicObject& rObj ) @@ -1053,7 +1053,7 @@ bool GraphicCache::IsInDisplayCache( OutputDevice* pOut, const Point& rPt, const { const Point aPtPixel( pOut->LogicToPixel( rPt ) ); const Size aSzPixel( pOut->LogicToPixel( rSz ) ); - const GraphicCacheEntry* pCacheEntry = ( (GraphicCache*) this )->ImplGetCacheEntry( rObj ); + const GraphicCacheEntry* pCacheEntry = const_cast(this)->ImplGetCacheEntry( rObj ); bool bFound = false; if( pCacheEntry ) @@ -1072,14 +1072,14 @@ bool GraphicCache::IsInDisplayCache( OutputDevice* pOut, const Point& rPt, const OString GraphicCache::GetUniqueID( const GraphicObject& rObj ) const { OString aRet; - GraphicCacheEntry* pEntry = ( (GraphicCache*) this )->ImplGetCacheEntry( rObj ); + GraphicCacheEntry* pEntry = const_cast(this)->ImplGetCacheEntry( rObj ); // ensure that the entry is correctly initialized (it has to be read at least once) if( pEntry && pEntry->GetID().IsEmpty() ) pEntry->TryToSwapIn(); // do another call to ImplGetCacheEntry in case of modified entry list - pEntry = ( (GraphicCache*) this )->ImplGetCacheEntry( rObj ); + pEntry = const_cast(this)->ImplGetCacheEntry( rObj ); if( pEntry ) aRet = pEntry->GetID().GetIDString(); diff --git a/svtools/source/graphic/grfmgr.cxx b/svtools/source/graphic/grfmgr.cxx index 30758854e030..c91b6e0236b3 100644 --- a/svtools/source/graphic/grfmgr.cxx +++ b/svtools/source/graphic/grfmgr.cxx @@ -199,7 +199,7 @@ void GraphicObject::ImplSetGraphicManager( const GraphicManager* pMgr, const OSt mpMgr = mpGlobalMgr; } else - mpMgr = (GraphicManager*) pMgr; + mpMgr = const_cast(pMgr); mpMgr->ImplRegisterObj( *this, maGraphic, pID, pCopyObj ); } diff --git a/svtools/source/graphic/grfmgr2.cxx b/svtools/source/graphic/grfmgr2.cxx index f82fc9fea513..55b09cc170f8 100644 --- a/svtools/source/graphic/grfmgr2.cxx +++ b/svtools/source/graphic/grfmgr2.cxx @@ -149,7 +149,7 @@ void GraphicManager::ImplRegisterObj( const GraphicObject& rObj, Graphic& rSubst assert(std::find(maObjList.begin(), maObjList.end(), const_cast(&rObj)) == maObjList.end()); - maObjList.push_back( (GraphicObject*)&rObj ); + maObjList.push_back( const_cast(&rObj) ); mpCache->AddGraphicObject( rObj, rSubstitute, pID, pCopyObj ); if( !rObj.IsSwappedOut() ) mnUsedSize += rObj.maGraphic.GetSizeBytes(); diff --git a/svtools/source/misc/embedtransfer.cxx b/svtools/source/misc/embedtransfer.cxx index 836b98977238..b6d9102872a0 100644 --- a/svtools/source/misc/embedtransfer.cxx +++ b/svtools/source/misc/embedtransfer.cxx @@ -163,7 +163,7 @@ bool SvEmbedTransferHelper::GetData( const css::datatransfer::DataFlavor& rFlavo aMemStm.SetVersion( SOFFICE_FILEFORMAT_CURRENT ); const GDIMetaFile& aMetaFile = m_pGraphic->GetGDIMetaFile(); - ((GDIMetaFile*)(&aMetaFile))->Write( aMemStm ); + const_cast(&aMetaFile)->Write( aMemStm ); uno::Any aAny; aAny <<= uno::Sequence< sal_Int8 >( reinterpret_cast< const sal_Int8* >( aMemStm.GetData() ), aMemStm.Seek( STREAM_SEEK_TO_END ) ); -- cgit