diff options
author | Noel Grandin <noel@peralex.com> | 2014-11-10 12:52:41 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-11-10 15:22:17 +0200 |
commit | 36057c3a11deb3a7c3748d7aafd5e6dd08b58984 (patch) | |
tree | 3a707c85eb28ae11e0d0b004928c491fe15d6074 /sw | |
parent | 34966ecb6fb139d49e55796229aa98e27ef8e4b2 (diff) |
loplugin: cstylecast
Change-Id: If7ada4cba0b1098bba304f1ec9b860ec7df75e7a
Diffstat (limited to 'sw')
50 files changed, 180 insertions, 176 deletions
diff --git a/sw/inc/dbfld.hxx b/sw/inc/dbfld.hxx index d9d92f0494a5..28b78b4fda33 100644 --- a/sw/inc/dbfld.hxx +++ b/sw/inc/dbfld.hxx @@ -106,7 +106,7 @@ public: void SetFieldCode(const OUString& rStr) { sFieldCode = rStr; } /// DBName - inline const SwDBData& GetDBData() const { return ((SwDBFieldType*)GetTyp())->GetDBData(); } + inline const SwDBData& GetDBData() const { return static_cast<SwDBFieldType*>(GetTyp())->GetDBData(); } 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/dcontact.hxx b/sw/inc/dcontact.hxx index f141f77c6597..474d334962cd 100644 --- a/sw/inc/dcontact.hxx +++ b/sw/inc/dcontact.hxx @@ -115,9 +115,9 @@ public: virtual SdrObject *GetMaster() = 0; virtual void SetMaster( SdrObject* _pNewMaster ) = 0; - SwFrmFmt *GetFmt(){ return (SwFrmFmt*)GetRegisteredIn(); } + SwFrmFmt *GetFmt() { return static_cast<SwFrmFmt*>(GetRegisteredIn()); } const SwFrmFmt *GetFmt() const - { return (const SwFrmFmt*)GetRegisteredIn(); } + { return static_cast<const SwFrmFmt*>(GetRegisteredIn()); } bool IsInDTOR() const { return mbInDTOR;} diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index 31a538c02544..ba3f5d618c1a 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -43,6 +43,8 @@ #include <com/sun/star/linguistic2/XProofreadingIterator.hpp> #include <com/sun/star/script/vba/XVBAEventProcessor.hpp> #include <tox.hxx> +#include <frmfmt.hxx> +#include <charfmt.hxx> #include <boost/unordered_map.hpp> @@ -826,7 +828,7 @@ public: bool bBroadcast = false, bool bAuto = true); void DelFrmFmt( SwFrmFmt *pFmt, bool bBroadcast = false ); SwFrmFmt* FindFrmFmtByName( const OUString& rName ) const - { return (SwFrmFmt*)FindFmtByName( (SwFmtsBase&)*mpFrmFmtTbl, rName ); } + { return static_cast<SwFrmFmt*>(FindFmtByName( (SwFmtsBase&)*mpFrmFmtTbl, rName )); } SwCharFmt *MakeCharFmt(const OUString &rFmtName, SwCharFmt *pDerivedFrom, bool bBroadcast = false, @@ -834,7 +836,7 @@ public: void DelCharFmt(sal_uInt16 nFmt, bool bBroadcast = false); void DelCharFmt(SwCharFmt* pFmt, bool bBroadcast = false); SwCharFmt* FindCharFmtByName( const OUString& rName ) const - { return (SwCharFmt*)FindFmtByName( (SwFmtsBase&)*mpCharFmtTbl, rName ); } + { return static_cast<SwCharFmt*>(FindFmtByName( (SwFmtsBase&)*mpCharFmtTbl, rName )); } // Formatcollections (styles) // TXT diff --git a/sw/inc/docufld.hxx b/sw/inc/docufld.hxx index a70c885f63dd..0f44505f672a 100644 --- a/sw/inc/docufld.hxx +++ b/sw/inc/docufld.hxx @@ -658,7 +658,7 @@ public: virtual void SetPar2(const OUString& rStr) SAL_OVERRIDE; SwCharFmt* GetCharFmt() const - { return ((SwJumpEditFieldType*)GetTyp())->GetCharFmt(); } + { return static_cast<SwJumpEditFieldType*>(GetTyp())->GetCharFmt(); } 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/editsh.hxx b/sw/inc/editsh.hxx index aef99cae0ea9..8221ff46ab99 100644 --- a/sw/inc/editsh.hxx +++ b/sw/inc/editsh.hxx @@ -34,6 +34,7 @@ #include <IMark.hxx> #include <tox.hxx> #include <frmfmt.hxx> +#include <charfmt.hxx> #include <vector> #include <set> @@ -360,7 +361,7 @@ public: SwFrmFmt* GetFrmFmtFromPool( sal_uInt16 nId ) { return static_cast<SwFrmFmt*>(SwEditShell::GetFmtFromPool( nId )); } SwCharFmt* GetCharFmtFromPool( sal_uInt16 nId ) - { return (SwCharFmt*)SwEditShell::GetFmtFromPool( nId ); } + { return static_cast<SwCharFmt*>(SwEditShell::GetFmtFromPool( nId )); } void Insert2(SwField&, const bool bForceExpandHints = false); diff --git a/sw/inc/expfld.hxx b/sw/inc/expfld.hxx index ac04f540eff4..5a3222313d16 100644 --- a/sw/inc/expfld.hxx +++ b/sw/inc/expfld.hxx @@ -278,7 +278,7 @@ inline bool SwSetExpField::GetInputFlag() const { return bInput; } inline bool SwSetExpField::IsSequenceFld() const - { return 0 != (nsSwGetSetExpType::GSE_SEQ & ((SwSetExpFieldType*)GetTyp())->GetType()); } + { return 0 != (nsSwGetSetExpType::GSE_SEQ & static_cast<SwSetExpFieldType*>(GetTyp())->GetType()); } class SwInputFieldType : public SwFieldType { diff --git a/sw/inc/fchrfmt.hxx b/sw/inc/fchrfmt.hxx index 4e70c617d986..40c259b7675e 100644 --- a/sw/inc/fchrfmt.hxx +++ b/sw/inc/fchrfmt.hxx @@ -22,8 +22,8 @@ #include <svl/poolitem.hxx> #include <calbck.hxx> #include <format.hxx> +#include <charfmt.hxx> -class SwCharFmt; class SwTxtCharFmt; class IntlWrapper; @@ -66,7 +66,7 @@ public: virtual bool GetInfo( SfxPoolItem& rInfo ) const SAL_OVERRIDE; void SetCharFmt( SwFmt* pFmt ) { pFmt->Add(this); } - SwCharFmt* GetCharFmt() const { return (SwCharFmt*)GetRegisteredIn(); } + SwCharFmt* GetCharFmt() const { return const_cast<SwCharFmt*>(static_cast<const SwCharFmt*>(GetRegisteredIn())); } }; #endif diff --git a/sw/inc/fldbas.hxx b/sw/inc/fldbas.hxx index f6893e8ed700..57780e9671e4 100644 --- a/sw/inc/fldbas.hxx +++ b/sw/inc/fldbas.hxx @@ -414,13 +414,13 @@ public: virtual SwFieldType* ChgTyp( SwFieldType* ) SAL_OVERRIDE; virtual void SetLanguage(sal_uInt16 nLng) SAL_OVERRIDE; - inline SwDoc* GetDoc() const { return ((SwValueFieldType*)GetTyp())->GetDoc(); } + inline SwDoc* GetDoc() const { return const_cast<SwValueFieldType*>(static_cast<const SwValueFieldType*>(GetTyp()))->GetDoc(); } virtual double GetValue() const; virtual void SetValue( const double& rVal ); inline OUString ExpandValue(const double& rVal, sal_uInt32 nFmt, sal_uInt16 nLng=0) const - { return ((SwValueFieldType*)GetTyp())->ExpandValue(rVal, nFmt, nLng); } + { return static_cast<SwValueFieldType*>(GetTyp())->ExpandValue(rVal, nFmt, nLng); } static sal_uInt32 GetSystemFormat(SvNumberFormatter* pFormatter, sal_uInt32 nFmt); }; diff --git a/sw/inc/fmtclbl.hxx b/sw/inc/fmtclbl.hxx index a5243630b181..f6eb91e64bac 100644 --- a/sw/inc/fmtclbl.hxx +++ b/sw/inc/fmtclbl.hxx @@ -36,7 +36,7 @@ public: }; inline const SwFmtNoBalancedColumns &SwAttrSet::GetBalancedColumns(bool bInP) const - { return (const SwFmtNoBalancedColumns&)Get( RES_COLUMNBALANCE, bInP ); } + { return static_cast<const SwFmtNoBalancedColumns&>(Get( RES_COLUMNBALANCE, bInP )); } inline const SwFmtNoBalancedColumns &SwFmt::GetBalancedColumns(bool bInP) const { return aSet.GetBalancedColumns( bInP ); } diff --git a/sw/inc/fmtcntnt.hxx b/sw/inc/fmtcntnt.hxx index c56011c744b6..c4efe4f7989c 100644 --- a/sw/inc/fmtcntnt.hxx +++ b/sw/inc/fmtcntnt.hxx @@ -47,7 +47,7 @@ public: }; inline const SwFmtCntnt &SwAttrSet::GetCntnt(bool bInP) const - { return (const SwFmtCntnt&)Get( RES_CNTNT,bInP); } + { return static_cast<const SwFmtCntnt&>(Get( RES_CNTNT,bInP)); } inline const SwFmtCntnt &SwFmt::GetCntnt(bool bInP) const { return aSet.GetCntnt(bInP); } diff --git a/sw/inc/fmteiro.hxx b/sw/inc/fmteiro.hxx index f7f4b25d0fba..4be9b7a86af2 100644 --- a/sw/inc/fmteiro.hxx +++ b/sw/inc/fmteiro.hxx @@ -42,7 +42,7 @@ public: }; inline const SwFmtEditInReadonly &SwAttrSet::GetEditInReadonly(bool bInP) const - { return (const SwFmtEditInReadonly&)Get( RES_EDIT_IN_READONLY,bInP); } + { return static_cast<const SwFmtEditInReadonly&>(Get( RES_EDIT_IN_READONLY,bInP)); } inline const SwFmtEditInReadonly &SwFmt::GetEditInReadonly(bool bInP) const { return aSet.GetEditInReadonly(bInP); } diff --git a/sw/inc/fmtfollowtextflow.hxx b/sw/inc/fmtfollowtextflow.hxx index 47913c8a246e..a0dcf6e55e26 100644 --- a/sw/inc/fmtfollowtextflow.hxx +++ b/sw/inc/fmtfollowtextflow.hxx @@ -44,7 +44,7 @@ public: }; inline const SwFmtFollowTextFlow &SwAttrSet::GetFollowTextFlow(bool bInP) const - { return (const SwFmtFollowTextFlow&)Get( RES_FOLLOW_TEXT_FLOW, bInP ); } + { return static_cast<const SwFmtFollowTextFlow&>(Get( RES_FOLLOW_TEXT_FLOW, bInP )); } inline const SwFmtFollowTextFlow &SwFmt::GetFollowTextFlow(bool bInP) const { return aSet.GetFollowTextFlow( bInP ); } diff --git a/sw/inc/fmtfordr.hxx b/sw/inc/fmtfordr.hxx index a29d3c06ded8..8c79327d9b88 100644 --- a/sw/inc/fmtfordr.hxx +++ b/sw/inc/fmtfordr.hxx @@ -53,7 +53,7 @@ inline SwFmtFillOrder &SwFmtFillOrder::operator=( const SwFmtFillOrder &rCpy ) } inline const SwFmtFillOrder &SwAttrSet::GetFillOrder(bool bInP) const - { return (const SwFmtFillOrder&)Get( RES_FILL_ORDER,bInP); } + { return static_cast<const SwFmtFillOrder&>(Get( RES_FILL_ORDER,bInP)); } inline const SwFmtFillOrder &SwFmt::GetFillOrder(bool bInP) const { return aSet.GetFillOrder(bInP); } diff --git a/sw/inc/fmtfsize.hxx b/sw/inc/fmtfsize.hxx index e80bd43680af..6bb75daa1073 100644 --- a/sw/inc/fmtfsize.hxx +++ b/sw/inc/fmtfsize.hxx @@ -100,7 +100,7 @@ public: }; inline const SwFmtFrmSize &SwAttrSet::GetFrmSize(bool bInP) const - { return (const SwFmtFrmSize&)Get( RES_FRM_SIZE,bInP); } + { return static_cast<const SwFmtFrmSize&>(Get( RES_FRM_SIZE,bInP)); } inline const SwFmtFrmSize &SwFmt::GetFrmSize(bool bInP) const { return aSet.GetFrmSize(bInP); } diff --git a/sw/inc/fmtftntx.hxx b/sw/inc/fmtftntx.hxx index 04016b338e3c..f2590d139597 100644 --- a/sw/inc/fmtftntx.hxx +++ b/sw/inc/fmtftntx.hxx @@ -107,9 +107,9 @@ public: }; inline const SwFmtFtnAtTxtEnd &SwAttrSet::GetFtnAtTxtEnd(bool bInP) const - { return (const SwFmtFtnAtTxtEnd&)Get( RES_FTN_AT_TXTEND, bInP); } + { return static_cast<const SwFmtFtnAtTxtEnd&>(Get( RES_FTN_AT_TXTEND, bInP)); } inline const SwFmtEndAtTxtEnd &SwAttrSet::GetEndAtTxtEnd(bool bInP) const - { return (const SwFmtEndAtTxtEnd&)Get( RES_END_AT_TXTEND, bInP); } + { return static_cast<const SwFmtEndAtTxtEnd&>(Get( RES_END_AT_TXTEND, bInP)); } inline const SwFmtFtnAtTxtEnd &SwFmt::GetFtnAtTxtEnd(bool bInP) const { return aSet.GetFtnAtTxtEnd(bInP); } diff --git a/sw/inc/fmtline.hxx b/sw/inc/fmtline.hxx index 9b1a795b1f58..cd5d85e3d605 100644 --- a/sw/inc/fmtline.hxx +++ b/sw/inc/fmtline.hxx @@ -56,7 +56,7 @@ public: }; inline const SwFmtLineNumber &SwAttrSet::GetLineNumber(bool bInP) const - { return (const SwFmtLineNumber&)Get( RES_LINENUMBER,bInP); } + { return static_cast<const SwFmtLineNumber&>(Get( RES_LINENUMBER,bInP)); } #endif diff --git a/sw/inc/fmtlsplt.hxx b/sw/inc/fmtlsplt.hxx index c16c72afce5f..3abe26f429b9 100644 --- a/sw/inc/fmtlsplt.hxx +++ b/sw/inc/fmtlsplt.hxx @@ -41,7 +41,7 @@ public: }; inline const SwFmtLayoutSplit &SwAttrSet::GetLayoutSplit(bool bInP) const - { return (const SwFmtLayoutSplit&)Get( RES_LAYOUT_SPLIT,bInP); } + { return static_cast<const SwFmtLayoutSplit&>(Get( RES_LAYOUT_SPLIT,bInP)); } inline const SwFmtLayoutSplit &SwFmt::GetLayoutSplit(bool bInP) const { return aSet.GetLayoutSplit(bInP); } diff --git a/sw/inc/fmtmeta.hxx b/sw/inc/fmtmeta.hxx index 0bcf9cebca20..d79a5808b16e 100644 --- a/sw/inc/fmtmeta.hxx +++ b/sw/inc/fmtmeta.hxx @@ -77,8 +77,10 @@ namespace com { namespace sun { namespace star { class SwTxtMeta; class SwXMeta; class SwXMetaField; +class SwTxtNode; namespace sw { class Meta; + class MetaFieldManager; } class SwFmtMeta @@ -118,8 +120,6 @@ public: namespace sw { -class MetaFieldManager; - class Meta : public ::sfx2::Metadatable , public SwModify diff --git a/sw/inc/fmtornt.hxx b/sw/inc/fmtornt.hxx index b267d8f08160..17b08e8b12eb 100644 --- a/sw/inc/fmtornt.hxx +++ b/sw/inc/fmtornt.hxx @@ -116,9 +116,9 @@ inline SwFmtHoriOrient &SwFmtHoriOrient::operator=( const SwFmtHoriOrient &rCpy } inline const SwFmtVertOrient &SwAttrSet::GetVertOrient(bool bInP) const - { return (const SwFmtVertOrient&)Get( RES_VERT_ORIENT,bInP); } + { return static_cast<const SwFmtVertOrient&>(Get( RES_VERT_ORIENT,bInP)); } inline const SwFmtHoriOrient &SwAttrSet::GetHoriOrient(bool bInP) const - { return (const SwFmtHoriOrient&)Get( RES_HORI_ORIENT,bInP); } + { return static_cast<const SwFmtHoriOrient&>(Get( RES_HORI_ORIENT,bInP)); } inline const SwFmtVertOrient &SwFmt::GetVertOrient(bool bInP) const { return aSet.GetVertOrient(bInP); } diff --git a/sw/inc/fmtpdsc.hxx b/sw/inc/fmtpdsc.hxx index 9b7f9a508129..f095978a28bd 100644 --- a/sw/inc/fmtpdsc.hxx +++ b/sw/inc/fmtpdsc.hxx @@ -83,7 +83,7 @@ public: }; inline const SwFmtPageDesc &SwAttrSet::GetPageDesc(bool bInP) const - { return (const SwFmtPageDesc&)Get( RES_PAGEDESC,bInP); } + { return static_cast<const SwFmtPageDesc&>(Get( RES_PAGEDESC,bInP)); } inline const SwFmtPageDesc &SwFmt::GetPageDesc(bool bInP) const { return aSet.GetPageDesc(bInP); } diff --git a/sw/inc/fmtrowsplt.hxx b/sw/inc/fmtrowsplt.hxx index f5fa372b28cc..c9905276d1c7 100644 --- a/sw/inc/fmtrowsplt.hxx +++ b/sw/inc/fmtrowsplt.hxx @@ -41,7 +41,7 @@ public: }; inline const SwFmtRowSplit &SwAttrSet::GetRowSplit(bool bInP) const - { return (const SwFmtRowSplit&)Get( RES_ROW_SPLIT,bInP); } + { return static_cast<const SwFmtRowSplit&>(Get( RES_ROW_SPLIT,bInP)); } inline const SwFmtRowSplit &SwFmt::GetRowSplit(bool bInP) const { return aSet.GetRowSplit(bInP); } diff --git a/sw/inc/fmtsrnd.hxx b/sw/inc/fmtsrnd.hxx index 4b27127141b1..123717f7bdfe 100644 --- a/sw/inc/fmtsrnd.hxx +++ b/sw/inc/fmtsrnd.hxx @@ -70,7 +70,7 @@ inline SwFmtSurround &SwFmtSurround::operator=( const SwFmtSurround &rCpy ) } inline const SwFmtSurround &SwAttrSet::GetSurround(bool bInP) const - { return (const SwFmtSurround&)Get( RES_SURROUND,bInP); } + { return static_cast<const SwFmtSurround&>(Get( RES_SURROUND,bInP)); } inline const SwFmtSurround &SwFmt::GetSurround(bool bInP) const { return aSet.GetSurround(bInP); } diff --git a/sw/inc/fmturl.hxx b/sw/inc/fmturl.hxx index 3f12aba99e83..55a09ac0dc23 100644 --- a/sw/inc/fmturl.hxx +++ b/sw/inc/fmturl.hxx @@ -74,7 +74,7 @@ public: }; inline const SwFmtURL &SwAttrSet::GetURL(bool bInP) const - { return (const SwFmtURL&)Get( RES_URL,bInP); } + { return static_cast<const SwFmtURL&>(Get( RES_URL,bInP)); } inline const SwFmtURL &SwFmt::GetURL(bool bInP) const { return aSet.GetURL(bInP); } diff --git a/sw/inc/fmtwrapinfluenceonobjpos.hxx b/sw/inc/fmtwrapinfluenceonobjpos.hxx index de88d4b4453a..046f09d6a4f5 100644 --- a/sw/inc/fmtwrapinfluenceonobjpos.hxx +++ b/sw/inc/fmtwrapinfluenceonobjpos.hxx @@ -59,7 +59,7 @@ public: }; inline const SwFmtWrapInfluenceOnObjPos& SwAttrSet::GetWrapInfluenceOnObjPos(bool bInP) const - { return (const SwFmtWrapInfluenceOnObjPos&)Get( RES_WRAP_INFLUENCE_ON_OBJPOS,bInP); } + { return static_cast<const SwFmtWrapInfluenceOnObjPos&>(Get( RES_WRAP_INFLUENCE_ON_OBJPOS,bInP)); } inline const SwFmtWrapInfluenceOnObjPos& SwFmt::GetWrapInfluenceOnObjPos(bool bInP) const { return aSet.GetWrapInfluenceOnObjPos(bInP); } diff --git a/sw/inc/grfatr.hxx b/sw/inc/grfatr.hxx index cbd745a96172..8ae55092cfa4 100644 --- a/sw/inc/grfatr.hxx +++ b/sw/inc/grfatr.hxx @@ -290,29 +290,29 @@ public: // Implementation of graphics attributes methods of SwAttr inline const SwMirrorGrf &SwAttrSet::GetMirrorGrf(bool bInP) const - { return (const SwMirrorGrf&)Get( RES_GRFATR_MIRRORGRF,bInP); } + { return static_cast<const SwMirrorGrf&>(Get( RES_GRFATR_MIRRORGRF,bInP)); } inline const SwCropGrf &SwAttrSet::GetCropGrf(bool bInP) const - { return (const SwCropGrf&)Get( RES_GRFATR_CROPGRF,bInP); } + { return static_cast<const SwCropGrf&>(Get( RES_GRFATR_CROPGRF,bInP)); } inline const SwRotationGrf &SwAttrSet::GetRotationGrf(bool bInP) const - { return (const SwRotationGrf&)Get( RES_GRFATR_ROTATION,bInP); } + { return static_cast<const SwRotationGrf&>(Get( RES_GRFATR_ROTATION,bInP)); } inline const SwLuminanceGrf &SwAttrSet::GetLuminanceGrf(bool bInP) const - { return (const SwLuminanceGrf&)Get( RES_GRFATR_LUMINANCE,bInP); } + { return static_cast<const SwLuminanceGrf&>(Get( RES_GRFATR_LUMINANCE,bInP)); } inline const SwContrastGrf &SwAttrSet::GetContrastGrf(bool bInP) const - { return (const SwContrastGrf&)Get( RES_GRFATR_CONTRAST,bInP); } + { return static_cast<const SwContrastGrf&>(Get( RES_GRFATR_CONTRAST,bInP)); } inline const SwChannelRGrf &SwAttrSet::GetChannelRGrf(bool bInP) const - { return (const SwChannelRGrf&)Get( RES_GRFATR_CHANNELR,bInP); } + { return static_cast<const SwChannelRGrf&>(Get( RES_GRFATR_CHANNELR,bInP)); } inline const SwChannelGGrf &SwAttrSet::GetChannelGGrf(bool bInP) const - { return (const SwChannelGGrf&)Get( RES_GRFATR_CHANNELG,bInP); } + { return static_cast<const SwChannelGGrf&>(Get( RES_GRFATR_CHANNELG,bInP)); } inline const SwChannelBGrf &SwAttrSet::GetChannelBGrf(bool bInP) const - { return (const SwChannelBGrf&)Get( RES_GRFATR_CHANNELB,bInP); } + { return static_cast<const SwChannelBGrf&>(Get( RES_GRFATR_CHANNELB,bInP)); } inline const SwGammaGrf &SwAttrSet::GetGammaGrf(bool bInP) const - { return (const SwGammaGrf&)Get( RES_GRFATR_GAMMA,bInP); } + { return static_cast<const SwGammaGrf&>(Get( RES_GRFATR_GAMMA,bInP)); } inline const SwInvertGrf &SwAttrSet::GetInvertGrf(bool bInP) const - { return (const SwInvertGrf&)Get( RES_GRFATR_INVERT,bInP); } + { return static_cast<const SwInvertGrf&>(Get( RES_GRFATR_INVERT,bInP)); } inline const SwTransparencyGrf &SwAttrSet::GetTransparencyGrf(bool bInP) const - { return (const SwTransparencyGrf&)Get( RES_GRFATR_TRANSPARENCY,bInP); } + { return static_cast<const SwTransparencyGrf&>(Get( RES_GRFATR_TRANSPARENCY,bInP)); } inline const SwDrawModeGrf &SwAttrSet::GetDrawModeGrf(bool bInP) const - { return (const SwDrawModeGrf&)Get( RES_GRFATR_DRAWMODE,bInP); } + { return static_cast<const SwDrawModeGrf&>(Get( RES_GRFATR_DRAWMODE,bInP)); } // Implementation of graphics attributes methods of SwFmt inline const SwMirrorGrf &SwFmt::GetMirrorGrf(bool bInP) const diff --git a/sw/inc/hfspacingitem.hxx b/sw/inc/hfspacingitem.hxx index c53f83374c0c..94547d3ce8d8 100644 --- a/sw/inc/hfspacingitem.hxx +++ b/sw/inc/hfspacingitem.hxx @@ -41,7 +41,7 @@ public: }; inline const SwHeaderAndFooterEatSpacingItem &SwAttrSet::GetHeaderAndFooterEatSpacing(bool bInP) const - { return (const SwHeaderAndFooterEatSpacingItem&)Get( RES_HEADER_FOOTER_EAT_SPACING,bInP); } + { return static_cast<const SwHeaderAndFooterEatSpacingItem&>(Get( RES_HEADER_FOOTER_EAT_SPACING,bInP)); } inline const SwHeaderAndFooterEatSpacingItem &SwFmt::GetHeaderAndFooterEatSpacing(bool bInP) const { return aSet.GetHeaderAndFooterEatSpacing(bInP); } diff --git a/sw/inc/ndnotxt.hxx b/sw/inc/ndnotxt.hxx index 875c75f0e1f0..26dfa94de0f1 100644 --- a/sw/inc/ndnotxt.hxx +++ b/sw/inc/ndnotxt.hxx @@ -53,7 +53,7 @@ public: virtual SwCntntFrm *MakeFrm( SwFrm* ) SAL_OVERRIDE; - inline SwGrfFmtColl *GetGrfColl() const { return (SwGrfFmtColl*)GetRegisteredIn(); } + inline SwGrfFmtColl *GetGrfColl() const { return const_cast<SwGrfFmtColl*>(static_cast<const SwGrfFmtColl*>(GetRegisteredIn())); } virtual Size GetTwipSize() const = 0; @@ -93,11 +93,11 @@ public: // Inline methods from Node.hxx - we know TxtNode only here!! inline SwNoTxtNode *SwNode::GetNoTxtNode() { - return ND_NOTXTNODE & nNodeType ? (SwNoTxtNode*)this : 0; + return ND_NOTXTNODE & nNodeType ? static_cast<SwNoTxtNode*>(this) : 0; } inline const SwNoTxtNode *SwNode::GetNoTxtNode() const { - return ND_NOTXTNODE & nNodeType ? (const SwNoTxtNode*)this : 0; + return ND_NOTXTNODE & nNodeType ? static_cast<const SwNoTxtNode*>(this) : 0; } #endif // INCLUDED_SW_INC_NDNOTXT_HXX diff --git a/sw/inc/ndole.hxx b/sw/inc/ndole.hxx index 65189eecb5cb..6cd24fcbb581 100644 --- a/sw/inc/ndole.hxx +++ b/sw/inc/ndole.hxx @@ -142,12 +142,12 @@ public: /// Inline methods from Node.hxx inline SwOLENode *SwNode::GetOLENode() { - return ND_OLENODE == nNodeType ? (SwOLENode*)this : 0; + return ND_OLENODE == nNodeType ? static_cast<SwOLENode*>(this) : 0; } inline const SwOLENode *SwNode::GetOLENode() const { - return ND_OLENODE == nNodeType ? (const SwOLENode*)this : 0; + return ND_OLENODE == nNodeType ? static_cast<const SwOLENode*>(this) : 0; } #endif // _ INCLUDED_SW_INC_NDOLE_HXX diff --git a/sw/inc/numrule.hxx b/sw/inc/numrule.hxx index ff2322c360c6..2dc755e6c5e5 100644 --- a/sw/inc/numrule.hxx +++ b/sw/inc/numrule.hxx @@ -31,6 +31,7 @@ #include <SwNumberTreeTypes.hxx> #include <ndarr.hxx> #include <vector> +#include <charfmt.hxx> class SwTxtFmtColl; class IDocumentListsAccess; @@ -39,7 +40,6 @@ namespace vcl { class Font; } class SvxBrushItem; class SfxGrabBagItem; class SvxNumRule; -class SwCharFmt; class SwDoc; class SwFmtVertOrient; class SwTxtNode; @@ -73,7 +73,7 @@ public: bool operator==( const SwNumFmt& ) const; bool operator!=( const SwNumFmt& r ) const { return !(*this == r); } - SwCharFmt* GetCharFmt() const { return (SwCharFmt*)GetRegisteredIn(); } + SwCharFmt* GetCharFmt() const { return const_cast<SwCharFmt*>(static_cast<const SwCharFmt*>(GetRegisteredIn())); } void SetCharFmt( SwCharFmt* ); virtual void SetCharFmtName(const OUString& rSet); diff --git a/sw/inc/tgrditem.hxx b/sw/inc/tgrditem.hxx index b110d386e2e4..2972d3546740 100644 --- a/sw/inc/tgrditem.hxx +++ b/sw/inc/tgrditem.hxx @@ -107,9 +107,9 @@ public: }; inline const SwTextGridItem &SwAttrSet::GetTextGrid(bool bInP) const - { return (const SwTextGridItem&)Get( RES_TEXTGRID, bInP ); } + { return static_cast<const SwTextGridItem&>(Get( RES_TEXTGRID, bInP )); } inline const SwTextGridItem &SwFmt::GetTextGrid(bool bInP) const - { return (const SwTextGridItem&)aSet.Get( RES_TEXTGRID, bInP ); } + { return static_cast<const SwTextGridItem&>(aSet.Get( RES_TEXTGRID, bInP )); } #endif diff --git a/sw/inc/txatbase.hxx b/sw/inc/txatbase.hxx index 830d097128c4..8ac157297abc 100644 --- a/sw/inc/txatbase.hxx +++ b/sw/inc/txatbase.hxx @@ -22,21 +22,21 @@ #include <tools/solar.h> #include <svl/poolitem.hxx> #include <hintids.hxx> +#include <fmtautofmt.hxx> +#include <fmtinfmt.hxx> +#include <fmtrfmrk.hxx> +#include <fmtruby.hxx> +#include <fmtfld.hxx> +#include <fmtflcnt.hxx> +#include <fmtftn.hxx> +#include <fmtmeta.hxx> +#include <fchrfmt.hxx> +#include <tox.hxx> #include <boost/utility.hpp> class SfxItemPool; class SvXMLAttrContainerItem; -class SwFmtRuby; -class SwFmtCharFmt; -class SwFmtAutoFmt; -class SwFmtINetFmt; -class SwFmtFld; -class SwFmtFtn; -class SwFmtFlyCnt; -class SwTOXMark; -class SwFmtRefMark; -class SwFmtMeta; class SwTxtAttr : private boost::noncopyable { @@ -175,13 +175,13 @@ inline void SwTxtAttr::SetDontExpand( bool bDontExpand ) inline const SwFmtCharFmt& SwTxtAttr::GetCharFmt() const { assert( m_pAttr && m_pAttr->Which() == RES_TXTATR_CHARFMT ); - return (const SwFmtCharFmt&)(*m_pAttr); + return static_cast<const SwFmtCharFmt&>(*m_pAttr); } inline const SwFmtAutoFmt& SwTxtAttr::GetAutoFmt() const { assert( m_pAttr && m_pAttr->Which() == RES_TXTATR_AUTOFMT ); - return (const SwFmtAutoFmt&)(*m_pAttr); + return static_cast<const SwFmtAutoFmt&>(*m_pAttr); } inline const SwFmtFld& SwTxtAttr::GetFmtFld() const @@ -190,50 +190,50 @@ inline const SwFmtFld& SwTxtAttr::GetFmtFld() const && ( m_pAttr->Which() == RES_TXTATR_FIELD || m_pAttr->Which() == RES_TXTATR_ANNOTATION || m_pAttr->Which() == RES_TXTATR_INPUTFIELD )); - return (const SwFmtFld&)(*m_pAttr); + return static_cast<const SwFmtFld&>(*m_pAttr); } inline const SwFmtFtn& SwTxtAttr::GetFtn() const { assert( m_pAttr && m_pAttr->Which() == RES_TXTATR_FTN ); - return (const SwFmtFtn&)(*m_pAttr); + return static_cast<const SwFmtFtn&>(*m_pAttr); } inline const SwFmtFlyCnt& SwTxtAttr::GetFlyCnt() const { assert( m_pAttr && m_pAttr->Which() == RES_TXTATR_FLYCNT ); - return (const SwFmtFlyCnt&)(*m_pAttr); + return static_cast<const SwFmtFlyCnt&>(*m_pAttr); } inline const SwTOXMark& SwTxtAttr::GetTOXMark() const { assert( m_pAttr && m_pAttr->Which() == RES_TXTATR_TOXMARK ); - return (const SwTOXMark&)(*m_pAttr); + return static_cast<const SwTOXMark&>(*m_pAttr); } inline const SwFmtRefMark& SwTxtAttr::GetRefMark() const { assert( m_pAttr && m_pAttr->Which() == RES_TXTATR_REFMARK ); - return (const SwFmtRefMark&)(*m_pAttr); + return static_cast<const SwFmtRefMark&>(*m_pAttr); } inline const SwFmtINetFmt& SwTxtAttr::GetINetFmt() const { assert( m_pAttr && m_pAttr->Which() == RES_TXTATR_INETFMT ); - return (const SwFmtINetFmt&)(*m_pAttr); + return static_cast<const SwFmtINetFmt&>(*m_pAttr); } inline const SwFmtRuby& SwTxtAttr::GetRuby() const { assert( m_pAttr && m_pAttr->Which() == RES_TXTATR_CJK_RUBY ); - return (const SwFmtRuby&)(*m_pAttr); + return static_cast<const SwFmtRuby&>(*m_pAttr); } inline const SwFmtMeta& SwTxtAttr::GetMeta() const { assert( m_pAttr && (m_pAttr->Which() == RES_TXTATR_META || m_pAttr->Which() == RES_TXTATR_METAFIELD) ); - return (const SwFmtMeta&)(*m_pAttr); + return static_cast<const SwFmtMeta&>(*m_pAttr); } // these should be static_casts but with virtual inheritance it's not possible diff --git a/sw/source/core/access/accdoc.cxx b/sw/source/core/access/accdoc.cxx index 65996a05569e..4afcba5378d8 100644 --- a/sw/source/core/access/accdoc.cxx +++ b/sw/source/core/access/accdoc.cxx @@ -652,11 +652,11 @@ uno::Any SAL_CALL SwAccessibleDocument::getExtendedAttributes() { const SwFrm *pSwFrm = pFlyFrm->GetAnchorFrm(); if(pSwFrm->IsTxtFrm()) - pCurrTxtFrm = ((SwTxtFrm*)(pSwFrm)); + pCurrTxtFrm = const_cast<SwTxtFrm*>(static_cast<const SwTxtFrm*>(pSwFrm)); } } else - pCurrTxtFrm = static_cast< SwTxtFrm* >(pCurrFrm); + pCurrTxtFrm = const_cast<SwTxtFrm*>(static_cast<const SwTxtFrm* >(pCurrFrm)); //check whether the text frame where the Graph/OLE/Frame anchored is in the Header/Footer SwFrm* pFrm = pCurrTxtFrm; while ( pFrm && !pFrm->IsHeaderFrm() && !pFrm->IsFooterFrm() ) @@ -670,7 +670,7 @@ uno::Any SAL_CALL SwAccessibleDocument::getExtendedAttributes() for ( size_t i = 0; i < rMrkList.GetMarkCount(); ++i ) { SdrObject *pObj = rMrkList.GetMark(i)->GetMarkedSdrObj(); - SwFrmFmt* pFmt = ((SwDrawContact*)pObj->GetUserCall())->GetFmt(); + SwFrmFmt* pFmt = static_cast<SwDrawContact*>(pObj->GetUserCall())->GetFmt(); const SwFmtAnchor& rAnchor = pFmt->GetAnchor(); if( FLY_AS_CHAR != rAnchor.GetAnchorId() ) pCurrTxtFrm = NULL; @@ -934,7 +934,7 @@ sal_Int32 SAL_CALL SwAccessibleDocument::getBackground() } } - while( _pStartCrsr && ( (_pStartCrsr=(SwPaM *)_pStartCrsr->GetNext()) != __pStartCrsr) ); + while( _pStartCrsr && ( (_pStartCrsr = static_cast<SwPaM *>(_pStartCrsr->GetNext())) != __pStartCrsr) ); if ( vFrmList.size() ) { diff --git a/sw/source/core/access/accembedded.cxx b/sw/source/core/access/accembedded.cxx index 385469044b8e..896175e310ff 100644 --- a/sw/source/core/access/accembedded.cxx +++ b/sw/source/core/access/accembedded.cxx @@ -120,7 +120,7 @@ uno::Sequence< sal_Int8 > SAL_CALL SwAccessibleEmbeddedObject::getImplementation SwCntntNode* pCNode = pCFrm->GetNode(); if( pCNode ) { - style += ((SwOLENode*)pCNode)->GetOLEObj().GetStyleString(); + style += static_cast<SwOLENode*>(pCNode)->GetOLEObj().GetStyleString(); } } style += ";"; diff --git a/sw/source/core/access/accframe.cxx b/sw/source/core/access/accframe.cxx index 351d62dfd38c..e292df928746 100644 --- a/sw/source/core/access/accframe.cxx +++ b/sw/source/core/access/accframe.cxx @@ -394,7 +394,7 @@ bool SwAccessibleFrame::IsOpaque( SwViewShell *pVSh ) const if( pFrm->IsSctFrm() ) { - const SwSection* pSection = ((SwSectionFrm*)pFrm)->GetSection(); + const SwSection* pSection = static_cast<const SwSectionFrm*>(pFrm)->GetSection(); if( pSection && ( TOX_HEADER_SECTION == pSection->GetType() || TOX_CONTENT_SECTION == pSection->GetType() ) && !pVOpt->IsReadonly() && diff --git a/sw/source/core/access/accgraphic.cxx b/sw/source/core/access/accgraphic.cxx index 9075294d4593..b4f2902b49d2 100644 --- a/sw/source/core/access/accgraphic.cxx +++ b/sw/source/core/access/accgraphic.cxx @@ -76,11 +76,11 @@ sal_Int16 SAL_CALL SwAccessibleGraphic::getAccessibleRole (void) { SolarMutexGuard g; - SwFmtURL aURL( ((SwLayoutFrm*)GetFrm())->GetFmt()->GetURL() ); + SwFmtURL aURL( static_cast<const SwLayoutFrm*>(GetFrm())->GetFmt()->GetURL() ); if (aURL.GetMap()) - return AccessibleRole::IMAGE_MAP ; - return AccessibleRole::GRAPHIC ; + return AccessibleRole::IMAGE_MAP; + return AccessibleRole::GRAPHIC; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx index 64a70c94a67e..a54c7deabdf9 100644 --- a/sw/source/core/access/accmap.cxx +++ b/sw/source/core/access/accmap.cxx @@ -1281,16 +1281,16 @@ void SwAccessibleMap::InvalidateShapeInParaSelection() SwFrm *pFrm = NULL; if(nStartIndex.GetNode().IsCntntNode()) { - SwCntntNode* pCNd = (SwCntntNode*)&(nStartIndex.GetNode()); + SwCntntNode* pCNd = static_cast<SwCntntNode*>(&(nStartIndex.GetNode())); SwClientIter aClientIter( *pCNd ); - pFrm = (SwFrm*)aClientIter.First( TYPE(SwFrm)); + pFrm = static_cast<SwFrm*>(aClientIter.First( TYPE(SwFrm))); } else if( nStartIndex.GetNode().IsTableNode() ) { - SwTableNode * pTable= (SwTableNode *)&(nStartIndex.GetNode()); + SwTableNode * pTable = static_cast<SwTableNode *>(&(nStartIndex.GetNode())); SwFrmFmt* pFmt = const_cast<SwFrmFmt*>(pTable->GetTable().GetFrmFmt()); SwClientIter aClientIter( *pFmt ); - pFrm = (SwFrm*)aClientIter.First( TYPE(SwFrm)); + pFrm = static_cast<SwFrm*>(aClientIter.First( TYPE(SwFrm))); } if( pFrm && mpFrmMap) diff --git a/sw/source/core/access/accnotextframe.cxx b/sw/source/core/access/accnotextframe.cxx index 10c312db3cee..9e92a916038f 100644 --- a/sw/source/core/access/accnotextframe.cxx +++ b/sw/source/core/access/accnotextframe.cxx @@ -308,7 +308,7 @@ throw (uno::RuntimeException, std::exception) CHECK_FOR_DEFUNC( XAccessibleHypertext ); sal_Int32 nCount = 0; - SwFmtURL aURL( ((SwLayoutFrm*)GetFrm())->GetFmt()->GetURL() ); + SwFmtURL aURL( static_cast<const SwLayoutFrm*>(GetFrm())->GetFmt()->GetURL() ); if(aURL.GetMap() || !aURL.GetURL().isEmpty()) nCount = 1; @@ -325,7 +325,7 @@ uno::Reference< XAccessibleHyperlink > SAL_CALL uno::Reference< XAccessibleHyperlink > xRet; - SwFmtURL aURL( ((SwLayoutFrm*)GetFrm())->GetFmt()->GetURL() ); + SwFmtURL aURL( static_cast<const SwLayoutFrm*>(GetFrm())->GetFmt()->GetURL() ); if( nLinkIndex > 0 ) throw lang::IndexOutOfBoundsException(); diff --git a/sw/source/core/access/accnotexthyperlink.hxx b/sw/source/core/access/accnotexthyperlink.hxx index fcc5ed9adb23..246f66a9cf2d 100644 --- a/sw/source/core/access/accnotexthyperlink.hxx +++ b/sw/source/core/access/accnotexthyperlink.hxx @@ -40,7 +40,7 @@ class SwAccessibleNoTextHyperlink : SwFrmFmt *GetFmt() { - return ((SwLayoutFrm*)mpFrm)->GetFmt(); + return const_cast<SwLayoutFrm*>(static_cast<const SwLayoutFrm*>(mpFrm))->GetFmt(); } public: diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx index 4f85ab31bab7..892447a51f2a 100644 --- a/sw/source/core/access/accpara.cxx +++ b/sw/source/core/access/accpara.cxx @@ -683,7 +683,7 @@ SwTOXSortTabBase* SwAccessibleParagraph::GetTOXSortTabBase() if( pSectNd ) { const SwSection * pSect = &pSectNd->GetSection(); - SwTOXBaseSection *pTOXBaseSect = (SwTOXBaseSection *)pSect; + const SwTOXBaseSection *pTOXBaseSect = static_cast<const SwTOXBaseSection *>(pSect); if( pSect->GetType() == TOX_CONTENT_SECTION ) { SwTOXSortTabBase* pSortBase = 0; @@ -1484,7 +1484,7 @@ OUString SwAccessibleParagraph::GetFieldTypeNameAtIndex(sal_Int32 nIndex) switch (nWhich) { case RES_DOCSTATFLD: - subType = ((SwDocStatField*)pField)->GetSubType(); + subType = static_cast<const SwDocStatField*>(pField)->GetSubType(); break; case RES_GETREFFLD: { @@ -1512,7 +1512,7 @@ OUString SwAccessibleParagraph::GetFieldTypeNameAtIndex(sal_Int32 nIndex) sEntry = OUString(RTL_CONSTASCII_USTRINGPARAM("Insert Reference")); break; case REF_SEQUENCEFLD: - sEntry = ((SwGetRefField*)pField)->GetSetRefName(); + sEntry = static_cast<const SwGetRefField*>(pField)->GetSetRefName(); break; } //Get format string @@ -1530,7 +1530,7 @@ OUString SwAccessibleParagraph::GetFieldTypeNameAtIndex(sal_Int32 nIndex) } break; case RES_DATETIMEFLD: - subType = ((SwDateTimeField*)pField)->GetSubType(); + subType = static_cast<const SwDateTimeField*>(pField)->GetSubType(); break; case RES_JUMPEDITFLD: { @@ -1548,7 +1548,7 @@ OUString SwAccessibleParagraph::GetFieldTypeNameAtIndex(sal_Int32 nIndex) } break; case RES_EXTUSERFLD: - subType = ((SwExtUserField*)pField)->GetSubType(); + subType = static_cast<const SwExtUserField*>(pField)->GetSubType(); break; case RES_HIDDENTXTFLD: case RES_SETEXPFLD: @@ -1567,7 +1567,7 @@ OUString SwAccessibleParagraph::GetFieldTypeNameAtIndex(sal_Int32 nIndex) break; case RES_REFPAGESETFLD: { - SwRefPageSetField* pRPld = (SwRefPageSetField*)pField; + const SwRefPageSetField* pRPld = static_cast<const SwRefPageSetField*>(pField); bool bOn = pRPld->IsOn(); strTypeName += "-"; if (bOn) diff --git a/sw/source/core/access/acctable.cxx b/sw/source/core/access/acctable.cxx index 08877d32a796..4fead783bcb7 100644 --- a/sw/source/core/access/acctable.cxx +++ b/sw/source/core/access/acctable.cxx @@ -193,7 +193,7 @@ void SwAccessibleTableData_Impl::CollectRowHeaderData( const SwFrm *pFrm ) if( pLower->IsRowFrm() ) { - const SwTableLine* pLine = ((SwRowFrm*)pLower)->GetTabLine(); + const SwTableLine* pLine = static_cast<const SwRowFrm*>(pLower)->GetTabLine(); while( pLine->GetUpper() ) pLine = pLine->GetUpper()->GetUpper(); @@ -236,7 +236,7 @@ void SwAccessibleTableData_Impl::CollectColumnHeaderData( const SwFrm *pFrm ) if( pLower->IsRowFrm() ) { - const SwTableLine* pLine = ((SwRowFrm*)pLower)->GetTabLine(); + const SwTableLine* pLine = static_cast<const SwRowFrm*>(pLower)->GetTabLine(); while( pLine->GetUpper() ) pLine = pLine->GetUpper()->GetUpper(); diff --git a/sw/source/core/attr/calbck.cxx b/sw/source/core/attr/calbck.cxx index 44d54c483f6e..548c27cce464 100644 --- a/sw/source/core/attr/calbck.cxx +++ b/sw/source/core/attr/calbck.cxx @@ -170,7 +170,7 @@ void SwModify::NotifyClients( const SfxPoolItem* pOldValue, const SfxPoolItem* p { case RES_OBJECTDYING: case RES_REMOVE_UNO_OBJECT: - bLockClientList = ((SwPtrMsgPoolItem*)pOldValue)->pObject != this; + bLockClientList = static_cast<const SwPtrMsgPoolItem*>(pOldValue)->pObject != this; break; default: diff --git a/sw/source/core/attr/cellatr.cxx b/sw/source/core/attr/cellatr.cxx index 9bc82961108d..8586cdf480da 100644 --- a/sw/source/core/attr/cellatr.cxx +++ b/sw/source/core/attr/cellatr.cxx @@ -39,8 +39,8 @@ SwTblBoxNumFormat::SwTblBoxNumFormat( sal_uInt32 nFormat, bool bFlag ) bool SwTblBoxNumFormat::operator==( const SfxPoolItem& rAttr ) const { assert(SfxPoolItem::operator==(rAttr)); - return GetValue() == ( (SwTblBoxNumFormat&) rAttr ).GetValue() && - bAuto == ( (SwTblBoxNumFormat&) rAttr ).bAuto; + return GetValue() == static_cast<const SwTblBoxNumFormat&>(rAttr).GetValue() && + bAuto == static_cast<const SwTblBoxNumFormat&>(rAttr).bAuto; } SfxPoolItem* SwTblBoxNumFormat::Clone( SfxItemPool* ) const @@ -58,8 +58,8 @@ SwTblBoxFormula::SwTblBoxFormula( const OUString& rFormula ) bool SwTblBoxFormula::operator==( const SfxPoolItem& rAttr ) const { assert(SfxPoolItem::operator==(rAttr)); - return GetFormula() == ( (SwTblBoxFormula&) rAttr ).GetFormula() && - pDefinedIn == ( (SwTblBoxFormula&) rAttr ).pDefinedIn; + return GetFormula() == static_cast<const SwTblBoxFormula&>(rAttr).GetFormula() && + pDefinedIn == static_cast<const SwTblBoxFormula&>(rAttr).pDefinedIn; } SfxPoolItem* SwTblBoxFormula::Clone( SfxItemPool* ) const @@ -110,7 +110,7 @@ void SwTblBoxFormula::ChangeState( const SfxPoolItem* pItem ) return ; } - pUpdtFld = (SwTableFmlUpdate*)pItem; + pUpdtFld = const_cast<SwTableFmlUpdate*>(static_cast<const SwTableFmlUpdate*>(pItem)); // detect table that contains this attribute const SwTableNode* pTblNd; diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx index 934acd292a0d..036f9451ffab 100644 --- a/sw/source/core/attr/format.cxx +++ b/sw/source/core/attr/format.cxx @@ -265,7 +265,7 @@ void SwFmt::Modify( const SfxPoolItem* pOldValue, const SfxPoolItem* pNewValue ) { // If the dying object is the parent format of this format so // attach this to the parent of the parent - SwFmt* pFmt = (SwFmt*) ((SwPtrMsgPoolItem*)pNewValue)->pObject; + SwFmt* pFmt = (SwFmt*) static_cast<const SwPtrMsgPoolItem*>(pNewValue)->pObject; // do not move if this is the topmost format if( GetRegisteredIn() && GetRegisteredIn() == pFmt ) @@ -286,11 +286,11 @@ void SwFmt::Modify( const SfxPoolItem* pOldValue, const SfxPoolItem* pNewValue ) } break; case RES_ATTRSET_CHG: - if (pOldValue && pNewValue && ((SwAttrSetChg*)pOldValue)->GetTheChgdSet() != &aSet) + if (pOldValue && pNewValue && static_cast<const SwAttrSetChg*>(pOldValue)->GetTheChgdSet() != &aSet) { // pass only those that are not set - SwAttrSetChg aOld( *(SwAttrSetChg*)pOldValue ); - SwAttrSetChg aNew( *(SwAttrSetChg*)pNewValue ); + SwAttrSetChg aOld( *static_cast<const SwAttrSetChg*>(pOldValue) ); + SwAttrSetChg aNew( *static_cast<const SwAttrSetChg*>(pNewValue) ); aOld.GetChgSet()->Differentiate( aSet ); aNew.GetChgSet()->Differentiate( aSet ); @@ -306,8 +306,8 @@ void SwFmt::Modify( const SfxPoolItem* pOldValue, const SfxPoolItem* pNewValue ) // skip my own Modify if ( pOldValue && pNewValue && - ((SwFmtChg*)pOldValue)->pChangedFmt != this && - ((SwFmtChg*)pNewValue)->pChangedFmt == GetRegisteredIn() ) + static_cast<const SwFmtChg*>(pOldValue)->pChangedFmt != this && + static_cast<const SwFmtChg*>(pNewValue)->pChangedFmt == GetRegisteredIn() ) { // attach Set to new parent aSet.SetParent( DerivedFrom() ? &DerivedFrom()->aSet : 0 ); @@ -474,7 +474,7 @@ SfxItemState SwFmt::GetBackgroundState(SvxBrushItem &rItem, bool bSrchInParent) const SfxPoolItem* pItem = 0; SfxItemState eRet = aSet.GetItemState(RES_BACKGROUND, bSrchInParent, &pItem); if (pItem) - rItem = *(const SvxBrushItem*)pItem; + rItem = *static_cast<const SvxBrushItem*>(pItem); return eRet; } diff --git a/sw/source/core/attr/swatrset.cxx b/sw/source/core/attr/swatrset.cxx index 62b30cc025dc..e746c209b9fd 100644 --- a/sw/source/core/attr/swatrset.cxx +++ b/sw/source/core/attr/swatrset.cxx @@ -268,32 +268,32 @@ bool SwAttrSet::SetModifyAtAttr( const SwModify* pModify ) const SfxPoolItem* pItem; if( SfxItemState::SET == GetItemState( RES_PAGEDESC, false, &pItem ) && - ((SwFmtPageDesc*)pItem)->GetDefinedIn() != pModify ) + static_cast<const SwFmtPageDesc*>(pItem)->GetDefinedIn() != pModify ) { - ((SwFmtPageDesc*)pItem)->ChgDefinedIn( pModify ); + const_cast<SwFmtPageDesc*>(static_cast<const SwFmtPageDesc*>(pItem))->ChgDefinedIn( pModify ); bSet = true; } if( SfxItemState::SET == GetItemState( RES_PARATR_DROP, false, &pItem ) && - ((SwFmtDrop*)pItem)->GetDefinedIn() != pModify ) + static_cast<const SwFmtDrop*>(pItem)->GetDefinedIn() != pModify ) { // If CharFormat is set and it is set in different attribute pools then // the CharFormat has to be copied. SwCharFmt* pCharFmt; - if( 0 != ( pCharFmt = ((SwFmtDrop*)pItem)->GetCharFmt() ) + if( 0 != ( pCharFmt = const_cast<SwFmtDrop*>(static_cast<const SwFmtDrop*>(pItem))->GetCharFmt() ) && GetPool() != pCharFmt->GetAttrSet().GetPool() ) { pCharFmt = GetDoc()->CopyCharFmt( *pCharFmt ); - ((SwFmtDrop*)pItem)->SetCharFmt( pCharFmt ); + const_cast<SwFmtDrop*>(static_cast<const SwFmtDrop*>(pItem))->SetCharFmt( pCharFmt ); } - ((SwFmtDrop*)pItem)->ChgDefinedIn( pModify ); + const_cast<SwFmtDrop*>(static_cast<const SwFmtDrop*>(pItem))->ChgDefinedIn( pModify ); bSet = true; } if( SfxItemState::SET == GetItemState( RES_BOXATR_FORMULA, false, &pItem ) && - ((SwTblBoxFormula*)pItem)->GetDefinedIn() != pModify ) + static_cast<const SwTblBoxFormula*>(pItem)->GetDefinedIn() != pModify ) { - ((SwTblBoxFormula*)pItem)->ChgDefinedIn( pModify ); + const_cast<SwTblBoxFormula*>(static_cast<const SwTblBoxFormula*>(pItem))->ChgDefinedIn( pModify ); bSet = true; } @@ -321,7 +321,7 @@ void SwAttrSet::CopyToModify( SwModify& rMod ) const if( pSrcDoc != pDstDoc && SfxItemState::SET == GetItemState( RES_PARATR_NUMRULE, false, &pItem ) ) { - const OUString& rNm = ((SwNumRuleItem*)pItem)->GetValue(); + const OUString& rNm = static_cast<const SwNumRuleItem*>(pItem)->GetValue(); if( !rNm.isEmpty() ) { SwNumRule* pDestRule = pDstDoc->FindNumRulePtr( rNm ); @@ -386,7 +386,7 @@ void SwAttrSet::CopyToModify( SwModify& rMod ) const const SwPageDesc* pPgDesc; if( pSrcDoc != pDstDoc && SfxItemState::SET == GetItemState( RES_PAGEDESC, false, &pItem ) && - 0 != ( pPgDesc = ((SwFmtPageDesc*)pItem)->GetPageDesc()) ) + 0 != ( pPgDesc = static_cast<const SwFmtPageDesc*>(pItem)->GetPageDesc()) ) { if( !tmpSet ) tmpSet.reset( new SfxItemSet( *this )); @@ -398,7 +398,7 @@ void SwAttrSet::CopyToModify( SwModify& rMod ) const pDstDoc->CopyPageDesc( *pPgDesc, *pDstPgDesc ); } SwFmtPageDesc aDesc( pDstPgDesc ); - aDesc.SetNumOffset( ((SwFmtPageDesc*)pItem)->GetNumOffset() ); + aDesc.SetNumOffset( static_cast<const SwFmtPageDesc*>(pItem)->GetNumOffset() ); tmpSet->Put( aDesc ); } diff --git a/sw/source/core/bastyp/calc.cxx b/sw/source/core/bastyp/calc.cxx index 65d8dafbdf54..290784e627a2 100644 --- a/sw/source/core/bastyp/calc.cxx +++ b/sw/source/core/bastyp/calc.cxx @@ -210,7 +210,7 @@ SwHash* Find( const OUString& rStr, SwHash** ppTable, inline LanguageType GetDocAppScriptLang( SwDoc& rDoc ) { - return ((SvxLanguageItem&)rDoc.GetDefault( + return static_cast<const SvxLanguageItem&>(rDoc.GetDefault( GetWhichOfScript( RES_CHRATR_LANGUAGE, GetI18NScriptTypeOfLanguage( (sal_uInt16)GetAppLanguage() )) )).GetLanguage(); @@ -336,24 +336,24 @@ SwCalc::SwCalc( SwDoc& rD ) VarTable[ aHashValue[ n ] ] = new SwCalcExp( sTmpStr, nVal, 0 ); } - ((SwCalcExp*)VarTable[ aHashValue[ 0 ] ])->nValue.PutBool( false ); - ((SwCalcExp*)VarTable[ aHashValue[ 1 ] ])->nValue.PutBool( true ); - ((SwCalcExp*)VarTable[ aHashValue[ 2 ] ])->nValue.PutDouble( F_PI ); - ((SwCalcExp*)VarTable[ aHashValue[ 3 ] ])->nValue.PutDouble( 2.7182818284590452354 ); + static_cast<SwCalcExp*>(VarTable[ aHashValue[ 0 ] ])->nValue.PutBool( false ); + static_cast<SwCalcExp*>(VarTable[ aHashValue[ 1 ] ])->nValue.PutBool( true ); + static_cast<SwCalcExp*>(VarTable[ aHashValue[ 2 ] ])->nValue.PutDouble( F_PI ); + static_cast<SwCalcExp*>(VarTable[ aHashValue[ 3 ] ])->nValue.PutDouble( 2.7182818284590452354 ); for( n = 0; n < 3; ++n ) - ((SwCalcExp*)VarTable[ aHashValue[ n + 4 ] ])->nValue.PutLong( rDocStat.*aDocStat1[ n ] ); + static_cast<SwCalcExp*>(VarTable[ aHashValue[ n + 4 ] ])->nValue.PutLong( rDocStat.*aDocStat1[ n ] ); for( n = 0; n < 4; ++n ) - ((SwCalcExp*)VarTable[ aHashValue[ n + 7 ] ])->nValue.PutLong( rDocStat.*aDocStat2[ n ] ); + static_cast<SwCalcExp*>(VarTable[ aHashValue[ n + 7 ] ])->nValue.PutLong( rDocStat.*aDocStat2[ n ] ); SvtUserOptions& rUserOptions = SW_MOD()->GetUserOptions(); - ((SwCalcExp*)VarTable[ aHashValue[ 11 ] ])->nValue.PutString( rUserOptions.GetFirstName() ); - ((SwCalcExp*)VarTable[ aHashValue[ 12 ] ])->nValue.PutString( rUserOptions.GetLastName() ); - ((SwCalcExp*)VarTable[ aHashValue[ 13 ] ])->nValue.PutString( rUserOptions.GetID() ); + static_cast<SwCalcExp*>(VarTable[ aHashValue[ 11 ] ])->nValue.PutString( rUserOptions.GetFirstName() ); + static_cast<SwCalcExp*>(VarTable[ aHashValue[ 12 ] ])->nValue.PutString( rUserOptions.GetLastName() ); + static_cast<SwCalcExp*>(VarTable[ aHashValue[ 13 ] ])->nValue.PutString( rUserOptions.GetID() ); for( n = 0; n < 11; ++n ) - ((SwCalcExp*)VarTable[ aHashValue[ n + 14 ] ])->nValue.PutString( + static_cast<SwCalcExp*>(VarTable[ aHashValue[ n + 14 ] ])->nValue.PutString( rUserOptions.GetToken( aAdrToken[ n ] )); nVal.PutString( rUserOptions.GetToken( aAdrToken[ 11 ] )); @@ -465,7 +465,7 @@ SwCalcExp* SwCalc::VarLook( const OUString& rStr, sal_uInt16 ins ) { // then insert here pFnd = new SwCalcExp( aStr, SwSbxValue(), - ((SwCalcFldType*)pEntry)->pFldType ); + static_cast<SwCalcFldType*>(pEntry)->pFldType ); pFnd->pNext = *(VarTable+ii); *(VarTable+ii) = pFnd; break; @@ -475,11 +475,11 @@ SwCalcExp* SwCalc::VarLook( const OUString& rStr, sal_uInt16 ins ) if( pFnd ) { - SwCalcExp* pFndExp = (SwCalcExp*)pFnd; + SwCalcExp* pFndExp = static_cast<SwCalcExp*>(pFnd); if( pFndExp->pFldType && pFndExp->pFldType->Which() == RES_USERFLD ) { - SwUserFieldType* pUFld = (SwUserFieldType*)pFndExp->pFldType; + SwUserFieldType* pUFld = const_cast<SwUserFieldType*>(static_cast<const SwUserFieldType*>(pFndExp->pFldType)); if( nsSwGetSetExpType::GSE_STRING & pUFld->GetType() ) { pFndExp->nValue.PutString( pUFld->GetContent() ); @@ -545,7 +545,7 @@ SwCalcExp* SwCalc::VarLook( const OUString& rStr, sal_uInt16 ins ) sal_uLong nTmpRec = 0; if( 0 != ( pFnd = Find( sDBNum, VarTable, TBLSZ ) ) ) - nTmpRec = ((SwCalcExp*)pFnd)->nValue.GetULong(); + nTmpRec = static_cast<SwCalcExp*>(pFnd)->nValue.GetULong(); OUString sResult; double nNumber = DBL_MAX; @@ -613,7 +613,7 @@ void SwCalc::VarChange( const OUString& rStr, const SwSbxValue& rValue ) OUString aStr = pCharClass->lowercase( rStr ); sal_uInt16 nPos = 0; - SwCalcExp* pFnd = (SwCalcExp*)Find( aStr, VarTable, TBLSZ, &nPos ); + SwCalcExp* pFnd = static_cast<SwCalcExp*>(Find( aStr, VarTable, TBLSZ, &nPos )); if( !pFnd ) { diff --git a/sw/source/core/bastyp/init.cxx b/sw/source/core/bastyp/init.cxx index 8e716bfa5e2a..e9d88ebc5993 100644 --- a/sw/source/core/bastyp/init.cxx +++ b/sw/source/core/bastyp/init.cxx @@ -546,7 +546,7 @@ void _InitCore() aAttrTab[ RES_PARATR_TABSTOP- POOLATTR_BEGIN ] = new SvxTabStopItem( 1, SVX_TAB_DEFDIST, SVX_TAB_ADJUST_DEFAULT, RES_PARATR_TABSTOP ); pItem = new SvxHyphenZoneItem( false, RES_PARATR_HYPHENZONE ); - ((SvxHyphenZoneItem*)pItem)->GetMaxHyphens() = 0; // Default: 0 + static_cast<SvxHyphenZoneItem*>(pItem)->GetMaxHyphens() = 0; // Default: 0 aAttrTab[ RES_PARATR_HYPHENZONE- POOLATTR_BEGIN ] = pItem; aAttrTab[ RES_PARATR_DROP- POOLATTR_BEGIN ] = new SwFmtDrop; @@ -649,9 +649,9 @@ void _InitCore() new SvXMLAttrContainerItem( RES_UNKNOWNATR_CONTAINER ); // get the correct fonts: - ::GetDefaultFonts( *(SvxFontItem*)aAttrTab[ RES_CHRATR_FONT- POOLATTR_BEGIN ], - *(SvxFontItem*)aAttrTab[ RES_CHRATR_CJK_FONT - POOLATTR_BEGIN ], - *(SvxFontItem*)aAttrTab[ RES_CHRATR_CTL_FONT - POOLATTR_BEGIN ] ); + ::GetDefaultFonts( *static_cast<SvxFontItem*>(aAttrTab[ RES_CHRATR_FONT- POOLATTR_BEGIN ]), + *static_cast<SvxFontItem*>(aAttrTab[ RES_CHRATR_CJK_FONT - POOLATTR_BEGIN ]), + *static_cast<SvxFontItem*>(aAttrTab[ RES_CHRATR_CTL_FONT - POOLATTR_BEGIN ]) ); // 1. version - new attributes: // - RES_CHRATR_BLINK diff --git a/sw/source/core/crsr/callnk.cxx b/sw/source/core/crsr/callnk.cxx index ea9ceb0e609e..6c036c3ed22b 100644 --- a/sw/source/core/crsr/callnk.cxx +++ b/sw/source/core/crsr/callnk.cxx @@ -56,7 +56,7 @@ SwCallLink::SwCallLink( SwCrsrShell & rSh ) bHasSelection = ( *pCrsr->GetPoint() != *pCrsr->GetMark() ); if( rNd.IsTxtNode() ) - nLeftFrmPos = SwCallLink::getLayoutFrm( rShell.GetLayout(), (SwTxtNode&)rNd, nCntnt, + nLeftFrmPos = SwCallLink::getLayoutFrm( rShell.GetLayout(), static_cast<SwTxtNode&>(rNd), nCntnt, !rShell.ActionPend() ); else { @@ -151,7 +151,7 @@ SwCallLink::~SwCallLink() { // If travelling with left/right only and the frame is // unchanged (columns!) then check text hints. - if( nLeftFrmPos == SwCallLink::getLayoutFrm( rShell.GetLayout(), (SwTxtNode&)*pCNd, nAktCntnt, + if( nLeftFrmPos == SwCallLink::getLayoutFrm( rShell.GetLayout(), static_cast<SwTxtNode&>(*pCNd), nAktCntnt, !rShell.ActionPend() ) && (( nCmp = nCntnt ) + 1 == nAktCntnt || // Right nCntnt -1 == ( nCmp = nAktCntnt )) ) // Left @@ -159,9 +159,9 @@ SwCallLink::~SwCallLink() if( nCmp == nAktCntnt && pCurCrsr->HasMark() ) // left & select ++nCmp; - if ( ((SwTxtNode*)pCNd)->HasHints() ) + if ( static_cast<SwTxtNode*>(pCNd)->HasHints() ) { - const SwpHints &rHts = ((SwTxtNode*)pCNd)->GetSwpHints(); + const SwpHints &rHts = static_cast<SwTxtNode*>(pCNd)->GetSwpHints(); for( size_t n = 0; n < rHts.Count(); ++n ) { @@ -193,7 +193,7 @@ SwCallLink::~SwCallLink() if( g_pBreakIt->GetBreakIter().is() ) { - const OUString rTxt = ((SwTxtNode*)pCNd)->GetTxt(); + const OUString rTxt = static_cast<SwTxtNode*>(pCNd)->GetTxt(); if( !nCmp || g_pBreakIt->GetBreakIter()->getScriptType( rTxt, nCmp ) != g_pBreakIt->GetBreakIter()->getScriptType( rTxt, nCmp - 1 )) @@ -231,7 +231,7 @@ SwCallLink::~SwCallLink() long SwCallLink::getLayoutFrm( const SwRootFrm* pRoot, SwTxtNode& rNd, sal_Int32 nCntPos, bool bCalcFrm ) { - SwTxtFrm* pFrm = (SwTxtFrm*)rNd.getLayoutFrm(pRoot,0,0,bCalcFrm), *pNext = pFrm; + SwTxtFrm* pFrm = static_cast<SwTxtFrm*>(rNd.getLayoutFrm(pRoot,0,0,bCalcFrm)), *pNext = pFrm; if ( pFrm && !pFrm->IsHiddenNow() ) { if( pFrm->HasFollow() ) diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx index adce2204a5f5..cb0341f4088e 100644 --- a/sw/source/core/crsr/crsrsh.cxx +++ b/sw/source/core/crsr/crsrsh.cxx @@ -88,7 +88,7 @@ void CheckRange( SwCursor* pCurCrsr ) *pEnd = pCurCrsr->GetPoint() == pStt ? pCurCrsr->GetMark() : pCurCrsr->GetPoint(); SwPaM *pTmpDel = 0, - *pTmp = (SwPaM*)pCurCrsr->GetNext(); + *pTmp = static_cast<SwPaM*>(pCurCrsr->GetNext()); // Search the complete ring while( pTmp != pCurCrsr ) @@ -108,7 +108,7 @@ void CheckRange( SwCursor* pCurCrsr ) // If Point or Mark is within the Crsr range, we need to remove the old // range. Take note that Point does not belong to the range anymore. - pTmp = (SwPaM*)pTmp->GetNext(); + pTmp = static_cast<SwPaM*>(pTmp->GetNext()); delete pTmpDel; // Remove old range pTmpDel = 0; } @@ -150,7 +150,7 @@ bool SwCrsrShell::DestroyCrsr() return false; SwCallLink aLk( *this ); // watch Crsr-Moves - SwCursor* pNextCrsr = (SwCursor*)m_pCurCrsr->GetNext(); + SwCursor* pNextCrsr = static_cast<SwCursor*>(m_pCurCrsr->GetNext()); delete m_pCurCrsr; m_pCurCrsr = dynamic_cast<SwShellCrsr*>(pNextCrsr); UpdateCrsr(); @@ -222,7 +222,7 @@ void SwCrsrShell::StartAction() m_nAktNdTyp = rNd.GetNodeType(); m_bAktSelection = *m_pCurCrsr->GetPoint() != *m_pCurCrsr->GetMark(); if( rNd.IsTxtNode() ) - m_nLeftFrmPos = SwCallLink::getLayoutFrm( GetLayout(), (SwTxtNode&)rNd, m_nAktCntnt, true ); + m_nLeftFrmPos = SwCallLink::getLayoutFrm( GetLayout(), const_cast<SwTxtNode&>(static_cast<const SwTxtNode&>(rNd)), m_nAktCntnt, true ); else m_nLeftFrmPos = 0; } @@ -663,7 +663,7 @@ bool SwCrsrShell::isInHiddenTxtFrm(SwShellCrsr* pShellCrsr) SwCntntNode *pCNode = pShellCrsr->GetCntntNode(); SwCntntFrm *pFrm = pCNode ? pCNode->getLayoutFrm( GetLayout(), &pShellCrsr->GetPtPos(), pShellCrsr->GetPoint(), false ) : 0; - return !pFrm || (pFrm->IsTxtFrm() && ((SwTxtFrm*)pFrm)->IsHiddenNow()); + return !pFrm || (pFrm->IsTxtFrm() && static_cast<SwTxtFrm*>(pFrm)->IsHiddenNow()); } bool SwCrsrShell::MovePara(SwWhichPara fnWhichPara, SwPosPara fnPosPara ) @@ -712,7 +712,7 @@ static SwFrm* lcl_IsInHeaderFooter( const SwNodeIndex& rIdx, Point& rPt ) SwCntntFrm *pCntFrm = pCNd->getLayoutFrm( pCNd->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), &rPt, 0, false ); pFrm = pCntFrm ? pCntFrm->GetUpper() : NULL; while( pFrm && !pFrm->IsHeaderFrm() && !pFrm->IsFooterFrm() ) - pFrm = pFrm->IsFlyFrm() ? ((SwFlyFrm*)pFrm)->AnchorFrm() + pFrm = pFrm->IsFlyFrm() ? static_cast<SwFlyFrm*>(pFrm)->AnchorFrm() : pFrm->GetUpper(); } return pFrm; @@ -793,9 +793,9 @@ int SwCrsrShell::SetCrsr( const Point &rLPt, bool bOnlyText, bool bBlock ) else if( aPos.nNode.GetNode().IsCntntNode() ) { // in the same frame? - SwFrm* pOld = ((SwCntntNode&)aPos.nNode.GetNode()).getLayoutFrm( + SwFrm* pOld = static_cast<SwCntntNode&>(aPos.nNode.GetNode()).getLayoutFrm( GetLayout(), &m_aCharRect.Pos(), 0, false ); - SwFrm* pNew = ((SwCntntNode&)aPos.nNode.GetNode()).getLayoutFrm( + SwFrm* pNew = static_cast<SwCntntNode&>(aPos.nNode.GetNode()).getLayoutFrm( GetLayout(), &aPt, 0, false ); if( pNew == pOld ) return bRet; @@ -1141,7 +1141,7 @@ void SwCrsrShell::GetPageNum( sal_uInt16 &rnPhyNum, sal_uInt16 &rnVirtNum, { pPg = Imp()->GetFirstVisPage(); while( pPg && pPg->IsEmptyPage() ) - pPg = (const SwPageFrm *)pPg->GetNext(); + pPg = static_cast<const SwPageFrm *>(pPg->GetNext()); } // pPg has to exist with a default of 1 for the special case "Writerstart" rnPhyNum = pPg? pPg->GetPhyPageNum() : 1; @@ -1162,24 +1162,24 @@ sal_uInt16 SwCrsrShell::GetNextPrevPageNum( bool bNext ) // go to next view layout row: do { - pPg = (const SwPageFrm *)pPg->GetNext(); + pPg = static_cast<const SwPageFrm *>(pPg->GetNext()); } while( pPg && pPg->Frm().Top() == nPageTop ); while( pPg && pPg->IsEmptyPage() ) - pPg = (const SwPageFrm *)pPg->GetNext(); + pPg = static_cast<const SwPageFrm *>(pPg->GetNext()); } else { // go to previous view layout row: do { - pPg = (const SwPageFrm *)pPg->GetPrev(); + pPg = static_cast<const SwPageFrm *>(pPg->GetPrev()); } while( pPg && pPg->Frm().Top() == nPageTop ); while( pPg && pPg->IsEmptyPage() ) - pPg = (const SwPageFrm *)pPg->GetPrev(); + pPg = static_cast<const SwPageFrm *>(pPg->GetPrev()); } } // pPg has to exist with a default of 1 for the special case "Writerstart" @@ -1352,7 +1352,7 @@ static void lcl_CheckHiddenPara( SwPosition& rPos ) { SwCntntNode* pCntnt = aTmp.GetNodes().GoNext( &aTmp ); if ( pCntnt && pCntnt->IsTxtNode() ) - pTxtNd = (SwTxtNode*)pCntnt; + pTxtNd = static_cast<SwTxtNode*>(pCntnt); else pTxtNd = 0; } @@ -1885,11 +1885,11 @@ void SwCrsrShell::RefreshBlockCursor() if( GetLayout()->FillSelection( aSelList, aRect ) ) { - SwCursor* pNxt = (SwCursor*)m_pCurCrsr->GetNext(); + SwCursor* pNxt = static_cast<SwCursor*>(m_pCurCrsr->GetNext()); while( pNxt != m_pCurCrsr ) { delete pNxt; - pNxt = (SwCursor*)m_pCurCrsr->GetNext(); + pNxt = static_cast<SwCursor*>(m_pCurCrsr->GetNext()); } std::list<SwPaM*>::iterator pStart = aSelList.getStart(); @@ -2413,8 +2413,8 @@ sal_uInt16 SwCrsrShell::GetCrsrCnt( bool bAll ) const *m_pCurCrsr->GetPoint() != *m_pCurCrsr->GetMark())) ? 1 : 0; while( pTmp != m_pCurCrsr ) { - if( bAll || ( ((SwPaM*)pTmp)->HasMark() && - *((SwPaM*)pTmp)->GetPoint() != *((SwPaM*)pTmp)->GetMark())) + if( bAll || ( static_cast<SwPaM*>(pTmp)->HasMark() && + *static_cast<SwPaM*>(pTmp)->GetPoint() != *static_cast<SwPaM*>(pTmp)->GetMark())) ++n; pTmp = pTmp->GetNext(); } @@ -2508,7 +2508,7 @@ void SwCrsrShell::_ParkPams( SwPaM* pDelRg, SwShellCrsr** ppDelRing ) if( ( bDelete = GoNextCrsr() ) ) { bGoNext = false; - pTmp = (SwPaM*)pTmp->GetNext(); + pTmp = static_cast<SwPaM*>(pTmp->GetNext()); } } else @@ -2524,7 +2524,7 @@ void SwCrsrShell::_ParkPams( SwPaM* pDelRg, SwShellCrsr** ppDelRing ) pTmpDel = 0; } if( bGoNext && pTmp ) - pTmp = (SwPaM*)pTmp->GetNext(); + pTmp = static_cast<SwPaM*>(pTmp->GetNext()); } while( !bGoNext || *ppDelRing != pTmp ); } @@ -2566,7 +2566,7 @@ void SwCrsrShell::ParkCrsr( const SwNodeIndex &rIdx ) do { if( pTmp->IsA( TYPE( SwCrsrShell ))) { - SwCrsrShell* pSh = (SwCrsrShell*)pTmp; + SwCrsrShell* pSh = static_cast<SwCrsrShell*>(pTmp); if( pSh->m_pCrsrStk ) pSh->_ParkPams( pNew, &pSh->m_pCrsrStk ); @@ -2584,7 +2584,7 @@ void SwCrsrShell::ParkCrsr( const SwNodeIndex &rIdx ) } } } - } while ( this != (pTmp = (SwViewShell*)pTmp->GetNext() )); + } while ( this != (pTmp = static_cast<SwViewShell*>(pTmp->GetNext()) )); delete pNew; } @@ -3038,7 +3038,7 @@ bool SwCrsrShell::HasReadonlySel(bool bAnnotationMode) const bRet = true; } - pCrsr = (SwPaM*)pCrsr->GetNext(); + pCrsr = static_cast<SwPaM*>(pCrsr->GetNext()); } while ( !bRet && pCrsr != m_pCurCrsr ); } } @@ -3189,9 +3189,9 @@ void SwCrsrShell::SetSelection( const SwPaM& rCrsr ) pCrsr->SetMark(); *pCrsr->GetMark() = *rCrsr.GetMark(); } - if((SwPaM*)rCrsr.GetNext() != &rCrsr) + if(static_cast<SwPaM*>(rCrsr.GetNext()) != &rCrsr) { - const SwPaM *_pStartCrsr = (SwPaM*)rCrsr.GetNext(); + const SwPaM *_pStartCrsr = static_cast<SwPaM*>(rCrsr.GetNext()); do { SwPaM* pCurrentCrsr = CreateCrsr(); @@ -3201,7 +3201,7 @@ void SwCrsrShell::SetSelection( const SwPaM& rCrsr ) pCurrentCrsr->SetMark(); *pCurrentCrsr->GetMark() = *_pStartCrsr->GetMark(); } - } while( (_pStartCrsr=(SwPaM *)_pStartCrsr->GetNext()) != &rCrsr ); + } while( (_pStartCrsr = static_cast<SwPaM *>(_pStartCrsr->GetNext())) != &rCrsr ); } EndAction(); } @@ -3246,7 +3246,7 @@ void SwCrsrShell::ClearUpCrsrs() // start of the ring SwPaM * pStartCrsr = GetCrsr(); // start loop with second entry of the ring - SwPaM * pCrsr = (SwPaM *) pStartCrsr->GetNext(); + SwPaM * pCrsr = static_cast<SwPaM *>(pStartCrsr->GetNext()); SwPaM * pTmpCrsr; bool bChanged = false; @@ -3254,7 +3254,7 @@ void SwCrsrShell::ClearUpCrsrs() // it is invalid. while (pCrsr != pStartCrsr) { - pTmpCrsr = (SwPaM *) pCrsr->GetNext(); + pTmpCrsr = static_cast<SwPaM *>(pCrsr->GetNext()); if ( ! lcl_CrsrOk(*pCrsr)) { delete pCrsr; diff --git a/sw/source/core/inc/doctxm.hxx b/sw/source/core/inc/doctxm.hxx index c1339634c1db..158299734db3 100644 --- a/sw/source/core/inc/doctxm.hxx +++ b/sw/source/core/inc/doctxm.hxx @@ -87,6 +87,7 @@ public: TYPEINFO_OVERRIDE(); // for rtti SwTOXSortTabBases& GetTOXSortTabBases() { return aSortArr; } + const SwTOXSortTabBases& GetTOXSortTabBases() const { return aSortArr; } bool SetPosAtStartEnd( SwPosition& rPos, bool bAtStart = true ) const; }; diff --git a/sw/source/core/inc/fntcache.hxx b/sw/source/core/inc/fntcache.hxx index 8a1c812cb9dd..1670f18a93e6 100644 --- a/sw/source/core/inc/fntcache.hxx +++ b/sw/source/core/inc/fntcache.hxx @@ -130,7 +130,7 @@ public: SwFntAccess( const void * &rMagic, sal_uInt16 &rIndex, const void *pOwner, SwViewShell const *pShell, bool bCheck = false ); - inline SwFntObj* Get() { return (SwFntObj*) SwCacheAccess::Get(); }; + inline SwFntObj* Get() { return static_cast<SwFntObj*>( SwCacheAccess::Get() ); } }; #endif |