From a05da74d0bdf691f097aa925fa59e21203ade8ed Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Fri, 14 Nov 2014 08:36:38 +0200 Subject: loplugin: cstylecast Change-Id: I7235a67e85c10ec9fefe7f718cda18f633cda97a --- sw/inc/charatr.hxx | 137 ++++++++++++-------- sw/inc/dbfld.hxx | 7 +- sw/inc/docufld.hxx | 4 +- sw/inc/edimp.hxx | 9 ++ sw/inc/ftninfo.hxx | 3 +- sw/inc/unoframe.hxx | 2 +- sw/source/core/doc/CntntIdxStore.cxx | 8 +- .../core/doc/DocumentContentOperationsManager.cxx | 20 +-- sw/source/core/doc/DocumentDeviceManager.cxx | 2 +- sw/source/core/doc/DocumentDrawModelManager.cxx | 4 +- sw/source/core/doc/DocumentFieldsManager.cxx | 142 ++++++++++----------- sw/source/core/doc/DocumentStateManager.cxx | 4 +- sw/source/core/doc/DocumentStatisticsManager.cxx | 2 +- sw/source/core/doc/DocumentTimerManager.cxx | 2 +- sw/source/core/doc/doccorr.cxx | 43 ++++--- sw/source/core/doc/docdesc.cxx | 12 +- sw/source/core/doc/docdraw.cxx | 34 ++--- sw/source/core/doc/docedt.cxx | 28 ++-- sw/source/core/doc/docfld.cxx | 74 +++++------ sw/source/core/doc/docfly.cxx | 44 +++---- sw/source/core/doc/docfmt.cxx | 71 +++++------ sw/source/core/doc/docftn.cxx | 10 +- sw/source/core/doc/docglbl.cxx | 10 +- sw/source/core/doc/docglos.cxx | 2 +- sw/source/core/doc/doclay.cxx | 34 ++--- sw/source/core/doc/docnum.cxx | 6 +- sw/source/core/doc/docredln.cxx | 18 +-- sw/source/core/doc/docruby.cxx | 8 +- sw/source/core/doc/docsort.cxx | 2 +- sw/source/core/doc/doctxm.cxx | 26 ++-- 30 files changed, 406 insertions(+), 362 deletions(-) (limited to 'sw') diff --git a/sw/inc/charatr.hxx b/sw/inc/charatr.hxx index b791a7ceadd2..6e24a988ce68 100644 --- a/sw/inc/charatr.hxx +++ b/sw/inc/charatr.hxx @@ -21,89 +21,116 @@ #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include // implementation of the character attribute methods of SwAttrSet inline const SvxPostureItem &SwAttrSet::GetPosture(bool bInP) const - { return (const SvxPostureItem&)Get( RES_CHRATR_POSTURE,bInP); } + { return static_cast(Get( RES_CHRATR_POSTURE,bInP)); } inline const SvxPostureItem &SwAttrSet::GetCJKPosture(bool bInP) const - { return (const SvxPostureItem&)Get( RES_CHRATR_CJK_POSTURE,bInP); } + { return static_cast(Get( RES_CHRATR_CJK_POSTURE,bInP)); } inline const SvxPostureItem &SwAttrSet::GetCTLPosture(bool bInP) const - { return (const SvxPostureItem&)Get( RES_CHRATR_CTL_POSTURE,bInP); } + { return static_cast(Get( RES_CHRATR_CTL_POSTURE,bInP)); } inline const SvxWeightItem &SwAttrSet::GetWeight(bool bInP) const - { return (const SvxWeightItem&)Get( RES_CHRATR_WEIGHT,bInP); } + { return static_cast(Get( RES_CHRATR_WEIGHT,bInP)); } inline const SvxWeightItem &SwAttrSet::GetCJKWeight(bool bInP) const - { return (const SvxWeightItem&)Get( RES_CHRATR_CJK_WEIGHT,bInP); } + { return static_cast(Get( RES_CHRATR_CJK_WEIGHT,bInP)); } inline const SvxWeightItem &SwAttrSet::GetCTLWeight(bool bInP) const - { return (const SvxWeightItem&)Get( RES_CHRATR_CTL_WEIGHT,bInP); } + { return static_cast(Get( RES_CHRATR_CTL_WEIGHT,bInP)); } inline const SvxShadowedItem &SwAttrSet::GetShadowed(bool bInP) const - { return (const SvxShadowedItem&)Get( RES_CHRATR_SHADOWED,bInP); } + { return static_cast(Get( RES_CHRATR_SHADOWED,bInP)); } inline const SvxAutoKernItem &SwAttrSet::GetAutoKern(bool bInP) const - { return (const SvxAutoKernItem&)Get( RES_CHRATR_AUTOKERN,bInP); } -inline const SvxWordLineModeItem &SwAttrSet::GetWordLineMode(bool bInP) const - { return (const SvxWordLineModeItem&)Get( RES_CHRATR_WORDLINEMODE,bInP); } + { return static_cast(Get( RES_CHRATR_AUTOKERN,bInP)); } +inline const SvxWordLineModeItem &SwAttrSet::GetWordLineMode(bool bInP) const + { return static_cast(Get( RES_CHRATR_WORDLINEMODE,bInP)); } inline const SvxContourItem &SwAttrSet::GetContour(bool bInP) const - { return (const SvxContourItem&)Get( RES_CHRATR_CONTOUR,bInP); } + { return static_cast(Get( RES_CHRATR_CONTOUR,bInP)); } inline const SvxKerningItem &SwAttrSet::GetKerning(bool bInP) const - { return (const SvxKerningItem&)Get( RES_CHRATR_KERNING,bInP); } + { return static_cast(Get( RES_CHRATR_KERNING,bInP)); } inline const SvxUnderlineItem &SwAttrSet::GetUnderline(bool bInP) const - { return (const SvxUnderlineItem&)Get( RES_CHRATR_UNDERLINE,bInP); } + { return static_cast(Get( RES_CHRATR_UNDERLINE,bInP)); } inline const SvxOverlineItem &SwAttrSet::GetOverline(bool bInP) const - { return (const SvxOverlineItem&)Get( RES_CHRATR_OVERLINE,bInP); } + { return static_cast(Get( RES_CHRATR_OVERLINE,bInP)); } inline const SvxCrossedOutItem &SwAttrSet::GetCrossedOut(bool bInP) const - { return (const SvxCrossedOutItem&)Get( RES_CHRATR_CROSSEDOUT,bInP); } -inline const SvxFontHeightItem &SwAttrSet::GetSize(bool bInP) const - { return (const SvxFontHeightItem&)Get( RES_CHRATR_FONTSIZE,bInP); } -inline const SvxFontHeightItem &SwAttrSet::GetCJKSize(bool bInP) const - { return (const SvxFontHeightItem&)Get( RES_CHRATR_CJK_FONTSIZE,bInP); } -inline const SvxFontHeightItem &SwAttrSet::GetCTLSize(bool bInP) const - { return (const SvxFontHeightItem&)Get( RES_CHRATR_CTL_FONTSIZE,bInP); } + { return static_cast(Get( RES_CHRATR_CROSSEDOUT,bInP)); } +inline const SvxFontHeightItem &SwAttrSet::GetSize(bool bInP) const + { return static_cast(Get( RES_CHRATR_FONTSIZE,bInP)); } +inline const SvxFontHeightItem &SwAttrSet::GetCJKSize(bool bInP) const + { return static_cast(Get( RES_CHRATR_CJK_FONTSIZE,bInP)); } +inline const SvxFontHeightItem &SwAttrSet::GetCTLSize(bool bInP) const + { return static_cast(Get( RES_CHRATR_CTL_FONTSIZE,bInP)); } inline const SvxPropSizeItem &SwAttrSet::GetPropSize(bool bInP) const - { return (const SvxPropSizeItem&)Get( RES_CHRATR_PROPORTIONALFONTSIZE,bInP); } + { return static_cast(Get( RES_CHRATR_PROPORTIONALFONTSIZE,bInP)); } inline const SvxFontItem &SwAttrSet::GetFont(bool bInP) const - { return (const SvxFontItem&)Get( RES_CHRATR_FONT,bInP); } + { return static_cast(Get( RES_CHRATR_FONT,bInP)); } inline const SvxFontItem &SwAttrSet::GetCJKFont(bool bInP) const - { return (const SvxFontItem&)Get( RES_CHRATR_CJK_FONT,bInP); } + { return static_cast(Get( RES_CHRATR_CJK_FONT,bInP)); } inline const SvxFontItem &SwAttrSet::GetCTLFont(bool bInP) const - { return (const SvxFontItem&)Get( RES_CHRATR_CTL_FONT,bInP); } + { return static_cast(Get( RES_CHRATR_CTL_FONT,bInP)); } inline const SvxColorItem &SwAttrSet::GetColor(bool bInP) const - { return (const SvxColorItem&)Get( RES_CHRATR_COLOR,bInP); } + { return static_cast(Get( RES_CHRATR_COLOR,bInP)); } inline const SvxCharSetColorItem &SwAttrSet::GetCharSetColor(bool bInP) const - { return (const SvxCharSetColorItem&)Get( RES_CHRATR_CHARSETCOLOR,bInP); } + { return static_cast(Get( RES_CHRATR_CHARSETCOLOR,bInP)); } inline const SvxLanguageItem &SwAttrSet::GetLanguage(bool bInP) const - { return (const SvxLanguageItem&)Get( RES_CHRATR_LANGUAGE,bInP); } + { return static_cast(Get( RES_CHRATR_LANGUAGE,bInP)); } inline const SvxLanguageItem &SwAttrSet::GetCJKLanguage(bool bInP) const - { return (const SvxLanguageItem&)Get( RES_CHRATR_CJK_LANGUAGE,bInP); } + { return static_cast(Get( RES_CHRATR_CJK_LANGUAGE,bInP)); } inline const SvxLanguageItem &SwAttrSet::GetCTLLanguage(bool bInP) const - { return (const SvxLanguageItem&)Get( RES_CHRATR_CTL_LANGUAGE,bInP); } + { return static_cast(Get( RES_CHRATR_CTL_LANGUAGE,bInP)); } inline const SvxEscapementItem &SwAttrSet::GetEscapement(bool bInP) const - { return (const SvxEscapementItem&)Get( RES_CHRATR_ESCAPEMENT,bInP); } -inline const SvxCaseMapItem &SwAttrSet::GetCaseMap(bool bInP) const - { return (const SvxCaseMapItem&)Get( RES_CHRATR_CASEMAP,bInP); } -inline const SvxNoHyphenItem &SwAttrSet::GetNoHyphenHere(bool bInP) const - { return (const SvxNoHyphenItem&)Get( RES_CHRATR_NOHYPHEN,bInP); } -inline const SvxBlinkItem &SwAttrSet::GetBlink(bool bInP) const - { return (const SvxBlinkItem&)Get( RES_CHRATR_BLINK,bInP); } -inline const SvxBrushItem &SwAttrSet::GetChrBackground( bool bInP ) const - { return (const SvxBrushItem&)Get( RES_CHRATR_BACKGROUND, bInP ); } -inline const SvxBrushItem &SwAttrSet::GetChrHighlight( bool bInP ) const - { return (const SvxBrushItem&)Get( RES_CHRATR_HIGHLIGHT, bInP ); } + { return static_cast(Get( RES_CHRATR_ESCAPEMENT,bInP)); } +inline const SvxCaseMapItem &SwAttrSet::GetCaseMap(bool bInP) const + { return static_cast(Get( RES_CHRATR_CASEMAP,bInP)); } +inline const SvxNoHyphenItem &SwAttrSet::GetNoHyphenHere(bool bInP) const + { return static_cast(Get( RES_CHRATR_NOHYPHEN,bInP)); } +inline const SvxBlinkItem &SwAttrSet::GetBlink(bool bInP) const + { return static_cast(Get( RES_CHRATR_BLINK,bInP)); } +inline const SvxBrushItem &SwAttrSet::GetChrBackground( bool bInP ) const + { return static_cast(Get( RES_CHRATR_BACKGROUND, bInP )); } +inline const SvxBrushItem &SwAttrSet::GetChrHighlight( bool bInP ) const + { return static_cast(Get( RES_CHRATR_HIGHLIGHT, bInP )); } inline const SvxEmphasisMarkItem &SwAttrSet::GetEmphasisMark( bool bInP ) const - { return (const SvxEmphasisMarkItem&)Get( RES_CHRATR_EMPHASIS_MARK, bInP ); } -inline const SvxTwoLinesItem &SwAttrSet::Get2Lines( bool bInP ) const - { return (const SvxTwoLinesItem&)Get( RES_CHRATR_TWO_LINES, bInP ); } + { return static_cast(Get( RES_CHRATR_EMPHASIS_MARK, bInP )); } +inline const SvxTwoLinesItem &SwAttrSet::Get2Lines( bool bInP ) const + { return static_cast(Get( RES_CHRATR_TWO_LINES, bInP )); } inline const SvxCharScaleWidthItem &SwAttrSet::GetCharScaleW( bool bInP ) const - { return (const SvxCharScaleWidthItem&)Get( RES_CHRATR_SCALEW, bInP ); } -inline const SvxCharRotateItem &SwAttrSet::GetCharRotate( bool bInP ) const - { return (const SvxCharRotateItem&)Get( RES_CHRATR_ROTATE, bInP ); } -inline const SvxCharReliefItem &SwAttrSet::GetCharRelief( bool bInP ) const - { return (const SvxCharReliefItem&)Get( RES_CHRATR_RELIEF, bInP ); } -inline const SvxCharHiddenItem &SwAttrSet::GetCharHidden( bool bInP ) const - { return (const SvxCharHiddenItem&)Get( RES_CHRATR_HIDDEN, bInP ); } -inline const SvxBoxItem &SwAttrSet::GetCharBorder( bool bInP ) const - { return (const SvxBoxItem&)Get( RES_CHRATR_BOX, bInP ); } -inline const SvxShadowItem &SwAttrSet::GetCharShadow( bool bInP ) const - { return (const SvxShadowItem&)Get( RES_CHRATR_SHADOW, bInP ); } + { return static_cast(Get( RES_CHRATR_SCALEW, bInP )); } +inline const SvxCharRotateItem &SwAttrSet::GetCharRotate( bool bInP ) const + { return static_cast(Get( RES_CHRATR_ROTATE, bInP )); } +inline const SvxCharReliefItem &SwAttrSet::GetCharRelief( bool bInP ) const + { return static_cast(Get( RES_CHRATR_RELIEF, bInP )); } +inline const SvxCharHiddenItem &SwAttrSet::GetCharHidden( bool bInP ) const + { return static_cast(Get( RES_CHRATR_HIDDEN, bInP )); } +inline const SvxBoxItem &SwAttrSet::GetCharBorder( bool bInP ) const + { return static_cast(Get( RES_CHRATR_BOX, bInP )); } +inline const SvxShadowItem &SwAttrSet::GetCharShadow( bool bInP ) const + { return static_cast(Get( RES_CHRATR_SHADOW, bInP )); } // implementation of the character attribute methods of SwFmt diff --git a/sw/inc/dbfld.hxx b/sw/inc/dbfld.hxx index 28b78b4fda33..9ee797c76f19 100644 --- a/sw/inc/dbfld.hxx +++ b/sw/inc/dbfld.hxx @@ -124,7 +124,7 @@ inline void SwDBField::ChgBodyTxtFlag( bool bIsInBody ) // Base class for all other database fields. class SW_DLLPUBLIC SwDBNameInfField : public SwField { - SwDBData aDBData; + SwDBData aDBData; sal_uInt16 nSubType; protected: @@ -135,7 +135,8 @@ protected: public: /// DBName - inline const SwDBData& GetRealDBData() { return aDBData; } + inline const SwDBData& GetRealDBData() const { return aDBData; } + inline SwDBData& GetRealDBData() { return aDBData; } SwDBData GetDBData(SwDoc* pDoc); void SetDBData(const SwDBData& rDBData); @@ -144,7 +145,7 @@ public: virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const SAL_OVERRIDE; virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) SAL_OVERRIDE; - virtual sal_uInt16 GetSubType() const SAL_OVERRIDE; + virtual sal_uInt16 GetSubType() const SAL_OVERRIDE; virtual void SetSubType(sal_uInt16 nType) SAL_OVERRIDE; }; diff --git a/sw/inc/docufld.hxx b/sw/inc/docufld.hxx index 0f44505f672a..01753a40110a 100644 --- a/sw/inc/docufld.hxx +++ b/sw/inc/docufld.hxx @@ -340,9 +340,9 @@ public: /// True/False - String virtual void SetPar2(const OUString& rStr) SAL_OVERRIDE; - virtual OUString GetPar2() const SAL_OVERRIDE; + virtual OUString GetPar2() const SAL_OVERRIDE; - virtual sal_uInt16 GetSubType() const SAL_OVERRIDE; + virtual sal_uInt16 GetSubType() const SAL_OVERRIDE; virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) const SAL_OVERRIDE; virtual bool PutValue( const com::sun::star::uno::Any& rVal, sal_uInt16 nWhich ) SAL_OVERRIDE; diff --git a/sw/inc/edimp.hxx b/sw/inc/edimp.hxx index c6e2956fc994..29aea41c2a71 100644 --- a/sw/inc/edimp.hxx +++ b/sw/inc/edimp.hxx @@ -38,6 +38,15 @@ class SwNodeIndex; } while( (_pStartCrsr=static_cast(_pStartCrsr->GetNext())) != __pStartCrsr ); \ } +#define FOREACHPAM_START_CONST(pCURSH) \ + {\ + const SwPaM *_pStartCrsr = (pCURSH), *__pStartCrsr = _pStartCrsr; \ + do { + +#define FOREACHPAM_END_CONST() \ + } while( (_pStartCrsr=static_cast(_pStartCrsr->GetNext())) != __pStartCrsr ); \ + } + struct SwPamRange { sal_uLong nStart, nEnd; diff --git a/sw/inc/ftninfo.hxx b/sw/inc/ftninfo.hxx index 2ff9034d8c3f..2b250287892b 100644 --- a/sw/inc/ftninfo.hxx +++ b/sw/inc/ftninfo.hxx @@ -23,6 +23,7 @@ #include "swdllapi.h" #include #include +#include class SwTxtFmtColl; class SwPageDesc; @@ -49,7 +50,7 @@ public: bool DependsOn( const SwPageDesc* ) const; void SetFtnTxtColl(SwTxtFmtColl& rColl); - SwTxtFmtColl* GetFtnTxtColl() const { return (SwTxtFmtColl*) GetRegisteredIn(); } // can be 0. + SwTxtFmtColl* GetFtnTxtColl() const { return const_cast(static_cast(GetRegisteredIn())); } // can be 0. SwCharFmt* GetCharFmt(SwDoc &rDoc) const; void SetCharFmt( SwCharFmt* ); diff --git a/sw/inc/unoframe.hxx b/sw/inc/unoframe.hxx index 08f8cf6b6b09..fa27f9711966 100644 --- a/sw/inc/unoframe.hxx +++ b/sw/inc/unoframe.hxx @@ -358,7 +358,7 @@ class SwXOLEListener : public cppu::WeakImplHelper1 { ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > xOLEModel; - SwFmt* GetFmt() const { return (SwFmt*)GetRegisteredIn(); } + SwFmt* GetFmt() const { return const_cast(static_cast(GetRegisteredIn())); } public: SwXOLEListener(SwFmt& rOLEFmt, ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > xOLE); virtual ~SwXOLEListener(); diff --git a/sw/source/core/doc/CntntIdxStore.cxx b/sw/source/core/doc/CntntIdxStore.cxx index 40dcd3ea3ae0..35f48296e47b 100644 --- a/sw/source/core/doc/CntntIdxStore.cxx +++ b/sw/source/core/doc/CntntIdxStore.cxx @@ -412,18 +412,18 @@ void CntntIdxStoreImpl::SaveShellCrsrs(SwDoc* pDoc, sal_uLong nNode, sal_Int32 n do { if( _pStartShell->IsA( TYPE( SwCrsrShell )) ) { - SwPaM *_pStkCrsr = ((SwCrsrShell*)_pStartShell)->GetStkCrsr(); + SwPaM *_pStkCrsr = static_cast(_pStartShell)->GetStkCrsr(); if( _pStkCrsr ) do { lcl_ChkPaMBoth( m_aShellCrsrEntries, nNode, nCntnt, *_pStkCrsr); } while ( (_pStkCrsr != 0 ) && - ((_pStkCrsr=(SwPaM *)_pStkCrsr->GetNext()) != ((SwCrsrShell*)_pStartShell)->GetStkCrsr()) ); + ((_pStkCrsr = static_cast(_pStkCrsr->GetNext())) != static_cast(_pStartShell)->GetStkCrsr()) ); - FOREACHPAM_START( ((SwCrsrShell*)_pStartShell)->_GetCrsr() ) + FOREACHPAM_START( static_cast(_pStartShell)->_GetCrsr() ) lcl_ChkPaMBoth( m_aShellCrsrEntries, nNode, nCntnt, *PCURCRSR); FOREACHPAM_END() } - } while((_pStartShell=(SwViewShell*)_pStartShell->GetNext())!= pShell ); + } while((_pStartShell = static_cast(_pStartShell->GetNext()))!= pShell ); } void CntntIdxStoreImpl::RestoreShellCrsrs(updater_t& rUpdater) diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx index 7cc04eb8b64b..7e99c27f2648 100644 --- a/sw/source/core/doc/DocumentContentOperationsManager.cxx +++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx @@ -354,7 +354,7 @@ namespace ::sw::UndoGuard const undoGuard(pDestDoc->GetIDocumentUndoRedo()); do { - pDestDoc->getIDocumentContentOperations().DeleteAndJoin( *(SwPaM*)pDelPam->GetNext() ); + pDestDoc->getIDocumentContentOperations().DeleteAndJoin( *static_cast(pDelPam->GetNext()) ); if( pDelPam->GetNext() == pDelPam ) break; delete pDelPam->GetNext(); @@ -1559,7 +1559,7 @@ namespace //local functions originally from docfmt.cxx SwNode* pNd = pDoc->GetNodes()[ nStart ]; if (!pNd || !pNd->IsTxtNode()) continue; - SwTxtNode *pCurrentNd = (SwTxtNode*)pNd; + SwTxtNode *pCurrentNd = static_cast(pNd); pCurrentNd->TryCharSetExpandToNum(*pCharSet); } } @@ -1600,7 +1600,7 @@ DocumentContentOperationsManager::CopyRange( SwPaM& rPam, SwPosition& rPos, cons if( pNd->IsCntntNode() && pStt->nContent.GetIndex() ) ++nStt, --nDiff; if( (pNd = m_rDoc.GetNodes()[ nEnd ])->IsCntntNode() && - ((SwCntntNode*)pNd)->Len() != pEnd->nContent.GetIndex() ) + static_cast(pNd)->Len() != pEnd->nContent.GetIndex() ) --nEnd, --nDiff; if( nDiff && lcl_ChkFlyFly( pDoc, nStt, nEnd, rPos.nNode.GetIndex() ) ) @@ -1717,7 +1717,7 @@ void DocumentContentOperationsManager::DeleteSection( SwNode *pNode ) { assert(pNode && "Didn't pass a Node."); - SwStartNode* pSttNd = pNode->IsStartNode() ? (SwStartNode*)pNode + SwStartNode* pSttNd = pNode->IsStartNode() ? static_cast(pNode) : pNode->StartOfSectionNode(); SwNodeIndex aSttIdx( *pSttNd ), aEndIdx( *pNode->EndOfSectionNode() ); @@ -1768,7 +1768,7 @@ bool DocumentContentOperationsManager::DelFullPara( SwPaM& rPam ) { const SfxPoolItem *pItem; - const SfxItemSet* pSet = ((SwCntntNode*)pNd)->GetpSwAttrSet(); + const SfxItemSet* pSet = static_cast(pNd)->GetpSwAttrSet(); if( pSet && SfxItemState::SET == pSet->GetItemState( RES_PAGEDESC, false, &pItem ) ) { @@ -2817,10 +2817,10 @@ bool DocumentContentOperationsManager::SplitNode( const SwPosition &rPos, bool b const SwTableNode* pTblNd; const SwNode* pNd = m_rDoc.GetNodes()[ nPrevPos ]; if( pNd->IsStartNode() && - SwTableBoxStartNode == ((SwStartNode*)pNd)->GetStartNodeType() && + SwTableBoxStartNode == static_cast(pNd)->GetStartNodeType() && 0 != ( pTblNd = m_rDoc.GetNodes()[ --nPrevPos ]->GetTableNode() ) && ((( pNd = m_rDoc.GetNodes()[ --nPrevPos ])->IsStartNode() && - SwTableBoxStartNode != ((SwStartNode*)pNd)->GetStartNodeType() ) + SwTableBoxStartNode != static_cast(pNd)->GetStartNodeType() ) || ( pNd->IsEndNode() && pNd->StartOfSectionNode()->IsTableNode() ) || pNd->IsCntntNode() )) { @@ -2919,7 +2919,7 @@ bool DocumentContentOperationsManager::AppendTxtNode( SwPosition& rPos ) m_rDoc.getIDocumentStylePoolAccess().GetTxtCollFromPool( RES_POOLCOLL_STANDARD )); } else - pCurNode = (SwTxtNode*)pCurNode->AppendNode( rPos ); + pCurNode = static_cast(pCurNode->AppendNode( rPos )); rPos.nNode++; rPos.nContent.Assign( pCurNode, 0 ); @@ -3354,7 +3354,7 @@ void DocumentContentOperationsManager::CopyFlyInFlyImpl( if ((FLY_AT_CHAR == aAnchor.GetAnchorId()) && newPos.nNode.GetNode().IsTxtNode() ) { - newPos.nContent.Assign( (SwTxtNode*)&newPos.nNode.GetNode(), + newPos.nContent.Assign( static_cast(&newPos.nNode.GetNode()), newPos.nContent.GetIndex() ); } else @@ -4024,7 +4024,7 @@ static void lcl_PushNumruleState( SfxItemState &aNumRuleState, SwNumRuleItem &aN const SfxPoolItem * pItem = NULL; aNumRuleState = pAttrSet->GetItemState(RES_PARATR_NUMRULE, false, &pItem); if (SfxItemState::SET == aNumRuleState) - aNumRuleItem = *((SwNumRuleItem *) pItem); + aNumRuleItem = *static_cast( pItem); aListIdState = pAttrSet->GetItemState(RES_PARATR_LIST_ID, false, &pItem); diff --git a/sw/source/core/doc/DocumentDeviceManager.cxx b/sw/source/core/doc/DocumentDeviceManager.cxx index baf908647058..53be5dcc913f 100644 --- a/sw/source/core/doc/DocumentDeviceManager.cxx +++ b/sw/source/core/doc/DocumentDeviceManager.cxx @@ -338,7 +338,7 @@ void DocumentDeviceManager::PrtDataChanged() do { pSh->InitPrt( getPrinter(false) ); - pSh = (SwViewShell*)pSh->GetNext(); + pSh = static_cast(pSh->GetNext()); } while ( pSh != m_rDoc.getIDocumentLayoutAccess().GetCurrentViewShell() ); } diff --git a/sw/source/core/doc/DocumentDrawModelManager.cxx b/sw/source/core/doc/DocumentDrawModelManager.cxx index 8771a1b390e6..d76b5946fa69 100644 --- a/sw/source/core/doc/DocumentDrawModelManager.cxx +++ b/sw/source/core/doc/DocumentDrawModelManager.cxx @@ -166,7 +166,7 @@ void DocumentDrawModelManager::InitDrawModel() pRoot->SetDrawPage( pDrawPage ); pDrawPage->SetSize( pRoot->Frm().SSize() ); } - pViewSh = (SwViewShell*)pViewSh->GetNext(); + pViewSh = static_cast(pViewSh->GetNext()); }while( pViewSh != m_rDoc.getIDocumentLayoutAccess().GetCurrentViewShell() ); } } @@ -218,7 +218,7 @@ SwDrawModel* DocumentDrawModelManager::_MakeDrawModel() do { pTmp->MakeDrawView(); - pTmp = (SwViewShell*) pTmp->GetNext(); + pTmp = static_cast( pTmp->GetNext()); } while ( pTmp != m_rDoc.getIDocumentLayoutAccess().GetCurrentViewShell() ); // Broadcast, so that the FormShell can be connected to the DrawView diff --git a/sw/source/core/doc/DocumentFieldsManager.cxx b/sw/source/core/doc/DocumentFieldsManager.cxx index bf617fca5970..10bee35638ec 100644 --- a/sw/source/core/doc/DocumentFieldsManager.cxx +++ b/sw/source/core/doc/DocumentFieldsManager.cxx @@ -91,10 +91,10 @@ namespace { SwSbxValue aValue; if( nsSwGetSetExpType::GSE_EXPR & pFld->GetSubType() ) - aValue.PutDouble( ((SwSetExpField*)pFld)->GetValue() ); + aValue.PutDouble( static_cast(pFld)->GetValue() ); else // Extension to calculate with Strings - aValue.PutString( ((SwSetExpField*)pFld)->GetExpStr() ); + aValue.PutString( static_cast(pFld)->GetExpStr() ); // set the new value in Calculator rCalc.VarChange( pFld->GetTyp()->GetName(), aValue ); @@ -108,7 +108,7 @@ namespace { case RES_DBNUMSETFLD: { - SwDBNumSetField* pDBFld = (SwDBNumSetField*)pFld; + SwDBNumSetField* pDBFld = const_cast(static_cast(pFld)); SwDBData aDBData(pDBFld->GetDBData(&rDoc)); @@ -120,7 +120,7 @@ namespace break; case RES_DBNEXTSETFLD: { - SwDBNextSetField* pDBFld = (SwDBNextSetField*)pFld; + SwDBNextSetField* pDBFld = const_cast(static_cast(pFld)); SwDBData aDBData(pDBFld->GetDBData(&rDoc)); if( !pDBFld->IsCondValid() || !pMgr->OpenDataSource( aDBData.sDataSource, aDBData.sCommand )) @@ -174,7 +174,7 @@ SwFieldType* DocumentFieldsManager::InsertFldType(const SwFieldType &rFldTyp) // Or we get doubble number circles!! //MIB 14.03.95: From now on also the SW3-Reader relies on &m_rDoc, when //constructing string pools and when reading SetExp fields - if( nsSwGetSetExpType::GSE_SEQ & ((SwSetExpFieldType&)rFldTyp).GetType() ) + if( nsSwGetSetExpType::GSE_SEQ & static_cast(rFldTyp).GetType() ) i -= INIT_SEQ_FLDTYPES; // no break; case RES_DBFLD: @@ -206,24 +206,24 @@ SwFieldType* DocumentFieldsManager::InsertFldType(const SwFieldType &rFldTyp) switch( nFldWhich ) { case RES_DDEFLD: - ((SwDDEFieldType*)pNew)->SetDoc( &m_rDoc ); + static_cast(pNew)->SetDoc( &m_rDoc ); break; case RES_DBFLD: case RES_TABLEFLD: case RES_DATETIMEFLD: case RES_GETEXPFLD: - ((SwValueFieldType*)pNew)->SetDoc( &m_rDoc ); + static_cast(pNew)->SetDoc( &m_rDoc ); break; case RES_USERFLD: case RES_SETEXPFLD: - ((SwValueFieldType*)pNew)->SetDoc( &m_rDoc ); + static_cast(pNew)->SetDoc( &m_rDoc ); // JP 29.07.96: Optionally prepare FieldList for Calculator: mpUpdtFlds->InsertFldType( *pNew ); break; case RES_AUTHORITY : - ((SwAuthorityFieldType*)pNew)->SetDoc( &m_rDoc ); + static_cast(pNew)->SetDoc( &m_rDoc ); break; } @@ -313,11 +313,11 @@ void DocumentFieldsManager::RemoveFldType(sal_uInt16 nFld) if( pTmp->GetDepends() && !m_rDoc.IsUsed( *pTmp ) ) { if( RES_SETEXPFLD == nWhich ) - ((SwSetExpFieldType*)pTmp)->SetDeleted( true ); + static_cast(pTmp)->SetDeleted( true ); else if( RES_USERFLD == nWhich ) - ((SwUserFieldType*)pTmp)->SetDeleted( true ); + static_cast(pTmp)->SetDeleted( true ); else - ((SwDDEFieldType*)pTmp)->SetDeleted( true ); + static_cast(pTmp)->SetDeleted( true ); nWhich = 0; } break; @@ -440,13 +440,13 @@ void DocumentFieldsManager::InsDeletedFldType( SwFieldType& rFldTyp ) switch( nFldWhich ) { case RES_SETEXPFLD: - ((SwSetExpFieldType&)rFldTyp).SetDeleted( false ); + static_cast(rFldTyp).SetDeleted( false ); break; case RES_USERFLD: - ((SwUserFieldType&)rFldTyp).SetDeleted( false ); + static_cast(rFldTyp).SetDeleted( false ); break; case RES_DDEFLD: - ((SwDDEFieldType&)rFldTyp).SetDeleted( false ); + static_cast(rFldTyp).SetDeleted( false ); break; } } @@ -533,7 +533,7 @@ bool DocumentFieldsManager::UpdateFld(SwTxtFld * pDstTxtFld, SwField & rSrcFld, case RES_DBNEXTSETFLD: case RES_DBNUMSETFLD: case RES_DBSETNUMBERFLD: - m_rDoc.ChgDBData(((SwDBNameInfField*) pNewFld)->GetRealDBData()); + m_rDoc.ChgDBData(static_cast( pNewFld)->GetRealDBData()); pNewFld->GetTyp()->UpdateFlds(); break; @@ -543,7 +543,7 @@ bool DocumentFieldsManager::UpdateFld(SwTxtFld * pDstTxtFld, SwField & rSrcFld, { // JP 10.02.96: call ChgValue, so that the style change sets the // ContentString correctly - SwDBField* pDBFld = (SwDBField*)pNewFld; + SwDBField* pDBFld = static_cast(pNewFld); if (pDBFld->IsInitialized()) pDBFld->ChgValue( pDBFld->GetValue(), true ); @@ -588,14 +588,14 @@ void DocumentFieldsManager::UpdateTblFlds( SfxPoolItem* pHt ) { SwTableFmlUpdate* pUpdtFld = 0; if( pHt && RES_TABLEFML_UPDATE == pHt->Which() ) - pUpdtFld = (SwTableFmlUpdate*)pHt; + pUpdtFld = static_cast(pHt); SwIterator aIter( *pFldType ); for( SwFmtFld* pFmtFld = aIter.First(); pFmtFld; pFmtFld = aIter.Next() ) { if( pFmtFld->GetTxtFld() ) { - SwTblField* pFld = (SwTblField*)pFmtFld->GetField(); + SwTblField* pFld = static_cast(pFmtFld->GetField()); if( pUpdtFld ) { @@ -656,15 +656,15 @@ void DocumentFieldsManager::UpdateTblFlds( SfxPoolItem* pHt ) for (sal_uInt32 i = 0; i < nMaxItems; ++i) { if( 0 != (pItem = m_rDoc.GetAttrPool().GetItem2( RES_BOXATR_FORMULA, i ) ) && - ((SwTblBoxFormula*)pItem)->GetDefinedIn() ) + static_cast(pItem)->GetDefinedIn() ) { - ((SwTblBoxFormula*)pItem)->ChangeState( pHt ); + const_cast(static_cast(pItem))->ChangeState( pHt ); } } // all fields/boxes are now invalid, so we can start to calculate if( pHt && ( RES_TABLEFML_UPDATE != pHt->Which() || - TBL_CALC != ((SwTableFmlUpdate*)pHt)->eFlags )) + TBL_CALC != static_cast(pHt)->eFlags )) return ; SwCalc* pCalc = 0; @@ -680,7 +680,7 @@ void DocumentFieldsManager::UpdateTblFlds( SfxPoolItem* pHt ) // mba: do we really need &m_rDoc "optimization"? Is it still valid? SwTblField* pFld; if( !pFmtFld->GetTxtFld() || (nsSwExtendedSubType::SUB_CMD & - (pFld = (SwTblField*)pFmtFld->GetField())->GetSubType() )) + (pFld = static_cast(pFmtFld->GetField()))->GetSubType() )) continue; // needs to be recalculated @@ -696,7 +696,7 @@ void DocumentFieldsManager::UpdateTblFlds( SfxPoolItem* pHt ) // if &m_rDoc field is not in the to-be-updated table, skip it if( pHt && &pTblNd->GetTable() != - ((SwTableFmlUpdate*)pHt)->pTbl ) + static_cast(pHt)->pTbl ) continue; if( !pCalc ) @@ -751,17 +751,17 @@ void DocumentFieldsManager::UpdateTblFlds( SfxPoolItem* pHt ) for (sal_uInt32 i = 0; i < nMaxItems; ++i ) { if( 0 != (pItem = m_rDoc.GetAttrPool().GetItem2( RES_BOXATR_FORMULA, i ) ) && - ((SwTblBoxFormula*)pItem)->GetDefinedIn() && - !((SwTblBoxFormula*)pItem)->IsValid() ) + static_cast(pItem)->GetDefinedIn() && + !static_cast(pItem)->IsValid() ) { - SwTblBoxFormula* pFml = (SwTblBoxFormula*)pItem; + SwTblBoxFormula* pFml = const_cast(static_cast(pItem)); SwTableBox* pBox = pFml->GetTableBox(); if( pBox && pBox->GetSttNd() && pBox->GetSttNd()->GetNodes().IsDocNodes() ) { const SwTableNode* pTblNd = pBox->GetSttNd()->FindTableNode(); if( !pHt || &pTblNd->GetTable() == - ((SwTableFmlUpdate*)pHt)->pTbl ) + static_cast(pHt)->pTbl ) { double nValue; if( !pCalc ) @@ -869,19 +869,19 @@ void DocumentFieldsManager::UpdateExpFlds( SwTxtFld* pUpdtFld, bool bUpdRefFlds // Entry present? sal_uInt16 nPos; const OUString& rNm = pFldType->GetName(); - OUString sExpand(((SwUserFieldType*)pFldType)->Expand(nsSwGetSetExpType::GSE_STRING, 0, 0)); + OUString sExpand(const_cast(static_cast(pFldType))->Expand(nsSwGetSetExpType::GSE_STRING, 0, 0)); SwHash* pFnd = Find( rNm, pHashStrTbl, nStrFmtCnt, &nPos ); if( pFnd ) // modify entry in the hash table - ((_HashStr*)pFnd)->aSetStr = sExpand; + static_cast<_HashStr*>(pFnd)->aSetStr = sExpand; else // insert the new entry *(pHashStrTbl + nPos ) = new _HashStr( rNm, sExpand, - (_HashStr*)*(pHashStrTbl + nPos) ); + static_cast<_HashStr*>(*(pHashStrTbl + nPos)) ); } break; case RES_SETEXPFLD: - ((SwSetExpFieldType*)pFldType)->SetOutlineChgNd( 0 ); + const_cast(static_cast(pFldType))->SetOutlineChgNd( 0 ); break; } } @@ -961,7 +961,7 @@ void DocumentFieldsManager::UpdateExpFlds( SwTxtFld* pUpdtFld, bool bUpdRefFlds { case RES_HIDDENTXTFLD: { - SwHiddenTxtField* pHFld = (SwHiddenTxtField*)pFld; + SwHiddenTxtField* pHFld = const_cast(static_cast(pFld)); SwSbxValue aValue = aCalc.Calculate( pHFld->GetPar1() ); bool bValue = !aValue.GetBool(); if(!aValue.IsVoidValue()) @@ -974,7 +974,7 @@ void DocumentFieldsManager::UpdateExpFlds( SwTxtFld* pUpdtFld, bool bUpdRefFlds break; case RES_HIDDENPARAFLD: { - SwHiddenParaField* pHPFld = (SwHiddenParaField*)pFld; + SwHiddenParaField* pHPFld = const_cast(static_cast(pFld)); SwSbxValue aValue = aCalc.Calculate( pHPFld->GetPar1() ); bool bValue = aValue.GetBool(); if(!aValue.IsVoidValue()) @@ -984,8 +984,8 @@ void DocumentFieldsManager::UpdateExpFlds( SwTxtFld* pUpdtFld, bool bUpdRefFlds case RES_DBSETNUMBERFLD: #if HAVE_FEATURE_DBCONNECTIVITY { - ((SwDBSetNumberField*)pFld)->Evaluate(&m_rDoc); - aCalc.VarChange( sDBNumNm, ((SwDBSetNumberField*)pFld)->GetSetNumber()); + const_cast(static_cast(pFld))->Evaluate(&m_rDoc); + aCalc.VarChange( sDBNumNm, static_cast(pFld)->GetSetNumber()); } #endif break; @@ -993,7 +993,7 @@ void DocumentFieldsManager::UpdateExpFlds( SwTxtFld* pUpdtFld, bool bUpdRefFlds case RES_DBNUMSETFLD: #if HAVE_FEATURE_DBCONNECTIVITY { - UpdateDBNumFlds( *(SwDBNameInfField*)pFld, aCalc ); + UpdateDBNumFlds( *const_cast(static_cast(pFld)), aCalc ); if( bCanFill ) bCanFill = pMgr->FillCalcWithMergeData( m_rDoc.GetNumberFormatter(), nLang, true, aCalc ); } @@ -1003,9 +1003,9 @@ void DocumentFieldsManager::UpdateExpFlds( SwTxtFld* pUpdtFld, bool bUpdRefFlds { #if HAVE_FEATURE_DBCONNECTIVITY // evaluate field - ((SwDBField*)pFld)->Evaluate(); + const_cast(static_cast(pFld))->Evaluate(); - SwDBData aTmpDBData(((SwDBField*)pFld)->GetDBData()); + SwDBData aTmpDBData(static_cast(pFld)->GetDBData()); if( pMgr->IsDataSourceOpen(aTmpDBData.sDataSource, aTmpDBData.sCommand, false)) aCalc.VarChange( sDBNumNm, pMgr->GetSelectedRecordId(aTmpDBData.sDataSource, aTmpDBData.sCommand, aTmpDBData.nCommandType)); @@ -1038,7 +1038,7 @@ void DocumentFieldsManager::UpdateExpFlds( SwTxtFld* pUpdtFld, bool bUpdRefFlds { if( RES_GETEXPFLD == nWhich ) { - SwGetExpField* pGFld = (SwGetExpField*)pFld; + SwGetExpField* pGFld = const_cast(static_cast(pFld)); if( (!pUpdtFld || pUpdtFld == pTxtFld ) && pGFld->IsInBodyTxt() ) @@ -1050,7 +1050,7 @@ void DocumentFieldsManager::UpdateExpFlds( SwTxtFld* pUpdtFld, bool bUpdRefFlds } else { - SwSetExpField* pSFld = (SwSetExpField*)pFld; + SwSetExpField* pSFld = const_cast(static_cast(pFld)); // is the "formula" a field? aNew = LookString( pHashStrTbl, nStrFmtCnt, pSFld->GetFormula() ); @@ -1063,22 +1063,22 @@ void DocumentFieldsManager::UpdateExpFlds( SwTxtFld* pUpdtFld, bool bUpdRefFlds pSFld->ChgExpStr( aNew ); // lookup the field's name - aNew = ((SwSetExpFieldType*)pSFld->GetTyp())->GetSetRefName(); + aNew = static_cast(pSFld->GetTyp())->GetSetRefName(); // Entry present? sal_uInt16 nPos; SwHash* pFnd = Find( aNew, pHashStrTbl, nStrFmtCnt, &nPos ); if( pFnd ) // Modify entry in the hash table - ((_HashStr*)pFnd)->aSetStr = pSFld->GetExpStr(); + static_cast<_HashStr*>(pFnd)->aSetStr = pSFld->GetExpStr(); else // insert new entry *(pHashStrTbl + nPos ) = pFnd = new _HashStr( aNew, pSFld->GetExpStr(), - (_HashStr*)*(pHashStrTbl + nPos) ); + static_cast<_HashStr*>(*(pHashStrTbl + nPos) )); // Extension for calculation with Strings SwSbxValue aValue; - aValue.PutString( ((_HashStr*)pFnd)->aSetStr ); + aValue.PutString( static_cast<_HashStr*>(pFnd)->aSetStr ); aCalc.VarChange( aNew, aValue ); } } @@ -1086,7 +1086,7 @@ void DocumentFieldsManager::UpdateExpFlds( SwTxtFld* pUpdtFld, bool bUpdRefFlds { if( RES_GETEXPFLD == nWhich ) { - SwGetExpField* pGFld = (SwGetExpField*)pFld; + SwGetExpField* pGFld = const_cast(static_cast(pFld)); if( (!pUpdtFld || pUpdtFld == pTxtFld ) && pGFld->IsInBodyTxt() ) @@ -1099,8 +1099,8 @@ void DocumentFieldsManager::UpdateExpFlds( SwTxtFld* pUpdtFld, bool bUpdRefFlds } else { - SwSetExpField* pSFld = (SwSetExpField*)pFld; - SwSetExpFieldType* pSFldTyp = (SwSetExpFieldType*)pFld->GetTyp(); + SwSetExpField* pSFld = const_cast(static_cast(pFld)); + SwSetExpFieldType* pSFldTyp = static_cast(pFld->GetTyp()); aNew = pSFldTyp->GetName(); SwNode* pSeqNd = 0; @@ -1177,7 +1177,7 @@ void DocumentFieldsManager::UpdateUsrFlds() { if( !pCalc ) pCalc = new SwCalc( m_rDoc ); - ((SwUserFieldType*)pFldType)->GetValue( *pCalc ); + const_cast(static_cast(pFldType))->GetValue( *pCalc ); } if( pCalc ) @@ -1312,11 +1312,11 @@ void DocumentFieldsManager::SetFixFields( bool bOnlyTimeDate, const DateTime* pN switch( aTypes[ nStt ] ) { case RES_DOCINFOFLD: - if( ((SwDocInfoField*)pFmtFld->GetField())->IsFixed() ) + if( static_cast(pFmtFld->GetField())->IsFixed() ) { bChgd = true; - SwDocInfoField* pDocInfFld = (SwDocInfoField*)pFmtFld->GetField(); - pDocInfFld->SetExpansion( ((SwDocInfoFieldType*) + SwDocInfoField* pDocInfFld = static_cast(pFmtFld->GetField()); + pDocInfFld->SetExpansion( static_cast( pDocInfFld->GetTyp())->Expand( pDocInfFld->GetSubType(), pDocInfFld->GetFormat(), @@ -1326,22 +1326,22 @@ void DocumentFieldsManager::SetFixFields( bool bOnlyTimeDate, const DateTime* pN break; case RES_AUTHORFLD: - if( ((SwAuthorField*)pFmtFld->GetField())->IsFixed() ) + if( static_cast(pFmtFld->GetField())->IsFixed() ) { bChgd = true; - SwAuthorField* pAuthorFld = (SwAuthorField*)pFmtFld->GetField(); - pAuthorFld->SetExpansion( ((SwAuthorFieldType*) + SwAuthorField* pAuthorFld = static_cast(pFmtFld->GetField()); + pAuthorFld->SetExpansion( static_cast( pAuthorFld->GetTyp())->Expand( pAuthorFld->GetFormat() ) ); } break; case RES_EXTUSERFLD: - if( ((SwExtUserField*)pFmtFld->GetField())->IsFixed() ) + if( static_cast(pFmtFld->GetField())->IsFixed() ) { bChgd = true; - SwExtUserField* pExtUserFld = (SwExtUserField*)pFmtFld->GetField(); - pExtUserFld->SetExpansion( ((SwExtUserFieldType*) + SwExtUserField* pExtUserFld = static_cast(pFmtFld->GetField()); + pExtUserFld->SetExpansion( static_cast( pExtUserFld->GetTyp())->Expand( pExtUserFld->GetSubType(), pExtUserFld->GetFormat())); @@ -1349,21 +1349,21 @@ void DocumentFieldsManager::SetFixFields( bool bOnlyTimeDate, const DateTime* pN break; case RES_DATETIMEFLD: - if( ((SwDateTimeField*)pFmtFld->GetField())->IsFixed() ) + if( static_cast(pFmtFld->GetField())->IsFixed() ) { bChgd = true; - ((SwDateTimeField*)pFmtFld->GetField())->SetDateTime( + static_cast(pFmtFld->GetField())->SetDateTime( DateTime(Date(nDate), tools::Time(nTime)) ); } break; case RES_FILENAMEFLD: - if( ((SwFileNameField*)pFmtFld->GetField())->IsFixed() ) + if( static_cast(pFmtFld->GetField())->IsFixed() ) { bChgd = true; SwFileNameField* pFileNameFld = - (SwFileNameField*)pFmtFld->GetField(); - pFileNameFld->SetExpansion( ((SwFileNameFieldType*) + static_cast(pFmtFld->GetField()); + pFileNameFld->SetExpansion( static_cast( pFileNameFld->GetTyp())->Expand( pFileNameFld->GetFormat() ) ); } @@ -1466,7 +1466,7 @@ void DocumentFieldsManager::FldsToExpand( SwHash**& ppHashTbl, sal_uInt16& rTblS { // set the new value in the hash table // is the formula a field? - SwSetExpField* pSFld = (SwSetExpField*)pFld; + SwSetExpField* pSFld = const_cast(static_cast(pFld)); OUString aNew = LookString( ppHashTbl, rTblSize, pSFld->GetFormula() ); if( aNew.isEmpty() ) // nothing found, then the formula is @@ -1477,17 +1477,17 @@ void DocumentFieldsManager::FldsToExpand( SwHash**& ppHashTbl, sal_uInt16& rTblS pSFld->ChgExpStr( aNew ); // look up the field's name - aNew = ((SwSetExpFieldType*)pSFld->GetTyp())->GetSetRefName(); + aNew = static_cast(pSFld->GetTyp())->GetSetRefName(); // Entry present? sal_uInt16 nPos; SwHash* pFnd = Find( aNew, ppHashTbl, rTblSize, &nPos ); if( pFnd ) // modify entry in the hash table - ((_HashStr*)pFnd)->aSetStr = pSFld->GetExpStr(); + static_cast<_HashStr*>(pFnd)->aSetStr = pSFld->GetExpStr(); else // insert the new entry *(ppHashTbl + nPos ) = new _HashStr( aNew, - pSFld->GetExpStr(), (_HashStr*)*(ppHashTbl + nPos) ); + pSFld->GetExpStr(), static_cast<_HashStr*>(*(ppHashTbl + nPos)) ); } break; case RES_DBFLD: @@ -1640,17 +1640,17 @@ void DocumentFieldsManager::UpdateDBNumFlds( SwDBNameInfField& rDBFld, SwCalc& r bool bPar1 = rCalc.Calculate( rDBFld.GetPar1() ).GetBool(); if( RES_DBNEXTSETFLD == nFldType ) - ((SwDBNextSetField&)rDBFld).SetCondValid( bPar1 ); + static_cast(rDBFld).SetCondValid( bPar1 ); else - ((SwDBNumSetField&)rDBFld).SetCondValid( bPar1 ); + static_cast(rDBFld).SetCondValid( bPar1 ); if( !rDBFld.GetRealDBData().sDataSource.isEmpty() ) { // Edit a certain database if( RES_DBNEXTSETFLD == nFldType ) - ((SwDBNextSetField&)rDBFld).Evaluate(&m_rDoc); + static_cast(rDBFld).Evaluate(&m_rDoc); else - ((SwDBNumSetField&)rDBFld).Evaluate(&m_rDoc); + static_cast(rDBFld).Evaluate(&m_rDoc); SwDBData aTmpDBData( rDBFld.GetDBData(&m_rDoc) ); diff --git a/sw/source/core/doc/DocumentStateManager.cxx b/sw/source/core/doc/DocumentStateManager.cxx index 699e442bc985..1e55f30d8d0e 100644 --- a/sw/source/core/doc/DocumentStateManager.cxx +++ b/sw/source/core/doc/DocumentStateManager.cxx @@ -50,7 +50,7 @@ void DocumentStateManager::SetModified() if( m_rDoc.GetOle2Link().IsSet() ) { mbInCallModified = true; - m_rDoc.GetOle2Link().Call( (void*)nCall ); + m_rDoc.GetOle2Link().Call( reinterpret_cast(nCall) ); mbInCallModified = false; } @@ -69,7 +69,7 @@ void DocumentStateManager::ResetModified() if( nCall && m_rDoc.GetOle2Link().IsSet() ) { mbInCallModified = true; - m_rDoc.GetOle2Link().Call( (void*)nCall ); + m_rDoc.GetOle2Link().Call( reinterpret_cast(nCall) ); mbInCallModified = false; } } diff --git a/sw/source/core/doc/DocumentStatisticsManager.cxx b/sw/source/core/doc/DocumentStatisticsManager.cxx index 5035ab5dbd03..5017630bb65b 100644 --- a/sw/source/core/doc/DocumentStatisticsManager.cxx +++ b/sw/source/core/doc/DocumentStatisticsManager.cxx @@ -56,7 +56,7 @@ namespace m_aViewWasUnLocked.push_back(pSh); pSh->LockView(true); } - pSh = (SwViewShell*)pSh->GetNext(); + pSh = static_cast(pSh->GetNext()); } while (pSh != m_pViewShell); } ~LockAllViews() diff --git a/sw/source/core/doc/DocumentTimerManager.cxx b/sw/source/core/doc/DocumentTimerManager.cxx index a467521964d7..c9f6c16e52f1 100644 --- a/sw/source/core/doc/DocumentTimerManager.cxx +++ b/sw/source/core/doc/DocumentTimerManager.cxx @@ -97,7 +97,7 @@ IMPL_LINK( DocumentTimerManager, DoIdleJobs, Timer *, pTimer ) pTimer->Start(); return 0; } - pSh = (SwViewShell*)pSh->GetNext(); + pSh = static_cast(pSh->GetNext()); } while( pSh != pStartSh ); if( pTmpRoot->IsNeedGrammarCheck() ) diff --git a/sw/source/core/doc/doccorr.cxx b/sw/source/core/doc/doccorr.cxx index 074eafca4314..3cc38fa1aaa6 100644 --- a/sw/source/core/doc/doccorr.cxx +++ b/sw/source/core/doc/doccorr.cxx @@ -36,7 +36,9 @@ /* * Macros to iterate over all CrsrShells */ -#define PCURSH ((SwCrsrShell*)_pStartShell) + +#define PCURSH_CONST static_cast(_pStartShell) + #define FOREACHSHELL_START( pEShell ) \ {\ SwViewShell const *_pStartShell = pEShell; \ @@ -46,7 +48,12 @@ #define FOREACHSHELL_END( pEShell ) \ } \ - } while((_pStartShell=(SwViewShell const*)_pStartShell->GetNext())!= pEShell ); \ + } while((_pStartShell = static_cast(_pStartShell->GetNext()))!= pEShell ); \ + } + +#define FOREACHSHELL_END_CONST( pEShell ) \ + } \ + } while((_pStartShell = static_cast(_pStartShell->GetNext()))!= pEShell ); \ } namespace @@ -116,21 +123,21 @@ void PaMCorrAbs( const SwPaM& rRange, if( pShell ) { FOREACHSHELL_START( pShell ) - SwPaM *_pStkCrsr = PCURSH->GetStkCrsr(); + SwPaM *_pStkCrsr = PCURSH_CONST->GetStkCrsr(); if( _pStkCrsr ) do { lcl_PaMCorrAbs( *_pStkCrsr, aStart, aEnd, aNewPos ); } while ( (_pStkCrsr != 0 ) && - ((_pStkCrsr=(SwPaM *)_pStkCrsr->GetNext()) != PCURSH->GetStkCrsr()) ); + ((_pStkCrsr = static_cast(_pStkCrsr->GetNext())) != PCURSH_CONST->GetStkCrsr()) ); - FOREACHPAM_START( PCURSH->_GetCrsr() ) - lcl_PaMCorrAbs( *PCURCRSR, aStart, aEnd, aNewPos ); - FOREACHPAM_END() + FOREACHPAM_START_CONST( PCURSH_CONST->_GetCrsr() ) + lcl_PaMCorrAbs( const_cast(*PCURCRSR), aStart, aEnd, aNewPos ); + FOREACHPAM_END_CONST() - if( PCURSH->IsTableMode() ) - lcl_PaMCorrAbs( *PCURSH->GetTblCrs(), aStart, aEnd, aNewPos ); + if( PCURSH_CONST->IsTableMode() ) + lcl_PaMCorrAbs( const_cast(*PCURSH_CONST->GetTblCrs()), aStart, aEnd, aNewPos ); - FOREACHSHELL_END( pShell ) + FOREACHSHELL_END_CONST( pShell ) } { SwUnoCrsrTbl& rTbl = const_cast(pDoc->GetUnoCrsrTbl()); @@ -263,19 +270,19 @@ void PaMCorrRel( const SwNodeIndex &rOldNode, if( pShell ) { FOREACHSHELL_START( pShell ) - SwPaM *_pStkCrsr = PCURSH->GetStkCrsr(); + SwPaM *_pStkCrsr = PCURSH_CONST->GetStkCrsr(); if( _pStkCrsr ) do { lcl_PaMCorrRel1( _pStkCrsr, pOldNode, aNewPos, nCntIdx ); } while ( (_pStkCrsr != 0 ) && - ((_pStkCrsr=(SwPaM *)_pStkCrsr->GetNext()) != PCURSH->GetStkCrsr()) ); + ((_pStkCrsr = static_cast(_pStkCrsr->GetNext())) != PCURSH_CONST->GetStkCrsr()) ); - FOREACHPAM_START( PCURSH->_GetCrsr() ) - lcl_PaMCorrRel1( PCURCRSR, pOldNode, aNewPos, nCntIdx); + FOREACHPAM_START_CONST( PCURSH_CONST->_GetCrsr() ) + lcl_PaMCorrRel1( const_cast(PCURCRSR), pOldNode, aNewPos, nCntIdx); FOREACHPAM_END() - if( PCURSH->IsTableMode() ) - lcl_PaMCorrRel1( PCURSH->GetTblCrs(), pOldNode, aNewPos, nCntIdx ); + if( PCURSH_CONST->IsTableMode() ) + lcl_PaMCorrRel1( const_cast(PCURSH_CONST->GetTblCrs()), pOldNode, aNewPos, nCntIdx ); FOREACHSHELL_END( pShell ) } @@ -334,9 +341,9 @@ SwEditShell const * SwDoc::GetEditShell() const do { if( pCurrentVSh->IsA( TYPE( SwEditShell ) ) ) { - return (SwEditShell*)pCurrentVSh; + return static_cast(pCurrentVSh); } - } while( pFirstVSh != ( pCurrentVSh = (SwViewShell*)pCurrentVSh->GetNext() )); + } while( pFirstVSh != ( pCurrentVSh = static_cast(pCurrentVSh->GetNext()) )); } return 0; } diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx index b7bc4c4523a2..4f5cdce5efb5 100644 --- a/sw/source/core/doc/docdesc.cxx +++ b/sw/source/core/doc/docdesc.cxx @@ -704,12 +704,12 @@ void SwDoc::PrtOLENotify( bool bAll ) SwViewShell *pSh = getIDocumentLayoutAccess().GetCurrentViewShell(); if ( !pSh->ISA(SwFEShell) ) do - { pSh = (SwViewShell*)pSh->GetNext(); + { pSh = static_cast(pSh->GetNext()); } while ( !pSh->ISA(SwFEShell) && pSh != getIDocumentLayoutAccess().GetCurrentViewShell() ); if ( pSh->ISA(SwFEShell) ) - pShell = (SwFEShell*)pSh; + pShell = static_cast(pSh); } if ( !pShell ) { @@ -781,7 +781,7 @@ void SwDoc::PrtOLENotify( bool bAll ) IMPL_LINK( SwDoc, DoUpdateModifiedOLE, Timer *, ) { - SwFEShell* pSh = (SwFEShell*)GetEditShell(); + SwFEShell* pSh = static_cast(GetEditShell()); if( pSh ) { mbOLEPrtNotifyPending = mbAllOLENotify = false; @@ -870,7 +870,7 @@ void SwDoc::SetDefaultPageMode(bool bSquaredPageMode) return; const SwTextGridItem& rGrid = - (const SwTextGridItem&)GetDefault( RES_TEXTGRID ); + static_cast(GetDefault( RES_TEXTGRID )); SwTextGridItem aNewGrid = rGrid; aNewGrid.SetSquaredMode(bSquaredPageMode); aNewGrid.Init(); @@ -883,7 +883,7 @@ void SwDoc::SetDefaultPageMode(bool bSquaredPageMode) SwFrmFmt& rMaster = rDesc.GetMaster(); SwFrmFmt& rLeft = rDesc.GetLeft(); - SwTextGridItem aGrid((SwTextGridItem&)rMaster.GetFmtAttr(RES_TEXTGRID)); + SwTextGridItem aGrid(static_cast(rMaster.GetFmtAttr(RES_TEXTGRID))); aGrid.SwitchPaperMode( bSquaredPageMode ); rMaster.SetFmtAttr(aGrid); rLeft.SetFmtAttr(aGrid); @@ -893,7 +893,7 @@ void SwDoc::SetDefaultPageMode(bool bSquaredPageMode) bool SwDoc::IsSquaredPageMode() const { const SwTextGridItem& rGrid = - (const SwTextGridItem&)GetDefault( RES_TEXTGRID ); + static_cast(GetDefault( RES_TEXTGRID )); return rGrid.IsSquaredMode(); } diff --git a/sw/source/core/doc/docdraw.cxx b/sw/source/core/doc/docdraw.cxx index 178e31d28e1a..67e73415179b 100644 --- a/sw/source/core/doc/docdraw.cxx +++ b/sw/source/core/doc/docdraw.cxx @@ -206,7 +206,7 @@ SwDrawContact* SwDoc::GroupSelection( SdrView& rDrawView ) if( bNoGroup ) { // Revoke anchor attribute. - SwDrawContact *pMyContact = (SwDrawContact*)GetUserCall(pObj); + SwDrawContact *pMyContact = static_cast(GetUserCall(pObj)); const SwFmtAnchor aAnch( pMyContact->GetFmt()->GetAnchor() ); SwUndoDrawGroup *const pUndo = (!GetIDocumentUndoRedo().DoesUndo()) @@ -224,7 +224,7 @@ SwDrawContact* SwDoc::GroupSelection( SdrView& rDrawView ) for( size_t i = 0; i < rMrkList.GetMarkCount(); ++i ) { pObj = rMrkList.GetMark( i )->GetMarkedSdrObj(); - SwDrawContact *pContact = (SwDrawContact*)GetUserCall(pObj); + SwDrawContact *pContact = static_cast(GetUserCall(pObj)); // #i53320# #if OSL_DEBUG_LEVEL > 0 @@ -234,7 +234,7 @@ SwDrawContact* SwDoc::GroupSelection( SdrView& rDrawView ) " - group members have different positioning status!" ); #endif - pFmt = (SwDrawFrmFmt*)pContact->GetFmt(); + pFmt = static_cast(pContact->GetFmt()); // Deletes itself! pContact->Changed(*pObj, SDRUSERCALL_DELETE, pObj->GetLastBoundRect() ); pObj->SetUserCall( 0 ); @@ -322,14 +322,14 @@ void SwDoc::UnGroupSelection( SdrView& rDrawView ) SdrObject *pObj = rMrkList.GetMark( i )->GetMarkedSdrObj(); if ( pObj->IsA( TYPE(SdrObjGroup) ) ) { - SwDrawContact *pContact = (SwDrawContact*)GetUserCall(pObj); + SwDrawContact *pContact = static_cast(GetUserCall(pObj)); SwFmtAnchor aAnch( pContact->GetFmt()->GetAnchor() ); - SdrObjList *pLst = ((SdrObjGroup*)pObj)->GetSubList(); + SdrObjList *pLst = static_cast(pObj)->GetSubList(); SwUndoDrawUnGroup* pUndo = 0; if( bUndo ) { - pUndo = new SwUndoDrawUnGroup( (SdrObjGroup*)pObj ); + pUndo = new SwUndoDrawUnGroup( static_cast(pObj) ); GetIDocumentUndoRedo().AppendUndo(pUndo); } @@ -398,7 +398,7 @@ bool SwDoc::DeleteSelection( SwDrawView& rDrawView ) if( pObj->ISA(SwVirtFlyDrawObj) ) { SwFlyFrmFmt* pFrmFmt = (SwFlyFrmFmt*) - ((SwVirtFlyDrawObj*)pObj)->GetFlyFrm()->GetFmt(); + static_cast(pObj)->GetFlyFrm()->GetFmt(); if( pFrmFmt ) { getIDocumentLayoutAccess().DelLayoutFmt( pFrmFmt ); @@ -412,8 +412,8 @@ bool SwDoc::DeleteSelection( SwDrawView& rDrawView ) SdrObject *pObj = rMrkList.GetMark( i )->GetMarkedSdrObj(); if( !pObj->ISA(SwVirtFlyDrawObj) ) { - SwDrawContact *pC = (SwDrawContact*)GetUserCall(pObj); - SwDrawFrmFmt *pFrmFmt = (SwDrawFrmFmt*)pC->GetFmt(); + SwDrawContact *pC = static_cast(GetUserCall(pObj)); + SwDrawFrmFmt *pFrmFmt = static_cast(pC->GetFmt()); if( pFrmFmt && FLY_AS_CHAR == pFrmFmt->GetAnchor().GetAnchorId() ) { @@ -439,10 +439,10 @@ bool SwDoc::DeleteSelection( SwDrawView& rDrawView ) { const SdrMark& rMark = *rMrkList.GetMark( i ); pObj = rMark.GetMarkedSdrObj(); - SwDrawContact *pContact = (SwDrawContact*)pObj->GetUserCall(); + SwDrawContact *pContact = static_cast(pObj->GetUserCall()); if( pContact ) // of course not for grouped objects { - SwDrawFrmFmt *pFmt = (SwDrawFrmFmt*)pContact->GetFmt(); + SwDrawFrmFmt *pFmt = static_cast(pContact->GetFmt()); // before delete of selection is performed, marked // -objects have to be replaced by its // reference objects. Thus, assert, if a @@ -531,33 +531,33 @@ IMPL_LINK(SwDoc, CalcFieldValueHdl, EditFieldInfo*, pInfo) { // Date field pInfo->SetRepresentation( - ((const SvxDateField*) pField)->GetFormatted( + static_cast( pField)->GetFormatted( *GetNumberFormatter( true ), LANGUAGE_SYSTEM) ); } else if (pField && pField->ISA(SvxURLField)) { // URL field - switch ( ((const SvxURLField*) pField)->GetFormat() ) + switch ( static_cast( pField)->GetFormat() ) { case SVXURLFORMAT_APPDEFAULT: //!!! Can be set in App??? case SVXURLFORMAT_REPR: { pInfo->SetRepresentation( - ((const SvxURLField*)pField)->GetRepresentation()); + static_cast(pField)->GetRepresentation()); } break; case SVXURLFORMAT_URL: { pInfo->SetRepresentation( - ((const SvxURLField*)pField)->GetURL()); + static_cast(pField)->GetURL()); } break; } sal_uInt16 nChrFmt; - if (IsVisitedURL(((const SvxURLField*)pField)->GetURL())) + if (IsVisitedURL(static_cast(pField)->GetURL())) nChrFmt = RES_POOLCHR_INET_VISIT; else nChrFmt = RES_POOLCHR_INET_NORMAL; @@ -579,7 +579,7 @@ IMPL_LINK(SwDoc, CalcFieldValueHdl, EditFieldInfo*, pInfo) { // Time field pInfo->SetRepresentation( - ((const SvxExtTimeField*) pField)->GetFormatted( + static_cast( pField)->GetFormatted( *GetNumberFormatter( true ), LANGUAGE_SYSTEM) ); } else diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx index 4b483f7a0148..f5d863f0a3e5 100644 --- a/sw/source/core/doc/docedt.cxx +++ b/sw/source/core/doc/docedt.cxx @@ -512,14 +512,14 @@ uno::Any SwDoc::Spell( SwPaM& rPaM, switch( pNd->GetNodeType() ) { case ND_TEXTNODE: - if( 0 != ( pCntFrm = ((SwTxtNode*)pNd)->getLayoutFrm( getIDocumentLayoutAccess().GetCurrentLayout() )) ) + if( 0 != ( pCntFrm = static_cast(pNd)->getLayoutFrm( getIDocumentLayoutAccess().GetCurrentLayout() )) ) { // skip protected and hidden Cells and Flys if( pCntFrm->IsProtected() ) { nCurrNd = pNd->EndOfSectionIndex(); } - else if( !((SwTxtFrm*)pCntFrm)->IsHiddenNow() ) + else if( !static_cast(pCntFrm)->IsHiddenNow() ) { if( pPageCnt && *pPageCnt && pPageSt ) { @@ -565,9 +565,9 @@ uno::Any SwDoc::Spell( SwPaM& rPaM, sal_Int32 nSpellErrorPosition = static_cast(pNd)->GetTxt().getLength(); if( (!pConvArgs && - ((SwTxtNode*)pNd)->Spell( pSpellArgs )) || + static_cast(pNd)->Spell( pSpellArgs )) || ( pConvArgs && - ((SwTxtNode*)pNd)->Convert( *pConvArgs ))) + static_cast(pNd)->Convert( *pConvArgs ))) { // Cancel and remember position pSttPos->nNode = nCurrNd; @@ -586,11 +586,11 @@ uno::Any SwDoc::Spell( SwPaM& rPaM, { uno::Reference< lang::XComponent > xDoc( ((SwDocShell*)GetDocShell())->GetBaseModel(), uno::UNO_QUERY ); // Expand the string: - const ModelToViewHelper aConversionMap(*(SwTxtNode*)pNd); + const ModelToViewHelper aConversionMap(*static_cast(pNd)); OUString aExpandText = aConversionMap.getViewText(); // get XFlatParagraph to use... - uno::Reference< text::XFlatParagraph > xFlatPara = new SwXFlatParagraph( *((SwTxtNode*)pNd), aExpandText, aConversionMap ); + uno::Reference< text::XFlatParagraph > xFlatPara = new SwXFlatParagraph( *static_cast(pNd), aExpandText, aConversionMap ); // get error position of cursor in XFlatParagraph linguistic2::ProofreadingResult aResult; @@ -601,7 +601,7 @@ uno::Any SwDoc::Spell( SwPaM& rPaM, aResult = xGCIterator->checkSentenceAtPosition( xDoc, xFlatPara, aExpandText, lang::Locale(), nBeginGrammarCheck, -1, -1 ); - lcl_syncGrammarError( *((SwTxtNode*)pNd), aResult, aConversionMap ); + lcl_syncGrammarError( *static_cast(pNd), aResult, aConversionMap ); // get suggestions to use for the specific error position nGrammarErrors = aResult.aErrors.getLength(); @@ -621,10 +621,10 @@ uno::Any SwDoc::Spell( SwPaM& rPaM, nCurrNd = pNd->GetIndex(); pSttPos->nNode = nCurrNd; pEndPos->nNode = nCurrNd; - pSpellArgs->pStartNode = ((SwTxtNode*)pNd); - pSpellArgs->pEndNode = ((SwTxtNode*)pNd); - pSpellArgs->pStartIdx->Assign(((SwTxtNode*)pNd), aConversionMap.ConvertToModelPosition( rError.nErrorStart ).mnPos ); - pSpellArgs->pEndIdx->Assign(((SwTxtNode*)pNd), aConversionMap.ConvertToModelPosition( rError.nErrorStart + rError.nErrorLength ).mnPos ); + pSpellArgs->pStartNode = static_cast(pNd); + pSpellArgs->pEndNode = static_cast(pNd); + pSpellArgs->pStartIdx->Assign(static_cast(pNd), aConversionMap.ConvertToModelPosition( rError.nErrorStart ).mnPos ); + pSpellArgs->pEndIdx->Assign(static_cast(pNd), aConversionMap.ConvertToModelPosition( rError.nErrorStart + rError.nErrorLength ).mnPos ); nCurrNd = nEndNd; } } @@ -633,8 +633,8 @@ uno::Any SwDoc::Spell( SwPaM& rPaM, } break; case ND_SECTIONNODE: - if( ( ((SwSectionNode*)pNd)->GetSection().IsProtect() || - ((SwSectionNode*)pNd)->GetSection().IsHidden() ) ) + if( ( static_cast(pNd)->GetSection().IsProtect() || + static_cast(pNd)->GetSection().IsHidden() ) ) nCurrNd = pNd->EndOfSectionIndex(); break; case ND_ENDNODE: @@ -741,7 +741,7 @@ static bool lcl_HyphenateNode( const SwNodePtr& rpNd, void* pArgs ) if( pNode ) { SwCntntFrm* pCntFrm = pNode->getLayoutFrm( pNode->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout() ); - if( pCntFrm && !((SwTxtFrm*)pCntFrm)->IsHiddenNow() ) + if( pCntFrm && !static_cast(pCntFrm)->IsHiddenNow() ) { sal_uInt16 *pPageSt = pHyphArgs->GetPageSt(); sal_uInt16 *pPageCnt = pHyphArgs->GetPageCnt(); diff --git a/sw/source/core/doc/docfld.cxx b/sw/source/core/doc/docfld.cxx index 0a340bf045e5..45fa05b5654d 100644 --- a/sw/source/core/doc/docfld.cxx +++ b/sw/source/core/doc/docfld.cxx @@ -189,7 +189,7 @@ void _SetGetExpFld::GetPosOfContent( SwPosition& rPos ) const if( pNd ) { rPos.nNode = *pNd; - rPos.nContent.Assign( (SwCntntNode*)pNd,GetCntPosFromCntnt() ); + rPos.nContent.Assign( const_cast(static_cast(pNd)), GetCntPosFromCntnt() ); } else { @@ -257,8 +257,8 @@ bool _SetGetExpFld::operator<( const _SetGetExpFld& rFld ) const if( pFirst->IsTxtNode() && pNext->IsTxtNode() && ( pFirst->FindFlyStartNode() || pNext->FindFlyStartNode() )) { - return ::IsFrameBehind( *(SwTxtNode*)pNext, nCntnt, - *(SwTxtNode*)pFirst, nCntnt ); + return ::IsFrameBehind( *static_cast(pNext), nCntnt, + *static_cast(pFirst), nCntnt ); } return pFirstStt->GetIndex() < pNextStt->GetIndex(); } @@ -349,7 +349,7 @@ OUString LookString( SwHash** ppTbl, sal_uInt16 nSize, const OUString& rName, { SwHash* pFnd = Find( comphelper::string::strip(rName, ' '), ppTbl, nSize, pPos ); if( pFnd ) - return ((_HashStr*)pFnd)->aSetStr; + return static_cast<_HashStr*>(pFnd)->aSetStr; return OUString(); } @@ -463,7 +463,7 @@ void SwDoc::GetAllUsedDB( std::vector& rDBNameList, if( 0 == (pItem = GetAttrPool().GetItem2( RES_TXTATR_FIELD, n ) )) continue; - const SwFmtFld* pFmtFld = (SwFmtFld*)pItem; + const SwFmtFld* pFmtFld = static_cast(pItem); const SwTxtFld* pTxtFld = pFmtFld->GetTxtFld(); if( !pTxtFld || !pTxtFld->GetTxtNode().GetNodes().IsDocNodes() ) continue; @@ -473,19 +473,19 @@ void SwDoc::GetAllUsedDB( std::vector& rDBNameList, { case RES_DBFLD: AddUsedDBToList( rDBNameList, - lcl_DBDataToString(((SwDBField*)pFld)->GetDBData() )); + lcl_DBDataToString(static_cast(pFld)->GetDBData() )); break; case RES_DBSETNUMBERFLD: case RES_DBNAMEFLD: AddUsedDBToList( rDBNameList, - lcl_DBDataToString(((SwDBNameInfField*)pFld)->GetRealDBData() )); + lcl_DBDataToString(static_cast(pFld)->GetRealDBData() )); break; case RES_DBNUMSETFLD: case RES_DBNEXTSETFLD: AddUsedDBToList( rDBNameList, - lcl_DBDataToString(((SwDBNameInfField*)pFld)->GetRealDBData() )); + lcl_DBDataToString(static_cast(pFld)->GetRealDBData() )); // no break // JP: is that right like that? case RES_HIDDENTXTFLD: @@ -623,7 +623,7 @@ void SwDoc::ChangeDBFields( const std::vector& rOldNames, if( 0 == (pItem = GetAttrPool().GetItem2( RES_TXTATR_FIELD, n ) )) continue; - SwFmtFld* pFmtFld = (SwFmtFld*)pItem; + SwFmtFld* pFmtFld = const_cast(static_cast(pItem)); SwTxtFld* pTxtFld = pFmtFld->GetTxtFld(); if( !pTxtFld || !pTxtFld->GetTxtNode().GetNodes().IsDocNodes() ) continue; @@ -635,18 +635,18 @@ void SwDoc::ChangeDBFields( const std::vector& rOldNames, { case RES_DBFLD: #if HAVE_FEATURE_DBCONNECTIVITY - if( IsNameInArray( rOldNames, lcl_DBDataToString(((SwDBField*)pFld)->GetDBData()))) + if( IsNameInArray( rOldNames, lcl_DBDataToString(static_cast(pFld)->GetDBData()))) { - SwDBFieldType* pOldTyp = (SwDBFieldType*)pFld->GetTyp(); + SwDBFieldType* pOldTyp = static_cast(pFld->GetTyp()); - SwDBFieldType* pTyp = (SwDBFieldType*)getIDocumentFieldsAccess().InsertFldType( - SwDBFieldType(this, pOldTyp->GetColumnName(), aNewDBData)); + SwDBFieldType* pTyp = static_cast(getIDocumentFieldsAccess().InsertFldType( + SwDBFieldType(this, pOldTyp->GetColumnName(), aNewDBData))); pFmtFld->RegisterToFieldType( *pTyp ); pFld->ChgTyp(pTyp); - ((SwDBField*)pFld)->ClearInitialized(); - ((SwDBField*)pFld)->InitContent(); + static_cast(pFld)->ClearInitialized(); + static_cast(pFld)->InitContent(); bExpand = true; } @@ -656,9 +656,9 @@ void SwDoc::ChangeDBFields( const std::vector& rOldNames, case RES_DBSETNUMBERFLD: case RES_DBNAMEFLD: if( IsNameInArray( rOldNames, - lcl_DBDataToString(((SwDBNameInfField*)pFld)->GetRealDBData()))) + lcl_DBDataToString(static_cast(pFld)->GetRealDBData()))) { - ((SwDBNameInfField*)pFld)->SetDBData(aNewDBData); + static_cast(pFld)->SetDBData(aNewDBData); bExpand = true; } break; @@ -666,9 +666,9 @@ void SwDoc::ChangeDBFields( const std::vector& rOldNames, case RES_DBNUMSETFLD: case RES_DBNEXTSETFLD: if( IsNameInArray( rOldNames, - lcl_DBDataToString(((SwDBNameInfField*)pFld)->GetRealDBData()))) + lcl_DBDataToString(static_cast(pFld)->GetRealDBData()))) { - ((SwDBNameInfField*)pFld)->SetDBData(aNewDBData); + static_cast(pFld)->SetDBData(aNewDBData); bExpand = true; } // no break; @@ -764,7 +764,7 @@ void SwDoc::ChangeAuthorityData( const SwAuthEntry* pNewData ) SwFieldType* pFldType = (*getIDocumentFieldsAccess().GetFldTypes())[i]; if( RES_AUTHORITY == pFldType->Which() ) { - SwAuthorityFieldType* pAuthType = (SwAuthorityFieldType*)pFldType; + SwAuthorityFieldType* pAuthType = static_cast(pFldType); pAuthType->ChangeEntryContent(pNewData); break; } @@ -902,7 +902,7 @@ void SwDocUpdtFld::_MakeFldList( SwDoc& rDoc, int eGetMode ) if( 0 == (pItem = rDoc.GetAttrPool().GetItem2( RES_TXTATR_FIELD, n )) ) continue; - const SwFmtFld* pFmtFld = (SwFmtFld*)pItem; + const SwFmtFld* pFmtFld = static_cast(pItem); const SwTxtFld* pTxtFld = pFmtFld->GetTxtFld(); if( !pTxtFld || !pTxtFld->GetTxtNode().GetNodes().IsDocNodes() ) continue; @@ -935,9 +935,9 @@ void SwDocUpdtFld::_MakeFldList( SwDoc& rDoc, int eGetMode ) { sFormula = pFld->GetPar1(); if (sFormula.isEmpty() || sFormula==sFalse) - ((SwHiddenParaField*)pFld)->SetHidden( false ); + const_cast(static_cast(pFld))->SetHidden( false ); else if (sFormula==sTrue) - ((SwHiddenParaField*)pFld)->SetHidden( true ); + const_cast(static_cast(pFld))->SetHidden( true ); else break; @@ -952,16 +952,16 @@ void SwDocUpdtFld::_MakeFldList( SwDoc& rDoc, int eGetMode ) { sFormula = pFld->GetPar1(); if (sFormula.isEmpty() || sFormula==sFalse) - ((SwHiddenTxtField*)pFld)->SetValue( true ); + const_cast(static_cast(pFld))->SetValue( true ); else if (sFormula==sTrue) - ((SwHiddenTxtField*)pFld)->SetValue( false ); + const_cast(static_cast(pFld))->SetValue( false ); else break; sFormula.clear(); // evaluate field - ((SwHiddenTxtField*)pFld)->Evaluate(&rDoc); + const_cast(static_cast(pFld))->Evaluate(&rDoc); // trigger formatting ((SwFmtFld*)pFmtFld)->ModifyNotification( 0, 0 ); } @@ -970,11 +970,11 @@ void SwDocUpdtFld::_MakeFldList( SwDoc& rDoc, int eGetMode ) #if HAVE_FEATURE_DBCONNECTIVITY case RES_DBNUMSETFLD: { - SwDBData aDBData(((SwDBNumSetField*)pFld)->GetDBData(&rDoc)); + SwDBData aDBData(const_cast(static_cast(pFld))->GetDBData(&rDoc)); if ( (bIsDBManager && rDoc.GetDBManager()->OpenDataSource(aDBData.sDataSource, aDBData.sCommand)) && - (GETFLD_ALL == eGetMode || (GETFLD_CALC & eGetMode && ((SwDBNumSetField*)pFld)->IsCondValid())) + (GETFLD_ALL == eGetMode || (GETFLD_CALC & eGetMode && static_cast(pFld)->IsCondValid())) ) { sFormula = pFld->GetPar1(); @@ -983,11 +983,11 @@ void SwDocUpdtFld::_MakeFldList( SwDoc& rDoc, int eGetMode ) break; case RES_DBNEXTSETFLD: { - SwDBData aDBData(((SwDBNextSetField*)pFld)->GetDBData(&rDoc)); + SwDBData aDBData(const_cast(static_cast(pFld))->GetDBData(&rDoc)); if ( (bIsDBManager && rDoc.GetDBManager()->OpenDataSource(aDBData.sDataSource, aDBData.sCommand)) && - (GETFLD_ALL == eGetMode || (GETFLD_CALC & eGetMode && ((SwDBNextSetField*)pFld)->IsCondValid())) + (GETFLD_ALL == eGetMode || (GETFLD_CALC & eGetMode && static_cast(pFld)->IsCondValid())) ) { sFormula = pFld->GetPar1(); @@ -1044,13 +1044,13 @@ void SwDocUpdtFld::GetBodyNode( const SwTxtFld& rTFld, sal_uInt16 nFldWhich ) // always set the BodyTxtFlag in GetExp or DB fields if( RES_GETEXPFLD == nFldWhich ) { - SwGetExpField* pGetFld = (SwGetExpField*)rTFld.GetFmtFld().GetField(); + SwGetExpField* pGetFld = const_cast(static_cast(rTFld.GetFmtFld().GetField())); pGetFld->ChgBodyTxtFlag( bIsInBody ); } #if HAVE_FEATURE_DBCONNECTIVITY else if( RES_DBFLD == nFldWhich ) { - SwDBField* pDBFld = (SwDBField*)rTFld.GetFmtFld().GetField(); + SwDBField* pDBFld = const_cast(static_cast(rTFld.GetFmtFld().GetField())); pDBFld->ChgBodyTxtFlag( bIsInBody ); } #endif @@ -1103,10 +1103,10 @@ void SwDocUpdtFld::InsertFldType( const SwFieldType& rType ) switch( rType.Which() ) { case RES_USERFLD : - sFldName = ((SwUserFieldType&)rType).GetName(); + sFldName = static_cast(rType).GetName(); break; case RES_SETEXPFLD: - sFldName = ((SwSetExpFieldType&)rType).GetName(); + sFldName = static_cast(rType).GetName(); break; default: OSL_ENSURE( false, "kein gueltiger FeldTyp" ); @@ -1136,10 +1136,10 @@ void SwDocUpdtFld::RemoveFldType( const SwFieldType& rType ) switch( rType.Which() ) { case RES_USERFLD : - sFldName = ((SwUserFieldType&)rType).GetName(); + sFldName = static_cast(rType).GetName(); break; case RES_SETEXPFLD: - sFldName = ((SwSetExpFieldType&)rType).GetName(); + sFldName = static_cast(rType).GetName(); break; } @@ -1154,7 +1154,7 @@ void SwDocUpdtFld::RemoveFldType( const SwFieldType& rType ) if( pFnd ) { if( aFldTypeTable[ n ] == pFnd ) - aFldTypeTable[ n ] = (SwCalcFldType*)pFnd->pNext; + aFldTypeTable[ n ] = static_cast(pFnd->pNext); else { SwHash* pPrev = aFldTypeTable[ n ]; diff --git a/sw/source/core/doc/docfly.cxx b/sw/source/core/doc/docfly.cxx index 1cc791c4ba7f..98a0347b0137 100644 --- a/sw/source/core/doc/docfly.cxx +++ b/sw/source/core/doc/docfly.cxx @@ -181,7 +181,7 @@ static Point lcl_FindAnchorLayPos( SwDoc& rDoc, const SwFmtAnchor& rAnch, case FLY_AS_CHAR: if( pFlyFmt && rAnch.GetCntntAnchor() ) { - const SwFrm* pOld = ((SwFlyFrmFmt*)pFlyFmt)->GetFrm( &aRet, false ); + const SwFrm* pOld = static_cast(pFlyFmt)->GetFrm( &aRet, false ); if( pOld ) aRet = pOld->Frm().Pos(); } @@ -202,8 +202,8 @@ static Point lcl_FindAnchorLayPos( SwDoc& rDoc, const SwFmtAnchor& rAnch, case FLY_AT_FLY: // LAYER_IMPL if( rAnch.GetCntntAnchor() ) { - const SwFlyFrmFmt* pFmt = (SwFlyFrmFmt*)rAnch.GetCntntAnchor()-> - nNode.GetNode().GetFlyFmt(); + const SwFlyFrmFmt* pFmt = static_cast(rAnch.GetCntntAnchor()-> + nNode.GetNode().GetFlyFmt()); const SwFrm* pOld = pFmt ? pFmt->GetFrm( &aRet, false ) : 0; if( pOld ) aRet = pOld->Frm().Pos(); @@ -213,9 +213,9 @@ static Point lcl_FindAnchorLayPos( SwDoc& rDoc, const SwFmtAnchor& rAnch, case FLY_AT_PAGE: { sal_uInt16 nPgNum = rAnch.GetPageNum(); - const SwPageFrm *pPage = (SwPageFrm*)rDoc.getIDocumentLayoutAccess().GetCurrentLayout()->Lower(); + const SwPageFrm *pPage = static_cast(rDoc.getIDocumentLayoutAccess().GetCurrentLayout()->Lower()); for( sal_uInt16 i = 1; (i <= nPgNum) && pPage; ++i, - pPage = (const SwPageFrm*)pPage->GetNext() ) + pPage =static_cast(pPage->GetNext()) ) if( i == nPgNum ) { aRet = pPage->Frm().Pos(); @@ -241,7 +241,7 @@ sal_Int8 SwDoc::SetFlyFrmAnchor( SwFrmFmt& rFmt, SfxItemSet& rSet, bool bNewFrms const SwFmtAnchor &rOldAnch = rFmt.GetAnchor(); const RndStdIds nOld = rOldAnch.GetAnchorId(); - SwFmtAnchor aNewAnch( (SwFmtAnchor&)rSet.Get( RES_ANCHOR ) ); + SwFmtAnchor aNewAnch( static_cast(rSet.Get( RES_ANCHOR )) ); RndStdIds nNew = aNewAnch.GetAnchorId(); // Is the new anchor valid? @@ -339,14 +339,14 @@ sal_Int8 SwDoc::SetFlyFrmAnchor( SwFrmFmt& rFmt, SfxItemSet& rSet, bool bNewFrms SwFmtHoriOrient aOldH( rFmt.GetHoriOrient() ); if( text::HoriOrientation::NONE == aOldH.GetHoriOrient() && ( !pItem || - aOldH.GetPos() == ((SwFmtHoriOrient*)pItem)->GetPos() )) + aOldH.GetPos() == static_cast(pItem)->GetPos() )) { SwTwips nPos = (FLY_AS_CHAR == nOld) ? 0 : aOldH.GetPos(); nPos += aOldAnchorPos.getX() - aNewAnchorPos.getX(); if( pItem ) { - SwFmtHoriOrient* pH = (SwFmtHoriOrient*)pItem; + SwFmtHoriOrient* pH = const_cast(static_cast(pItem)); aOldH.SetHoriOrient( pH->GetHoriOrient() ); aOldH.SetRelationOrient( pH->GetRelationOrient() ); } @@ -361,13 +361,13 @@ sal_Int8 SwDoc::SetFlyFrmAnchor( SwFrmFmt& rFmt, SfxItemSet& rSet, bool bNewFrms // #i28922# - correction: compare if( text::VertOrientation::NONE == aOldV.GetVertOrient() && (!pItem || - aOldV.GetPos() == ((SwFmtVertOrient*)pItem)->GetPos() ) ) + aOldV.GetPos() == static_cast(pItem)->GetPos() ) ) { SwTwips nPos = (FLY_AS_CHAR == nOld) ? 0 : aOldV.GetPos(); nPos += aOldAnchorPos.getY() - aNewAnchorPos.getY(); if( pItem ) { - SwFmtVertOrient* pV = (SwFmtVertOrient*)pItem; + SwFmtVertOrient* pV = const_cast(static_cast(pItem)); aOldV.SetVertOrient( pV->GetVertOrient() ); aOldV.SetRelationOrient( pV->GetRelationOrient() ); } @@ -623,7 +623,7 @@ bool SwDoc::SetFrmFmtToFly( SwFrmFmt& rFmt, SwFrmFmt& rNewFmt, const SfxItemSet* pAsk = pSet; if( !pAsk ) pAsk = &rNewFmt.GetAttrSet(); if( SfxItemState::SET == pAsk->GetItemState( RES_ANCHOR, false, &pItem ) - && ((SwFmtAnchor*)pItem)->GetAnchorId() != + && static_cast(pItem)->GetAnchorId() != rFmt.GetAnchor().GetAnchorId() ) { if( pSet ) @@ -752,9 +752,9 @@ bool SwDoc::ChgAnchor( const SdrMarkList& _rMrkList, // allow drawing objects in header/footer pNewAnchorFrm = ::FindAnchor( pOldAnchorFrm, aNewPoint, false ); - if ( pNewAnchorFrm->IsTxtFrm() && ((SwTxtFrm*)pNewAnchorFrm)->IsFollow() ) + if ( pNewAnchorFrm->IsTxtFrm() && static_cast(pNewAnchorFrm)->IsFollow() ) { - pNewAnchorFrm = ((SwTxtFrm*)pNewAnchorFrm)->FindMaster(); + pNewAnchorFrm = static_cast(pNewAnchorFrm)->FindMaster(); } if ( pNewAnchorFrm->IsProtected() ) { @@ -762,7 +762,7 @@ bool SwDoc::ChgAnchor( const SdrMarkList& _rMrkList, } else { - SwPosition aPos( *((SwCntntFrm*)pNewAnchorFrm)->GetNode() ); + SwPosition aPos( *static_cast(pNewAnchorFrm)->GetNode() ); aNewAnch.SetType( _eAnchorType ); aNewAnch.SetAnchor( &aPos ); } @@ -788,7 +788,7 @@ bool SwDoc::ChgAnchor( const SdrMarkList& _rMrkList, pNewAnchorFrm = pTmp->FindFlyFrm(); if( pNewAnchorFrm && !pNewAnchorFrm->IsProtected() ) { - const SwFrmFmt *pTmpFmt = ((SwFlyFrm*)pNewAnchorFrm)->GetFmt(); + const SwFrmFmt *pTmpFmt = static_cast(pNewAnchorFrm)->GetFmt(); const SwFmtCntnt& rCntnt = pTmpFmt->GetCntnt(); SwPosition aPos( *rCntnt.GetCntntIdx() ); aNewAnch.SetAnchor( &aPos ); @@ -806,7 +806,7 @@ bool SwDoc::ChgAnchor( const SdrMarkList& _rMrkList, if ( !pNewAnchorFrm ) continue; - aNewAnch.SetPageNum( ((SwPageFrm*)pNewAnchorFrm)->GetPhyPageNum()); + aNewAnch.SetPageNum( static_cast(pNewAnchorFrm)->GetPhyPageNum()); } break; case FLY_AS_CHAR: @@ -817,7 +817,7 @@ bool SwDoc::ChgAnchor( const SdrMarkList& _rMrkList, pContact->ConnectToLayout(); pOldAnchorFrm = pContact->GetAnchorFrm(); } - ((SwTxtFrm*)pOldAnchorFrm)->Prepare(); + const_cast(static_cast(pOldAnchorFrm))->Prepare(); } else // Change of anchors { @@ -833,7 +833,7 @@ bool SwDoc::ChgAnchor( const SdrMarkList& _rMrkList, Point aPoint( aPt ); aPoint.setX(aPoint.getX() - 1); // Do not load in the DrawObj! aNewAnch.SetType( FLY_AS_CHAR ); - SwPosition aPos( *((SwCntntFrm*)pNewAnchorFrm)->GetNode() ); + SwPosition aPos( *static_cast(pNewAnchorFrm)->GetNode() ); if ( pNewAnchorFrm->Frm().IsInside( aPoint ) ) { // We need to find a TextNode, because only there we can anchor a @@ -844,7 +844,7 @@ bool SwDoc::ChgAnchor( const SdrMarkList& _rMrkList, else { SwCntntNode &rCNd = (SwCntntNode&) - *((SwCntntFrm*)pNewAnchorFrm)->GetNode(); + *static_cast(pNewAnchorFrm)->GetNode(); if ( pNewAnchorFrm->Frm().Bottom() < aPt.Y() ) rCNd.MakeStartIndex( &aPos.nContent ); else @@ -1029,18 +1029,18 @@ int SwDoc::Chain( SwFrmFmt &rSource, const SwFrmFmt &rDest ) { GetIDocumentUndoRedo().StartUndo( UNDO_CHAINE, NULL ); - SwFlyFrmFmt& rDestFmt = (SwFlyFrmFmt&)rDest; + SwFlyFrmFmt& rDestFmt = const_cast(static_cast(rDest)); // Attach Follow to the Master. SwFmtChain aChain = rDestFmt.GetChain(); - aChain.SetPrev( &(SwFlyFrmFmt&)rSource ); + aChain.SetPrev( &static_cast(rSource) ); SetAttr( aChain, rDestFmt ); SfxItemSet aSet( GetAttrPool(), RES_FRM_SIZE, RES_FRM_SIZE, RES_CHAIN, RES_CHAIN, 0 ); // Attach Follow to the Master. - aChain.SetPrev( &(SwFlyFrmFmt&)rSource ); + aChain.SetPrev( &static_cast(rSource) ); SetAttr( aChain, rDestFmt ); // Attach Master to the Follow. diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index 9c3d5d598679..1b465b5845f7 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -138,13 +138,13 @@ static bool lcl_RstAttr( const SwNodePtr& rpNd, void* pArgs ) switch( aSavIds[ n ] ) { case RES_PAGEDESC: - bSave = 0 != ((SwFmtPageDesc*)pItem)->GetPageDesc(); + bSave = 0 != static_cast(pItem)->GetPageDesc(); break; case RES_BREAK: - bSave = SVX_BREAK_NONE != ((SvxFmtBreakItem*)pItem)->GetBreak(); + bSave = SVX_BREAK_NONE != static_cast(pItem)->GetBreak(); break; case RES_PARATR_NUMRULE: - bSave = !((SwNumRuleItem*)pItem)->GetValue().isEmpty(); + bSave = !static_cast(pItem)->GetValue().isEmpty(); break; } if( bSave ) @@ -605,21 +605,21 @@ void SwDoc::SetDefault( const SfxItemSet& rSet ) const SfxPoolItem* pTmpItem; if( ( SfxItemState::SET == aNew.GetItemState( RES_PARATR_TABSTOP, false, &pTmpItem ) ) && - ((SvxTabStopItem*)pTmpItem)->Count() ) + static_cast(pTmpItem)->Count() ) { // Set the default values of all TabStops to the new value. // Attention: we always work with the PoolAttribut here, so that // we don't calculate the same value on the same TabStop (pooled!) for all sets. // We send a FmtChg to modify. - SwTwips nNewWidth = (*(SvxTabStopItem*)pTmpItem)[ 0 ].GetTabPos(), - nOldWidth = ((SvxTabStopItem&)aOld.Get(RES_PARATR_TABSTOP))[ 0 ].GetTabPos(); + SwTwips nNewWidth = (*static_cast(pTmpItem))[ 0 ].GetTabPos(), + nOldWidth = static_cast(aOld.Get(RES_PARATR_TABSTOP))[ 0 ].GetTabPos(); int bChg = sal_False; sal_uInt32 nMaxItems = GetAttrPool().GetItemCount2( RES_PARATR_TABSTOP ); for( sal_uInt32 n = 0; n < nMaxItems; ++n ) if( 0 != (pTmpItem = GetAttrPool().GetItem2( RES_PARATR_TABSTOP, n ) )) bChg |= lcl_SetNewDefTabStops( nOldWidth, nNewWidth, - *(SvxTabStopItem*)pTmpItem ); + *const_cast(static_cast(pTmpItem)) ); aNew.ClearItem( RES_PARATR_TABSTOP ); aOld.ClearItem( RES_PARATR_TABSTOP ); @@ -1129,17 +1129,16 @@ SwFmt* SwDoc::CopyFmt( const SwFmt& rFmt, /// copy the frame format SwFrmFmt* SwDoc::CopyFrmFmt( const SwFrmFmt& rFmt ) { - - return (SwFrmFmt*)CopyFmt( rFmt, *GetFrmFmts(), &SwDoc::_MakeFrmFmt, - *GetDfltFrmFmt() ); + return static_cast(CopyFmt( rFmt, *GetFrmFmts(), &SwDoc::_MakeFrmFmt, + *GetDfltFrmFmt() )); } /// copy the char format SwCharFmt* SwDoc::CopyCharFmt( const SwCharFmt& rFmt ) { - return (SwCharFmt*)CopyFmt( rFmt, *GetCharFmts(), - &SwDoc::_MakeCharFmt, - *GetDfltCharFmt() ); + return static_cast(CopyFmt( rFmt, *GetCharFmts(), + &SwDoc::_MakeCharFmt, + *GetDfltCharFmt() )); } /// copy TextNodes @@ -1152,7 +1151,7 @@ SwTxtFmtColl* SwDoc::CopyTxtColl( const SwTxtFmtColl& rColl ) // search for the "parent" first SwTxtFmtColl* pParent = mpDfltTxtFmtColl; if( pParent != rColl.DerivedFrom() ) - pParent = CopyTxtColl( *(SwTxtFmtColl*)rColl.DerivedFrom() ); + pParent = CopyTxtColl( *static_cast(rColl.DerivedFrom()) ); //FEATURE::CONDCOLL if( RES_CONDTXTFMTCOLL == rColl.Which() ) @@ -1164,8 +1163,8 @@ SwTxtFmtColl* SwDoc::CopyTxtColl( const SwTxtFmtColl& rColl ) getIDocumentState().SetModified(); // copy the conditions - ((SwConditionTxtFmtColl*)pNewColl)->SetConditions( - ((SwConditionTxtFmtColl&)rColl).GetCondColls() ); + static_cast(pNewColl)->SetConditions( + static_cast(rColl).GetCondColls() ); } else //FEATURE::CONDCOLL @@ -1193,7 +1192,7 @@ SwTxtFmtColl* SwDoc::CopyTxtColl( const SwTxtFmtColl& rColl ) false, &pItem )) { const SwNumRule* pRule; - const OUString& rName = ((SwNumRuleItem*)pItem)->GetValue(); + const OUString& rName = static_cast(pItem)->GetValue(); if( !rName.isEmpty() && 0 != ( pRule = rColl.GetDoc()->FindNumRulePtr( rName )) && !pRule->IsAutoRule() ) @@ -1219,7 +1218,7 @@ SwGrfFmtColl* SwDoc::CopyGrfColl( const SwGrfFmtColl& rColl ) // Search for the "parent" first SwGrfFmtColl* pParent = mpDfltGrfFmtColl; if( pParent != rColl.DerivedFrom() ) - pParent = CopyGrfColl( *(SwGrfFmtColl*)rColl.DerivedFrom() ); + pParent = CopyGrfColl( *static_cast(rColl.DerivedFrom()) ); // if not, copy them pNewColl = MakeGrfFmtColl( rColl.GetName(), pParent ); @@ -1265,7 +1264,7 @@ void SwDoc::CopyFmtArr( const SwFmtsBase& rSourceArr, if( 0 == FindFmtByName( rDestArr, pSrc->GetName() ) ) { if( RES_CONDTXTFMTCOLL == pSrc->Which() ) - MakeCondTxtFmtColl( pSrc->GetName(), (SwTxtFmtColl*)&rDfltFmt ); + MakeCondTxtFmtColl( pSrc->GetName(), static_cast(&rDfltFmt) ); else // #i40550# (this->*fnCopyFmt)( pSrc->GetName(), &rDfltFmt, false, true ); @@ -1288,9 +1287,9 @@ void SwDoc::CopyFmtArr( const SwFmtsBase& rSourceArr, if( &GetAttrPool() != pSrc->GetAttrSet().GetPool() && SfxItemState::SET == pSrc->GetAttrSet().GetItemState( RES_PAGEDESC, false, &pItem ) && - ((SwFmtPageDesc*)pItem)->GetPageDesc() ) + static_cast(pItem)->GetPageDesc() ) { - SwFmtPageDesc aPageDesc( *(SwFmtPageDesc*)pItem ); + SwFmtPageDesc aPageDesc( *static_cast(pItem) ); const OUString& rNm = aPageDesc.GetPageDesc()->GetName(); SwPageDesc* pPageDesc = ::lcl_FindPageDesc( maPageDescs, rNm ); if( !pPageDesc ) @@ -1319,11 +1318,11 @@ void SwDoc::CopyFmtArr( const SwFmtsBase& rSourceArr, if( RES_TXTFMTCOLL == pSrc->Which() || RES_CONDTXTFMTCOLL == pSrc->Which() ) { - SwTxtFmtColl* pSrcColl = (SwTxtFmtColl*)pSrc, - * pDstColl = (SwTxtFmtColl*)pDest; + SwTxtFmtColl* pSrcColl = static_cast(pSrc), + * pDstColl = static_cast(pDest); if( &pSrcColl->GetNextTxtFmtColl() != pSrcColl ) - pDstColl->SetNextTxtFmtColl( *(SwTxtFmtColl*)FindFmtByName( - rDestArr, pSrcColl->GetNextTxtFmtColl().GetName() ) ); + pDstColl->SetNextTxtFmtColl( *static_cast(FindFmtByName( + rDestArr, pSrcColl->GetNextTxtFmtColl().GetName() ) ) ); if(pSrcColl->IsAssignedToListLevelOfOutlineStyle()) pDstColl->AssignToListLevelOfOutlineStyle(pSrcColl->GetAssignedOutlineStyleLevel()); @@ -1331,8 +1330,8 @@ void SwDoc::CopyFmtArr( const SwFmtsBase& rSourceArr, //FEATURE::CONDCOLL if( RES_CONDTXTFMTCOLL == pSrc->Which() ) // Copy the conditions, but delete the old ones first! - ((SwConditionTxtFmtColl*)pDstColl)->SetConditions( - ((SwConditionTxtFmtColl*)pSrc)->GetCondColls() ); + static_cast(pDstColl)->SetConditions( + static_cast(pSrc)->GetCondColls() ); //FEATURE::CONDCOLL } } @@ -1353,9 +1352,9 @@ void SwDoc::CopyPageDescHeaderFooterImpl( bool bCpyHeader, SwFrmFmt* pOldFmt; if( bCpyHeader ) - pOldFmt = ((SwFmtHeader*)pNewItem)->GetHeaderFmt(); + pOldFmt = static_cast(pNewItem)->GetHeaderFmt(); else - pOldFmt = ((SwFmtFooter*)pNewItem)->GetFooterFmt(); + pOldFmt = static_cast(pNewItem)->GetFooterFmt(); if( pOldFmt ) { @@ -1366,7 +1365,7 @@ void SwDoc::CopyPageDescHeaderFooterImpl( bool bCpyHeader, if( SfxItemState::SET == pNewFmt->GetAttrSet().GetItemState( RES_CNTNT, false, &pItem )) { - SwFmtCntnt* pCntnt = (SwFmtCntnt*)pItem; + const SwFmtCntnt* pCntnt = static_cast(pItem); if( pCntnt->GetCntntIdx() ) { SwNodeIndex aTmpIdx( GetNodes().GetEndOfAutotext() ); @@ -1387,9 +1386,9 @@ void SwDoc::CopyPageDescHeaderFooterImpl( bool bCpyHeader, pNewFmt->ResetFmtAttr( RES_CNTNT ); } if( bCpyHeader ) - ((SwFmtHeader*)pNewItem)->RegisterToFormat(*pNewFmt); + static_cast(pNewItem)->RegisterToFormat(*pNewFmt); else - ((SwFmtFooter*)pNewItem)->RegisterToFormat(*pNewFmt); + static_cast(pNewItem)->RegisterToFormat(*pNewFmt); rDestFmt.SetFmtAttr( *pNewItem ); } delete pNewItem; @@ -1633,7 +1632,7 @@ void SwDoc::MoveLeftMargin( const SwPaM& rPam, bool bRight, bool bModulus ) GetIDocumentUndoRedo().AppendUndo( pUndo ); } - const SvxTabStopItem& rTabItem = (SvxTabStopItem&)GetDefault( RES_PARATR_TABSTOP ); + const SvxTabStopItem& rTabItem = static_cast(GetDefault( RES_PARATR_TABSTOP )); sal_uInt16 nDefDist = rTabItem.Count() ? static_cast(rTabItem[0].GetTabPos()) : 1134; const SwPosition &rStt = *rPam.Start(), &rEnd = *rPam.End(); @@ -1643,7 +1642,7 @@ void SwDoc::MoveLeftMargin( const SwPaM& rPam, bool bRight, bool bModulus ) SwTxtNode* pTNd = aIdx.GetNode().GetTxtNode(); if( pTNd ) { - SvxLRSpaceItem aLS( (SvxLRSpaceItem&)pTNd->SwCntntNode::GetAttr( RES_LR_SPACE ) ); + SvxLRSpaceItem aLS( static_cast(pTNd->SwCntntNode::GetAttr( RES_LR_SPACE )) ); // #i93873# See also lcl_MergeListLevelIndentAsLRSpaceItem in thints.cxx if ( pTNd->AreListLevelIndentsApplicable() ) @@ -1735,7 +1734,7 @@ SwTblNumFmtMerge::SwTblNumFmtMerge( const SwDoc& rSrc, SwDoc& rDest ) ( pNFmt = rDest.GetNumberFormatter( true ))->MergeFormatter( *pN ); if( &rSrc != &rDest ) - ((SwGetRefFieldType*)rSrc.getIDocumentFieldsAccess().GetSysFldType( RES_GETREFFLD ))-> + static_cast(rSrc.getIDocumentFieldsAccess().GetSysFldType( RES_GETREFFLD ))-> MergeWithOtherDoc( rDest ); } @@ -1950,7 +1949,7 @@ std::vector SwDoc::GetDocColors() case RES_CHRATR_HIGHLIGHT: case RES_BACKGROUND: { - Color aColor( ((SvxColorItem*)pItem)->GetValue() ); + Color aColor( static_cast(pItem)->GetValue() ); if( COL_AUTO != aColor.GetColor() && std::find(docColors.begin(), docColors.end(), aColor) == docColors.end() ) { diff --git a/sw/source/core/doc/docftn.cxx b/sw/source/core/doc/docftn.cxx index e9fbc4e17665..409661950306 100644 --- a/sw/source/core/doc/docftn.cxx +++ b/sw/source/core/doc/docftn.cxx @@ -127,7 +127,7 @@ SwPageDesc *SwEndNoteInfo::GetPageDesc( SwDoc &rDoc ) const pDesc->Add( &((SwClient&)aPageDescDep) ); } - return (SwPageDesc*)( aPageDescDep.GetRegisteredIn() ); + return const_cast(static_cast( aPageDescDep.GetRegisteredIn() )); } bool SwEndNoteInfo::KnowsPageDesc() const @@ -158,7 +158,7 @@ SwCharFmt* SwEndNoteInfo::GetCharFmt(SwDoc &rDoc) const m_bEndNote ? RES_POOLCHR_ENDNOTE : RES_POOLCHR_FOOTNOTE ) ); pFmt->Add( &((SwClient&)aCharFmtDep) ); } - return (SwCharFmt*)aCharFmtDep.GetRegisteredIn(); + return const_cast(static_cast(aCharFmtDep.GetRegisteredIn())); } void SwEndNoteInfo::SetCharFmt( SwCharFmt* pChFmt ) @@ -175,7 +175,7 @@ SwCharFmt* SwEndNoteInfo::GetAnchorCharFmt(SwDoc &rDoc) const m_bEndNote ? RES_POOLCHR_ENDNOTE_ANCHOR : RES_POOLCHR_FOOTNOTE_ANCHOR ) ); pFmt->Add( &((SwClient&)aAnchorCharFmtDep) ); } - return (SwCharFmt*)aAnchorCharFmtDep.GetRegisteredIn(); + return const_cast(static_cast(aAnchorCharFmtDep.GetRegisteredIn())); } void SwEndNoteInfo::SetAnchorCharFmt( SwCharFmt* pChFmt ) @@ -193,9 +193,9 @@ void SwEndNoteInfo::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew ) { SwDoc* pDoc; if( aCharFmtDep.GetRegisteredIn() ) - pDoc = ((SwCharFmt*)aCharFmtDep.GetRegisteredIn())->GetDoc(); + pDoc = static_cast(aCharFmtDep.GetRegisteredIn())->GetDoc(); else - pDoc = ((SwCharFmt*)aAnchorCharFmtDep.GetRegisteredIn())->GetDoc(); + pDoc = static_cast(aAnchorCharFmtDep.GetRegisteredIn())->GetDoc(); SwFtnIdxs& rFtnIdxs = pDoc->GetFtnIdxs(); for( size_t nPos = 0; nPos < rFtnIdxs.size(); ++nPos ) { diff --git a/sw/source/core/doc/docglbl.cxx b/sw/source/core/doc/docglbl.cxx index 598fc3a94c33..2e45d54fd73e 100644 --- a/sw/source/core/doc/docglbl.cxx +++ b/sw/source/core/doc/docglbl.cxx @@ -272,10 +272,10 @@ bool SwDoc::SplitDoc( sal_uInt16 eDocType, const OUString& rPath, bool bOutline, SfxObjectShellLock xDocSh( new SwDocShell( SFX_CREATE_MODE_INTERNAL )); if( xDocSh->DoInitNew( 0 ) ) { - SwDoc* pDoc = ((SwDocShell*)(&xDocSh))->GetDoc(); + SwDoc* pDoc = static_cast(&xDocSh)->GetDoc(); uno::Reference xDPS( - ((SwDocShell*)(&xDocSh))->GetModel(), + static_cast(&xDocSh)->GetModel(), uno::UNO_QUERY_THROW); uno::Reference xDocProps( xDPS->getDocumentProperties()); @@ -294,7 +294,7 @@ bool SwDoc::SplitDoc( sal_uInt16 eDocType, const OUString& rPath, bool bOutline, OUString sTitle( xDocProps->getTitle() ); if (!sTitle.isEmpty()) sTitle += ": "; - sTitle += ((SwTxtNode*)pStartNd)->GetExpandTxt(); + sTitle += static_cast(pStartNd)->GetExpandTxt(); xDocProps->setTitle( sTitle ); // Replace template @@ -398,7 +398,7 @@ bool SwDoc::SplitDoc( sal_uInt16 eDocType, const OUString& rPath, bool bOutline, // set the link in the StartNode SwFmtINetFmt aINet( sFileName , OUString() ); - SwTxtNode* pTNd = (SwTxtNode*)pStartNd; + SwTxtNode* pTNd = static_cast(pStartNd); pTNd->InsertItem(aINet, 0, pTNd->GetTxt().getLength()); // If the link cannot be found anymore, @@ -514,7 +514,7 @@ bool SwDoc::SplitDoc( sal_uInt16 eDocType, const OUString& rPath, bool bOutline, aReq.AppendItem( SfxBoolItem( SID_SAVETO, true ) ); if(pFilter) aReq.AppendItem( SfxStringItem( SID_FILTER_NAME, pFilter->GetName() ) ); - const SfxBoolItem *pRet = (const SfxBoolItem*)mpDocShell->ExecuteSlot( aReq ); + const SfxBoolItem *pRet = static_cast(mpDocShell->ExecuteSlot( aReq )); return pRet && pRet->GetValue(); } diff --git a/sw/source/core/doc/docglos.cxx b/sw/source/core/doc/docglos.cxx index 9b61f83c5e99..51cb97c67bea 100644 --- a/sw/source/core/doc/docglos.cxx +++ b/sw/source/core/doc/docglos.cxx @@ -192,7 +192,7 @@ bool SwDoc::InsertGlossary( SwTextBlocks& rBlock, const OUString& rEntry, aACD.RestoreDontExpandItems( rInsPos ); if( pShell ) pShell->SaveTblBoxCntnt( &rInsPos ); - } while( (_pStartCrsr=(SwPaM *)_pStartCrsr->GetNext()) != + } while( (_pStartCrsr = static_cast(_pStartCrsr->GetNext())) != __pStartCrsr ); GetIDocumentUndoRedo().EndUndo( UNDO_INSGLOSSARY, NULL ); diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx index 4bc37a0153ca..b2f57f6dfcf4 100644 --- a/sw/source/core/doc/doclay.cxx +++ b/sw/source/core/doc/doclay.cxx @@ -131,7 +131,7 @@ SdrObject* SwDoc::CloneSdrObj( const SdrObject& rObj, bool bMoveWithinDoc, if( bMoveWithinDoc && FmFormInventor == pObj->GetObjInventor() ) { // We need to preserve the Name for Controls - uno::Reference< awt::XControlModel > xModel = ((SdrUnoObj*)pObj)->GetUnoControlModel(); + uno::Reference< awt::XControlModel > xModel = static_cast(pObj)->GetUnoControlModel(); uno::Any aVal; uno::Reference< beans::XPropertySet > xSet(xModel, uno::UNO_QUERY); OUString sName("Name"); @@ -355,7 +355,7 @@ SwFlyFrmFmt* SwDoc::MakeFlyAndMove( const SwPaM& rPam, const SfxItemSet& rSet, const SwSelBoxes* pSelBoxes, SwFrmFmt *pParent ) { - SwFmtAnchor& rAnch = (SwFmtAnchor&)rSet.Get( RES_ANCHOR ); + const SwFmtAnchor& rAnch = static_cast(rSet.Get( RES_ANCHOR )); GetIDocumentUndoRedo().StartUndo( UNDO_INSLAYFMT, NULL ); @@ -507,7 +507,7 @@ static bool lcl_TstFlyRange( const SwPaM* pPam, const SwPosition* pFlyPos, (nPamEndContentIndex > nFlyContentIndex ))); } - } while( !bOk && pPam != ( pTmp = (const SwPaM*)pTmp->GetNext() )); + } while( !bOk && pPam != ( pTmp = static_cast(pTmp->GetNext()) )); return bOk; } @@ -548,12 +548,12 @@ SwPosFlyFrms SwDoc::GetAllFlyFmts( const SwPaM* pCmpRange, bool bDrawAlso, return aRetval; } - SwPageFrm *pPage = (SwPageFrm*)getIDocumentLayoutAccess().GetCurrentLayout()->GetLower(); + const SwPageFrm *pPage = static_cast(getIDocumentLayoutAccess().GetCurrentLayout()->GetLower()); while( pPage ) { if( pPage->GetSortedObjs() ) { - SwSortedObjs &rObjs = *pPage->GetSortedObjs(); + const SwSortedObjs &rObjs = *pPage->GetSortedObjs(); for( size_t i = 0; i < rObjs.size(); ++i) { SwAnchoredObject* pAnchoredObj = rObjs[i]; @@ -575,11 +575,11 @@ SwPosFlyFrms SwDoc::GetAllFlyFmts( const SwPaM* pCmpRange, bool bDrawAlso, // Oops! An empty page. // In order not to lose the whole frame (RTF) we // look for the last Cntnt before the page. - SwPageFrm *pPrv = (SwPageFrm*)pPage->GetPrev(); + const SwPageFrm *pPrv = static_cast(pPage->GetPrev()); while ( !pCntntFrm && pPrv ) { pCntntFrm = pPrv->FindFirstBodyCntnt(); - pPrv = (SwPageFrm*)pPrv->GetPrev(); + pPrv = static_cast(pPrv->GetPrev()); } } if ( pCntntFrm ) @@ -590,7 +590,7 @@ SwPosFlyFrms SwDoc::GetAllFlyFmts( const SwPaM* pCmpRange, bool bDrawAlso, } } } - pPage = (SwPageFrm*)pPage->GetNext(); + pPage = static_cast(pPage->GetNext()); } return aRetval; @@ -907,7 +907,7 @@ lcl_InsertLabel(SwDoc & rDoc, SwTxtFmtColls *const pTxtFmtCollTbl, // Insert field if(pType) { - SwSetExpField aFld( (SwSetExpFieldType*)pType, OUString(), SVX_NUM_ARABIC); + SwSetExpField aFld( static_cast(pType), OUString(), SVX_NUM_ARABIC); if( bOrderNumberingFirst ) nIdx = 0; SwFmtFld aFmt( aFld ); @@ -1199,7 +1199,7 @@ lcl_InsertDrawLabel( SwDoc & rDoc, SwTxtFmtColls *const pTxtFmtCollTbl, // insert field if ( pType ) { - SwSetExpField aFld( (SwSetExpFieldType*)pType, OUString(), SVX_NUM_ARABIC ); + SwSetExpField aFld( static_cast(pType), OUString(), SVX_NUM_ARABIC ); if( bOrderNumberingFirst ) nIdx = 0; SwFmtFld aFmt( aFld ); @@ -1240,7 +1240,7 @@ SwFlyFrmFmt* SwDoc::InsertDrawLabel( if (!pContact) return 0; - SwDrawFrmFmt* pOldFmt = (SwDrawFrmFmt *)pContact->GetFmt(); + SwDrawFrmFmt* pOldFmt = static_cast(pContact->GetFmt()); if (!pOldFmt) return 0; @@ -1281,7 +1281,7 @@ IMPL_STATIC_LINK( SwDoc, BackgroundDone, SvxBrushItem*, EMPTYARG ) pSh->LockPaint(); pSh->UnlockPaint( true ); } - pSh = (SwViewShell*)pSh->GetNext(); + pSh = static_cast(pSh->GetNext()); } while( pSh != pStartSh ); return 0; } @@ -1370,10 +1370,10 @@ const SwFlyFrmFmt* SwDoc::FindFlyByName( const OUString& rName, sal_Int8 nNdTyp if( nNdTyp == ND_TEXTNODE ? !pNd->IsNoTxtNode() : nNdTyp == pNd->GetNodeType() ) - return (SwFlyFrmFmt*)pFlyFmt; + return static_cast(pFlyFmt); } else - return (SwFlyFrmFmt*)pFlyFmt; + return static_cast(pFlyFmt); } } return 0; @@ -1621,8 +1621,8 @@ short SwDoc::GetTextDirection( const SwPosition& rPos, } } if( !pItem ) - pItem = (SvxFrameDirectionItem*)&GetAttrPool().GetDefaultItem( - RES_FRAMEDIR ); + pItem = static_cast(&GetAttrPool().GetDefaultItem( + RES_FRAMEDIR )); nRet = pItem->GetValue(); } return nRet; @@ -1646,7 +1646,7 @@ std::set SwDoc::GetAllLayouts() if (pTemp->GetLayout()) { aAllLayouts.insert(pTemp->GetLayout()); - pTemp = (SwViewShell*)pTemp->GetNext(); + pTemp = static_cast(pTemp->GetNext()); } } while(pTemp!=pStart); } diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx index 4cf931b8daba..4797a5bd693f 100644 --- a/sw/source/core/doc/docnum.cxx +++ b/sw/source/core/doc/docnum.cxx @@ -437,7 +437,7 @@ bool SwDoc::MoveOutlinePara( const SwPaM& rPam, short nOffset ) SwNode* pSrch = &aSttRg.GetNode(); if( pSrch->IsTxtNode()) - nOutLineLevel = static_cast(((SwTxtNode*)pSrch)->GetAttrOutlineLevel()-1); + nOutLineLevel = static_cast(static_cast(pSrch)->GetAttrOutlineLevel()-1); SwNode* pEndSrch = &aEndRg.GetNode(); if( !GetNodes().GetOutLineNds().Seek_Entry( pSrch, &nAktPos ) ) { @@ -459,7 +459,7 @@ bool SwDoc::MoveOutlinePara( const SwPaM& rPam, short nOffset ) if( GetNodes().GetOutLineNds().Seek_Entry( pEndSrch, &nTmpPos ) ) { if( !pEndSrch->IsTxtNode() || pEndSrch == pSrch || - nOutLineLevel < ((SwTxtNode*)pEndSrch)->GetAttrOutlineLevel()-1 ) + nOutLineLevel < static_cast(pEndSrch)->GetAttrOutlineLevel()-1 ) ++nTmpPos; // For sub outlines only! } @@ -1390,7 +1390,7 @@ static bool lcl_IsValidPrevNextNumNode( const SwNodeIndex& rIdx ) break; case ND_STARTNODE: - bRet = SwTableBoxStartNode == ((SwStartNode&)rNd).GetStartNodeType(); + bRet = SwTableBoxStartNode == static_cast(rNd).GetStartNodeType(); break; case ND_SECTIONNODE: // that one's valid, so proceed diff --git a/sw/source/core/doc/docredln.cxx b/sw/source/core/doc/docredln.cxx index 0c2d096cdac4..4ee3d9225923 100644 --- a/sw/source/core/doc/docredln.cxx +++ b/sw/source/core/doc/docredln.cxx @@ -638,7 +638,7 @@ void SwRedlineExtraData_FmtColl::Reject( SwPaM& rPam ) const bool SwRedlineExtraData_FmtColl::operator == ( const SwRedlineExtraData& r) const { - const SwRedlineExtraData_FmtColl& rCmp = (SwRedlineExtraData_FmtColl&)r; + const SwRedlineExtraData_FmtColl& rCmp = static_cast(r); return sFmtNm == rCmp.sFmtNm && nPoolId == rCmp.nPoolId && ( ( !pSet && !rCmp.pSet ) || ( pSet && rCmp.pSet && *pSet == *rCmp.pSet ) ); @@ -704,11 +704,11 @@ bool SwRedlineExtraData_Format::operator == ( const SwRedlineExtraData& rCmp ) c { bool nRet = true; size_t nEnd = aWhichIds.size(); - if( nEnd != ((SwRedlineExtraData_Format&)rCmp).aWhichIds.size() ) + if( nEnd != static_cast(rCmp).aWhichIds.size() ) nRet = false; else for( size_t n = 0; n < nEnd; ++n ) - if( ((SwRedlineExtraData_Format&)rCmp).aWhichIds[n] != aWhichIds[n]) + if( static_cast(rCmp).aWhichIds[n] != aWhichIds[n]) { nRet = false; break; @@ -756,7 +756,7 @@ void SwRedlineExtraData_FormattingChanges::Reject( SwPaM& rPam ) const bool SwRedlineExtraData_FormattingChanges::operator == ( const SwRedlineExtraData& rExtraData ) const { - const SwRedlineExtraData_FormattingChanges& rCmp = (SwRedlineExtraData_FormattingChanges&)rExtraData; + const SwRedlineExtraData_FormattingChanges& rCmp = static_cast(rExtraData); if ( !pSet && !rCmp.pSet ) { @@ -1123,9 +1123,9 @@ void SwRangeRedline::MoveToSection() if( pCSttNd || pCEndNd ) { SwTxtFmtColl* pColl = (pCSttNd && pCSttNd->IsTxtNode() ) - ? ((SwTxtNode*)pCSttNd)->GetTxtColl() + ? static_cast(pCSttNd)->GetTxtColl() : (pCEndNd && pCEndNd->IsTxtNode() ) - ? ((SwTxtNode*)pCEndNd)->GetTxtColl() + ? static_cast(pCEndNd)->GetTxtColl() : pDoc->getIDocumentStylePoolAccess().GetTxtCollFromPool( RES_POOLCOLL_STANDARD ); @@ -1193,7 +1193,7 @@ void SwRangeRedline::CopyToSection() if( pCSttNd ) { SwTxtFmtColl* pColl = (pCSttNd && pCSttNd->IsTxtNode() ) - ? ((SwTxtNode*)pCSttNd)->GetTxtColl() + ? static_cast(pCSttNd)->GetTxtColl() : pDoc->getIDocumentStylePoolAccess().GetTxtCollFromPool( RES_POOLCOLL_STANDARD ); @@ -1213,8 +1213,8 @@ void SwRangeRedline::CopyToSection() if( pDestNd ) { if( pDestNd->IsTxtNode() && pCEndNd->IsTxtNode() ) - ((SwTxtNode*)pCEndNd)->CopyCollFmt( - *(SwTxtNode*)pDestNd ); + static_cast(pCEndNd)->CopyCollFmt( + *static_cast(pDestNd) ); else pDestNd->ChgFmtColl( pCEndNd->GetFmtColl() ); } diff --git a/sw/source/core/doc/docruby.cxx b/sw/source/core/doc/docruby.cxx index e32a1b8f95ff..3ea510dea3e9 100644 --- a/sw/source/core/doc/docruby.cxx +++ b/sw/source/core/doc/docruby.cxx @@ -48,7 +48,7 @@ using namespace ::com::sun::star::i18n; sal_uInt16 SwDoc::FillRubyList( const SwPaM& rPam, SwRubyList& rList, sal_uInt16 nMode ) { - const SwPaM *_pStartCrsr = (SwPaM*)rPam.GetNext(), + const SwPaM *_pStartCrsr = static_cast(rPam.GetNext()), *__pStartCrsr = _pStartCrsr; bool bCheckEmpty = &rPam != _pStartCrsr; do { @@ -86,7 +86,7 @@ sal_uInt16 SwDoc::FillRubyList( const SwPaM& rPam, SwRubyList& rList, } while( 30 > rList.size() && *aPam.GetPoint() < *pEnd ); } } while( 30 > rList.size() && - (_pStartCrsr=(SwPaM *)_pStartCrsr->GetNext()) != __pStartCrsr ); + (_pStartCrsr = static_cast(_pStartCrsr->GetNext())) != __pStartCrsr ); return rList.size(); } @@ -100,7 +100,7 @@ sal_uInt16 SwDoc::SetRubyList( const SwPaM& rPam, const SwRubyList& rList, sal_uInt16 nListEntry = 0; - const SwPaM *_pStartCrsr = (SwPaM*)rPam.GetNext(), + const SwPaM *_pStartCrsr = static_cast(rPam.GetNext()), *__pStartCrsr = _pStartCrsr; bool bCheckEmpty = &rPam != _pStartCrsr; do { @@ -173,7 +173,7 @@ sal_uInt16 SwDoc::SetRubyList( const SwPaM& rPam, const SwRubyList& rList, } while( nListEntry < rList.size() && *aPam.GetPoint() < *pEnd ); } } while( 30 > rList.size() && - (_pStartCrsr=(SwPaM *)_pStartCrsr->GetNext()) != __pStartCrsr ); + (_pStartCrsr = static_cast(_pStartCrsr->GetNext())) != __pStartCrsr ); GetIDocumentUndoRedo().EndUndo( UNDO_SETRUBYATTR, NULL ); diff --git a/sw/source/core/doc/docsort.cxx b/sw/source/core/doc/docsort.cxx index 6475c34b7452..7f113a8567bd 100644 --- a/sw/source/core/doc/docsort.cxx +++ b/sw/source/core/doc/docsort.cxx @@ -258,7 +258,7 @@ OUString SwSortBoxElement::GetKey(sal_uInt16 nKey) const const SwNode *pNd = 0, *pEndNd = pMyBox->GetSttNd()->EndOfSectionNode(); for( sal_uLong nIdx = pMyBox->GetSttIdx() + 1; pNd != pEndNd; ++nIdx ) if( ( pNd = pDoc->GetNodes()[ nIdx ])->IsTxtNode() ) - aRetStr += ((SwTxtNode*)pNd)->GetTxt(); + aRetStr += static_cast(pNd)->GetTxt(); } } return aRetStr; diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx index 929e986979b1..fd8f452a0fc4 100644 --- a/sw/source/core/doc/doctxm.cxx +++ b/sw/source/core/doc/doctxm.cxx @@ -87,7 +87,7 @@ sal_uInt16 SwDoc::GetTOIKeys( SwTOIKeyType eTyp, std::vector& rArr ) c const sal_uInt32 nMaxItems = GetAttrPool().GetItemCount2( RES_TXTATR_TOXMARK ); for( sal_uInt32 i = 0; i < nMaxItems; ++i ) { - const SwTOXMark* pItem = (SwTOXMark*)GetAttrPool().GetItem2( RES_TXTATR_TOXMARK, i ); + const SwTOXMark* pItem = static_cast(GetAttrPool().GetItem2( RES_TXTATR_TOXMARK, i )); if( !pItem ) continue; const SwTOXType* pTOXType = pItem->GetTOXType(); @@ -428,8 +428,8 @@ const SwTOXBase* SwDoc::GetCurTOX( const SwPosition& rPos ) const { OSL_ENSURE( pSectNd->GetSection().ISA( SwTOXBaseSection ), "no TOXBaseSection!" ); - SwTOXBaseSection& rTOXSect = (SwTOXBaseSection&) - pSectNd->GetSection(); + const SwTOXBaseSection& rTOXSect = static_cast( + pSectNd->GetSection()); return &rTOXSect; } pSectNd = pSectNd->StartOfSectionNode()->FindSectionNode(); @@ -440,7 +440,7 @@ const SwTOXBase* SwDoc::GetCurTOX( const SwPosition& rPos ) const const SwAttrSet& SwDoc::GetTOXBaseAttrSet(const SwTOXBase& rTOXBase) const { OSL_ENSURE( rTOXBase.ISA( SwTOXBaseSection ), "no TOXBaseSection!" ); - const SwTOXBaseSection& rTOXSect = (const SwTOXBaseSection&)rTOXBase; + const SwTOXBaseSection& rTOXSect = static_cast(rTOXBase); SwSectionFmt* pFmt = rTOXSect.GetFmt(); OSL_ENSURE( pFmt, "invalid TOXBaseSection!" ); return pFmt->GetAttrSet(); @@ -500,7 +500,7 @@ bool SwDoc::DeleteTOX( const SwTOXBase& rTOXBase, bool bDelNodes ) bool bRet = false; OSL_ENSURE( rTOXBase.ISA( SwTOXBaseSection ), "no TOXBaseSection!" ); - const SwTOXBaseSection& rTOXSect = (const SwTOXBaseSection&)rTOXBase; + const SwTOXBaseSection& rTOXSect = static_cast(rTOXBase); SwSectionFmt* pFmt = rTOXSect.GetFmt(); if( pFmt ) { @@ -681,7 +681,7 @@ bool SwDoc::SetTOXBaseName(const SwTOXBase& rTOXBase, const OUString& rName) { OSL_ENSURE( rTOXBase.ISA( SwTOXBaseSection ), "no TOXBaseSection!" ); - SwTOXBaseSection* pTOX = (SwTOXBaseSection*)&rTOXBase; + SwTOXBaseSection* pTOX = const_cast(static_cast(&rTOXBase)); OUString sTmp = GetUniqueTOXBaseName(*rTOXBase.GetTOXType(), rName); bool bRet = sTmp == rName; @@ -1039,7 +1039,7 @@ void SwTOXBaseSection::Update(const SfxItemSet* pAttr, std::set aAllLayouts = pDoc->GetAllLayouts(); for ( std::set::iterator pLayoutIter = aAllLayouts.begin(); pLayoutIter != aAllLayouts.end(); ++pLayoutIter) { - SwFrm::CheckPageDescs( (SwPageFrm*)(*pLayoutIter)->Lower() ); + SwFrm::CheckPageDescs( static_cast((*pLayoutIter)->Lower()) ); } SetProtect( SwTOXBase::IsProtected() ); @@ -1139,7 +1139,7 @@ SwTxtFmtColl* SwTOXBaseSection::GetTxtFmtColl( sal_uInt16 nLevel ) void SwTOXBaseSection::UpdateMarks( const SwTOXInternational& rIntl, const SwTxtNode* pOwnChapterNode ) { - const SwTOXType* pType = (SwTOXType*) SwTOXBase::GetRegisteredIn(); + const SwTOXType* pType = static_cast( SwTOXBase::GetRegisteredIn() ); if( !pType->GetDepends() ) return; @@ -1430,7 +1430,7 @@ void SwTOXBaseSection::UpdateCntnt( SwTOXElement eMyType, break; case nsSwTOXElement::TOX_GRAPHIC: if( pNd->IsGrfNode() ) - pCNd = (SwCntntNode*)pNd; + pCNd = static_cast(pNd); break; case nsSwTOXElement::TOX_OLE: if( pNd->IsOLENode() ) @@ -1457,7 +1457,7 @@ void SwTOXBaseSection::UpdateCntnt( SwTOXElement eMyType, } if(bInclude) - pCNd = (SwCntntNode*)pNd; + pCNd = static_cast(pNd); } break; default: break; @@ -1605,11 +1605,11 @@ void SwTOXBaseSection::UpdatePageNum() OSL_ENSURE( pFrm || pDoc->IsUpdateTOX(), "TOX, no Frame found"); if( !pFrm ) continue; - if( pFrm->IsTxtFrm() && ((SwTxtFrm*)pFrm)->HasFollow() ) + if( pFrm->IsTxtFrm() && static_cast(pFrm)->HasFollow() ) { // find the right one - SwTxtFrm* pNext = (SwTxtFrm*)pFrm; - while( 0 != ( pNext = (SwTxtFrm*)pFrm->GetFollow() ) + SwTxtFrm* pNext = static_cast(pFrm); + while( 0 != ( pNext = static_cast(pFrm->GetFollow()) ) && rTOXSource.nPos >= pNext->GetOfst() ) pFrm = pNext; } -- cgit