summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2015-03-26 15:31:55 +0100
committerStephan Bergmann <sbergman@redhat.com>2015-03-26 15:33:38 +0100
commit6f3c52bb37f52f57fea6479f1da6c1828fbd85fe (patch)
treed8e6db66db4c28335a62fbec4a282541ae083a85 /sw
parent5429049e3b8fd12e84aca83be7ca19e52920f672 (diff)
const_cast: convert some C-style casts and remove some redundant ones
Change-Id: Icb14a036ea9d7636359b6bc5e0af17568c0d54cb
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/cellatr.hxx4
-rw-r--r--sw/inc/dcontact.hxx2
-rw-r--r--sw/inc/doc.hxx4
-rw-r--r--sw/inc/docsh.hxx2
-rw-r--r--sw/inc/editsh.hxx4
-rw-r--r--sw/inc/fldbas.hxx4
-rw-r--r--sw/inc/fmtpdsc.hxx2
-rw-r--r--sw/inc/frmfmt.hxx6
-rw-r--r--sw/inc/node.hxx6
-rw-r--r--sw/inc/pagedesc.hxx2
-rw-r--r--sw/inc/paratr.hxx2
-rw-r--r--sw/inc/swddetbl.hxx2
-rw-r--r--sw/inc/swtable.hxx2
-rw-r--r--sw/inc/viewsh.hxx4
-rw-r--r--sw/source/core/access/accpara.cxx4
-rw-r--r--sw/source/core/attr/format.cxx6
-rw-r--r--sw/source/core/crsr/crstrvl.cxx4
-rw-r--r--sw/source/core/crsr/findcoll.cxx2
-rw-r--r--sw/source/core/crsr/pam.cxx2
-rw-r--r--sw/source/core/crsr/swcrsr.cxx4
-rw-r--r--sw/source/core/crsr/trvlcol.cxx4
-rw-r--r--sw/source/core/crsr/viscrs.cxx2
-rw-r--r--sw/source/core/doc/DocumentContentOperationsManager.cxx2
-rw-r--r--sw/source/core/doc/DocumentFieldsManager.cxx10
-rw-r--r--sw/source/core/doc/DocumentLayoutManager.cxx2
-rw-r--r--sw/source/core/doc/DocumentLinksAdministrationManager.cxx6
-rw-r--r--sw/source/core/doc/docbasic.cxx4
-rw-r--r--sw/source/core/doc/doccomp.cxx2
-rw-r--r--sw/source/core/doc/docdesc.cxx4
-rw-r--r--sw/source/core/doc/docedt.cxx4
-rw-r--r--sw/source/core/doc/docfmt.cxx4
-rw-r--r--sw/source/core/doc/docglbl.cxx2
-rw-r--r--sw/source/core/doc/docglos.cxx4
-rw-r--r--sw/source/core/doc/doclay.cxx6
-rw-r--r--sw/source/core/doc/docnum.cxx4
-rw-r--r--sw/source/core/doc/docsort.cxx2
-rw-r--r--sw/source/core/doc/doctxm.cxx8
-rw-r--r--sw/source/core/doc/fmtcol.cxx2
-rw-r--r--sw/source/core/doc/ftnidx.cxx2
-rw-r--r--sw/source/core/doc/gctable.cxx6
-rw-r--r--sw/source/core/doc/htmltbl.cxx4
-rw-r--r--sw/source/core/doc/notxtfrm.cxx4
-rw-r--r--sw/source/core/doc/number.cxx2
-rw-r--r--sw/source/core/doc/tblafmt.cxx2
-rw-r--r--sw/source/core/doc/tblcpy.cxx6
-rw-r--r--sw/source/core/doc/tblrwcl.cxx26
-rw-r--r--sw/source/core/docnode/ndcopy.cxx2
-rw-r--r--sw/source/core/docnode/ndnotxt.cxx4
-rw-r--r--sw/source/core/docnode/ndnum.cxx2
-rw-r--r--sw/source/core/docnode/ndsect.cxx6
-rw-r--r--sw/source/core/docnode/ndtbl.cxx30
-rw-r--r--sw/source/core/docnode/ndtbl1.cxx18
-rw-r--r--sw/source/core/docnode/node.cxx8
-rw-r--r--sw/source/core/docnode/section.cxx12
-rw-r--r--sw/source/core/draw/dcontact.cxx4
-rw-r--r--sw/source/core/edit/edfld.cxx2
-rw-r--r--sw/source/core/edit/edglbldc.cxx2
-rw-r--r--sw/source/core/edit/edglss.cxx4
-rw-r--r--sw/source/core/edit/editsh.cxx4
-rw-r--r--sw/source/core/edit/edlingu.cxx4
-rw-r--r--sw/source/core/edit/ednumber.cxx2
-rw-r--r--sw/source/core/edit/edsect.cxx2
-rw-r--r--sw/source/core/edit/edtab.cxx12
-rw-r--r--sw/source/core/fields/authfld.cxx2
-rw-r--r--sw/source/core/fields/cellfml.cxx32
-rw-r--r--sw/source/core/fields/chpfld.cxx4
-rw-r--r--sw/source/core/fields/docufld.cxx2
-rw-r--r--sw/source/core/fields/expfld.cxx4
-rw-r--r--sw/source/core/fields/fldlst.cxx2
-rw-r--r--sw/source/core/fields/reffld.cxx8
-rw-r--r--sw/source/core/fields/tblcalc.cxx2
-rw-r--r--sw/source/core/frmedt/fefly1.cxx10
-rw-r--r--sw/source/core/frmedt/feshview.cxx6
-rw-r--r--sw/source/core/frmedt/fetab.cxx4
-rw-r--r--sw/source/core/frmedt/fews.cxx6
-rw-r--r--sw/source/core/frmedt/tblsel.cxx14
-rw-r--r--sw/source/core/graphic/ndgrf.cxx2
-rw-r--r--sw/source/core/inc/cntfrm.hxx4
-rw-r--r--sw/source/core/inc/frame.hxx4
-rw-r--r--sw/source/core/inc/layfrm.hxx6
-rw-r--r--sw/source/core/inc/txtfrm.hxx2
-rw-r--r--sw/source/core/layout/atrfrm.cxx12
-rw-r--r--sw/source/core/layout/calcmove.cxx2
-rw-r--r--sw/source/core/layout/flowfrm.cxx2
-rw-r--r--sw/source/core/layout/fly.cxx4
-rw-r--r--sw/source/core/layout/flycnt.cxx6
-rw-r--r--sw/source/core/layout/flylay.cxx4
-rw-r--r--sw/source/core/layout/flypos.cxx2
-rw-r--r--sw/source/core/layout/frmtool.cxx4
-rw-r--r--sw/source/core/layout/ftnfrm.cxx8
-rw-r--r--sw/source/core/layout/hffrm.cxx8
-rw-r--r--sw/source/core/layout/layact.cxx2
-rw-r--r--sw/source/core/layout/newfrm.cxx4
-rw-r--r--sw/source/core/layout/pagechg.cxx10
-rw-r--r--sw/source/core/layout/pagedesc.cxx2
-rw-r--r--sw/source/core/layout/paintfrm.cxx16
-rw-r--r--sw/source/core/layout/sectfrm.cxx4
-rw-r--r--sw/source/core/layout/ssfrm.cxx2
-rw-r--r--sw/source/core/layout/tabfrm.cxx16
-rw-r--r--sw/source/core/layout/trvlfrm.cxx20
-rw-r--r--sw/source/core/layout/wsfrm.cxx10
-rw-r--r--sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx4
-rw-r--r--sw/source/core/ole/ndole.cxx6
-rw-r--r--sw/source/core/table/swtable.cxx4
-rw-r--r--sw/source/core/text/EnhancedPDFExportHelper.cxx4
-rw-r--r--sw/source/core/text/atrstck.cxx2
-rw-r--r--sw/source/core/text/blink.cxx4
-rw-r--r--sw/source/core/text/frmcrsr.cxx62
-rw-r--r--sw/source/core/text/frmform.cxx4
-rw-r--r--sw/source/core/text/frminf.cxx30
-rw-r--r--sw/source/core/text/frmpaint.cxx24
-rw-r--r--sw/source/core/text/inftxt.cxx32
-rw-r--r--sw/source/core/text/inftxt.hxx2
-rw-r--r--sw/source/core/text/itratr.cxx16
-rw-r--r--sw/source/core/text/itrcrsr.cxx2
-rw-r--r--sw/source/core/text/itrform2.cxx8
-rw-r--r--sw/source/core/text/itrtxt.cxx6
-rw-r--r--sw/source/core/text/porfld.cxx18
-rw-r--r--sw/source/core/text/porlay.cxx2
-rw-r--r--sw/source/core/text/porlin.cxx4
-rw-r--r--sw/source/core/text/porref.cxx2
-rw-r--r--sw/source/core/text/porrst.cxx4
-rw-r--r--sw/source/core/text/portox.cxx2
-rw-r--r--sw/source/core/text/txtcache.cxx2
-rw-r--r--sw/source/core/text/txtdrop.cxx2
-rw-r--r--sw/source/core/text/txtfld.cxx2
-rw-r--r--sw/source/core/text/txtftn.cxx4
-rw-r--r--sw/source/core/tox/ToxTextGenerator.cxx2
-rw-r--r--sw/source/core/tox/tox.cxx8
-rw-r--r--sw/source/core/txtnode/atrfld.cxx4
-rw-r--r--sw/source/core/txtnode/atrflyin.cxx4
-rw-r--r--sw/source/core/txtnode/fntcache.cxx2
-rw-r--r--sw/source/core/txtnode/fntcap.cxx2
-rw-r--r--sw/source/core/txtnode/ndtxt.cxx2
-rw-r--r--sw/source/core/txtnode/txtatr2.cxx2
-rw-r--r--sw/source/core/txtnode/txtedt.cxx2
-rw-r--r--sw/source/core/undo/SwUndoField.cxx2
-rw-r--r--sw/source/core/undo/undobj1.cxx2
-rw-r--r--sw/source/core/undo/untbl.cxx8
-rw-r--r--sw/source/core/unocore/unochart.cxx2
-rw-r--r--sw/source/core/unocore/unomap.cxx2
-rw-r--r--sw/source/core/unocore/unoobj2.cxx2
-rw-r--r--sw/source/core/unocore/unotbl.cxx8
-rw-r--r--sw/source/filter/basflt/shellio.cxx6
-rw-r--r--sw/source/filter/html/htmlnum.hxx2
-rw-r--r--sw/source/filter/html/htmlsect.cxx12
-rw-r--r--sw/source/filter/html/htmltab.cxx16
-rw-r--r--sw/source/filter/ww8/docxattributeoutput.cxx38
-rw-r--r--sw/source/filter/ww8/docxexport.cxx2
-rw-r--r--sw/source/filter/ww8/wrtw8esh.cxx2
-rw-r--r--sw/source/filter/ww8/wrtw8nds.cxx2
-rw-r--r--sw/source/filter/ww8/wrtw8num.cxx2
-rw-r--r--sw/source/filter/ww8/wrtww8.cxx2
-rw-r--r--sw/source/filter/ww8/ww8par2.cxx10
-rw-r--r--sw/source/filter/ww8/ww8par5.cxx2
-rw-r--r--sw/source/filter/ww8/ww8par6.cxx6
-rw-r--r--sw/source/filter/xml/xmlfmt.cxx2
-rw-r--r--sw/source/filter/xml/xmltble.cxx10
-rw-r--r--sw/source/filter/xml/xmltexti.cxx2
-rw-r--r--sw/source/ui/envelp/envfmt.cxx2
-rw-r--r--sw/source/ui/vba/vbatablehelper.cxx4
-rw-r--r--sw/source/uibase/app/apphdl.cxx2
-rw-r--r--sw/source/uibase/app/docst.cxx6
-rw-r--r--sw/source/uibase/app/docstyle.cxx10
-rw-r--r--sw/source/uibase/app/swmodul1.cxx4
-rw-r--r--sw/source/uibase/cctrl/popbox.cxx2
-rw-r--r--sw/source/uibase/dbui/dbtree.cxx2
-rw-r--r--sw/source/uibase/dochdl/swdtflvr.cxx6
-rw-r--r--sw/source/uibase/docvw/edtdd.cxx6
-rw-r--r--sw/source/uibase/docvw/edtwin.cxx8
-rw-r--r--sw/source/uibase/index/toxmgr.cxx10
-rw-r--r--sw/source/uibase/misc/redlndlg.cxx8
-rw-r--r--sw/source/uibase/shells/frmsh.cxx20
-rw-r--r--sw/source/uibase/shells/grfsh.cxx2
-rw-r--r--sw/source/uibase/shells/textidx.cxx2
-rw-r--r--sw/source/uibase/shells/textsh1.cxx6
-rw-r--r--sw/source/uibase/uiview/pview.cxx4
-rw-r--r--sw/source/uibase/uiview/viewling.cxx4
-rw-r--r--sw/source/uibase/uiview/viewmdi.cxx4
-rw-r--r--sw/source/uibase/uiview/viewtab.cxx10
-rw-r--r--sw/source/uibase/uno/unomailmerge.cxx2
-rw-r--r--sw/source/uibase/utlui/numfmtlb.cxx2
-rw-r--r--sw/source/uibase/wrtsh/wrtsh1.cxx4
-rw-r--r--sw/source/uibase/wrtsh/wrtsh2.cxx8
184 files changed, 561 insertions, 561 deletions
diff --git a/sw/inc/cellatr.hxx b/sw/inc/cellatr.hxx
index 6f398f1a84e4..458c4ca27435 100644
--- a/sw/inc/cellatr.hxx
+++ b/sw/inc/cellatr.hxx
@@ -65,13 +65,13 @@ public:
inline const SwModify* GetDefinedIn() const { return pDefinedIn; }
inline void ChgDefinedIn( const SwModify* pNew )
- { pDefinedIn = (SwModify*)pNew; }
+ { pDefinedIn = const_cast<SwModify*>(pNew); }
// BoxAttribut -> BoxStartNode
virtual const SwNode* GetNodeOfFormula() const SAL_OVERRIDE;
SwTableBox* GetTableBox();
const SwTableBox* GetTableBox() const
- { return ((SwTblBoxFormula*)this)->GetTableBox(); }
+ { return const_cast<SwTblBoxFormula*>(this)->GetTableBox(); }
void ChangeState( const SfxPoolItem* pItem );
void Calc( SwTblCalcPara& rCalcPara, double& rValue );
diff --git a/sw/inc/dcontact.hxx b/sw/inc/dcontact.hxx
index 9747c9325b4b..f49c491cb52e 100644
--- a/sw/inc/dcontact.hxx
+++ b/sw/inc/dcontact.hxx
@@ -51,7 +51,7 @@ class SdrTextObj;
Implementation in dcontact.cxx. */
SW_DLLPUBLIC SwFrmFmt *FindFrmFmt( SdrObject *pObj );
inline const SwFrmFmt *FindFrmFmt( const SdrObject *pObj )
-{ return ::FindFrmFmt( (SdrObject*)pObj ); }
+{ return ::FindFrmFmt( const_cast<SdrObject*>(pObj) ); }
bool HasWrap( const SdrObject* pObj );
void setContextWritingMode( SdrObject* pObj, SwFrm* pAnchor );
diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index a096bbef7cbe..804534ad0c30 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -1686,7 +1686,7 @@ void ClrContourCache();
inline const SwTableNode* SwDoc::IsIdxInTbl( const SwNodeIndex& rIdx ) const
{
- return ((SwDoc*)this)->IsIdxInTbl( rIdx );
+ return const_cast<SwDoc*>(this)->IsIdxInTbl( rIdx );
}
inline SvNumberFormatter* SwDoc::GetNumberFormatter( bool bCreate )
@@ -1698,7 +1698,7 @@ inline SvNumberFormatter* SwDoc::GetNumberFormatter( bool bCreate )
inline const SvNumberFormatter* SwDoc::GetNumberFormatter( bool bCreate ) const
{
- return ((SwDoc*)this)->GetNumberFormatter( bCreate );
+ return const_cast<SwDoc*>(this)->GetNumberFormatter( bCreate );
}
inline void SwDoc::SetOLEPrtNotifyPending( bool bSet )
diff --git a/sw/inc/docsh.hxx b/sw/inc/docsh.hxx
index bfcf69fcadd9..66084a488295 100644
--- a/sw/inc/docsh.hxx
+++ b/sw/inc/docsh.hxx
@@ -225,7 +225,7 @@ public:
/// For Core - it knows the DocShell but not the WrtShell!
SwFEShell *GetFEShell();
const SwFEShell *GetFEShell() const
- { return ((SwDocShell*)this)->GetFEShell(); }
+ { return const_cast<SwDocShell*>(this)->GetFEShell(); }
/// For inserting document.
Reader* StartConvertFrom(SfxMedium& rMedium, SwReader** ppRdr,
diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx
index 8dc3098c4bee..c617931309d7 100644
--- a/sw/inc/editsh.hxx
+++ b/sw/inc/editsh.hxx
@@ -863,7 +863,7 @@ public:
/// Query NumberFormater from document.
SvNumberFormatter* GetNumberFormatter();
const SvNumberFormatter* GetNumberFormatter() const
- { return ((SwEditShell*)this)->GetNumberFormatter(); }
+ { return const_cast<SwEditShell*>(this)->GetNumberFormatter(); }
/// Interfaces for GlobalDocument.
bool IsGlobalDoc() const;
@@ -948,7 +948,7 @@ private:
};
inline const sfx2::LinkManager& SwEditShell::GetLinkManager() const
-{ return ((SwEditShell*)this)->GetLinkManager(); }
+{ return const_cast<SwEditShell*>(this)->GetLinkManager(); }
/// Class for automated call of Start- and EndAction().
class SwActContext {
diff --git a/sw/inc/fldbas.hxx b/sw/inc/fldbas.hxx
index b43e4f9bf09e..c5967c691e09 100644
--- a/sw/inc/fldbas.hxx
+++ b/sw/inc/fldbas.hxx
@@ -272,7 +272,7 @@ public:
inline void SwFieldType::UpdateFlds() const
{
- ((SwFieldType*)this)->ModifyNotification( 0, 0 );
+ const_cast<SwFieldType*>(this)->ModifyNotification( 0, 0 );
}
/** Base class of all fields.
@@ -414,7 +414,7 @@ public:
virtual SwFieldType* ChgTyp( SwFieldType* ) SAL_OVERRIDE;
virtual void SetLanguage(sal_uInt16 nLng) SAL_OVERRIDE;
- inline SwDoc* GetDoc() const { return const_cast<SwValueFieldType*>(static_cast<const SwValueFieldType*>(GetTyp()))->GetDoc(); }
+ inline SwDoc* GetDoc() const { return static_cast<const SwValueFieldType*>(GetTyp())->GetDoc(); }
virtual double GetValue() const;
virtual void SetValue( const double& rVal );
diff --git a/sw/inc/fmtpdsc.hxx b/sw/inc/fmtpdsc.hxx
index 30bcfd2b6cad..fd95501917ba 100644
--- a/sw/inc/fmtpdsc.hxx
+++ b/sw/inc/fmtpdsc.hxx
@@ -77,7 +77,7 @@ public:
/// Query / set where attribute is anchored.
inline const SwModify* GetDefinedIn() const { return pDefinedIn; }
- void ChgDefinedIn( const SwModify* pNew ) { pDefinedIn = (SwModify*)pNew; }
+ void ChgDefinedIn( const SwModify* pNew ) { pDefinedIn = const_cast<SwModify*>(pNew); }
void RegisterToEndNotInfo( SwEndNoteInfo& );
void RegisterToPageDesc( SwPageDesc& );
bool KnowsPageDesc() const;
diff --git a/sw/inc/frmfmt.hxx b/sw/inc/frmfmt.hxx
index 9fbbccf1f5f7..53f3694b55ee 100644
--- a/sw/inc/frmfmt.hxx
+++ b/sw/inc/frmfmt.hxx
@@ -97,7 +97,7 @@ public:
The UserCall knows its SdrObject. */
SwContact *FindContactObj();
const SwContact *FindContactObj() const
- { return ((SwFrmFmt*)this)->FindContactObj(); }
+ { return const_cast<SwFrmFmt*>(this)->FindContactObj(); }
/** @return the SdrObject, that is connected to the ContactObject.
Only DrawFrmFmts are connected to the "real SdrObject". FlyFrmFmts
@@ -105,11 +105,11 @@ public:
"Real SdrObject" has position and a Z-order. */
SdrObject *FindSdrObject();
const SdrObject *FindSdrObject() const
- { return ((SwFrmFmt*)this)->FindSdrObject(); }
+ { return const_cast<SwFrmFmt*>(this)->FindSdrObject(); }
SdrObject *FindRealSdrObject();
const SdrObject *FindRealSdrObject() const
- { return ((SwFrmFmt*)this)->FindRealSdrObject(); }
+ { return const_cast<SwFrmFmt*>(this)->FindRealSdrObject(); }
bool IsLowerOf( const SwFrmFmt& rFmt ) const;
diff --git a/sw/inc/node.hxx b/sw/inc/node.hxx
index 4537fde88258..843daebc5af5 100644
--- a/sw/inc/node.hxx
+++ b/sw/inc/node.hxx
@@ -660,15 +660,15 @@ inline bool SwNode::IsGrfNode() const
inline const SwStartNode* SwNode::FindSttNodeByType( SwStartNodeType eTyp ) const
{
- return ((SwNode*)this)->FindSttNodeByType( eTyp );
+ return const_cast<SwNode*>(this)->FindSttNodeByType( eTyp );
}
inline const SwTableNode* SwNode::FindTableNode() const
{
- return ((SwNode*)this)->FindTableNode();
+ return const_cast<SwNode*>(this)->FindTableNode();
}
inline const SwSectionNode* SwNode::FindSectionNode() const
{
- return ((SwNode*)this)->FindSectionNode();
+ return const_cast<SwNode*>(this)->FindSectionNode();
}
inline sal_uLong SwNode::StartOfSectionIndex() const
{
diff --git a/sw/inc/pagedesc.hxx b/sw/inc/pagedesc.hxx
index 2743a6bb1ff6..a5bed9c47649 100644
--- a/sw/inc/pagedesc.hxx
+++ b/sw/inc/pagedesc.hxx
@@ -253,7 +253,7 @@ public:
inline void SwPageDesc::SetFollow( const SwPageDesc* pNew )
{
- pFollow = pNew ? (SwPageDesc*)pNew : this;
+ pFollow = pNew ? const_cast<SwPageDesc*>(pNew) : this;
}
inline bool SwPageDesc::IsHeaderShared() const
diff --git a/sw/inc/paratr.hxx b/sw/inc/paratr.hxx
index ae8249943b21..f606af9c672b 100644
--- a/sw/inc/paratr.hxx
+++ b/sw/inc/paratr.hxx
@@ -107,7 +107,7 @@ public:
/// Get and set Modify pointer.
inline const SwModify* GetDefinedIn() const { return pDefinedIn; }
inline void ChgDefinedIn( const SwModify* pNew )
- { pDefinedIn = (SwModify*)pNew; }
+ { pDefinedIn = const_cast<SwModify*>(pNew); }
};
class SwRegisterItem : public SfxBoolItem
diff --git a/sw/inc/swddetbl.hxx b/sw/inc/swddetbl.hxx
index f66e723d312d..025fe81ce21c 100644
--- a/sw/inc/swddetbl.hxx
+++ b/sw/inc/swddetbl.hxx
@@ -47,7 +47,7 @@ protected:
inline const SwDDEFieldType* SwDDETable::GetDDEFldType() const
{
- return ((SwDDETable*)this)->GetDDEFldType();
+ return const_cast<SwDDETable*>(this)->GetDDEFldType();
}
#endif
diff --git a/sw/inc/swtable.hxx b/sw/inc/swtable.hxx
index f20b88524a4b..152859f041fa 100644
--- a/sw/inc/swtable.hxx
+++ b/sw/inc/swtable.hxx
@@ -285,7 +285,7 @@ public:
// Get box, whose start index is set on nBoxStt.
SwTableBox* GetTblBox( sal_uLong nSttIdx );
const SwTableBox* GetTblBox( sal_uLong nSttIdx ) const
- { return ((SwTable*)this)->GetTblBox( nSttIdx ); }
+ { return const_cast<SwTable*>(this)->GetTblBox( nSttIdx ); }
// Returns true if table contains nestings.
bool IsTblComplex() const;
diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx
index 2bc8260ba592..b1a03a43dabe 100644
--- a/sw/inc/viewsh.hxx
+++ b/sw/inc/viewsh.hxx
@@ -476,7 +476,7 @@ public:
// DrawView may be used at UI.
SdrView *GetDrawView();
- const SdrView *GetDrawView() const { return ((SwViewShell*)this)->GetDrawView(); }
+ const SdrView *GetDrawView() const { return const_cast<SwViewShell*>(this)->GetDrawView(); }
// Take care that MarkList is up-to-date in any case (Bug 57153).
SdrView *GetDrawViewWithValidMarkList();
@@ -626,7 +626,7 @@ inline void SwViewShell::UnlockPaint( bool bVirDev )
}
inline const SfxItemPool& SwViewShell::GetAttrPool() const
{
- return ((SwViewShell*)this)->GetAttrPool();
+ return const_cast<SwViewShell*>(this)->GetAttrPool();
}
#endif // INCLUDED_SW_INC_VIEWSH_HXX
diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx
index e58efbe8e5fb..bc89339f7fcc 100644
--- a/sw/source/core/access/accpara.cxx
+++ b/sw/source/core/access/accpara.cxx
@@ -3163,7 +3163,7 @@ uno::Reference< XAccessibleHyperlink > SAL_CALL
SwHyperlinkIter_Impl aHIter( pTxtFrm );
sal_Int32 nTIndex = -1;
SwTOXSortTabBase* pTBase = GetTOXSortTabBase();
- SwTxtAttr* pHt = (SwTxtAttr*)(aHIter.next());
+ SwTxtAttr* pHt = const_cast<SwTxtAttr*>(aHIter.next());
while( (nLinkIndex < getHyperLinkCount()) && nTIndex < nLinkIndex)
{
sal_Int32 nHStt = -1;
@@ -3227,7 +3227,7 @@ uno::Reference< XAccessibleHyperlink > SAL_CALL
// iterate next
if( bH )
// iterate next hyperlink
- pHt = (SwTxtAttr*)(aHIter.next());
+ pHt = const_cast<SwTxtAttr*>(aHIter.next());
else if(bTOC)
continue;
else
diff --git a/sw/source/core/attr/format.cxx b/sw/source/core/attr/format.cxx
index ba6a742302f9..4f4fe078c40b 100644
--- a/sw/source/core/attr/format.cxx
+++ b/sw/source/core/attr/format.cxx
@@ -187,11 +187,11 @@ void SwFmt::CopyAttrs( const SwFmt& rFmt, bool bReplace )
SetInSwFntCache( false );
// special treatments for some attributes
- SwAttrSet* pChgSet = (SwAttrSet*)&rFmt.aSet;
+ SwAttrSet* pChgSet = const_cast<SwAttrSet*>(&rFmt.aSet);
if( !bReplace ) // refresh only those that are not set?
{
- if( pChgSet == (SwAttrSet*)&rFmt.aSet )
+ if( pChgSet == &rFmt.aSet )
pChgSet = new SwAttrSet( rFmt.aSet );
pChgSet->Differentiate( aSet );
}
@@ -215,7 +215,7 @@ void SwFmt::CopyAttrs( const SwFmt& rFmt, bool bReplace )
}
}
- if( pChgSet != (SwAttrSet*)&rFmt.aSet ) // was a Set created?
+ if( pChgSet != &rFmt.aSet ) // was a Set created?
delete pChgSet;
}
diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx
index 239faa823c4d..425fa09856f0 100644
--- a/sw/source/core/crsr/crstrvl.cxx
+++ b/sw/source/core/crsr/crstrvl.cxx
@@ -831,7 +831,7 @@ SwField* SwCrsrShell::GetFieldAtCrsr(
: 1;
if ( ( pCrsr->End()->nContent.GetIndex() - pCrsr->Start()->nContent.GetIndex() ) <= nTxtFldLength )
{
- pFieldAtCrsr = (SwField*)pTxtFld->GetFmtFld().GetField();
+ pFieldAtCrsr = const_cast<SwField*>(pTxtFld->GetFmtFld().GetField());
}
}
@@ -1783,7 +1783,7 @@ bool SwCrsrShell::GotoINetAttr( const SwTxtINetFmt& rAttr )
SwCrsrSaveState aSaveState( *pCrsr );
pCrsr->GetPoint()->nNode = *rAttr.GetpTxtNode();
- pCrsr->GetPoint()->nContent.Assign( (SwTxtNode*)rAttr.GetpTxtNode(),
+ pCrsr->GetPoint()->nContent.Assign( const_cast<SwTxtNode*>(rAttr.GetpTxtNode()),
rAttr.GetStart() );
bRet = !pCrsr->IsSelOvr();
if( bRet )
diff --git a/sw/source/core/crsr/findcoll.cxx b/sw/source/core/crsr/findcoll.cxx
index f0e88e1cf8ed..8468eb4e21d1 100644
--- a/sw/source/core/crsr/findcoll.cxx
+++ b/sw/source/core/crsr/findcoll.cxx
@@ -52,7 +52,7 @@ int SwFindParaFmtColl::Find( SwPaM* pCrsr, SwMoveFn fnMove, const SwPaM* pRegion
nRet = FIND_NOT_FOUND;
else if( pReplColl )
{
- pCrsr->GetDoc()->SetTxtFmtColl( *pCrsr, (SwTxtFmtColl*)pReplColl );
+ pCrsr->GetDoc()->SetTxtFmtColl( *pCrsr, const_cast<SwTxtFmtColl*>(pReplColl) );
nRet = FIND_NO_RING;
}
return nRet;
diff --git a/sw/source/core/crsr/pam.cxx b/sw/source/core/crsr/pam.cxx
index 6f1efcab5ad5..1e94830d54ab 100644
--- a/sw/source/core/crsr/pam.cxx
+++ b/sw/source/core/crsr/pam.cxx
@@ -520,7 +520,7 @@ SwPaM* SwPaM::MakeRegion( SwMoveFn fnMove, const SwPaM * pOrigRg )
}
else
{
- pPam = new SwPaM( *(SwPaM*)pOrigRg ); // given search area
+ pPam = new SwPaM( *const_cast<SwPaM*>(pOrigRg) ); // given search area
// make sure that SPoint is on the "real" start position
// FORWARD: SPoint always smaller than GetMark
// BACKWARD: SPoint always bigger than GetMark
diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx
index 93e17cfb9c2f..83e08708c90a 100644
--- a/sw/source/core/crsr/swcrsr.cxx
+++ b/sw/source/core/crsr/swcrsr.cxx
@@ -366,7 +366,7 @@ bool SwCursor::IsSelOvr( int eFlags )
}
}
- SwCntntNode* pCNd = (pFrm != NULL) ? (SwCntntNode*)pFrm->GetNode() : NULL;
+ SwCntntNode* pCNd = (pFrm != NULL) ? const_cast<SwCntntNode*>(pFrm->GetNode()) : NULL;
if ( pCNd != NULL )
{
// set this CntntNode as new position
@@ -2250,7 +2250,7 @@ SwCursor* SwTableCursor::MakeBoxSels( SwCursor* pAktCrsr )
void SwTableCursor::InsertBox( const SwTableBox& rTblBox )
{
- SwTableBox* pBox = (SwTableBox*)&rTblBox;
+ SwTableBox* pBox = const_cast<SwTableBox*>(&rTblBox);
m_SelectedBoxes.insert(pBox);
m_bChanged = true;
}
diff --git a/sw/source/core/crsr/trvlcol.cxx b/sw/source/core/crsr/trvlcol.cxx
index 71ae0eb50814..ffd22a28cd78 100644
--- a/sw/source/core/crsr/trvlcol.cxx
+++ b/sw/source/core/crsr/trvlcol.cxx
@@ -29,7 +29,7 @@ SwLayoutFrm* GetCurrColumn( const SwLayoutFrm* pLayFrm )
{
while( pLayFrm && !pLayFrm->IsColumnFrm() )
pLayFrm = pLayFrm->GetUpper();
- return (SwLayoutFrm*)pLayFrm;
+ return const_cast<SwLayoutFrm*>(pLayFrm);
}
SwLayoutFrm* GetNextColumn( const SwLayoutFrm* pLayFrm )
@@ -46,7 +46,7 @@ SwLayoutFrm* GetPrevColumn( const SwLayoutFrm* pLayFrm )
SwCntntFrm* GetColumnStt( const SwLayoutFrm* pColFrm )
{
- return pColFrm ? (SwCntntFrm*)pColFrm->ContainsCntnt() : 0;
+ return pColFrm ? const_cast<SwCntntFrm*>(pColFrm->ContainsCntnt()) : 0;
}
SwCntntFrm* GetColumnEnd( const SwLayoutFrm* pColFrm )
diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx
index a26cd78fa2a7..89962ec38276 100644
--- a/sw/source/core/crsr/viscrs.cxx
+++ b/sw/source/core/crsr/viscrs.cxx
@@ -423,7 +423,7 @@ void SwSelPaintRects::HighlightInputFld()
}
else
{
- SdrView* pView = (SdrView*)GetShell()->GetDrawView();
+ SdrView* pView = const_cast<SdrView*>(GetShell()->GetDrawView());
SdrPaintWindow* pCandidate = pView->GetPaintWindow(0);
rtl::Reference<sdr::overlay::OverlayManager> xTargetOverlay = pCandidate->GetOverlayManager();
diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx
index b2c13c2e75de..d6e1c163e1f1 100644
--- a/sw/source/core/doc/DocumentContentOperationsManager.cxx
+++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx
@@ -2289,7 +2289,7 @@ bool DocumentContentOperationsManager::MoveAndJoin( SwPaM& rPaM, SwPosition& rPo
bool DocumentContentOperationsManager::Overwrite( const SwPaM &rRg, const OUString &rStr )
{
- SwPosition& rPt = *(SwPosition*)rRg.GetPoint();
+ SwPosition& rPt = *const_cast<SwPosition*>(rRg.GetPoint());
if( m_rDoc.GetAutoCorrExceptWord() ) // Add to AutoCorrect
{
if( 1 == rStr.getLength() )
diff --git a/sw/source/core/doc/DocumentFieldsManager.cxx b/sw/source/core/doc/DocumentFieldsManager.cxx
index 0dbe47ac7944..e1746a22b216 100644
--- a/sw/source/core/doc/DocumentFieldsManager.cxx
+++ b/sw/source/core/doc/DocumentFieldsManager.cxx
@@ -475,7 +475,7 @@ bool DocumentFieldsManager::UpdateFld(SwTxtFld * pDstTxtFld, SwField & rSrcFld,
bool bTblSelBreak = false;
- SwFmtFld * pDstFmtFld = (SwFmtFld*)&pDstTxtFld->GetFmtFld();
+ SwFmtFld * pDstFmtFld = const_cast<SwFmtFld*>(&pDstTxtFld->GetFmtFld());
SwField * pDstFld = pDstFmtFld->GetField();
sal_uInt16 nFldWhich = rSrcFld.GetTyp()->Which();
SwNodeIndex aTblNdIdx(pDstTxtFld->GetTxtNode());
@@ -906,7 +906,7 @@ void DocumentFieldsManager::UpdateExpFlds( SwTxtFld* pUpdtFld, bool bUpdRefFlds
int nShownSections = 0;
for( _SetGetExpFlds::const_iterator it = mpUpdtFlds->GetSortLst()->begin(); it != mpUpdtFlds->GetSortLst()->end(); ++it )
{
- SwSection* pSect = (SwSection*)(*it)->GetSection();
+ SwSection* pSect = const_cast<SwSection*>((*it)->GetSection());
if ( pSect && !pSect->IsCondHidden())
nShownSections++;
}
@@ -914,7 +914,7 @@ void DocumentFieldsManager::UpdateExpFlds( SwTxtFld* pUpdtFld, bool bUpdRefFlds
OUString aNew;
for( _SetGetExpFlds::const_iterator it = mpUpdtFlds->GetSortLst()->begin(); it != mpUpdtFlds->GetSortLst()->end(); ++it )
{
- SwSection* pSect = (SwSection*)(*it)->GetSection();
+ SwSection* pSect = const_cast<SwSection*>((*it)->GetSection());
if( pSect )
{
@@ -947,14 +947,14 @@ void DocumentFieldsManager::UpdateExpFlds( SwTxtFld* pUpdtFld, bool bUpdRefFlds
continue;
}
- SwTxtFld* pTxtFld = (SwTxtFld*)(*it)->GetTxtFld();
+ SwTxtFld* pTxtFld = const_cast<SwTxtFld*>((*it)->GetTxtFld());
if( !pTxtFld )
{
OSL_ENSURE( false, "what's wrong now'" );
continue;
}
- SwFmtFld* pFmtFld = (SwFmtFld*)&pTxtFld->GetFmtFld();
+ SwFmtFld* pFmtFld = const_cast<SwFmtFld*>(&pTxtFld->GetFmtFld());
const SwField* pFld = pFmtFld->GetField();
switch( nWhich = pFld->GetTyp()->Which() )
diff --git a/sw/source/core/doc/DocumentLayoutManager.cxx b/sw/source/core/doc/DocumentLayoutManager.cxx
index 450fac11da72..88fabcaf1c84 100644
--- a/sw/source/core/doc/DocumentLayoutManager.cxx
+++ b/sw/source/core/doc/DocumentLayoutManager.cxx
@@ -340,7 +340,7 @@ SwFrmFmt *DocumentLayoutManager::CopyLayoutFmt(
const bool bDraw = RES_DRAWFRMFMT == rSource.Which();
OSL_ENSURE( bFly || bDraw, "this method only works for fly or draw" );
- SwDoc* pSrcDoc = (SwDoc*)rSource.GetDoc();
+ SwDoc* pSrcDoc = const_cast<SwDoc*>(rSource.GetDoc());
// May we copy this object?
// We may, unless it's 1) it's a control (and therfore a draw)
diff --git a/sw/source/core/doc/DocumentLinksAdministrationManager.cxx b/sw/source/core/doc/DocumentLinksAdministrationManager.cxx
index 0d5edf68e969..c336871bea49 100644
--- a/sw/source/core/doc/DocumentLinksAdministrationManager.cxx
+++ b/sw/source/core/doc/DocumentLinksAdministrationManager.cxx
@@ -154,8 +154,8 @@ namespace
&pTableFmt->GetDoc()->GetNodes() == &pFBox->GetSttNd()->GetNodes() )
{
// a table in the normal NodesArr
- pItem->pTblNd = (SwTableNode*)
- pFBox->GetSttNd()->FindTableNode();
+ pItem->pTblNd = const_cast<SwTableNode*>(
+ pFBox->GetSttNd()->FindTableNode());
return false;
}
// If the name is already correct, but not the rest then we don't have them.
@@ -471,7 +471,7 @@ bool DocumentLinksAdministrationManager::SelectServerObj( const OUString& rStr,
SwNode* pNd;
const SwFlyFrmFmt* pFlyFmt = m_rDoc.FindFlyByName( sName );
if( pFlyFmt &&
- 0 != ( pIdx = (SwNodeIndex*)pFlyFmt->GetCntnt().GetCntntIdx() ) &&
+ 0 != ( pIdx = const_cast<SwNodeIndex*>(pFlyFmt->GetCntnt().GetCntntIdx()) ) &&
!( pNd = &pIdx->GetNode())->IsNoTxtNode() )
{
rpRange = new SwNodeRange( *pNd, 1, *pNd->EndOfSectionNode() );
diff --git a/sw/source/core/doc/docbasic.cxx b/sw/source/core/doc/docbasic.cxx
index e460114f2452..4b04920f8f78 100644
--- a/sw/source/core/doc/docbasic.cxx
+++ b/sw/source/core/doc/docbasic.cxx
@@ -162,7 +162,7 @@ sal_uInt16 SwDoc::CallEvent( sal_uInt16 nEvent, const SwCallMouseEvent& rCallEve
case EVENT_OBJECT_URLITEM:
case EVENT_OBJECT_IMAGE:
{
- const SwFrmFmt* pFmt = (SwFrmFmt*)rCallEvent.PTR.pFmt;
+ const SwFrmFmt* pFmt = rCallEvent.PTR.pFmt;
if( bCheckPtr )
{
if ( GetSpzFrmFmts()->Contains( pFmt ) )
@@ -178,7 +178,7 @@ sal_uInt16 SwDoc::CallEvent( sal_uInt16 nEvent, const SwCallMouseEvent& rCallEve
const IMapObject* pIMapObj = rCallEvent.PTR.IMAP.pIMapObj;
if( bCheckPtr )
{
- const SwFrmFmt* pFmt = (SwFrmFmt*)rCallEvent.PTR.IMAP.pFmt;
+ const SwFrmFmt* pFmt = rCallEvent.PTR.IMAP.pFmt;
const ImageMap* pIMap;
if( GetSpzFrmFmts()->Contains( pFmt ) &&
0 != (pIMap = pFmt->GetURL().GetMap()) )
diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx
index 44a7f2561b38..aab09cc90c96 100644
--- a/sw/source/core/doc/doccomp.cxx
+++ b/sw/source/core/doc/doccomp.cxx
@@ -1291,7 +1291,7 @@ bool SwCompareLine::ChangesInLine( const SwCompareLine& rLine,
if( ND_TEXTNODE == rNode.GetNodeType() &&
ND_TEXTNODE == rLine.GetNode().GetNodeType() )
{
- SwTxtNode& rDstNd = *(SwTxtNode*)rNode.GetTxtNode();
+ SwTxtNode& rDstNd = *const_cast<SwTxtNode*>(rNode.GetTxtNode());
const SwTxtNode& rSrcNd = *rLine.GetNode().GetTxtNode();
SwDoc* pDstDoc = rDstNd.GetDoc();
diff --git a/sw/source/core/doc/docdesc.cxx b/sw/source/core/doc/docdesc.cxx
index d5015fe1c628..6cc694395523 100644
--- a/sw/source/core/doc/docdesc.cxx
+++ b/sw/source/core/doc/docdesc.cxx
@@ -299,7 +299,7 @@ void SwDoc::CopyMasterHeader(const SwPageDesc &rChged, const SwFmtHeader &rHead,
}
else
::lcl_DescSetAttr( *pRight,
- *(SwFrmFmt*)rFmtHead.GetHeaderFmt(), false );
+ *const_cast<SwFrmFmt*>(rFmtHead.GetHeaderFmt()), false );
}
}
}
@@ -371,7 +371,7 @@ void SwDoc::CopyMasterFooter(const SwPageDesc &rChged, const SwFmtFooter &rFoot,
}
else
::lcl_DescSetAttr( *pRight,
- *(SwFrmFmt*)rFmtFoot.GetFooterFmt(), false );
+ *const_cast<SwFrmFmt*>(rFmtFoot.GetFooterFmt()), false );
}
}
}
diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx
index 55100ff888d1..2c090460a8a5 100644
--- a/sw/source/core/doc/docedt.cxx
+++ b/sw/source/core/doc/docedt.cxx
@@ -248,7 +248,7 @@ _SaveRedlEndPosForRestore::_SaveRedlEndPosForRestore( const SwNodeIndex& rInsIdx
pSavArr = new std::vector<SwPosition*>;
pSavIdx = new SwNodeIndex( rInsIdx, -1 );
}
- pSavArr->push_back( (SwPosition*)pEnd );
+ pSavArr->push_back( const_cast<SwPosition*>(pEnd) );
}
}
}
@@ -532,7 +532,7 @@ uno::Any SwDoc::Spell( SwPaM& rPaM,
nStat = nPageNr - *pPageSt + 1;
else
nStat = nPageNr + *pPageCnt - *pPageSt + 1;
- ::SetProgressState( nStat, (SwDocShell*)GetDocShell() );
+ ::SetProgressState( nStat, const_cast<SwDocShell*>(GetDocShell()) );
}
//Spell() changes the pSpellArgs in case an error is found
sal_Int32 nBeginGrammarCheck = 0;
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index fd6f4fe0fb1b..6b339cb4f26a 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -242,7 +242,7 @@ void SwDoc::ResetAttrs( const SwPaM &rRg,
const std::set<sal_uInt16> &rAttrs,
const bool bSendDataChangedEvents )
{
- SwPaM* pPam = (SwPaM*)&rRg;
+ SwPaM* pPam = const_cast<SwPaM*>(&rRg);
if( !bTxtAttr && !rAttrs.empty() && RES_TXTATR_END > *(rAttrs.begin()) )
bTxtAttr = true;
@@ -1119,7 +1119,7 @@ SwFmt* SwDoc::CopyFmt( const SwFmt& rFmt,
}
// Search for the "parent" first
- SwFmt* pParent = (SwFmt*)&rDfltFmt;
+ SwFmt* pParent = const_cast<SwFmt*>(&rDfltFmt);
if( rFmt.DerivedFrom() && pParent != rFmt.DerivedFrom() )
pParent = CopyFmt( *rFmt.DerivedFrom(), rFmtArr,
fnCopyFmt, rDfltFmt );
diff --git a/sw/source/core/doc/docglbl.cxx b/sw/source/core/doc/docglbl.cxx
index f044096e59ad..33a251d03902 100644
--- a/sw/source/core/doc/docglbl.cxx
+++ b/sw/source/core/doc/docglbl.cxx
@@ -161,7 +161,7 @@ bool SwDoc::SplitDoc( sal_uInt16 eDocType, const OUString& rPath, bool bOutline,
return false;
sal_uInt16 nOutl = 0;
- SwOutlineNodes* pOutlNds = (SwOutlineNodes*)&GetNodes().GetOutLineNds();
+ SwOutlineNodes* pOutlNds = const_cast<SwOutlineNodes*>(&GetNodes().GetOutLineNds());
boost::scoped_ptr<SwOutlineNodes> xTmpOutlNds;
SwNodePtr pStartNd;
diff --git a/sw/source/core/doc/docglos.cxx b/sw/source/core/doc/docglos.cxx
index 0e08b60fbd8d..894c631994b2 100644
--- a/sw/source/core/doc/docglos.cxx
+++ b/sw/source/core/doc/docglos.cxx
@@ -172,8 +172,8 @@ bool SwDoc::InsertGlossary( SwTextBlocks& rBlock, const OUString& rEntry,
do {
SwPosition& rInsPos = *_pStartCrsr->GetPoint();
- SwStartNode* pBoxSttNd = (SwStartNode*)rInsPos.nNode.GetNode().
- FindTableBoxStartNode();
+ SwStartNode* pBoxSttNd = const_cast<SwStartNode*>(rInsPos.nNode.GetNode().
+ FindTableBoxStartNode());
if( pBoxSttNd && 2 == pBoxSttNd->EndOfSectionIndex() -
pBoxSttNd->GetIndex() &&
diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx
index 2b2b527753c3..a9e82f90b9d0 100644
--- a/sw/source/core/doc/doclay.cxx
+++ b/sw/source/core/doc/doclay.cxx
@@ -384,8 +384,8 @@ SwFlyFrmFmt* SwDoc::MakeFlyAndMove( const SwPaM& rPam, const SfxItemSet& rSet,
// original one and move (copy and delete) the selected boxes.
// The size is corrected on a percentage basis.
- SwTableNode* pTblNd = (SwTableNode*)(*pSelBoxes)[0]->
- GetSttNd()->FindTableNode();
+ SwTableNode* pTblNd = const_cast<SwTableNode*>((*pSelBoxes)[0]->
+ GetSttNd()->FindTableNode());
if( !pTblNd )
break;
@@ -1113,7 +1113,7 @@ lcl_InsertDrawLabel( SwDoc & rDoc, SwTxtFmtColls *const pTxtFmtCollTbl,
#if OSL_DEBUG_LEVEL > 0
OSL_ENSURE( pHnt && pHnt->Which() == RES_TXTATR_FLYCNT,
"Missing FlyInCnt-Hint." );
- OSL_ENSURE( pHnt && const_cast<SwFmtFlyCnt&>(pHnt->GetFlyCnt()).
+ OSL_ENSURE( pHnt && pHnt->GetFlyCnt().
GetFrmFmt() == (SwFrmFmt*)pOldFmt,
"Wrong TxtFlyCnt-Hint." );
#endif
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index 2c85114aae02..0eedcc134354 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -1452,7 +1452,7 @@ static bool lcl_GotoNextPrevNum( SwPosition& rPos, bool bNext,
static_cast<sal_uInt8>(pNd->GetActualListLevel()) ))
{
rPos.nNode = aIdx;
- rPos.nContent.Assign( (SwTxtNode*)pNd, 0 );
+ rPos.nContent.Assign( const_cast<SwTxtNode*>(pNd), 0 );
bRet = true;
break;
}
@@ -1482,7 +1482,7 @@ static bool lcl_GotoNextPrevNum( SwPosition& rPos, bool bNext,
else
{
rPos.nNode.Assign( *pLast );
- rPos.nContent.Assign( (SwTxtNode*)pLast, 0 );
+ rPos.nContent.Assign( const_cast<SwTxtNode*>(pLast), 0 );
}
bRet = true;
}
diff --git a/sw/source/core/doc/docsort.cxx b/sw/source/core/doc/docsort.cxx
index 73dfa7704519..799981638ff6 100644
--- a/sw/source/core/doc/docsort.cxx
+++ b/sw/source/core/doc/docsort.cxx
@@ -477,7 +477,7 @@ bool SwDoc::SortTbl(const SwSelBoxes& rBoxes, const SwSortOptions& rOpt)
{
// Via SwDoc for Undo!
OSL_ENSURE( !rBoxes.empty(), "no valid Box list" );
- SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode();
+ SwTableNode* pTblNd = const_cast<SwTableNode*>(rBoxes[0]->GetSttNd()->FindTableNode());
if( !pTblNd )
return false;
diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx
index 150c9f216232..613310607cf9 100644
--- a/sw/source/core/doc/doctxm.cxx
+++ b/sw/source/core/doc/doctxm.cxx
@@ -141,7 +141,7 @@ sal_uInt16 SwDoc::GetCurTOXMark( const SwPosition& rPos,
// the attributes are sorted by Start!
break;
- SwTOXMark* pTMark = (SwTOXMark*) &pHt->GetTOXMark();
+ SwTOXMark* pTMark = const_cast<SwTOXMark*>(&pHt->GetTOXMark());
rArr.push_back( pTMark );
}
return rArr.size();
@@ -773,7 +773,7 @@ void SwTOXBaseSection::Update(const SfxItemSet* pAttr,
maMSTOCExpression.clear();
}
- SwDoc* pDoc = (SwDoc*)pSectNd->GetDoc();
+ SwDoc* pDoc = const_cast<SwDoc*>(pSectNd->GetDoc());
assert(pDoc); //Where is the document?
@@ -853,7 +853,7 @@ void SwTOXBaseSection::Update(const SfxItemSet* pAttr,
: 0;
SwNode2Layout aN2L( *pSectNd );
- ((SwSectionNode*)pSectNd)->DelFrms();
+ const_cast<SwSectionNode*>(pSectNd)->DelFrms();
// remove old content an insert one empty textnode (to hold the layout!)
SwTxtNode* pFirstEmptyNd;
@@ -1649,7 +1649,7 @@ void SwTOXBaseSection::UpdatePageNum()
const SwTxtNode* pTxtNd = pBase->pTOXNd->GetTxtNode();
OSL_ENSURE( pTxtNd, "no TextNode, wrong TOC" );
- _UpdatePageNum( (SwTxtNode*)pTxtNd, aNums, aDescs, pMainNums,
+ _UpdatePageNum( const_cast<SwTxtNode*>(pTxtNd), aNums, aDescs, pMainNums,
aIntl );
}
DELETEZ(pMainNums);
diff --git a/sw/source/core/doc/fmtcol.cxx b/sw/source/core/doc/fmtcol.cxx
index c700cf453777..cafbb4791bdc 100644
--- a/sw/source/core/doc/fmtcol.cxx
+++ b/sw/source/core/doc/fmtcol.cxx
@@ -500,7 +500,7 @@ SwCollCondition::SwCollCondition( SwTxtFmtColl* pColl, sal_uLong nMasterCond,
}
SwCollCondition::SwCollCondition( const SwCollCondition& rCopy )
- : SwClient( (SwModify*)rCopy.GetRegisteredIn() ), nCondition( rCopy.nCondition )
+ : SwClient( const_cast<SwModify*>(rCopy.GetRegisteredIn()) ), nCondition( rCopy.nCondition )
{
if( USRFLD_EXPRESSION & rCopy.nCondition )
aSubCondition.pFldExpression = new OUString( *rCopy.GetFldExpression() );
diff --git a/sw/source/core/doc/ftnidx.cxx b/sw/source/core/doc/ftnidx.cxx
index df909db1d876..998996988767 100644
--- a/sw/source/core/doc/ftnidx.cxx
+++ b/sw/source/core/doc/ftnidx.cxx
@@ -163,7 +163,7 @@ void SwFtnIdxs::UpdateAllFtn()
return;
// Get the NodesArray via the StartIndex of the first Footnote
- SwDoc* pDoc = (SwDoc*) (*this)[ 0 ]->GetTxtNode().GetDoc();
+ SwDoc* pDoc = const_cast<SwDoc*>((*this)[ 0 ]->GetTxtNode().GetDoc());
SwTxtFtn* pTxtFtn;
const SwEndNoteInfo& rEndInfo = pDoc->GetEndNoteInfo();
const SwFtnInfo& rFtnInfo = pDoc->GetFtnInfo();
diff --git a/sw/source/core/doc/gctable.cxx b/sw/source/core/doc/gctable.cxx
index 7e52a678df6f..1951495e7383 100644
--- a/sw/source/core/doc/gctable.cxx
+++ b/sw/source/core/doc/gctable.cxx
@@ -87,7 +87,7 @@ static void lcl_GCBorder_GetLastBox_B( const SwTableBox* pBox, SwTableBoxes* pPa
lcl_GCBorder_GetLastBox_L( pLine, pPara );
}
else
- pPara->push_back( (SwTableBox*)pBox );
+ pPara->push_back( const_cast<SwTableBox*>(pBox) );
}
// Find the "end" of the passed BorderLine. Returns the "Layout"Pos!
@@ -126,7 +126,7 @@ static void lcl_GCBorder_DelBorder( const SwCollectTblLineBoxes& rCollTLB,
sal_uInt16 nEndPos,
SwShareBoxFmts* pShareFmts )
{
- SwTableBox* pBox = (SwTableBox*)&rCollTLB.GetBox( rStt );
+ SwTableBox* pBox = const_cast<SwTableBox*>(&rCollTLB.GetBox( rStt ));
sal_uInt16 nNextPos;
const SvxBorderLine* pLn = &rLine;
@@ -148,7 +148,7 @@ static void lcl_GCBorder_DelBorder( const SwCollectTblLineBoxes& rCollTLB,
if( ++rStt >= rCollTLB.Count() )
break;
- pBox = (SwTableBox*)&rCollTLB.GetBox( rStt, &nNextPos );
+ pBox = const_cast<SwTableBox*>(&rCollTLB.GetBox( rStt, &nNextPos ));
if( nNextPos > nEndPos )
break;
diff --git a/sw/source/core/doc/htmltbl.cxx b/sw/source/core/doc/htmltbl.cxx
index 3b3ba7f11795..a234b819c7aa 100644
--- a/sw/source/core/doc/htmltbl.cxx
+++ b/sw/source/core/doc/htmltbl.cxx
@@ -1669,14 +1669,14 @@ void SwHTMLTableLayout::SetWidths( bool bCallPass2, sal_uInt16 nAbsAvail,
// are altered again.
// Also, we need to preserve a percent setting if it exists.
SwFrmFmt *pFrmFmt = pSwTable->GetFrmFmt();
- ((SwTable *)pSwTable)->LockModify();
+ const_cast<SwTable *>(pSwTable)->LockModify();
SwFmtFrmSize aFrmSize( pFrmFmt->GetFrmSize() );
aFrmSize.SetWidth( nRelTabWidth );
bool bRel = bUseRelWidth &&
text::HoriOrientation::FULL!=pFrmFmt->GetHoriOrient().GetHoriOrient();
aFrmSize.SetWidthPercent( (sal_uInt8)(bRel ? nWidthOption : 0) );
pFrmFmt->SetFmtAttr( aFrmSize );
- ((SwTable *)pSwTable)->UnlockModify();
+ const_cast<SwTable *>(pSwTable)->UnlockModify();
// If the table is located in a frame, we also need to adapt the
// frame's width.
diff --git a/sw/source/core/doc/notxtfrm.cxx b/sw/source/core/doc/notxtfrm.cxx
index 6f2499344fed..60b9585dfb27 100644
--- a/sw/source/core/doc/notxtfrm.cxx
+++ b/sw/source/core/doc/notxtfrm.cxx
@@ -116,7 +116,7 @@ static void lcl_PaintReplacement( const SwRect &rRect, const OUString &rText,
bool bVisited = false;
if ( rURL.GetMap() )
{
- ImageMap *pMap = (ImageMap*)rURL.GetMap();
+ ImageMap *pMap = const_cast<ImageMap*>(rURL.GetMap());
for( size_t i = 0; i < pMap->GetIMapObjectCount(); ++i )
{
IMapObject *pObj = pMap->GetIMapObject( i );
@@ -533,7 +533,7 @@ bool SwNoTxtFrm::GetCharRect( SwRect &rRect, const SwPosition& rPos,
bool SwNoTxtFrm::GetCrsrOfst(SwPosition* pPos, Point& ,
SwCrsrMoveState*, bool ) const
{
- SwCntntNode* pCNd = (SwCntntNode*)GetNode();
+ SwCntntNode* pCNd = const_cast<SwCntntNode*>(GetNode());
pPos->nNode = *pCNd;
pPos->nContent.Assign( pCNd, 0 );
return true;
diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx
index eefe8972d5f9..667d165eb3df 100644
--- a/sw/source/core/doc/number.cxx
+++ b/sw/source/core/doc/number.cxx
@@ -301,7 +301,7 @@ void SwNumFmt::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
}
if( pFmt && !pFmt->GetDoc()->IsInDtor() )
- UpdateNumNodes( (SwDoc*)pFmt->GetDoc() );
+ UpdateNumNodes( const_cast<SwDoc*>(pFmt->GetDoc()) );
else
CheckRegistration( pOld, pNew );
}
diff --git a/sw/source/core/doc/tblafmt.cxx b/sw/source/core/doc/tblafmt.cxx
index 71cb1baf8a3f..23b521c443c6 100644
--- a/sw/source/core/doc/tblafmt.cxx
+++ b/sw/source/core/doc/tblafmt.cxx
@@ -734,7 +734,7 @@ void SwTableAutoFmt::UpdateFromSet( sal_uInt8 nPos,
if( SfxItemState::SET == rSet.GetItemState( RES_BOXATR_FORMAT, true,
reinterpret_cast<const SfxPoolItem**>(&pNumFmtItem) ) && pNFmtr &&
0 != (pNumFormat = pNFmtr->GetEntry( pNumFmtItem->GetValue() )) )
- pFmt->SetValueFormat( const_cast<SvNumberformat*>(pNumFormat)->GetFormatstring(),
+ pFmt->SetValueFormat( pNumFormat->GetFormatstring(),
pNumFormat->GetLanguage(),
::GetAppLanguage());
else
diff --git a/sw/source/core/doc/tblcpy.cxx b/sw/source/core/doc/tblcpy.cxx
index 18b06bb1052c..42e054821139 100644
--- a/sw/source/core/doc/tblcpy.cxx
+++ b/sw/source/core/doc/tblcpy.cxx
@@ -777,7 +777,7 @@ bool SwTable::InsTable( const SwTable& rCpyTbl, const SwNodeIndex& rSttBox,
if( 0 == ( pTmp = pMyBox->FindNextBox( *this, pMyBox, false )))
bDelCntnt = false; // No space left?
else
- pMyBox = (SwTableBox*)pTmp;
+ pMyBox = const_cast<SwTableBox*>(pTmp);
} while( true );
@@ -1040,7 +1040,7 @@ static void _FndCntntBox( const SwTableBox* pBox, SwSelBoxes* pPara )
_FndCntntLine( pLine, pPara );
}
else
- pPara->insert( (SwTableBox*)pBox );
+ pPara->insert( const_cast<SwTableBox*>(pBox) );
}
static void _FndCntntLine( const SwTableLine* pLine, SwSelBoxes* pPara )
@@ -1053,7 +1053,7 @@ static void _FndCntntLine( const SwTableLine* pLine, SwSelBoxes* pPara )
SwSelBoxes& SwTable::SelLineFromBox( const SwTableBox* pBox,
SwSelBoxes& rBoxes, bool bToTop ) const
{
- SwTableLine* pLine = (SwTableLine*)pBox->GetUpper();
+ SwTableLine* pLine = const_cast<SwTableLine*>(pBox->GetUpper());
if( bToTop )
while( pLine->GetUpper() )
pLine = pLine->GetUpper()->GetUpper();
diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx
index ceef57491677..d2d4beeb1b44 100644
--- a/sw/source/core/doc/tblrwcl.cxx
+++ b/sw/source/core/doc/tblrwcl.cxx
@@ -498,7 +498,7 @@ SwRowFrm* GetRowFrm( SwTableLine& rLine )
bool SwTable::InsertCol( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCnt, bool bBehind )
{
OSL_ENSURE( !rBoxes.empty() && nCnt, "No valid Box List" );
- SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode();
+ SwTableNode* pTblNd = const_cast<SwTableNode*>(rBoxes[0]->GetSttNd()->FindTableNode());
if( !pTblNd )
return false;
@@ -554,7 +554,7 @@ bool SwTable::_InsertRow( SwDoc* pDoc, const SwSelBoxes& rBoxes,
sal_uInt16 nCnt, bool bBehind )
{
OSL_ENSURE( pDoc && !rBoxes.empty() && nCnt, "No valid Box List" );
- SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode();
+ SwTableNode* pTblNd = const_cast<SwTableNode*>(rBoxes[0]->GetSttNd()->FindTableNode());
if( !pTblNd )
return false;
@@ -757,7 +757,7 @@ void _DeleteBox( SwTable& rTbl, SwTableBox* pBox, SwUndo* pUndo,
}
// Delete the Box first, then the Nodes!
- SwStartNode* pSttNd = (SwStartNode*)pBox->GetSttNd();
+ SwStartNode* pSttNd = const_cast<SwStartNode*>(pBox->GetSttNd());
if( pShareFmts )
pShareFmts->RemoveFormat( *rTblBoxes[ nDelPos ]->GetFrmFmt() );
@@ -977,7 +977,7 @@ bool SwTable::DeleteSel(
SwTableNode* pTblNd = 0;
if( !rBoxes.empty() )
{
- pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode();
+ pTblNd = const_cast<SwTableNode*>(rBoxes[0]->GetSttNd()->FindTableNode());
if( !pTblNd )
return false;
}
@@ -1045,7 +1045,7 @@ bool SwTable::OldSplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCn
bool bSameHeight )
{
OSL_ENSURE( pDoc && !rBoxes.empty() && nCnt, "No valid values" );
- SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode();
+ SwTableNode* pTblNd = const_cast<SwTableNode*>(rBoxes[0]->GetSttNd()->FindTableNode());
if( !pTblNd )
return false;
@@ -1187,7 +1187,7 @@ bool SwTable::OldSplitRow( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCn
bool SwTable::SplitCol( SwDoc* pDoc, const SwSelBoxes& rBoxes, sal_uInt16 nCnt )
{
OSL_ENSURE( pDoc && !rBoxes.empty() && nCnt, "No valid values" );
- SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode();
+ SwTableNode* pTblNd = const_cast<SwTableNode*>(rBoxes[0]->GetSttNd()->FindTableNode());
if( !pTblNd )
return false;
@@ -1551,7 +1551,7 @@ bool SwTable::OldMerge( SwDoc* pDoc, const SwSelBoxes& rBoxes,
SwTableBox* pMergeBox, SwUndoTblMerge* pUndo )
{
OSL_ENSURE( !rBoxes.empty() && pMergeBox, "no valid values" );
- SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode();
+ SwTableNode* pTblNd = const_cast<SwTableNode*>(rBoxes[0]->GetSttNd()->FindTableNode());
if( !pTblNd )
return false;
@@ -2066,10 +2066,10 @@ bool SwTable::MakeCopy( SwDoc* pInsDoc, const SwPosition& rPos,
pInsDoc->CopyTxtColl( *pSrcDoc->getIDocumentStylePoolAccess().GetTxtCollFromPool( RES_POOLCOLL_TABLE_HDLN ) );
}
- SwTable* pNewTbl = (SwTable*)pInsDoc->InsertTable(
+ SwTable* pNewTbl = const_cast<SwTable*>(pInsDoc->InsertTable(
SwInsertTableOptions( tabopts::HEADLINE_NO_BORDER, 1 ),
rPos, 1, 1, GetFrmFmt()->GetHoriOrient().GetHoriOrient(),
- 0, 0, false, IsNewModel() );
+ 0, 0, false, IsNewModel() ));
if( !pNewTbl )
return false;
@@ -2299,7 +2299,7 @@ SwTableBox* SwTableBox::FindNextBox( const SwTable& rTbl,
const SwTableBox* pSrchBox, bool bOvrTblLns ) const
{
if( !pSrchBox && GetTabLines().empty() )
- return (SwTableBox*)this;
+ return const_cast<SwTableBox*>(this);
return GetUpper()->FindNextBox( rTbl, pSrchBox ? pSrchBox : this,
bOvrTblLns );
@@ -2310,7 +2310,7 @@ SwTableBox* SwTableBox::FindPreviousBox( const SwTable& rTbl,
const SwTableBox* pSrchBox, bool bOvrTblLns ) const
{
if( !pSrchBox && GetTabLines().empty() )
- return (SwTableBox*)this;
+ return const_cast<SwTableBox*>(this);
return GetUpper()->FindPreviousBox( rTbl, pSrchBox ? pSrchBox : this,
bOvrTblLns );
}
@@ -3399,7 +3399,7 @@ bool SwTable::SetColWidth( SwTableBox& rAktBox, sal_uInt16 eType,
SwTwips nDistStt = 0;
CR_SetBoxWidth aParam( eType, nRelDiff, nDist, rSz.GetWidth(),
bLeft ? nDist : rSz.GetWidth() - nDist,
- (SwTableNode*)rAktBox.GetSttNd()->FindTableNode() );
+ const_cast<SwTableNode*>(rAktBox.GetSttNd()->FindTableNode()) );
bBigger = aParam.bBigger;
FN_lcl_SetBoxWidth fnSelBox, fnOtherBox;
@@ -4131,7 +4131,7 @@ bool SwTable::SetRowHeight( SwTableBox& rAktBox, sal_uInt16 eType,
sal_uLong nBoxIdx = rAktBox.GetSttIdx();
CR_SetLineHeight aParam( eType,
- (SwTableNode*)rAktBox.GetSttNd()->FindTableNode() );
+ const_cast<SwTableNode*>(rAktBox.GetSttNd()->FindTableNode()) );
bBigger = aParam.bBigger;
FN_lcl_SetLineHeight fnSelLine, fnOtherLine = lcl_SetOtherLineHeight;
diff --git a/sw/source/core/docnode/ndcopy.cxx b/sw/source/core/docnode/ndcopy.cxx
index 09a0053198a7..0dd84b4e01cb 100644
--- a/sw/source/core/docnode/ndcopy.cxx
+++ b/sw/source/core/docnode/ndcopy.cxx
@@ -58,7 +58,7 @@ SwCntntNode* SwTxtNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const
// node with the collection and hard attributes. Normally is the same
// node, but if insert a glossary without formatting, then the Attrnode
// is the prev node of the destionation position in dest. document.
- SwTxtNode* pCpyTxtNd = (SwTxtNode*)this;
+ SwTxtNode* pCpyTxtNd = const_cast<SwTxtNode*>(this);
SwTxtNode* pCpyAttrNd = pCpyTxtNd;
// Copy the formats to the other document
diff --git a/sw/source/core/docnode/ndnotxt.cxx b/sw/source/core/docnode/ndnotxt.cxx
index cb348a0ea252..4c6f414c45fe 100644
--- a/sw/source/core/docnode/ndnotxt.cxx
+++ b/sw/source/core/docnode/ndnotxt.cxx
@@ -172,8 +172,8 @@ const tools::PolyPolygon *SwNoTxtNode::HasContour() const
}
}
}
- ((SwNoTxtNode *)this)->bContourMapModeValid = true;
- ((SwNoTxtNode *)this)->bPixelContour = false;
+ const_cast<SwNoTxtNode *>(this)->bContourMapModeValid = true;
+ const_cast<SwNoTxtNode *>(this)->bPixelContour = false;
}
return pContour;
diff --git a/sw/source/core/docnode/ndnum.cxx b/sw/source/core/docnode/ndnum.cxx
index 06eb0f95ad3d..8c8a542d804f 100644
--- a/sw/source/core/docnode/ndnum.cxx
+++ b/sw/source/core/docnode/ndnum.cxx
@@ -78,7 +78,7 @@ void SwNodes::UpdtOutlineIdx( const SwNode& rNd )
if( pOutlineNds->empty() ) // no OutlineNodes present ?
return;
- const SwNodePtr pSrch = (SwNodePtr)&rNd;
+ const SwNodePtr pSrch = const_cast<SwNodePtr>(&rNd);
sal_uInt16 nPos;
if (!pOutlineNds->Seek_Entry(pSrch, &nPos))
diff --git a/sw/source/core/docnode/ndsect.cxx b/sw/source/core/docnode/ndsect.cxx
index 7ff805252cb1..7eee0d6cc2ba 100644
--- a/sw/source/core/docnode/ndsect.cxx
+++ b/sw/source/core/docnode/ndsect.cxx
@@ -203,8 +203,8 @@ SwDoc::InsertSwSection(SwPaM const& rRange, SwSectionData & rNewData,
if( rRange.HasMark() )
{
- SwPosition *pSttPos = (SwPosition*)rRange.Start(),
- *pEndPos = (SwPosition*)rRange.End();
+ SwPosition *pSttPos = const_cast<SwPosition*>(rRange.Start()),
+ *pEndPos = const_cast<SwPosition*>(rRange.End());
if( pPrvNd && 3 == nRegionRet )
{
OSL_ENSURE( pPrvNd, "The SectionNode is missing" );
@@ -502,7 +502,7 @@ SwSection* SwDoc::GetCurrSection( const SwPosition& rPos ) const
{
const SwSectionNode* pSectNd = rPos.nNode.GetNode().FindSectionNode();
if( pSectNd )
- return (SwSection*)&pSectNd->GetSection();
+ return const_cast<SwSection*>(&pSectNd->GetSection());
return 0;
}
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index 972001fb5227..0c075b2a4b1c 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -1680,7 +1680,7 @@ bool SwDoc::InsertCol( const SwCursor& rCursor, sal_uInt16 nCnt, bool bBehind )
bool SwDoc::InsertCol( const SwSelBoxes& rBoxes, sal_uInt16 nCnt, bool bBehind )
{
OSL_ENSURE( !rBoxes.empty(), "No valid Box list" );
- SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode();
+ SwTableNode* pTblNd = const_cast<SwTableNode*>(rBoxes[0]->GetSttNd()->FindTableNode());
if( !pTblNd )
return false;
@@ -1742,7 +1742,7 @@ bool SwDoc::InsertRow( const SwCursor& rCursor, sal_uInt16 nCnt, bool bBehind )
bool SwDoc::InsertRow( const SwSelBoxes& rBoxes, sal_uInt16 nCnt, bool bBehind )
{
OSL_ENSURE( !rBoxes.empty(), "No valid Box list" );
- SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode();
+ SwTableNode* pTblNd = const_cast<SwTableNode*>(rBoxes[0]->GetSttNd()->FindTableNode());
if( !pTblNd )
return false;
@@ -1927,7 +1927,7 @@ bool SwDoc::DeleteRowCol( const SwSelBoxes& rBoxes, bool bColumn )
return false;
OSL_ENSURE( !rBoxes.empty(), "No valid Box list" );
- SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode();
+ SwTableNode* pTblNd = const_cast<SwTableNode*>(rBoxes[0]->GetSttNd()->FindTableNode());
if( !pTblNd )
return false;
@@ -2132,7 +2132,7 @@ bool SwDoc::SplitTbl( const SwSelBoxes& rBoxes, bool bVert, sal_uInt16 nCnt,
bool bSameHeight )
{
OSL_ENSURE( !rBoxes.empty() && nCnt, "No valid Box list" );
- SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode();
+ SwTableNode* pTblNd = const_cast<SwTableNode*>(rBoxes[0]->GetSttNd()->FindTableNode());
if( !pTblNd )
return false;
@@ -2912,7 +2912,7 @@ void SwCollectTblLineBoxes::AddToUndoHistory( const SwCntntNode& rNd )
void SwCollectTblLineBoxes::AddBox( const SwTableBox& rBox )
{
aPosArr.push_back(nWidth);
- SwTableBox* p = (SwTableBox*)&rBox;
+ SwTableBox* p = const_cast<SwTableBox*>(&rBox);
m_Boxes.push_back(p);
nWidth = nWidth + (sal_uInt16)rBox.GetFrmFmt()->GetFrmSize().GetWidth();
}
@@ -2986,12 +2986,12 @@ bool sw_Line_CollectBox( const SwTableLine*& rpLine, void* pPara )
{
SwCollectTblLineBoxes* pSplPara = (SwCollectTblLineBoxes*)pPara;
if( pSplPara->IsGetValues() )
- for( SwTableBoxes::iterator it = ((SwTableLine*)rpLine)->GetTabBoxes().begin();
- it != ((SwTableLine*)rpLine)->GetTabBoxes().end(); ++it)
+ for( SwTableBoxes::iterator it = const_cast<SwTableLine*>(rpLine)->GetTabBoxes().begin();
+ it != const_cast<SwTableLine*>(rpLine)->GetTabBoxes().end(); ++it)
sw_Box_CollectBox(*it, pSplPara );
else
- for( SwTableBoxes::iterator it = ((SwTableLine*)rpLine)->GetTabBoxes().begin();
- it != ((SwTableLine*)rpLine)->GetTabBoxes().end(); ++it)
+ for( SwTableBoxes::iterator it = const_cast<SwTableLine*>(rpLine)->GetTabBoxes().begin();
+ it != const_cast<SwTableLine*>(rpLine)->GetTabBoxes().end(); ++it)
sw_BoxSetSplitBoxFmts(*it, pSplPara );
return true;
}
@@ -3699,7 +3699,7 @@ static bool lcl_SetAFmtBox( _FndBox & rBox, _SetAFmtTabPara *pSetPara )
bool SwDoc::SetTableAutoFmt( const SwSelBoxes& rBoxes, const SwTableAutoFmt& rNew )
{
OSL_ENSURE( !rBoxes.empty(), "No valid Box list" );
- SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode();
+ SwTableNode* pTblNd = const_cast<SwTableNode*>(rBoxes[0]->GetSttNd()->FindTableNode());
if( !pTblNd )
return false;
@@ -3786,7 +3786,7 @@ bool SwDoc::SetTableAutoFmt( const SwSelBoxes& rBoxes, const SwTableAutoFmt& rNe
bool SwDoc::GetTableAutoFmt( const SwSelBoxes& rBoxes, SwTableAutoFmt& rGet )
{
OSL_ENSURE( !rBoxes.empty(), "No valid Box list" );
- SwTableNode* pTblNd = (SwTableNode*)rBoxes[0]->GetSttNd()->FindTableNode();
+ SwTableNode* pTblNd = const_cast<SwTableNode*>(rBoxes[0]->GetSttNd()->FindTableNode());
if( !pTblNd )
return false;
@@ -3930,7 +3930,7 @@ SwTableFmt* SwDoc::FindTblFmtByName( const OUString& rName, bool bAll ) const
bool SwDoc::SetColRowWidthHeight( SwTableBox& rAktBox, sal_uInt16 eType,
SwTwips nAbsDiff, SwTwips nRelDiff )
{
- SwTableNode* pTblNd = (SwTableNode*)rAktBox.GetSttNd()->FindTableNode();
+ SwTableNode* pTblNd = const_cast<SwTableNode*>(rAktBox.GetSttNd()->FindTableNode());
SwUndo* pUndo = 0;
if( nsTblChgWidthHeightType::WH_FLAG_INSDEL & eType && pTblNd->GetTable().ISA( SwDDETable ))
@@ -4292,7 +4292,7 @@ bool SwDoc::InsCopyOfTbl( SwPosition& rInsPos, const SwSelBoxes& rBoxes,
GetIDocumentUndoRedo().DoUndo(false);
}
- SwDoc* pCpyDoc = (SwDoc*)pSrcTblNd->GetDoc();
+ SwDoc* pCpyDoc = const_cast<SwDoc*>(pSrcTblNd->GetDoc());
bool bDelCpyDoc = pCpyDoc == this;
if( bDelCpyDoc )
@@ -4480,7 +4480,7 @@ bool SwDoc::UnProtectTbls( const SwPaM& rPam )
GetIDocumentUndoRedo().StartUndo(UNDO_EMPTY, NULL);
bool bChgd = false, bHasSel = rPam.HasMark() ||
- rPam.GetNext() != (SwPaM*)&rPam;
+ rPam.GetNext() != &rPam;
SwFrmFmts& rFmts = *GetTblFrmFmts();
SwTable* pTbl;
const SwTableNode* pTblNd;
@@ -4495,7 +4495,7 @@ bool SwDoc::UnProtectTbls( const SwPaM& rPam )
if( bHasSel )
{
bool bFound = false;
- SwPaM* pTmp = (SwPaM*)&rPam;
+ SwPaM* pTmp = const_cast<SwPaM*>(&rPam);
do {
const SwPosition *pStt = pTmp->Start(),
*pEnd = pTmp->End();
diff --git a/sw/source/core/docnode/ndtbl1.cxx b/sw/source/core/docnode/ndtbl1.cxx
index 60f5efc9b47e..3aa62a36caab 100644
--- a/sw/source/core/docnode/ndtbl1.cxx
+++ b/sw/source/core/docnode/ndtbl1.cxx
@@ -133,8 +133,8 @@ static bool lcl_GetBoxSel( const SwCursor& rCursor, SwSelBoxes& rBoxes,
const SwNode* pNd = pCurPam->GetNode().FindTableBoxStartNode();
if( pNd )
{
- SwTableBox* pBox = (SwTableBox*)pNd->FindTableNode()->GetTable().
- GetTblBox( pNd->GetIndex() );
+ SwTableBox* pBox = const_cast<SwTableBox*>(pNd->FindTableNode()->GetTable().
+ GetTblBox( pNd->GetIndex() ));
rBoxes.insert( pBox );
}
} while( bAllCrsr &&
@@ -775,7 +775,7 @@ void SwDoc::SetTabBorders( const SwCursor& rCursor, const SfxItemSet& rSet )
aBox.SetDistance( pSetBox->GetDistance( *pBrd ), *pBrd );
}
- SwTableBox *pBox = (SwTableBox*)pCell->GetTabBox();
+ SwTableBox *pBox = const_cast<SwTableBox*>(pCell->GetTabBox());
SwFrmFmt *pNewFmt;
if ( 0 != (pNewFmt = SwTblFmtCmp::FindNewFmt( aFmtCmp, pBox->GetFrmFmt(), nType )))
pBox->ChgFrmFmt( static_cast<SwTableBoxFmt*>(pNewFmt) );
@@ -872,16 +872,16 @@ void SwDoc::SetTabLineStyle( const SwCursor& rCursor,
else
{
if ( aBox.GetTop() )
- ::lcl_SetLineStyle( (SvxBorderLine*)aBox.GetTop(),
+ ::lcl_SetLineStyle( const_cast<SvxBorderLine*>(aBox.GetTop()),
pColor, pBorderLine );
if ( aBox.GetBottom() )
- ::lcl_SetLineStyle( (SvxBorderLine*)aBox.GetBottom(),
+ ::lcl_SetLineStyle( const_cast<SvxBorderLine*>(aBox.GetBottom()),
pColor, pBorderLine );
if ( aBox.GetLeft() )
- ::lcl_SetLineStyle( (SvxBorderLine*)aBox.GetLeft(),
+ ::lcl_SetLineStyle( const_cast<SvxBorderLine*>(aBox.GetLeft()),
pColor, pBorderLine );
if ( aBox.GetRight() )
- ::lcl_SetLineStyle( (SvxBorderLine*)aBox.GetRight(),
+ ::lcl_SetLineStyle( const_cast<SvxBorderLine*>(aBox.GetRight()),
pColor, pBorderLine );
}
pFmt->SetFmtAttr( aBox );
@@ -941,7 +941,7 @@ void SwDoc::GetTabBorders( const SwCursor& rCursor, SfxItemSet& rSet ) const
std::vector<SwCellFrm*> aCellArr;
aCellArr.reserve(255);
- ::lcl_CollectCells( aCellArr, rUnion, (SwTabFrm*)pTab );
+ ::lcl_CollectCells( aCellArr, rUnion, const_cast<SwTabFrm*>(pTab) );
for ( sal_uInt16 j = 0; j < aCellArr.size(); ++j )
{
@@ -1474,7 +1474,7 @@ void SwDoc::AdjustCellWidth( const SwCursor& rCursor, bool bBalance )
// It's more robust if we calculate the minimum values for the whole Table
const SwTabFrm *pTab = pStart->ImplFindTabFrm();
pStart = (SwLayoutFrm*)pTab->FirstCell();
- pEnd = (SwLayoutFrm*)pTab->FindLastCntnt()->GetUpper();
+ pEnd = const_cast<SwLayoutFrm*>(pTab->FindLastCntnt()->GetUpper());
while( !pEnd->IsCellFrm() )
pEnd = pEnd->GetUpper();
::lcl_CalcColValues( aMins, aTabCols, pStart, pEnd, false );
diff --git a/sw/source/core/docnode/node.cxx b/sw/source/core/docnode/node.cxx
index 25e6a9f13f66..5e11972c505e 100644
--- a/sw/source/core/docnode/node.cxx
+++ b/sw/source/core/docnode/node.cxx
@@ -740,8 +740,8 @@ SwTableBox* SwNode::GetTblBox() const
SwTableBox* pBox = 0;
const SwNode* pSttNd = FindTableBoxStartNode();
if( pSttNd )
- pBox = (SwTableBox*)pSttNd->FindTableNode()->GetTable().GetTblBox(
- pSttNd->GetIndex() );
+ pBox = const_cast<SwTableBox*>(pSttNd->FindTableNode()->GetTable().GetTblBox(
+ pSttNd->GetIndex() ));
return pBox;
}
@@ -761,7 +761,7 @@ const SwTxtNode* SwNode::FindOutlineNodeOfLevel( sal_uInt8 nLvl ) const
if( MAXLEVEL > nLvl && !rONds.empty() )
{
sal_uInt16 nPos;
- SwNode* pNd = (SwNode*)this;
+ SwNode* pNd = const_cast<SwNode*>(this);
bool bCheckFirst = false;
if( !rONds.Seek_Entry( pNd, &nPos ))
{
@@ -1877,7 +1877,7 @@ bool SwCntntNode::IsAnyCondition( SwCollCondition& rTmp ) const
const SwOutlineNodes& rOutlNds = rNds.GetOutLineNds();
if( !rOutlNds.empty() )
{
- if( !rOutlNds.Seek_Entry( (SwCntntNode*)this, &nPos ) && nPos )
+ if( !rOutlNds.Seek_Entry( const_cast<SwCntntNode*>(this), &nPos ) && nPos )
--nPos;
if( nPos < rOutlNds.size() &&
rOutlNds[ nPos ]->GetIndex() < GetIndex() )
diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx
index 0ba5f72140b2..48b2a214689b 100644
--- a/sw/source/core/docnode/section.cxx
+++ b/sw/source/core/docnode/section.cxx
@@ -87,7 +87,7 @@ public:
inline SwSectionNode* GetSectNode()
{
- const SwNode* pSectNd( const_cast<SwIntrnlSectRefLink*>(this)->GetAnchor() );
+ const SwNode* pSectNd( GetAnchor() );
return const_cast<SwSectionNode*>( dynamic_cast<const SwSectionNode*>( pSectNd ) );
}
};
@@ -718,7 +718,7 @@ void SwSectionFmt::DelFrms()
if( pCNd )
{
const SfxPoolItem& rItem = pCNd->GetSwAttrSet().Get( RES_PAGEDESC );
- pCNd->ModifyNotification( (SfxPoolItem*)&rItem, (SfxPoolItem*)&rItem );
+ pCNd->ModifyNotification( &rItem, &rItem );
}
}
}
@@ -752,7 +752,7 @@ void SwSectionFmt::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
if( SfxItemState::SET == pNewSet->GetItemState(
RES_PROTECT, false, &pItem ))
{
- ModifyBroadcast( (SfxPoolItem*)pItem, (SfxPoolItem*)pItem );
+ ModifyBroadcast( pItem, pItem );
pNewSet->ClearItem( RES_PROTECT );
pOldSet->ClearItem( RES_PROTECT );
}
@@ -761,7 +761,7 @@ void SwSectionFmt::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
if( SfxItemState::SET == pNewSet->GetItemState(
RES_EDIT_IN_READONLY, false, &pItem ) )
{
- ModifyBroadcast( (SfxPoolItem*)pItem, (SfxPoolItem*)pItem );
+ ModifyBroadcast( pItem, pItem );
pNewSet->ClearItem( RES_EDIT_IN_READONLY );
pOldSet->ClearItem( RES_EDIT_IN_READONLY );
}
@@ -769,14 +769,14 @@ void SwSectionFmt::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
if( SfxItemState::SET == pNewSet->GetItemState(
RES_FTN_AT_TXTEND, false, &pItem ))
{
- ModifyBroadcast( (SfxPoolItem*)&pOldSet->Get( RES_FTN_AT_TXTEND ), (SfxPoolItem*)pItem );
+ ModifyBroadcast( &pOldSet->Get( RES_FTN_AT_TXTEND ), pItem );
pNewSet->ClearItem( RES_FTN_AT_TXTEND );
pOldSet->ClearItem( RES_FTN_AT_TXTEND );
}
if( SfxItemState::SET == pNewSet->GetItemState(
RES_END_AT_TXTEND, false, &pItem ))
{
- ModifyBroadcast( (SfxPoolItem*)&pOldSet->Get( RES_END_AT_TXTEND ), (SfxPoolItem*)pItem );
+ ModifyBroadcast( &pOldSet->Get( RES_END_AT_TXTEND ), pItem );
pNewSet->ClearItem( RES_END_AT_TXTEND );
pOldSet->ClearItem( RES_END_AT_TXTEND );
}
diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx
index 24e256823314..28ddb8470493 100644
--- a/sw/source/core/draw/dcontact.cxx
+++ b/sw/source/core/draw/dcontact.cxx
@@ -418,7 +418,7 @@ const SwAnchoredObject* SwFlyDrawContact::GetAnchoredObj( const SdrObject* _pSdr
"<SwFlyDrawContact::GetAnchoredObj(..)> - no object provided" );
OSL_ENSURE( _pSdrObj->ISA(SwVirtFlyDrawObj),
"<SwFlyDrawContact::GetAnchoredObj(..)> - wrong object type object provided" );
- OSL_ENSURE( GetUserCall( _pSdrObj ) == const_cast<SwFlyDrawContact*>(this),
+ OSL_ENSURE( GetUserCall( _pSdrObj ) == this,
"<SwFlyDrawContact::GetAnchoredObj(..)> - provided object doesn't belongs to this contact" );
const SwAnchoredObject* pRetAnchoredObj = 0L;
@@ -684,7 +684,7 @@ const SwAnchoredObject* SwDrawContact::GetAnchoredObj( const SdrObject* _pSdrObj
OSL_ENSURE( _pSdrObj->ISA(SwDrawVirtObj) ||
( !_pSdrObj->ISA(SdrVirtObj) && !_pSdrObj->ISA(SwDrawVirtObj) ),
"<SwDrawContact::GetAnchoredObj(..)> - wrong object type object provided" );
- OSL_ENSURE( GetUserCall( _pSdrObj ) == const_cast<SwDrawContact*>(this) ||
+ OSL_ENSURE( GetUserCall( _pSdrObj ) == this ||
_pSdrObj == GetMaster(),
"<SwDrawContact::GetAnchoredObj(..)> - provided object doesn't belongs to this contact" );
diff --git a/sw/source/core/edit/edfld.cxx b/sw/source/core/edit/edfld.cxx
index 3cb493acc1ee..f9b0e7f4e28b 100644
--- a/sw/source/core/edit/edfld.cxx
+++ b/sw/source/core/edit/edfld.cxx
@@ -318,7 +318,7 @@ void SwEditShell::UpdateFlds( SwField &rFld )
if( 0 != (pTxtFld = GetTxtFldAtPos( pCurStt, true )) )
{
- pFmtFld = (SwFmtFld*)&pTxtFld->GetFmtFld();
+ pFmtFld = const_cast<SwFmtFld*>(&pTxtFld->GetFmtFld());
SwField *pCurFld = pFmtFld->GetField();
// if there are mixed field types
diff --git a/sw/source/core/edit/edglbldc.cxx b/sw/source/core/edit/edglbldc.cxx
index b0a8678224cf..1eced03afeee 100644
--- a/sw/source/core/edit/edglbldc.cxx
+++ b/sw/source/core/edit/edglbldc.cxx
@@ -293,7 +293,7 @@ bool SwEditShell::DeleteGlobalDocContent( const SwGlblDocContents& rArr ,
case GLBLDOC_SECTION:
{
- SwSectionFmt* pSectFmt = (SwSectionFmt*)rDelPos.GetSection()->GetFmt();
+ SwSectionFmt* pSectFmt = const_cast<SwSectionFmt*>(rDelPos.GetSection()->GetFmt());
pMyDoc->DelSectionFmt( pSectFmt, true );
}
break;
diff --git a/sw/source/core/edit/edglss.cxx b/sw/source/core/edit/edglss.cxx
index 6d80fe37b658..281c3e55ae7e 100644
--- a/sw/source/core/edit/edglss.cxx
+++ b/sw/source/core/edit/edglss.cxx
@@ -188,8 +188,8 @@ bool SwEditShell::_CopySelToDoc( SwDoc* pInsDoc, SwNodeIndex* pSttNd )
SwTableNode* pTblNd;
SwSelBoxes aBoxes;
GetTblSel( *this, aBoxes );
- if( !aBoxes.empty() && 0 != (pTblNd = (SwTableNode*)aBoxes[0]
- ->GetSttNd()->FindTableNode() ))
+ if( !aBoxes.empty() && 0 != (pTblNd = const_cast<SwTableNode*>(aBoxes[0]
+ ->GetSttNd()->FindTableNode()) ))
{
// check if the table name can be copied
bool bCpyTblNm = aBoxes.size() == pTblNd->GetTable().GetTabSortBoxes().size();
diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx
index 7e9bb4764b53..f442c9af7040 100644
--- a/sw/source/core/edit/editsh.cxx
+++ b/sw/source/core/edit/editsh.cxx
@@ -321,7 +321,7 @@ void SwEditShell::SetGraphicPolygon( const tools::PolyPolygon *pPoly )
pNd->SetContour( pPoly );
SwFlyFrm *pFly = static_cast<SwFlyFrm*>(pNd->getLayoutFrm(GetLayout())->GetUpper());
const SwFmtSurround &rSur = pFly->GetFmt()->GetSurround();
- pFly->GetFmt()->NotifyClients( (SwFmtSurround*)&rSur, (SwFmtSurround*)&rSur );
+ pFly->GetFmt()->NotifyClients( const_cast<SwFmtSurround*>(&rSur), const_cast<SwFmtSurround*>(&rSur) );
GetDoc()->getIDocumentState().SetModified();
EndAllAction();
}
@@ -336,7 +336,7 @@ void SwEditShell::ClearAutomaticContour()
pNd->SetContour( NULL, false );
SwFlyFrm *pFly = static_cast<SwFlyFrm*>(pNd->getLayoutFrm(GetLayout())->GetUpper());
const SwFmtSurround &rSur = pFly->GetFmt()->GetSurround();
- pFly->GetFmt()->NotifyClients( (SwFmtSurround*)&rSur, (SwFmtSurround*)&rSur );
+ pFly->GetFmt()->NotifyClients( const_cast<SwFmtSurround*>(&rSur), const_cast<SwFmtSurround*>(&rSur) );
GetDoc()->getIDocumentState().SetModified();
EndAllAction();
}
diff --git a/sw/source/core/edit/edlingu.cxx b/sw/source/core/edit/edlingu.cxx
index 5cd956df00a3..de71ac62a82f 100644
--- a/sw/source/core/edit/edlingu.cxx
+++ b/sw/source/core/edit/edlingu.cxx
@@ -441,7 +441,7 @@ void SwHyphIter::Start( SwEditShell *pShell, SwDocPositions eStart, SwDocPositio
// nothing to do (at least not in the way as in the "else" part)
bOldIdle = pShell->GetViewOptions()->IsIdle();
- const_cast<SwViewOption*>(pShell->GetViewOptions())->SetIdle( false );
+ pShell->GetViewOptions()->SetIdle( false );
_Start( pShell, eStart, eEnd );
}
@@ -450,7 +450,7 @@ void SwHyphIter::End()
{
if( !GetSh() )
return;
- const_cast<SwViewOption*>(GetSh()->GetViewOptions())->SetIdle( bOldIdle );
+ GetSh()->GetViewOptions()->SetIdle( bOldIdle );
_End();
}
diff --git a/sw/source/core/edit/ednumber.cxx b/sw/source/core/edit/ednumber.cxx
index 64e418abf407..981881ad0011 100644
--- a/sw/source/core/edit/ednumber.cxx
+++ b/sw/source/core/edit/ednumber.cxx
@@ -561,7 +561,7 @@ bool SwEditShell::IsProtectedOutlinePara() const
if( rNd.IsTxtNode() )
{
const SwOutlineNodes& rOutlNd = GetDoc()->GetNodes().GetOutLineNds();
- SwNodePtr pNd = (SwNodePtr)&rNd;
+ SwNodePtr pNd = const_cast<SwNodePtr>(&rNd);
bool bFirst = true;
sal_uInt16 nPos;
int nLvl(0);
diff --git a/sw/source/core/edit/edsect.cxx b/sw/source/core/edit/edsect.cxx
index cf60418bb1be..79704d676d7a 100644
--- a/sw/source/core/edit/edsect.cxx
+++ b/sw/source/core/edit/edsect.cxx
@@ -142,7 +142,7 @@ bool SwEditShell::IsAnySectionInDoc( bool bChkReadOnly, bool bChkHidden, bool bC
sal_uInt16 SwEditShell::GetSectionFmtPos( const SwSectionFmt& rFmt ) const
{
- SwSectionFmt* pFmt = (SwSectionFmt*)&rFmt;
+ SwSectionFmt* pFmt = const_cast<SwSectionFmt*>(&rFmt);
return GetDoc()->GetSections().GetPos( pFmt );
}
diff --git a/sw/source/core/edit/edtab.cxx b/sw/source/core/edit/edtab.cxx
index 8d5bbc71064c..39693a8923d6 100644
--- a/sw/source/core/edit/edtab.cxx
+++ b/sw/source/core/edit/edtab.cxx
@@ -230,11 +230,11 @@ void SwEditShell::InsertDDETable( const SwInsertTableOptions& rInsTblOpts,
const SwInsertTableOptions aInsTblOpts( rInsTblOpts.mnInsMode | tabopts::DEFAULT_BORDER,
rInsTblOpts.mnRowsToRepeat );
- SwTable* pTbl = (SwTable*)GetDoc()->InsertTable( aInsTblOpts, *pPos,
- nRows, nCols, eAdj );
+ SwTable* pTbl = const_cast<SwTable*>(GetDoc()->InsertTable( aInsTblOpts, *pPos,
+ nRows, nCols, eAdj ));
- SwTableNode* pTblNode = (SwTableNode*)pTbl->GetTabSortBoxes()[ 0 ]->
- GetSttNd()->FindTableNode();
+ SwTableNode* pTblNode = const_cast<SwTableNode*>(pTbl->GetTabSortBoxes()[ 0 ]->
+ GetSttNd()->FindTableNode());
SwDDETable* pDDETbl = new SwDDETable( *pTbl, pDDEType );
pTblNode->SetNewTable( pDDETbl ); // setze die DDE-Tabelle
@@ -256,7 +256,7 @@ void SwEditShell::UpdateTable()
if( DoesUndo() )
StartUndo();
EndAllTblBoxEdit();
- SwTableFmlUpdate aTblUpdate( (SwTable*)&pTblNd->GetTable() );
+ SwTableFmlUpdate aTblUpdate( &pTblNd->GetTable() );
GetDoc()->getIDocumentFieldsAccess().UpdateTblFlds( &aTblUpdate );
if( DoesUndo() )
EndUndo();
@@ -321,7 +321,7 @@ bool SwEditShell::GetTblBoxFormulaAttrs( SfxItemSet& rSet ) const
// Convert formulae into external presentation
const SwTable& rTbl = pSelBox->GetSttNd()->FindTableNode()->GetTable();
- SwTableFmlUpdate aTblUpdate( (SwTable*)&rTbl );
+ SwTableFmlUpdate aTblUpdate( &rTbl );
aTblUpdate.eFlags = TBL_BOXNAME;
static_cast<SwDoc*>(GetDoc())->getIDocumentFieldsAccess().UpdateTblFlds( &aTblUpdate );
diff --git a/sw/source/core/fields/authfld.cxx b/sw/source/core/fields/authfld.cxx
index b78deba70f87..2e9ce09de4d1 100644
--- a/sw/source/core/fields/authfld.cxx
+++ b/sw/source/core/fields/authfld.cxx
@@ -284,7 +284,7 @@ sal_uInt16 SwAuthorityFieldType::GetSequencePos(sal_IntPtr nHandle)
}
const SwTxtNode& rFldTxtNode = pTxtFld->GetTxtNode();
SwPosition aFldPos(rFldTxtNode);
- SwDoc& rDoc = *(SwDoc*)rFldTxtNode.GetDoc();
+ SwDoc& rDoc = *const_cast<SwDoc*>(rFldTxtNode.GetDoc());
SwCntntFrm *pFrm = rFldTxtNode.getLayoutFrm( rDoc.getIDocumentLayoutAccess().GetCurrentLayout() );
const SwTxtNode* pTxtNode = 0;
if(pFrm && !pFrm->IsInDocBody())
diff --git a/sw/source/core/fields/cellfml.cxx b/sw/source/core/fields/cellfml.cxx
index 2b0b6861de6b..06448d60cdf7 100644
--- a/sw/source/core/fields/cellfml.cxx
+++ b/sw/source/core/fields/cellfml.cxx
@@ -90,7 +90,7 @@ double SwTableBox::GetValue( SwTblCalcPara& rCalcPara ) const
rCalcPara.SetLastTblBox( this );
// Does it create a recursion?
- SwTableBox* pBox = (SwTableBox*)this;
+ SwTableBox* pBox = const_cast<SwTableBox*>(this);
if( rCalcPara.pBoxStk->find( pBox ) != rCalcPara.pBoxStk->end() )
return nRet; // already on the stack: error
@@ -271,7 +271,7 @@ bool SwTblCalcPara::CalcWithStackOverflow()
sal_uInt16 nCnt = 0;
SwTableBoxes aStackOverflows;
do {
- SwTableBox* pBox = (SwTableBox*)pLastTblBox;
+ SwTableBox* pBox = const_cast<SwTableBox*>(pLastTblBox);
nStackCnt = 0;
rCalc.SetCalcError( CALC_NOERR );
aStackOverflows.insert( aStackOverflows.begin() + nCnt++, pBox );
@@ -381,7 +381,7 @@ void SwTableFormula::RelNmsToBoxNms( const SwTable& rTbl, OUString& rNewStr,
// relative name w.r.t. box name (external presentation)
SwNode* pNd = (SwNode*)pPara;
OSL_ENSURE( pNd, "Feld steht in keinem TextNode" );
- const SwTableBox *pBox = (SwTableBox *)rTbl.GetTblBox(
+ const SwTableBox *pBox = rTbl.GetTblBox(
pNd->FindTableBoxStartNode()->GetIndex() );
rNewStr += OUString(rFirstBox[0]); // get label for the box
@@ -414,7 +414,7 @@ void SwTableFormula::RelBoxNmsToPtr( const SwTable& rTbl, OUString& rNewStr,
// relative name w.r.t. box name (internal presentation)
SwNode* pNd = (SwNode*)pPara;
OSL_ENSURE( pNd, "Field not placed in any Node" );
- const SwTableBox *pBox = (SwTableBox*)rTbl.GetTblBox(
+ const SwTableBox *pBox = rTbl.GetTblBox(
pNd->FindTableBoxStartNode()->GetIndex() );
rNewStr += OUString(rFirstBox[0]); // get label for the box
@@ -762,12 +762,12 @@ static const SwTableBox* lcl_RelToBox( const SwTable& rTbl,
sGetName = sGetName.copy( 1 );
- const SwTableLines* pLines = (SwTableLines*)&rTbl.GetTabLines();
+ const SwTableLines* pLines = &rTbl.GetTabLines();
const SwTableBoxes* pBoxes;
const SwTableLine* pLine;
// determine starting values of the box,...
- pBox = (SwTableBox*)pRefBox;
+ pBox = pRefBox;
pLine = pBox->GetUpper();
while( pLine->GetUpper() )
{
@@ -995,18 +995,18 @@ void SwTableFormula::_HasValidBoxes( const SwTable& rTbl, OUString& ,
{
const SwNode* pNd = GetNodeOfFormula();
const SwTableBox* pBox = !pNd ? 0
- : (SwTableBox *)rTbl.GetTblBox(
- pNd->FindTableBoxStartNode()->GetIndex() );
+ : const_cast<SwTableBox *>(rTbl.GetTblBox(
+ pNd->FindTableBoxStartNode()->GetIndex() ));
if( pLastBox )
- pEndBox = (SwTableBox*)lcl_RelToBox( rTbl, pBox, *pLastBox );
- pSttBox = (SwTableBox*)lcl_RelToBox( rTbl, pBox, rFirstBox );
+ pEndBox = const_cast<SwTableBox*>(lcl_RelToBox( rTbl, pBox, *pLastBox ));
+ pSttBox = const_cast<SwTableBox*>(lcl_RelToBox( rTbl, pBox, rFirstBox ));
}
break;
case EXTRNL_NAME:
if( pLastBox )
- pEndBox = (SwTableBox*)rTbl.GetTblBox( *pLastBox );
- pSttBox = (SwTableBox*)rTbl.GetTblBox( rFirstBox );
+ pEndBox = const_cast<SwTableBox*>(rTbl.GetTblBox( *pLastBox ));
+ pSttBox = const_cast<SwTableBox*>(rTbl.GetTblBox( rFirstBox ));
break;
}
@@ -1104,15 +1104,15 @@ void SwTableFormula::_SplitMergeBoxNm( const SwTable& rTbl, OUString& rNewStr,
const SwTableBox* pBox = pNd ? pTbl->GetTblBox(
pNd->FindTableBoxStartNode()->GetIndex() ) : 0;
if( pLastBox )
- pEndBox = (SwTableBox*)lcl_RelToBox( *pTbl, pBox, *pLastBox );
- pSttBox = (SwTableBox*)lcl_RelToBox( *pTbl, pBox, rFirstBox );
+ pEndBox = const_cast<SwTableBox*>(lcl_RelToBox( *pTbl, pBox, *pLastBox ));
+ pSttBox = const_cast<SwTableBox*>(lcl_RelToBox( *pTbl, pBox, rFirstBox ));
}
break;
case EXTRNL_NAME:
if( pLastBox )
- pEndBox = (SwTableBox*)pTbl->GetTblBox( *pLastBox );
- pSttBox = (SwTableBox*)pTbl->GetTblBox( rFirstBox );
+ pEndBox = const_cast<SwTableBox*>(pTbl->GetTblBox( *pLastBox ));
+ pSttBox = const_cast<SwTableBox*>(pTbl->GetTblBox( rFirstBox ));
break;
}
diff --git a/sw/source/core/fields/chpfld.cxx b/sw/source/core/fields/chpfld.cxx
index 8f9c5217421f..8f6d2d9f00e8 100644
--- a/sw/source/core/fields/chpfld.cxx
+++ b/sw/source/core/fields/chpfld.cxx
@@ -103,7 +103,7 @@ void SwChapterField::ChangeExpansion(const SwFrm* pFrm,
bool bSrchNum )
{
OSL_ENSURE( pFrm, "In which frame am I?" );
- SwDoc* pDoc = (SwDoc*)pCntntNode->GetDoc();
+ SwDoc* pDoc = const_cast<SwDoc*>(pCntntNode->GetDoc());
const SwTxtNode* pTxtNode = dynamic_cast<const SwTxtNode*>(pCntntNode);
if ( !pTxtNode || !pFrm->IsInDocBody() )
@@ -125,7 +125,7 @@ void SwChapterField::ChangeExpansion(const SwTxtNode &rTxtNd, bool bSrchNum)
sPost.clear();
sPre.clear();
- SwDoc* pDoc = (SwDoc*)rTxtNd.GetDoc();
+ SwDoc* pDoc = const_cast<SwDoc*>(rTxtNd.GetDoc());
const SwTxtNode *pTxtNd = rTxtNd.FindOutlineNodeOfLevel( nLevel );
if( pTxtNd )
{
diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx
index 2da0ac342cf1..27848b0aa771 100644
--- a/sw/source/core/fields/docufld.cxx
+++ b/sw/source/core/fields/docufld.cxx
@@ -2211,7 +2211,7 @@ void SwRefPageGetField::ChangeExpansion( const SwFrm* pFrm,
// create index for determination of the TextNode
SwPosition aPos( SwNodeIndex( pDoc->GetNodes() ) );
- SwTxtNode* pTxtNode = (SwTxtNode*) GetBodyTxtNode( *pDoc, aPos, *pFrm );
+ SwTxtNode* pTxtNode = const_cast<SwTxtNode*>(GetBodyTxtNode( *pDoc, aPos, *pFrm ));
// If no layout exists, ChangeExpansion is called for header and
// footer lines via layout formatting without existing TxtNode.
diff --git a/sw/source/core/fields/expfld.cxx b/sw/source/core/fields/expfld.cxx
index c799c8176738..3d8eb129bb4a 100644
--- a/sw/source/core/fields/expfld.cxx
+++ b/sw/source/core/fields/expfld.cxx
@@ -163,7 +163,7 @@ SwTxtNode* GetFirstTxtNode( const SwDoc& rDoc, SwPosition& rPos,
const SwTxtNode* GetBodyTxtNode( const SwDoc& rDoc, SwPosition& rPos,
const SwFrm& rFrm )
{
- const SwLayoutFrm* pLayout = (SwLayoutFrm*)rFrm.GetUpper();
+ const SwLayoutFrm* pLayout = rFrm.GetUpper();
const SwTxtNode* pTxtNode = 0;
while( pLayout )
@@ -328,7 +328,7 @@ void SwGetExpField::ChangeExpansion( const SwFrm& rFrm, const SwTxtFld& rFld )
// determine document (or is there an easier way?)
const SwTxtNode* pTxtNode = &rFld.GetTxtNode();
- SwDoc& rDoc = *(SwDoc*)pTxtNode->GetDoc();
+ SwDoc& rDoc = *const_cast<SwDoc*>(pTxtNode->GetDoc());
// create index for determination of the TextNode
SwPosition aPos( SwNodeIndex( rDoc.GetNodes() ) );
diff --git a/sw/source/core/fields/fldlst.cxx b/sw/source/core/fields/fldlst.cxx
index 72d92c1c3ebf..03e3a8efa7ae 100644
--- a/sw/source/core/fields/fldlst.cxx
+++ b/sw/source/core/fields/fldlst.cxx
@@ -93,7 +93,7 @@ SwField* SwInputFieldList::GetField(size_t nId)
{
const SwTxtFld* pTxtFld = (*pSrtLst)[ nId ]->GetTxtFld();
OSL_ENSURE( pTxtFld, "no TextFld" );
- return (SwField*)pTxtFld->GetFmtFld().GetField();
+ return const_cast<SwField*>(pTxtFld->GetFmtFld().GetField());
}
/// save cursor
diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx
index b4c40f19aca7..d2ce47c6d654 100644
--- a/sw/source/core/fields/reffld.cxx
+++ b/sw/source/core/fields/reffld.cxx
@@ -97,9 +97,9 @@ bool IsFrameBehind( const SwTxtNode& rMyNd, sal_Int32 nMySttPos,
*pFrm = static_cast<SwTxtFrm*>(rBehindNd.getLayoutFrm( rBehindNd.GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), 0, 0, false) );
while( pFrm && !pFrm->IsInside( nSttPos ) )
- pFrm = (SwTxtFrm*)pFrm->GetFollow();
+ pFrm = pFrm->GetFollow();
while( pMyFrm && !pMyFrm->IsInside( nMySttPos ) )
- pMyFrm = (SwTxtFrm*)pMyFrm->GetFollow();
+ pMyFrm = pMyFrm->GetFollow();
if( !pFrm || !pMyFrm || pFrm == pMyFrm )
return false;
@@ -421,7 +421,7 @@ void SwGetRefField::UpdateField( const SwTxtFld* pFldTxtAttr )
const SwTxtFrm* pFrm = static_cast<SwTxtFrm*>(pTxtNd->getLayoutFrm( pDoc->getIDocumentLayoutAccess().GetCurrentLayout(), 0, 0, false)),
*pSave = pFrm;
while( pFrm && !pFrm->IsInside( nNumStart ) )
- pFrm = (SwTxtFrm*)pFrm->GetFollow();
+ pFrm = pFrm->GetFollow();
if( pFrm || 0 != ( pFrm = pSave ))
{
@@ -826,7 +826,7 @@ SwTxtNode* SwGetRefFieldType::FindAnchor( SwDoc* pDoc, const OUString& rRefMark,
const SwFmtRefMark *pRef = pDoc->GetRefMark( rRefMark );
if( pRef && pRef->GetTxtRefMark() )
{
- pTxtNd = (SwTxtNode*)&pRef->GetTxtRefMark()->GetTxtNode();
+ pTxtNd = const_cast<SwTxtNode*>(&pRef->GetTxtRefMark()->GetTxtNode());
*pStt = pRef->GetTxtRefMark()->GetStart();
if( pEnd )
*pEnd = *pRef->GetTxtRefMark()->GetAnyEnd();
diff --git a/sw/source/core/fields/tblcalc.cxx b/sw/source/core/fields/tblcalc.cxx
index 07e5fa352de2..ec822963c409 100644
--- a/sw/source/core/fields/tblcalc.cxx
+++ b/sw/source/core/fields/tblcalc.cxx
@@ -154,7 +154,7 @@ bool SwTblField::QueryValue( uno::Any& rAny, sal_uInt16 nWhichId ) const
case FIELD_PROP_PAR2:
{
sal_uInt16 nOldSubType = nSubType;
- SwTblField* pThis = (SwTblField*)this;
+ SwTblField* pThis = const_cast<SwTblField*>(this);
pThis->nSubType |= nsSwExtendedSubType::SUB_CMD;
rAny <<= Expand();
pThis->nSubType = nOldSubType;
diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx
index 4e34bb0da377..a3555a2fe8b6 100644
--- a/sw/source/core/frmedt/fefly1.cxx
+++ b/sw/source/core/frmedt/fefly1.cxx
@@ -209,7 +209,7 @@ bool sw_ChkAndSetNewAnchor(
if( nOld == nNew )
return false;
- SwDoc* pDoc = (SwDoc*)rFmt.GetDoc();
+ SwDoc* pDoc = const_cast<SwDoc*>(rFmt.GetDoc());
#if OSL_DEBUG_LEVEL > 0
OSL_ENSURE( !(nNew == FLY_AT_PAGE &&
@@ -1468,7 +1468,7 @@ const SwFrmFmt* SwFEShell::IsURLGrfAtPos( const Point& rPt, OUString* pURL,
SdrObject* pObj;
SdrPageView* pPV;
const SwFrmFmt* pRet = 0;
- SwDrawView *pDView = (SwDrawView*)Imp()->GetDrawView();
+ SwDrawView *pDView = const_cast<SwDrawView*>(Imp()->GetDrawView());
sal_uInt16 nOld = pDView->GetHitTolerancePixel();
pDView->SetHitTolerancePixel( 2 );
@@ -1539,7 +1539,7 @@ const Graphic *SwFEShell::GetGrfAtPos( const Point &rPt,
SdrObject* pObj;
SdrPageView* pPV;
- SwDrawView *pDView = (SwDrawView*)Imp()->GetDrawView();
+ SwDrawView *pDView = const_cast<SwDrawView*>(Imp()->GetDrawView());
if( pDView->PickObj( rPt, pDView->getHitTolLog(), pObj, pPV ) && pObj->ISA(SwVirtFlyDrawObj) )
{
@@ -1577,7 +1577,7 @@ const SwFrmFmt* SwFEShell::GetFmtFromObj( const Point& rPt, SwRect** pRectToFill
SdrObject* pObj;
SdrPageView* pPView;
- SwDrawView *pDView = (SwDrawView*)Imp()->GetDrawView();
+ SwDrawView *pDView = const_cast<SwDrawView*>(Imp()->GetDrawView());
sal_uInt16 nOld = pDView->GetHitTolerancePixel();
// tolerance for Drawing-SS
@@ -1701,7 +1701,7 @@ ObjCntType SwFEShell::GetObjCntType( const Point &rPt, SdrObject *&rpObj ) const
SdrObject* pObj;
SdrPageView* pPView;
- SwDrawView *pDView = (SwDrawView*)Imp()->GetDrawView();
+ SwDrawView *pDView = const_cast<SwDrawView*>(Imp()->GetDrawView());
sal_uInt16 nOld = pDView->GetHitTolerancePixel();
// tolerance for Drawing-SS
diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx
index 4697c92970f1..9311cc9b3a3a 100644
--- a/sw/source/core/frmedt/feshview.cxx
+++ b/sw/source/core/frmedt/feshview.cxx
@@ -1393,13 +1393,13 @@ bool SwFEShell::GotoObj( bool bNext, sal_uInt16 /*GOTOOBJ_...*/ eType )
{
const SwVirtFlyDrawObj *pO = static_cast<const SwVirtFlyDrawObj*>(pBest);
const SwRect& rFrm = pO->GetFlyFrm()->Frm();
- SelectObj( rFrm.Pos(), 0, (SdrObject*)pBest );
+ SelectObj( rFrm.Pos(), 0, const_cast<SdrObject*>(pBest) );
if( !ActionPend() )
MakeVisible( rFrm );
}
else
{
- SelectObj( Point(), 0, (SdrObject*)pBest );
+ SelectObj( Point(), 0, const_cast<SdrObject*>(pBest) );
if( !ActionPend() )
MakeVisible( pBest->GetCurrentBoundRect() );
}
@@ -2511,7 +2511,7 @@ SwChainRet SwFEShell::Chainable( SwRect &rRect, const SwFrmFmt &rSource,
{
SdrObject* pObj;
SdrPageView* pPView;
- SwDrawView *pDView = (SwDrawView*)Imp()->GetDrawView();
+ SwDrawView *pDView = const_cast<SwDrawView*>(Imp()->GetDrawView());
const sal_uInt16 nOld = pDView->GetHitTolerancePixel();
pDView->SetHitTolerancePixel( 0 );
if( pDView->PickObj( rPt, pDView->getHitTolLog(), pObj, pPView, SDRSEARCH_PICKMARKABLE ) &&
diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx
index 3d94e391d30d..24062749c174 100644
--- a/sw/source/core/frmedt/fetab.cxx
+++ b/sw/source/core/frmedt/fetab.cxx
@@ -1171,7 +1171,7 @@ bool SwFEShell::IsAdjustCellWidthAllowed( bool bBalance ) const
// AutoFormat for the table/table selection
bool SwFEShell::SetTableAutoFmt( const SwTableAutoFmt& rNew )
{
- SwTableNode *pTblNd = (SwTableNode*)IsCrsrInTbl();
+ SwTableNode *pTblNd = const_cast<SwTableNode*>(IsCrsrInTbl());
if( !pTblNd || pTblNd->GetTable().IsTblComplex() )
return false;
@@ -2332,7 +2332,7 @@ bool SwFEShell::IsTableRightToLeft() const
bool SwFEShell::IsMouseTableRightToLeft(const Point &rPt) const
{
- SwFrm *pFrm = (SwFrm *)GetBox( rPt );
+ SwFrm *pFrm = const_cast<SwFrm *>(GetBox( rPt ));
const SwTabFrm* pTabFrm = pFrm ? pFrm->ImplFindTabFrm() : 0;
OSL_ENSURE( pTabFrm, "Table not found" );
return pTabFrm && pTabFrm->IsRightToLeft();
diff --git a/sw/source/core/frmedt/fews.cxx b/sw/source/core/frmedt/fews.cxx
index dd9c2153a170..a61854f66400 100644
--- a/sw/source/core/frmedt/fews.cxx
+++ b/sw/source/core/frmedt/fews.cxx
@@ -339,7 +339,7 @@ void SwFEShell::SetNewPageOffset( sal_uInt16 nOffset )
{
GetLayout()->SetVirtPageNum( true );
const SwPageFrm *pPage = GetCurrFrm( false )->FindPageFrm();
- lcl_SetAPageOffset( nOffset, (SwPageFrm*)pPage, this );
+ lcl_SetAPageOffset( nOffset, const_cast<SwPageFrm*>(pPage), this );
}
void SwFEShell::SetPageOffset( sal_uInt16 nOffset )
@@ -357,7 +357,7 @@ void SwFEShell::SetPageOffset( sal_uInt16 nOffset )
if ( rPgDesc.GetNumOffset() )
{
pDocLayout->SetVirtPageNum( true );
- lcl_SetAPageOffset( nOffset, (SwPageFrm*)pPage, this );
+ lcl_SetAPageOffset( nOffset, const_cast<SwPageFrm*>(pPage), this );
break;
}
}
@@ -658,7 +658,7 @@ void SwFEShell::CalcBoundRect( SwRect& _orRect,
bool bWrapThrough = false;
if ( pFly )
{
- SwFlyFrmFmt* pFmt = (SwFlyFrmFmt*)pFly->GetFmt();
+ SwFlyFrmFmt* pFmt = const_cast<SwFlyFrmFmt*>(pFly->GetFmt());
const SwFmtSurround& rSurround = pFmt->GetSurround();
bWrapThrough = rSurround.GetSurround() == SURROUND_THROUGHT;
}
diff --git a/sw/source/core/frmedt/tblsel.cxx b/sw/source/core/frmedt/tblsel.cxx
index 86d36f70cbce..4a1f369b8cb7 100644
--- a/sw/source/core/frmedt/tblsel.cxx
+++ b/sw/source/core/frmedt/tblsel.cxx
@@ -131,7 +131,7 @@ void GetTblSelCrs( const SwTableCursor& rTblCrsr, SwSelBoxes& rBoxes )
if (rTblCrsr.IsChgd() || !rTblCrsr.GetSelectedBoxesCount())
{
- SwTableCursor* pTCrsr = (SwTableCursor*)&rTblCrsr;
+ SwTableCursor* pTCrsr = const_cast<SwTableCursor*>(&rTblCrsr);
pTCrsr->GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout()->MakeTblCrsrs( *pTCrsr );
}
@@ -308,8 +308,8 @@ void GetTblSel( const SwLayoutFrm* pStart, const SwLayoutFrm* pEnd,
OSL_ENSURE( pCell->IsCellFrm(), "Frame ohne Celle" );
if( ::IsFrmInTblSel( pUnion->GetUnion(), pCell ) )
{
- SwTableBox* pBox = (SwTableBox*)
- static_cast<const SwCellFrm*>(pCell)->GetTabBox();
+ SwTableBox* pBox = const_cast<SwTableBox*>(
+ static_cast<const SwCellFrm*>(pCell)->GetTabBox());
// check for cell protection??
if( !bChkProtected ||
!pBox->GetFrmFmt()->GetProtect().IsCntntProtected() )
@@ -924,9 +924,9 @@ void GetMergeSel( const SwPaM& rPam, SwSelBoxes& rBoxes,
return;
const SwTable *pTable = aUnions.front().GetTable()->GetTable();
- SwDoc* pDoc = (SwDoc*)pStart->GetFmt()->GetDoc();
- SwTableNode* pTblNd = (SwTableNode*)pTable->GetTabSortBoxes()[ 0 ]->
- GetSttNd()->FindTableNode();
+ SwDoc* pDoc = const_cast<SwDoc*>(pStart->GetFmt()->GetDoc());
+ SwTableNode* pTblNd = const_cast<SwTableNode*>(pTable->GetTabSortBoxes()[ 0 ]->
+ GetSttNd()->FindTableNode());
_MergePos aPosArr; // Sort-Array with the frame positions
long nWidth;
@@ -1922,7 +1922,7 @@ void MakeSelUnions( SwSelUnions& rUnions, const SwLayoutFrm *pStart,
if( (aUnion.*fnRect->fnGetWidth)() )
{
- SwSelUnion *pTmp = new SwSelUnion( aUnion, (SwTabFrm*)pTable );
+ SwSelUnion *pTmp = new SwSelUnion( aUnion, const_cast<SwTabFrm*>(pTable) );
rUnions.push_back( pTmp );
}
diff --git a/sw/source/core/graphic/ndgrf.cxx b/sw/source/core/graphic/ndgrf.cxx
index 339476704c78..912bc83046be 100644
--- a/sw/source/core/graphic/ndgrf.cxx
+++ b/sw/source/core/graphic/ndgrf.cxx
@@ -947,7 +947,7 @@ SwCntntNode* SwGrfNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const
SwGrfNode* pGrfNd = pDoc->GetNodes().MakeGrfNode( rIdx, sFile, sFilter,
&aTmpGrf, pColl,
- (SwAttrSet*)GetpSwAttrSet() );
+ const_cast<SwAttrSet*>(GetpSwAttrSet()) );
pGrfNd->SetTitle( GetTitle() );
pGrfNd->SetDescription( GetDescription() );
pGrfNd->SetContour( HasContour(), HasAutomaticContour() );
diff --git a/sw/source/core/inc/cntfrm.hxx b/sw/source/core/inc/cntfrm.hxx
index 74b9f4d7fcb1..b8fae50d8786 100644
--- a/sw/source/core/inc/cntfrm.hxx
+++ b/sw/source/core/inc/cntfrm.hxx
@@ -112,7 +112,7 @@ inline SwCntntFrm* SwCntntFrm::GetNextCntntFrm() const
if ( GetNext() && GetNext()->IsCntntFrm() )
return const_cast<SwCntntFrm*>(static_cast<const SwCntntFrm*>(GetNext()));
else
- return (SwCntntFrm*)ImplGetNextCntntFrm( true );
+ return const_cast<SwCntntFrm*>(ImplGetNextCntntFrm( true ));
}
inline SwCntntFrm* SwCntntFrm::GetPrevCntntFrm() const
@@ -120,7 +120,7 @@ inline SwCntntFrm* SwCntntFrm::GetPrevCntntFrm() const
if ( GetPrev() && GetPrev()->IsCntntFrm() )
return const_cast<SwCntntFrm*>(static_cast<const SwCntntFrm*>(GetPrev()));
else
- return (SwCntntFrm*)ImplGetNextCntntFrm( false );
+ return const_cast<SwCntntFrm*>(ImplGetNextCntntFrm( false ));
}
inline SwCntntNode *SwCntntFrm::GetNode()
diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx
index aeed0030eb11..48e44e783ce7 100644
--- a/sw/source/core/inc/frame.hxx
+++ b/sw/source/core/inc/frame.hxx
@@ -935,11 +935,11 @@ inline void SwFrm::ResetRetouche() const
inline SwLayoutFrm *SwFrm::GetNextLayoutLeaf()
{
- return (SwLayoutFrm*)static_cast<const SwFrm*>(this)->GetNextLayoutLeaf();
+ return const_cast<SwLayoutFrm*>(static_cast<const SwFrm*>(this)->GetNextLayoutLeaf());
}
inline SwLayoutFrm *SwFrm::GetPrevLayoutLeaf()
{
- return (SwLayoutFrm*)static_cast<const SwFrm*>(this)->GetPrevLayoutLeaf();
+ return const_cast<SwLayoutFrm*>(static_cast<const SwFrm*>(this)->GetPrevLayoutLeaf());
}
inline const SwLayoutFrm *SwFrm::GetNextLayoutLeaf() const
{
diff --git a/sw/source/core/inc/layfrm.hxx b/sw/source/core/inc/layfrm.hxx
index 2488f99f9b11..7f3774b707a2 100644
--- a/sw/source/core/inc/layfrm.hxx
+++ b/sw/source/core/inc/layfrm.hxx
@@ -196,17 +196,17 @@ public:
*/
inline SwCntntFrm* SwLayoutFrm::ContainsCntnt()
{
- return (SwCntntFrm*)(static_cast<const SwLayoutFrm*>(this)->ContainsCntnt());
+ return const_cast<SwCntntFrm*>(static_cast<const SwLayoutFrm*>(this)->ContainsCntnt());
}
inline SwCellFrm* SwLayoutFrm::FirstCell()
{
- return (SwCellFrm*)(static_cast<const SwLayoutFrm*>(this)->FirstCell());
+ return const_cast<SwCellFrm*>(static_cast<const SwLayoutFrm*>(this)->FirstCell());
}
inline SwFrm* SwLayoutFrm::ContainsAny( const bool _bInvestigateFtnForSections )
{
- return (SwFrm*)(static_cast<const SwLayoutFrm*>(this)->ContainsAny( _bInvestigateFtnForSections ));
+ return const_cast<SwFrm*>(static_cast<const SwLayoutFrm*>(this)->ContainsAny( _bInvestigateFtnForSections ));
}
/**
diff --git a/sw/source/core/inc/txtfrm.hxx b/sw/source/core/inc/txtfrm.hxx
index b29cb18b611a..8cf26338c56f 100644
--- a/sw/source/core/inc/txtfrm.hxx
+++ b/sw/source/core/inc/txtfrm.hxx
@@ -397,7 +397,7 @@ public:
inline void ResetBlinkPor() const;
inline bool HasBlinkPor() const { return bBlinkPor; }
inline void SetAnimation() const
- { ( (SwTxtFrm*)this )->bHasAnimation = true; }
+ { const_cast<SwTxtFrm*>(this)->bHasAnimation = true; }
inline bool HasAnimation() const { return bHasAnimation; }
inline bool IsSwapped() const { return bIsSwapped; }
diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx
index 7efebc117838..fbe2e323b54c 100644
--- a/sw/source/core/layout/atrfrm.cxx
+++ b/sw/source/core/layout/atrfrm.cxx
@@ -451,7 +451,7 @@ SwFmtHeader::SwFmtHeader( SwFrmFmt *pHeaderFmt )
SwFmtHeader::SwFmtHeader( const SwFmtHeader &rCpy )
: SfxPoolItem( RES_HEADER ),
- SwClient( (SwModify*)rCpy.GetRegisteredIn() ),
+ SwClient( const_cast<SwModify*>(rCpy.GetRegisteredIn()) ),
bActive( rCpy.IsActive() )
{
}
@@ -496,7 +496,7 @@ SwFmtFooter::SwFmtFooter( SwFrmFmt *pFooterFmt )
SwFmtFooter::SwFmtFooter( const SwFmtFooter &rCpy )
: SfxPoolItem( RES_FOOTER ),
- SwClient( (SwModify*)rCpy.GetRegisteredIn() ),
+ SwClient( const_cast<SwModify*>(rCpy.GetRegisteredIn()) ),
bActive( rCpy.IsActive() )
{
}
@@ -582,7 +582,7 @@ void SwFmtCntnt::dumpAsXml(xmlTextWriterPtr pWriter) const
// Partially implemented inline in hxx
SwFmtPageDesc::SwFmtPageDesc( const SwFmtPageDesc &rCpy )
: SfxPoolItem( RES_PAGEDESC ),
- SwClient( (SwPageDesc*)rCpy.GetPageDesc() ),
+ SwClient( const_cast<SwPageDesc*>(rCpy.GetPageDesc()) ),
oNumOffset( rCpy.oNumOffset ),
nDescNameIdx( rCpy.nDescNameIdx ),
pDefinedIn( 0 )
@@ -591,7 +591,7 @@ SwFmtPageDesc::SwFmtPageDesc( const SwFmtPageDesc &rCpy )
SwFmtPageDesc::SwFmtPageDesc( const SwPageDesc *pDesc )
: SfxPoolItem( RES_PAGEDESC ),
- SwClient( (SwPageDesc*)pDesc ),
+ SwClient( const_cast<SwPageDesc*>(pDesc) ),
nDescNameIdx( 0xFFFF ), // IDX_NO_VALUE
pDefinedIn( 0 )
{
@@ -2583,9 +2583,9 @@ void SwFrmFmt::Modify( const SfxPoolItem* pOld, const SfxPoolItem* pNew )
}
}
else if( RES_HEADER == nWhich )
- pH = const_cast<SwFmtHeader*>(static_cast<const SwFmtHeader*>(pNew));
+ pH = static_cast<const SwFmtHeader*>(pNew);
else if( RES_FOOTER == nWhich )
- pF = const_cast<SwFmtFooter*>(static_cast<const SwFmtFooter*>(pNew));
+ pF = static_cast<const SwFmtFooter*>(pNew);
if( pH && pH->IsActive() && !pH->GetHeaderFmt() )
{ //If he doesn't have one, I'll add one
diff --git a/sw/source/core/layout/calcmove.cxx b/sw/source/core/layout/calcmove.cxx
index 827a5da5efab..9e951b698e07 100644
--- a/sw/source/core/layout/calcmove.cxx
+++ b/sw/source/core/layout/calcmove.cxx
@@ -916,7 +916,7 @@ bool SwCntntFrm::MakePrtArea( const SwBorderAttrs &rAttrs )
// At the FixSize, the surrounding Frame enforces the size;
// the borders are simply subtracted.
const long nLeft = rAttrs.CalcLeft( this );
- const long nRight = const_cast<SwBorderAttrs&>(rAttrs).CalcRight( this );
+ const long nRight = rAttrs.CalcRight( this );
(this->*fnRect->fnSetXMargins)( nLeft, nRight );
SwViewShell *pSh = getRootFrm()->GetCurrShell();
diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx
index 365413aff33b..cb54c5231d1a 100644
--- a/sw/source/core/layout/flowfrm.cxx
+++ b/sw/source/core/layout/flowfrm.cxx
@@ -823,7 +823,7 @@ bool SwFrm::WrongPageDesc( SwPageFrm* pNew )
SwFlowFrm *pFlow = SwFlowFrm::CastFlowFrm( this );
if ( !pFlow || !pFlow->IsFollow() )
{
- pDesc = (SwPageDesc*)rFmtDesc.GetPageDesc();
+ pDesc = const_cast<SwPageDesc*>(rFmtDesc.GetPageDesc());
if( pDesc )
{
if( !pDesc->GetRightFmt() )
diff --git a/sw/source/core/layout/fly.cxx b/sw/source/core/layout/fly.cxx
index f8c0db074ba1..a7e0820fb0ac 100644
--- a/sw/source/core/layout/fly.cxx
+++ b/sw/source/core/layout/fly.cxx
@@ -690,8 +690,8 @@ void SwFlyFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem * pNew )
SwAttrSetChg aNewSet( *static_cast<const SwAttrSetChg*>(pNew) );
while( true )
{
- _UpdateAttr( (SfxPoolItem*)aOIter.GetCurItem(),
- (SfxPoolItem*)aNIter.GetCurItem(), nInvFlags,
+ _UpdateAttr( aOIter.GetCurItem(),
+ aNIter.GetCurItem(), nInvFlags,
&aOldSet, &aNewSet );
if( aNIter.IsAtEnd() )
break;
diff --git a/sw/source/core/layout/flycnt.cxx b/sw/source/core/layout/flycnt.cxx
index 2c18d9af746e..bd6b789eda02 100644
--- a/sw/source/core/layout/flycnt.cxx
+++ b/sw/source/core/layout/flycnt.cxx
@@ -730,7 +730,7 @@ static const SwFrm * lcl_CalcDownDist( SwDistance &rRet,
{
if ( !static_cast<const SwLayoutFrm*>(pLay)->Lower() )
{
- SwFrm *pDel = (SwFrm*)pLay;
+ SwFrm *pDel = const_cast<SwFrm*>(pLay);
pDel->Cut();
delete pDel;
return pPre;
@@ -839,7 +839,7 @@ static const SwFrm * lcl_CalcDownDist( SwDistance &rRet,
}
if ( pLay->IsFtnContFrm() && !static_cast<const SwLayoutFrm*>(pLay)->Lower() )
{
- SwFrm *pDel = (SwFrm*)pLay;
+ SwFrm *pDel = const_cast<SwFrm*>(pLay);
pDel->Cut();
delete pDel;
return 0;
@@ -1175,7 +1175,7 @@ void SwFlyAtCntFrm::SetAbsPos( const Point &rNew )
if( ( GetAnchorFrm()->IsVertical() && !GetAnchorFrm()->IsVertLR() ) || GetAnchorFrm()->IsRightToLeft() )
aNew.setX(aNew.getX() + Frm().Width());
- SwCntntFrm *pCnt = (SwCntntFrm*)::FindAnchor( GetAnchorFrm(), aNew );
+ SwCntntFrm *pCnt = const_cast<SwCntntFrm*>(::FindAnchor( GetAnchorFrm(), aNew ));
if( pCnt->IsProtected() )
pCnt = const_cast<SwCntntFrm*>(static_cast<const SwCntntFrm*>(GetAnchorFrm()));
diff --git a/sw/source/core/layout/flylay.cxx b/sw/source/core/layout/flylay.cxx
index 0c3ae6ff910a..0243f0d99644 100644
--- a/sw/source/core/layout/flylay.cxx
+++ b/sw/source/core/layout/flylay.cxx
@@ -559,7 +559,7 @@ void SwPageFrm::AppendFlyToPage( SwFlyFrm *pNew )
SdrObject* pObj = pNew->GetVirtDrawObj();
OSL_ENSURE( pNew->GetAnchorFrm(), "Fly without Anchor" );
- SwFlyFrm* pFly = (SwFlyFrm*)pNew->GetAnchorFrm()->FindFlyFrm();
+ SwFlyFrm* pFly = const_cast<SwFlyFrm*>(pNew->GetAnchorFrm()->FindFlyFrm());
if ( pFly && pObj->GetOrdNum() < pFly->GetVirtDrawObj()->GetOrdNum() )
{
//#i119945# set pFly's OrdNum to _rNewObj's. So when pFly is removed by Undo, the original OrdNum will not be changed.
@@ -796,7 +796,7 @@ void SwPageFrm::AppendDrawObjToPage( SwAnchoredObject& _rNewObj )
}
OSL_ENSURE( _rNewObj.GetAnchorFrm(), "anchored draw object without anchor" );
- SwFlyFrm* pFlyFrm = (SwFlyFrm*)_rNewObj.GetAnchorFrm()->FindFlyFrm();
+ SwFlyFrm* pFlyFrm = const_cast<SwFlyFrm*>(_rNewObj.GetAnchorFrm()->FindFlyFrm());
if ( pFlyFrm &&
_rNewObj.GetDrawObj()->GetOrdNum() < pFlyFrm->GetVirtDrawObj()->GetOrdNum() )
{
diff --git a/sw/source/core/layout/flypos.cxx b/sw/source/core/layout/flypos.cxx
index b0ecb2894e9c..60c44bf1528e 100644
--- a/sw/source/core/layout/flypos.cxx
+++ b/sw/source/core/layout/flypos.cxx
@@ -38,7 +38,7 @@ bool SwPosFlyFrmCmp::operator()(const SwPosFlyFrmPtr& rA, const SwPosFlyFrmPtr&
SwPosFlyFrm::SwPosFlyFrm( const SwNodeIndex& rIdx, const SwFrmFmt* pFmt,
sal_uInt16 nArrPos )
- : pFrmFmt( pFmt ), pNdIdx( (SwNodeIndex*) &rIdx )
+ : pFrmFmt( pFmt ), pNdIdx( const_cast<SwNodeIndex*>(&rIdx) )
{
bool bFnd = false;
const SwFmtAnchor& rAnchor = pFmt->GetAnchor();
diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx
index 37a7dac32fa5..e96ad045c128 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -2715,7 +2715,7 @@ SwPageFrm * InsertNewPage( SwPageDesc &rDesc, SwFrm *pUpper,
static void lcl_Regist( SwPageFrm *pPage, const SwFrm *pAnch )
{
- SwSortedObjs *pObjs = (SwSortedObjs*)pAnch->GetDrawObjs();
+ SwSortedObjs *pObjs = const_cast<SwSortedObjs*>(pAnch->GetDrawObjs());
for ( size_t i = 0; i < pObjs->size(); ++i )
{
SwAnchoredObject* pObj = (*pObjs)[i];
@@ -3086,7 +3086,7 @@ const SwFrm* GetVirtualUpper( const SwFrm* pFrm, const Point& rPos )
}
else
{
- SwFlyFrm* pTmp = (SwFlyFrm*)pFrm->FindFlyFrm();
+ SwFlyFrm* pTmp = const_cast<SwFlyFrm*>(pFrm->FindFlyFrm());
while( pTmp )
{
if( pTmp->Frm().IsInside( rPos ) )
diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx
index 04a55df847c2..6d21bf42367c 100644
--- a/sw/source/core/layout/ftnfrm.cxx
+++ b/sw/source/core/layout/ftnfrm.cxx
@@ -42,7 +42,7 @@ static sal_uLong lcl_FindFtnPos( const SwDoc *pDoc, const SwTxtFtn *pAttr )
{
const SwFtnIdxs &rFtnIdxs = pDoc->GetFtnIdxs();
- SwTxtFtn* pBla = (SwTxtFtn*)pAttr;
+ SwTxtFtn* pBla = const_cast<SwTxtFtn*>(pAttr);
SwFtnIdxs::const_iterator it = rFtnIdxs.find( pBla );
if ( it != rFtnIdxs.end() )
{
@@ -1085,7 +1085,7 @@ const SwFtnFrm *SwFtnBossFrm::FindFirstFtn( SwCntntFrm *pCnt ) const
if ( pRet->GetNext() )
pRet = static_cast<const SwFtnFrm*>(pRet->GetNext());
else
- { SwFtnBossFrm *pBoss = (SwFtnBossFrm*)pRet->FindFtnBossFrm();
+ { SwFtnBossFrm *pBoss = const_cast<SwFtnBossFrm*>(pRet->FindFtnBossFrm());
SwPageFrm *pPage = pBoss->FindPageFrm();
lcl_NextFtnBoss( pBoss, pPage, false ); // next FtnBoss
SwFtnContFrm *pCont = pBoss ? pBoss->FindNearestFtnCont() : 0;
@@ -2346,7 +2346,7 @@ void SwPageFrm::UpdateFtnNum()
pCntnt = static_cast<SwSectionFrm*>(pBoss->GetUpper())->FindLastCntnt();
else
{
- SwFtnFrm* pFtn = (SwFtnFrm*)pBoss->FindFirstFtn( pCntnt );
+ SwFtnFrm* pFtn = const_cast<SwFtnFrm*>(pBoss->FindFirstFtn( pCntnt ));
while( pFtn )
{
SwTxtFtn* pTxtFtn = pFtn->GetAttr();
@@ -2803,7 +2803,7 @@ SwCntntFrm* SwFtnFrm::GetRef()
const SwCntntFrm* SwFtnFrm::GetRefFromAttr() const
{
- SwFtnFrm* pThis = (SwFtnFrm*)this;
+ SwFtnFrm* pThis = const_cast<SwFtnFrm*>(this);
return pThis->GetRefFromAttr();
}
diff --git a/sw/source/core/layout/hffrm.cxx b/sw/source/core/layout/hffrm.cxx
index 9e4f1ee9de19..f85a82049297 100644
--- a/sw/source/core/layout/hffrm.cxx
+++ b/sw/source/core/layout/hffrm.cxx
@@ -679,7 +679,7 @@ void SwPageFrm::PrepareHeader()
{ //Implant header, but remove first, if already present
OSL_ENSURE( rH.GetHeaderFmt(), "FrmFmt for Header not found." );
- if ( pLay->GetFmt() == (SwFrmFmt*)rH.GetHeaderFmt() )
+ if ( pLay->GetFmt() == rH.GetHeaderFmt() )
return; // Header is already the correct one.
if ( pLay->IsHeaderFrm() )
@@ -690,7 +690,7 @@ void SwPageFrm::PrepareHeader()
delete pDel;
}
OSL_ENSURE( pLay, "Where to with the Header?" );
- SwHeaderFrm *pH = new SwHeaderFrm( (SwFrmFmt*)rH.GetHeaderFmt(), this );
+ SwHeaderFrm *pH = new SwHeaderFrm( const_cast<SwFrmFmt*>(rH.GetHeaderFmt()), this );
pH->Paste( this, pLay );
if ( GetUpper() )
::RegistFlys( this, pH );
@@ -721,7 +721,7 @@ void SwPageFrm::PrepareFooter()
{ //Implant footer, but remove first, if already present
OSL_ENSURE( rF.GetFooterFmt(), "FrmFmt for Footer not found." );
- if ( pLay->GetFmt() == (SwFrmFmt*)rF.GetFooterFmt() )
+ if ( pLay->GetFmt() == rF.GetFooterFmt() )
return; // Footer is already the correct one.
if ( pLay->IsFooterFrm() )
@@ -729,7 +729,7 @@ void SwPageFrm::PrepareFooter()
pLay->Cut();
delete pLay;
}
- SwFooterFrm *pF = new SwFooterFrm( (SwFrmFmt*)rF.GetFooterFmt(), this );
+ SwFooterFrm *pF = new SwFooterFrm( const_cast<SwFrmFmt*>(rF.GetFooterFmt()), this );
pF->Paste( this );
if ( GetUpper() )
::RegistFlys( this, pF );
diff --git a/sw/source/core/layout/layact.cxx b/sw/source/core/layout/layact.cxx
index 4ef707e4bc67..0455e3450edb 100644
--- a/sw/source/core/layout/layact.cxx
+++ b/sw/source/core/layout/layact.cxx
@@ -1156,7 +1156,7 @@ bool SwLayAction::IsShortCut( SwPageFrm *&prPage )
if ( pTmp->GetPhyPageNum() < prPage->GetPhyPageNum() &&
pTmp->IsInvalid() )
{
- prPage = (SwPageFrm*)pTmp;
+ prPage = const_cast<SwPageFrm*>(pTmp);
}
else
{
diff --git a/sw/source/core/layout/newfrm.cxx b/sw/source/core/layout/newfrm.cxx
index 5f3d16b582b0..f4f9dbafba0c 100644
--- a/sw/source/core/layout/newfrm.cxx
+++ b/sw/source/core/layout/newfrm.cxx
@@ -522,7 +522,7 @@ void SwRootFrm::Init( SwFrmFmt* pFmt )
if ( pTblNd )
{
const SwFmtPageDesc &rDesc = pTblNd->GetTable().GetFrmFmt()->GetPageDesc();
- pDesc = (SwPageDesc*)rDesc.GetPageDesc();
+ pDesc = const_cast<SwPageDesc*>(rDesc.GetPageDesc());
//#19104# respect the page number offset!!
oPgNum = rDesc.GetNumOffset();
if (oPgNum)
@@ -531,7 +531,7 @@ void SwRootFrm::Init( SwFrmFmt* pFmt )
else if ( pNode )
{
const SwFmtPageDesc &rDesc = pNode->GetSwAttrSet().GetPageDesc();
- pDesc = (SwPageDesc*)rDesc.GetPageDesc();
+ pDesc = const_cast<SwPageDesc*>(rDesc.GetPageDesc());
//#19104# respect the page number offset!!
oPgNum = rDesc.GetNumOffset();
if (oPgNum)
diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx
index 90fdc81c24dd..a649d84a1787 100644
--- a/sw/source/core/layout/pagechg.cxx
+++ b/sw/source/core/layout/pagechg.cxx
@@ -493,8 +493,8 @@ void SwPageFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem * pNew )
SwAttrSetChg aNewSet( *static_cast<const SwAttrSetChg*>(pNew) );
while( true )
{
- _UpdateAttr( (SfxPoolItem*)aOIter.GetCurItem(),
- (SfxPoolItem*)aNIter.GetCurItem(), nInvFlags,
+ _UpdateAttr( aOIter.GetCurItem(),
+ aNIter.GetCurItem(), nInvFlags,
&aOldSet, &aNewSet );
if( aNIter.IsAtEnd() )
break;
@@ -724,7 +724,7 @@ SwPageDesc *SwPageFrm::FindPageDesc()
SwFrm *pFlow = pFrm;
if ( pFlow->IsInTab() )
pFlow = pFlow->FindTabFrm();
- pRet = (SwPageDesc*)pFlow->GetAttrSet()->GetPageDesc().GetPageDesc();
+ pRet = const_cast<SwPageDesc*>(pFlow->GetAttrSet()->GetPageDesc().GetPageDesc());
}
if ( !pRet )
pRet = &GetFmt()->GetDoc()->GetPageDesc( 0 );
@@ -740,7 +740,7 @@ SwPageDesc *SwPageFrm::FindPageDesc()
{
SwFlowFrm *pTmp = SwFlowFrm::CastFlowFrm( pFlow );
if ( !pTmp->IsFollow() )
- pRet = (SwPageDesc*)pFlow->GetAttrSet()->GetPageDesc().GetPageDesc();
+ pRet = const_cast<SwPageDesc*>(pFlow->GetAttrSet()->GetPageDesc().GetPageDesc());
}
//3. und 3.1
@@ -1479,7 +1479,7 @@ void SwRootFrm::AssertPageFlys( SwPageFrm *pPage )
nCnt != pPage->GetSortedObjs()->size(),
"Object couldn't be reattached!" );
#else
- rFmt.NotifyClients( 0, (SwFmtAnchor*)&rAnch );
+ rFmt.NotifyClients( 0, const_cast<SwFmtAnchor*>(&rAnch) );
#endif
// Do not increment index, in this case
continue;
diff --git a/sw/source/core/layout/pagedesc.cxx b/sw/source/core/layout/pagedesc.cxx
index fffe9df4079e..0aca15fc9ddc 100644
--- a/sw/source/core/layout/pagedesc.cxx
+++ b/sw/source/core/layout/pagedesc.cxx
@@ -64,7 +64,7 @@ SwPageDesc::SwPageDesc( const SwPageDesc &rCpy ) :
aLeft( rCpy.GetLeft() ),
m_FirstMaster( rCpy.GetFirstMaster() ),
m_FirstLeft( rCpy.GetFirstLeft() ),
- aDepend( this, (SwModify*)rCpy.aDepend.GetRegisteredIn() ),
+ aDepend( this, const_cast<SwModify*>(rCpy.aDepend.GetRegisteredIn()) ),
pFollow( rCpy.pFollow ),
nRegHeight( rCpy.GetRegHeight() ),
nRegAscent( rCpy.GetRegAscent() ),
diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx
index 6860801b830b..d753f2ba7f99 100644
--- a/sw/source/core/layout/paintfrm.cxx
+++ b/sw/source/core/layout/paintfrm.cxx
@@ -1840,7 +1840,7 @@ static void lcl_DrawGraphic( const SvxBrushItem& rBrush, OutputDevice *pOut,
// No Link here, we want to load the graphic synchronously!
const_cast<SvxBrushItem&>(rBrush).SetDoneLink( Link() );
- GraphicObject *pGrf = (GraphicObject*)rBrush.GetGraphicObject();
+ GraphicObject *pGrf = const_cast<GraphicObject*>(rBrush.GetGraphicObject());
// Outsource drawing of background with a background color
::lcl_DrawGraphicBackgrd( rBrush, pOut, aAlignedGrfRect, *pGrf, bGrfNum, properties, bBackgrdAlreadyDrawn );
@@ -1965,7 +1965,7 @@ void DrawGraphic(
if ( (rSh).GetViewOptions()->IsPDFExport() ||
rSh.GetOut()->GetOutDevType() == OUTDEV_PRINTER )
{
- const_cast<SvxBrushItem*>(pBrush)->PurgeMedium();
+ pBrush->PurgeMedium();
const_cast<SvxBrushItem*>(pBrush)->SetDoneLink( Link() );
}
else
@@ -2140,7 +2140,7 @@ void DrawGraphic(
(ePos != GPOS_TILED) && (ePos != GPOS_AREA)
)
{
- GraphicObject *pGrf = (GraphicObject*)pBrush->GetGraphicObject();
+ GraphicObject *pGrf = const_cast<GraphicObject*>(pBrush->GetGraphicObject());
if ( bConsiderBackgroundTransparency )
{
GraphicAttr pGrfAttr = pGrf->GetAttr();
@@ -3214,12 +3214,12 @@ void SwRootFrm::Paint(SwRect const& rRect, SwPrintData const*const pPrintData) c
if ( bPerformLayoutAction )
{
const_cast<SwRootFrm*>(this)->ResetTurbo();
- SwLayAction aAction( (SwRootFrm*)this, pSh->Imp() );
+ SwLayAction aAction( const_cast<SwRootFrm*>(this), pSh->Imp() );
aAction.SetPaint( false );
aAction.SetComplete( false );
aAction.SetReschedule( gProp.pSProgress != nullptr );
aAction.Action();
- const_cast<SwRootFrm*>(this)->ResetTurboFlag();
+ ResetTurboFlag();
if ( !pSh->ActionPend() )
pSh->Imp()->DelRegion();
}
@@ -6413,7 +6413,7 @@ void SwFrm::PaintBaBo( const SwRect& rRect, const SwPageFrm *pPage,
pOut->Push( PushFlags::FILLCOLOR|PushFlags::LINECOLOR );
pOut->SetLineColor();
- SwBorderAttrAccess aAccess( SwFrm::GetCache(), (SwFrm*)this );
+ SwBorderAttrAccess aAccess( SwFrm::GetCache(), this );
const SwBorderAttrs &rAttrs = *aAccess.Get();
// OD 20.11.2002 #104598# - take care of page margin area
@@ -6671,7 +6671,7 @@ void SwFrm::PaintBackground( const SwRect &rRect, const SwPageFrm *pPage,
aFrmRect = pFrm->PaintArea();
if ( aFrmRect.IsOver( aBorderRect ) )
{
- SwBorderAttrAccess aAccess( SwFrm::GetCache(), (SwFrm*)pFrm );
+ SwBorderAttrAccess aAccess( SwFrm::GetCache(), pFrm );
const SwBorderAttrs &rTmpAttrs = *aAccess.Get();
if ( ( pFrm->IsLayoutFrm() && bLowerBorder ) ||
aFrmRect.IsOver( aRect ) )
@@ -7255,7 +7255,7 @@ void SwLayoutFrm::RefreshExtraData( const SwRect &rRect ) const
pCnt->Frm().Top() <= rRect.Bottom() &&
pCnt->Frm().Bottom() >= rRect.Top() )
{
- const_cast<SwTxtFrm*>(static_cast<const SwTxtFrm*>(pCnt))->PaintExtraData( rRect );
+ static_cast<const SwTxtFrm*>(pCnt)->PaintExtraData( rRect );
}
if ( bLineInFly && pCnt->GetDrawObjs() )
for ( size_t i = 0; i < pCnt->GetDrawObjs()->size(); ++i )
diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx
index 521572311a4c..80e45a8580ba 100644
--- a/sw/source/core/layout/sectfrm.cxx
+++ b/sw/source/core/layout/sectfrm.cxx
@@ -2258,8 +2258,8 @@ void SwSectionFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem * pNew )
SwAttrSetChg aNewSet( *static_cast<const SwAttrSetChg*>(pNew) );
while( true )
{
- _UpdateAttr( (SfxPoolItem*)aOIter.GetCurItem(),
- (SfxPoolItem*)aNIter.GetCurItem(), nInvFlags,
+ _UpdateAttr( aOIter.GetCurItem(),
+ aNIter.GetCurItem(), nInvFlags,
&aOldSet, &aNewSet );
if( aNIter.IsAtEnd() )
break;
diff --git a/sw/source/core/layout/ssfrm.cxx b/sw/source/core/layout/ssfrm.cxx
index a4aa372c1c40..b25ea093d5f5 100644
--- a/sw/source/core/layout/ssfrm.cxx
+++ b/sw/source/core/layout/ssfrm.cxx
@@ -213,7 +213,7 @@ void SwFrm::CheckDirChange()
MIN_VERT_CELL_HEIGHT = 1135
};
- SwTableLine* pLine = (SwTableLine*)static_cast<SwCellFrm*>(this)->GetTabBox()->GetUpper();
+ SwTableLine* pLine = const_cast<SwTableLine*>(static_cast<SwCellFrm*>(this)->GetTabBox()->GetUpper());
SwFrmFmt* pFrmFmt = pLine->GetFrmFmt();
SwFmtFrmSize aNew( pFrmFmt->GetFrmSize() );
if ( ATT_FIX_SIZE != aNew.GetHeightSizeType() )
diff --git a/sw/source/core/layout/tabfrm.cxx b/sw/source/core/layout/tabfrm.cxx
index a319c556e785..6ab7825db965 100644
--- a/sw/source/core/layout/tabfrm.cxx
+++ b/sw/source/core/layout/tabfrm.cxx
@@ -3000,8 +3000,8 @@ void SwTabFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem * pNew )
SwAttrSetChg aNewSet( *static_cast<const SwAttrSetChg*>(pNew) );
while( true )
{
- _UpdateAttr( (SfxPoolItem*)aOIter.GetCurItem(),
- (SfxPoolItem*)aNIter.GetCurItem(), nInvFlags,
+ _UpdateAttr( aOIter.GetCurItem(),
+ aNIter.GetCurItem(), nInvFlags,
&aOldSet, &aNewSet );
if( aNIter.IsAtEnd() )
break;
@@ -3836,7 +3836,7 @@ static sal_uInt16 lcl_GetTopSpace( const SwRowFrm& rRow )
nTmpTopSpace = lcl_GetTopSpace( *static_cast<const SwRowFrm*>(pCurrLower->Lower()) );
else
{
- const SwAttrSet& rSet = ((SwCellFrm*)pCurrLower)->GetFmt()->GetAttrSet();
+ const SwAttrSet& rSet = const_cast<SwCellFrm*>(pCurrLower)->GetFmt()->GetAttrSet();
const SvxBoxItem& rBoxItem = rSet.GetBox();
nTmpTopSpace = rBoxItem.CalcLineSpace( BOX_LINE_TOP, true );
}
@@ -3857,7 +3857,7 @@ static sal_uInt16 lcl_GetTopLineDist( const SwRowFrm& rRow )
nTmpTopLineDist = lcl_GetTopLineDist( *static_cast<const SwRowFrm*>(pCurrLower->Lower()) );
else
{
- const SwAttrSet& rSet = ((SwCellFrm*)pCurrLower)->GetFmt()->GetAttrSet();
+ const SwAttrSet& rSet = const_cast<SwCellFrm*>(pCurrLower)->GetFmt()->GetAttrSet();
const SvxBoxItem& rBoxItem = rSet.GetBox();
nTmpTopLineDist = rBoxItem.GetDistance( BOX_LINE_TOP );
}
@@ -3881,7 +3881,7 @@ static sal_uInt16 lcl_GetBottomLineSize( const SwRowFrm& rRow )
}
else
{
- const SwAttrSet& rSet = ((SwCellFrm*)pCurrLower)->GetFmt()->GetAttrSet();
+ const SwAttrSet& rSet = const_cast<SwCellFrm*>(pCurrLower)->GetFmt()->GetAttrSet();
const SvxBoxItem& rBoxItem = rSet.GetBox();
nTmpBottomLineSize = rBoxItem.CalcLineSpace( BOX_LINE_BOTTOM, true ) -
rBoxItem.GetDistance( BOX_LINE_BOTTOM );
@@ -3906,7 +3906,7 @@ static sal_uInt16 lcl_GetBottomLineDist( const SwRowFrm& rRow )
}
else
{
- const SwAttrSet& rSet = ((SwCellFrm*)pCurrLower)->GetFmt()->GetAttrSet();
+ const SwAttrSet& rSet = const_cast<SwCellFrm*>(pCurrLower)->GetFmt()->GetAttrSet();
const SvxBoxItem& rBoxItem = rSet.GetBox();
nTmpBottomLineDist = rBoxItem.GetDistance( BOX_LINE_BOTTOM );
}
@@ -5321,7 +5321,7 @@ SwTwips SwTabFrm::CalcHeightOfFirstContentLine() const
else if ( 0 != nFirstLineHeight )
{
const bool bOldJoinLock = IsJoinLocked();
- ((SwTabFrm*)this)->LockJoin();
+ const_cast<SwTabFrm*>(this)->LockJoin();
const SwTwips nHeightOfFirstContentLine = lcl_CalcHeightOfFirstContentLine( *(SwRowFrm*)pFirstRow );
// Consider minimum row height:
@@ -5332,7 +5332,7 @@ SwTwips SwTabFrm::CalcHeightOfFirstContentLine() const
nTmpHeight += std::max( nHeightOfFirstContentLine, nMinRowHeight );
if ( !bOldJoinLock )
- ((SwTabFrm*)this)->UnlockJoin();
+ const_cast<SwTabFrm*>(this)->UnlockJoin();
}
}
diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx
index 33823251456c..deab86a7acd8 100644
--- a/sw/source/core/layout/trvlfrm.cxx
+++ b/sw/source/core/layout/trvlfrm.cxx
@@ -606,7 +606,7 @@ bool SwFlyFrm::GetCrsrOfst( SwPosition *pPos, Point &rPoint,
/** Layout dependent cursor travelling */
bool SwCntntFrm::LeftMargin(SwPaM *pPam) const
{
- if( &pPam->GetNode() != (SwCntntNode*)GetNode() )
+ if( &pPam->GetNode() != GetNode() )
return false;
const_cast<SwCntntNode*>(GetNode())->
MakeStartIndex((SwIndex *) &pPam->GetPoint()->nContent);
@@ -615,7 +615,7 @@ bool SwCntntFrm::LeftMargin(SwPaM *pPam) const
bool SwCntntFrm::RightMargin(SwPaM *pPam, bool) const
{
- if( &pPam->GetNode() != (SwCntntNode*)GetNode() )
+ if( &pPam->GetNode() != GetNode() )
return false;
const_cast<SwCntntNode*>(GetNode())->
MakeEndIndex((SwIndex *) &pPam->GetPoint()->nContent);
@@ -681,7 +681,7 @@ static const SwCntntFrm * lcl_MissProtectedFrames( const SwCntntFrm *pCnt,
static bool lcl_UpDown( SwPaM *pPam, const SwCntntFrm *pStart,
GetNxtPrvCnt fnNxtPrv, bool bInReadOnly )
{
- OSL_ENSURE( &pPam->GetNode() == (SwCntntNode*)pStart->GetNode(),
+ OSL_ENSURE( &pPam->GetNode() == pStart->GetNode(),
"lcl_UpDown doesn't work for others." );
const SwCntntFrm *pCnt = 0;
@@ -930,7 +930,7 @@ static bool lcl_UpDown( SwPaM *pPam, const SwCntntFrm *pStart,
if( pCnt )
{ // set the Point on the Content-Node
- SwCntntNode *pCNd = (SwCntntNode*)pCnt->GetNode();
+ SwCntntNode *pCNd = const_cast<SwCntntNode*>(pCnt->GetNode());
pPam->GetPoint()->nNode = *pCNd;
if ( fnNxtPrv == lcl_GetPrvCnt )
pCNd->MakeEndIndex( (SwIndex*)&pPam->GetPoint()->nContent );
@@ -1010,7 +1010,7 @@ sal_uInt16 SwRootFrm::SetCurrPage( SwCursor* pToSet, sal_uInt16 nPageNum )
pCntnt = pCntnt->GetNextCntntFrm();
if ( pCntnt )
{
- SwCntntNode* pCNd = (SwCntntNode*)pCntnt->GetNode();
+ SwCntntNode* pCNd = const_cast<SwCntntNode*>(pCntnt->GetNode());
pToSet->GetPoint()->nNode = *pCNd;
pCNd->MakeStartIndex( (SwIndex*)&pToSet->GetPoint()->nContent );
pToSet->GetPoint()->nContent = static_cast<const SwTxtFrm*>(pCntnt)->GetOfst();
@@ -1051,7 +1051,7 @@ SwLayoutFrm *GetNextFrm( const SwLayoutFrm *pFrm )
SwLayoutFrm *GetThisFrm( const SwLayoutFrm *pFrm )
{
- return (SwLayoutFrm*)pFrm;
+ return const_cast<SwLayoutFrm*>(pFrm);
}
SwLayoutFrm *GetPrevFrm( const SwLayoutFrm *pFrm )
@@ -1115,7 +1115,7 @@ bool GetFrmInPage( const SwCntntFrm *pCnt, SwWhichPage fnWhichPage,
}
}
- SwCntntNode *pCNd = (SwCntntNode*)pCnt->GetNode();
+ SwCntntNode *pCNd = const_cast<SwCntntNode*>(pCnt->GetNode());
pPam->GetPoint()->nNode = *pCNd;
sal_Int32 nIdx;
if( fnPosPage == GetFirstSub )
@@ -1447,7 +1447,7 @@ void SwPageFrm::GetCntntPosition( const Point &rPt, SwPosition &rPos ) const
if( !pAct->IsValid() )
{
// CntntFrm not formatted -> always on node-beginning
- SwCntntNode* pCNd = (SwCntntNode*)pAct->GetNode();
+ SwCntntNode* pCNd = const_cast<SwCntntNode*>(pAct->GetNode());
OSL_ENSURE( pCNd, "Where is my CntntNode?" );
rPos.nNode = *pCNd;
rPos.nContent.Assign( pCNd, 0 );
@@ -1923,8 +1923,8 @@ bool SwRootFrm::MakeTblCrsrs( SwTableCursor& rTblCrsr )
(bReadOnlyAvailable ||
!pCell->GetFmt()->GetProtect().IsCntntProtected()))
{
- SwTableBox* pInsBox = (SwTableBox*)
- static_cast<const SwCellFrm*>(pCell)->GetTabBox();
+ SwTableBox* pInsBox = const_cast<SwTableBox*>(
+ static_cast<const SwCellFrm*>(pCell)->GetTabBox());
aNew.insert( pInsBox );
}
if ( pCell->GetNext() )
diff --git a/sw/source/core/layout/wsfrm.cxx b/sw/source/core/layout/wsfrm.cxx
index ad5381e32efb..50290eed2a39 100644
--- a/sw/source/core/layout/wsfrm.cxx
+++ b/sw/source/core/layout/wsfrm.cxx
@@ -226,8 +226,8 @@ void SwFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem * pNew )
SfxItemIter aOIter( *static_cast<const SwAttrSetChg*>(pOld)->GetChgSet() );
while( true )
{
- _UpdateAttrFrm( (SfxPoolItem*)aOIter.GetCurItem(),
- (SfxPoolItem*)aNIter.GetCurItem(), nInvFlags );
+ _UpdateAttrFrm( aOIter.GetCurItem(),
+ aNIter.GetCurItem(), nInvFlags );
if( aNIter.IsAtEnd() )
break;
aNIter.NextItem();
@@ -1927,8 +1927,8 @@ void SwCntntFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem * pNew )
SwAttrSetChg aNewSet( *static_cast<const SwAttrSetChg*>(pNew) );
while( true )
{
- _UpdateAttr( (SfxPoolItem*)aOIter.GetCurItem(),
- (SfxPoolItem*)aNIter.GetCurItem(), nInvFlags,
+ _UpdateAttr( aOIter.GetCurItem(),
+ aNIter.GetCurItem(), nInvFlags,
&aOldSet, &aNewSet );
if( aNIter.IsAtEnd() )
break;
@@ -2930,7 +2930,7 @@ void SwLayoutFrm::Format( const SwBorderAttrs *pAttrs )
const sal_uInt16 nLeft = (sal_uInt16)pAttrs->CalcLeft( this );
const sal_uInt16 nUpper = pAttrs->CalcTop();
- const sal_uInt16 nRight = (sal_uInt16)const_cast<SwBorderAttrs*>(pAttrs)->CalcRight( this );
+ const sal_uInt16 nRight = (sal_uInt16)pAttrs->CalcRight( this );
const sal_uInt16 nLower = pAttrs->CalcBottom();
bool bVert = IsVertical() && !IsPageFrm();
SwRectFn fnRect = bVert ? ( IsVertLR() ? fnRectVertL2R : fnRectVert ) : fnRectHori;
diff --git a/sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx b/sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx
index 6e73a79d1d69..c037bf9de3c8 100644
--- a/sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx
+++ b/sw/source/core/objectpositioning/tocntntanchoredobjectposition.cxx
@@ -659,7 +659,7 @@ void SwToCntntAnchoredObjectPosition::CalcPosition()
pUpperOfOrientFrm->FindSctFrm()->IsAnFollow( pTmp->FindSctFrm() ) ) )
{
pUpperOfOrientFrm = pTmp;
- bMoveable = rAnchorTxtFrm.IsMoveable( (SwLayoutFrm*)pUpperOfOrientFrm );
+ bMoveable = rAnchorTxtFrm.IsMoveable( pUpperOfOrientFrm );
SWREFRESHFN( pUpperOfOrientFrm )
nAvail = (pUpperOfOrientFrm->Prt().*fnRect->fnGetHeight)();
}
@@ -915,7 +915,7 @@ void SwToCntntAnchoredObjectPosition::CalcPosition()
aRelPos.Y() = nTmpRelPosY;
pUpperOfOrientFrm = pNextLay;
SWREFRESHFN( pUpperOfOrientFrm )
- bMoveable = rAnchorTxtFrm.IsMoveable( (SwLayoutFrm*)pUpperOfOrientFrm );
+ bMoveable = rAnchorTxtFrm.IsMoveable( pUpperOfOrientFrm );
if( bVertX )
{
// --> OD 2009-08-31 #mongolianlayout#
diff --git a/sw/source/core/ole/ndole.cxx b/sw/source/core/ole/ndole.cxx
index e5680be458f8..f87ec851b212 100644
--- a/sw/source/core/ole/ndole.cxx
+++ b/sw/source/core/ole/ndole.cxx
@@ -445,7 +445,7 @@ SwCntntNode* SwOLENode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const
SwOLENode* pOLENd = pDoc->GetNodes().MakeOLENode( rIdx, aNewName, GetAspect(),
(SwGrfFmtColl*)pDoc->GetDfltGrfFmtColl(),
- (SwAttrSet*)GetpSwAttrSet() );
+ const_cast<SwAttrSet*>(GetpSwAttrSet()) );
pOLENd->SetChartTblName( GetChartTblName() );
pOLENd->SetTitle( GetTitle() );
@@ -748,7 +748,7 @@ void SwOLEObj::SetNode( SwOLENode* pNode )
else
xOLERef.AssignToContainer( &p->GetEmbeddedObjectContainer(), aObjName );
- ( (SwOLENode*)pOLENd )->CheckFileLink_Impl(); // for this notification nonconst access is required
+ const_cast<SwOLENode*>(pOLENd)->CheckFileLink_Impl(); // for this notification nonconst access is required
aName = aObjName;
}
@@ -806,7 +806,7 @@ const uno::Reference < embed::XEmbeddedObject > SwOLEObj::GetOleRef()
xObj->addStateChangeListener( pListener );
}
- ( (SwOLENode*)pOLENd )->CheckFileLink_Impl(); // for this notification nonconst access is required
+ const_cast<SwOLENode*>(pOLENd)->CheckFileLink_Impl(); // for this notification nonconst access is required
}
else if ( xOLERef->getCurrentState() == embed::EmbedStates::RUNNING )
{
diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx
index 77e003586590..ab6522ef4e1d 100644
--- a/sw/source/core/table/swtable.cxx
+++ b/sw/source/core/table/swtable.cxx
@@ -1473,7 +1473,7 @@ SwTableBox* SwTable::GetTblBox( sal_uLong nSttIdx )
while ( pFrm && !pFrm->IsCellFrm() )
pFrm = pFrm->GetUpper();
if ( pFrm )
- pRet = (SwTableBox*)static_cast<SwCellFrm*>(pFrm)->GetTabBox();
+ pRet = const_cast<SwTableBox*>(static_cast<SwCellFrm*>(pFrm)->GetTabBox());
}
// In case the layout doesn't exist yet or anything else goes wrong.
@@ -1943,7 +1943,7 @@ SwTable * SwTable::FindTable( SwFrmFmt const*const pFmt )
SwTableNode* SwTable::GetTableNode() const
{
return !GetTabSortBoxes().empty() ?
- (SwTableNode*)GetTabSortBoxes()[ 0 ]->GetSttNd()->FindTableNode() :
+ const_cast<SwTableNode*>(GetTabSortBoxes()[ 0 ]->GetSttNd()->FindTableNode()) :
pTableNode;
}
diff --git a/sw/source/core/text/EnhancedPDFExportHelper.cxx b/sw/source/core/text/EnhancedPDFExportHelper.cxx
index 054451073c9f..b16697d3cfbd 100644
--- a/sw/source/core/text/EnhancedPDFExportHelper.cxx
+++ b/sw/source/core/text/EnhancedPDFExportHelper.cxx
@@ -1339,7 +1339,7 @@ void SwTaggedPDFHelper::BeginInlineStructureElements()
case POR_TXT :
case POR_PARA :
{
- SwTxtNode* pNd = (SwTxtNode*)pFrm->GetTxtNode();
+ SwTxtNode* pNd = const_cast<SwTxtNode*>(pFrm->GetTxtNode());
SwTxtAttr const*const pInetFmtAttr =
pNd->GetTxtAttrAt(rInf.GetIdx(), RES_TXTATR_INETFMT);
@@ -1411,7 +1411,7 @@ void SwTaggedPDFHelper::BeginInlineStructureElements()
const SwTxtAttr* pHint = mpPorInfo->mrTxtPainter.GetAttr( nIdx );
if ( pHint && RES_TXTATR_FIELD == pHint->Which() )
{
- const SwField* pFld = (SwField*)pHint->GetFmtFld().GetField();
+ const SwField* pFld = pHint->GetFmtFld().GetField();
if ( RES_GETREFFLD == pFld->Which() )
{
nPDFType = vcl::PDFWriter::Link;
diff --git a/sw/source/core/text/atrstck.cxx b/sw/source/core/text/atrstck.cxx
index 8f1c9c1bae40..0bf4e711aadd 100644
--- a/sw/source/core/text/atrstck.cxx
+++ b/sw/source/core/text/atrstck.cxx
@@ -304,7 +304,7 @@ void SwAttrHandler::SwAttrStack::Insert( const SwTxtAttr& rAttr, const sal_uInt1
memmove( pArray + nPos + 1, pArray + nPos,
( nCount - nPos ) * sizeof(SwTxtAttr*)
);
- pArray[ nPos ] = (SwTxtAttr*)&rAttr;
+ pArray[ nPos ] = const_cast<SwTxtAttr*>(&rAttr);
nCount++;
}
diff --git a/sw/source/core/text/blink.cxx b/sw/source/core/text/blink.cxx
index d84b89d71bd2..52c720ae0e8f 100644
--- a/sw/source/core/text/blink.cxx
+++ b/sw/source/core/text/blink.cxx
@@ -69,7 +69,7 @@ IMPL_LINK_NOARG(SwBlink, Blinker)
{
const SwBlinkPortion* pTmp = &*it;
if( pTmp->GetRootFrm() &&
- const_cast<SwRootFrm*>(pTmp->GetRootFrm())->GetCurrShell() )
+ pTmp->GetRootFrm()->GetCurrShell() )
{
++it;
@@ -104,7 +104,7 @@ IMPL_LINK_NOARG(SwBlink, Blinker)
Rectangle aRefresh( aPos, Size( nWidth, nHeight ) );
aRefresh.Right() += ( aRefresh.Bottom()- aRefresh.Top() ) / 8;
- const_cast<SwRootFrm*>(pTmp->GetRootFrm())
+ pTmp->GetRootFrm()
->GetCurrShell()->InvalidateWindows( aRefresh );
}
else // Portions without a shell can be removed from the list
diff --git a/sw/source/core/text/frmcrsr.cxx b/sw/source/core/text/frmcrsr.cxx
index 4c23e0de1e2b..648c2cd3661b 100644
--- a/sw/source/core/text/frmcrsr.cxx
+++ b/sw/source/core/text/frmcrsr.cxx
@@ -189,7 +189,7 @@ bool SwTxtFrm::GetCharRect( SwRect& rOrig, const SwPosition &rPos,
// Optimisation: reading ahead saves us a GetAdjFrmAtPos
const bool bRightMargin = pCMS && ( MV_RIGHTMARGIN == pCMS->eState );
const bool bNoScroll = pCMS && pCMS->bNoScroll;
- SwTxtFrm *pFrm = GetAdjFrmAtPos( (SwTxtFrm*)this, rPos, bRightMargin,
+ SwTxtFrm *pFrm = GetAdjFrmAtPos( const_cast<SwTxtFrm*>(this), rPos, bRightMargin,
bNoScroll );
pFrm->GetFormatted();
const SwFrm* pTmpFrm = (SwFrm*)pFrm->GetUpper();
@@ -208,7 +208,7 @@ bool SwTxtFrm::GetCharRect( SwRect& rOrig, const SwPosition &rPos,
if ( pFrm->IsEmpty() || ! (pFrm->Prt().*fnRect->fnGetHeight)() )
{
Point aPnt1 = pFrm->Frm().Pos() + pFrm->Prt().Pos();
- SwTxtNode* pTxtNd = ((SwTxtFrm*)this)->GetTxtNode();
+ SwTxtNode* pTxtNd = const_cast<SwTxtFrm*>(this)->GetTxtNode();
short nFirstOffset;
pTxtNd->GetFirstLineOfsWithNum( nFirstOffset );
@@ -547,14 +547,14 @@ bool SwTxtFrm::_GetCrsrOfst(SwPosition* pPos, const Point& rPoint,
if( IsLocked() || IsHiddenNow() )
return false;
- ((SwTxtFrm*)this)->GetFormatted();
+ const_cast<SwTxtFrm*>(this)->GetFormatted();
Point aOldPoint( rPoint );
if ( IsVertical() )
{
SwitchVerticalToHorizontal( (Point&)rPoint );
- ((SwTxtFrm*)this)->SwapWidthAndHeight();
+ const_cast<SwTxtFrm*>(this)->SwapWidthAndHeight();
}
if ( IsRightToLeft() )
@@ -565,7 +565,7 @@ bool SwTxtFrm::_GetCrsrOfst(SwPosition* pPos, const Point& rPoint,
if ( IsEmpty() )
{
- SwTxtNode* pTxtNd = ((SwTxtFrm*)this)->GetTxtNode();
+ SwTxtNode* pTxtNd = const_cast<SwTxtFrm*>(this)->GetTxtNode();
pPos->nNode = *pTxtNd;
pPos->nContent.Assign( pTxtNd, 0 );
if( pCMS && pCMS->bFieldInfo )
@@ -577,8 +577,8 @@ bool SwTxtFrm::_GetCrsrOfst(SwPosition* pPos, const Point& rPoint,
}
else
{
- SwTxtSizeInfo aInf( (SwTxtFrm*)this );
- SwTxtCursor aLine( ((SwTxtFrm*)this), &aInf );
+ SwTxtSizeInfo aInf( const_cast<SwTxtFrm*>(this) );
+ SwTxtCursor aLine( const_cast<SwTxtFrm*>(this), &aInf );
// See comment in AdjustFrm()
SwTwips nMaxY = Frm().Top() + Prt().Top() + Prt().Height();
@@ -606,7 +606,7 @@ bool SwTxtFrm::_GetCrsrOfst(SwPosition* pPos, const Point& rPoint,
// In such cases, pPos must not be calculated.
if( COMPLETE_STRING != nOffset )
{
- SwTxtNode* pTxtNd = ((SwTxtFrm*)this)->GetTxtNode();
+ SwTxtNode* pTxtNd = const_cast<SwTxtFrm*>(this)->GetTxtNode();
pPos->nNode = *pTxtNd;
pPos->nContent.Assign( pTxtNd, nOffset );
if( pFillData )
@@ -634,7 +634,7 @@ bool SwTxtFrm::_GetCrsrOfst(SwPosition* pPos, const Point& rPoint,
{
if ( bChgFillData )
SwitchHorizontalToVertical( pFillData->Fill().aCrsr.Pos() );
- ((SwTxtFrm*)this)->SwapWidthAndHeight();
+ const_cast<SwTxtFrm*>(this)->SwapWidthAndHeight();
}
if ( IsRightToLeft() && bChgFillData )
@@ -668,9 +668,9 @@ bool SwTxtFrm::GetCrsrOfst(SwPosition* pPos, Point& rPoint,
bool SwTxtFrm::LeftMargin(SwPaM *pPam) const
{
if( &pPam->GetNode() != GetNode() )
- pPam->GetPoint()->nNode = *((SwTxtFrm*)this)->GetTxtNode();
+ pPam->GetPoint()->nNode = *const_cast<SwTxtFrm*>(this)->GetTxtNode();
- SwTxtFrm *pFrm = GetAdjFrmAtPos( (SwTxtFrm*)this, *pPam->GetPoint(),
+ SwTxtFrm *pFrm = GetAdjFrmAtPos( const_cast<SwTxtFrm*>(this), *pPam->GetPoint(),
SwTxtCursor::IsRightMargin() );
pFrm->GetFormatted();
sal_Int32 nIndx;
@@ -703,9 +703,9 @@ bool SwTxtFrm::LeftMargin(SwPaM *pPam) const
bool SwTxtFrm::RightMargin(SwPaM *pPam, bool bAPI) const
{
if( &pPam->GetNode() != GetNode() )
- pPam->GetPoint()->nNode = *((SwTxtFrm*)this)->GetTxtNode();
+ pPam->GetPoint()->nNode = *const_cast<SwTxtFrm*>(this)->GetTxtNode();
- SwTxtFrm *pFrm = GetAdjFrmAtPos( (SwTxtFrm*)this, *pPam->GetPoint(),
+ SwTxtFrm *pFrm = GetAdjFrmAtPos( const_cast<SwTxtFrm*>(this), *pPam->GetPoint(),
SwTxtCursor::IsRightMargin() );
pFrm->GetFormatted();
sal_Int32 nRightMargin;
@@ -764,7 +764,7 @@ bool SwTxtFrm::_UnitUp( SwPaM *pPam, const SwTwips nOffset,
return SwCntntFrm::UnitUp( pPam, nOffset, bSetInReadOnly );
}
- ((SwTxtFrm*)this)->GetFormatted();
+ const_cast<SwTxtFrm*>(this)->GetFormatted();
const sal_Int32 nPos = pPam->GetPoint()->nContent.GetIndex();
SwRect aCharBox;
@@ -774,10 +774,10 @@ bool SwTxtFrm::_UnitUp( SwPaM *pPam, const SwTwips nOffset,
do
{
if( nFormat != COMPLETE_STRING && !IsFollow() )
- sw_ChangeOffset( ((SwTxtFrm*)this), nFormat );
+ sw_ChangeOffset( const_cast<SwTxtFrm*>(this), nFormat );
- SwTxtSizeInfo aInf( (SwTxtFrm*)this );
- SwTxtCursor aLine( ((SwTxtFrm*)this), &aInf );
+ SwTxtSizeInfo aInf( const_cast<SwTxtFrm*>(this) );
+ SwTxtCursor aLine( const_cast<SwTxtFrm*>(this), &aInf );
// Optimize away flys with no flow and IsDummy()
if( nPos )
@@ -840,7 +840,7 @@ bool SwTxtFrm::_UnitUp( SwPaM *pPam, const SwTwips nOffset,
aSet.SetRight( true );
}
pPam->GetPoint()->nContent =
- SwIndex( ((SwTxtFrm*)this)->GetTxtNode(), nTmpOfst );
+ SwIndex( const_cast<SwTxtFrm*>(this)->GetTxtNode(), nTmpOfst );
return true;
}
@@ -1150,13 +1150,13 @@ bool SwTxtFrm::_UnitDown(SwPaM *pPam, const SwTwips nOffset,
// which is handled by the base class.
return SwCntntFrm::UnitDown( pPam, nOffset, bSetInReadOnly );
}
- ((SwTxtFrm*)this)->GetFormatted();
+ const_cast<SwTxtFrm*>(this)->GetFormatted();
const sal_Int32 nPos = pPam->GetPoint()->nContent.GetIndex();
SwRect aCharBox;
const SwCntntFrm *pTmpFollow = 0;
if ( IsVertical() )
- ((SwTxtFrm*)this)->SwapWidthAndHeight();
+ const_cast<SwTxtFrm*>(this)->SwapWidthAndHeight();
if ( !IsEmpty() && !IsHiddenNow() )
{
@@ -1164,11 +1164,11 @@ bool SwTxtFrm::_UnitDown(SwPaM *pPam, const SwTwips nOffset,
do
{
if( nFormat != COMPLETE_STRING && !IsFollow() &&
- !sw_ChangeOffset( ((SwTxtFrm*)this), nFormat ) )
+ !sw_ChangeOffset( const_cast<SwTxtFrm*>(this), nFormat ) )
break;
- SwTxtSizeInfo aInf( (SwTxtFrm*)this );
- SwTxtCursor aLine( ((SwTxtFrm*)this), &aInf );
+ SwTxtSizeInfo aInf( const_cast<SwTxtFrm*>(this) );
+ SwTxtCursor aLine( const_cast<SwTxtFrm*>(this), &aInf );
nFormat = aLine.GetEnd();
aLine.CharCrsrToLine( nPos );
@@ -1200,10 +1200,10 @@ bool SwTxtFrm::_UnitDown(SwPaM *pPam, const SwTwips nOffset,
if( nTmpOfst <= nStart && ! bFirstOfDouble )
nTmpOfst = nStart + 1;
pPam->GetPoint()->nContent =
- SwIndex( ((SwTxtFrm*)this)->GetTxtNode(), nTmpOfst );
+ SwIndex( const_cast<SwTxtFrm*>(this)->GetTxtNode(), nTmpOfst );
if ( IsVertical() )
- ((SwTxtFrm*)this)->SwapWidthAndHeight();
+ const_cast<SwTxtFrm*>(this)->SwapWidthAndHeight();
return true;
}
@@ -1222,7 +1222,7 @@ bool SwTxtFrm::_UnitDown(SwPaM *pPam, const SwTwips nOffset,
if( !pTmpFollow ) // Only protected ones left
{
if ( IsVertical() )
- ((SwTxtFrm*)this)->SwapWidthAndHeight();
+ const_cast<SwTxtFrm*>(this)->SwapWidthAndHeight();
return pTmp->SwCntntFrm::UnitDown( pPam, nOffset, bSetInReadOnly );
}
@@ -1251,7 +1251,7 @@ bool SwTxtFrm::_UnitDown(SwPaM *pPam, const SwTwips nOffset,
pTmpFollow = GetFollow();
if ( IsVertical() )
- ((SwTxtFrm*)this)->SwapWidthAndHeight();
+ const_cast<SwTxtFrm*>(this)->SwapWidthAndHeight();
// We take a shortcut for follows
if( pTmpFollow )
@@ -1273,7 +1273,7 @@ bool SwTxtFrm::UnitUp(SwPaM *pPam, const SwTwips nOffset,
* We calculate UnitUp for pFrm. pFrm is either a master (= this) or a
* follow (!= this).
*/
- const SwTxtFrm *pFrm = GetAdjFrmAtPos( (SwTxtFrm*)this, *(pPam->GetPoint()),
+ const SwTxtFrm *pFrm = GetAdjFrmAtPos( const_cast<SwTxtFrm*>(this), *(pPam->GetPoint()),
SwTxtCursor::IsRightMargin() );
const bool bRet = pFrm->_UnitUp( pPam, nOffset, bSetInReadOnly );
@@ -1285,7 +1285,7 @@ bool SwTxtFrm::UnitUp(SwPaM *pPam, const SwTwips nOffset,
bool SwTxtFrm::UnitDown(SwPaM *pPam, const SwTwips nOffset,
bool bSetInReadOnly ) const
{
- const SwTxtFrm *pFrm = GetAdjFrmAtPos((SwTxtFrm*)this, *(pPam->GetPoint()),
+ const SwTxtFrm *pFrm = GetAdjFrmAtPos(const_cast<SwTxtFrm*>(this), *(pPam->GetPoint()),
SwTxtCursor::IsRightMargin() );
const bool bRet = pFrm->_UnitDown( pPam, nOffset, bSetInReadOnly );
SwTxtCursor::SetRightMargin( false );
@@ -1360,7 +1360,7 @@ void SwTxtFrm::FillCrsrPos( SwFillData& rFill ) const
nDiff = -1;
else
pColl = &pColl->GetNextTxtFmtColl();
- SwAttrSet aSet( ((SwDoc*)GetTxtNode()->GetDoc())->GetAttrPool(), aTxtFmtCollSetRange );
+ SwAttrSet aSet( const_cast<SwDoc*>(GetTxtNode()->GetDoc())->GetAttrPool(), aTxtFmtCollSetRange );
const SwAttrSet* pSet = &pColl->GetAttrSet();
SwViewShell *pSh = getRootFrm()->GetCurrShell();
if( GetTxtNode()->HasSwAttrSet() )
@@ -1662,7 +1662,7 @@ void SwTxtFrm::FillCrsrPos( SwFillData& rFill ) const
rRect.Width( 1 );
}
}
- ((SwCrsrMoveState*)rFill.pCMS)->bFillRet = bFill;
+ const_cast<SwCrsrMoveState*>(rFill.pCMS)->bFillRet = bFill;
delete pFnt;
}
diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx
index fc181965030a..9ccdf722baa5 100644
--- a/sw/source/core/text/frmform.cxx
+++ b/sw/source/core/text/frmform.cxx
@@ -149,8 +149,8 @@ bool SwTxtFrm::_GetDropRect( SwRect &rRect ) const
SWAP_IF_NOT_SWAPPED( this )
OSL_ENSURE( HasPara(), "SwTxtFrm::_GetDropRect: try again next year." );
- SwTxtSizeInfo aInf( (SwTxtFrm*)this );
- SwTxtMargin aLine( (SwTxtFrm*)this, &aInf );
+ SwTxtSizeInfo aInf( const_cast<SwTxtFrm*>(this) );
+ SwTxtMargin aLine( const_cast<SwTxtFrm*>(this), &aInf );
if( aLine.GetDropLines() )
{
rRect.Top( aLine.Y() );
diff --git a/sw/source/core/text/frminf.cxx b/sw/source/core/text/frminf.cxx
index d66970ac38c7..530e52ad2c45 100644
--- a/sw/source/core/text/frminf.cxx
+++ b/sw/source/core/text/frminf.cxx
@@ -99,8 +99,8 @@ SwTwips SwTxtFrmInfo::GetLineStart( const SwTxtCursor &rLine ) const
// Where does the text start (without whitespace)? (relative in the Frame)
SwTwips SwTxtFrmInfo::GetLineStart() const
{
- SwTxtSizeInfo aInf( (SwTxtFrm*)pFrm );
- SwTxtCursor aLine( (SwTxtFrm*)pFrm, &aInf );
+ SwTxtSizeInfo aInf( const_cast<SwTxtFrm*>(pFrm) );
+ SwTxtCursor aLine( const_cast<SwTxtFrm*>(pFrm), &aInf );
return GetLineStart( aLine ) - pFrm->Frm().Left() - pFrm->Prt().Left();
}
@@ -110,8 +110,8 @@ SwTwips SwTxtFrmInfo::GetCharPos( sal_Int32 nChar, bool bCenter ) const
SWRECTFN( pFrm )
SwFrmSwapper aSwapper( pFrm, true );
- SwTxtSizeInfo aInf( (SwTxtFrm*)pFrm );
- SwTxtCursor aLine( (SwTxtFrm*)pFrm, &aInf );
+ SwTxtSizeInfo aInf( const_cast<SwTxtFrm*>(pFrm) );
+ SwTxtCursor aLine( const_cast<SwTxtFrm*>(pFrm), &aInf );
SwTwips nStt, nNext;
SwRect aRect;
@@ -160,7 +160,7 @@ SwPaM *AddPam( SwPaM *pPam, const SwTxtFrm* pTxtFrm,
}
SwIndex &rContent = pPam->GetPoint()->nContent;
- rContent.Assign( (SwTxtNode*)pTxtFrm->GetTxtNode(), nPos );
+ rContent.Assign( const_cast<SwTxtNode*>(pTxtFrm->GetTxtNode()), nPos );
pPam->SetMark();
rContent += nLen;
}
@@ -170,8 +170,8 @@ SwPaM *AddPam( SwPaM *pPam, const SwTxtFrm* pTxtFrm,
// Accumulates the whitespace at line start and end in the Pam
void SwTxtFrmInfo::GetSpaces( SwPaM &rPam, bool bWithLineBreak ) const
{
- SwTxtSizeInfo aInf( (SwTxtFrm*)pFrm );
- SwTxtMargin aLine( (SwTxtFrm*)pFrm, &aInf );
+ SwTxtSizeInfo aInf( const_cast<SwTxtFrm*>(pFrm) );
+ SwTxtMargin aLine( const_cast<SwTxtFrm*>(pFrm), &aInf );
SwPaM *pPam = &rPam;
bool bFirstLine = true;
do {
@@ -209,8 +209,8 @@ void SwTxtFrmInfo::GetSpaces( SwPaM &rPam, bool bWithLineBreak ) const
// Fonts: CharSet, SYMBOL und DONTKNOW
bool SwTxtFrmInfo::IsBullet( sal_Int32 nTxtStart ) const
{
- SwTxtSizeInfo aInf( (SwTxtFrm*)pFrm );
- SwTxtMargin aLine( (SwTxtFrm*)pFrm, &aInf );
+ SwTxtSizeInfo aInf( const_cast<SwTxtFrm*>(pFrm) );
+ SwTxtMargin aLine( const_cast<SwTxtFrm*>(pFrm), &aInf );
aInf.SetIdx( nTxtStart );
return aLine.IsSymbol( nTxtStart );
}
@@ -221,8 +221,8 @@ bool SwTxtFrmInfo::IsBullet( sal_Int32 nTxtStart ) const
// We do not want to be so picky and work with a tolerance of TOLERANCE twips.
SwTwips SwTxtFrmInfo::GetFirstIndent() const
{
- SwTxtSizeInfo aInf( (SwTxtFrm*)pFrm );
- SwTxtCursor aLine( (SwTxtFrm*)pFrm, &aInf );
+ SwTxtSizeInfo aInf( const_cast<SwTxtFrm*>(pFrm) );
+ SwTxtCursor aLine( const_cast<SwTxtFrm*>(pFrm), &aInf );
const SwTwips nFirst = GetLineStart( aLine );
const SwTwips TOLERANCE = 20;
@@ -254,15 +254,15 @@ SwTwips SwTxtFrmInfo::GetFirstIndent() const
sal_Int32 SwTxtFrmInfo::GetBigIndent( sal_Int32& rFndPos,
const SwTxtFrm *pNextFrm ) const
{
- SwTxtSizeInfo aInf( (SwTxtFrm*)pFrm );
- SwTxtCursor aLine( (SwTxtFrm*)pFrm, &aInf );
+ SwTxtSizeInfo aInf( const_cast<SwTxtFrm*>(pFrm) );
+ SwTxtCursor aLine( const_cast<SwTxtFrm*>(pFrm), &aInf );
SwTwips nNextIndent = 0;
if( pNextFrm )
{
// I'm a single line
- SwTxtSizeInfo aNxtInf( (SwTxtFrm*)pNextFrm );
- SwTxtCursor aNxtLine( (SwTxtFrm*)pNextFrm, &aNxtInf );
+ SwTxtSizeInfo aNxtInf( const_cast<SwTxtFrm*>(pNextFrm) );
+ SwTxtCursor aNxtLine( const_cast<SwTxtFrm*>(pNextFrm), &aNxtInf );
nNextIndent = GetLineStart( aNxtLine );
}
else
diff --git a/sw/source/core/text/frmpaint.cxx b/sw/source/core/text/frmpaint.cxx
index 4b480cd4f613..cea9731b7d78 100644
--- a/sw/source/core/text/frmpaint.cxx
+++ b/sw/source/core/text/frmpaint.cxx
@@ -316,16 +316,16 @@ void SwTxtFrm::PaintExtraData( const SwRect &rRect ) const
if( HasPara() )
{
- SwTxtFrmLocker aLock((SwTxtFrm*)this);
+ SwTxtFrmLocker aLock(const_cast<SwTxtFrm*>(this));
- SwTxtLineAccess aAccess( (SwTxtFrm*)this );
+ SwTxtLineAccess aAccess( this );
aAccess.GetPara();
- SwTxtPaintInfo aInf( (SwTxtFrm*)this, rRect );
+ SwTxtPaintInfo aInf( const_cast<SwTxtFrm*>(this), rRect );
aLayoutModeModifier.Modify( false );
- SwTxtPainter aLine( (SwTxtFrm*)this, &aInf );
+ SwTxtPainter aLine( const_cast<SwTxtFrm*>(this), &aInf );
bool bNoDummy = !aLine.GetNext(); // Only one empty line!
while( aLine.Y() + aLine.GetLineHeight() <= rRect.Top() )
@@ -605,7 +605,7 @@ void SwTxtFrm::Paint(SwRect const& rRect, SwPrintData const*const) const
// #i29062# pass info that we are currently
// painting.
- ((SwTxtFrm*)this)->GetFormatted( true );
+ const_cast<SwTxtFrm*>(this)->GetFormatted( true );
if( IsEmpty() )
{
PaintEmpty( rRect, false );
@@ -620,7 +620,7 @@ void SwTxtFrm::Paint(SwRect const& rRect, SwPrintData const*const) const
// We don't want to be interrupted while painting.
// Do that after thr Format()!
- SwTxtFrmLocker aLock((SwTxtFrm*)this);
+ SwTxtFrmLocker aLock(const_cast<SwTxtFrm*>(this));
// We only paint the part of the TxtFrm which changed, is within the
// range and was requested to paint.
@@ -628,7 +628,7 @@ void SwTxtFrm::Paint(SwRect const& rRect, SwPrintData const*const) const
// rRepaint is set. Indeed, we cannot avoid this problem from a formal
// perspective. Luckily we can assume rRepaint to be empty when we need
// paint the while Frm.
- SwTxtLineAccess aAccess( (SwTxtFrm*)this );
+ SwTxtLineAccess aAccess( this );
SwParaPortion *pPara = aAccess.GetPara();
SwRepaint &rRepaint = pPara->GetRepaint();
@@ -656,13 +656,13 @@ void SwTxtFrm::Paint(SwRect const& rRect, SwPrintData const*const) const
if ( IsRightToLeft() )
SwitchRTLtoLTR( (SwRect&)rRect );
- SwTxtPaintInfo aInf( (SwTxtFrm*)this, rRect );
- aInf.SetWrongList( ( (SwTxtNode*)GetTxtNode() )->GetWrong() );
- aInf.SetGrammarCheckList( ( (SwTxtNode*)GetTxtNode() )->GetGrammarCheck() );
- aInf.SetSmartTags( ( (SwTxtNode*)GetTxtNode() )->GetSmartTags() );
+ SwTxtPaintInfo aInf( const_cast<SwTxtFrm*>(this), rRect );
+ aInf.SetWrongList( const_cast<SwTxtNode*>(GetTxtNode())->GetWrong() );
+ aInf.SetGrammarCheckList( const_cast<SwTxtNode*>(GetTxtNode())->GetGrammarCheck() );
+ aInf.SetSmartTags( const_cast<SwTxtNode*>(GetTxtNode())->GetSmartTags() );
aInf.GetTxtFly().SetTopRule();
- SwTxtPainter aLine( (SwTxtFrm*)this, &aInf );
+ SwTxtPainter aLine( const_cast<SwTxtFrm*>(this), &aInf );
// Optimization: if no free flying Frm overlaps into our line, the
// SwTxtFly just switches off
aInf.GetTxtFly().Relax();
diff --git a/sw/source/core/text/inftxt.cxx b/sw/source/core/text/inftxt.cxx
index b763351695d1..6a622e44352d 100644
--- a/sw/source/core/text/inftxt.cxx
+++ b/sw/source/core/text/inftxt.cxx
@@ -193,12 +193,12 @@ inline sal_Int32 GetMinLen( const SwTxtSizeInfo &rInf )
SwTxtSizeInfo::SwTxtSizeInfo( const SwTxtSizeInfo &rNew )
: SwTxtInfo( rNew ),
- m_pKanaComp(const_cast<SwTxtSizeInfo&>(rNew).GetpKanaComp()),
+ m_pKanaComp(rNew.GetpKanaComp()),
m_pVsh(const_cast<SwTxtSizeInfo&>(rNew).GetVsh()),
m_pOut(const_cast<SwTxtSizeInfo&>(rNew).GetOut()),
m_pRef(const_cast<SwTxtSizeInfo&>(rNew).GetRefDev()),
m_pFnt(const_cast<SwTxtSizeInfo&>(rNew).GetFont()),
- m_pUnderFnt(const_cast<SwTxtSizeInfo&>(rNew).GetUnderFnt()),
+ m_pUnderFnt(rNew.GetUnderFnt()),
m_pFrm(rNew.m_pFrm),
m_pOpt(&rNew.GetOpt()),
m_pTxt(&rNew.GetTxt()),
@@ -304,12 +304,12 @@ void SwTxtSizeInfo::CtorInitTxtSizeInfo( SwTxtFrm *pFrame, SwFont *pNewFnt,
SwTxtSizeInfo::SwTxtSizeInfo( const SwTxtSizeInfo &rNew, const OUString* pTxt,
const sal_Int32 nIndex, const sal_Int32 nLength )
: SwTxtInfo( rNew ),
- m_pKanaComp(const_cast<SwTxtSizeInfo&>(rNew).GetpKanaComp()),
+ m_pKanaComp(rNew.GetpKanaComp()),
m_pVsh(const_cast<SwTxtSizeInfo&>(rNew).GetVsh()),
m_pOut(const_cast<SwTxtSizeInfo&>(rNew).GetOut()),
m_pRef(const_cast<SwTxtSizeInfo&>(rNew).GetRefDev()),
m_pFnt(const_cast<SwTxtSizeInfo&>(rNew).GetFont()),
- m_pUnderFnt(const_cast<SwTxtSizeInfo&>(rNew).GetUnderFnt()),
+ m_pUnderFnt(rNew.GetUnderFnt()),
m_pFrm( rNew.m_pFrm ),
m_pOpt(&rNew.GetOpt()),
m_pTxt(pTxt),
@@ -373,7 +373,7 @@ SwPosSize SwTxtSizeInfo::GetTxtSize( OutputDevice* pOutDev,
SwPosSize SwTxtSizeInfo::GetTxtSize() const
{
const SwScriptInfo& rSI =
- ( (SwParaPortion*)GetParaPortion() )->GetScriptInfo();
+ const_cast<SwParaPortion*>(GetParaPortion())->GetScriptInfo();
// in some cases, compression is not allowed or suppressed for
// performance reasons
@@ -410,7 +410,7 @@ sal_Int32 SwTxtSizeInfo::GetTxtBreak( const long nLineWidth,
const sal_uInt16 nComp ) const
{
const SwScriptInfo& rScriptInfo =
- ( (SwParaPortion*)GetParaPortion() )->GetScriptInfo();
+ const_cast<SwParaPortion*>(GetParaPortion())->GetScriptInfo();
OSL_ENSURE( m_pRef == m_pOut, "GetTxtBreak is supposed to use the RefDev" );
SwDrawTextInfo aDrawInf( m_pVsh, *m_pOut, &rScriptInfo,
@@ -430,7 +430,7 @@ sal_Int32 SwTxtSizeInfo::GetTxtBreak( const long nLineWidth,
sal_Int32& rExtraCharPos ) const
{
const SwScriptInfo& rScriptInfo =
- ( (SwParaPortion*)GetParaPortion() )->GetScriptInfo();
+ const_cast<SwParaPortion*>(GetParaPortion())->GetScriptInfo();
OSL_ENSURE( m_pRef == m_pOut, "GetTxtBreak is supposed to use the RefDev" );
SwDrawTextInfo aDrawInf( m_pVsh, *m_pOut, &rScriptInfo,
@@ -765,7 +765,7 @@ void SwTxtPaintInfo::CalcRect( const SwLinePortion& rPor,
if( aRect.HasArea() && pIntersect )
{
- ::SwAlignRect( aRect, (SwViewShell*)GetVsh() );
+ ::SwAlignRect( aRect, GetVsh() );
if ( GetOut()->IsClipRegion() )
{
@@ -891,7 +891,7 @@ static void lcl_DrawSpecial( const SwTxtPaintInfo& rInf, const SwLinePortion& rP
const_cast<SwLinePortion&>(rPor).Width( (sal_uInt16)aFontSize.Width() );
rInf.DrawText( aTmp, rPor );
const_cast<SwLinePortion&>(rPor).Width( nOldWidth );
- const_cast<SwTxtPaintInfo&>(rInf).SetFont( (SwFont*)pOldFnt );
+ const_cast<SwTxtPaintInfo&>(rInf).SetFont( const_cast<SwFont*>(pOldFnt) );
const_cast<SwTxtPaintInfo&>(rInf).SetPos( aOldPos );
}
@@ -1036,7 +1036,7 @@ void SwTxtPaintInfo::DrawPostIts( const SwLinePortion&, bool bScript ) const
GetTxtFrm()->SwitchHorizontalToVertical( aTmpRect );
const Rectangle aRect( aTmpRect.SVRect() );
- m_pOpt->PaintPostIts( (OutputDevice*)GetOut(), aRect, bScript );
+ m_pOpt->PaintPostIts( const_cast<OutputDevice*>(GetOut()), aRect, bScript );
}
}
@@ -1049,7 +1049,7 @@ void SwTxtPaintInfo::DrawCheckBox(const SwFieldFormCheckboxPortion &rPor, bool b
if (OnWin() && SwViewOption::IsFieldShadings() &&
!GetOpt().IsPagePreview())
{
- OutputDevice* pOut = (OutputDevice*)GetOut();
+ OutputDevice* pOut = const_cast<OutputDevice*>(GetOut());
pOut->Push( PushFlags::LINECOLOR | PushFlags::FILLCOLOR );
pOut->SetFillColor( SwViewOption::GetFieldShadingsColor() );
pOut->SetLineColor();
@@ -1080,7 +1080,7 @@ void SwTxtPaintInfo::DrawBackground( const SwLinePortion &rPor ) const
if ( aIntersect.HasArea() )
{
- OutputDevice* pOut = (OutputDevice*)GetOut();
+ OutputDevice* pOut = const_cast<OutputDevice*>(GetOut());
pOut->Push( PushFlags::LINECOLOR | PushFlags::FILLCOLOR );
// For dark background we do not want to have a filled rectangle
@@ -1131,7 +1131,7 @@ void SwTxtPaintInfo::DrawBackBrush( const SwLinePortion &rPor ) const
SwViewOption::IsFieldShadings() &&
!GetOpt().IsPagePreview())
{
- OutputDevice* pOutDev = (OutputDevice*)GetOut();
+ OutputDevice* pOutDev = const_cast<OutputDevice*>(GetOut());
pOutDev->Push( PushFlags::LINECOLOR | PushFlags::FILLCOLOR );
pOutDev->SetFillColor( SwViewOption::GetFieldShadingsColor() );
pOutDev->SetLineColor( );
@@ -1146,7 +1146,7 @@ void SwTxtPaintInfo::DrawBackBrush( const SwLinePortion &rPor ) const
if ( aIntersect.HasArea() )
{
- OutputDevice* pTmpOut = (OutputDevice*)GetOut();
+ OutputDevice* pTmpOut = const_cast<OutputDevice*>(GetOut());
// #i16816# tagged pdf support
SwTaggedPDFHelper aTaggedPDFHelper( 0, 0, 0, *pTmpOut );
@@ -1245,7 +1245,7 @@ void SwTxtPaintInfo::_NotifyURL( const SwLinePortion &rPor ) const
if( aIntersect.HasArea() )
{
- SwTxtNode *pNd = (SwTxtNode*)GetTxtFrm()->GetTxtNode();
+ SwTxtNode *pNd = const_cast<SwTxtNode*>(GetTxtFrm()->GetTxtNode());
SwTxtAttr *const pAttr =
pNd->GetTxtAttrAt(GetIdx(), RES_TXTATR_INETFMT);
if( pAttr )
@@ -1638,7 +1638,7 @@ SwTxtSlot::SwTxtSlot(
// The text is replaced ...
if( bOn )
{
- pInf = (SwTxtSizeInfo*)pNew;
+ pInf = const_cast<SwTxtSizeInfo*>(pNew);
nIdx = pInf->GetIdx();
nLen = pInf->GetLen();
pOldTxt = &(pInf->GetTxt());
diff --git a/sw/source/core/text/inftxt.hxx b/sw/source/core/text/inftxt.hxx
index 34cb9400472f..a0b627c2bf48 100644
--- a/sw/source/core/text/inftxt.hxx
+++ b/sw/source/core/text/inftxt.hxx
@@ -91,7 +91,7 @@ public:
inline const SvxLineSpacingItem *GetLineSpacing() const { return pSpace; }
inline sal_uInt16 GetDefTabStop() const { return nDefTabStop; }
inline void SetDefTabStop( sal_uInt16 nNew ) const
- { ( (SwLineInfo*)this )->nDefTabStop = nNew; }
+ { const_cast<SwLineInfo*>(this)->nDefTabStop = nNew; }
// vertical alignment
inline sal_uInt16 GetVertAlign() const { return nVertAlign; }
diff --git a/sw/source/core/text/itratr.cxx b/sw/source/core/text/itratr.cxx
index b16996f91794..38dc69ed5887 100644
--- a/sw/source/core/text/itratr.cxx
+++ b/sw/source/core/text/itratr.cxx
@@ -411,7 +411,7 @@ static bool lcl_MinMaxString( SwMinMaxArgs& rArg, SwFont* pFnt, const OUString &
bool SwTxtNode::IsSymbol( const sal_Int32 nBegin ) const
{
SwScriptInfo aScriptInfo;
- SwAttrIter aIter( *(SwTxtNode*)this, aScriptInfo );
+ SwAttrIter aIter( *const_cast<SwTxtNode*>(this), aScriptInfo );
aIter.Seek( nBegin );
return aIter.GetFnt()->IsSymbol(
const_cast<SwViewShell *>(getIDocumentLayoutAccess()->GetCurrentViewShell()) );
@@ -588,7 +588,7 @@ void SwTxtNode::GetMinMaxSize( sal_uLong nIndex, sal_uLong& rMin, sal_uLong &rMa
aNodeArgs.nRightDiff = 0;
if( nIndex )
{
- SwFrmFmts* pTmp = (SwFrmFmts*)GetDoc()->GetSpzFrmFmts();
+ SwFrmFmts* pTmp = const_cast<SwFrmFmts*>(GetDoc()->GetSpzFrmFmts());
if( pTmp )
{
aNodeArgs.nIndx = nIndex;
@@ -609,7 +609,7 @@ void SwTxtNode::GetMinMaxSize( sal_uLong nIndex, sal_uLong& rMin, sal_uLong &rMa
aNodeArgs.nMaxWidth -= aNodeArgs.nRightRest;
SwScriptInfo aScriptInfo;
- SwAttrIter aIter( *(SwTxtNode*)this, aScriptInfo );
+ SwAttrIter aIter( *const_cast<SwTxtNode*>(this), aScriptInfo );
sal_Int32 nIdx = 0;
aIter.SeekAndChgAttrIter( nIdx, pOut );
sal_Int32 nLen = m_Text.getLength();
@@ -665,7 +665,7 @@ void SwTxtNode::GetMinMaxSize( sal_uLong nIndex, sal_uLong& rMin, sal_uLong &rMa
case CHAR_HARDHYPHEN:
{
OUString sTmp( cChar );
- SwDrawTextInfo aDrawInf( const_cast<SwViewShell *>(getIDocumentLayoutAccess()->GetCurrentViewShell()),
+ SwDrawTextInfo aDrawInf( getIDocumentLayoutAccess()->GetCurrentViewShell(),
*pOut, 0, sTmp, 0, 1, 0, false );
nAktWidth = aIter.GetFnt()->_GetTxtSize( aDrawInf ).Width();
aArg.nWordWidth += nAktWidth;
@@ -739,7 +739,7 @@ void SwTxtNode::GetMinMaxSize( sal_uLong nIndex, sal_uLong& rMin, sal_uLong &rMa
case RES_TXTATR_FIELD :
case RES_TXTATR_ANNOTATION :
{
- SwField *pFld = (SwField*)pHint->GetFmtFld().GetField();
+ SwField *pFld = const_cast<SwField*>(pHint->GetFmtFld().GetField());
const OUString aTxt = pFld->ExpandField(true);
if( lcl_MinMaxString( aArg, aIter.GetFnt(), aTxt, 0,
aTxt.getLength() ) )
@@ -813,7 +813,7 @@ sal_uInt16 SwTxtNode::GetScalingOfSelectedText( sal_Int32 nStt, sal_Int32 nEnd )
return 100;
SwScriptInfo aScriptInfo;
- SwAttrIter aIter( *(SwTxtNode*)this, aScriptInfo );
+ SwAttrIter aIter( *const_cast<SwTxtNode*>(this), aScriptInfo );
aIter.SeekAndChgAttrIter( nStt, pOut );
Boundary aBound =
@@ -839,7 +839,7 @@ sal_uInt16 SwTxtNode::GetScalingOfSelectedText( sal_Int32 nStt, sal_Int32 nEnd )
}
SwScriptInfo aScriptInfo;
- SwAttrIter aIter( *(SwTxtNode*)this, aScriptInfo );
+ SwAttrIter aIter( *const_cast<SwTxtNode*>(this), aScriptInfo );
// We do not want scaling attributes to be considered during this
// calculation. For this, we push a temporary scaling attribute with
@@ -937,7 +937,7 @@ sal_uInt16 SwTxtNode::GetScalingOfSelectedText( sal_Int32 nStt, sal_Int32 nEnd )
case RES_TXTATR_FIELD :
case RES_TXTATR_ANNOTATION :
{
- SwField *pFld = (SwField*)pHint->GetFmtFld().GetField();
+ SwField *pFld = const_cast<SwField*>(pHint->GetFmtFld().GetField());
OUString const aTxt = pFld->ExpandField(true);
SwDrawTextInfo aDrawInf( pSh, *pOut, 0, aTxt, 0, aTxt.getLength() );
diff --git a/sw/source/core/text/itrcrsr.cxx b/sw/source/core/text/itrcrsr.cxx
index 501269c8e33f..dd149c7ad225 100644
--- a/sw/source/core/text/itrcrsr.cxx
+++ b/sw/source/core/text/itrcrsr.cxx
@@ -1599,7 +1599,7 @@ sal_Int32 SwTxtCursor::GetCrsrOfst( SwPosition *pPos, const Point &rPoint,
SwFontSave aSave( aSizeInf, pPor->IsDropPortion() ?
static_cast<SwDropPortion*>(pPor)->GetFnt() : NULL );
- SwParaPortion* pPara = (SwParaPortion*)GetInfo().GetParaPortion();
+ SwParaPortion* pPara = const_cast<SwParaPortion*>(GetInfo().GetParaPortion());
OSL_ENSURE( pPara, "No paragraph!" );
SwDrawTextInfo aDrawInf( aSizeInf.GetVsh(),
diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx
index 6149fd2c6ec5..505e017ebe7a 100644
--- a/sw/source/core/text/itrform2.cxx
+++ b/sw/source/core/text/itrform2.cxx
@@ -1877,10 +1877,10 @@ void SwTxtFormatter::FeedInf( SwTxtFormatInfo &rInf ) const
rInf.RealWidth( sal_uInt16(rInf.Right() - GetLeftMargin()) );
rInf.Width( rInf.RealWidth() );
- if( ((SwTxtFormatter*)this)->GetRedln() )
+ if( const_cast<SwTxtFormatter*>(this)->GetRedln() )
{
- ((SwTxtFormatter*)this)->GetRedln()->Clear( ((SwTxtFormatter*)this)->GetFnt() );
- ((SwTxtFormatter*)this)->GetRedln()->Reset();
+ const_cast<SwTxtFormatter*>(this)->GetRedln()->Clear( const_cast<SwTxtFormatter*>(this)->GetFnt() );
+ const_cast<SwTxtFormatter*>(this)->GetRedln()->Reset();
}
}
@@ -2124,7 +2124,7 @@ void SwTxtFormatter::UpdatePos( SwLineLayout *pCurrent, Point aStart,
aSt.Y() += pLay->Height();
pLay = pLay->GetNext();
} while ( pLay );
- ((SwTxtFormatter*)this)->pMulti = NULL;
+ const_cast<SwTxtFormatter*>(this)->pMulti = NULL;
}
pPos->Move( aTmpInf );
pPos = pPos->GetPortion();
diff --git a/sw/source/core/text/itrtxt.cxx b/sw/source/core/text/itrtxt.cxx
index cd9294735083..920b22f66035 100644
--- a/sw/source/core/text/itrtxt.cxx
+++ b/sw/source/core/text/itrtxt.cxx
@@ -138,7 +138,7 @@ const SwLineLayout *SwTxtIter::GetNextLine() const
{
pNext = pNext->GetNext();
}
- return (SwLineLayout*)pNext;
+ return pNext;
}
const SwLineLayout *SwTxtIter::GetPrevLine()
@@ -164,7 +164,7 @@ const SwLineLayout *SwTxtIter::GetPrevLine()
}
// Wenn sich nichts getan hat, dann gibt es nur noch Dummys
- return (SwLineLayout*)pLay;
+ return pLay;
}
const SwLineLayout *SwTxtIter::PrevLine()
@@ -179,7 +179,7 @@ const SwLineLayout *SwTxtIter::PrevLine()
pLast = pMyPrev;
pMyPrev = Prev();
}
- return (SwLineLayout*)(pMyPrev ? pMyPrev : pLast);
+ return pMyPrev ? pMyPrev : pLast;
}
void SwTxtIter::Bottom()
diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx
index 815b5724b9d8..ae446176bf96 100644
--- a/sw/source/core/text/porfld.cxx
+++ b/sw/source/core/text/porfld.cxx
@@ -119,7 +119,7 @@ SwFldPortion::~SwFldPortion()
sal_uInt16 SwFldPortion::GetViewWidth( const SwTxtSizeInfo &rInf ) const
{
// even though this is const, nViewWidth should be computed at the very end:
- SwFldPortion* pThis = (SwFldPortion*)this;
+ SwFldPortion* pThis = const_cast<SwFldPortion*>(this);
if( !Width() && rInf.OnWin() && !rInf.GetOpt().IsPagePreview() &&
!rInf.GetOpt().IsReadonly() && SwViewOption::IsFieldShadings() )
{
@@ -158,7 +158,7 @@ SwFldSlot::SwFldSlot( const SwTxtFormatInfo* pNew, const SwFldPortion *pPor )
// The text will be replaced ...
if( bOn )
{
- pInf = (SwTxtFormatInfo*)pNew;
+ pInf = const_cast<SwTxtFormatInfo*>(pNew);
nIdx = pInf->GetIdx();
nLen = pInf->GetLen();
pOldTxt = &(pInf->GetTxt());
@@ -792,7 +792,7 @@ SwGrfNumPortion::~SwGrfNumPortion()
{
if ( IsAnimated() )
{
- Graphic* pGraph = ( (Graphic*) pBrush->GetGraphic() );
+ Graphic* pGraph = const_cast<Graphic*>(pBrush->GetGraphic());
if (pGraph)
pGraph->StopAnimation( 0, nId );
}
@@ -803,7 +803,7 @@ void SwGrfNumPortion::StopAnimation( OutputDevice* pOut )
{
if ( IsAnimated() )
{
- Graphic* pGraph = ( (Graphic*) pBrush->GetGraphic() );
+ Graphic* pGraph = const_cast<Graphic*>(pBrush->GetGraphic());
if (pGraph)
pGraph->StopAnimation( pOut, nId );
}
@@ -940,7 +940,7 @@ void SwGrfNumPortion::Paint( const SwTxtPaintInfo &rInf ) const
if( OUTDEV_VIRDEV == rInf.GetOut()->GetOutDevType() &&
pViewShell && pViewShell->GetWin() )
{
- Graphic* pGraph = (Graphic*)pBrush->GetGraphic();
+ Graphic* pGraph = const_cast<Graphic*>(pBrush->GetGraphic());
if (pGraph)
pGraph->StopAnimation(0,nId);
rInf.GetTxtFrm()->getRootFrm()->GetCurrShell()->InvalidateWindows( aTmp );
@@ -952,11 +952,11 @@ void SwGrfNumPortion::Paint( const SwTxtPaintInfo &rInf ) const
// #i9684# Stop animation during printing/pdf export.
pViewShell->GetWin() )
{
- Graphic* pGraph = (Graphic*)pBrush->GetGraphic();
+ Graphic* pGraph = const_cast<Graphic*>(pBrush->GetGraphic());
if (pGraph)
{
pGraph->StartAnimation(
- (OutputDevice*)rInf.GetOut(), aPos, aSize, nId );
+ const_cast<OutputDevice*>(rInf.GetOut()), aPos, aSize, nId );
}
}
@@ -967,7 +967,7 @@ void SwGrfNumPortion::Paint( const SwTxtPaintInfo &rInf ) const
if( bDraw )
{
- Graphic* pGraph = (Graphic*)pBrush->GetGraphic();
+ Graphic* pGraph = const_cast<Graphic*>(pBrush->GetGraphic());
if (pGraph)
pGraph->StopAnimation( 0, nId );
}
@@ -989,7 +989,7 @@ void SwGrfNumPortion::Paint( const SwTxtPaintInfo &rInf ) const
if( bDraw && aTmp.HasArea() )
{
- DrawGraphic( pBrush, (OutputDevice*)rInf.GetOut(),
+ DrawGraphic( pBrush, const_cast<OutputDevice*>(rInf.GetOut()),
aTmp, aRepaint, bReplace ? GRFNUM_REPLACE : GRFNUM_YES );
}
}
diff --git a/sw/source/core/text/porlay.cxx b/sw/source/core/text/porlay.cxx
index 2213428416bd..442e22e2a16f 100644
--- a/sw/source/core/text/porlay.cxx
+++ b/sw/source/core/text/porlay.cxx
@@ -1936,7 +1936,7 @@ SwScriptInfo* SwScriptInfo::GetScriptInfo( const SwTxtNode& rTNd,
for( SwTxtFrm* pLast = aIter.First(); pLast; pLast = aIter.Next() )
{
- pScriptInfo = (SwScriptInfo*)pLast->GetScriptInfo();
+ pScriptInfo = const_cast<SwScriptInfo*>(pLast->GetScriptInfo());
if ( pScriptInfo )
{
if ( bAllowInvalid || COMPLETE_STRING == pScriptInfo->GetInvalidityA() )
diff --git a/sw/source/core/text/porlin.cxx b/sw/source/core/text/porlin.cxx
index 1e1719de7cab..3215844dbd0a 100644
--- a/sw/source/core/text/porlin.cxx
+++ b/sw/source/core/text/porlin.cxx
@@ -133,7 +133,7 @@ void SwLinePortion::PrePaint( const SwTxtPaintInfo& rInf,
break;
}
- SwLinePortion *pThis = (SwLinePortion*)this;
+ SwLinePortion *pThis = const_cast<SwLinePortion*>(this);
pThis->Width( nViewWidth );
Paint( aInf );
pThis->Width(0);
@@ -212,7 +212,7 @@ SwLinePortion *SwLinePortion::Cut( SwLinePortion *pVictim )
SwLinePortion *SwLinePortion::FindPrevPortion( const SwLinePortion *pRoot )
{
OSL_ENSURE( pRoot != this, "SwLinePortion::FindPrevPortion(): invalid root" );
- SwLinePortion *pPos = (SwLinePortion*)pRoot;
+ SwLinePortion *pPos = const_cast<SwLinePortion*>(pRoot);
while( pPos->GetPortion() && pPos->GetPortion() != this )
{
pPos = pPos->GetPortion();
diff --git a/sw/source/core/text/porref.cxx b/sw/source/core/text/porref.cxx
index de74b2457db8..1f17acc7acbe 100644
--- a/sw/source/core/text/porref.cxx
+++ b/sw/source/core/text/porref.cxx
@@ -44,7 +44,7 @@ sal_uInt16 SwIsoRefPortion::GetViewWidth( const SwTxtSizeInfo &rInf ) const
{
// Although we are const, nViewWidth should be calculated in the last
// moment possible
- SwIsoRefPortion* pThis = (SwIsoRefPortion*)this;
+ SwIsoRefPortion* pThis = const_cast<SwIsoRefPortion*>(this);
if( !Width() && rInf.OnWin() && SwViewOption::IsFieldShadings() &&
!rInf.GetOpt().IsReadonly() && !rInf.GetOpt().IsPagePreview() )
{
diff --git a/sw/source/core/text/porrst.cxx b/sw/source/core/text/porrst.cxx
index e2e92f97353d..d9d4fb922cc1 100644
--- a/sw/source/core/text/porrst.cxx
+++ b/sw/source/core/text/porrst.cxx
@@ -155,7 +155,7 @@ void SwKernPortion::Paint( const SwTxtPaintInfo &rInf ) const
SwRect aClipRect;
rInf.CalcRect( *this, &aClipRect, 0 );
- SwSaveClip aClip( (OutputDevice*)rInf.GetOut() );
+ SwSaveClip aClip( const_cast<OutputDevice*>(rInf.GetOut()) );
aClip.ChgClip( aClipRect, 0 );
rInf.DrawText( aTxtDouble, *this, 0, 2, true );
}
@@ -459,7 +459,7 @@ void SwHiddenTextPortion::Paint( const SwTxtPaintInfo & rInf) const
{
(void)rInf;
#ifdef DBG_UTIL
- OutputDevice* pOut = (OutputDevice*)rInf.GetOut();
+ OutputDevice* pOut = const_cast<OutputDevice*>(rInf.GetOut());
Color aCol( SwViewOption::GetFieldShadingsColor() );
Color aOldColor( pOut->GetFillColor() );
pOut->SetFillColor( aCol );
diff --git a/sw/source/core/text/portox.cxx b/sw/source/core/text/portox.cxx
index 4882e1c50174..79873dec6c17 100644
--- a/sw/source/core/text/portox.cxx
+++ b/sw/source/core/text/portox.cxx
@@ -44,7 +44,7 @@ sal_uInt16 SwIsoToxPortion::GetViewWidth( const SwTxtSizeInfo &rInf ) const
{
// Although we are const, nViewWidth should be calculated in the last
// moment possible
- SwIsoToxPortion* pThis = (SwIsoToxPortion*)this;
+ SwIsoToxPortion* pThis = const_cast<SwIsoToxPortion*>(this);
// nViewWidth need to be calculated
if( !Width() && rInf.OnWin() &&
!rInf.GetOpt().IsPagePreview() &&
diff --git a/sw/source/core/text/txtcache.cxx b/sw/source/core/text/txtcache.cxx
index 4fd050f61ef9..972b68e763a3 100644
--- a/sw/source/core/text/txtcache.cxx
+++ b/sw/source/core/text/txtcache.cxx
@@ -72,7 +72,7 @@ bool SwTxtFrm::_HasPara() const
return true;
}
else
- ((SwTxtFrm*)this)->nCacheIdx = USHRT_MAX;
+ const_cast<SwTxtFrm*>(this)->nCacheIdx = USHRT_MAX;
return false;
}
diff --git a/sw/source/core/text/txtdrop.cxx b/sw/source/core/text/txtdrop.cxx
index ba8a3e367328..bd06251d064f 100644
--- a/sw/source/core/text/txtdrop.cxx
+++ b/sw/source/core/text/txtdrop.cxx
@@ -323,7 +323,7 @@ void SwDropPortion::PaintDrop( const SwTxtPaintInfo &rInf ) const
aClipRect = SwRect( aOutPos, SvLSize() );
aClipRect.Intersection( rInf.GetPaintRect() );
}
- SwSaveClip aClip( (OutputDevice*)rInf.GetOut() );
+ SwSaveClip aClip( const_cast<OutputDevice*>(rInf.GetOut()) );
aClip.ChgClip( aClipRect, rInf.GetTxtFrm() );
// Just do, what we always do ...
diff --git a/sw/source/core/text/txtfld.cxx b/sw/source/core/text/txtfld.cxx
index cc6b50a1b064..a55fb63e7933 100644
--- a/sw/source/core/text/txtfld.cxx
+++ b/sw/source/core/text/txtfld.cxx
@@ -73,7 +73,7 @@ SwExpandPortion *SwTxtFormatter::NewFldPortion( SwTxtFormatInfo &rInf,
{
SwExpandPortion *pRet = 0;
SwFrm *pFrame = (SwFrm*)pFrm;
- SwField *pFld = (SwField*)pHint->GetFmtFld().GetField();
+ SwField *pFld = const_cast<SwField*>(pHint->GetFmtFld().GetField());
const bool bName = rInf.GetOpt().IsFldName();
SwCharFmt* pChFmt = 0;
diff --git a/sw/source/core/text/txtftn.cxx b/sw/source/core/text/txtftn.cxx
index bb0ba76b2117..88ad8aa247aa 100644
--- a/sw/source/core/text/txtftn.cxx
+++ b/sw/source/core/text/txtftn.cxx
@@ -257,7 +257,7 @@ SwTwips SwTxtFrm::GetFtnLine( const SwTxtFtn *pFtn ) const
OSL_ENSURE( ! IsVertical() || ! IsSwapped(),
"SwTxtFrm::GetFtnLine with swapped frame" );
- SwTxtFrm *pThis = (SwTxtFrm*)this;
+ SwTxtFrm *pThis = const_cast<SwTxtFrm*>(this);
if( !HasPara() )
{
@@ -339,7 +339,7 @@ SwTwips SwTxtFrm::_GetFtnFrmHeight() const
// Growth potential of the container
if ( !pRef->IsInFtnConnect() )
{
- SwSaveFtnHeight aSave( (SwFtnBossFrm*)pBoss, nHeight );
+ SwSaveFtnHeight aSave( const_cast<SwFtnBossFrm*>(pBoss), nHeight );
nHeight = const_cast<SwFtnContFrm*>(static_cast<const SwFtnContFrm*>(pCont))->Grow( LONG_MAX, true );
}
else
diff --git a/sw/source/core/tox/ToxTextGenerator.cxx b/sw/source/core/tox/ToxTextGenerator.cxx
index e3e10c185c12..246ec5a70604 100644
--- a/sw/source/core/tox/ToxTextGenerator.cxx
+++ b/sw/source/core/tox/ToxTextGenerator.cxx
@@ -156,7 +156,7 @@ ToxTextGenerator::GenerateText(SwDoc* pDoc, const std::vector<SwTOXSortTabBase*>
sal_uInt16 indexOfEntryToProcess, sal_uInt16 numberOfEntriesToProcess)
{
// pTOXNd is only set at the first mark
- SwTxtNode* pTOXNd = (SwTxtNode*)entries.at(indexOfEntryToProcess)->pTOXNd;
+ SwTxtNode* pTOXNd = const_cast<SwTxtNode*>(entries.at(indexOfEntryToProcess)->pTOXNd);
// FIXME this operates directly on the node text
OUString & rTxt = const_cast<OUString&>(pTOXNd->GetTxt());
rTxt.clear();
diff --git a/sw/source/core/tox/tox.cxx b/sw/source/core/tox/tox.cxx
index 66c86db13a31..dd9bc1177e76 100644
--- a/sw/source/core/tox/tox.cxx
+++ b/sw/source/core/tox/tox.cxx
@@ -207,7 +207,7 @@ SwTOXType::SwTOXType( TOXTypes eTyp, const OUString& rName )
}
SwTOXType::SwTOXType(const SwTOXType& rCopy)
- : SwModify( (SwModify*)rCopy.GetRegisteredIn() ),
+ : SwModify( const_cast<SwModify*>(rCopy.GetRegisteredIn()) ),
aName(rCopy.aName),
eType(rCopy.eType)
{
@@ -460,7 +460,7 @@ void SwTOXBase::RegisterToTOXType( SwTOXType& rType )
SwTOXBase& SwTOXBase::CopyTOXBase( SwDoc* pDoc, const SwTOXBase& rSource )
{
maMSTOCExpression = rSource.maMSTOCExpression;
- SwTOXType* pType = (SwTOXType*)rSource.GetTOXType();
+ SwTOXType* pType = const_cast<SwTOXType*>(rSource.GetTOXType());
if( pDoc && USHRT_MAX == pDoc->GetTOXTypes().GetPos( pType ))
{
// type not in pDoc, so create it now
@@ -472,14 +472,14 @@ SwTOXBase& SwTOXBase::CopyTOXBase( SwDoc* pDoc, const SwTOXBase& rSource )
if( pCmp->GetType() == pType->GetType() &&
pCmp->GetTypeName() == pType->GetTypeName() )
{
- pType = (SwTOXType*)pCmp;
+ pType = const_cast<SwTOXType*>(pCmp);
bFound = true;
break;
}
}
if( !bFound )
- pType = (SwTOXType*)pDoc->InsertTOXType( *pType );
+ pType = const_cast<SwTOXType*>(pDoc->InsertTOXType( *pType ));
}
pType->Add( this );
diff --git a/sw/source/core/txtnode/atrfld.cxx b/sw/source/core/txtnode/atrfld.cxx
index b3a3b31bd936..018b448b6d55 100644
--- a/sw/source/core/txtnode/atrfld.cxx
+++ b/sw/source/core/txtnode/atrfld.cxx
@@ -218,7 +218,7 @@ void SwFmtFld::SwClientNotify( const SwModify& rModify, const SfxHint& rHint )
SwDoc* pDoc = pPaM->GetDoc();
const SwTxtNode& rTxtNode = mpTxtFld->GetTxtNode();
pPaM->GetPoint()->nNode = rTxtNode;
- pPaM->GetPoint()->nContent.Assign( (SwTxtNode*)&rTxtNode, mpTxtFld->GetStart() );
+ pPaM->GetPoint()->nContent.Assign( const_cast<SwTxtNode*>(&rTxtNode), mpTxtFld->GetStart() );
OUString const aEntry( GetField()->ExpandField( pDoc->IsClipBoard() ) );
pPaM->SetMark();
@@ -447,7 +447,7 @@ void SwTxtFld::CopyTxtFld( SwTxtFld *pDest ) const
|| nFldWhich == RES_GETEXPFLD
|| nFldWhich == RES_HIDDENTXTFLD )
{
- SwTxtFld* pFld = (SwTxtFld*)this;
+ SwTxtFld* pFld = const_cast<SwTxtFld*>(this);
pDestIDFA->UpdateExpFlds( pFld, true );
}
// Tabellenfelder auf externe Darstellung
diff --git a/sw/source/core/txtnode/atrflyin.cxx b/sw/source/core/txtnode/atrflyin.cxx
index d82afbc2935b..009e5c004242 100644
--- a/sw/source/core/txtnode/atrflyin.cxx
+++ b/sw/source/core/txtnode/atrflyin.cxx
@@ -144,9 +144,9 @@ void SwTxtFlyCnt::SetAnchor( const SwTxtNode *pNode )
// Wir ermitteln den Index im Nodesarray zum Node
- SwDoc* pDoc = (SwDoc*)pNode->GetDoc();
+ SwDoc* pDoc = const_cast<SwDoc*>(pNode->GetDoc());
- SwIndex aIdx( (SwTxtNode*)pNode, GetStart() );
+ SwIndex aIdx( const_cast<SwTxtNode*>(pNode), GetStart() );
SwPosition aPos( *pNode->StartOfSectionNode(), aIdx );
SwFrmFmt* pFmt = GetFlyCnt().GetFrmFmt();
SwFmtAnchor aAnchor( pFmt->GetAnchor() );
diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx
index 54c0c6178dc5..7a837ed5945f 100644
--- a/sw/source/core/txtnode/fntcache.cxx
+++ b/sw/source/core/txtnode/fntcache.cxx
@@ -401,7 +401,7 @@ void SwFntObj::CreateScrFont( const SwViewShell& rSh, const OutputDevice& rOut )
return;
// any changes to the output device are reset at the end of the function
- OutputDevice* pOut = (OutputDevice*)&rOut;
+ OutputDevice* pOut = const_cast<OutputDevice*>(&rOut);
// Save old font
vcl::Font aOldOutFont( pOut->GetFont() );
diff --git a/sw/source/core/txtnode/fntcap.cxx b/sw/source/core/txtnode/fntcap.cxx
index 5f8bf848ec10..b7b856045723 100644
--- a/sw/source/core/txtnode/fntcap.cxx
+++ b/sw/source/core/txtnode/fntcap.cxx
@@ -213,7 +213,7 @@ sal_Int32 SwFont::GetCapitalBreak( SwViewShell const * pSh, const OutputDevice*
{
// Start:
Point aPos( 0, 0 );
- SwDrawTextInfo aInfo(pSh, *(OutputDevice*)pOut, pScript, rTxt, nIdx, nLen,
+ SwDrawTextInfo aInfo(pSh, *const_cast<OutputDevice*>(pOut), pScript, rTxt, nIdx, nLen,
0, false);
aInfo.SetPos( aPos );
aInfo.SetSpace( 0 );
diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx
index 7af5ef14c1ff..91f617701d39 100644
--- a/sw/source/core/txtnode/ndtxt.cxx
+++ b/sw/source/core/txtnode/ndtxt.cxx
@@ -594,7 +594,7 @@ SwCntntNode *SwTxtNode::SplitCntntNode( const SwPosition &rPos )
if( HasWriterListeners() && SfxItemState::SET == pNode->GetSwAttrSet().
GetItemState( RES_PAGEDESC, true, &pItem ) )
{
- pNode->ModifyNotification( (SfxPoolItem*)pItem, (SfxPoolItem*)pItem );
+ pNode->ModifyNotification( pItem, pItem );
}
}
return pNode;
diff --git a/sw/source/core/txtnode/txtatr2.cxx b/sw/source/core/txtnode/txtatr2.cxx
index 86a0d5d4061d..9761a38ba60c 100644
--- a/sw/source/core/txtnode/txtatr2.cxx
+++ b/sw/source/core/txtnode/txtatr2.cxx
@@ -271,7 +271,7 @@ SwCharFmt* SwTxtRuby::GetCharFmt()
}
pRet = IsPoolUserFmt( nId )
- ? const_cast<SwDoc*>(pDoc)->FindCharFmtByName( rStr )
+ ? pDoc->FindCharFmtByName( rStr )
: const_cast<SwDoc*>(pDoc)->getIDocumentStylePoolAccess().GetCharFmtFromPool( nId );
if( bResetMod )
diff --git a/sw/source/core/txtnode/txtedt.cxx b/sw/source/core/txtnode/txtedt.cxx
index 15658efdbefa..7aa8b52a406f 100644
--- a/sw/source/core/txtnode/txtedt.cxx
+++ b/sw/source/core/txtnode/txtedt.cxx
@@ -1591,7 +1591,7 @@ bool SwTxtNode::Hyphenate( SwInterHyphInfo &rHyphInf )
if( pLinguNode != this )
{
pLinguNode = this;
- pLinguFrm = static_cast<SwTxtFrm*>(getLayoutFrm( GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), (Point*)(rHyphInf.GetCrsrPos()) ));
+ pLinguFrm = static_cast<SwTxtFrm*>(getLayoutFrm( GetDoc()->getIDocumentLayoutAccess().GetCurrentLayout(), rHyphInf.GetCrsrPos() ));
}
SwTxtFrm *pFrm = pLinguFrm;
if( pFrm )
diff --git a/sw/source/core/undo/SwUndoField.cxx b/sw/source/core/undo/SwUndoField.cxx
index 3e1557c3839a..080e8b2f24f6 100644
--- a/sw/source/core/undo/SwUndoField.cxx
+++ b/sw/source/core/undo/SwUndoField.cxx
@@ -95,7 +95,7 @@ void SwUndoFieldFromDoc::DoImpl()
if (pField)
{
pDoc->getIDocumentFieldsAccess().UpdateFld(pTxtFld, *pNewField, pHnt, bUpdate);
- SwFmtFld* pDstFmtFld = (SwFmtFld*)&pTxtFld->GetFmtFld();
+ SwFmtFld* pDstFmtFld = const_cast<SwFmtFld*>(&pTxtFld->GetFmtFld());
if ( pDoc->getIDocumentFieldsAccess().GetFldType(RES_POSTITFLD, aEmptyOUStr, false) == pDstFmtFld->GetField()->GetTyp() )
pDoc->GetDocShell()->Broadcast( SwFmtFldHint( pDstFmtFld, SwFmtFldHintWhich::INSERTED ) );
diff --git a/sw/source/core/undo/undobj1.cxx b/sw/source/core/undo/undobj1.cxx
index d44c2a1e8aae..0ef2e5f6d451 100644
--- a/sw/source/core/undo/undobj1.cxx
+++ b/sw/source/core/undo/undobj1.cxx
@@ -656,7 +656,7 @@ void SwUndoSetFlyFmt::PutAttr( sal_uInt16 nWhich, const SfxPoolItem* pItem )
nOldCntnt = pAnchor->GetPageNum();
}
- pAnchor = (SwFmtAnchor*)&pFrmFmt->GetAnchor();
+ pAnchor = &pFrmFmt->GetAnchor();
switch( nNewAnchorTyp = static_cast<sal_uInt16>(pAnchor->GetAnchorId()) )
{
case FLY_AS_CHAR:
diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx
index fd07513c3454..d48e8d223d40 100644
--- a/sw/source/core/undo/untbl.cxx
+++ b/sw/source/core/undo/untbl.cxx
@@ -1123,7 +1123,7 @@ void _SaveTable::NewFrmFmt( const SwTableLine* pTblLn, const SwTableBox* pTblBx,
const SfxPoolItem& rOld = pOldFmt->GetFmtAttr( RES_BOXATR_FORMAT ),
& rNew = pFmt->GetFmtAttr( RES_BOXATR_FORMAT );
if( rOld != rNew )
- pFmt->ModifyNotification( (SfxPoolItem*)&rOld, (SfxPoolItem*)&rNew );
+ pFmt->ModifyNotification( &rOld, &rNew );
}
if( !pOldFmt->HasWriterListeners() )
@@ -1414,7 +1414,7 @@ SwUndoTblAutoFmt::SwUndoTblAutoFmt( const SwTableNode& rTblNd,
{
// than also go over the ContentNodes of the EndBoxes and collect
// all paragraph attributes
- pSaveTbl->SaveCntntAttrs( (SwDoc*)rTblNd.GetDoc() );
+ pSaveTbl->SaveCntntAttrs( const_cast<SwDoc*>(rTblNd.GetDoc()) );
bSaveCntntAttr = true;
}
}
@@ -2787,8 +2787,8 @@ SwUndo* SwUndoTblCpyTbl::PrepareRedline( SwDoc* pDoc, const SwTableBox& rBox,
bool SwUndoTblCpyTbl::InsertRow( SwTable& rTbl, const SwSelBoxes& rBoxes,
sal_uInt16 nCnt )
{
- SwTableNode* pTblNd = (SwTableNode*)rTbl.GetTabSortBoxes()[0]->
- GetSttNd()->FindTableNode();
+ SwTableNode* pTblNd = const_cast<SwTableNode*>(rTbl.GetTabSortBoxes()[0]->
+ GetSttNd()->FindTableNode());
pInsRowUndo = new SwUndoTblNdsChg( UNDO_TABLE_INSROW, rBoxes, *pTblNd,
0, 0, nCnt, true, false );
diff --git a/sw/source/core/unocore/unochart.cxx b/sw/source/core/unocore/unochart.cxx
index 8f34f15ffc39..deaa196bf449 100644
--- a/sw/source/core/unocore/unochart.cxx
+++ b/sw/source/core/unocore/unochart.cxx
@@ -2562,7 +2562,7 @@ bool SwChartDataSequence::DeleteBox( const SwTableBox &rBox )
if (bMoveHorizontal)
nCol += bMoveLeft ? -1 : +1;
const OUString aNewCellName = sw_GetCellName( nCol, nRow );
- SwTableBox* pNewBox = (SwTableBox*) pTable->GetTblBox( aNewCellName );
+ SwTableBox* pNewBox = const_cast<SwTableBox*>(pTable->GetTblBox( aNewCellName ));
if (pNewBox) // set new position (cell range) to use
{
diff --git a/sw/source/core/unocore/unomap.cxx b/sw/source/core/unocore/unomap.cxx
index cb7cdf03f672..3bd2700efe40 100644
--- a/sw/source/core/unocore/unomap.cxx
+++ b/sw/source/core/unocore/unomap.cxx
@@ -1702,7 +1702,7 @@ const SfxItemPropertyMapEntry* SwUnoPropertyMapProvider::GetPropertyMapEntries(s
{ OUString(), 0, css::uno::Type(), 0, 0 }
};
- aMapEntriesArr[nPropertyId] = (SfxItemPropertyMapEntry*)aTableRowPropertyMap_Impl;
+ aMapEntriesArr[nPropertyId] = aTableRowPropertyMap_Impl;
}
break;
case PROPERTY_MAP_TEXT_TABLE_CURSOR:
diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx
index 58a7101f2ad0..685e35609c54 100644
--- a/sw/source/core/unocore/unoobj2.cxx
+++ b/sw/source/core/unocore/unoobj2.cxx
@@ -227,7 +227,7 @@ void CollectFrameAtNode( SwClient& rClnt, const SwNodeIndex& rIdx,
0 != (pAnchorPos = rAnchor.GetCntntAnchor()) &&
pAnchorPos->nNode == rIdx )
{
- SwDepend* pNewDepend = new SwDepend( &rClnt, (SwFrmFmt*)pFmt);
+ SwDepend* pNewDepend = new SwDepend( &rClnt, const_cast<SwFrmFmt*>(pFmt));
// OD 2004-05-07 #i28701# - determine insert position for
// sorted <rFrameArr>
diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx
index d02e5f275b9c..ddc7f707ea9d 100644
--- a/sw/source/core/unocore/unotbl.cxx
+++ b/sw/source/core/unocore/unotbl.cxx
@@ -576,7 +576,7 @@ static SwXCell* lcl_CreateXCell(SwFrmFmt* pFmt, sal_Int32 nColumn, sal_Int32 nRo
SwXCell* pXCell = 0;
const OUString sCellName = sw_GetCellName(nColumn, nRow);
SwTable* pTable = SwTable::FindTable( pFmt );
- SwTableBox* pBox = (SwTableBox*)pTable->GetTblBox( sCellName );
+ SwTableBox* pBox = const_cast<SwTableBox*>(pTable->GetTblBox( sCellName ));
if(pBox)
{
pXCell = SwXCell::CreateXCell(pFmt, pBox, pTable);
@@ -872,7 +872,7 @@ const SwStartNode *SwXCell::GetStartNode() const
{
const SwStartNode *pSttNd = 0;
- if( pStartNode || ((SwXCell *)this)->IsValid() )
+ if( pStartNode || IsValid() )
pSttNd = pStartNode ? pStartNode : pBox->GetSttNd();
return pSttNd;
@@ -2295,7 +2295,7 @@ uno::Reference< table::XCell > SwXTextTable::getCellByName(const OUString& sCell
if(pFmt)
{
SwTable* pTable = SwTable::FindTable( pFmt );
- SwTableBox* pBox = (SwTableBox*)pTable->GetTblBox( sCellName );
+ SwTableBox* pBox = const_cast<SwTableBox*>(pTable->GetTblBox( sCellName ));
if(pBox)
{
xRet = SwXCell::CreateXCell(pFmt, pBox);
@@ -2338,7 +2338,7 @@ uno::Reference< text::XTextTableCursor > SwXTextTable::createCursorByCellName(co
if(pFmt)
{
SwTable* pTable = SwTable::FindTable( pFmt );
- SwTableBox* pBox = (SwTableBox*)pTable->GetTblBox( sCellName );
+ SwTableBox* pBox = const_cast<SwTableBox*>(pTable->GetTblBox( sCellName ));
if(pBox && pBox->getRowSpan() > 0 )
{
xRet = new SwXTextTableCursor(pFmt, pBox);
diff --git a/sw/source/filter/basflt/shellio.cxx b/sw/source/filter/basflt/shellio.cxx
index 072c417b1f1d..01251df4e8d9 100644
--- a/sw/source/filter/basflt/shellio.cxx
+++ b/sw/source/filter/basflt/shellio.cxx
@@ -64,7 +64,7 @@ using namespace ::com::sun::star;
sal_uLong SwReader::Read( const Reader& rOptions )
{
// copy variables
- Reader* po = (Reader*) &rOptions;
+ Reader* po = const_cast<Reader*>(&rOptions);
po->pStrm = pStrm;
po->pStg = pStg;
po->xStg = xStg;
@@ -648,7 +648,7 @@ size_t Reader::GetSectionList( SfxMedium&, std::vector<OUString*>& ) const
bool SwReader::HasGlossaries( const Reader& rOptions )
{
// copy variables
- Reader* po = (Reader*) &rOptions;
+ Reader* po = const_cast<Reader*>(&rOptions);
po->pStrm = pStrm;
po->pStg = pStg;
po->bInsertMode = false;
@@ -664,7 +664,7 @@ bool SwReader::ReadGlossaries( const Reader& rOptions,
SwTextBlocks& rBlocks, bool bSaveRelFiles )
{
// copy variables
- Reader* po = (Reader*) &rOptions;
+ Reader* po = const_cast<Reader*>(&rOptions);
po->pStrm = pStrm;
po->pStg = pStg;
po->bInsertMode = false;
diff --git a/sw/source/filter/html/htmlnum.hxx b/sw/source/filter/html/htmlnum.hxx
index e3f826d5850e..f67190f4aaf5 100644
--- a/sw/source/filter/html/htmlnum.hxx
+++ b/sw/source/filter/html/htmlnum.hxx
@@ -65,7 +65,7 @@ public:
inline void Clear();
- void SetNumRule( const SwNumRule *pRule ) { pNumRule = (SwNumRule *)pRule; }
+ void SetNumRule( const SwNumRule *pRule ) { pNumRule = const_cast<SwNumRule *>(pRule); }
SwNumRule *GetNumRule() { return pNumRule; }
const SwNumRule *GetNumRule() const { return pNumRule; }
diff --git a/sw/source/filter/html/htmlsect.cxx b/sw/source/filter/html/htmlsect.cxx
index 404d13b93cde..6c1ac2b9fe42 100644
--- a/sw/source/filter/html/htmlsect.cxx
+++ b/sw/source/filter/html/htmlsect.cxx
@@ -152,24 +152,24 @@ void SwHTMLParser::NewDivision( int nToken )
sal_uInt16 nFlags = CONTEXT_FLAGS_HDRFTR;
if( bHeader )
{
- pHdFtFmt = (SwFrmFmt*)rPageFmt.GetHeader().GetHeaderFmt();
+ pHdFtFmt = const_cast<SwFrmFmt*>(rPageFmt.GetHeader().GetHeaderFmt());
if( !pHdFtFmt )
{
// noch keine Header, dann erzeuge einen.
rPageFmt.SetFmtAttr( SwFmtHeader( true ));
- pHdFtFmt = (SwFrmFmt*)rPageFmt.GetHeader().GetHeaderFmt();
+ pHdFtFmt = const_cast<SwFrmFmt*>(rPageFmt.GetHeader().GetHeaderFmt());
bNew = true;
}
nFlags |= HTML_CNTXT_HEADER_DIST;
}
else
{
- pHdFtFmt = (SwFrmFmt*)rPageFmt.GetFooter().GetFooterFmt();
+ pHdFtFmt = const_cast<SwFrmFmt*>(rPageFmt.GetFooter().GetFooterFmt());
if( !pHdFtFmt )
{
// noch keine Footer, dann erzeuge einen.
rPageFmt.SetFmtAttr( SwFmtFooter( true ));
- pHdFtFmt = (SwFrmFmt*)rPageFmt.GetFooter().GetFooterFmt();
+ pHdFtFmt = const_cast<SwFrmFmt*>(rPageFmt.GetFooter().GetFooterFmt());
bNew = true;
}
nFlags |= HTML_CNTXT_FOOTER_DIST;
@@ -419,8 +419,8 @@ void SwHTMLParser::FixHeaderFooterDistance( bool bHeader,
SwFrmFmt& rPageFmt = pPageDesc->GetMaster();
SwFrmFmt *pHdFtFmt =
- bHeader ? (SwFrmFmt*)rPageFmt.GetHeader().GetHeaderFmt()
- : (SwFrmFmt*)rPageFmt.GetFooter().GetFooterFmt();
+ bHeader ? const_cast<SwFrmFmt*>(rPageFmt.GetHeader().GetHeaderFmt())
+ : const_cast<SwFrmFmt*>(rPageFmt.GetFooter().GetFooterFmt());
OSL_ENSURE( pHdFtFmt, "Doch keine Kopf- oder Fusszeile" );
const SwFmtCntnt& rFlyCntnt = pHdFtFmt->GetCntnt();
diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx
index 24ff36d57e6e..1aa0e643535c 100644
--- a/sw/source/filter/html/htmltab.cxx
+++ b/sw/source/filter/html/htmltab.cxx
@@ -600,7 +600,7 @@ public:
bool HasColTags() const { return bColSpec; }
- sal_uInt16 IncGrfsThatResize() { return pSwTable ? ((SwTable *)pSwTable)->IncGrfsThatResize() : 0; }
+ sal_uInt16 IncGrfsThatResize() { return pSwTable ? const_cast<SwTable *>(pSwTable)->IncGrfsThatResize() : 0; }
void RegisterDrawObject( SdrObject *pObj, sal_uInt8 nPrcWidth );
@@ -2358,7 +2358,7 @@ void HTMLTable::CloseTable()
void HTMLTable::_MakeTable( SwTableBox *pBox )
{
SwTableLines& rLines = (pBox ? pBox->GetTabLines()
- : ((SwTable *)pSwTable)->GetTabLines() );
+ : const_cast<SwTable *>(pSwTable)->GetTabLines() );
// jetzt geht's richtig los ...
@@ -2635,8 +2635,8 @@ void HTMLTable::MakeTable( SwTableBox *pBox, sal_uInt16 nAbsAvail,
if( GetBGBrush() )
pSwTable->GetFrmFmt()->SetFmtAttr( *GetBGBrush() );
- ((SwTable *)pSwTable)->SetRowsToRepeat( static_cast< sal_uInt16 >(nHeadlineRepeat) );
- ((SwTable *)pSwTable)->GCLines();
+ const_cast<SwTable *>(pSwTable)->SetRowsToRepeat( static_cast< sal_uInt16 >(nHeadlineRepeat) );
+ const_cast<SwTable *>(pSwTable)->GCLines();
bool bIsInFlyFrame = pContext && pContext->GetFrmFmt();
if( bIsInFlyFrame && !nWidth )
@@ -2688,7 +2688,7 @@ void HTMLTable::MakeTable( SwTableBox *pBox, sal_uInt16 nAbsAvail,
pLayoutInfo->SetWidths();
- ((SwTable *)pSwTable)->SetHTMLTableLayout( pLayoutInfo );
+ const_cast<SwTable *>(pSwTable)->SetHTMLTableLayout( pLayoutInfo );
if( pResizeDrawObjs )
{
@@ -3785,7 +3785,7 @@ void SwHTMLParser::BuildTableCell( HTMLTable *pCurTable, bool bReadOptions,
pPostIts = 0;
}
- pTCntxt->SetTableNode( (SwTableNode *)pNd->FindTableNode() );
+ pTCntxt->SetTableNode( const_cast<SwTableNode *>(pNd->FindTableNode()) );
pCurTable->SetTable( pTCntxt->GetTableNode(), pTCntxt,
nLeftSpace, nRightSpace,
@@ -5367,7 +5367,7 @@ HTMLTable *SwHTMLParser::BuildTable( SvxAdjust eParentAdjust,
// Die Section wird jetzt nicht mehr gebraucht.
pPam->SetMark();
pPam->DeleteMark();
- pDoc->getIDocumentContentOperations().DeleteSection( (SwStartNode *)pCapStNd );
+ pDoc->getIDocumentContentOperations().DeleteSection( const_cast<SwStartNode *>(pCapStNd) );
pTable->SetCaption( 0, false );
}
@@ -5417,7 +5417,7 @@ HTMLTable *SwHTMLParser::BuildTable( SvxAdjust eParentAdjust,
{
pPam->SetMark();
pPam->DeleteMark();
- pDoc->getIDocumentContentOperations().DeleteSection( (SwStartNode *)pCapStNd );
+ pDoc->getIDocumentContentOperations().DeleteSection( const_cast<SwStartNode *>(pCapStNd) );
pCurTable->SetCaption( 0, false );
}
}
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 3d71b749ad6a..66d1da9fe02a 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -2494,49 +2494,49 @@ static void impl_borderLine( FSHelperPtr pSerializer, sal_Int32 elementToken, co
switch (pBorderLine->GetBorderLineStyle())
{
case table::BorderLineStyle::SOLID:
- pVal = ( sal_Char* )"single";
+ pVal = "single";
break;
case table::BorderLineStyle::DOTTED:
- pVal = ( sal_Char* )"dotted";
+ pVal = "dotted";
break;
case table::BorderLineStyle::DASHED:
- pVal = ( sal_Char* )"dashed";
+ pVal = "dashed";
break;
case table::BorderLineStyle::DOUBLE:
- pVal = ( sal_Char* )"double";
+ pVal = "double";
break;
case table::BorderLineStyle::THINTHICK_SMALLGAP:
- pVal = ( sal_Char* )"thinThickSmallGap";
+ pVal = "thinThickSmallGap";
break;
case table::BorderLineStyle::THINTHICK_MEDIUMGAP:
- pVal = ( sal_Char* )"thinThickMediumGap";
+ pVal = "thinThickMediumGap";
break;
case table::BorderLineStyle::THINTHICK_LARGEGAP:
- pVal = ( sal_Char* )"thinThickLargeGap";
+ pVal = "thinThickLargeGap";
break;
case table::BorderLineStyle::THICKTHIN_SMALLGAP:
- pVal = ( sal_Char* )"thickThinSmallGap";
+ pVal = "thickThinSmallGap";
break;
case table::BorderLineStyle::THICKTHIN_MEDIUMGAP:
- pVal = ( sal_Char* )"thickThinMediumGap";
+ pVal = "thickThinMediumGap";
break;
case table::BorderLineStyle::THICKTHIN_LARGEGAP:
- pVal = ( sal_Char* )"thickThinLargeGap";
+ pVal = "thickThinLargeGap";
break;
case table::BorderLineStyle::EMBOSSED:
- pVal = ( sal_Char* )"threeDEmboss";
+ pVal = "threeDEmboss";
break;
case table::BorderLineStyle::ENGRAVED:
- pVal = ( sal_Char* )"threeDEngrave";
+ pVal = "threeDEngrave";
break;
case table::BorderLineStyle::OUTSET:
- pVal = ( sal_Char* )"outset";
+ pVal = "outset";
break;
case table::BorderLineStyle::INSET:
- pVal = ( sal_Char* )"inset";
+ pVal = "inset";
break;
case table::BorderLineStyle::FINE_DASHED:
- pVal = ( sal_Char* )"dashSmallGap";
+ pVal = "dashSmallGap";
break;
case table::BorderLineStyle::NONE:
default:
@@ -6351,13 +6351,13 @@ void DocxAttributeOutput::CharTwoLines( const SvxTwoLinesItem& rTwoLines )
OString sBracket;
if ((cStart == '{') || (cEnd == '}'))
- sBracket = (sal_Char *)"curly";
+ sBracket = const_cast<sal_Char *>("curly");
else if ((cStart == '<') || (cEnd == '>'))
- sBracket = (sal_Char *)"angle";
+ sBracket = const_cast<sal_Char *>("angle");
else if ((cStart == '[') || (cEnd == ']'))
- sBracket = (sal_Char *)"square";
+ sBracket = const_cast<sal_Char *>("square");
else
- sBracket = (sal_Char *)"round";
+ sBracket = const_cast<sal_Char *>("round");
AddToAttrList( m_pEastAsianLayoutAttrList, FSNS( XML_w, XML_combineBrackets ), sBracket.getStr() );
}
diff --git a/sw/source/filter/ww8/docxexport.cxx b/sw/source/filter/ww8/docxexport.cxx
index 0a32b3f5e832..c800a8d4c26c 100644
--- a/sw/source/filter/ww8/docxexport.cxx
+++ b/sw/source/filter/ww8/docxexport.cxx
@@ -490,7 +490,7 @@ void DocxExport::OutputEndNode( const SwEndNode& rEndNode )
sal_uLong nRstLnNum;
if( rNd.IsCntntNode() )
- nRstLnNum = const_cast< SwCntntNode* >( rNd.GetCntntNode() )->GetSwAttrSet().GetLineNumber().GetStartValue();
+ nRstLnNum = rNd.GetCntntNode()->GetSwAttrSet().GetLineNumber().GetStartValue();
else
nRstLnNum = 0;
diff --git a/sw/source/filter/ww8/wrtw8esh.cxx b/sw/source/filter/ww8/wrtw8esh.cxx
index bb12e572f99f..d88ddfd907df 100644
--- a/sw/source/filter/ww8/wrtw8esh.cxx
+++ b/sw/source/filter/ww8/wrtw8esh.cxx
@@ -999,7 +999,7 @@ sal_uInt32 WW8Export::GetSdrOrdNum( const SwFrmFmt& rFmt ) const
else
{
// no Layout for this format, then recalc the ordnum
- SwFrmFmt* pFmt = (SwFrmFmt*)&rFmt;
+ SwFrmFmt* pFmt = const_cast<SwFrmFmt*>(&rFmt);
nOrdNum = pDoc->GetSpzFrmFmts()->GetPos( pFmt );
const SwDrawModel* pModel = pDoc->getIDocumentDrawModelAccess().GetDrawModel();
diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx
index 2f573b850b07..421c7a580f16 100644
--- a/sw/source/filter/ww8/wrtw8nds.cxx
+++ b/sw/source/filter/ww8/wrtw8nds.cxx
@@ -218,7 +218,7 @@ SwWW8AttrIter::SwWW8AttrIter(MSWordExportBase& rWr, const SwTxtNode& rTxtNd) :
if ( !m_rExport.pDoc->getIDocumentRedlineAccess().GetRedlineTbl().empty() )
{
- SwPosition aPosition( rNd, SwIndex( (SwTxtNode*)&rNd ) );
+ SwPosition aPosition( rNd, SwIndex( const_cast<SwTxtNode*>(&rNd) ) );
pCurRedline = m_rExport.pDoc->getIDocumentRedlineAccess().GetRedline( aPosition, &nCurRedlinePos );
}
diff --git a/sw/source/filter/ww8/wrtw8num.cxx b/sw/source/filter/ww8/wrtw8num.cxx
index fc5e14f374db..22196290ec86 100644
--- a/sw/source/filter/ww8/wrtw8num.cxx
+++ b/sw/source/filter/ww8/wrtw8num.cxx
@@ -99,7 +99,7 @@ sal_uInt16 MSWordExportBase::GetId( const SwNumRule& rNumRule )
pUsedNumTbl->push_back( pR );
}
}
- SwNumRule* p = (SwNumRule*)&rNumRule;
+ SwNumRule* p = const_cast<SwNumRule*>(&rNumRule);
sal_uInt16 nRet = pUsedNumTbl->GetPos(p);
// Is this list now duplicated into a new list which we should use
diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx
index 021c0cf28195..850fc4e30d47 100644
--- a/sw/source/filter/ww8/wrtww8.cxx
+++ b/sw/source/filter/ww8/wrtww8.cxx
@@ -879,7 +879,7 @@ void WW8_WrPlcPn::AppendFkpEntry(WW8_FC nEndFc,short nVarLen,const sal_uInt8* pS
WW8_WrFkp* pF = &aFkps.back();
// big sprm? build the sprmPHugePapx
- sal_uInt8* pNewSprms = (sal_uInt8*)pSprms;
+ sal_uInt8* pNewSprms = const_cast<sal_uInt8*>(pSprms);
sal_uInt8 aHugePapx[ 8 ];
if( rWrt.bWrtWW8 && PAP == ePlc && 488 < nVarLen )
{
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index 1f28f5146824..c0c8205ca231 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -2471,8 +2471,8 @@ void WW8TabDesc::UseSwTable()
pTabLines = &pTable->GetTabLines();
nAktRow = nAktCol = nAktBandRow = 0;
- pTblNd = (SwTableNode*)(*pTabLines)[0]->GetTabBoxes()[0]->
- GetSttNd()->FindTableNode();
+ pTblNd = const_cast<SwTableNode*>((*pTabLines)[0]->GetTabBoxes()[0]->
+ GetSttNd()->FindTableNode());
OSL_ENSURE( pTblNd, "wo ist mein TabellenNode" );
// #i69519# - Restrict rows to repeat to a decent value
@@ -2645,7 +2645,7 @@ void WW8TabDesc::ParkPaM()
while (pIo->pPaM->GetNode().GetNodeType() != ND_TEXTNODE && ++nSttNd < nEndNd);
pIo->pPaM->GetPoint()->nContent.Assign(pIo->pPaM->GetCntntNode(), 0);
- pIo->rDoc.SetTxtFmtColl(*pIo->pPaM, (SwTxtFmtColl*)pIo->pDfltTxtFmtColl);
+ pIo->rDoc.SetTxtFmtColl(*pIo->pPaM, const_cast<SwTxtFmtColl*>(pIo->pDfltTxtFmtColl));
}
}
@@ -2887,7 +2887,7 @@ bool WW8TabDesc::SetPamInCell(short nWwCol, bool bPam)
pIo->pPaM->GetPoint()->nContent.Assign(pIo->pPaM->GetCntntNode(), 0);
// Precautionally set now, otherwise the style is not set for cells
// that are inserted for margin balancing.
- pIo->rDoc.SetTxtFmtColl(*pIo->pPaM, (SwTxtFmtColl*)pIo->pDfltTxtFmtColl);
+ pIo->rDoc.SetTxtFmtColl(*pIo->pPaM, const_cast<SwTxtFmtColl*>(pIo->pDfltTxtFmtColl));
// because this cells are invisible helper constructions only to simulate
// the frayed view of WW-tables we do NOT need SetTxtFmtCollAndListLevel()
}
@@ -2925,7 +2925,7 @@ void WW8TabDesc::InsertCells( short nIns )
pTabBox = (*pTabBoxes)[0];
pIo->rDoc.GetNodes().InsBoxen( pTblNd, pTabLine, static_cast<SwTableBoxFmt*>(pTabBox->GetFrmFmt()),
- (SwTxtFmtColl*)pIo->pDfltTxtFmtColl, 0, pTabBoxes->size(), nIns );
+ const_cast<SwTxtFmtColl*>(pIo->pDfltTxtFmtColl), 0, pTabBoxes->size(), nIns );
// The third parameter contains the FrmFmt of the boxes.
// Here it is possible to optimize to save (reduce) FrmFmts.
}
diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx
index 5e485405897d..5f0fe6bffa6a 100644
--- a/sw/source/filter/ww8/ww8par5.cxx
+++ b/sw/source/filter/ww8/ww8par5.cxx
@@ -2687,7 +2687,7 @@ static void lcl_toxMatchACSwitch( SwWW8ImplReader& /*rReader*/,
{
if ( rParam.GoToTokenParam() )
{
- SwTOXType* pType = (SwTOXType*)rDoc.GetTOXType( TOX_ILLUSTRATIONS, 0);
+ SwTOXType* pType = const_cast<SwTOXType*>(rDoc.GetTOXType( TOX_ILLUSTRATIONS, 0));
rBase.RegisterToTOXType( *pType );
rBase.SetCaptionDisplay( eCaptionType );
// Read Sequence Name and store in TOXBase
diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx
index 8911d364c195..15a17a8d0199 100644
--- a/sw/source/filter/ww8/ww8par6.cxx
+++ b/sw/source/filter/ww8/ww8par6.cxx
@@ -584,7 +584,7 @@ void wwSectionManager::SetPageULSpaceItems(SwFrmFmt &rFmt,
if (rData.bHasHeader) // ... und Header-Lower setzen
{
//Kopfzeilenhoehe minimal sezten
- if (SwFrmFmt* pHdFmt = (SwFrmFmt*)rFmt.GetHeader().GetHeaderFmt())
+ if (SwFrmFmt* pHdFmt = const_cast<SwFrmFmt*>(rFmt.GetHeader().GetHeaderFmt()))
{
SvxULSpaceItem aHdUL(pHdFmt->GetULSpace());
if (!rSection.IsFixedHeightHeader()) //normal
@@ -611,7 +611,7 @@ void wwSectionManager::SetPageULSpaceItems(SwFrmFmt &rFmt,
if (rData.bHasFooter) // ... und Footer-Upper setzen
{
- if (SwFrmFmt* pFtFmt = (SwFrmFmt*)rFmt.GetFooter().GetFooterFmt())
+ if (SwFrmFmt* pFtFmt = const_cast<SwFrmFmt*>(rFmt.GetFooter().GetFooterFmt()))
{
SvxULSpaceItem aFtUL(pFtFmt->GetULSpace());
if (!rSection.IsFixedHeightFooter()) //normal
@@ -4002,7 +4002,7 @@ void SwWW8ImplReader::Read_LR( sal_uInt16 nId, const sal_uInt8* pData, short nLe
// If have not explicit left, set number format list tab position is doc default tab
const SvxTabStopItem *pDefaultStopItem = static_cast<const SvxTabStopItem *>(rDoc.GetAttrPool().GetPoolDefaultItem(RES_PARATR_TABSTOP));
if ( pDefaultStopItem && pDefaultStopItem->Count() > 0 )
- ((SwNumFmt*)(pNumFmt))->SetListtabPos( ((SvxTabStop&)(*pDefaultStopItem)[0]).GetTabPos() );
+ const_cast<SwNumFmt*>(pNumFmt)->SetListtabPos( ((SvxTabStop&)(*pDefaultStopItem)[0]).GetTabPos() );
}
}
}
diff --git a/sw/source/filter/xml/xmlfmt.cxx b/sw/source/filter/xml/xmlfmt.cxx
index 8cf6b00bc780..b4f243b13657 100644
--- a/sw/source/filter/xml/xmlfmt.cxx
+++ b/sw/source/filter/xml/xmlfmt.cxx
@@ -881,7 +881,7 @@ uno::Reference < container::XNameContainer > SwXMLStylesContext_Impl::GetStylesC
{
uno::Reference < container::XNameContainer > xStyles;
if( XML_STYLE_FAMILY_SD_GRAPHICS_ID == nFamily )
- xStyles = ((SvXMLImport *)&GetImport())->GetTextImport()->GetFrameStyles();
+ xStyles = const_cast<SvXMLImport *>(&GetImport())->GetTextImport()->GetFrameStyles();
else
xStyles = SvXMLStylesContext::GetStylesContainer( nFamily );
diff --git a/sw/source/filter/xml/xmltble.cxx b/sw/source/filter/xml/xmltble.cxx
index 605a7c78ae90..2efe361f7693 100644
--- a/sw/source/filter/xml/xmltble.cxx
+++ b/sw/source/filter/xml/xmltble.cxx
@@ -650,9 +650,9 @@ void SwXMLExport::ExportTableLinesAutoStyles( const SwTableLines& rLines,
ExportFmt( *pFrmFmt2, XML_TABLE_CELL );
Reference < XCell > xCell = SwXCell::CreateXCell(
- (SwFrmFmt *)rTblInfo.GetTblFmt(),
+ const_cast<SwFrmFmt *>(rTblInfo.GetTblFmt()),
pBox,
- (SwTable *)rTblInfo.GetTable() );
+ const_cast<SwTable *>(rTblInfo.GetTable()) );
if (xCell.is())
{
Reference < XText > xText( xCell, UNO_QUERY );
@@ -766,9 +766,9 @@ void SwXMLExport::ExportTableBox( const SwTableBox& rBox,
{
// start node -> normal cell
// get cell range for table
- Reference<XCell> xCell = SwXCell::CreateXCell( (SwFrmFmt *)rTblInfo.GetTblFmt(),
- (SwTableBox *)&rBox,
- (SwTable *)rTblInfo.GetTable() );
+ Reference<XCell> xCell = SwXCell::CreateXCell( const_cast<SwFrmFmt *>(rTblInfo.GetTblFmt()),
+ const_cast<SwTableBox *>(&rBox),
+ const_cast<SwTable *>(rTblInfo.GetTable()) );
if (xCell.is())
{
diff --git a/sw/source/filter/xml/xmltexti.cxx b/sw/source/filter/xml/xmltexti.cxx
index a12e5ae119cd..a9307b60a993 100644
--- a/sw/source/filter/xml/xmltexti.cxx
+++ b/sw/source/filter/xml/xmltexti.cxx
@@ -184,7 +184,7 @@ SvXMLImportContext *SwXMLTextImportHelper::CreateTableChildContext(
bool SwXMLTextImportHelper::IsInHeaderFooter() const
{
uno::Reference<XUnoTunnel> xCrsrTunnel(
- ((SwXMLTextImportHelper *)this)->GetCursor(), UNO_QUERY );
+ const_cast<SwXMLTextImportHelper *>(this)->GetCursor(), UNO_QUERY );
assert(xCrsrTunnel.is() && "missing XUnoTunnel for Cursor");
OTextCursorHelper *pTxtCrsr = reinterpret_cast< OTextCursorHelper * >(
sal::static_int_cast< sal_IntPtr >( xCrsrTunnel->getSomething( OTextCursorHelper::getUnoTunnelId() )));
diff --git a/sw/source/ui/envelp/envfmt.cxx b/sw/source/ui/envelp/envfmt.cxx
index 996a39dc6eff..a18dd071692e 100644
--- a/sw/source/ui/envelp/envfmt.cxx
+++ b/sw/source/ui/envelp/envfmt.cxx
@@ -304,7 +304,7 @@ IMPL_LINK( SwEnvFmtPage, EditHdl, MenuButton *, pButton )
{
// maybe relocate defaults
const SfxPoolItem* pItem = 0;
- SfxItemSet* pOutputSet = (SfxItemSet*)pDlg->GetOutputItemSet();
+ SfxItemSet* pOutputSet = const_cast<SfxItemSet*>(pDlg->GetOutputItemSet());
sal_uInt16 nNewDist;
if( SfxItemState::SET == pOutputSet->GetItemState( SID_ATTR_TABSTOP_DEFAULTS,
diff --git a/sw/source/ui/vba/vbatablehelper.cxx b/sw/source/ui/vba/vbatablehelper.cxx
index 5c3906262189..04d49b20c7a8 100644
--- a/sw/source/ui/vba/vbatablehelper.cxx
+++ b/sw/source/ui/vba/vbatablehelper.cxx
@@ -76,7 +76,7 @@ sal_Int32 SwVbaTableHelper::getTabRowIndex( const OUString& CellName ) throw (un
{
sal_Int32 nRet = 0;
OUString sCellName(CellName);
- SwTableBox* pBox = (SwTableBox*)pTable->GetTblBox( sCellName );
+ SwTableBox* pBox = const_cast<SwTableBox*>(pTable->GetTblBox( sCellName ));
if( !pBox )
throw uno::RuntimeException();
@@ -91,7 +91,7 @@ sal_Int32 SwVbaTableHelper::getTabColIndex( const OUString& CellName ) throw (un
{
sal_Int32 nRet = 0;
OUString sCellName(CellName);
- const SwTableBox* pBox = (SwTableBox*)pTable->GetTblBox( sCellName );
+ const SwTableBox* pBox = pTable->GetTblBox( sCellName );
if( !pBox )
throw uno::RuntimeException();
const SwTableBoxes* pBoxes = &pBox->GetUpper()->GetTabBoxes();
diff --git a/sw/source/uibase/app/apphdl.cxx b/sw/source/uibase/app/apphdl.cxx
index b5e825909623..c77ae688ee98 100644
--- a/sw/source/uibase/app/apphdl.cxx
+++ b/sw/source/uibase/app/apphdl.cxx
@@ -864,7 +864,7 @@ SvtUserOptions& SwModule::GetUserOptions()
const SwMasterUsrPref *SwModule::GetUsrPref(bool bWeb) const
{
- SwModule* pNonConstModule = (SwModule*)this;
+ SwModule* pNonConstModule = const_cast<SwModule*>(this);
if(bWeb && !pWebUsrPref)
{
// The SpellChecker is needed in SwMasterUsrPref's Load, but it must not
diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx
index 638d0fc305b5..6583dafb5d88 100644
--- a/sw/source/uibase/app/docst.cxx
+++ b/sw/source/uibase/app/docst.cxx
@@ -975,10 +975,10 @@ sal_uInt16 SwDocShell::DoWaterCan(const OUString &rName, sal_uInt16 nFamily)
aTemplate.aColl.pFrmFmt = pStyle->GetFrmFmt();
break;
case SFX_STYLE_FAMILY_PAGE:
- aTemplate.aColl.pPageDesc = (SwPageDesc*)pStyle->GetPageDesc();
+ aTemplate.aColl.pPageDesc = const_cast<SwPageDesc*>(pStyle->GetPageDesc());
break;
case SFX_STYLE_FAMILY_PSEUDO:
- aTemplate.aColl.pNumRule = (SwNumRule*)pStyle->GetNumRule();
+ aTemplate.aColl.pNumRule = const_cast<SwNumRule*>(pStyle->GetNumRule());
break;
default:
@@ -1180,7 +1180,7 @@ sal_uInt16 SwDocShell::MakeByExample( const OUString &rName, sal_uInt16 nFamily,
pCurrWrtShell->StartAllAction();
sal_uInt16 nPgDsc = pCurrWrtShell->GetCurPageDesc();
SwPageDesc& rSrc = (SwPageDesc&)pCurrWrtShell->GetPageDesc( nPgDsc );
- SwPageDesc& rDest = *(SwPageDesc*)pStyle->GetPageDesc();
+ SwPageDesc& rDest = *const_cast<SwPageDesc*>(pStyle->GetPageDesc());
sal_uInt16 nPoolId = rDest.GetPoolFmtId();
sal_uInt16 nHId = rDest.GetPoolHelpId();
diff --git a/sw/source/uibase/app/docstyle.cxx b/sw/source/uibase/app/docstyle.cxx
index c37165747223..75fde3674ffd 100644
--- a/sw/source/uibase/app/docstyle.cxx
+++ b/sw/source/uibase/app/docstyle.cxx
@@ -672,7 +672,7 @@ const OUString& SwDocStyleSheet::GetParent() const
if( p && !p->IsDefault() )
sTmp = p->GetName();
}
- SwDocStyleSheet* pThis = (SwDocStyleSheet*)this;
+ SwDocStyleSheet* pThis = const_cast<SwDocStyleSheet*>(this);
pThis->aParent = sTmp;
}
return aParent;
@@ -683,7 +683,7 @@ const OUString& SwDocStyleSheet::GetFollow() const
{
if( !bPhysical )
{
- SwDocStyleSheet* pThis = (SwDocStyleSheet*)this;
+ SwDocStyleSheet* pThis = const_cast<SwDocStyleSheet*>(this);
pThis->FillStyleSheet( FillAllInfo );
}
return aFollow;
@@ -2033,7 +2033,7 @@ bool SwDocStyleSheet::IsUsed() const
{
if( !bPhysical )
{
- SwDocStyleSheet* pThis = (SwDocStyleSheet*)this;
+ SwDocStyleSheet* pThis = const_cast<SwDocStyleSheet*>(this);
pThis->FillStyleSheet( FillOnlyName );
}
@@ -2272,9 +2272,9 @@ void SwDocStyleSheetPool::Replace( SfxStyleSheetBase& rSource,
{
// deal with separately!
SwPageDesc* pDestDsc =
- (SwPageDesc*)static_cast<SwDocStyleSheet&>(rTarget).GetPageDesc();
+ const_cast<SwPageDesc*>(static_cast<SwDocStyleSheet&>(rTarget).GetPageDesc());
SwPageDesc* pCpyDsc =
- (SwPageDesc*)static_cast<SwDocStyleSheet&>(rSource).GetPageDesc();
+ const_cast<SwPageDesc*>(static_cast<SwDocStyleSheet&>(rSource).GetPageDesc());
rDoc.CopyPageDesc( *pCpyDsc, *pDestDsc );
}
else
diff --git a/sw/source/uibase/app/swmodul1.cxx b/sw/source/uibase/app/swmodul1.cxx
index 35ef45ec8901..d64b949e9526 100644
--- a/sw/source/uibase/app/swmodul1.cxx
+++ b/sw/source/uibase/app/swmodul1.cxx
@@ -144,10 +144,10 @@ void SwModule::ApplyUsrPref(const SwViewOption &rUsrPref, SwView* pActView,
SwView* pCurrView = pActView;
SwViewShell* pSh = pCurrView ? &pCurrView->GetWrtShell() : 0;
- SwMasterUsrPref* pPref = (SwMasterUsrPref*)GetUsrPref(
+ SwMasterUsrPref* pPref = const_cast<SwMasterUsrPref*>(GetUsrPref(
VIEWOPT_DEST_WEB == nDest ? true :
VIEWOPT_DEST_TEXT== nDest ? false :
- pCurrView && pCurrView->ISA(SwWebView) );
+ pCurrView && pCurrView->ISA(SwWebView) ));
// with Uno, only sdbcx::View, but not the Module should be changed
bool bViewOnly = VIEWOPT_DEST_VIEW_ONLY == nDest;
diff --git a/sw/source/uibase/cctrl/popbox.cxx b/sw/source/uibase/cctrl/popbox.cxx
index 1ef4113a634b..ded277b2bfb0 100644
--- a/sw/source/uibase/cctrl/popbox.cxx
+++ b/sw/source/uibase/cctrl/popbox.cxx
@@ -34,7 +34,7 @@ void SwHelpToolBox::MouseButtonDown(const MouseEvent &rEvt)
if(rEvt.GetButtons() == MOUSE_RIGHT &&
0 == GetItemId(rEvt.GetPosPixel()))
{
- aRightClickLink.Call((MouseEvent *)&rEvt);
+ aRightClickLink.Call(const_cast<MouseEvent *>(&rEvt));
}
else
ToolBox::MouseButtonDown(rEvt);
diff --git a/sw/source/uibase/dbui/dbtree.cxx b/sw/source/uibase/dbui/dbtree.cxx
index a9f60cff73be..552cc9c85a52 100644
--- a/sw/source/uibase/dbui/dbtree.cxx
+++ b/sw/source/uibase/dbui/dbtree.cxx
@@ -400,7 +400,7 @@ void SwDBTreeList::RequestingChildren(SvTreeListEntry* pParent)
IMPL_LINK( SwDBTreeList, DBCompare, SvSortData*, pData )
{
- SvTreeListEntry* pRight = (SvTreeListEntry*)(pData->pRight );
+ SvTreeListEntry* pRight = const_cast<SvTreeListEntry*>(pData->pRight);
if (GetParent(pRight) && GetParent(GetParent(pRight)))
return 1; // don't sort column names
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx
index a1d1ad7d49a1..2e8d988be0ad 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -356,7 +356,7 @@ const Graphic* SwTransferable::FindOLEReplacementGraphic() const
void SwTransferable::RemoveDDELinkFormat( const vcl::Window& rWin )
{
RemoveFormat( SotClipboardFormatId::LINK );
- CopyToClipboard( (vcl::Window*)&rWin );
+ CopyToClipboard( const_cast<vcl::Window*>(&rWin) );
}
namespace
@@ -3156,7 +3156,7 @@ void SwTransferable::StartDrag( vcl::Window* pWin, const Point& rPos )
bOldIdle = pWrtShell->GetViewOptions()->IsIdle();
bCleanUp = true;
- ((SwViewOption *)pWrtShell->GetViewOptions())->SetIdle( false );
+ pWrtShell->GetViewOptions()->SetIdle( false );
if( pWrtShell->IsSelFrmMode() )
pWrtShell->ShowCrsr();
@@ -3214,7 +3214,7 @@ void SwTransferable::DragFinished( sal_Int8 nAction )
else
pWrtShell->ShowCrsr();
- ((SwViewOption *)pWrtShell->GetViewOptions())->SetIdle( bOldIdle );
+ pWrtShell->GetViewOptions()->SetIdle( bOldIdle );
}
bool SwTransferable::PrivatePaste( SwWrtShell& rShell )
diff --git a/sw/source/uibase/docvw/edtdd.cxx b/sw/source/uibase/docvw/edtdd.cxx
index 83c5b8031631..f72191ca2ec0 100644
--- a/sw/source/uibase/docvw/edtdd.cxx
+++ b/sw/source/uibase/docvw/edtdd.cxx
@@ -160,7 +160,7 @@ void SwEditWin::DropCleanup()
g_bNoInterrupt = false;
if ( m_bOldIdleSet )
{
- const_cast<SwViewOption*>(rSh.GetViewOptions())->SetIdle( m_bOldIdle );
+ rSh.GetViewOptions()->SetIdle( m_bOldIdle );
m_bOldIdleSet = false;
}
if ( m_pUserMarker )
@@ -350,7 +350,7 @@ sal_Int8 SwEditWin::AcceptDrop( const AcceptDropEvent& rEvt )
last_tick = current_tick;
if(!m_bOldIdleSet) {
m_bOldIdle = rSh.GetViewOptions()->IsIdle();
- ((SwViewOption *)rSh.GetViewOptions())->SetIdle(false);
+ rSh.GetViewOptions()->SetIdle(false);
m_bOldIdleSet = true;
}
CleanupDropUserMarker();
@@ -365,7 +365,7 @@ sal_Int8 SwEditWin::AcceptDrop( const AcceptDropEvent& rEvt )
}
if(m_bOldIdleSet) {
- ((SwViewOption *)rSh.GetViewOptions())->SetIdle( m_bOldIdle );
+ rSh.GetViewOptions()->SetIdle( m_bOldIdle );
m_bOldIdleSet = false;
}
diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx
index b02b8afdb83e..f0831acce215 100644
--- a/sw/source/uibase/docvw/edtwin.cxx
+++ b/sw/source/uibase/docvw/edtwin.cxx
@@ -4839,7 +4839,7 @@ void SwEditWin::SetApplyTemplate(const SwApplyTemplate &rTempl)
SetPointer( POINTER_FILL );//@todo #i20119# maybe better a new brush pointer here in future
rSh.NoEdit( false );
bIdle = rSh.GetViewOptions()->IsIdle();
- ((SwViewOption *)rSh.GetViewOptions())->SetIdle( false );
+ rSh.GetViewOptions()->SetIdle( false );
}
else if(rTempl.nColor)
{
@@ -4847,7 +4847,7 @@ void SwEditWin::SetApplyTemplate(const SwApplyTemplate &rTempl)
SetPointer( POINTER_FILL );
rSh.NoEdit( false );
bIdle = rSh.GetViewOptions()->IsIdle();
- ((SwViewOption *)rSh.GetViewOptions())->SetIdle( false );
+ rSh.GetViewOptions()->SetIdle( false );
}
else if( rTempl.eType )
{
@@ -4855,14 +4855,14 @@ void SwEditWin::SetApplyTemplate(const SwApplyTemplate &rTempl)
SetPointer( POINTER_FILL );
rSh.NoEdit( false );
bIdle = rSh.GetViewOptions()->IsIdle();
- ((SwViewOption *)rSh.GetViewOptions())->SetIdle( false );
+ rSh.GetViewOptions()->SetIdle( false );
}
else
{
SetPointer( POINTER_TEXT );
rSh.UnSetVisCrsr();
- ((SwViewOption *)rSh.GetViewOptions())->SetIdle( bIdle );
+ rSh.GetViewOptions()->SetIdle( bIdle );
if ( !rSh.IsSelFrmMode() )
rSh.Edit();
}
diff --git a/sw/source/uibase/index/toxmgr.cxx b/sw/source/uibase/index/toxmgr.cxx
index a1b1a21a712e..76ea0dced9dd 100644
--- a/sw/source/uibase/index/toxmgr.cxx
+++ b/sw/source/uibase/index/toxmgr.cxx
@@ -54,7 +54,7 @@ void SwTOXMgr::DeleteTOXMark()
SwTOXMark* pNext = 0;
if( pCurTOXMark )
{
- pNext = (SwTOXMark*)&pSh->GotoTOXMark( *pCurTOXMark, TOX_NXT );
+ pNext = const_cast<SwTOXMark*>(&pSh->GotoTOXMark( *pCurTOXMark, TOX_NXT ));
if( pNext == pCurTOXMark )
pNext = 0;
@@ -248,7 +248,7 @@ void SwTOXMgr::NextTOXMark(bool bSame)
if( pCurTOXMark )
{
SwTOXSearch eDir = bSame ? TOX_SAME_NXT : TOX_NXT;
- pCurTOXMark = (SwTOXMark*)&pSh->GotoTOXMark( *pCurTOXMark, eDir );
+ pCurTOXMark = const_cast<SwTOXMark*>(&pSh->GotoTOXMark( *pCurTOXMark, eDir ));
}
}
@@ -258,7 +258,7 @@ void SwTOXMgr::PrevTOXMark(bool bSame)
if( pCurTOXMark )
{
SwTOXSearch eDir = bSame ? TOX_SAME_PRV : TOX_PRV;
- pCurTOXMark = (SwTOXMark*)&pSh->GotoTOXMark(*pCurTOXMark, eDir );
+ pCurTOXMark = const_cast<SwTOXMark*>(&pSh->GotoTOXMark(*pCurTOXMark, eDir ));
}
}
@@ -284,7 +284,7 @@ bool SwTOXMgr::UpdateOrInsertTOX(const SwTOXDescription& rDesc,
SwWait aWait( *pSh->GetView().GetDocShell(), true );
bool bRet = true;
const SwTOXBase* pCurTOX = ppBase && *ppBase ? *ppBase : GetCurTOX();
- SwTOXBase* pTOX = (SwTOXBase*)pCurTOX;
+ SwTOXBase* pTOX = const_cast<SwTOXBase*>(pCurTOX);
SwTOXBase * pNewTOX = NULL;
@@ -394,7 +394,7 @@ bool SwTOXMgr::UpdateOrInsertTOX(const SwTOXDescription& rDesc,
{
if((!ppBase || !(*ppBase)) && pSh->HasSelection())
pSh->DelRight();
- pNewTOX = (SwTOXBase*)pCurTOX;
+ pNewTOX = const_cast<SwTOXBase*>(pCurTOX);
}
pNewTOX->SetFromObjectNames(rDesc.IsCreateFromObjectNames());
pNewTOX->SetOLEOptions(rDesc.GetOLEOptions());
diff --git a/sw/source/uibase/misc/redlndlg.cxx b/sw/source/uibase/misc/redlndlg.cxx
index 513df0aa49f5..7fa6e73ef0d6 100644
--- a/sw/source/uibase/misc/redlndlg.cxx
+++ b/sw/source/uibase/misc/redlndlg.cxx
@@ -486,12 +486,12 @@ sal_uInt16 SwRedlineAcceptDlg::CalcDiff(sal_uInt16 nStart, bool bChild)
if (bChild) // should actually never happen, but just in case...
{
// throw away all entry's children and initialise newly
- SwRedlineDataChild* pBackupData = (SwRedlineDataChild*)pParent->pNext;
+ SwRedlineDataChild* pBackupData = const_cast<SwRedlineDataChild*>(pParent->pNext);
SwRedlineDataChild* pNext;
while (pBackupData)
{
- pNext = (SwRedlineDataChild*)pBackupData->pNext;
+ pNext = const_cast<SwRedlineDataChild*>(pBackupData->pNext);
if (pBackupData->pTLBChild)
pTable->RemoveEntry(pBackupData->pTLBChild);
@@ -664,7 +664,7 @@ void SwRedlineAcceptDlg::RemoveParents(sal_uInt16 nStart, sal_uInt16 nEnd)
{
if (!bChildrenRemoved && aRedlineParents[i].pNext)
{
- SwRedlineDataChildPtr pChildPtr = (SwRedlineDataChildPtr)aRedlineParents[i].pNext;
+ SwRedlineDataChildPtr pChildPtr = const_cast<SwRedlineDataChildPtr>(aRedlineParents[i].pNext);
for( SwRedlineDataChildArr::iterator it = aRedlineChildren.begin();
it != aRedlineChildren.end(); ++it)
if (&*it == pChildPtr)
@@ -672,7 +672,7 @@ void SwRedlineAcceptDlg::RemoveParents(sal_uInt16 nStart, sal_uInt16 nEnd)
sal_uInt16 nChildren = 0;
while (pChildPtr)
{
- pChildPtr = (SwRedlineDataChildPtr)pChildPtr->pNext;
+ pChildPtr = const_cast<SwRedlineDataChildPtr>(pChildPtr->pNext);
nChildren++;
}
diff --git a/sw/source/uibase/shells/frmsh.cxx b/sw/source/uibase/shells/frmsh.cxx
index f0e414b9251d..56d04be6176c 100644
--- a/sw/source/uibase/shells/frmsh.cxx
+++ b/sw/source/uibase/shells/frmsh.cxx
@@ -548,8 +548,8 @@ void SwFrameShell::Execute(SfxRequest &rReq)
if (!sPrevName.isEmpty())
{
//needs cast - no non-const method available
- SwFrmFmt* pPrevFmt = (SwFrmFmt*)
- lcl_GetFrmFmtByName(rSh, sPrevName);
+ SwFrmFmt* pPrevFmt = const_cast<SwFrmFmt*>(
+ lcl_GetFrmFmtByName(rSh, sPrevName));
SAL_WARN_IF(!pPrevFmt, "sw.ui", "No frame found!");
if(pPrevFmt)
{
@@ -582,13 +582,13 @@ void SwFrameShell::Execute(SfxRequest &rReq)
if (!sNextName.isEmpty())
{
//needs cast - no non-const method available
- SwFrmFmt* pNextFmt = (SwFrmFmt*)
- lcl_GetFrmFmtByName(rSh, sNextName);
+ SwFrmFmt* pNextFmt = const_cast<SwFrmFmt*>(
+ lcl_GetFrmFmtByName(rSh, sNextName));
SAL_WARN_IF(!pNextFmt, "sw.ui", "No frame found!");
if(pNextFmt)
{
- rSh.Chain(*(SwFrmFmt*)
- pCurrFlyFmt, *pNextFmt);
+ rSh.Chain(*const_cast<SwFrmFmt*>(
+ pCurrFlyFmt), *pNextFmt);
}
}
rSh.SetChainMarker();
@@ -1095,13 +1095,13 @@ void SwFrameShell::ExecFrameStyle(SfxRequest& rReq)
else
{
if ( aBoxItem.GetTop() )
- ((SvxBorderLine*)aBoxItem.GetTop())->SetColor( rNewColor );
+ const_cast<SvxBorderLine*>(aBoxItem.GetTop())->SetColor( rNewColor );
if ( aBoxItem.GetBottom() )
- ((SvxBorderLine*)aBoxItem.GetBottom())->SetColor( rNewColor );
+ const_cast<SvxBorderLine*>(aBoxItem.GetBottom())->SetColor( rNewColor );
if ( aBoxItem.GetLeft() )
- ((SvxBorderLine*)aBoxItem.GetLeft())->SetColor( rNewColor );
+ const_cast<SvxBorderLine*>(aBoxItem.GetLeft())->SetColor( rNewColor );
if ( aBoxItem.GetRight() )
- ((SvxBorderLine*)aBoxItem.GetRight())->SetColor( rNewColor );
+ const_cast<SvxBorderLine*>(aBoxItem.GetRight())->SetColor( rNewColor );
}
}
}
diff --git a/sw/source/uibase/shells/grfsh.cxx b/sw/source/uibase/shells/grfsh.cxx
index b261adcd42a7..a85b1be431e7 100644
--- a/sw/source/uibase/shells/grfsh.cxx
+++ b/sw/source/uibase/shells/grfsh.cxx
@@ -360,7 +360,7 @@ void SwGrfShell::Execute(SfxRequest &rReq)
rSh.StartAllAction();
rSh.StartUndo(UNDO_START);
const SfxPoolItem* pItem;
- SfxItemSet* pSet = (SfxItemSet*)pDlg->GetOutputItemSet();
+ SfxItemSet* pSet = const_cast<SfxItemSet*>(pDlg->GetOutputItemSet());
rReq.Done(*pSet);
// change the 2 frmsize SizeItems to the correct SwFrmSizeItem
if( SfxItemState::SET == pSet->GetItemState(
diff --git a/sw/source/uibase/shells/textidx.cxx b/sw/source/uibase/shells/textidx.cxx
index 05c4ef1bd3fa..a87dcb460f9e 100644
--- a/sw/source/uibase/shells/textidx.cxx
+++ b/sw/source/uibase/shells/textidx.cxx
@@ -139,7 +139,7 @@ void SwTextShell::ExecIdx(SfxRequest &rReq)
SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create();
OSL_ENSURE(pFact, "Dialog creation failed!");
boost::scoped_ptr<AbstractMultiTOXTabDialog> pDlg(pFact->CreateMultiTOXTabDialog(
- pMDI, aSet, rSh, (SwTOXBase* )pCurTOX,
+ pMDI, aSet, rSh, const_cast<SwTOXBase*>(pCurTOX),
USHRT_MAX, bGlobal));
OSL_ENSURE(pDlg, "Dialog creation failed!");
pDlg->Execute();
diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx
index b25456aec053..e18d86d10345 100644
--- a/sw/source/uibase/shells/textsh1.cxx
+++ b/sw/source/uibase/shells/textsh1.cxx
@@ -983,13 +983,13 @@ void SwTextShell::Execute(SfxRequest &rReq)
pSet = &aCoreSet;
} else
- pSet = (SfxItemSet*) pArgs;
+ pSet = const_cast<SfxItemSet*>(pArgs);
}
else if ( pDlg && pDlg->Execute() == RET_OK )
{
// Apply defaults if necessary.
- pSet = (SfxItemSet*)pDlg->GetOutputItemSet();
+ pSet = const_cast<SfxItemSet*>(pDlg->GetOutputItemSet());
sal_uInt16 nNewDist;
if( SfxItemState::SET == pSet->GetItemState( SID_ATTR_TABSTOP_DEFAULTS, false, &pItem ) &&
nDefDist != (nNewDist = static_cast<const SfxUInt16Item*>(pItem)->GetValue()) )
@@ -1788,7 +1788,7 @@ void SwTextShell::GetState( SfxItemSet &rSet )
case FN_BUL_NUM_RULE_INDEX:
case FN_NUM_NUM_RULE_INDEX:
{
- SwNumRule* pCurRule = (SwNumRule*)(GetShell().GetNumRuleAtCurrCrsrPos());
+ SwNumRule* pCurRule = const_cast<SwNumRule*>(GetShell().GetNumRuleAtCurrCrsrPos());
sal_uInt16 nActNumLvl = USHRT_MAX;
rSet.Put(SfxUInt16Item(FN_NUM_NUM_RULE_INDEX,DEFAULT_NONE));
rSet.Put(SfxUInt16Item(FN_BUL_NUM_RULE_INDEX,DEFAULT_NONE));
diff --git a/sw/source/uibase/uiview/pview.cxx b/sw/source/uibase/uiview/pview.cxx
index 40c2696602c0..fa80f75052a0 100644
--- a/sw/source/uibase/uiview/pview.cxx
+++ b/sw/source/uibase/uiview/pview.cxx
@@ -522,7 +522,7 @@ void SwPagePreviewWin::MouseButtonDown( const MouseEvent& rMEvt )
void SwPagePreviewWin::SetPagePreview( sal_uInt8 nRow, sal_uInt8 nCol )
{
- SwMasterUsrPref *pOpt = (SwMasterUsrPref *)SW_MOD()->GetUsrPref(false);
+ SwMasterUsrPref *pOpt = const_cast<SwMasterUsrPref *>(SW_MOD()->GetUsrPref(false));
if (nRow != pOpt->GetPagePrevRow() || nCol != pOpt->GetPagePrevCol())
{
@@ -709,7 +709,7 @@ void SwPagePreview::Execute( SfxRequest &rReq )
if( pArgs && SfxItemState::SET == pArgs->GetItemState( FN_SHOW_BOOKVIEW, false, &pItem ) )
{
bBookPreview = static_cast< const SfxBoolItem* >( pItem )->GetValue();
- ( ( SwViewOption* ) GetViewShell()->GetViewOptions() )->SetPagePrevBookview( bBookPreview );
+ const_cast<SwViewOption*>(GetViewShell()->GetViewOptions())->SetPagePrevBookview( bBookPreview );
// cast is not gentleman like, but it's common use in writer and in this case
}
if ( pViewWin->SetBookPreviewMode( bBookPreview ) )
diff --git a/sw/source/uibase/uiview/viewling.cxx b/sw/source/uibase/uiview/viewling.cxx
index cf80a288540d..b0142b985c58 100644
--- a/sw/source/uibase/uiview/viewling.cxx
+++ b/sw/source/uibase/uiview/viewling.cxx
@@ -441,7 +441,7 @@ void SwView::HyphenateDocument()
}
else
{
- SwViewOption* pVOpt = (SwViewOption*)m_pWrtShell->GetViewOptions();
+ SwViewOption* pVOpt = const_cast<SwViewOption*>(m_pWrtShell->GetViewOptions());
bool bOldIdle = pVOpt->IsIdle();
pVOpt->SetIdle( false );
@@ -560,7 +560,7 @@ void SwView::StartThesaurus()
return;
}
- SwViewOption* pVOpt = (SwViewOption*)m_pWrtShell->GetViewOptions();
+ SwViewOption* pVOpt = const_cast<SwViewOption*>(m_pWrtShell->GetViewOptions());
bool bOldIdle = pVOpt->IsIdle();
pVOpt->SetIdle( false );
diff --git a/sw/source/uibase/uiview/viewmdi.cxx b/sw/source/uibase/uiview/viewmdi.cxx
index 4116e7ee1d36..8d63bcb4580a 100644
--- a/sw/source/uibase/uiview/viewmdi.cxx
+++ b/sw/source/uibase/uiview/viewmdi.cxx
@@ -81,7 +81,7 @@ void SwView::_SetZoom( const Size &rEditSize, SvxZoomType eZoomType,
long nFac = nFactor;
const bool bWeb = this->ISA(SwWebView);
- SwMasterUsrPref *pUsrPref = (SwMasterUsrPref*)SW_MOD()->GetUsrPref(bWeb);
+ SwMasterUsrPref *pUsrPref = const_cast<SwMasterUsrPref*>(SW_MOD()->GetUsrPref(bWeb));
const SwPageDesc &rDesc = m_pWrtShell->GetPageDesc( m_pWrtShell->GetCurPageDesc() );
const SvxLRSpaceItem &rLRSpace = rDesc.GetMaster().GetLRSpace();
@@ -218,7 +218,7 @@ void SwView::SetViewLayout( sal_uInt16 nColumns, bool bBookMode, bool bViewOnly
if ( !GetViewFrame()->GetFrame().IsInPlace() && !bViewOnly )
{
const bool bWeb = this->ISA(SwWebView);
- SwMasterUsrPref *pUsrPref = (SwMasterUsrPref*)SW_MOD()->GetUsrPref(bWeb);
+ SwMasterUsrPref *pUsrPref = const_cast<SwMasterUsrPref*>(SW_MOD()->GetUsrPref(bWeb));
// Update MasterUsrPrefs and after that update the ViewOptions of the current View.
if ( nColumns != pUsrPref->GetViewLayoutColumns() ||
diff --git a/sw/source/uibase/uiview/viewtab.cxx b/sw/source/uibase/uiview/viewtab.cxx
index e24c7755cde3..1a5c2d0a80b2 100644
--- a/sw/source/uibase/uiview/viewtab.cxx
+++ b/sw/source/uibase/uiview/viewtab.cxx
@@ -236,10 +236,10 @@ void SwView::ExecTabWin( SfxRequest& rReq )
const bool bVerticalWriting = rSh.IsInVerticalText();
const SwFmtHeader& rHeaderFmt = rDesc.GetMaster().GetHeader();
- SwFrmFmt *pHeaderFmt = (SwFrmFmt*)rHeaderFmt.GetHeaderFmt();
+ SwFrmFmt *pHeaderFmt = const_cast<SwFrmFmt*>(rHeaderFmt.GetHeaderFmt());
const SwFmtFooter& rFooterFmt = rDesc.GetMaster().GetFooter();
- SwFrmFmt *pFooterFmt = (SwFrmFmt*)rFooterFmt.GetFooterFmt();
+ SwFrmFmt *pFooterFmt = const_cast<SwFrmFmt*>(rFooterFmt.GetFooterFmt());
const SwFmtFrmSize &rFrmSize = rDesc.GetMaster().GetFrmSize();
@@ -1095,7 +1095,7 @@ void SwView::StateTabWin(SfxItemSet& rSet)
if ( ( nFrmType & FrmTypeFlags::HEADER || nFrmType & FrmTypeFlags::FOOTER ) &&
!(nFrmType & FrmTypeFlags::COLSECT) )
{
- SwFrmFmt *pFmt = (SwFrmFmt*) (nFrmType & FrmTypeFlags::HEADER ?
+ SwFrmFmt *pFmt = const_cast<SwFrmFmt*>(nFrmType & FrmTypeFlags::HEADER ?
rDesc.GetMaster().GetHeader().GetHeaderFmt() :
rDesc.GetMaster().GetFooter().GetFooterFmt());
if( pFmt )// #i80890# if rDesc is not the one belonging to the current page is might crash
@@ -1396,14 +1396,14 @@ void SwView::StateTabWin(SfxItemSet& rSet)
{
rMaster.GetHeader();
const SwFmtHeader& rHeaderFmt = rMaster.GetHeader();
- SwFrmFmt *pHeaderFmt = (SwFrmFmt*)rHeaderFmt.GetHeaderFmt();
+ SwFrmFmt *pHeaderFmt = const_cast<SwFrmFmt*>(rHeaderFmt.GetHeaderFmt());
if( pHeaderFmt )// #i80890# if rDesc is not the one belonging to the current page is might crash
pBox = & (const SvxBoxItem&)pHeaderFmt->GetBox();
}
else if(nFrmType & FrmTypeFlags::FOOTER )
{
const SwFmtFooter& rFooterFmt = rMaster.GetFooter();
- SwFrmFmt *pFooterFmt = (SwFrmFmt*)rFooterFmt.GetFooterFmt();
+ SwFrmFmt *pFooterFmt = const_cast<SwFrmFmt*>(rFooterFmt.GetFooterFmt());
if( pFooterFmt )// #i80890# if rDesc is not the one belonging to the current page is might crash
pBox = & (const SvxBoxItem&)pFooterFmt->GetBox();
}
diff --git a/sw/source/uibase/uno/unomailmerge.cxx b/sw/source/uibase/uno/unomailmerge.cxx
index 394ce27e416a..9ffed3a8af84 100644
--- a/sw/source/uibase/uno/unomailmerge.cxx
+++ b/sw/source/uibase/uno/unomailmerge.cxx
@@ -844,7 +844,7 @@ void SAL_CALL SwXMailMerge::cancel() throw (com::sun::star::uno::RuntimeExceptio
void SwXMailMerge::LaunchMailMergeEvent( const MailMergeEvent &rEvt ) const
{
- cppu::OInterfaceIteratorHelper aIt( ((SwXMailMerge *) this)->aMergeListeners );
+ cppu::OInterfaceIteratorHelper aIt( const_cast<SwXMailMerge *>(this)->aMergeListeners );
while (aIt.hasMoreElements())
{
Reference< XMailMergeListener > xRef( aIt.next(), UNO_QUERY );
diff --git a/sw/source/uibase/utlui/numfmtlb.cxx b/sw/source/uibase/utlui/numfmtlb.cxx
index c4411af5eccb..1b9aa58bf62c 100644
--- a/sw/source/uibase/utlui/numfmtlb.cxx
+++ b/sw/source/uibase/utlui/numfmtlb.cxx
@@ -227,7 +227,7 @@ void NumFormatListBox::SetFormatType(const short nFormatType)
if( nFormat == pFormatter->GetFormatIndex( NF_NUMBER_STANDARD,
eCurLanguage )
- || ((SvNumberformat*)pFmt)->GetOutputString( fVal, sValue, &pCol )
+ || const_cast<SvNumberformat*>(pFmt)->GetOutputString( fVal, sValue, &pCol )
|| nFormatType == css::util::NumberFormat::UNDEFINED )
{
sValue = pFmt->GetFormatstring();
diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx b/sw/source/uibase/wrtsh/wrtsh1.cxx
index 9edbda738bcc..7601a5554332 100644
--- a/sw/source/uibase/wrtsh/wrtsh1.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh1.cxx
@@ -1791,8 +1791,8 @@ void SwWrtShell::ChangeHeaderOrFooter(
{
SvxULSpaceItem aUL(bHeader ? 0 : MM50, bHeader ? MM50 : 0, RES_UL_SPACE );
SwFrmFmt* pFmt = bHeader ?
- (SwFrmFmt*)rMaster.GetHeader().GetHeaderFmt() :
- (SwFrmFmt*)rMaster.GetFooter().GetFooterFmt();
+ const_cast<SwFrmFmt*>(rMaster.GetHeader().GetHeaderFmt()) :
+ const_cast<SwFrmFmt*>(rMaster.GetFooter().GetFooterFmt());
pFmt->SetFmtAttr( aUL );
}
}
diff --git a/sw/source/uibase/wrtsh/wrtsh2.cxx b/sw/source/uibase/wrtsh/wrtsh2.cxx
index 770842adb7f2..b9cf0f6957f9 100644
--- a/sw/source/uibase/wrtsh/wrtsh2.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh2.cxx
@@ -371,7 +371,7 @@ void SwWrtShell::ClickToField( const SwField& rFld )
{
StartAllAction();
const_cast<SwField&>(rFld).SetPar2( sRet );
- const_cast<SwField&>(rFld).GetTyp()->UpdateFlds();
+ rFld.GetTyp()->UpdateFlds();
EndAllAction();
}
}
@@ -390,17 +390,17 @@ void SwWrtShell::ClickToField( const SwField& rFld )
const SwInputField* pInputField = dynamic_cast<const SwInputField*>(&rFld);
if ( pInputField == NULL )
{
- StartInputFldDlg( (SwField*)&rFld, false );
+ StartInputFldDlg( const_cast<SwField*>(&rFld), false );
}
}
break;
case RES_SETEXPFLD:
if( static_cast<const SwSetExpField&>(rFld).GetInputFlag() )
- StartInputFldDlg( (SwField*)&rFld, false );
+ StartInputFldDlg( const_cast<SwField*>(&rFld), false );
break;
case RES_DROPDOWN :
- StartDropDownFldDlg( (SwField*)&rFld, false );
+ StartDropDownFldDlg( const_cast<SwField*>(&rFld), false );
break;
default:
SAL_WARN_IF(rFld.IsClickable(), "sw", "unhandled clickable field!");