summaryrefslogtreecommitdiff
path: root/editeng
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-03-26 15:28:32 +0100
committerStephan Bergmann <sbergman@redhat.com>2015-03-26 15:33:30 +0100
commit812e5e8ed7c408cb7f2388ab718365354bfc9a41 (patch)
tree722c1931584651940a725f130f58434c86a480e4 /editeng
parent93cf4dcf443c839c90b19dd68ea64bc1f31a2d91 (diff)
const_cast: convert some C-style casts and remove some redundant ones
Change-Id: I8682fee997d8dac254ca431f96172c9aa58c8c06
Diffstat (limited to 'editeng')
-rw-r--r--editeng/source/editeng/editdoc.cxx2
-rw-r--r--editeng/source/editeng/editeng.cxx4
-rw-r--r--editeng/source/editeng/impedit2.cxx12
-rw-r--r--editeng/source/editeng/impedit3.cxx2
-rw-r--r--editeng/source/editeng/impedit5.cxx2
-rw-r--r--editeng/source/items/frmitems.cxx4
-rw-r--r--editeng/source/items/svxfont.cxx10
-rw-r--r--editeng/source/misc/svxacorr.cxx2
-rw-r--r--editeng/source/outliner/outliner.cxx2
-rw-r--r--editeng/source/uno/unoforou.cxx8
-rw-r--r--editeng/source/uno/unoipset.cxx4
-rw-r--r--editeng/source/uno/unotext.cxx2
12 files changed, 27 insertions, 27 deletions
diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx
index 9e0f6570d63b..fa956cc1519e 100644
--- a/editeng/source/editeng/editdoc.cxx
+++ b/editeng/source/editeng/editdoc.cxx
@@ -3087,7 +3087,7 @@ SvStream& EditEngineItemPool::Store( SvStream& rStream ) const
bool b31Format = ( nVersion && ( nVersion <= SOFFICE_FILEFORMAT_31 ) )
? sal_True : sal_False;
- EditEngineItemPool* pThis = (EditEngineItemPool*)this;
+ EditEngineItemPool* pThis = const_cast<EditEngineItemPool*>(this);
if ( b31Format )
pThis->SetStoringRange( 3997, 4022 );
else
diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx
index ad2b3d44c586..afed13934c3b 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -630,7 +630,7 @@ OUString EditEngine::GetWord( sal_Int32 nPara, sal_Int32 nIndex )
ESelection EditEngine::GetWord( const ESelection& rSelection, sal_uInt16 nWordType ) const
{
// ImpEditEngine-Iteration-Methods should be const!
- EditEngine* pE = (EditEngine*)this;
+ EditEngine* pE = const_cast<EditEngine*>(this);
EditSelection aSel( pE->pImpEditEngine->CreateSel( rSelection ) );
aSel = pE->pImpEditEngine->SelectWord( aSel, nWordType );
@@ -2350,7 +2350,7 @@ EPosition EditEngine::FindDocPosition( const Point& rDocPos ) const
{
EPosition aPos;
// From the point of the API, this is const....
- EditPaM aPaM = ((EditEngine*)this)->pImpEditEngine->GetPaM( rDocPos, false );
+ EditPaM aPaM = const_cast<EditEngine*>(this)->pImpEditEngine->GetPaM( rDocPos, false );
if ( aPaM.GetNode() )
{
aPos.nPara = pImpEditEngine->aEditDoc.GetPos( aPaM.GetNode() );
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index fa62ca2d7ba9..bb964c193105 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -1755,7 +1755,7 @@ sal_uInt16 ImpEditEngine::GetI18NScriptType( const EditPaM& rPaM, sal_Int32* pEn
sal_Int32 nPara = GetEditDoc().GetPos( rPaM.GetNode() );
const ParaPortion* pParaPortion = GetParaPortions().SafeGetObject( nPara );
if ( pParaPortion->aScriptInfos.empty() )
- ((ImpEditEngine*)this)->InitScriptTypes( nPara );
+ const_cast<ImpEditEngine*>(this)->InitScriptTypes( nPara );
const ScriptTypePosInfos& rTypes = pParaPortion->aScriptInfos;
@@ -1785,7 +1785,7 @@ sal_uInt16 ImpEditEngine::GetItemScriptType( const EditSelection& rSel ) const
{
const ParaPortion* pParaPortion = GetParaPortions().SafeGetObject( nPara );
if ( pParaPortion->aScriptInfos.empty() )
- ((ImpEditEngine*)this)->InitScriptTypes( nPara );
+ const_cast<ImpEditEngine*>(this)->InitScriptTypes( nPara );
const ScriptTypePosInfos& rTypes = pParaPortion->aScriptInfos;
@@ -1829,7 +1829,7 @@ bool ImpEditEngine::IsScriptChange( const EditPaM& rPaM ) const
sal_Int32 nPara = GetEditDoc().GetPos( rPaM.GetNode() );
const ParaPortion* pParaPortion = GetParaPortions().SafeGetObject( nPara );
if ( pParaPortion->aScriptInfos.empty() )
- ((ImpEditEngine*)this)->InitScriptTypes( nPara );
+ const_cast<ImpEditEngine*>(this)->InitScriptTypes( nPara );
const ScriptTypePosInfos& rTypes = pParaPortion->aScriptInfos;
const sal_Int32 nPos = rPaM.GetIndex();
@@ -1851,7 +1851,7 @@ bool ImpEditEngine::HasScriptType( sal_Int32 nPara, sal_uInt16 nType ) const
const ParaPortion* pParaPortion = GetParaPortions().SafeGetObject( nPara );
if ( pParaPortion->aScriptInfos.empty() )
- ((ImpEditEngine*)this)->InitScriptTypes( nPara );
+ const_cast<ImpEditEngine*>(this)->InitScriptTypes( nPara );
const ScriptTypePosInfos& rTypes = pParaPortion->aScriptInfos;
for ( size_t n = rTypes.size(); n && !bTypeFound; )
@@ -1940,7 +1940,7 @@ bool ImpEditEngine::IsRightToLeft( sal_Int32 nPara ) const
else
{
// Use pool default
- pFrameDirItem = &static_cast<const SvxFrameDirectionItem&>(((ImpEditEngine*)this)->GetEmptyItemSet().Get( EE_PARA_WRITINGDIR ));
+ pFrameDirItem = &static_cast<const SvxFrameDirectionItem&>(const_cast<ImpEditEngine*>(this)->GetEmptyItemSet().Get( EE_PARA_WRITINGDIR ));
}
}
}
@@ -1953,7 +1953,7 @@ bool ImpEditEngine::IsRightToLeft( sal_Int32 nPara ) const
bool ImpEditEngine::HasDifferentRTLLevels( const ContentNode* pNode )
{
- sal_Int32 nPara = GetEditDoc().GetPos( (ContentNode*)pNode );
+ sal_Int32 nPara = GetEditDoc().GetPos( pNode );
ParaPortion* pParaPortion = GetParaPortions().SafeGetObject( nPara );
bool bHasDifferentRTLLevels = false;
diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx
index caba43f74ed9..069a3935b16c 100644
--- a/editeng/source/editeng/impedit3.cxx
+++ b/editeng/source/editeng/impedit3.cxx
@@ -4222,7 +4222,7 @@ const SvxNumberFormat* ImpEditEngine::GetNumberFormat( const ContentNode *pNode
if (pNode)
{
// get index of paragraph
- sal_Int32 nPara = GetEditDoc().GetPos( const_cast< ContentNode * >(pNode) );
+ sal_Int32 nPara = GetEditDoc().GetPos( pNode );
DBG_ASSERT( nPara < EE_PARA_NOT_FOUND, "node not found in array" );
if (nPara < EE_PARA_NOT_FOUND)
{
diff --git a/editeng/source/editeng/impedit5.cxx b/editeng/source/editeng/impedit5.cxx
index d362f258f348..fa733cdecd62 100644
--- a/editeng/source/editeng/impedit5.cxx
+++ b/editeng/source/editeng/impedit5.cxx
@@ -401,7 +401,7 @@ SfxItemSet ImpEditEngine::GetAttribs( sal_Int32 nPara, sal_Int32 nStart, sal_Int
DBG_ASSERT( pNode, "GetAttribs - unknown paragraph!" );
DBG_ASSERT( nStart <= nEnd, "getAttribs: Start > End not supported!" );
- SfxItemSet aAttribs( ((ImpEditEngine*)this)->GetEmptyItemSet() );
+ SfxItemSet aAttribs( const_cast<ImpEditEngine*>(this)->GetEmptyItemSet() );
if ( pNode )
{
diff --git a/editeng/source/items/frmitems.cxx b/editeng/source/items/frmitems.cxx
index f6e2315c4f02..6c2368d745e4 100644
--- a/editeng/source/items/frmitems.cxx
+++ b/editeng/source/items/frmitems.cxx
@@ -672,7 +672,7 @@ bool SvxLRSpaceItem::GetPresentation
SvStream& SvxLRSpaceItem::Store( SvStream& rStrm , sal_uInt16 nItemVersion ) const
{
short nSaveFI = nFirstLineOfst;
- ((SvxLRSpaceItem*)this)->SetTxtFirstLineOfst( 0 ); // nLeftMargin is manipulated together with this, see Create()
+ const_cast<SvxLRSpaceItem*>(this)->SetTxtFirstLineOfst( 0 ); // nLeftMargin is manipulated together with this, see Create()
sal_uInt16 nMargin = 0;
if( nLeftMargin > 0 )
@@ -712,7 +712,7 @@ SvStream& SvxLRSpaceItem::Store( SvStream& rStrm , sal_uInt16 nItemVersion ) con
}
}
- ((SvxLRSpaceItem*)this)->SetTxtFirstLineOfst( nSaveFI );
+ const_cast<SvxLRSpaceItem*>(this)->SetTxtFirstLineOfst( nSaveFI );
return rStrm;
}
diff --git a/editeng/source/items/svxfont.cxx b/editeng/source/items/svxfont.cxx
index a306c68901bd..e93edd42e372 100644
--- a/editeng/source/items/svxfont.cxx
+++ b/editeng/source/items/svxfont.cxx
@@ -440,14 +440,14 @@ Size SvxFont::GetTxtSize( const OutputDevice *pOut, const OUString &rTxt,
sal_Int32 nTmp = nLen;
if ( nTmp == SAL_MAX_INT32 ) // already initialized?
nTmp = rTxt.getLength();
- Font aOldFont( ChgPhysFont((OutputDevice *)pOut) );
+ Font aOldFont( ChgPhysFont(const_cast<OutputDevice *>(pOut)) );
Size aTxtSize;
if( IsCapital() && !rTxt.isEmpty() )
{
aTxtSize = GetCapitalSize( pOut, rTxt, nIdx, nTmp );
}
else aTxtSize = GetPhysTxtSize(pOut,rTxt,nIdx,nTmp);
- ((OutputDevice *)pOut)->SetFont( aOldFont );
+ const_cast<OutputDevice *>(pOut)->SetFont( aOldFont );
return aTxtSize;
}
@@ -592,7 +592,7 @@ public:
SvxDoGetCapitalSize( SvxFont *_pFnt, const OutputDevice *_pOut,
const OUString &_rTxt, const sal_Int32 _nIdx,
const sal_Int32 _nLen, const short _nKrn )
- : SvxDoCapitals( (OutputDevice*)_pOut, _rTxt, _nIdx, _nLen ),
+ : SvxDoCapitals( const_cast<OutputDevice*>(_pOut), _rTxt, _nIdx, _nLen ),
pFont( _pFnt ),
nKern( _nKrn )
{ }
@@ -633,7 +633,7 @@ Size SvxFont::GetCapitalSize( const OutputDevice *pOut, const OUString &rTxt,
const sal_Int32 nIdx, const sal_Int32 nLen) const
{
// Start:
- SvxDoGetCapitalSize aDo( (SvxFont *)this, pOut, rTxt, nIdx, nLen, nKern );
+ SvxDoGetCapitalSize aDo( const_cast<SvxFont *>(this), pOut, rTxt, nIdx, nLen, nKern );
DoOnCapitals( aDo );
Size aTxtSize( aDo.GetSize() );
@@ -741,7 +741,7 @@ void SvxFont::DrawCapital( OutputDevice *pOut,
const Point &rPos, const OUString &rTxt,
const sal_Int32 nIdx, const sal_Int32 nLen ) const
{
- SvxDoDrawCapital aDo( (SvxFont *)this,pOut,rTxt,nIdx,nLen,rPos,nKern );
+ SvxDoDrawCapital aDo( const_cast<SvxFont *>(this),pOut,rTxt,nIdx,nLen,rPos,nKern );
DoOnCapitals( aDo );
}
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index e74ad5d0901a..7ec0a8b96fb5 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -1548,7 +1548,7 @@ bool SvxAutoCorrect::GetPrevAutoCorrWord( SvxAutoCorrDoc& rDoc,
if( LANGUAGE_SYSTEM == eLang )
eLang = MsLangId::getSystemLanguage();
- SvxAutoCorrect* pThis = (SvxAutoCorrect*)this;
+ SvxAutoCorrect* pThis = const_cast<SvxAutoCorrect*>(this);
CharClass& rCC = pThis->GetCharClass( eLang );
if( lcl_IsSymbolChar( rCC, rTxt, nCapLttrPos, nEnde ))
diff --git a/editeng/source/outliner/outliner.cxx b/editeng/source/outliner/outliner.cxx
index 959bb65f639b..b30bd9579a7b 100644
--- a/editeng/source/outliner/outliner.cxx
+++ b/editeng/source/outliner/outliner.cxx
@@ -1062,7 +1062,7 @@ void Outliner::PaintBullet( sal_Int32 nPara, const Point& rStartPos,
else
{
// Remove CAST when KA made the Draw-Method const
- ((GraphicObject*)pFmt->GetBrush()->GetGraphicObject())->Draw( pOutDev, aBulletPos, pPara->aBulSize );
+ const_cast<GraphicObject*>(pFmt->GetBrush()->GetGraphicObject())->Draw( pOutDev, aBulletPos, pPara->aBulSize );
}
}
}
diff --git a/editeng/source/uno/unoforou.cxx b/editeng/source/uno/unoforou.cxx
index f0d3fbb1be5c..5057f0389812 100644
--- a/editeng/source/uno/unoforou.cxx
+++ b/editeng/source/uno/unoforou.cxx
@@ -68,7 +68,7 @@ OUString SvxOutlinerForwarder::GetText( const ESelection& rSel ) const
{
//! GetText (ESelection) should probably also be in the Outliner
// in the time being use as the hack for the EditEngine:
- EditEngine* pEditEngine = (EditEngine*)&rOutliner.GetEditEngine();
+ EditEngine* pEditEngine = const_cast<EditEngine*>(&rOutliner.GetEditEngine());
return pEditEngine->GetText( rSel, LINEEND_LF );
}
@@ -105,7 +105,7 @@ SfxItemSet SvxOutlinerForwarder::GetAttribs( const ESelection& rSel, EditEngineA
if( mpAttribsCache && ( EditEngineAttribs_All == nOnlyHardAttrib ) )
{
// have we the correct set in cache?
- if( ((SvxOutlinerForwarder*)this)->maAttribCacheSelection.IsEqual(rSel) )
+ if( const_cast<SvxOutlinerForwarder*>(this)->maAttribCacheSelection.IsEqual(rSel) )
{
// yes! just return the cache
return *mpAttribsCache;
@@ -173,12 +173,12 @@ void SvxOutlinerForwarder::SetParaAttribs( sal_Int32 nPara, const SfxItemSet& rS
const SfxItemSet* pOldParent = rSet.GetParent();
if( pOldParent )
- ((SfxItemSet*)&rSet)->SetParent( NULL );
+ const_cast<SfxItemSet*>(&rSet)->SetParent( NULL );
rOutliner.SetParaAttribs( nPara, rSet );
if( pOldParent )
- ((SfxItemSet*)&rSet)->SetParent( pOldParent );
+ const_cast<SfxItemSet*>(&rSet)->SetParent( pOldParent );
}
void SvxOutlinerForwarder::RemoveAttribs( const ESelection& rSelection, bool bRemoveParaAttribs, sal_uInt16 nWhich )
diff --git a/editeng/source/uno/unoipset.cxx b/editeng/source/uno/unoipset.cxx
index 59f08cdb5144..f42c3cda5c0a 100644
--- a/editeng/source/uno/unoipset.cxx
+++ b/editeng/source/uno/unoipset.cxx
@@ -222,7 +222,7 @@ uno::Any SvxItemPropertySet::getPropertyValue( const SfxItemPropertySimpleEntry*
if(eState >= SfxItemState::DEFAULT && pItem)
{
pItem->QueryValue( aVal, nMemberId );
- ((SvxItemPropertySet*)this)->AddUsrAnyForID(aVal, pMap->nWID);
+ const_cast<SvxItemPropertySet*>(this)->AddUsrAnyForID(aVal, pMap->nWID);
}
}
@@ -253,7 +253,7 @@ void SvxItemPropertySet::setPropertyValue( const SfxItemPropertySimpleEntry* pMa
{
uno::Any* pUsrAny = GetUsrAnyForID(pMap->nWID);
if(!pUsrAny)
- ((SvxItemPropertySet*)this)->AddUsrAnyForID(rVal, pMap->nWID);
+ const_cast<SvxItemPropertySet*>(this)->AddUsrAnyForID(rVal, pMap->nWID);
else
*pUsrAny = rVal;
}
diff --git a/editeng/source/uno/unotext.cxx b/editeng/source/uno/unotext.cxx
index 3d00ca00b7a5..0a94a73194c0 100644
--- a/editeng/source/uno/unotext.cxx
+++ b/editeng/source/uno/unotext.cxx
@@ -678,7 +678,7 @@ void SvxUnoTextRangeBase::getPropertyValue( const SfxItemPropertySimpleEntry* pM
break;
default:
- if(!GetPropertyValueHelper( *((SfxItemSet*)(&rSet)), pMap, rAny, &maSelection, GetEditSource() ))
+ if(!GetPropertyValueHelper( *const_cast<SfxItemSet*>(&rSet), pMap, rAny, &maSelection, GetEditSource() ))
rAny = mpPropSet->getPropertyValue(pMap, rSet, true, false );
}
}