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 )
// Evaluate Parameter
SFX_REQUEST_ARG(rReq, pOnItem, SfxBoolItem, SID_HELPTIPS, false);
bool bOn = pOnItem
? ((SfxBoolItem*)pOnItem)->GetValue()
? pOnItem->GetValue()
: !Help::IsQuickHelpEnabled();
if ( bOn )
......@@ -507,7 +507,7 @@ void SfxApplication::MiscExec_Impl( SfxRequest& rReq )
// Evaluate Parameter
SFX_REQUEST_ARG(rReq, pOnItem, SfxBoolItem, SID_HELPBALLOONS, false);
bool bOn = pOnItem
? ((SfxBoolItem*)pOnItem)->GetValue()
? pOnItem->GetValue()
: !Help::IsBalloonHelpEnabled();
if ( bOn )
......
......@@ -547,7 +547,7 @@ bool SvFileObject::IsDataComplete() const
bRet = true;
else if( !bLoadError && !bWaitForData )
{
SvFileObject* pThis = (SvFileObject*)this;
SvFileObject* pThis = const_cast<SvFileObject*>(this);
if( bDataReady ||
( bSynchron && pThis->LoadFile_Impl() && xMed.Is() ) )
bRet = true;
......
......@@ -1101,7 +1101,7 @@ void SfxFilterContainer::ReadSingleFilter_Impl(
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;
if (!pFilter)
{
......
......@@ -311,7 +311,7 @@ void SfxHTMLParser::GetScriptType_Impl( SvKeyValueIterator *pHTTPHeader )
ScriptType SfxHTMLParser::GetScriptType( SvKeyValueIterator *pHTTPHeader ) const
{
if( aScriptType.isEmpty() )
((SfxHTMLParser *)this)->GetScriptType_Impl( pHTTPHeader );
const_cast<SfxHTMLParser *>(this)->GetScriptType_Impl( pHTTPHeader );
return eScriptType;
}
......@@ -320,7 +320,7 @@ const OUString& SfxHTMLParser::GetScriptTypeString(
SvKeyValueIterator *pHTTPHeader ) const
{
if( aScriptType.isEmpty() )
((SfxHTMLParser *)this)->GetScriptType_Impl( pHTTPHeader );
const_cast<SfxHTMLParser *>(this)->GetScriptType_Impl( pHTTPHeader );
return aScriptType;
}
......
......@@ -46,7 +46,7 @@ SfxSlotKind SfxSlot::GetKind() const
sal_uInt16 SfxSlot::GetWhich( const SfxItemPool &rPool ) const
{
if ( !nMasterSlotId || nMasterSlotId == USHRT_MAX )
((SfxSlot*) this) -> nMasterSlotId = rPool.GetWhich(nSlotId);
const_cast<SfxSlot*>(this) -> nMasterSlotId = rPool.GetWhich(nSlotId);
return nMasterSlotId;
}
......
......@@ -157,7 +157,7 @@ void SfxInterface::SetSlotMap( SfxSlot& rSlotMap, sal_uInt16 nSlotCount )
pIter->pLinkedSlot = GetSlot( pIter->nMasterSlotId );
assert( pIter->pLinkedSlot );
if ( !pIter->pLinkedSlot->pLinkedSlot )
( (SfxSlot*) pIter->pLinkedSlot)->pLinkedSlot = pIter;
const_cast<SfxSlot*>(pIter->pLinkedSlot)->pLinkedSlot = pIter;
if ( 0 == pIter->GetNextSlot() )
{
......
......@@ -742,7 +742,7 @@ void SfxRequest::Done_Impl
{
// play it safe; repair the wrong flags
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::RECORDPERSET;
}
......
......@@ -390,7 +390,7 @@ SfxTabDialog::~SfxTabDialog()
}
if ( pDataObject->bOnDemand )
delete (SfxItemSet*)&pDataObject->pTabPage->GetItemSet();
delete &pDataObject->pTabPage->GetItemSet();
delete pDataObject->pTabPage;
}
delete pDataObject;
......@@ -689,7 +689,7 @@ void SfxTabDialog::RemoveTabPage( sal_uInt16 nId )
}
if ( pDataObject->bOnDemand )
delete (SfxItemSet*)&pDataObject->pTabPage->GetItemSet();
delete &pDataObject->pTabPage->GetItemSet();
delete pDataObject->pTabPage;
}
......
......@@ -630,7 +630,7 @@ bool SfxMedium::CloseOutStream_Impl()
const OUString& SfxMedium::GetPhysicalName() const
{
if ( pImp->m_aName.isEmpty() && !pImp->m_aLogicName.isEmpty() )
(( SfxMedium*)this)->CreateFileStream();
const_cast<SfxMedium*>(this)->CreateFileStream();
// return the name then
return pImp->m_aName;
......
......@@ -130,7 +130,7 @@ SfxObjectShell::CreatePreviewMetaFile_Impl( bool bFullContent ) const
VirtualDevice aDevice;
aDevice.EnableOutput( false );
MapMode aMode( ((SfxObjectShell*)this)->GetMapUnit() );
MapMode aMode( this->GetMapUnit() );
aDevice.SetMapMode( aMode );
xFile->SetPrefMapMode( aMode );
......@@ -144,7 +144,7 @@ SfxObjectShell::CreatePreviewMetaFile_Impl( bool bFullContent ) const
else
{
nAspect = ASPECT_THUMBNAIL;
aTmpSize = ((SfxObjectShell*)this)->GetFirstPageSize();
aTmpSize = const_cast<SfxObjectShell*>(this)->GetFirstPageSize();
}
xFile->SetPrefSize( aTmpSize );
......@@ -166,7 +166,7 @@ SfxObjectShell::CreatePreviewMetaFile_Impl( bool bFullContent ) const
{
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();
......
......@@ -247,7 +247,7 @@ void SfxObjectShell::DoDraw_Impl( OutputDevice* pDev,
comphelper::EmbeddedObjectContainer& SfxObjectShell::GetEmbeddedObjectContainer() const
{
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;
}
......
......@@ -831,7 +831,7 @@ OUString SfxObjectShell::GetTitle
bRecur = true;
OUString aTitle;
SfxObjectShell *pThis = (SfxObjectShell*) this;
SfxObjectShell *pThis = const_cast<SfxObjectShell*>(this);
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