diff options
author | Noel Grandin <noel@peralex.com> | 2014-11-10 09:39:17 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-11-10 15:22:15 +0200 |
commit | 5cb6144f2119aa1dcce161724abfc22ead1d20b5 (patch) | |
tree | 1296cb64a64b4f8bb7ec633ee605c9ef80a5dee7 /sw | |
parent | 7623a4832441691a486673cea981ef32b8d72ae7 (diff) |
loplugin: cstylecast
Change-Id: Ie57f543681790e662f6ac7d074ccb37925999790
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/cellatr.hxx | 6 | ||||
-rw-r--r-- | sw/inc/crsrsh.hxx | 2 | ||||
-rw-r--r-- | sw/inc/doc.hxx | 4 | ||||
-rw-r--r-- | sw/inc/editsh.hxx | 3 | ||||
-rw-r--r-- | sw/inc/fmtclds.hxx | 2 | ||||
-rw-r--r-- | sw/inc/fmtcol.hxx | 2 | ||||
-rw-r--r-- | sw/inc/format.hxx | 2 | ||||
-rw-r--r-- | sw/inc/frmatr.hxx | 42 | ||||
-rw-r--r-- | sw/inc/node.hxx | 38 | ||||
-rw-r--r-- | sw/inc/swatrset.hxx | 2 | ||||
-rw-r--r-- | sw/inc/swtable.hxx | 15 | ||||
-rw-r--r-- | sw/inc/tox.hxx | 4 |
12 files changed, 69 insertions, 53 deletions
diff --git a/sw/inc/cellatr.hxx b/sw/inc/cellatr.hxx index 8dd73daa3d93..b343a8b32dc0 100644 --- a/sw/inc/cellatr.hxx +++ b/sw/inc/cellatr.hxx @@ -98,11 +98,11 @@ public: }; inline const SwTblBoxNumFormat &SwAttrSet::GetTblBoxNumFmt(bool bInP) const - { return (const SwTblBoxNumFormat&)Get( RES_BOXATR_FORMAT,bInP); } + { return static_cast<const SwTblBoxNumFormat&>(Get( RES_BOXATR_FORMAT,bInP)); } inline const SwTblBoxFormula &SwAttrSet::GetTblBoxFormula(bool bInP) const - { return (const SwTblBoxFormula&)Get( RES_BOXATR_FORMULA,bInP); } + { return static_cast<const SwTblBoxFormula&>(Get( RES_BOXATR_FORMULA,bInP)); } inline const SwTblBoxValue &SwAttrSet::GetTblBoxValue(bool bInP) const - { return (const SwTblBoxValue&)Get( RES_BOXATR_VALUE, bInP); } + { return static_cast<const SwTblBoxValue&>(Get( RES_BOXATR_VALUE, bInP)); } inline const SwTblBoxNumFormat &SwFmt::GetTblBoxNumFmt(bool bInP) const { return aSet.GetTblBoxNumFmt(bInP); } diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx index 58c6e35f1e14..db3a9a31c87b 100644 --- a/sw/inc/crsrsh.hxx +++ b/sw/inc/crsrsh.hxx @@ -869,7 +869,7 @@ inline SwMoveFnCollection* SwCrsrShell::MakeFindRange( inline SwCursor* SwCrsrShell::GetSwCrsr( bool bMakeTblCrsr ) const { - return (SwCursor*)GetCrsr( bMakeTblCrsr ); + return static_cast<SwCursor*>(GetCrsr( bMakeTblCrsr )); } inline SwPaM* SwCrsrShell::GetStkCrsr() const { return m_pCrsrStk; } diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index 76a77139f7ed..31a538c02544 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -862,7 +862,7 @@ public: const bool bReset = true, const bool bResetListAttrs = false); SwTxtFmtColl* FindTxtFmtCollByName( const OUString& rName ) const - { return (SwTxtFmtColl*)FindFmtByName( (SwFmtsBase&)*mpTxtFmtCollTbl, rName ); } + { return static_cast<SwTxtFmtColl*>(FindFmtByName( (SwFmtsBase&)*mpTxtFmtCollTbl, rName )); } void ChkCondColls(); @@ -872,7 +872,7 @@ public: SwGrfFmtColl *MakeGrfFmtColl(const OUString &rFmtName, SwGrfFmtColl *pDerivedFrom); SwGrfFmtColl* FindGrfFmtCollByName( const OUString& rName ) const - { return (SwGrfFmtColl*)FindFmtByName( (SwFmtsBase&)*mpGrfFmtCollTbl, rName ); } + { return static_cast<SwGrfFmtColl*>(FindFmtByName( (SwFmtsBase&)*mpGrfFmtCollTbl, rName )); } // Table formatting const SwFrmFmts* GetTblFrmFmts() const { return mpTblFrmFmtTbl; } diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx index 06aed3a13bda..aef99cae0ea9 100644 --- a/sw/inc/editsh.hxx +++ b/sw/inc/editsh.hxx @@ -33,6 +33,7 @@ #include <tblenum.hxx> #include <IMark.hxx> #include <tox.hxx> +#include <frmfmt.hxx> #include <vector> #include <set> @@ -357,7 +358,7 @@ public: /// @return required automatic format. SwFrmFmt* GetFrmFmtFromPool( sal_uInt16 nId ) - { return (SwFrmFmt*)SwEditShell::GetFmtFromPool( nId ); } + { return static_cast<SwFrmFmt*>(SwEditShell::GetFmtFromPool( nId )); } SwCharFmt* GetCharFmtFromPool( sal_uInt16 nId ) { return (SwCharFmt*)SwEditShell::GetFmtFromPool( nId ); } diff --git a/sw/inc/fmtclds.hxx b/sw/inc/fmtclds.hxx index 465137c6346f..3370a983d3b5 100644 --- a/sw/inc/fmtclds.hxx +++ b/sw/inc/fmtclds.hxx @@ -163,7 +163,7 @@ public: }; inline const SwFmtCol &SwAttrSet::GetCol(bool bInP) const - { return (const SwFmtCol&)Get( RES_COL,bInP); } + { return static_cast<const SwFmtCol&>(Get( RES_COL,bInP)); } inline const SwFmtCol &SwFmt::GetCol(bool bInP) const { return aSet.GetCol(bInP); } diff --git a/sw/inc/fmtcol.hxx b/sw/inc/fmtcol.hxx index 82ee3a9c365b..ce8a5bfc2afd 100644 --- a/sw/inc/fmtcol.hxx +++ b/sw/inc/fmtcol.hxx @@ -229,7 +229,7 @@ public: { return aSubCondition.pFldExpression; } void SetCondition( sal_uLong nCond, sal_uLong nSubCond ); - SwTxtFmtColl* GetTxtFmtColl() const { return (SwTxtFmtColl*)GetRegisteredIn(); } + SwTxtFmtColl* GetTxtFmtColl() const { return const_cast<SwTxtFmtColl*>(static_cast<const SwTxtFmtColl*>(GetRegisteredIn())); } void RegisterToFormat( SwFmt& ); }; diff --git a/sw/inc/format.hxx b/sw/inc/format.hxx index b576048ebdf1..321bd8846dee 100644 --- a/sw/inc/format.hxx +++ b/sw/inc/format.hxx @@ -108,7 +108,7 @@ public: @return count of deleted hints. */ virtual sal_uInt16 ResetAllFmtAttr(); - inline SwFmt* DerivedFrom() const { return (SwFmt*)GetRegisteredIn(); } + inline SwFmt* DerivedFrom() const { return const_cast<SwFmt*>(static_cast<const SwFmt*>(GetRegisteredIn())); } inline bool IsDefault() const { return DerivedFrom() == 0; } inline OUString GetName() const { return aFmtName; } diff --git a/sw/inc/frmatr.hxx b/sw/inc/frmatr.hxx index c3937dff459b..ae826122cbb2 100644 --- a/sw/inc/frmatr.hxx +++ b/sw/inc/frmatr.hxx @@ -21,38 +21,52 @@ #include <hintids.hxx> #include <format.hxx> +#include <editeng/pbinitem.hxx> +#include <editeng/lrspitem.hxx> +#include <editeng/ulspitem.hxx> +#include <editeng/prntitem.hxx> +#include <editeng/opaqitem.hxx> +#include <editeng/protitem.hxx> +#include <editeng/boxitem.hxx> +#include <editeng/keepitem.hxx> +#include <editeng/brushitem.hxx> +#include <editeng/shaditem.hxx> +#include <editeng/formatbreakitem.hxx> +#include <editeng/frmdiritem.hxx> +#include <svl/macitem.hxx> +#include <svx/sdtaitm.hxx> // Inlines // Implementation of FrameAttribute methods of SwAttrSet. inline const SvxPaperBinItem &SwAttrSet::GetPaperBin(bool bInP) const - { return (const SvxPaperBinItem&)Get( RES_PAPER_BIN,bInP); } + { return static_cast<const SvxPaperBinItem&>(Get( RES_PAPER_BIN,bInP)); } inline const SvxLRSpaceItem &SwAttrSet::GetLRSpace(bool bInP) const - { return (const SvxLRSpaceItem&)Get( RES_LR_SPACE,bInP); } + { return static_cast<const SvxLRSpaceItem&>(Get( RES_LR_SPACE,bInP)); } inline const SvxULSpaceItem &SwAttrSet::GetULSpace(bool bInP) const - { return (const SvxULSpaceItem&)Get( RES_UL_SPACE,bInP); } + { return static_cast<const SvxULSpaceItem&>(Get( RES_UL_SPACE,bInP)); } inline const SvxPrintItem &SwAttrSet::GetPrint(bool bInP) const - { return (const SvxPrintItem&)Get( RES_PRINT,bInP); } + { return static_cast<const SvxPrintItem&>(Get( RES_PRINT,bInP)); } inline const SvxOpaqueItem &SwAttrSet::GetOpaque(bool bInP) const - { return (const SvxOpaqueItem&)Get( RES_OPAQUE,bInP); } + { return static_cast<const SvxOpaqueItem&>(Get( RES_OPAQUE,bInP)); } inline const SvxProtectItem &SwAttrSet::GetProtect(bool bInP) const - { return (const SvxProtectItem&)Get( RES_PROTECT,bInP); } + { return static_cast<const SvxProtectItem&>(Get( RES_PROTECT,bInP)); } inline const SvxBoxItem &SwAttrSet::GetBox(bool bInP) const - { return (const SvxBoxItem&)Get( RES_BOX,bInP); } + { return static_cast<const SvxBoxItem&>(Get( RES_BOX,bInP)); } inline const SvxFmtKeepItem &SwAttrSet::GetKeep(bool bInP) const - { return (const SvxFmtKeepItem&)Get( RES_KEEP,bInP); } + { return static_cast<const SvxFmtKeepItem&>(Get( RES_KEEP,bInP)); } inline const SvxBrushItem &SwAttrSet::GetBackground(bool bInP) const - { return (const SvxBrushItem&)Get( RES_BACKGROUND,bInP); } + { return static_cast<const SvxBrushItem&>(Get( RES_BACKGROUND,bInP)); } inline const SvxShadowItem &SwAttrSet::GetShadow(bool bInP) const - { return (const SvxShadowItem&)Get( RES_SHADOW,bInP); } + { return static_cast<const SvxShadowItem&>(Get( RES_SHADOW,bInP)); } inline const SvxFmtBreakItem &SwAttrSet::GetBreak(bool bInP) const - { return (const SvxFmtBreakItem&)Get( RES_BREAK,bInP); } + { return static_cast<const SvxFmtBreakItem&>(Get( RES_BREAK,bInP)); } inline const SvxMacroItem &SwAttrSet::GetMacro(bool bInP) const - { return (const SvxMacroItem&)Get( RES_FRMMACRO,bInP); } + { return static_cast<const SvxMacroItem&>(Get( RES_FRMMACRO,bInP)); } inline const SvxFrameDirectionItem &SwAttrSet::GetFrmDir(bool bInP) const - { return (const SvxFrameDirectionItem&)Get( RES_FRAMEDIR,bInP); } + { return static_cast<const SvxFrameDirectionItem&>(Get( RES_FRAMEDIR,bInP)); } inline const SdrTextVertAdjustItem &SwAttrSet::GetTextVertAdjust(bool bInP) const - { return (const SdrTextVertAdjustItem&)Get( RES_TEXT_VERT_ADJUST,bInP); } + { return static_cast<const SdrTextVertAdjustItem&>(Get( RES_TEXT_VERT_ADJUST,bInP)); } // Implementation of FrameAttribute methods of SwFmt. inline const SvxPaperBinItem &SwFmt::GetPaperBin(bool bInP) const diff --git a/sw/inc/node.hxx b/sw/inc/node.hxx index 64a7e5c8e803..1098a0f2cbee 100644 --- a/sw/inc/node.hxx +++ b/sw/inc/node.hxx @@ -455,7 +455,7 @@ public: inline bool HasSwAttrSet() const { return mpAttrSet ? sal_True : sal_False; } virtual SwFmtColl* ChgFmtColl( SwFmtColl* ); - SwFmtColl* GetFmtColl() const { return (SwFmtColl*)GetRegisteredIn(); } + SwFmtColl* GetFmtColl() const { return const_cast<SwFmtColl*>(static_cast<const SwFmtColl*>(GetRegisteredIn())); } //FEATURE::CONDCOLL inline SwFmtColl& GetAnyFmtColl() const; @@ -587,43 +587,43 @@ private: inline SwEndNode *SwNode::GetEndNode() { - return ND_ENDNODE == nNodeType ? (SwEndNode*)this : 0; + return ND_ENDNODE == nNodeType ? static_cast<SwEndNode*>(this) : 0; } inline const SwEndNode *SwNode::GetEndNode() const { - return ND_ENDNODE == nNodeType ? (const SwEndNode*)this : 0; + return ND_ENDNODE == nNodeType ? static_cast<const SwEndNode*>(this) : 0; } inline SwStartNode *SwNode::GetStartNode() { - return ND_STARTNODE & nNodeType ? (SwStartNode*)this : 0; + return ND_STARTNODE & nNodeType ? static_cast<SwStartNode*>(this) : 0; } inline const SwStartNode *SwNode::GetStartNode() const { - return ND_STARTNODE & nNodeType ? (const SwStartNode*)this : 0; + return ND_STARTNODE & nNodeType ? static_cast<const SwStartNode*>(this) : 0; } inline SwTableNode *SwNode::GetTableNode() { - return ND_TABLENODE == nNodeType ? (SwTableNode*)this : 0; + return ND_TABLENODE == nNodeType ? static_cast<SwTableNode*>(this) : 0; } inline const SwTableNode *SwNode::GetTableNode() const { - return ND_TABLENODE == nNodeType ? (const SwTableNode*)this : 0; + return ND_TABLENODE == nNodeType ? static_cast<const SwTableNode*>(this) : 0; } inline SwSectionNode *SwNode::GetSectionNode() { - return ND_SECTIONNODE == nNodeType ? (SwSectionNode*)this : 0; + return ND_SECTIONNODE == nNodeType ? static_cast<SwSectionNode*>(this) : 0; } inline const SwSectionNode *SwNode::GetSectionNode() const { - return ND_SECTIONNODE == nNodeType ? (const SwSectionNode*)this : 0; + return ND_SECTIONNODE == nNodeType ? static_cast<const SwSectionNode*>(this) : 0; } inline SwCntntNode *SwNode::GetCntntNode() { - return ND_CONTENTNODE & nNodeType ? (SwCntntNode*)this : 0; + return ND_CONTENTNODE & nNodeType ? static_cast<SwCntntNode*>(this) : 0; } inline const SwCntntNode *SwNode::GetCntntNode() const { - return ND_CONTENTNODE & nNodeType ? (const SwCntntNode*)this : 0; + return ND_CONTENTNODE & nNodeType ? static_cast<const SwCntntNode*>(this) : 0; } inline bool SwNode::IsStartNode() const @@ -681,27 +681,27 @@ inline sal_uLong SwNode::StartOfSectionIndex() const } inline sal_uLong SwNode::EndOfSectionIndex() const { - const SwStartNode* pStNd = IsStartNode() ? (SwStartNode*)this : pStartOfSection; + const SwStartNode* pStNd = IsStartNode() ? static_cast<const SwStartNode*>(this) : pStartOfSection; return pStNd->pEndOfSection->GetIndex(); } inline const SwEndNode* SwNode::EndOfSectionNode() const { - const SwStartNode* pStNd = IsStartNode() ? (SwStartNode*)this : pStartOfSection; + const SwStartNode* pStNd = IsStartNode() ? static_cast<const SwStartNode*>(this) : pStartOfSection; return pStNd->pEndOfSection; } inline SwEndNode* SwNode::EndOfSectionNode() { - SwStartNode* pStNd = IsStartNode() ? (SwStartNode*)this : pStartOfSection; + const SwStartNode* pStNd = IsStartNode() ? static_cast<const SwStartNode*>(this) : pStartOfSection; return pStNd->pEndOfSection; } inline SwNodes& SwNode::GetNodes() { - return (SwNodes&)GetArray(); + return static_cast<SwNodes&>(GetArray()); } inline const SwNodes& SwNode::GetNodes() const { - return (SwNodes&)GetArray(); + return static_cast<SwNodes&>(GetArray()); } inline SwDoc* SwNode::GetDoc() @@ -715,14 +715,14 @@ inline const SwDoc* SwNode::GetDoc() const inline SwFmtColl* SwCntntNode::GetCondFmtColl() const { - return pCondColl ? (SwFmtColl*)pCondColl->GetRegisteredIn() : 0; + return pCondColl ? static_cast<SwFmtColl*>(pCondColl->GetRegisteredIn()) : 0; } inline SwFmtColl& SwCntntNode::GetAnyFmtColl() const { return pCondColl && pCondColl->GetRegisteredIn() - ? *(SwFmtColl*)pCondColl->GetRegisteredIn() - : *(SwFmtColl*)GetRegisteredIn(); + ? *static_cast<SwFmtColl*>(pCondColl->GetRegisteredIn()) + : *const_cast<SwFmtColl*>(static_cast<const SwFmtColl*>(GetRegisteredIn())); } inline const SwAttrSet& SwCntntNode::GetSwAttrSet() const diff --git a/sw/inc/swatrset.hxx b/sw/inc/swatrset.hxx index b60bc45c02cc..e9d9395b46f9 100644 --- a/sw/inc/swatrset.hxx +++ b/sw/inc/swatrset.hxx @@ -199,7 +199,7 @@ public: void GetPresentation( SfxItemPresentation ePres, SfxMapUnit eCoreMetric, SfxMapUnit ePresMetric, OUString &rText ) const; - SwAttrPool* GetPool() const { return (SwAttrPool*)SfxItemSet::GetPool(); } + SwAttrPool* GetPool() const { return static_cast<SwAttrPool*>(SfxItemSet::GetPool()); } // Copy attributes, if necessary across documents. void CopyToModify( SwModify& rMod ) const; diff --git a/sw/inc/swtable.hxx b/sw/inc/swtable.hxx index 50620c08f91c..709aaa4d5410 100644 --- a/sw/inc/swtable.hxx +++ b/sw/inc/swtable.hxx @@ -24,6 +24,7 @@ #include <swtypes.hxx> #include <calbck.hxx> #include <swrect.hxx> +#include <swtblfmt.hxx> #include <memory> #include <boost/noncopyable.hpp> @@ -183,9 +184,9 @@ public: SwTableLines &GetTabLines() { return aLines; } const SwTableLines &GetTabLines() const { return aLines; } - SwFrmFmt* GetFrmFmt() { return (SwFrmFmt*)GetRegisteredIn(); } - SwFrmFmt* GetFrmFmt() const { return (SwFrmFmt*)GetRegisteredIn(); } - SwTableFmt* GetTableFmt() const { return (SwTableFmt*)GetRegisteredIn(); } + SwFrmFmt* GetFrmFmt() { return static_cast<SwFrmFmt*>(GetRegisteredIn()); } + SwFrmFmt* GetFrmFmt() const { return const_cast<SwFrmFmt*>(static_cast<const SwFrmFmt*>(GetRegisteredIn())); } + SwTableFmt* GetTableFmt() const { return const_cast<SwTableFmt*>(static_cast<const SwTableFmt*>(GetRegisteredIn())); } void GetTabCols( SwTabCols &rToFill, const SwTableBox *pStart, bool bHidden = false, bool bCurRowOnly = false ) const; @@ -356,8 +357,8 @@ public: const SwTableBox *GetUpper() const { return pUpper; } void SetUpper( SwTableBox *pNew ) { pUpper = pNew; } - SwFrmFmt* GetFrmFmt() { return (SwFrmFmt*)GetRegisteredIn(); } - SwFrmFmt* GetFrmFmt() const { return (SwFrmFmt*)GetRegisteredIn(); } + SwFrmFmt* GetFrmFmt() { return static_cast<SwFrmFmt*>(GetRegisteredIn()); } + SwFrmFmt* GetFrmFmt() const { return const_cast<SwFrmFmt*>(static_cast<const SwFrmFmt*>(GetRegisteredIn())); } // Creates a own FrmFmt if more lines depend on it. SwFrmFmt* ClaimFrmFmt(); @@ -412,8 +413,8 @@ public: const SwTableLine *GetUpper() const { return pUpper; } void SetUpper( SwTableLine *pNew ) { pUpper = pNew; } - SwFrmFmt* GetFrmFmt() { return (SwFrmFmt*)GetRegisteredIn(); } - SwFrmFmt* GetFrmFmt() const { return (SwFrmFmt*)GetRegisteredIn(); } + SwFrmFmt* GetFrmFmt() { return static_cast<SwFrmFmt*>(GetRegisteredIn()); } + SwFrmFmt* GetFrmFmt() const { return const_cast<SwFrmFmt*>(static_cast<const SwFrmFmt*>(GetRegisteredIn())); } // Creates its own FrmFmt if more boxes depend on it. SwFrmFmt* ClaimFrmFmt(); diff --git a/sw/inc/tox.hxx b/sw/inc/tox.hxx index 4165a66b7255..6cbb7e83d65b 100644 --- a/sw/inc/tox.hxx +++ b/sw/inc/tox.hxx @@ -547,7 +547,7 @@ inline OUString SwTOXMark::GetEntryTypeName() const { return m_aEntryTypeName; } inline const SwTOXType* SwTOXMark::GetTOXType() const - { return (SwTOXType*)GetRegisteredIn(); } + { return static_cast<const SwTOXType*>(GetRegisteredIn()); } inline bool SwTOXMark::IsAlternativeText() const { return !aAltText.isEmpty(); } @@ -685,7 +685,7 @@ inline TOXTypes SwTOXType::GetType() const // SwTOXBase inline const SwTOXType* SwTOXBase::GetTOXType() const - { return (SwTOXType*)GetRegisteredIn(); } + { return static_cast<const SwTOXType*>(GetRegisteredIn()); } inline sal_uInt16 SwTOXBase::GetCreateType() const { return nCreateType; } |