Kaydet (Commit) 98ce4ac4 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

const_cast: convert some C-style casts and remove some redundant ones

Change-Id: I59526bea5104def80e98902e4cf16e7bcfaa250c
üst f474984c
...@@ -480,7 +480,7 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq ) ...@@ -480,7 +480,7 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
// Evaluate Parameter // Evaluate Parameter
SFX_REQUEST_ARG(rReq, pOnItem, SfxBoolItem, SID_HELPTIPS, false); SFX_REQUEST_ARG(rReq, pOnItem, SfxBoolItem, SID_HELPTIPS, false);
bool bOn = pOnItem bool bOn = pOnItem
? ((SfxBoolItem*)pOnItem)->GetValue() ? pOnItem->GetValue()
: !Help::IsQuickHelpEnabled(); : !Help::IsQuickHelpEnabled();
if ( bOn ) if ( bOn )
...@@ -507,7 +507,7 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq ) ...@@ -507,7 +507,7 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
// Evaluate Parameter // Evaluate Parameter
SFX_REQUEST_ARG(rReq, pOnItem, SfxBoolItem, SID_HELPBALLOONS, false); SFX_REQUEST_ARG(rReq, pOnItem, SfxBoolItem, SID_HELPBALLOONS, false);
bool bOn = pOnItem bool bOn = pOnItem
? ((SfxBoolItem*)pOnItem)->GetValue() ? pOnItem->GetValue()
: !Help::IsBalloonHelpEnabled(); : !Help::IsBalloonHelpEnabled();
if ( bOn ) if ( bOn )
......
...@@ -547,7 +547,7 @@ bool SvFileObject::IsDataComplete() const ...@@ -547,7 +547,7 @@ bool SvFileObject::IsDataComplete() const
bRet = true; bRet = true;
else if( !bLoadError && !bWaitForData ) else if( !bLoadError && !bWaitForData )
{ {
SvFileObject* pThis = (SvFileObject*)this; SvFileObject* pThis = const_cast<SvFileObject*>(this);
if( bDataReady || if( bDataReady ||
( bSynchron && pThis->LoadFile_Impl() && xMed.Is() ) ) ( bSynchron && pThis->LoadFile_Impl() && xMed.Is() ) )
bRet = true; bRet = true;
......
...@@ -1101,7 +1101,7 @@ void SfxFilterContainer::ReadSingleFilter_Impl( ...@@ -1101,7 +1101,7 @@ void SfxFilterContainer::ReadSingleFilter_Impl(
sFilterName = sFilterName.copy( nStartRealName+2 ); sFilterName = sFilterName.copy( nStartRealName+2 );
} }
SfxFilter* pFilter = bUpdate ? (SfxFilter*) SfxFilter::GetFilterByName( sFilterName ) : 0; SfxFilter* pFilter = bUpdate ? const_cast<SfxFilter*>(SfxFilter::GetFilterByName( sFilterName )) : 0;
bool bNew = false; bool bNew = false;
if (!pFilter) if (!pFilter)
{ {
......
...@@ -311,7 +311,7 @@ void SfxHTMLParser::GetScriptType_Impl( SvKeyValueIterator *pHTTPHeader ) ...@@ -311,7 +311,7 @@ void SfxHTMLParser::GetScriptType_Impl( SvKeyValueIterator *pHTTPHeader )
ScriptType SfxHTMLParser::GetScriptType( SvKeyValueIterator *pHTTPHeader ) const ScriptType SfxHTMLParser::GetScriptType( SvKeyValueIterator *pHTTPHeader ) const
{ {
if( aScriptType.isEmpty() ) if( aScriptType.isEmpty() )
((SfxHTMLParser *)this)->GetScriptType_Impl( pHTTPHeader ); const_cast<SfxHTMLParser *>(this)->GetScriptType_Impl( pHTTPHeader );
return eScriptType; return eScriptType;
} }
...@@ -320,7 +320,7 @@ const OUString& SfxHTMLParser::GetScriptTypeString( ...@@ -320,7 +320,7 @@ const OUString& SfxHTMLParser::GetScriptTypeString(
SvKeyValueIterator *pHTTPHeader ) const SvKeyValueIterator *pHTTPHeader ) const
{ {
if( aScriptType.isEmpty() ) if( aScriptType.isEmpty() )
((SfxHTMLParser *)this)->GetScriptType_Impl( pHTTPHeader ); const_cast<SfxHTMLParser *>(this)->GetScriptType_Impl( pHTTPHeader );
return aScriptType; return aScriptType;
} }
......
...@@ -46,7 +46,7 @@ SfxSlotKind SfxSlot::GetKind() const ...@@ -46,7 +46,7 @@ SfxSlotKind SfxSlot::GetKind() const
sal_uInt16 SfxSlot::GetWhich( const SfxItemPool &rPool ) const sal_uInt16 SfxSlot::GetWhich( const SfxItemPool &rPool ) const
{ {
if ( !nMasterSlotId || nMasterSlotId == USHRT_MAX ) if ( !nMasterSlotId || nMasterSlotId == USHRT_MAX )
((SfxSlot*) this) -> nMasterSlotId = rPool.GetWhich(nSlotId); const_cast<SfxSlot*>(this) -> nMasterSlotId = rPool.GetWhich(nSlotId);
return nMasterSlotId; return nMasterSlotId;
} }
......
...@@ -157,7 +157,7 @@ void SfxInterface::SetSlotMap( SfxSlot& rSlotMap, sal_uInt16 nSlotCount ) ...@@ -157,7 +157,7 @@ void SfxInterface::SetSlotMap( SfxSlot& rSlotMap, sal_uInt16 nSlotCount )
pIter->pLinkedSlot = GetSlot( pIter->nMasterSlotId ); pIter->pLinkedSlot = GetSlot( pIter->nMasterSlotId );
assert( pIter->pLinkedSlot ); assert( pIter->pLinkedSlot );
if ( !pIter->pLinkedSlot->pLinkedSlot ) if ( !pIter->pLinkedSlot->pLinkedSlot )
( (SfxSlot*) pIter->pLinkedSlot)->pLinkedSlot = pIter; const_cast<SfxSlot*>(pIter->pLinkedSlot)->pLinkedSlot = pIter;
if ( 0 == pIter->GetNextSlot() ) if ( 0 == pIter->GetNextSlot() )
{ {
......
...@@ -742,7 +742,7 @@ void SfxRequest::Done_Impl ...@@ -742,7 +742,7 @@ void SfxRequest::Done_Impl
{ {
// play it safe; repair the wrong flags // play it safe; repair the wrong flags
OSL_FAIL( "recursion RecordPerItem - use RecordPerSet!" ); OSL_FAIL( "recursion RecordPerItem - use RecordPerSet!" );
SfxSlot *pSlot = (SfxSlot*) pImp->pSlot; SfxSlot *pSlot = const_cast<SfxSlot*>(pImp->pSlot);
pSlot->nFlags &= ~(SfxSlotMode::RECORDPERITEM); pSlot->nFlags &= ~(SfxSlotMode::RECORDPERITEM);
pSlot->nFlags &= SfxSlotMode::RECORDPERSET; pSlot->nFlags &= SfxSlotMode::RECORDPERSET;
} }
......
...@@ -390,7 +390,7 @@ SfxTabDialog::~SfxTabDialog() ...@@ -390,7 +390,7 @@ SfxTabDialog::~SfxTabDialog()
} }
if ( pDataObject->bOnDemand ) if ( pDataObject->bOnDemand )
delete (SfxItemSet*)&pDataObject->pTabPage->GetItemSet(); delete &pDataObject->pTabPage->GetItemSet();
delete pDataObject->pTabPage; delete pDataObject->pTabPage;
} }
delete pDataObject; delete pDataObject;
...@@ -689,7 +689,7 @@ void SfxTabDialog::RemoveTabPage( sal_uInt16 nId ) ...@@ -689,7 +689,7 @@ void SfxTabDialog::RemoveTabPage( sal_uInt16 nId )
} }
if ( pDataObject->bOnDemand ) if ( pDataObject->bOnDemand )
delete (SfxItemSet*)&pDataObject->pTabPage->GetItemSet(); delete &pDataObject->pTabPage->GetItemSet();
delete pDataObject->pTabPage; delete pDataObject->pTabPage;
} }
......
...@@ -630,7 +630,7 @@ bool SfxMedium::CloseOutStream_Impl() ...@@ -630,7 +630,7 @@ bool SfxMedium::CloseOutStream_Impl()
const OUString& SfxMedium::GetPhysicalName() const const OUString& SfxMedium::GetPhysicalName() const
{ {
if ( pImp->m_aName.isEmpty() && !pImp->m_aLogicName.isEmpty() ) if ( pImp->m_aName.isEmpty() && !pImp->m_aLogicName.isEmpty() )
(( SfxMedium*)this)->CreateFileStream(); const_cast<SfxMedium*>(this)->CreateFileStream();
// return the name then // return the name then
return pImp->m_aName; return pImp->m_aName;
......
...@@ -130,7 +130,7 @@ SfxObjectShell::CreatePreviewMetaFile_Impl( bool bFullContent ) const ...@@ -130,7 +130,7 @@ SfxObjectShell::CreatePreviewMetaFile_Impl( bool bFullContent ) const
VirtualDevice aDevice; VirtualDevice aDevice;
aDevice.EnableOutput( false ); aDevice.EnableOutput( false );
MapMode aMode( ((SfxObjectShell*)this)->GetMapUnit() ); MapMode aMode( this->GetMapUnit() );
aDevice.SetMapMode( aMode ); aDevice.SetMapMode( aMode );
xFile->SetPrefMapMode( aMode ); xFile->SetPrefMapMode( aMode );
...@@ -144,7 +144,7 @@ SfxObjectShell::CreatePreviewMetaFile_Impl( bool bFullContent ) const ...@@ -144,7 +144,7 @@ SfxObjectShell::CreatePreviewMetaFile_Impl( bool bFullContent ) const
else else
{ {
nAspect = ASPECT_THUMBNAIL; nAspect = ASPECT_THUMBNAIL;
aTmpSize = ((SfxObjectShell*)this)->GetFirstPageSize(); aTmpSize = const_cast<SfxObjectShell*>(this)->GetFirstPageSize();
} }
xFile->SetPrefSize( aTmpSize ); xFile->SetPrefSize( aTmpSize );
...@@ -166,7 +166,7 @@ SfxObjectShell::CreatePreviewMetaFile_Impl( bool bFullContent ) const ...@@ -166,7 +166,7 @@ SfxObjectShell::CreatePreviewMetaFile_Impl( bool bFullContent ) const
{ {
SAL_INFO( "sfx.doc", "PERFORMANCE SfxObjectShell::CreatePreviewMetaFile_Impl" ); SAL_INFO( "sfx.doc", "PERFORMANCE SfxObjectShell::CreatePreviewMetaFile_Impl" );
((SfxObjectShell*)this)->DoDraw( &aDevice, Point(0,0), aTmpSize, JobSetup(), nAspect ); const_cast<SfxObjectShell*>(this)->DoDraw( &aDevice, Point(0,0), aTmpSize, JobSetup(), nAspect );
} }
xFile->Stop(); xFile->Stop();
......
...@@ -247,7 +247,7 @@ void SfxObjectShell::DoDraw_Impl( OutputDevice* pDev, ...@@ -247,7 +247,7 @@ void SfxObjectShell::DoDraw_Impl( OutputDevice* pDev,
comphelper::EmbeddedObjectContainer& SfxObjectShell::GetEmbeddedObjectContainer() const comphelper::EmbeddedObjectContainer& SfxObjectShell::GetEmbeddedObjectContainer() const
{ {
if ( !pImp->mpObjectContainer ) if ( !pImp->mpObjectContainer )
pImp->mpObjectContainer = new comphelper::EmbeddedObjectContainer( ((SfxObjectShell*)this)->GetStorage(), GetModel() ); pImp->mpObjectContainer = new comphelper::EmbeddedObjectContainer( const_cast<SfxObjectShell*>(this)->GetStorage(), GetModel() );
return *pImp->mpObjectContainer; return *pImp->mpObjectContainer;
} }
......
...@@ -831,7 +831,7 @@ OUString SfxObjectShell::GetTitle ...@@ -831,7 +831,7 @@ OUString SfxObjectShell::GetTitle
bRecur = true; bRecur = true;
OUString aTitle; OUString aTitle;
SfxObjectShell *pThis = (SfxObjectShell*) this; SfxObjectShell *pThis = const_cast<SfxObjectShell*>(this);
if ( pMed ) if ( pMed )
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment