[Libreoffice-commits] core.git: 10 commits - sw/source

Noel Grandin noel at peralex.com
Tue Nov 25 00:10:40 PST 2014


 sw/source/core/access/accdoc.cxx                        |    8 -
 sw/source/core/access/accnotexthyperlink.cxx            |    2 
 sw/source/core/access/acctable.cxx                      |    2 
 sw/source/core/bastyp/calc.cxx                          |   26 ++--
 sw/source/core/crsr/crsrsh.cxx                          |   12 +-
 sw/source/core/crsr/findattr.cxx                        |    2 
 sw/source/core/crsr/findtxt.cxx                         |    2 
 sw/source/core/crsr/viscrs.cxx                          |    2 
 sw/source/core/doc/DocumentContentOperationsManager.cxx |    6 -
 sw/source/core/doc/DocumentFieldsManager.cxx            |    2 
 sw/source/core/doc/DocumentTimerManager.cxx             |    2 
 sw/source/core/doc/acmplwrd.cxx                         |    2 
 sw/source/core/doc/docdesc.cxx                          |    2 
 sw/source/core/doc/docedt.cxx                           |    2 
 sw/source/core/doc/docfld.cxx                           |    4 
 sw/source/core/doc/docfmt.cxx                           |    2 
 sw/source/core/doc/docftn.cxx                           |   34 +++---
 sw/source/core/doc/doclay.cxx                           |    2 
 sw/source/core/doc/docsort.cxx                          |    4 
 sw/source/core/doc/lineinfo.cxx                         |    4 
 sw/source/core/doc/notxtfrm.cxx                         |    2 
 sw/source/core/doc/swserv.cxx                           |    4 
 sw/source/core/doc/tblafmt.cxx                          |    4 
 sw/source/core/docnode/ndcopy.cxx                       |    4 
 sw/source/core/docnode/ndtbl1.cxx                       |    2 
 sw/source/core/docnode/node.cxx                         |    6 -
 sw/source/core/draw/dcontact.cxx                        |   10 -
 sw/source/core/draw/dflyobj.cxx                         |    4 
 sw/source/core/draw/dpage.cxx                           |    8 -
 sw/source/core/edit/acorrect.cxx                        |    2 
 sw/source/core/edit/autofmt.cxx                         |    2 
 sw/source/core/edit/edfcol.cxx                          |    2 
 sw/source/core/edit/edlingu.cxx                         |    4 
 sw/source/core/edit/edtab.cxx                           |    4 
 sw/source/core/edit/edtox.cxx                           |    4 
 sw/source/core/fields/docufld.cxx                       |    4 
 sw/source/core/fields/expfld.cxx                        |    2 
 sw/source/core/frmedt/fecopy.cxx                        |    2 
 sw/source/core/frmedt/fefly1.cxx                        |   10 -
 sw/source/core/frmedt/feflyole.cxx                      |    6 -
 sw/source/core/frmedt/feshview.cxx                      |    4 
 sw/source/core/frmedt/fetab.cxx                         |    2 
 sw/source/core/frmedt/tblsel.cxx                        |    2 
 sw/source/core/inc/flyfrm.hxx                           |    4 
 sw/source/core/inc/flyfrms.hxx                          |    8 -
 sw/source/core/inc/frame.hxx                            |   50 ++++----
 sw/source/core/inc/frmtool.hxx                          |   20 +--
 sw/source/core/inc/ftnboss.hxx                          |    4 
 sw/source/core/inc/pagefrm.hxx                          |   38 +++---
 sw/source/core/inc/rootfrm.hxx                          |    8 -
 sw/source/core/inc/tabfrm.hxx                           |    2 
 sw/source/core/inc/txtfly.hxx                           |    4 
 sw/source/core/inc/txtfrm.hxx                           |   18 +--
 sw/source/core/inc/viewimp.hxx                          |    2 
 sw/source/core/layout/atrfrm.cxx                        |    6 -
 sw/source/core/layout/calcmove.cxx                      |    2 
 sw/source/core/layout/flowfrm.cxx                       |    4 
 sw/source/core/layout/fly.cxx                           |    2 
 sw/source/core/layout/flylay.cxx                        |    4 
 sw/source/core/layout/ftnfrm.cxx                        |    4 
 sw/source/core/layout/pagedesc.cxx                      |    4 
 sw/source/core/layout/paintfrm.cxx                      |   22 +--
 sw/source/core/layout/trvlfrm.cxx                       |   16 +-
 sw/source/core/layout/wsfrm.cxx                         |    4 
 sw/source/core/ole/ndole.cxx                            |    2 
 sw/source/core/text/blink.cxx                           |    4 
 sw/source/core/text/frmform.cxx                         |    4 
 sw/source/core/text/frminf.cxx                          |    6 -
 sw/source/core/text/guess.cxx                           |    2 
 sw/source/core/text/inftxt.cxx                          |   48 ++++----
 sw/source/core/text/inftxt.hxx                          |   10 -
 sw/source/core/text/itrcrsr.cxx                         |   32 ++---
 sw/source/core/text/itrtxt.hxx                          |    2 
 sw/source/core/text/porexp.cxx                          |    2 
 sw/source/core/text/porfld.cxx                          |    4 
 sw/source/core/text/porfld.hxx                          |    2 
 sw/source/core/text/porlay.cxx                          |    4 
 sw/source/core/text/porlin.cxx                          |    4 
 sw/source/core/text/pormulti.cxx                        |    2 
 sw/source/core/text/porrst.cxx                          |    4 
 sw/source/core/text/portxt.cxx                          |    2 
 sw/source/core/text/txtdrop.cxx                         |   54 ++++-----
 sw/source/core/text/txtfld.cxx                          |    2 
 sw/source/core/text/txtfrm.cxx                          |   16 +-
 sw/source/core/text/txthyph.cxx                         |    4 
 sw/source/core/text/txttab.cxx                          |    4 
 sw/source/core/txtnode/atrftn.cxx                       |   14 +-
 sw/source/core/txtnode/atrref.cxx                       |    2 
 sw/source/core/txtnode/atrtox.cxx                       |    2 
 sw/source/core/txtnode/fmtatr2.cxx                      |   30 ++---
 sw/source/core/txtnode/fntcap.cxx                       |    4 
 sw/source/core/txtnode/ndtxt.cxx                        |   26 ++--
 sw/source/core/txtnode/swfntcch.cxx                     |    4 
 sw/source/core/txtnode/swfont.cxx                       |   64 +++++------
 sw/source/core/txtnode/txtatr2.cxx                      |   10 -
 sw/source/core/undo/SwUndoPageDesc.cxx                  |   24 ++--
 sw/source/core/undo/undel.cxx                           |    4 
 sw/source/core/undo/undobj1.cxx                         |    8 -
 sw/source/core/undo/undraw.cxx                          |    2 
 sw/source/core/undo/unins.cxx                           |    2 
 sw/source/core/undo/unmove.cxx                          |    4 
 sw/source/core/undo/unredln.cxx                         |    4 
 sw/source/core/undo/unsect.cxx                          |    2 
 sw/source/core/undo/untblk.cxx                          |    2 
 sw/source/core/unocore/unocrsrhelper.cxx                |    4 
 sw/source/core/unocore/unodraw.cxx                      |    8 -
 sw/source/core/unocore/unoidx.cxx                       |    2 
 sw/source/core/unocore/unoparagraph.cxx                 |    2 
 sw/source/core/unocore/unosett.cxx                      |    6 -
 sw/source/core/unocore/unostyle.cxx                     |   36 +++---
 sw/source/core/unocore/unotextmarkup.cxx                |    6 -
 sw/source/core/view/vdraw.cxx                           |    6 -
 sw/source/core/view/viewsh.cxx                          |   16 +-
 sw/source/core/view/vnew.cxx                            |    6 -
 sw/source/core/view/vprint.cxx                          |    4 
 sw/source/filter/ascii/ascatr.cxx                       |    2 
 sw/source/filter/html/css1atr.cxx                       |    8 -
 sw/source/filter/html/htmlcss1.cxx                      |    4 
 sw/source/filter/html/htmldrawreader.cxx                |    4 
 sw/source/filter/html/htmlfld.cxx                       |   18 +--
 sw/source/filter/html/htmlfldw.cxx                      |   12 +-
 sw/source/filter/html/htmlflywriter.cxx                 |   20 +--
 sw/source/filter/html/htmlforw.cxx                      |   24 ++--
 sw/source/filter/html/htmlplug.cxx                      |    2 
 sw/source/filter/html/htmltabw.cxx                      |    2 
 sw/source/filter/html/svxcss1.cxx                       |   24 ++--
 sw/source/filter/html/swhtml.cxx                        |   10 -
 sw/source/filter/html/wrthtml.cxx                       |    2 
 sw/source/filter/writer/writer.cxx                      |    2 
 sw/source/filter/writer/wrtswtbl.cxx                    |    4 
 sw/source/filter/ww8/docxattributeoutput.cxx            |   14 +-
 sw/source/filter/ww8/docxsdrexport.cxx                  |    2 
 sw/source/filter/ww8/wrtw8esh.cxx                       |   28 ++--
 sw/source/filter/ww8/wrtw8nds.cxx                       |    8 -
 sw/source/filter/ww8/ww8atr.cxx                         |    8 -
 sw/source/filter/ww8/ww8glsy.cxx                        |    2 
 sw/source/filter/ww8/ww8graf.cxx                        |    8 -
 sw/source/filter/ww8/ww8graf2.cxx                       |    2 
 sw/source/filter/ww8/ww8par.cxx                         |   16 +-
 sw/source/filter/ww8/ww8par4.cxx                        |    2 
 sw/source/filter/xml/xmlfmt.cxx                         |    2 
 sw/source/filter/xml/xmlitemi.cxx                       |    2 
 sw/source/filter/xml/xmltble.cxx                        |   12 +-
 sw/source/ui/chrdlg/pardlg.cxx                          |    8 -
 sw/source/ui/chrdlg/swuiccoll.cxx                       |    2 
 sw/source/ui/config/optload.cxx                         |    6 -
 sw/source/ui/config/optpage.cxx                         |   10 -
 sw/source/ui/dbui/mmoutputpage.cxx                      |    2 
 sw/source/ui/dialog/ascfldlg.cxx                        |    2 
 sw/source/ui/dialog/docstdlg.cxx                        |    4 
 sw/source/ui/dialog/macassgn.cxx                        |    2 
 sw/source/ui/dialog/uiregionsw.cxx                      |   22 +--
 sw/source/ui/envelp/envfmt.cxx                          |    4 
 sw/source/ui/envelp/envlop1.cxx                         |    4 
 sw/source/ui/envelp/label1.cxx                          |    6 -
 sw/source/ui/envelp/labfmt.cxx                          |    2 
 sw/source/ui/fldui/flddb.cxx                            |    6 -
 sw/source/ui/fldui/flddinf.cxx                          |    8 -
 sw/source/ui/fldui/flddok.cxx                           |   12 +-
 sw/source/ui/fldui/fldpage.cxx                          |    2 
 sw/source/ui/fldui/fldref.cxx                           |    2 
 sw/source/ui/fldui/fldvar.cxx                           |   24 ++--
 sw/source/ui/fmtui/tmpdlg.cxx                           |   32 ++---
 sw/source/ui/frmdlg/cption.cxx                          |    4 
 sw/source/ui/frmdlg/frmdlg.cxx                          |   28 ++--
 sw/source/ui/index/swuiidxmrk.cxx                       |    4 
 sw/source/ui/misc/docfnote.cxx                          |    4 
 sw/source/ui/misc/glossary.cxx                          |    2 
 sw/source/ui/misc/linenum.cxx                           |    2 
 sw/source/ui/misc/outline.cxx                           |   12 +-
 sw/source/ui/misc/pgfnote.cxx                           |    4 
 sw/source/ui/table/tabledlg.cxx                         |    6 -
 sw/source/ui/table/tautofmt.cxx                         |    2 
 sw/source/uibase/app/appopt.cxx                         |    2 
 sw/source/uibase/app/docsh.cxx                          |    8 -
 sw/source/uibase/app/docsh2.cxx                         |   18 +--
 sw/source/uibase/app/docshini.cxx                       |    8 -
 sw/source/uibase/app/docst.cxx                          |    8 -
 sw/source/uibase/app/docstyle.cxx                       |   54 ++++-----
 sw/source/uibase/app/swmodul1.cxx                       |    2 
 sw/source/uibase/cctrl/popbox.cxx                       |    4 
 sw/source/uibase/config/cfgitems.cxx                    |    4 
 sw/source/uibase/config/uinums.cxx                      |    4 
 sw/source/uibase/config/usrpref.cxx                     |    2 
 sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx    |    2 
 sw/source/uibase/dialog/swwrtshitem.cxx                 |    2 
 sw/source/uibase/dochdl/swdtflvr.cxx                    |   14 +-
 sw/source/uibase/docvw/PostItMgr.cxx                    |    4 
 sw/source/uibase/docvw/SidebarTxtControl.cxx            |    6 -
 sw/source/uibase/docvw/edtdd.cxx                        |    2 
 sw/source/uibase/docvw/edtwin.cxx                       |   18 +--
 sw/source/uibase/docvw/edtwin2.cxx                      |   14 +-
 sw/source/uibase/docvw/edtwin3.cxx                      |    2 
 sw/source/uibase/docvw/romenu.cxx                       |    2 
 sw/source/uibase/docvw/srcedtw.cxx                      |    6 -
 sw/source/uibase/fldui/fldmgr.cxx                       |   36 +++---
 sw/source/uibase/frmdlg/colex.cxx                       |    4 
 sw/source/uibase/frmdlg/frmmgr.cxx                      |    4 
 sw/source/uibase/inc/frmmgr.hxx                         |   14 +-
 sw/source/uibase/inc/inputwin.hxx                       |    4 
 sw/source/uibase/inc/view.hxx                           |    2 
 sw/source/uibase/misc/redlndlg.cxx                      |    4 
 sw/source/uibase/ribbar/concustomshape.cxx              |    4 
 sw/source/uibase/ribbar/inputwin.cxx                    |    8 -
 sw/source/uibase/ribbar/workctrl.cxx                    |    6 -
 sw/source/uibase/shells/annotsh.cxx                     |    2 
 sw/source/uibase/shells/basesh.cxx                      |    8 -
 sw/source/uibase/shells/drwtxtex.cxx                    |    2 
 sw/source/uibase/shells/drwtxtsh.cxx                    |    2 
 sw/source/uibase/shells/grfsh.cxx                       |   44 +++----
 sw/source/uibase/shells/tabsh.cxx                       |   24 ++--
 sw/source/uibase/shells/textfld.cxx                     |   10 -
 sw/source/uibase/shells/textidx.cxx                     |    2 
 sw/source/uibase/shells/textsh.cxx                      |    2 
 sw/source/uibase/shells/textsh1.cxx                     |   26 ++--
 sw/source/uibase/shells/textsh2.cxx                     |    8 -
 sw/source/uibase/shells/txtattr.cxx                     |    4 
 sw/source/uibase/uiview/formatclipboard.cxx             |    4 
 sw/source/uibase/uiview/pview.cxx                       |   12 +-
 sw/source/uibase/uiview/srcview.cxx                     |    4 
 sw/source/uibase/uiview/swcli.cxx                       |    8 -
 sw/source/uibase/uiview/uivwimp.cxx                     |    4 
 sw/source/uibase/uiview/view.cxx                        |   22 +--
 sw/source/uibase/uiview/view0.cxx                       |    2 
 sw/source/uibase/uiview/view2.cxx                       |   22 +--
 sw/source/uibase/uiview/viewcoll.cxx                    |    4 
 sw/source/uibase/uiview/viewdlg2.cxx                    |    2 
 sw/source/uibase/uiview/viewdraw.cxx                    |    8 -
 sw/source/uibase/uiview/viewling.cxx                    |   12 +-
 sw/source/uibase/uiview/viewmdi.cxx                     |    4 
 sw/source/uibase/uiview/viewprt.cxx                     |    2 
 sw/source/uibase/uiview/viewtab.cxx                     |    4 
 sw/source/uibase/uno/unomod.cxx                         |    4 
 sw/source/uibase/uno/unotxdoc.cxx                       |   90 ++++++++--------
 sw/source/uibase/uno/unotxvw.cxx                        |    6 -
 sw/source/uibase/utlui/bookctrl.cxx                     |    4 
 sw/source/uibase/utlui/glbltree.cxx                     |    8 -
 sw/source/uibase/utlui/navipi.cxx                       |   20 +--
 sw/source/uibase/utlui/tmplctrl.cxx                     |    2 
 sw/source/uibase/utlui/uiitems.cxx                      |    4 
 sw/source/uibase/utlui/wordcountctrl.cxx                |    2 
 sw/source/uibase/wrtsh/wrtsh1.cxx                       |    6 -
 sw/source/uibase/wrtsh/wrtsh2.cxx                       |   12 +-
 243 files changed, 1055 insertions(+), 1055 deletions(-)

New commits:
commit 830193d1e5fd3455e8a30caffeab79e14d9d9da0
Author: Noel Grandin <noel at peralex.com>
Date:   Mon Nov 24 10:40:28 2014 +0200

    loplugin: cstylecast
    
    Change-Id: I1ca8f2c4a2a6a2729fc736222055417427c72177

diff --git a/sw/source/uibase/uno/unomod.cxx b/sw/source/uibase/uno/unomod.cxx
index 4ab522c..1d1e8f8 100644
--- a/sw/source/uibase/uno/unomod.cxx
+++ b/sw/source/uibase/uno/unomod.cxx
@@ -228,7 +228,7 @@ Reference< XPropertySet >  SwXModule::getViewSettings(void) throw( uno::RuntimeE
     SolarMutexGuard aGuard;
     if(!pxViewSettings)
     {
-        ((SwXModule*)this)->pxViewSettings = new Reference< XPropertySet > ;
+        static_cast<SwXModule*>(this)->pxViewSettings = new Reference< XPropertySet > ;
         OSL_FAIL("Web or Text?");
         *pxViewSettings = static_cast < HelperBaseNoState * > ( new SwXViewSettings( false, 0 ) );
     }
@@ -240,7 +240,7 @@ Reference< XPropertySet >  SwXModule::getPrintSettings(void) throw( uno::Runtime
     SolarMutexGuard aGuard;
     if(!pxPrintSettings)
     {
-        ((SwXModule*)this)->pxPrintSettings = new Reference< XPropertySet > ;
+        static_cast<SwXModule*>(this)->pxPrintSettings = new Reference< XPropertySet > ;
         OSL_FAIL("Web or Text?");
         *pxPrintSettings = static_cast < HelperBaseNoState * > ( new SwXPrintSettings ( PRINT_SETTINGS_MODULE ) );
     }
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index 50dc5f8..e6a5f9b 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -636,7 +636,7 @@ Reference< XIndexAccess >  SwXTextDocument::getNumberingRules(void) throw( Runti
         throw RuntimeException();
     if(!pxXNumberingRules )
     {
-        ((SwXTextDocument*)this)->pxXNumberingRules = new Reference< XIndexAccess > ;
+        static_cast<SwXTextDocument*>(this)->pxXNumberingRules = new Reference< XIndexAccess > ;
         *pxXNumberingRules = new SwXNumberingRulesCollection( pDocShell->GetDoc() );
     }
     return *pxXNumberingRules;
@@ -649,7 +649,7 @@ Reference< XIndexAccess >  SwXTextDocument::getFootnotes(void) throw( RuntimeExc
         throw RuntimeException();
     if(!pxXFootnotes)
     {
-        ((SwXTextDocument*)this)->pxXFootnotes = new Reference< XIndexAccess > ;
+        static_cast<SwXTextDocument*>(this)->pxXFootnotes = new Reference< XIndexAccess > ;
         *pxXFootnotes = new SwXFootnotes(false, pDocShell->GetDoc());
     }
     return *pxXFootnotes;
@@ -663,7 +663,7 @@ Reference< XPropertySet >  SAL_CALL
         throw RuntimeException();
     if(!pxXFootnoteSettings)
     {
-        ((SwXTextDocument*)this)->pxXFootnoteSettings = new Reference< XPropertySet > ;
+        static_cast<SwXTextDocument*>(this)->pxXFootnoteSettings = new Reference< XPropertySet > ;
         *pxXFootnoteSettings = new SwXFootnoteProperties(pDocShell->GetDoc());
     }
     return *pxXFootnoteSettings;
@@ -676,7 +676,7 @@ Reference< XIndexAccess >  SwXTextDocument::getEndnotes(void) throw( RuntimeExce
         throw RuntimeException();
     if(!pxXEndnotes)
     {
-        ((SwXTextDocument*)this)->pxXEndnotes = new Reference< XIndexAccess > ;
+        static_cast<SwXTextDocument*>(this)->pxXEndnotes = new Reference< XIndexAccess > ;
         *pxXEndnotes = new SwXFootnotes(true, pDocShell->GetDoc());
     }
     return *pxXEndnotes;
@@ -689,7 +689,7 @@ Reference< XPropertySet >  SwXTextDocument::getEndnoteSettings(void) throw( Runt
         throw RuntimeException();
     if(!pxXEndnoteSettings)
     {
-        ((SwXTextDocument*)this)->pxXEndnoteSettings = new Reference< XPropertySet > ;
+        static_cast<SwXTextDocument*>(this)->pxXEndnoteSettings = new Reference< XPropertySet > ;
         *pxXEndnoteSettings = new SwXEndnoteProperties(pDocShell->GetDoc());
     }
     return *pxXEndnoteSettings;
@@ -1225,7 +1225,7 @@ Reference< XNameAccess >  SwXTextDocument::getReferenceMarks(void)
         throw RuntimeException();
     if(!pxXReferenceMarks)
     {
-        ((SwXTextDocument*)this)->pxXReferenceMarks = new Reference< XNameAccess > ;
+        static_cast<SwXTextDocument*>(this)->pxXReferenceMarks = new Reference< XNameAccess > ;
         *pxXReferenceMarks = new SwXReferenceMarks(pDocShell->GetDoc());
     }
     return *pxXReferenceMarks;
@@ -1238,7 +1238,7 @@ Reference< XEnumerationAccess >  SwXTextDocument::getTextFields(void) throw( Run
         throw RuntimeException();
     if(!pxXTextFieldTypes)
     {
-        ((SwXTextDocument*)this)->pxXTextFieldTypes = new Reference< XEnumerationAccess > ;
+        static_cast<SwXTextDocument*>(this)->pxXTextFieldTypes = new Reference< XEnumerationAccess > ;
         *pxXTextFieldTypes = new SwXTextFieldTypes(pDocShell->GetDoc());
     }
     return *pxXTextFieldTypes;
@@ -1252,7 +1252,7 @@ Reference< XNameAccess >  SwXTextDocument::getTextFieldMasters(void)
         throw RuntimeException();
     if(!pxXTextFieldMasters)
     {
-        ((SwXTextDocument*)this)->pxXTextFieldMasters = new Reference< XNameAccess > ;
+        static_cast<SwXTextDocument*>(this)->pxXTextFieldMasters = new Reference< XNameAccess > ;
         *pxXTextFieldMasters = new SwXTextFieldMasters(pDocShell->GetDoc());
     }
     return *pxXTextFieldMasters;
@@ -1265,7 +1265,7 @@ Reference< XNameAccess >  SwXTextDocument::getEmbeddedObjects(void) throw( Runti
         throw RuntimeException();
     if(!pxXEmbeddedObjects)
     {
-        ((SwXTextDocument*)this)->pxXEmbeddedObjects = new Reference< XNameAccess > ;
+        static_cast<SwXTextDocument*>(this)->pxXEmbeddedObjects = new Reference< XNameAccess > ;
         *pxXEmbeddedObjects = new SwXTextEmbeddedObjects(pDocShell->GetDoc());
     }
     return *pxXEmbeddedObjects;
@@ -1278,7 +1278,7 @@ Reference< XNameAccess >  SwXTextDocument::getBookmarks(void) throw( RuntimeExce
         throw RuntimeException();
     if(!pxXBookmarks)
     {
-        ((SwXTextDocument*)this)->pxXBookmarks = new Reference< XNameAccess > ;
+        static_cast<SwXTextDocument*>(this)->pxXBookmarks = new Reference< XNameAccess > ;
         *pxXBookmarks = new SwXBookmarks(pDocShell->GetDoc());
     }
     return *pxXBookmarks;
@@ -1291,7 +1291,7 @@ Reference< XNameAccess >  SwXTextDocument::getTextSections(void) throw( RuntimeE
         throw RuntimeException();
     if(!pxXTextSections)
     {
-        ((SwXTextDocument*)this)->pxXTextSections = new Reference< XNameAccess > ;
+        static_cast<SwXTextDocument*>(this)->pxXTextSections = new Reference< XNameAccess > ;
         *pxXTextSections = new SwXTextSections(pDocShell->GetDoc());
     }
     return *pxXTextSections;
@@ -1304,7 +1304,7 @@ Reference< XNameAccess >  SwXTextDocument::getTextTables(void) throw( RuntimeExc
         throw RuntimeException();
     if(!pxXTextTables)
     {
-        ((SwXTextDocument*)this)->pxXTextTables = new Reference< XNameAccess > ;
+        static_cast<SwXTextDocument*>(this)->pxXTextTables = new Reference< XNameAccess > ;
         *pxXTextTables = new SwXTextTables(pDocShell->GetDoc());
     }
     return *pxXTextTables;
@@ -1317,7 +1317,7 @@ Reference< XNameAccess >  SwXTextDocument::getGraphicObjects(void) throw( Runtim
         throw RuntimeException();
     if(!pxXGraphicObjects)
     {
-        ((SwXTextDocument*)this)->pxXGraphicObjects = new Reference< XNameAccess > ;
+        static_cast<SwXTextDocument*>(this)->pxXGraphicObjects = new Reference< XNameAccess > ;
         *pxXGraphicObjects = new SwXTextGraphicObjects(pDocShell->GetDoc());
     }
     return *pxXGraphicObjects;
@@ -1330,7 +1330,7 @@ Reference< XNameAccess >  SwXTextDocument::getTextFrames(void) throw( RuntimeExc
         throw RuntimeException();
     if(!pxXTextFrames)
     {
-        ((SwXTextDocument*)this)->pxXTextFrames = new Reference< XNameAccess > ;
+        static_cast<SwXTextDocument*>(this)->pxXTextFrames = new Reference< XNameAccess > ;
         *pxXTextFrames = new SwXTextFrames(pDocShell->GetDoc());
     }
     return *pxXTextFrames;
@@ -1343,7 +1343,7 @@ Reference< XNameAccess >  SwXTextDocument::getStyleFamilies(void) throw( Runtime
         throw RuntimeException();
     if(!pxXStyleFamilies)
     {
-        ((SwXTextDocument*)this)->pxXStyleFamilies = new Reference< XNameAccess > ;
+        static_cast<SwXTextDocument*>(this)->pxXStyleFamilies = new Reference< XNameAccess > ;
         *pxXStyleFamilies = new SwXStyleFamilies(*pDocShell);
     }
     return *pxXStyleFamilies;
@@ -1371,8 +1371,8 @@ Reference< drawing::XDrawPage >  SwXTextDocument::getDrawPage(void) throw( Runti
         throw RuntimeException();
     if(!pxXDrawPage)
     {
-        ((SwXTextDocument*)this)->pDrawPage = new SwXDrawPage(pDocShell->GetDoc());
-        ((SwXTextDocument*)this)->pxXDrawPage = new Reference< drawing::XDrawPage >(pDrawPage);
+        static_cast<SwXTextDocument*>(this)->pDrawPage = new SwXDrawPage(pDocShell->GetDoc());
+        static_cast<SwXTextDocument*>(this)->pxXDrawPage = new Reference< drawing::XDrawPage >(pDrawPage);
         // Create a Reference to trigger the complete initialization of the
         // object. Otherwise in some corner cases it would get initialized
         // at ::InitNewDoc -> which would get called during
@@ -1428,7 +1428,7 @@ void    SwXTextDocument::InitNewDoc()
     if(pxXTextTables)
     {
          XNameAccess* pTbls = pxXTextTables->get();
-        ((SwXTextTables*)pTbls)->Invalidate();
+        static_cast<SwXTextTables*>(pTbls)->Invalidate();
         delete pxXTextTables;
         pxXTextTables = 0;
     }
@@ -1436,7 +1436,7 @@ void    SwXTextDocument::InitNewDoc()
     if(pxXTextFrames)
     {
          XNameAccess* pFrms = pxXTextFrames->get();
-        ((SwXTextFrames*)pFrms)->Invalidate();
+        static_cast<SwXTextFrames*>(pFrms)->Invalidate();
         delete pxXTextFrames;
         pxXTextFrames = 0;
     }
@@ -1444,7 +1444,7 @@ void    SwXTextDocument::InitNewDoc()
     if(pxXGraphicObjects)
     {
          XNameAccess* pFrms = pxXGraphicObjects->get();
-        ((SwXTextGraphicObjects*)pFrms)->Invalidate();
+        static_cast<SwXTextGraphicObjects*>(pFrms)->Invalidate();
         delete pxXGraphicObjects;
         pxXGraphicObjects = 0;
     }
@@ -1452,7 +1452,7 @@ void    SwXTextDocument::InitNewDoc()
     if(pxXEmbeddedObjects)
     {
      XNameAccess* pOLE = pxXEmbeddedObjects->get();
-        ((SwXTextEmbeddedObjects*)pOLE)->Invalidate();
+        static_cast<SwXTextEmbeddedObjects*>(pOLE)->Invalidate();
         delete pxXEmbeddedObjects;
         pxXEmbeddedObjects = 0;
     }
@@ -1483,7 +1483,7 @@ void    SwXTextDocument::InitNewDoc()
     if(pxXTextFieldTypes)
     {
          XEnumerationAccess* pT = pxXTextFieldTypes->get();
-        ((SwXTextFieldTypes*)pT)->Invalidate();
+        static_cast<SwXTextFieldTypes*>(pT)->Invalidate();
         delete pxXTextFieldTypes;
         pxXTextFieldTypes = 0;
     }
@@ -1491,7 +1491,7 @@ void    SwXTextDocument::InitNewDoc()
     if(pxXTextFieldMasters)
     {
          XNameAccess* pT = pxXTextFieldMasters->get();
-        ((SwXTextFieldMasters*)pT)->Invalidate();
+        static_cast<SwXTextFieldMasters*>(pT)->Invalidate();
         delete pxXTextFieldMasters;
         pxXTextFieldMasters = 0;
     }
@@ -1499,7 +1499,7 @@ void    SwXTextDocument::InitNewDoc()
     if(pxXTextSections)
     {
          XNameAccess* pSect = pxXTextSections->get();
-        ((SwXTextSections*)pSect)->Invalidate();
+        static_cast<SwXTextSections*>(pSect)->Invalidate();
         delete pxXTextSections;
         pxXTextSections = 0;
     }
@@ -1518,7 +1518,7 @@ void    SwXTextDocument::InitNewDoc()
     if ( pxXNumberingRules )
     {
         XIndexAccess* pNum = pxXNumberingRules->get();
-        ((SwXNumberingRulesCollection*)pNum)->Invalidate();
+        static_cast<SwXNumberingRulesCollection*>(pNum)->Invalidate();
         delete pxXNumberingRules;
         pxXNumberingRules = 0;
     }
@@ -1526,7 +1526,7 @@ void    SwXTextDocument::InitNewDoc()
     if(pxXFootnotes)
     {
          XIndexAccess* pFtn = pxXFootnotes->get();
-        ((SwXFootnotes*)pFtn)->Invalidate();
+        static_cast<SwXFootnotes*>(pFtn)->Invalidate();
         delete pxXFootnotes;
         pxXFootnotes = 0;
     }
@@ -1534,7 +1534,7 @@ void    SwXTextDocument::InitNewDoc()
     if(pxXEndnotes)
     {
          XIndexAccess* pFtn = pxXEndnotes->get();
-        ((SwXFootnotes*)pFtn)->Invalidate();
+        static_cast<SwXFootnotes*>(pFtn)->Invalidate();
         delete pxXEndnotes;
         pxXEndnotes = 0;
     }
@@ -1542,7 +1542,7 @@ void    SwXTextDocument::InitNewDoc()
     if(pxXDocumentIndexes)
     {
          XIndexAccess* pIdxs = pxXDocumentIndexes->get();
-        ((SwXDocumentIndexes*)pIdxs)->Invalidate();
+        static_cast<SwXDocumentIndexes*>(pIdxs)->Invalidate();
         delete pxXDocumentIndexes;
         pxXDocumentIndexes = 0;
     }
@@ -1550,14 +1550,14 @@ void    SwXTextDocument::InitNewDoc()
     if(pxXStyleFamilies)
     {
          XNameAccess* pStyles = pxXStyleFamilies->get();
-        ((SwXStyleFamilies*)pStyles)->Invalidate();
+        static_cast<SwXStyleFamilies*>(pStyles)->Invalidate();
         delete pxXStyleFamilies;
         pxXStyleFamilies = 0;
     }
     if(pxXAutoStyles)
     {
          XNameAccess* pStyles = pxXAutoStyles->get();
-        ((SwXAutoStyles*)pStyles)->Invalidate();
+        static_cast<SwXAutoStyles*>(pStyles)->Invalidate();
         delete pxXAutoStyles;
         pxXAutoStyles = 0;
     }
@@ -1565,7 +1565,7 @@ void    SwXTextDocument::InitNewDoc()
     if(pxXBookmarks)
     {
          XNameAccess* pBm = pxXBookmarks->get();
-        ((SwXBookmarks*)pBm)->Invalidate();
+        static_cast<SwXBookmarks*>(pBm)->Invalidate();
         delete pxXBookmarks;
         pxXBookmarks = 0;
     }
@@ -1573,7 +1573,7 @@ void    SwXTextDocument::InitNewDoc()
     if(pxXChapterNumbering)
     {
          XIndexReplace* pCh = pxXChapterNumbering->get();
-        ((SwXChapterNumbering*)pCh)->Invalidate();
+        static_cast<SwXChapterNumbering*>(pCh)->Invalidate();
         delete pxXChapterNumbering;
         pxXChapterNumbering = 0;
     }
@@ -1581,7 +1581,7 @@ void    SwXTextDocument::InitNewDoc()
     if(pxXFootnoteSettings)
     {
          XPropertySet* pFntSet = pxXFootnoteSettings->get();
-        ((SwXFootnoteProperties*)pFntSet)->Invalidate();
+        static_cast<SwXFootnoteProperties*>(pFntSet)->Invalidate();
         delete pxXFootnoteSettings;
         pxXFootnoteSettings = 0;
     }
@@ -1589,7 +1589,7 @@ void    SwXTextDocument::InitNewDoc()
     if(pxXEndnoteSettings)
     {
          XPropertySet* pEndSet = pxXEndnoteSettings->get();
-        ((SwXEndnoteProperties*)pEndSet)->Invalidate();
+        static_cast<SwXEndnoteProperties*>(pEndSet)->Invalidate();
         delete pxXEndnoteSettings;
         pxXEndnoteSettings = 0;
     }
@@ -1597,28 +1597,28 @@ void    SwXTextDocument::InitNewDoc()
     if(pxXLineNumberingProperties)
     {
          XPropertySet* pLine = pxXLineNumberingProperties->get();
-        ((SwXLineNumberingProperties*)pLine)->Invalidate();
+        static_cast<SwXLineNumberingProperties*>(pLine)->Invalidate();
         delete pxXLineNumberingProperties;
         pxXLineNumberingProperties = 0;
     }
     if(pxXReferenceMarks)
     {
          XNameAccess* pMarks = pxXReferenceMarks->get();
-        ((SwXReferenceMarks*)pMarks)->Invalidate();
+        static_cast<SwXReferenceMarks*>(pMarks)->Invalidate();
         delete pxXReferenceMarks;
         pxXReferenceMarks = 0;
     }
     if(pxLinkTargetSupplier)
     {
          XNameAccess* pAccess = (*pxLinkTargetSupplier).get();
-        ((SwXLinkTargetSupplier*)pAccess)->Invalidate();
+        static_cast<SwXLinkTargetSupplier*>(pAccess)->Invalidate();
         delete pxLinkTargetSupplier;
         pxLinkTargetSupplier = 0;
     }
     if(pxXRedlines)
     {
         XEnumerationAccess* pMarks = pxXRedlines->get();
-        ((SwXRedlines*)pMarks)->Invalidate();
+        static_cast<SwXRedlines*>(pMarks)->Invalidate();
         delete pxXRedlines;
         pxXRedlines = 0;
     }
@@ -1805,7 +1805,7 @@ Reference< XIndexAccess >  SwXTextDocument::getDocumentIndexes(void) throw( Runt
         throw RuntimeException();
     if(!pxXDocumentIndexes)
     {
-        ((SwXTextDocument*)this)->pxXDocumentIndexes = new Reference< XIndexAccess > ;
+        static_cast<SwXTextDocument*>(this)->pxXDocumentIndexes = new Reference< XIndexAccess > ;
         *pxXDocumentIndexes = new SwXDocumentIndexes(pDocShell->GetDoc());
     }
     return *pxXDocumentIndexes;
@@ -2442,7 +2442,7 @@ SwDoc * SwXTextDocument::GetRenderDoc(
                 }
                 if (xDocSh.Is())
                 {
-                    pDoc = ((SwDocShell*)&xDocSh)->GetDoc();
+                    pDoc = static_cast<SwDocShell*>(&xDocSh)->GetDoc();
                     rpView = pDoc->GetDocShell()->GetView();
                 }
             }
@@ -2540,10 +2540,10 @@ sal_Int32 SAL_CALL SwXTextDocument::getRendererCount(
                 //create a hidden view to be able to export as PDF also in print preview
                 //pView and pSwView are not changed intentionally!
                 m_pHiddenViewFrame = SfxViewFrame::LoadHiddenDocument( *pRenderDocShell, 2 );
-                pViewShell = ((SwView*)m_pHiddenViewFrame->GetViewShell())->GetWrtShellPtr();
+                pViewShell = static_cast<SwView*>(m_pHiddenViewFrame->GetViewShell())->GetWrtShellPtr();
             }
             else
-                pViewShell = ((SwPagePreview*)pView)->GetViewShell();
+                pViewShell = static_cast<SwPagePreview*>(pView)->GetViewShell();
         }
 
         if (!pViewShell || !pViewShell->GetLayout())
@@ -2705,7 +2705,7 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SwXTextDocument::getRenderer(
     if ( pSwView )
         pVwSh = pSwView->GetWrtShellPtr();
     else
-        pVwSh = ((SwPagePreview*)pView)->GetViewShell();
+        pVwSh = static_cast<SwPagePreview*>(pView)->GetViewShell();
 
     sal_Int32 nMaxRenderer = 0;
     if (!bIsSwSrcView && m_pRenderData)
@@ -2994,7 +2994,7 @@ void SAL_CALL SwXTextDocument::render(
                     if ( pSwView )
                         pVwSh = pSwView->GetWrtShellPtr();
                     else
-                        pVwSh = ((SwPagePreview*)pView)->GetViewShell();
+                        pVwSh = static_cast<SwPagePreview*>(pView)->GetViewShell();
                 }
 
                 // get output device to use
@@ -3021,7 +3021,7 @@ void SAL_CALL SwXTextDocument::render(
                     // the pdf file are collected, which are evaulated during painting.
 
                     SwWrtShell* pWrtShell = pView->IsA(aSwViewTypeId) ?
-                                            ((SwView*)pView)->GetWrtShellPtr() :
+                                            static_cast<SwView*>(pView)->GetWrtShellPtr() :
                                             0;
 
                     SwPrintData const& rSwPrtOptions =
diff --git a/sw/source/uibase/uno/unotxvw.cxx b/sw/source/uibase/uno/unotxvw.cxx
index 8d31246..e4fe032 100644
--- a/sw/source/uibase/uno/unotxvw.cxx
+++ b/sw/source/uibase/uno/unotxvw.cxx
@@ -114,7 +114,7 @@ void SwXTextView::Invalidate()
     if(pxTextViewCursor)
     {
         text::XTextViewCursor* pCrsr = pxTextViewCursor->get();
-        ((SwXTextViewCursor*)pCrsr)->Invalidate();
+        static_cast<SwXTextViewCursor*>(pCrsr)->Invalidate();
         DELETEZ(pxTextViewCursor);
     }
 
@@ -502,7 +502,7 @@ uno::Reference< text::XTextViewCursor >  SwXTextView::getViewCursor(void) throw(
     {
         if(!pxTextViewCursor)
         {
-            ((SwXTextView*)this)->pxTextViewCursor = new uno::Reference< text::XTextViewCursor > ;
+            static_cast<SwXTextView*>(this)->pxTextViewCursor = new uno::Reference< text::XTextViewCursor > ;
             *pxTextViewCursor = new  SwXTextViewCursor(GetView());
         }
         return *pxTextViewCursor;
@@ -518,7 +518,7 @@ uno::Reference< beans::XPropertySet >  SwXTextView::getViewSettings(void) throw(
     {
         if(!pxViewSettings)
         {
-            ((SwXTextView*)this)->pxViewSettings = new uno::Reference< beans::XPropertySet > ;
+            static_cast<SwXTextView*>(this)->pxViewSettings = new uno::Reference< beans::XPropertySet > ;
             *pxViewSettings = static_cast < HelperBaseNoState * > ( new SwXViewSettings( false, m_pView ) );
         }
     }
diff --git a/sw/source/uibase/utlui/bookctrl.cxx b/sw/source/uibase/utlui/bookctrl.cxx
index 70a913f..d3ef629 100644
--- a/sw/source/uibase/utlui/bookctrl.cxx
+++ b/sw/source/uibase/utlui/bookctrl.cxx
@@ -78,12 +78,12 @@ void SwBookmarkControl::StateChanged(
         GetStatusBar().SetItemText( GetId(), OUString() );
     else if ( pState->ISA( SfxStringItem ) )
     {
-        sPageNumber = ((SfxStringItem*)pState)->GetValue();
+        sPageNumber = static_cast<const SfxStringItem*>(pState)->GetValue();
         GetStatusBar().SetItemText( GetId(), sPageNumber );
     }
     else if ( pState->ISA( SfxBoolItem ) )
     {
-        if (((SfxBoolItem*)pState)->GetValue()) // Indicates whether to show extended tooltip
+        if (static_cast<const SfxBoolItem*>(pState)->GetValue()) // Indicates whether to show extended tooltip
             GetStatusBar().SetQuickHelpText(GetId(), SW_RESSTR(STR_BOOKCTRL_HINT_EXTENDED));
         else
             GetStatusBar().SetQuickHelpText(GetId(), SW_RESSTR(STR_BOOKCTRL_HINT));
diff --git a/sw/source/uibase/utlui/glbltree.cxx b/sw/source/uibase/utlui/glbltree.cxx
index 5730f82..1176dd3 100644
--- a/sw/source/uibase/utlui/glbltree.cxx
+++ b/sw/source/uibase/utlui/glbltree.cxx
@@ -431,10 +431,10 @@ sal_uInt16  SwGlobalTree::GetEnableFlags() const
     if(nSelCount == 1)
     {
         nRet |= ENABLE_EDIT;
-        if (pEntry && ((SwGlblDocContent*)pEntry->GetUserData())->GetType() != GLBLDOC_UNKNOWN &&
-                    (!pPrevEntry || ((SwGlblDocContent*)pPrevEntry->GetUserData())->GetType() != GLBLDOC_UNKNOWN))
+        if (pEntry && static_cast<SwGlblDocContent*>(pEntry->GetUserData())->GetType() != GLBLDOC_UNKNOWN &&
+                    (!pPrevEntry || static_cast<SwGlblDocContent*>(pPrevEntry->GetUserData())->GetType() != GLBLDOC_UNKNOWN))
             nRet |= ENABLE_INSERT_TEXT;
-        if (pEntry && GLBLDOC_SECTION == ((SwGlblDocContent*)pEntry->GetUserData())->GetType())
+        if (pEntry && GLBLDOC_SECTION == static_cast<SwGlblDocContent*>(pEntry->GetUserData())->GetType())
             nRet |= ENABLE_EDIT_LINK;
     }
     else if(!nEntryCount)
@@ -792,7 +792,7 @@ void    SwGlobalTree::ExcecuteContextMenuAction( sal_uInt16 nSelectedPopupEntry
                 if(GLBLDOC_SECTION == pContent->GetType() &&
                     pContent->GetSection()->IsConnected())
                 {
-                    ((SwSection*)pContent->GetSection())->UpdateNow();
+                    const_cast<SwSection*>(pContent->GetSection())->UpdateNow();
                 }
 
                 pSelEntry = NextSelected(pSelEntry);
diff --git a/sw/source/uibase/utlui/navipi.cxx b/sw/source/uibase/utlui/navipi.cxx
index 005e204..2909385 100644
--- a/sw/source/uibase/utlui/navipi.cxx
+++ b/sw/source/uibase/utlui/navipi.cxx
@@ -423,7 +423,7 @@ void SwNavHelpToolBox::MouseButtonDown(const MouseEvent &rEvt)
     if(rEvt.GetButtons() == MOUSE_LEFT &&
             FN_CREATE_NAVIGATION == GetItemId(rEvt.GetPosPixel()))
     {
-        ((SwNavigationPI*)GetParent())->CreateNavigationTool(GetItemRect(FN_CREATE_NAVIGATION), false, this);
+        static_cast<SwNavigationPI*>(GetParent())->CreateNavigationTool(GetItemRect(FN_CREATE_NAVIGATION), false, this);
     }
     else
         SwHelpToolBox::MouseButtonDown(rEvt);
@@ -547,8 +547,8 @@ void SwNavigationPI::_ZoomOut()
         bIsZoomedIn = false;
         Size aSz(GetOutputSizePixel());
         aSz.Height() = nZoomOut;
-        Size aMinOutSizePixel = ((SfxDockingWindow*)GetParent())->GetMinOutputSizePixel();
-        ((SfxDockingWindow*)GetParent())->SetMinOutputSizePixel(Size(
+        Size aMinOutSizePixel = static_cast<SfxDockingWindow*>(GetParent())->GetMinOutputSizePixel();
+        static_cast<SfxDockingWindow*>(GetParent())->SetMinOutputSizePixel(Size(
                             aMinOutSizePixel.Width(),nZoomOutInit));
         if (pFloat != NULL)
             pFloat->SetOutputSizePixel(aSz);
@@ -587,8 +587,8 @@ void SwNavigationPI::_ZoomIn()
                 nZoomOut = ( short ) aSz.Height();
 
             aSz.Height() = nZoomIn;
-            Size aMinOutSizePixel = ((SfxDockingWindow*)GetParent())->GetMinOutputSizePixel();
-            ((SfxDockingWindow*)GetParent())->SetMinOutputSizePixel(Size(
+            Size aMinOutSizePixel = static_cast<SfxDockingWindow*>(GetParent())->GetMinOutputSizePixel();
+            static_cast<SfxDockingWindow*>(GetParent())->SetMinOutputSizePixel(Size(
                     aMinOutSizePixel.Width(), aSz.Height()));
             pFloat->SetOutputSizePixel(aSz);
             SvTreeListEntry* pFirst = aContentTree.FirstSelected();
@@ -999,7 +999,7 @@ void SwNavigationPI::Notify( SfxBroadcaster& rBrdc, const SfxHint& rHint )
 {
     if(&rBrdc == pCreateView)
     {
-        if(dynamic_cast<const SfxSimpleHint*>(&rHint) && ((SfxSimpleHint&)rHint).GetId() == SFX_HINT_DYING)
+        if(dynamic_cast<const SfxSimpleHint*>(&rHint) && static_cast<const SfxSimpleHint&>(rHint).GetId() == SFX_HINT_DYING)
         {
             pCreateView = 0;
         }
@@ -1009,11 +1009,11 @@ void SwNavigationPI::Notify( SfxBroadcaster& rBrdc, const SfxHint& rHint )
         if(dynamic_cast<const SfxEventHint*>(&rHint))
         {
             if( pxObjectShell &&
-                        ((SfxEventHint&) rHint).GetEventId() == SFX_EVENT_CLOSEAPP)
+                        static_cast<const SfxEventHint&>( rHint).GetEventId() == SFX_EVENT_CLOSEAPP)
             {
                 DELETEZ(pxObjectShell);
             }
-            else if(((SfxEventHint&) rHint).GetEventId() == SFX_EVENT_OPENDOC)
+            else if(static_cast<const SfxEventHint&>( rHint).GetEventId() == SFX_EVENT_OPENDOC)
             {
 
                 SwView *pActView = GetCreateView();
@@ -1310,8 +1310,8 @@ SwView*  SwNavigationPI::GetCreateView() const
         {
             if(&pView->GetViewFrame()->GetBindings() == &rBindings)
             {
-                ((SwNavigationPI*)this)->pCreateView = pView;
-                ((SwNavigationPI*)this)->StartListening(*pCreateView);
+                const_cast<SwNavigationPI*>(this)->pCreateView = pView;
+                const_cast<SwNavigationPI*>(this)->StartListening(*pCreateView);
                 break;
             }
             pView = SwModule::GetNextView(pView);
diff --git a/sw/source/uibase/utlui/tmplctrl.cxx b/sw/source/uibase/utlui/tmplctrl.cxx
index 1046b05..ab06c0d 100644
--- a/sw/source/uibase/utlui/tmplctrl.cxx
+++ b/sw/source/uibase/utlui/tmplctrl.cxx
@@ -78,7 +78,7 @@ void SwTemplateControl::StateChanged(
         GetStatusBar().SetItemText( GetId(), OUString() );
     else if ( pState->ISA( SfxStringItem ) )
     {
-        sTemplate = ((SfxStringItem*)pState)->GetValue();
+        sTemplate = static_cast<const SfxStringItem*>(pState)->GetValue();
         GetStatusBar().SetItemText( GetId(), sTemplate );
     }
 }
diff --git a/sw/source/uibase/utlui/uiitems.cxx b/sw/source/uibase/utlui/uiitems.cxx
index 0f7fa70..cdede9c 100644
--- a/sw/source/uibase/utlui/uiitems.cxx
+++ b/sw/source/uibase/utlui/uiitems.cxx
@@ -56,7 +56,7 @@ SfxPoolItem*  SwPageFtnInfoItem::Clone( SfxItemPool * /*pPool*/ ) const
 bool SwPageFtnInfoItem::operator==( const SfxPoolItem& rAttr ) const
 {
     OSL_ENSURE( Which() == rAttr.Which(), "no equal attributes" );
-    return ( aFtnInfo == ((SwPageFtnInfoItem&)rAttr).GetPageFtnInfo());
+    return ( aFtnInfo == static_cast<const SwPageFtnInfoItem&>(rAttr).GetPageFtnInfo());
 }
 
 bool  SwPageFtnInfoItem::GetPresentation
@@ -245,7 +245,7 @@ SfxPoolItem*  SwUINumRuleItem::Clone( SfxItemPool * /*pPool*/ ) const
 bool SwUINumRuleItem::operator==( const SfxPoolItem& rAttr ) const
 {
     assert(SfxPoolItem::operator==(rAttr));
-    return *pRule == *((SwUINumRuleItem&)rAttr).pRule;
+    return *pRule == *static_cast<const SwUINumRuleItem&>(rAttr).pRule;
 }
 
 bool SwUINumRuleItem::QueryValue( uno::Any& rVal, sal_uInt8 /*nMemberId*/ ) const
diff --git a/sw/source/uibase/utlui/wordcountctrl.cxx b/sw/source/uibase/utlui/wordcountctrl.cxx
index 58fe4b4..1ca297b 100644
--- a/sw/source/uibase/utlui/wordcountctrl.cxx
+++ b/sw/source/uibase/utlui/wordcountctrl.cxx
@@ -30,7 +30,7 @@ void SwWordCountStatusBarControl::StateChanged(
     sal_uInt16 /*nSID*/, SfxItemState eState, const SfxPoolItem* pState )
 {
     if (eState == SfxItemState::DEFAULT) // Can access pState
-        GetStatusBar().SetItemText( GetId(), ((SfxStringItem*)pState)->GetValue() );
+        GetStatusBar().SetItemText( GetId(), static_cast<const SfxStringItem*>(pState)->GetValue() );
 
     GetStatusBar().SetQuickHelpText(GetId(), SW_RESSTR(STR_WORDCOUNT_HINT));
 }
diff --git a/sw/source/uibase/wrtsh/wrtsh1.cxx b/sw/source/uibase/wrtsh/wrtsh1.cxx
index d49ce12..8841f0c 100644
--- a/sw/source/uibase/wrtsh/wrtsh1.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh1.cxx
@@ -579,12 +579,12 @@ void SwWrtShell::LaunchOLEObj( long nVerb )
         if ( !pCli )
             pCli = new SwOleClient( &GetView(), &GetView().GetEditWin(), xRef );
 
-        ((SwOleClient*)pCli)->SetInDoVerb( true );
+        static_cast<SwOleClient*>(pCli)->SetInDoVerb( true );
 
         CalcAndSetScale( xRef );
         pCli->DoVerb( nVerb );
 
-        ((SwOleClient*)pCli)->SetInDoVerb( false );
+        static_cast<SwOleClient*>(pCli)->SetInDoVerb( false );
         CalcAndSetScale( xRef );
     }
 }
@@ -1351,7 +1351,7 @@ SelectionType SwWrtShell::GetSelectionType() const
     if ( BasicActionPend() )
         return IsSelFrmMode() ? nsSelectionType::SEL_FRM : nsSelectionType::SEL_TXT;
 
-    SwView &_rView = ((SwView&)GetView());
+    SwView &_rView = const_cast<SwView&>(GetView());
     if (_rView.GetPostItMgr() && _rView.GetPostItMgr()->HasActiveSidebarWin() )
         return nsSelectionType::SEL_POSTIT;
 
diff --git a/sw/source/uibase/wrtsh/wrtsh2.cxx b/sw/source/uibase/wrtsh/wrtsh2.cxx
index 786ce99..98f6830 100644
--- a/sw/source/uibase/wrtsh/wrtsh2.cxx
+++ b/sw/source/uibase/wrtsh/wrtsh2.cxx
@@ -357,8 +357,8 @@ void SwWrtShell::ClickToField( const SwField& rFld )
             if( sRet != sText )
             {
                 StartAllAction();
-                ((SwField&)rFld).SetPar2( sRet );
-                ((SwField&)rFld).GetTyp()->UpdateFlds();
+                const_cast<SwField&>(rFld).SetPar2( sRet );
+                const_cast<SwField&>(rFld).GetTyp()->UpdateFlds();
                 EndAllAction();
             }
         }
@@ -366,9 +366,9 @@ void SwWrtShell::ClickToField( const SwField& rFld )
 
     case RES_GETREFFLD:
         StartAllAction();
-        SwCrsrShell::GotoRefMark( ((SwGetRefField&)rFld).GetSetRefName(),
-                                    ((SwGetRefField&)rFld).GetSubType(),
-                                    ((SwGetRefField&)rFld).GetSeqNo() );
+        SwCrsrShell::GotoRefMark( static_cast<const SwGetRefField&>(rFld).GetSetRefName(),
+                                    static_cast<const SwGetRefField&>(rFld).GetSubType(),
+                                    static_cast<const SwGetRefField&>(rFld).GetSeqNo() );
         EndAllAction();
         break;
 
@@ -383,7 +383,7 @@ void SwWrtShell::ClickToField( const SwField& rFld )
         break;
 
     case RES_SETEXPFLD:
-        if( ((SwSetExpField&)rFld).GetInputFlag() )
+        if( static_cast<const SwSetExpField&>(rFld).GetInputFlag() )
             StartInputFldDlg( (SwField*)&rFld, false );
         break;
     case RES_DROPDOWN :
commit 9409b2eb454118eab93542d4dfb464b723b219e2
Author: Noel Grandin <noel at peralex.com>
Date:   Mon Nov 24 10:40:18 2014 +0200

    loplugin: cstylecast
    
    Change-Id: I030208a86a60609b0379c00957538677fac15ccf

diff --git a/sw/source/uibase/ribbar/concustomshape.cxx b/sw/source/uibase/ribbar/concustomshape.cxx
index 0c21879..10f85f6 100644
--- a/sw/source/uibase/ribbar/concustomshape.cxx
+++ b/sw/source/uibase/ribbar/concustomshape.cxx
@@ -83,7 +83,7 @@ bool ConstCustomShape::MouseButtonDown(const MouseEvent& rMEvt)
             {
                 SetAttributes( pObj );
                 bool bForceNoFillStyle = false;
-                if ( ((SdrObjCustomShape*)pObj)->UseNoFillStyle() )
+                if ( static_cast<SdrObjCustomShape*>(pObj)->UseNoFillStyle() )
                     bForceNoFillStyle = true;
 
                 SfxItemSet aAttr( m_pView->GetPool() );
@@ -169,7 +169,7 @@ void ConstCustomShape::SetAttributes( SdrObject* pObj )
         pObj->SetMergedItem( SdrTextVertAdjustItem( SDRTEXTVERTADJUST_CENTER ) );
         pObj->SetMergedItem( SdrTextHorzAdjustItem( SDRTEXTHORZADJUST_BLOCK ) );
         pObj->SetMergedItem( makeSdrTextAutoGrowHeightItem( false ) );
-        ((SdrObjCustomShape*)pObj)->MergeDefaultAttributes( &aCustomShape );
+        static_cast<SdrObjCustomShape*>(pObj)->MergeDefaultAttributes( &aCustomShape );
     }
 }
 
diff --git a/sw/source/uibase/ribbar/inputwin.cxx b/sw/source/uibase/ribbar/inputwin.cxx
index c9cd78a..46f5a15 100644
--- a/sw/source/uibase/ribbar/inputwin.cxx
+++ b/sw/source/uibase/ribbar/inputwin.cxx
@@ -260,7 +260,7 @@ void SwInputWindow::ShowWin()
 
                 SfxItemSet aSet( pWrtShell->GetAttrPool(), RES_BOXATR_FORMULA, RES_BOXATR_FORMULA );
                 if( pWrtShell->GetTblBoxFormulaAttrs( aSet ))
-                    sEdit += ((SwTblBoxFormula&)aSet.Get( RES_BOXATR_FORMULA )).GetFormula();
+                    sEdit += static_cast<const SwTblBoxFormula&>(aSet.Get( RES_BOXATR_FORMULA )).GetFormula();
             }
         }
 
@@ -506,9 +506,9 @@ void InputEdit::KeyInput(const KeyEvent& rEvent)
 {
     const vcl::KeyCode aCode = rEvent.GetKeyCode();
     if(aCode == KEY_RETURN || aCode == KEY_F2 )
-        ((SwInputWindow*)GetParent())->ApplyFormula();
+        static_cast<SwInputWindow*>(GetParent())->ApplyFormula();
     else if(aCode == KEY_ESCAPE )
-        ((SwInputWindow*)GetParent())->CancelFormula();
+        static_cast<SwInputWindow*>(GetParent())->CancelFormula();
     else
         Edit::KeyInput(rEvent);
 }
@@ -617,7 +617,7 @@ SwInputChild::SwInputChild(vcl::Window* _pParent,
 {
     pDispatch = pBindings->GetDispatcher();
     pWindow = new SwInputWindow( _pParent, pBindings );
-    ((SwInputWindow*)pWindow)->ShowWin();
+    static_cast<SwInputWindow*>(pWindow)->ShowWin();
     eChildAlignment = SFX_ALIGN_LOWESTTOP;
 }
 
diff --git a/sw/source/uibase/ribbar/workctrl.cxx b/sw/source/uibase/ribbar/workctrl.cxx
index d191cfd..5cf0161 100644
--- a/sw/source/uibase/ribbar/workctrl.cxx
+++ b/sw/source/uibase/ribbar/workctrl.cxx
@@ -331,7 +331,7 @@ void SwTbxFieldCtrl::StateChanged( sal_uInt16,
     GetToolBox().EnableItem( GetId(), (GetItemState(pState) != SfxItemState::DISABLED) );
     if (eState >= SfxItemState::DEFAULT)
     {
-        GetToolBox().CheckItem( GetId(), ((SfxBoolItem*)pState)->GetValue() );
+        GetToolBox().CheckItem( GetId(), static_cast<const SfxBoolItem*>(pState)->GetValue() );
     }
 }
 
@@ -502,8 +502,8 @@ IMPL_LINK(SwScrollNaviPopup, SelectHdl, ToolBox*, pSet)
 void SwScrollNaviToolBox::MouseButtonUp( const MouseEvent& rMEvt )
 {
     ToolBox::MouseButtonUp(rMEvt);
-    if ( ((SwScrollNaviPopup*)GetParent())->IsInPopupMode() )
-        ((SwScrollNaviPopup*)GetParent())->EndPopupMode( FLOATWIN_POPUPMODEEND_CLOSEALL );
+    if ( static_cast<SwScrollNaviPopup*>(GetParent())->IsInPopupMode() )
+        static_cast<SwScrollNaviPopup*>(GetParent())->EndPopupMode( FLOATWIN_POPUPMODEEND_CLOSEALL );
 }
 
 void  SwScrollNaviToolBox::RequestHelp( const HelpEvent& rHEvt )
diff --git a/sw/source/uibase/shells/annotsh.cxx b/sw/source/uibase/shells/annotsh.cxx
index 172bd26..b746f48 100644
--- a/sw/source/uibase/shells/annotsh.cxx
+++ b/sw/source/uibase/shells/annotsh.cxx
@@ -1455,7 +1455,7 @@ void SwAnnotationShell::ExecUndo(SfxRequest &rReq)
     sal_uInt16 nCnt = 1;
     const SfxPoolItem* pItem=0;
     if( pArgs && SfxItemState::SET == pArgs->GetItemState( nId, false, &pItem ) )
-        nCnt = ((SfxUInt16Item*)pItem)->GetValue();
+        nCnt = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
     switch( nId )
     {
         case SID_UNDO:
diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx
index 9002984..16b666e 100644
--- a/sw/source/uibase/shells/basesh.cxx
+++ b/sw/source/uibase/shells/basesh.cxx
@@ -300,7 +300,7 @@ void SwBaseShell::ExecClpbrd(SfxRequest &rReq)
                         SwView* pView = &rView;
 
                         SwTransferable::PasteFormat( rSh, aDataHelper,
-                                        ((SfxUInt32Item*)pFmt)->GetValue() );
+                                        static_cast<const SfxUInt32Item*>(pFmt)->GetValue() );
 
                         //Done() has to be called before the shell has been removed
                         rReq.Done();
@@ -463,7 +463,7 @@ void SwBaseShell::ExecUndo(SfxRequest &rReq)
     const SfxItemSet* pArgs = rReq.GetArgs();
     const SfxPoolItem* pItem;
     if( pArgs && SfxItemState::SET == pArgs->GetItemState( nId, false, &pItem ))
-        nCnt = ((SfxUInt16Item*)pItem)->GetValue();
+        nCnt = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
 
     // #i106349#: save pointer: undo/redo may delete the shell, i.e., this!
     SfxViewFrame *const pViewFrame( GetView().GetViewFrame() );
@@ -1552,7 +1552,7 @@ void SwBaseShell::GetState( SfxItemSet &rSet )
                         rSh.GetObjAttr(aSet);
                     else
                         rSh.GetFlyFrmAttr(aSet);
-                    RndStdIds eSet = ((SwFmtAnchor&)aSet.Get(RES_ANCHOR)).GetAnchorId();
+                    RndStdIds eSet = static_cast<const SwFmtAnchor&>(aSet.Get(RES_ANCHOR)).GetAnchorId();
                     const bool bSet =
                            ((nWhich == FN_TOOL_ANCHOR_PAGE) &&
                             (eSet == FLY_AT_PAGE))
@@ -1627,7 +1627,7 @@ void SwBaseShell::GetState( SfxItemSet &rSet )
                     else
                     {
                         rSh.GetFlyFrmAttr(aSet);
-                        nAnchorType = ((SwFmtAnchor&)aSet.Get(RES_ANCHOR)).GetAnchorId();
+                        nAnchorType = static_cast<const SwFmtAnchor&>(aSet.Get(RES_ANCHOR)).GetAnchorId();
                     }
                     const SwFmtSurround& rWrap = (const SwFmtSurround&)aSet.Get(RES_SURROUND);
 
diff --git a/sw/source/uibase/shells/drwtxtex.cxx b/sw/source/uibase/shells/drwtxtex.cxx
index c3059ebd..0b8a4da 100644
--- a/sw/source/uibase/shells/drwtxtex.cxx
+++ b/sw/source/uibase/shells/drwtxtex.cxx
@@ -663,7 +663,7 @@ ASK_ADJUST:
                 if( !pAdjust || IsInvalidItem( pAdjust ))
                     rSet.InvalidateItem( nSlotId ), nSlotId = 0;
                 else
-                    bFlag = eAdjust == ((SvxAdjustItem*)pAdjust)->GetAdjust();
+                    bFlag = eAdjust == static_cast<const SvxAdjustItem*>(pAdjust)->GetAdjust();
             }
             break;
 
diff --git a/sw/source/uibase/shells/drwtxtsh.cxx b/sw/source/uibase/shells/drwtxtsh.cxx
index 3ec5c14..a3807e8 100644
--- a/sw/source/uibase/shells/drwtxtsh.cxx
+++ b/sw/source/uibase/shells/drwtxtsh.cxx
@@ -527,7 +527,7 @@ void SwDrawTextShell::ExecUndo(SfxRequest &rReq)
             case SID_UNDO:
             case SID_REDO:
                 if( SfxItemState::SET == pArgs->GetItemState( nId, false, &pItem ) &&
-                    1 < (nCnt = ((SfxUInt16Item*)pItem)->GetValue()) )
+                    1 < (nCnt = static_cast<const SfxUInt16Item*>(pItem)->GetValue()) )
                 {
                     // then we make by ourself.
                     ::svl::IUndoManager* pUndoManager = GetUndoManager();
diff --git a/sw/source/uibase/shells/grfsh.cxx b/sw/source/uibase/shells/grfsh.cxx
index 7407d7f..4fb5744 100644
--- a/sw/source/uibase/shells/grfsh.cxx
+++ b/sw/source/uibase/shells/grfsh.cxx
@@ -356,14 +356,14 @@ void SwGrfShell::Execute(SfxRequest &rReq)
                                 SID_ATTR_GRAF_FRMSIZE, false, &pItem ))
                 {
                     SwFmtFrmSize aSize;
-                    const Size& rSz = ((SvxSizeItem*)pItem)->GetSize();
+                    const Size& rSz = static_cast<const SvxSizeItem*>(pItem)->GetSize();
                     aSize.SetWidth( rSz.Width() );
                     aSize.SetHeight( rSz.Height() );
 
                     if( SfxItemState::SET == pSet->GetItemState(
                             SID_ATTR_GRAF_FRMSIZE_PERCENT, false, &pItem ))
                     {
-                        const Size& rRelativeSize = ((SvxSizeItem*)pItem)->GetSize();
+                        const Size& rRelativeSize = static_cast<const SvxSizeItem*>(pItem)->GetSize();
                         aSize.SetWidthPercent( static_cast< sal_uInt8 >( rRelativeSize.Width() ) );
                         aSize.SetHeightPercent( static_cast< sal_uInt8 >( rRelativeSize.Height() ) );
                     }
@@ -412,13 +412,13 @@ void SwGrfShell::Execute(SfxRequest &rReq)
                 if( SfxItemState::SET == pSet->GetItemState(
                                         SID_ATTR_GRAF_GRAPHIC, true, &pItem ))
                 {
-                    if( !((SvxBrushItem*)pItem)->GetGraphicLink().isEmpty() )
-                        sGrfNm = ((SvxBrushItem*)pItem)->GetGraphicLink();
+                    if( !static_cast<const SvxBrushItem*>(pItem)->GetGraphicLink().isEmpty() )
+                        sGrfNm = static_cast<const SvxBrushItem*>(pItem)->GetGraphicLink();
                     else
                         sGrfNm = "";
 
-                    if( !((SvxBrushItem*)pItem)->GetGraphicFilter().isEmpty() )
-                        sFilterNm = ((SvxBrushItem*)pItem)->GetGraphicFilter();
+                    if( !static_cast<const SvxBrushItem*>(pItem)->GetGraphicFilter().isEmpty() )
+                        sFilterNm = static_cast<const SvxBrushItem*>(pItem)->GetGraphicFilter();
                     else
                         sFilterNm = "";
 
@@ -527,37 +527,37 @@ void SwGrfShell::ExecAttr( SfxRequest &rReq )
         case SID_ATTR_GRAF_LUMINANCE:
             if( pItem )
                 aGrfSet.Put( SwLuminanceGrf(
-                            ((SfxInt16Item*)pItem)->GetValue() ));
+                            static_cast<const SfxInt16Item*>(pItem)->GetValue() ));
             break;
 
         case SID_ATTR_GRAF_CONTRAST:
             if( pItem )
                 aGrfSet.Put( SwContrastGrf(
-                            ((SfxInt16Item*)pItem)->GetValue() ));
+                            static_cast<const SfxInt16Item*>(pItem)->GetValue() ));
             break;
 
         case SID_ATTR_GRAF_RED:
             if( pItem )
                 aGrfSet.Put( SwChannelRGrf(
-                            ((SfxInt16Item*)pItem)->GetValue() ));
+                            static_cast<const SfxInt16Item*>(pItem)->GetValue() ));
             break;
 
         case SID_ATTR_GRAF_GREEN:
             if( pItem )
                 aGrfSet.Put( SwChannelGGrf(
-                            ((SfxInt16Item*)pItem)->GetValue() ));
+                            static_cast<const SfxInt16Item*>(pItem)->GetValue() ));
             break;
 
         case SID_ATTR_GRAF_BLUE:
             if( pItem )
                 aGrfSet.Put( SwChannelBGrf(
-                            ((SfxInt16Item*)pItem)->GetValue() ));
+                            static_cast<const SfxInt16Item*>(pItem)->GetValue() ));
             break;
 
         case SID_ATTR_GRAF_GAMMA:
             if( pItem )
             {
-                double fVal = ((SfxUInt32Item*)pItem)->GetValue();
+                double fVal = static_cast<const SfxUInt32Item*>(pItem)->GetValue();
                 aGrfSet.Put( SwGammaGrf(fVal/100. ));
             }
             break;
@@ -571,13 +571,13 @@ void SwGrfShell::ExecAttr( SfxRequest &rReq )
         case SID_ATTR_GRAF_INVERT:
             if( pItem )
                 aGrfSet.Put( SwInvertGrf(
-                            ((SfxBoolItem*)pItem)->GetValue() ));
+                            static_cast<const SfxBoolItem*>(pItem)->GetValue() ));
             break;
 
         case SID_ATTR_GRAF_MODE:
             if( pItem )
                 aGrfSet.Put( SwDrawModeGrf(
-                            ((SfxUInt16Item*)pItem)->GetValue() ));
+                            static_cast<const SfxUInt16Item*>(pItem)->GetValue() ));
             break;
 
         case SID_COLOR_SETTINGS:
@@ -695,31 +695,31 @@ void SwGrfShell::GetAttrState(SfxItemSet &rSet)
 
         case SID_ATTR_GRAF_LUMINANCE:
             if( !bParentCntProt )
-                rSet.Put( SfxInt16Item( nWhich, ((SwLuminanceGrf&)
+                rSet.Put( SfxInt16Item( nWhich, static_cast<const SwLuminanceGrf&>(
                         aCoreSet.Get(RES_GRFATR_LUMINANCE)).GetValue() ));
             break;
 
         case SID_ATTR_GRAF_CONTRAST:
             if( !bParentCntProt )
-                rSet.Put( SfxInt16Item( nWhich, ((SwContrastGrf&)
+                rSet.Put( SfxInt16Item( nWhich, static_cast<const SwContrastGrf&>(
                         aCoreSet.Get(RES_GRFATR_CONTRAST)).GetValue() ));
             break;
 
         case SID_ATTR_GRAF_RED:
             if( !bParentCntProt )
-                rSet.Put( SfxInt16Item( nWhich, ((SwChannelRGrf&)
+                rSet.Put( SfxInt16Item( nWhich, static_cast<const SwChannelRGrf&>(
                         aCoreSet.Get(RES_GRFATR_CHANNELR)).GetValue() ));
             break;
 
         case SID_ATTR_GRAF_GREEN:
             if( !bParentCntProt )
-                rSet.Put( SfxInt16Item( nWhich, ((SwChannelGGrf&)
+                rSet.Put( SfxInt16Item( nWhich, static_cast<const SwChannelGGrf&>(
                         aCoreSet.Get(RES_GRFATR_CHANNELG)).GetValue() ));
             break;
 
         case SID_ATTR_GRAF_BLUE:
             if( !bParentCntProt )
-                rSet.Put( SfxInt16Item( nWhich, ((SwChannelBGrf&)
+                rSet.Put( SfxInt16Item( nWhich, static_cast<const SwChannelBGrf&>(
                         aCoreSet.Get(RES_GRFATR_CHANNELB)).GetValue() ));
             break;
 
@@ -740,7 +740,7 @@ void SwGrfShell::GetAttrState(SfxItemSet &rSet)
                         GRAPHIC_GDIMETAFILE == pGrafObj->GetType() )
                         bDisable = true;
                     else
-                        rSet.Put( SfxUInt16Item( nWhich, ((SwTransparencyGrf&)
+                        rSet.Put( SfxUInt16Item( nWhich, static_cast<const SwTransparencyGrf&>(
                             aCoreSet.Get(RES_GRFATR_TRANSPARENCY)).GetValue() ));
                 }
             }
@@ -748,13 +748,13 @@ void SwGrfShell::GetAttrState(SfxItemSet &rSet)
 
         case SID_ATTR_GRAF_INVERT:
             if( !bParentCntProt )
-                rSet.Put( SfxBoolItem( nWhich, ((SwInvertGrf&)
+                rSet.Put( SfxBoolItem( nWhich, static_cast<const SwInvertGrf&>(
                         aCoreSet.Get(RES_GRFATR_INVERT)).GetValue() ));
             break;
 
         case SID_ATTR_GRAF_MODE:
             if( !bParentCntProt )
-                rSet.Put( SfxUInt16Item( nWhich, ((SwDrawModeGrf&)
+                rSet.Put( SfxUInt16Item( nWhich, static_cast<const SwDrawModeGrf&>(
                         aCoreSet.Get(RES_GRFATR_DRAWMODE)).GetValue() ));
             break;
 
diff --git a/sw/source/uibase/shells/tabsh.cxx b/sw/source/uibase/shells/tabsh.cxx
index d6992ba..d4fe26b 100644
--- a/sw/source/uibase/shells/tabsh.cxx
+++ b/sw/source/uibase/shells/tabsh.cxx
@@ -279,7 +279,7 @@ void ItemSetToTableParam( const SfxItemSet& rSet,
     if(SfxItemState::SET == rSet.GetItemState(SID_BACKGRND_DESTINATION, false, &pItem))
     {
         SwViewOption aUsrPref( *rSh.GetViewOptions() );
-        aUsrPref.SetTblDest((sal_uInt8)((SfxUInt16Item*)pItem)->GetValue());
+        aUsrPref.SetTblDest((sal_uInt8)static_cast<const SfxUInt16Item*>(pItem)->GetValue());
         SW_MOD()->ApplyUsrPref(aUsrPref, &rSh.GetView());
     }
     bool bBorder = ( SfxItemState::SET == rSet.GetItemState( RES_BOX ) ||
@@ -389,7 +389,7 @@ void ItemSetToTableParam( const SfxItemSet& rSet,
         // The item must only be recorded while manual alignment, so that the
         // alignment is not overwritten by the distances while recording.
         if(eOrient != text::HoriOrientation::NONE)
-            ((SfxItemSet&)rSet).ClearItem( SID_ATTR_LRSPACE );
+            const_cast<SfxItemSet&>(static_cast<const SfxItemSet&>(rSet)).ClearItem( SID_ATTR_LRSPACE );
 
         if(pRep->HasColsChanged())
         {
@@ -398,10 +398,10 @@ void ItemSetToTableParam( const SfxItemSet& rSet,
     }
 
     if( SfxItemState::SET == rSet.GetItemState( FN_PARAM_TABLE_HEADLINE, false, &pItem))
-        rSh.SetRowsToRepeat( ((SfxUInt16Item*)pItem)->GetValue() );
+        rSh.SetRowsToRepeat( static_cast<const SfxUInt16Item*>(pItem)->GetValue() );
 
     if( SfxItemState::SET == rSet.GetItemState( FN_TABLE_SET_VERT_ALIGN, false, &pItem))
-        rSh.SetBoxAlign(((SfxUInt16Item*)(pItem))->GetValue());
+        rSh.SetBoxAlign(static_cast<const SfxUInt16Item*>((pItem))->GetValue());
 
     if( SfxItemState::SET == rSet.GetItemState( FN_PARAM_TABLE_NAME, false, &pItem ))
         rSh.SetTableName( *pFmt, ((const SfxStringItem*)pItem)->GetValue() );
@@ -636,12 +636,12 @@ void SwTableShell::Execute(SfxRequest &rReq)
                 }
                 else
                     aCoreSet.Put( SfxUInt32Item( SID_ATTR_NUMBERFORMAT_VALUE,
-                                    ((SwTblBoxNumFormat&)aBoxSet.Get(
+                                    static_cast<const SwTblBoxNumFormat&>(aBoxSet.Get(
                                     RES_BOXATR_FORMAT )).GetValue() ));
 
                 OUString sCurText( rSh.GetTableBoxText() );
                 aCoreSet.Put( SvxNumberInfoItem( pFormatter,
-                                    ((SwTblBoxValue&)aBoxSet.Get(
+                                    static_cast<const SwTblBoxValue&>(aBoxSet.Get(
                                         RES_BOXATR_VALUE)).GetValue(),
                                     sCurText, SID_ATTR_NUMBERFORMAT_INFO ));
 
@@ -658,13 +658,13 @@ void SwTableShell::Execute(SfxRequest &rReq)
                     const SfxPoolItem* pNumberFormatItem = GetView().GetDocShell()->
                                     GetItem( SID_ATTR_NUMBERFORMAT_INFO );
 
-                    if( pNumberFormatItem && 0 != ((SvxNumberInfoItem*)pNumberFormatItem)->GetDelCount() )
+                    if( pNumberFormatItem && 0 != static_cast<const SvxNumberInfoItem*>(pNumberFormatItem)->GetDelCount() )
                     {
-                        const sal_uInt32* pDelArr = ((SvxNumberInfoItem*)
+                        const sal_uInt32* pDelArr = static_cast<const SvxNumberInfoItem*>(
                                                         pNumberFormatItem)->GetDelArray();
 
-                        for ( sal_uInt32 i = 0; i < ((SvxNumberInfoItem*)pNumberFormatItem)->GetDelCount(); i++ )
-                            ((SvxNumberInfoItem*)pNumberFormatItem)->
+                        for ( sal_uInt32 i = 0; i < static_cast<const SvxNumberInfoItem*>(pNumberFormatItem)->GetDelCount(); i++ )
+                            static_cast<const SvxNumberInfoItem*>(pNumberFormatItem)->
                             GetNumberFormatter()->DeleteEntry( pDelArr[i] );
                     }
 
@@ -674,7 +674,7 @@ void SwTableShell::Execute(SfxRequest &rReq)
                         SfxItemSet aBoxFormatSet( *aCoreSet.GetPool(),
                                     RES_BOXATR_FORMAT, RES_BOXATR_FORMAT );
                         aBoxFormatSet.Put( SwTblBoxNumFormat(
-                                ((SfxUInt32Item*)pNumberFormatItem)->GetValue() ));
+                                static_cast<const SfxUInt32Item*>(pNumberFormatItem)->GetValue() ));
                         rSh.SetTblBoxFormulaAttrs( aBoxFormatSet );
 
                     }
@@ -710,7 +710,7 @@ void SwTableShell::Execute(SfxRequest &rReq)
         {
             bool bAppendLine = true;
             if( pItem )
-                bAppendLine = ((SfxBoolItem*)pItem)->GetValue();
+                bAppendLine = static_cast<const SfxBoolItem*>(pItem)->GetValue();
             rReq.SetReturnValue( SfxBoolItem( nSlot,
                                     rSh.GoNextCell( bAppendLine ) ) );
             bCallDone = true;
diff --git a/sw/source/uibase/shells/textfld.cxx b/sw/source/uibase/shells/textfld.cxx
index e4ba7d8..c38a45e 100644
--- a/sw/source/uibase/shells/textfld.cxx
+++ b/sw/source/uibase/shells/textfld.cxx
@@ -134,7 +134,7 @@ void SwTextShell::ExecField(SfxRequest &rReq)
                 {
                     case TYP_DDEFLD:
                     {
-                        ::sfx2::SvBaseLink& rLink = ((SwDDEFieldType*)pFld->GetTyp())->
+                        ::sfx2::SvBaseLink& rLink = static_cast<SwDDEFieldType*>(pFld->GetTyp())->
                                                 GetBaseLink();
                         if(rLink.IsVisible())
                         {
@@ -166,7 +166,7 @@ void SwTextShell::ExecField(SfxRequest &rReq)
             if(pFld && pFld->GetTyp()->Which() == RES_MACROFLD)
             {
 
-                const OUString& rMacro = ((SwMacroField*)pFld)->GetMacro();
+                const OUString& rMacro = static_cast<SwMacroField*>(pFld)->GetMacro();
                 sal_Int32 nPos = rMacro.indexOf('.');
                 if(nPos != -1)
                 {
@@ -240,7 +240,7 @@ void SwTextShell::ExecField(SfxRequest &rReq)
                     }
                     if( SfxItemState::SET == pArgs->GetItemState(
                                         FN_PARAM_3, false, &pItem ))
-                        nCommand = ((SfxInt32Item*)pItem)->GetValue();
+                        nCommand = static_cast<const SfxInt32Item*>(pItem)->GetValue();
                     aPar1 += OUString(DB_DELIM);
                     aPar1 += OUString::number(nCommand);
                     aPar1 += OUString(DB_DELIM);
@@ -542,7 +542,7 @@ void SwTextShell::ExecField(SfxRequest &rReq)
                 SwFldMgr aMgr;
                 if ( pItem )
                 {
-                    aText = ((SfxStringItem*)pItem)->GetValue();
+                    aText = static_cast<const SfxStringItem*>(pItem)->GetValue();
                     SFX_REQUEST_ARG( rReq, pType, SfxStringItem, FN_PARAM_2 , false );
                     SFX_REQUEST_ARG( rReq, pIsUrl, SfxBoolItem, FN_PARAM_1 , false );
                     if ( pType )
@@ -685,7 +685,7 @@ void SwTextShell::StateField( SfxItemSet &rSet )
                     RES_AUTHORITY == nTempWhich )
                     rSet.DisableItem( nWhich );
                 else if( RES_DDEFLD == nTempWhich &&
-                    !((SwDDEFieldType*)pField->GetTyp())->GetBaseLink().IsVisible())
+                    !static_cast<SwDDEFieldType*>(pField->GetTyp())->GetBaseLink().IsVisible())
                 {
                     // nested links cannot be edited
                     rSet.DisableItem( nWhich );
diff --git a/sw/source/uibase/shells/textidx.cxx b/sw/source/uibase/shells/textidx.cxx
index 601883e..5f635ec 100644
--- a/sw/source/uibase/shells/textidx.cxx
+++ b/sw/source/uibase/shells/textidx.cxx
@@ -125,7 +125,7 @@ void SwTextShell::ExecIdx(SfxRequest &rReq)
             bool bGlobal = false;
             if(pItem)
             {
-                pCurTOX = (const SwTOXBase* )((SwPtrItem*)pItem)->GetValue();
+                pCurTOX = (const SwTOXBase* )static_cast<const SwPtrItem*>(pItem)->GetValue();
                 bGlobal = true;
             }
             else
diff --git a/sw/source/uibase/shells/textsh.cxx b/sw/source/uibase/shells/textsh.cxx
index ea9e96f..3d7bf34 100644
--- a/sw/source/uibase/shells/textsh.cxx
+++ b/sw/source/uibase/shells/textsh.cxx
@@ -451,7 +451,7 @@ void SwTextShell::ExecInsert(SfxRequest &rReq)
                 svt::EmbeddedObjectRef& xObj = rSh.GetOLEObject();
                 if(pItem && xObj.is())
                 {
-                    Size aSize(((SvxSizeItem*)pItem)->GetSize());
+                    Size aSize(static_cast<const SvxSizeItem*>(pItem)->GetSize());
                     aSize = OutputDevice::LogicToLogic
                                     ( aSize, MapMode( MAP_TWIP ), MapMode( MAP_100TH_MM ) );
 
diff --git a/sw/source/uibase/shells/textsh1.cxx b/sw/source/uibase/shells/textsh1.cxx
index 51d9a9d..2e679e8 100644
--- a/sw/source/uibase/shells/textsh1.cxx
+++ b/sw/source/uibase/shells/textsh1.cxx
@@ -526,7 +526,7 @@ void SwTextShell::Execute(SfxRequest &rReq)
             OUString aTemplateName;
             if ( pItem )
             {
-                nKind = ((SfxInt16Item*)pItem)->GetValue();
+                nKind = static_cast<const SfxInt16Item*>(pItem)->GetValue();
                 SFX_REQUEST_ARG( rReq, pTemplate, SfxStringItem, FN_PARAM_1 , false );
                 SFX_REQUEST_ARG( rReq, pNumber, SfxUInt16Item, FN_PARAM_2 , false );
                 SFX_REQUEST_ARG( rReq, pIsNumberFilled, SfxBoolItem, FN_PARAM_3, false );
@@ -590,7 +590,7 @@ void SwTextShell::Execute(SfxRequest &rReq)
         {
             if ( pItem )
             {
-                OUString sName = ((SfxStringItem*)pItem)->GetValue();
+                OUString sName = static_cast<const SfxStringItem*>(pItem)->GetValue();
                 rWrtSh.SetBookmark( vcl::KeyCode(), sName, OUString() );
             }
             else
@@ -610,7 +610,7 @@ void SwTextShell::Execute(SfxRequest &rReq)
             if ( pItem )
             {
                 IDocumentMarkAccess* const pMarkAccess = rWrtSh.getIDocumentMarkAccess();
-                pMarkAccess->deleteMark( pMarkAccess->findMark(((SfxStringItem*)pItem)->GetValue()) );
+                pMarkAccess->deleteMark( pMarkAccess->findMark(static_cast<const SfxStringItem*>(pItem)->GetValue()) );
             }
             break;
         }
@@ -730,9 +730,9 @@ void SwTextShell::Execute(SfxRequest &rReq)
             if(pFld && pFld->GetTypeId() == TYP_GETREFFLD)
             {
                 rWrtSh.StartAllAction();
-                rWrtSh.SwCrsrShell::GotoRefMark( ((SwGetRefField*)pFld)->GetSetRefName(),
-                                    ((SwGetRefField*)pFld)->GetSubType(),
-                                    ((SwGetRefField*)pFld)->GetSeqNo() );
+                rWrtSh.SwCrsrShell::GotoRefMark( static_cast<SwGetRefField*>(pFld)->GetSetRefName(),
+                                    static_cast<SwGetRefField*>(pFld)->GetSubType(),
+                                    static_cast<SwGetRefField*>(pFld)->GetSeqNo() );
                 rWrtSh.EndAllAction();
                 rReq.Done();
             }
@@ -953,7 +953,7 @@ void SwTextShell::Execute(SfxRequest &rReq)
             // Left border as offset
             //#i24363# tab stops relative to indent
             const long nOff = rWrtSh.getIDocumentSettingAccess()->get(IDocumentSettingAccess::TABS_RELATIVE_TO_INDENT) ?
-                ((SvxLRSpaceItem&)aCoreSet.Get( RES_LR_SPACE )).GetTxtLeft() : 0;
+                static_cast<const SvxLRSpaceItem&>(aCoreSet.Get( RES_LR_SPACE )).GetTxtLeft() : 0;
             SfxInt32Item aOff( SID_ATTR_TABSTOP_OFFSET, nOff );
             aCoreSet.Put( aOff );
 
@@ -1006,7 +1006,7 @@ void SwTextShell::Execute(SfxRequest &rReq)
                 pSet = (SfxItemSet*)pDlg->GetOutputItemSet();
                 sal_uInt16 nNewDist;
                 if( SfxItemState::SET == pSet->GetItemState( SID_ATTR_TABSTOP_DEFAULTS, false, &pItem ) &&
-                    nDefDist != (nNewDist = ((SfxUInt16Item*)pItem)->GetValue()) )
+                    nDefDist != (nNewDist = static_cast<const SfxUInt16Item*>(pItem)->GetValue()) )
                 {
                     SvxTabStopItem aDefTabs( 0, 0, SVX_TAB_ADJUST_DEFAULT, RES_PARATR_TABSTOP );
                     MakeDefTabs( nNewDist, aDefTabs );
@@ -1048,8 +1048,8 @@ void SwTextShell::Execute(SfxRequest &rReq)
                     rWrtSh.StartAction();
                     if ( SfxItemState::SET == pSet->GetItemState(FN_DROP_TEXT, false, &pItem) )
                     {
-                        if ( !((SfxStringItem*)pItem)->GetValue().isEmpty() )
-                            rWrtSh.ReplaceDropTxt(((SfxStringItem*)pItem)->GetValue(), pPaM);
+                        if ( !static_cast<const SfxStringItem*>(pItem)->GetValue().isEmpty() )
+                            rWrtSh.ReplaceDropTxt(static_cast<const SfxStringItem*>(pItem)->GetValue(), pPaM);
                     }
                     rWrtSh.SetAttrSet( *pSet, 0, pPaM );
                     rWrtSh.EndAction();
@@ -1067,7 +1067,7 @@ void SwTextShell::Execute(SfxRequest &rReq)
                     //otherwise the SetNodeNumStart() value determines the start
                     //if it's set to something different than USHRT_MAX
 
-                    bool bStart = ((SfxBoolItem&)pSet->Get(FN_NUMBER_NEWSTART)).GetValue();
+                    bool bStart = static_cast<const SfxBoolItem&>(pSet->Get(FN_NUMBER_NEWSTART)).GetValue();
 
                     // Default value for restart value has to be USHRT_MAX
                     // in order to indicate that the restart value of the list
@@ -1075,14 +1075,14 @@ void SwTextShell::Execute(SfxRequest &rReq)
                     sal_uInt16 nNumStart = USHRT_MAX;
                     if( SfxItemState::SET == pSet->GetItemState(FN_NUMBER_NEWSTART_AT) )
                     {
-                        nNumStart = ((SfxUInt16Item&)pSet->Get(FN_NUMBER_NEWSTART_AT)).GetValue();
+                        nNumStart = static_cast<const SfxUInt16Item&>(pSet->Get(FN_NUMBER_NEWSTART_AT)).GetValue();
                     }
                     rWrtSh.SetNumRuleStart(bStart, pPaM);
                     rWrtSh.SetNodeNumStart(nNumStart);
                 }
                 else if( SfxItemState::SET == pSet->GetItemState(FN_NUMBER_NEWSTART_AT) )
                 {
-                    rWrtSh.SetNodeNumStart(((SfxUInt16Item&)pSet->Get(FN_NUMBER_NEWSTART_AT)).GetValue());
+                    rWrtSh.SetNodeNumStart(static_cast<const SfxUInt16Item&>(pSet->Get(FN_NUMBER_NEWSTART_AT)).GetValue());
                     rWrtSh.SetNumRuleStart(false, pPaM);
                 }
                 // #i56253#
diff --git a/sw/source/uibase/shells/textsh2.cxx b/sw/source/uibase/shells/textsh2.cxx
index d1fcb65..8e1f349 100644
--- a/sw/source/uibase/shells/textsh2.cxx
+++ b/sw/source/uibase/shells/textsh2.cxx
@@ -102,7 +102,7 @@ void SwTextShell::ExecDB(SfxRequest &rReq)
 
     Sequence<Any> aSelection;
     if(pSelectionItem)
-        ((SfxUsrAnyItem*)pSelectionItem)->GetValue() >>= aSelection;
+        static_cast<const SfxUsrAnyItem*>(pSelectionItem)->GetValue() >>= aSelection;
 
     // get the data source name
     pArgs->GetItemState(FN_DB_DATA_SOURCE_ANY, false, &pSourceItem);
@@ -196,7 +196,7 @@ void SwTextShell::ExecDB(SfxRequest &rReq)
 
                 OUString sColumnName;
                 if(pColumnNameItem)
-                    ((SfxUsrAnyItem*)pColumnNameItem)->GetValue() >>= sColumnName;
+                    static_cast<const SfxUsrAnyItem*>(pColumnNameItem)->GetValue() >>= sColumnName;
                 OUString sDBName = sSourceArg;
                 sDBName += OUString(DB_DELIM);
                 sDBName += sCommandArg;
@@ -208,9 +208,9 @@ void SwTextShell::ExecDB(SfxRequest &rReq)
                 SwFldMgr aFldMgr(GetShellPtr());
                 SwInsertFld_Data aData(TYP_DBFLD, 0, sDBName, OUString(), 0);
                 if(pConnectionItem)
-                    aData.aDBConnection = ((SfxUsrAnyItem*)pConnectionItem)->GetValue();
+                    aData.aDBConnection = static_cast<const SfxUsrAnyItem*>(pConnectionItem)->GetValue();
                 if(pColumnItem)
-                    aData.aDBColumn = ((SfxUsrAnyItem*)pColumnItem)->GetValue();
+                    aData.aDBColumn = static_cast<const SfxUsrAnyItem*>(pColumnItem)->GetValue();
                 aFldMgr.InsertFld(aData);
                 SfxViewFrame* pViewFrame = GetView().GetViewFrame();
                 uno::Reference< XDispatchRecorder > xRecorder =
diff --git a/sw/source/uibase/shells/txtattr.cxx b/sw/source/uibase/shells/txtattr.cxx
index 9c9adcb..bd8baeb 100644
--- a/sw/source/uibase/shells/txtattr.cxx
+++ b/sw/source/uibase/shells/txtattr.cxx
@@ -471,8 +471,8 @@ void SwTextShell::ExecParaAttrArgs(SfxRequest &rReq)
                     rSh.StartUndo( UNDO_START );
                     if ( SfxItemState::SET == aSet.GetItemState(HINT_END,false,&pItem) )
                     {
-                        if ( !((SfxStringItem*)pItem)->GetValue().isEmpty() )
-                            rSh.ReplaceDropTxt(((SfxStringItem*)pItem)->GetValue());
+                        if ( !static_cast<const SfxStringItem*>(pItem)->GetValue().isEmpty() )
+                            rSh.ReplaceDropTxt(static_cast<const SfxStringItem*>(pItem)->GetValue());
                     }
                     rSh.SetAttrSet(*pDlg->GetOutputItemSet());
                     rSh.StartUndo( UNDO_END );
diff --git a/sw/source/uibase/uiview/formatclipboard.cxx b/sw/source/uibase/uiview/formatclipboard.cxx
index 4815149..5540680 100644
--- a/sw/source/uibase/uiview/formatclipboard.cxx
+++ b/sw/source/uibase/uiview/formatclipboard.cxx
@@ -159,7 +159,7 @@ void lcl_setTableAttributes( const SfxItemSet& rSet, SwWrtShell &rSh )
         rSh.SetTabBorders( rSet );
 
     if( SfxItemState::SET == rSet.GetItemState( FN_PARAM_TABLE_HEADLINE, false, &pItem) )
-        rSh.SetRowsToRepeat( ((SfxUInt16Item*)pItem)->GetValue() );
+        rSh.SetRowsToRepeat( static_cast<const SfxUInt16Item*>(pItem)->GetValue() );
 
     SwFrmFmt* pFrmFmt = rSh.GetTableFmt();
     if(pFrmFmt)
@@ -209,7 +209,7 @@ void lcl_setTableAttributes( const SfxItemSet& rSet, SwWrtShell &rSh )
     }
 
     if( SfxItemState::SET == rSet.GetItemState( FN_TABLE_SET_VERT_ALIGN, false, &pItem))
-        rSh.SetBoxAlign(((SfxUInt16Item*)(pItem))->GetValue());
+        rSh.SetBoxAlign(static_cast<const SfxUInt16Item*>((pItem))->GetValue());
 
     if( SfxItemState::SET == rSet.GetItemState( RES_ROW_SPLIT, false, &pItem) )
         rSh.SetRowSplit(*static_cast<const SwFmtRowSplit*>(pItem));
diff --git a/sw/source/uibase/uiview/pview.cxx b/sw/source/uibase/uiview/pview.cxx
index 22efb9c..f979782 100644
--- a/sw/source/uibase/uiview/pview.cxx
+++ b/sw/source/uibase/uiview/pview.cxx
@@ -166,7 +166,7 @@ SwPreviewZoomDlg::SwPreviewZoomDlg( SwPagePreviewWin& rParent )
 
 void  SwPreviewZoomDlg::Apply()
 {
-    ((SwPagePreviewWin*)GetParent())->CalcWish(
+    static_cast<SwPagePreviewWin*>(GetParent())->CalcWish(
                 sal_uInt8(m_pRowEdit->GetValue()),
                 sal_uInt8(m_pColEdit->GetValue()) );
 }
@@ -1052,7 +1052,7 @@ void  SwPagePreview::GetState( SfxItemSet& rSet )
                 else if( SfxItemState::SET == aSet.GetItemState( SID_PRINTDOC,
                         false, &pItem ))
                 {
-                    ((SfxPoolItem*)pItem)->SetWhich( FN_PRINT_PAGEPREVIEW );
+                    const_cast<SfxPoolItem*>(pItem)->SetWhich( FN_PRINT_PAGEPREVIEW );
                     rSet.Put( *pItem );
                 }
             }
@@ -1175,12 +1175,12 @@ SwPagePreview::SwPagePreview(SfxViewFrame *pViewFrame, SfxViewShell* pOldSh):
     SwViewShell *pVS, *pNew;
 
     if( pOldSh && pOldSh->IsA( TYPE( SwPagePreview ) ) )
-        pVS = ((SwPagePreview*)pOldSh)->GetViewShell();
+        pVS = static_cast<SwPagePreview*>(pOldSh)->GetViewShell();
     else
     {
         if( pOldSh && pOldSh->IsA( TYPE( SwView ) ) )
         {
-            pVS = ((SwView*)pOldSh)->GetWrtShellPtr();
+            pVS = static_cast<SwView*>(pOldSh)->GetWrtShellPtr();
             // save the current ViewData of the previous SwView
             pOldSh->WriteUserData( sSwViewData, false );
         }
@@ -1190,7 +1190,7 @@ SwPagePreview::SwPagePreview(SfxViewFrame *pViewFrame, SfxViewShell* pOldSh):
         {
             // Set the current page as the first.
             sal_uInt16 nPhysPg, nVirtPg;
-            ((SwCrsrShell*)pVS)->GetPageNum( nPhysPg, nVirtPg, true, false );
+            static_cast<SwCrsrShell*>(pVS)->GetPageNum( nPhysPg, nVirtPg, true, false );
             if( 1 != pViewWin->GetCol() && 1 == nPhysPg )
                 --nPhysPg;
             pViewWin->SetSttPage( nPhysPg );
@@ -1209,7 +1209,7 @@ SwPagePreview::SwPagePreview(SfxViewFrame *pViewFrame, SfxViewShell* pOldSh):
         pNew = new SwViewShell( *pVS, pViewWin, 0, VSHELLFLAG_ISPREVIEW );
     else
         pNew = new SwViewShell(
-                *((SwDocShell*)pViewFrame->GetObjectShell())->GetDoc(),
+                *static_cast<SwDocShell*>(pViewFrame->GetObjectShell())->GetDoc(),
                 pViewWin, 0, 0, VSHELLFLAG_ISPREVIEW );
 
     pViewWin->SetViewShell( pNew );
diff --git a/sw/source/uibase/uiview/srcview.cxx b/sw/source/uibase/uiview/srcview.cxx
index 2a4c455..15e7c05 100644
--- a/sw/source/uibase/uiview/srcview.cxx
+++ b/sw/source/uibase/uiview/srcview.cxx
@@ -232,7 +232,7 @@ SwSrcView::~SwSrcView()
     SwDocShell* pDocShell = GetDocShell();
     OSL_ENSURE(PTR_CAST(SwWebDocShell, pDocShell), "Why no WebDocShell?");
     const TextSelection&  rSel = aEditWin.GetTextView()->GetSelection();
-    ((SwWebDocShell*)pDocShell)->SetSourcePara( static_cast< sal_uInt16 >( rSel.GetStart().GetPara() ) );
+    static_cast<SwWebDocShell*>(pDocShell)->SetSourcePara( static_cast< sal_uInt16 >( rSel.GetStart().GetPara() ) );
 
     uno::Reference<document::XDocumentPropertiesSupplier> xDPS(
         pDocShell->GetModel(), uno::UNO_QUERY_THROW);
@@ -871,7 +871,7 @@ void SwSrcView::Load(SwDocShell* pDocShell)
     // Disable AutoLoad
     pDocShell->SetAutoLoad(INetURLObject(), 0, false);
     OSL_ENSURE(PTR_CAST(SwWebDocShell, pDocShell), "Why no WebDocShell?");
-    sal_uInt16 nLine = ((SwWebDocShell*)pDocShell)->GetSourcePara();
+    sal_uInt16 nLine = static_cast<SwWebDocShell*>(pDocShell)->GetSourcePara();
     aEditWin.SetStartLine(nLine);
     aEditWin.GetTextEngine()->ResetUndo();
     aEditWin.GetOutWin()->GrabFocus();
diff --git a/sw/source/uibase/uiview/swcli.cxx b/sw/source/uibase/uiview/swcli.cxx
index 71b5749..826f084 100644
--- a/sw/source/uibase/uiview/swcli.cxx
+++ b/sw/source/uibase/uiview/swcli.cxx
@@ -49,7 +49,7 @@ void SwOleClient::RequestNewObjectArea( Rectangle& aLogRect )
     // If the Ole-Frm is formatted, then the CalcAndSetScale() of the WrtShell
     // will be called. There the scaling of the SwOleClient is set if necessary.
 
-    SwWrtShell &rSh  = ((SwView*)GetViewShell())->GetWrtShell();
+    SwWrtShell &rSh  = static_cast<SwView*>(GetViewShell())->GetWrtShell();
 
     rSh.StartAllAction();
 
@@ -85,7 +85,7 @@ void SwOleClient::RequestNewObjectArea( Rectangle& aLogRect )
 
 void SwOleClient::ObjectAreaChanged()
 {
-    SwWrtShell &rSh  = ((SwView*)GetViewShell())->GetWrtShell();
+    SwWrtShell &rSh  = static_cast<SwView*>(GetViewShell())->GetWrtShell();
     SwRect aFrm( rSh.GetAnyCurRect( RECT_FLY_EMBEDDED,     0, GetObject() ));
     if ( !aFrm.IsOver( rSh.VisArea() ) )
         rSh.MakeVisible( aFrm );
@@ -105,7 +105,7 @@ void SwOleClient::ViewChanged()
         return;
     }
 
-    SwWrtShell &rSh  = ((SwView*)GetViewShell())->GetWrtShell();
+    SwWrtShell &rSh  = static_cast<SwView*>(GetViewShell())->GetWrtShell();
 
     // Adjust the size of the object in the core. The Scaling must
     // be considered. Repercussions on the object are considered by
@@ -154,7 +154,7 @@ void SwOleClient::ViewChanged()
 
 void SwOleClient::MakeVisible()
 {
-    const SwWrtShell &rSh  = ((SwView*)GetViewShell())->GetWrtShell();
+    const SwWrtShell &rSh  = static_cast<SwView*>(GetViewShell())->GetWrtShell();
     rSh.MakeObjVisible( GetObject() );
 }
 
diff --git a/sw/source/uibase/uiview/uivwimp.cxx b/sw/source/uibase/uiview/uivwimp.cxx
index 3a66ec6..93853c2 100644
--- a/sw/source/uibase/uiview/uivwimp.cxx
+++ b/sw/source/uibase/uiview/uivwimp.cxx
@@ -87,7 +87,7 @@ SwView_Impl::~SwView_Impl()
         pInterceptor->Invalidate();
     }
     view::XSelectionSupplier* pTextView = pxXTextView->get();
-    ((SwXTextView*)pTextView)->Invalidate();
+    static_cast<SwXTextView*>(pTextView)->Invalidate();
     delete pxXTextView;
     if( xScanEvtLstnr.is() )
            pScanEvtLstnr->ViewDestroyed();
@@ -116,7 +116,7 @@ view::XSelectionSupplier*   SwView_Impl::GetUNOObject()
 SwXTextView*    SwView_Impl::GetUNOObject_Impl()
 {
         view::XSelectionSupplier* pTextView = pxXTextView->get();
-        return ((SwXTextView*)pTextView);
+        return static_cast<SwXTextView*>(pTextView);
 }
 
 void SwView_Impl::ExecuteScan( SfxRequest& rReq )
diff --git a/sw/source/uibase/uiview/view.cxx b/sw/source/uibase/uiview/view.cxx
index 358937f..346c9e1 100644
--- a/sw/source/uibase/uiview/view.cxx
+++ b/sw/source/uibase/uiview/view.cxx
@@ -498,7 +498,7 @@ IMPL_LINK_NOARG(SwView, AttrChangedNotify)
             const SfxPoolItem *pItem;
             if ( SfxItemState::SET != GetObjectShell()->GetMedium()->GetItemSet()->
                                     GetItemState( SID_HIDDEN, false, &pItem ) ||
-                 !((SfxBoolItem*)pItem)->GetValue() )
+                 !static_cast<const SfxBoolItem*>(pItem)->GetValue() )
             {
                 GetViewFrame()->GetBindings().ENTERREGISTRATIONS();
                 m_bAttrChgNotifiedWithRegistrations = true;
@@ -783,9 +783,9 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh )
         // determine type of existing view
         if( pExistingSh->IsA( TYPE( SwPagePreview ) ) )
         {
-            m_sSwViewData = ((SwPagePreview*)pExistingSh)->GetPrevSwViewData();
-            m_sNewCrsrPos = ((SwPagePreview*)pExistingSh)->GetNewCrsrPos();
-            m_nNewPage = ((SwPagePreview*)pExistingSh)->GetNewPage();
+            m_sSwViewData = static_cast<SwPagePreview*>(pExistingSh)->GetPrevSwViewData();
+            m_sNewCrsrPos = static_cast<SwPagePreview*>(pExistingSh)->GetNewCrsrPos();
+            m_nNewPage = static_cast<SwPagePreview*>(pExistingSh)->GetNewPage();
             m_bOldShellWasPagePreview = true;
             m_bIsPreviewDoubleClick = !m_sNewCrsrPos.isEmpty() || m_nNewPage != USHRT_MAX;
         }
@@ -796,7 +796,7 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh )
     SAL_INFO( "sw.ui", "before create WrtShell" );
     if(PTR_CAST( SwView, pExistingSh))
     {
-        m_pWrtShell = new SwWrtShell( *((SwView*)pExistingSh)->m_pWrtShell,
+        m_pWrtShell = new SwWrtShell( *static_cast<SwView*>(pExistingSh)->m_pWrtShell,
                                     m_pEditWin, *this);
     }
     else if( dynamic_cast<SwWrtShell*>( pDocSh->GetDoc()->getIDocumentLayoutAccess().GetCurrentViewShell() ) )
@@ -806,7 +806,7 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh )
     }
     else
     {
-        SwDoc& rDoc = *((SwDocShell*)pDocSh)->GetDoc();
+        SwDoc& rDoc = *static_cast<SwDocShell*>(pDocSh)->GetDoc();
 
         if( !bOldShellWasSrcView && bWebDShell && !m_bOldShellWasPagePreview )
             aUsrPref.setBrowseMode( true );
@@ -830,7 +830,7 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh )
         // add the SwViewShell to the ring of the other SwViewShell(s)
         if(m_bOldShellWasPagePreview)
         {
-            SwViewShell& rPreviewViewShell = *((SwPagePreview*)pExistingSh)->GetViewShell();
+            SwViewShell& rPreviewViewShell = *static_cast<SwPagePreview*>(pExistingSh)->GetViewShell();
             m_pWrtShell->MoveTo(&rPreviewViewShell);
             // to update the field command et.al. if necessary
             const SwViewOption* pPreviewOpt = rPreviewViewShell.GetViewOptions();
@@ -841,11 +841,11 @@ SwView::SwView( SfxViewFrame *_pFrame, SfxViewShell* pOldSh )
                 rPreviewViewShell.ApplyViewOptions(aUsrPref);
             // reset design mode at draw view for form
             // shell, if needed.
-            if ( ((SwPagePreview*)pExistingSh)->ResetFormDesignMode() &&
+            if ( static_cast<SwPagePreview*>(pExistingSh)->ResetFormDesignMode() &&
                  m_pWrtShell->HasDrawView() )
             {
                 SdrView* pDrawView = m_pWrtShell->GetDrawView();
-                pDrawView->SetDesignMode( ((SwPagePreview*)pExistingSh)->FormDesignModeToReset() );
+                pDrawView->SetDesignMode( static_cast<SwPagePreview*>(pExistingSh)->FormDesignModeToReset() );
             }
         }
     }
@@ -1590,7 +1590,7 @@ void SwView::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
     bool bCallBase = true;
     if ( dynamic_cast<const SfxSimpleHint*>(&rHint) )
     {
-        sal_uInt32 nId = ((SfxSimpleHint&)rHint).GetId();
+        sal_uInt32 nId = static_cast<const SfxSimpleHint&>(rHint).GetId();
         switch ( nId )
         {
             // sub shells will be destroyed by the
@@ -1662,7 +1662,7 @@ void SwView::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
     }
     else if(dynamic_cast<const FmDesignModeChangedHint*>(&rHint))
     {
-        bool bDesignMode = ((FmDesignModeChangedHint&)rHint).GetDesignMode();
+        bool bDesignMode = static_cast<const FmDesignModeChangedHint&>(rHint).GetDesignMode();
         if (!bDesignMode && GetDrawFuncPtr())
         {
             GetDrawFuncPtr()->Deactivate();
diff --git a/sw/source/uibase/uiview/view0.cxx b/sw/source/uibase/uiview/view0.cxx
index 7424cf9..4777d66 100644
--- a/sw/source/uibase/uiview/view0.cxx
+++ b/sw/source/uibase/uiview/view0.cxx
@@ -362,7 +362,7 @@ void SwView::ExecViewOptions(SfxRequest &rReq)
 
     if( pArgs && SfxItemState::SET == pArgs->GetItemState( nSlot , false, &pAttr ))
     {
-        bSet = ((SfxBoolItem*)pAttr)->GetValue();
+        bSet = static_cast<const SfxBoolItem*>(pAttr)->GetValue();
         eState = bSet ? STATE_ON : STATE_OFF;
     }
 
diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx
index 7dcde99..83470b9 100644
--- a/sw/source/uibase/uiview/view2.cxx
+++ b/sw/source/uibase/uiview/view2.cxx
@@ -614,7 +614,7 @@ void SwView::Execute(SfxRequest &rReq)
             IDocumentRedlineAccess* pIDRA = m_pWrtShell->getIDocumentRedlineAccess();
             Sequence <sal_Int8> aPasswd = pIDRA->GetRedlinePassword();
             if( pArgs && SfxItemState::SET == pArgs->GetItemState(nSlot, false, &pItem )
-                && ((SfxBoolItem*)pItem)->GetValue() == ( aPasswd.getLength() != 0 ) )
+                && static_cast<const SfxBoolItem*>(pItem)->GetValue() == ( aPasswd.getLength() != 0 ) )
                 break;
 
             // xmlsec05:    new password dialog
@@ -822,7 +822,7 @@ void SwView::Execute(SfxRequest &rReq)
                 if(pSdrView && pSdrView->AreObjectsMarked() &&
                     pSdrView->GetHdlList().GetFocusHdl())
                 {
-                    ((SdrHdlList&)pSdrView->GetHdlList()).ResetFocusHdl();
+                    const_cast<SdrHdlList&>(pSdrView->GetHdlList()).ResetFocusHdl();
                 }
                 else
                 {
@@ -843,7 +843,7 @@ void SwView::Execute(SfxRequest &rReq)
             {
                 GetEditWin().SetApplyTemplate(SwApplyTemplate());
             }
-            else if( ((SfxObjectShell*)GetDocShell())->IsInPlaceActive() )
+            else if( static_cast<SfxObjectShell*>(GetDocShell())->IsInPlaceActive() )
             {
                 Escape();
             }
@@ -902,7 +902,7 @@ void SwView::Execute(SfxRequest &rReq)
                 pCh = pVFrame->GetChildWindow( SID_NAVIGATOR );
 
             }
-                ((SwNavigationPI*) pCh->GetContextWindow(SW_MOD()))->GotoPage();
+                static_cast<SwNavigationPI*>( pCh->GetContextWindow(SW_MOD()))->GotoPage();
         }
         break;
         case  FN_EDIT_CURRENT_TOX:
@@ -995,7 +995,7 @@ void SwView::Execute(SfxRequest &rReq)
         {
             if(pArgs && SfxItemState::SET == pArgs->GetItemState(nSlot, false, &pItem))
             {
-                const sal_uInt16 nValue = ((SfxUInt16Item*)pItem)->GetValue();
+                const sal_uInt16 nValue = static_cast<const SfxUInt16Item*>(pItem)->GetValue();
                 switch ( nSlot )
                 {
                     case FN_INSERT_CTRL:
@@ -1035,7 +1035,7 @@ void SwView::Execute(SfxRequest &rReq)
         case SID_ATTR_LANGUAGE  :
         if(pArgs && SfxItemState::SET == pArgs->GetItemState(SID_ATTR_LANGUAGE, false, &pItem))
         {
-            SvxLanguageItem aLang(((SvxLanguageItem*)pItem)->GetLanguage(), RES_CHRATR_LANGUAGE);
+            SvxLanguageItem aLang(static_cast<const SvxLanguageItem*>(pItem)->GetLanguage(), RES_CHRATR_LANGUAGE);
             m_pWrtShell->SetDefault( aLang );
             lcl_SetAllTextToDefaultLanguage( *m_pWrtShell, RES_CHRATR_LANGUAGE );
         }
@@ -1074,7 +1074,7 @@ void SwView::Execute(SfxRequest &rReq)
                 pVFrame->ToggleChildWindow( SID_NAVIGATOR );
                 pCh = pVFrame->GetChildWindow( SID_NAVIGATOR );
             }
-            ((SwNavigationPI*) pCh->GetContextWindow(SW_MOD()))->CreateNavigationTool(
+            static_cast<SwNavigationPI*>( pCh->GetContextWindow(SW_MOD()))->CreateNavigationTool(
                             GetVisArea(), true, &pVFrame->GetWindow());
         }
         break;
@@ -2028,9 +2028,9 @@ static sal_uInt16 lcl_PageDescWithHeader( const SwDoc& rDoc )
         const SwFrmFmt& rMaster = rPageDesc.GetMaster();
         const SfxPoolItem* pItem;
         if( ( SfxItemState::SET == rMaster.GetAttrSet().GetItemState( RES_HEADER, false, &pItem ) &&
-              ((SwFmtHeader*)pItem)->IsActive() ) ||
+              static_cast<const SwFmtHeader*>(pItem)->IsActive() ) ||
             ( SfxItemState::SET == rMaster.GetAttrSet().GetItemState( RES_FOOTER, false, &pItem )  &&
-              ((SwFmtFooter*)pItem)->IsActive()) )
+              static_cast<const SwFmtFooter*>(pItem)->IsActive()) )
             ++nRet;
     }
     return nRet; // number of page styles with active header/footer
@@ -2223,9 +2223,9 @@ long SwView::InsertMedium( sal_uInt16 nSlotId, SfxMedium* pMedium, sal_Int16 nVe
             m_pWrtShell->EnterStdMode(); // delete selections
 
             if( bCompare )
-                nFound = m_pWrtShell->CompareDoc( *((SwDocShell*)&xDocSh)->GetDoc() );
+                nFound = m_pWrtShell->CompareDoc( *static_cast<SwDocShell*>(&xDocSh)->GetDoc() );
             else
-                nFound = m_pWrtShell->MergeDoc( *((SwDocShell*)&xDocSh)->GetDoc() );
+                nFound = m_pWrtShell->MergeDoc( *static_cast<SwDocShell*>(&xDocSh)->GetDoc() );
 
             m_pWrtShell->EndAllAction();
 
diff --git a/sw/source/uibase/uiview/viewcoll.cxx b/sw/source/uibase/uiview/viewcoll.cxx
index 2a4c521..8f379b5 100644
--- a/sw/source/uibase/uiview/viewcoll.cxx
+++ b/sw/source/uibase/uiview/viewcoll.cxx
@@ -49,11 +49,11 @@ void SwView::ExecColl(SfxRequest &rReq)
                 if (pArgs &&
                     SfxItemState::SET == pArgs->GetItemState( nWhich , true, &pItem ))
                 {
-                    if( ((SfxStringItem*)pItem)->GetValue() !=
+                    if( static_cast<const SfxStringItem*>(pItem)->GetValue() !=
                                             GetWrtShell().GetCurPageStyle(false) )
                     {
                         SfxStringItem aName(SID_STYLE_APPLY,
-                                   ((SfxStringItem*)pItem)->GetValue());
+                                   static_cast<const SfxStringItem*>(pItem)->GetValue());
                         SfxUInt16Item aFamItem( SID_STYLE_FAMILY,
                                             SFX_STYLE_FAMILY_PAGE);
                         SwPtrItem aShell(FN_PARAM_WRTSHELL, GetWrtShellPtr());
diff --git a/sw/source/uibase/uiview/viewdlg2.cxx b/sw/source/uibase/uiview/viewdlg2.cxx
index e3edf28..59633e6 100644
--- a/sw/source/uibase/uiview/viewdlg2.cxx
+++ b/sw/source/uibase/uiview/viewdlg2.cxx
@@ -172,7 +172,7 @@ void SwView::InsertCaption(const InsCaptionOpt *pOpt)
                                 pOpt->CopyAttributes() );
     // Set Number Format
     if(pType)
-        ((SwSetExpFieldType*)pType)->SetSeqFormat(pOpt->GetNumType());
+        static_cast<SwSetExpFieldType*>(pType)->SetSeqFormat(pOpt->GetNumType());
 
     rSh.UpdateExpFlds( true );
 
diff --git a/sw/source/uibase/uiview/viewdraw.cxx b/sw/source/uibase/uiview/viewdraw.cxx
index 4e2bfe2..0d3661e 100644
--- a/sw/source/uibase/uiview/viewdraw.cxx
+++ b/sw/source/uibase/uiview/viewdraw.cxx
@@ -151,7 +151,7 @@ void SwView::ExecDraw(SfxRequest& rReq)
                     //determine the size of the object
                     if(pObj->IsGroupObject())
                     {
-                        const Rectangle& rBoundRect = ((SdrObjGroup*)pObj)->GetCurrentBoundRect();
+                        const Rectangle& rBoundRect = static_cast<SdrObjGroup*>(pObj)->GetCurrentBoundRect();
                         aStartPos.X() -= rBoundRect.GetWidth()/2;
                         aStartPos.Y() -= rBoundRect.GetHeight()/2;
                     }
@@ -490,7 +490,7 @@ bool SwView::EnterDrawTextMode(const Point& aDocPos)
         // To allow SwDrawVirtObj text objects to be activated, allow their type, too.
         ( pObj->ISA( SdrTextObj ) ||
           ( pObj->ISA(SwDrawVirtObj) &&
-            ((SwDrawVirtObj*)pObj)->GetReferencedObj().ISA(SdrTextObj) ) ) &&
+            static_cast<SwDrawVirtObj*>(pObj)->GetReferencedObj().ISA(SdrTextObj) ) ) &&
 
         !m_pWrtShell->IsSelObjProtected(FLYPROTECT_CONTENT))
     {
@@ -564,12 +564,12 @@ bool SwView::BeginTextEdit(SdrObject* pObj, SdrPageView* pPV, vcl::Window* pWin,
     if(pObj->ISA(SwDrawVirtObj))
     {
         SwDrawVirtObj* pVirtObj = (SwDrawVirtObj*)pObj;
-        pToBeActivated = &((SdrObject&)pVirtObj->GetReferencedObj());
+        pToBeActivated = &const_cast<SdrObject&>(pVirtObj->GetReferencedObj());
         aNewTextEditOffset = pVirtObj->GetOffset();
     }
 
     // set in each case, thus it will be correct for all objects
-    ((SdrTextObj*)pToBeActivated)->SetTextEditOffset(aNewTextEditOffset);
+    static_cast<SdrTextObj*>(pToBeActivated)->SetTextEditOffset(aNewTextEditOffset);
 
     bool bRet(pSdrView->SdrBeginTextEdit( pToBeActivated, pPV, pWin, true, pOutliner, 0, false, false, false ));
 
diff --git a/sw/source/uibase/uiview/viewling.cxx b/sw/source/uibase/uiview/viewling.cxx
index 8a88076..b9938c2 100644
--- a/sw/source/uibase/uiview/viewling.cxx
+++ b/sw/source/uibase/uiview/viewling.cxx
@@ -242,7 +242,7 @@ void SwView::StartTextConversion(
     bool bOldIns = m_pWrtShell->IsInsMode();
     m_pWrtShell->SetInsMode( true );
 
-    const bool bSelection = ((SwCrsrShell*)m_pWrtShell)->HasSelection() ||
+    const bool bSelection = static_cast<SwCrsrShell*>(m_pWrtShell)->HasSelection() ||
         m_pWrtShell->GetCrsr() != m_pWrtShell->GetCrsr()->GetNext();
 
     const bool  bStart = bSelection || m_pWrtShell->IsStartOfDoc();
@@ -450,7 +450,7 @@ void SwView::HyphenateDocument()
         m_pWrtShell->StartUndo(UNDO_INSATTR);         // valid later
 
         bool bHyphSpecial = xProp.is() && xProp->getIsHyphSpecial();
-        bool bSelection = ((SwCrsrShell*)m_pWrtShell)->HasSelection() ||
+        bool bSelection = static_cast<SwCrsrShell*>(m_pWrtShell)->HasSelection() ||
             m_pWrtShell->GetCrsr() != m_pWrtShell->GetCrsr()->GetNext();
         bool bOther = m_pWrtShell->HasOtherCnt() && bHyphSpecial && !bSelection;
         bool bStart = bSelection || ( !bOther && m_pWrtShell->IsStartOfDoc() );
@@ -488,7 +488,7 @@ bool SwView::IsValidSelectionForThesaurus() const
     // to be within a single paragraph
 
     const bool bMultiSel = m_pWrtShell->GetCrsr() != m_pWrtShell->GetCrsr()->GetNext();
-    const bool bSelection = ((SwCrsrShell*)m_pWrtShell)->HasSelection();
+    const bool bSelection = static_cast<SwCrsrShell*>(m_pWrtShell)->HasSelection();
     return !bMultiSel && (!bSelection || m_pWrtShell->IsSelOnePara() );
 }
 
@@ -565,7 +565,7 @@ void SwView::StartThesaurus()
     pVOpt->SetIdle( false );
 
     // get initial LookUp text
-    const bool bSelection = ((SwCrsrShell*)m_pWrtShell)->HasSelection();
+    const bool bSelection = static_cast<SwCrsrShell*>(m_pWrtShell)->HasSelection();
     OUString aTmp = GetThesaurusLookUpText( bSelection );
 
     Reference< XThesaurus >  xThes( ::GetThesaurus() );
@@ -708,8 +708,8 @@ bool SwView::ExecSpellPopup(const Point& rPt)
                     //! 'custom made' menu... *sigh* (code copied from sfx2 and framework)
                     if ( pMenu )
                     {
-                        const sal_uInt16 nId = ((PopupMenu*)pMenu)->Execute(m_pEditWin, aPixPos);
-                        OUString aCommand = ((PopupMenu*)pMenu)->GetItemCommand(nId);
+                        const sal_uInt16 nId = static_cast<PopupMenu*>(pMenu)->Execute(m_pEditWin, aPixPos);
+                        OUString aCommand = static_cast<PopupMenu*>(pMenu)->GetItemCommand(nId);
                         if (aCommand.isEmpty() )
                         {
                             if(!ExecuteMenuCommand(dynamic_cast<PopupMenu&>(*pMenu), *GetViewFrame(), nId ))
diff --git a/sw/source/uibase/uiview/viewmdi.cxx b/sw/source/uibase/uiview/viewmdi.cxx
index 0a1aba0..c49c831 100644
--- a/sw/source/uibase/uiview/viewmdi.cxx
+++ b/sw/source/uibase/uiview/viewmdi.cxx
@@ -183,7 +183,7 @@ void SwView::_SetZoom( const Size &rEditSize, SvxZoomType eZoomType,
         }
         // Compromise solution - Under certain circumstances SetZoom is called
         // in CalcVisAreas again and thus be set wrong values.
-        ((SwViewOption*)m_pWrtShell->GetViewOptions())->SetZoomType( eZoomType );
+        const_cast<SwViewOption*>(m_pWrtShell->GetViewOptions())->SetZoomType( eZoomType );
         CalcVisArea( rEditSize );   // for the recalculation of the viewable area
     }
     else if ( nZoomFac != pOpt->GetZoom() )
@@ -197,7 +197,7 @@ void SwView::_SetZoom( const Size &rEditSize, SvxZoomType eZoomType,
     m_pVRuler->ForceUpdate();
     m_pHRuler->SetZoom( aFrac );
     m_pHRuler->ForceUpdate();
-    ((SwViewOption*)m_pWrtShell->GetViewOptions())->SetZoomType( eZoomType );
+    const_cast<SwViewOption*>(m_pWrtShell->GetViewOptions())->SetZoomType( eZoomType );
     } // end of SwActContext scope
 
     m_pWrtShell->UnlockPaint();
diff --git a/sw/source/uibase/uiview/viewprt.cxx b/sw/source/uibase/uiview/viewprt.cxx
index 59f18ac..cfde028 100644
--- a/sw/source/uibase/uiview/viewprt.cxx
+++ b/sw/source/uibase/uiview/viewprt.cxx
@@ -290,7 +290,7 @@ void SetAppPrintOptions( SwViewShell* pSh, bool bWeb )
 
         if(bWeb)
             aSet.Put(SfxUInt16Item(SID_HTML_MODE,
-                    ::GetHtmlMode(((SwWrtShell*)pSh)->GetView().GetDocShell())));
+                    ::GetHtmlMode(static_cast<SwWrtShell*>(pSh)->GetView().GetDocShell())));
         aSet.Put(SfxBoolItem(SID_PRINTER_NOTFOUND_WARN,
                         aMisc.IsNotFoundWarning() ));
         aSet.Put(aAddPrinterItem);
diff --git a/sw/source/uibase/uiview/viewtab.cxx b/sw/source/uibase/uiview/viewtab.cxx
index ae8bf5b..506de8d 100644
--- a/sw/source/uibase/uiview/viewtab.cxx
+++ b/sw/source/uibase/uiview/viewtab.cxx
@@ -261,7 +261,7 @@ void SwView::ExecTabWin( SfxRequest& rReq )
             SvxLRSpaceItem aLR(RES_LR_SPACE);
             if ( !bSect && (bFrmSelection || nFrmType & FRMTYPE_FLY_ANY) )
             {
-                SwFrmFmt* pFmt = ((SwFrmFmt*)rSh.GetFlyFrmFmt());
+                SwFrmFmt* pFmt = static_cast<SwFrmFmt*>(rSh.GetFlyFrmFmt());
                 const SwRect &rRect = rSh.GetAnyCurRect(RECT_FLY_EMBEDDED);
 
                 bool bVerticalFrame(false);
@@ -420,7 +420,7 @@ void SwView::ExecTabWin( SfxRequest& rReq )
 
             if( bFrmSelection || nFrmType & FRMTYPE_FLY_ANY )
             {
-                SwFrmFmt* pFmt = ((SwFrmFmt*)rSh.GetFlyFrmFmt());
+                SwFrmFmt* pFmt = static_cast<SwFrmFmt*>(rSh.GetFlyFrmFmt());
                 const SwRect &rRect = rSh.GetAnyCurRect(RECT_FLY_EMBEDDED);
                 const long nDeltaY = rPageRect.Top() + aLongULSpace.GetUpper() - rRect.Top();
                 const long nHeight = nPageHeight - (aLongULSpace.GetUpper() + aLongULSpace.GetLower());
commit 88aaa3496161339d504876a2e84dc03e4d6191d9
Author: Noel Grandin <noel at peralex.com>
Date:   Mon Nov 24 10:40:08 2014 +0200

    loplugin: cstylecast
    
    Change-Id: I0607afad59068e3d94494f971990fb45c2b79443

diff --git a/sw/source/ui/table/tabledlg.cxx b/sw/source/ui/table/tabledlg.cxx
index 221211f..d70b4fd 100644
--- a/sw/source/ui/table/tabledlg.cxx
+++ b/sw/source/ui/table/tabledlg.cxx
@@ -555,7 +555,7 @@ void  SwFormatTablePage::Reset( const SfxItemSet* )
     //Text direction
     if( SfxItemState::SET == rSet.GetItemState( RES_FRAMEDIR, true, &pItem ) )
     {
-        sal_uIntPtr nVal  = ((SvxFrameDirectionItem*)pItem)->GetValue();
+        sal_uIntPtr nVal  = static_cast<const SvxFrameDirectionItem*>(pItem)->GetValue();
         const sal_Int32 nPos = m_pTextDirectionLB->GetEntryPos( (void*) nVal );
         m_pTextDirectionLB->SelectEntryPos( nPos );
         m_pTextDirectionLB->SaveValue();
@@ -1236,10 +1236,10 @@ void  SwTableTabDlg::PageCreated(sal_uInt16 nId, SfxTabPage& rPage)
     }
     else if (nId == m_nTextFlowId)
     {
-        ((SwTextFlowPage&)rPage).SetShell(pShell);
+        static_cast<SwTextFlowPage&>(rPage).SetShell(pShell);
         const sal_uInt16 eType = pShell->GetFrmType(0,true);
         if( !(FRMTYPE_BODY & eType) )
-            ((SwTextFlowPage&)rPage).DisablePageBreak();
+            static_cast<SwTextFlowPage&>(rPage).DisablePageBreak();
     }
 }
 
diff --git a/sw/source/ui/table/tautofmt.cxx b/sw/source/ui/table/tautofmt.cxx
index b0ef74f..763208a 100644
--- a/sw/source/ui/table/tautofmt.cxx
+++ b/sw/source/ui/table/tautofmt.cxx
@@ -254,7 +254,7 @@ void SwAutoFormatDlg::FillAutoFmtOfIndex( SwTableAutoFmt*& rToFill ) const
 IMPL_LINK( SwAutoFormatDlg, CheckHdl, Button *, pBtn )
 {
     SwTableAutoFmt* pData  = &(*pTableTbl)[nIndex];
-    bool bCheck = ((CheckBox*)pBtn)->IsChecked(), bDataChgd = true;
+    bool bCheck = static_cast<CheckBox*>(pBtn)->IsChecked(), bDataChgd = true;
 
     if( pBtn == m_pBtnNumFormat )
         pData->SetValueFormat( bCheck );
diff --git a/sw/source/uibase/app/appopt.cxx b/sw/source/uibase/app/appopt.cxx
index cb6a165..f1aef71 100644
--- a/sw/source/uibase/app/appopt.cxx
+++ b/sw/source/uibase/app/appopt.cxx
@@ -388,7 +388,7 @@ void SwModule::ApplyItemSet( sal_uInt16 nId, const SfxItemSet& rSet )
 
     if( SfxItemState::SET == rSet.GetItemState( FN_PARAM_SHADOWCURSOR, false, &pItem ))
     {
-        ((SwShadowCursorItem*)pItem)->FillViewOptions( aViewOpt );
+        static_cast<const SwShadowCursorItem*>(pItem)->FillViewOptions( aViewOpt );
         if(pBindings)
             pBindings->Invalidate(FN_SHADOWCURSOR);
     }
diff --git a/sw/source/uibase/app/docsh.cxx b/sw/source/uibase/app/docsh.cxx
index 1879e7e..23e3155 100644
--- a/sw/source/uibase/app/docsh.cxx
+++ b/sw/source/uibase/app/docsh.cxx
@@ -956,7 +956,7 @@ void SwDocShell::GetState(SfxItemSet& rSet)
                 while (pTmpFrm)     // Look for Preview
                 {
                     if ( PTR_CAST(SwView, pTmpFrm->GetViewShell()) &&
-                         ((SwView*)pTmpFrm->GetViewShell())->GetWrtShell().GetViewOptions()->getBrowseMode() )
+                         static_cast<SwView*>(pTmpFrm->GetViewShell())->GetWrtShell().GetViewOptions()->getBrowseMode() )
                     {
                         bDisable = true;
                         break;
@@ -1120,7 +1120,7 @@ void SwDocShell::LoadingFinished()
     {
         SfxViewShell* pShell = pVFrame->GetViewShell();
         if(PTR_CAST(SwSrcView, pShell))
-            ((SwSrcView*)pShell)->Load(this);
+            static_cast<SwSrcView*>(pShell)->Load(this);
     }
 
     // #i38810#
@@ -1294,7 +1294,7 @@ bool SwDocShell::SetProtectionPassword( const OUString &rNewPassword )
     IDocumentRedlineAccess* pIDRA = mpWrtShell->getIDocumentRedlineAccess();
     Sequence< sal_Int8 > aPasswd = pIDRA->GetRedlinePassword();
     if (pArgs && SfxItemState::SET == pArgs->GetItemState( FN_REDLINE_PROTECT, false, &pItem )
-        && ((SfxBoolItem*)pItem)->GetValue() == (aPasswd.getLength() > 0))
+        && static_cast<const SfxBoolItem*>(pItem)->GetValue() == (aPasswd.getLength() > 0))
         return false;
 
     bool bRes = false;
@@ -1329,7 +1329,7 @@ bool SwDocShell::GetProtectionHash( /*out*/ ::com::sun::star::uno::Sequence< sal
     IDocumentRedlineAccess* pIDRA = mpWrtShell->getIDocumentRedlineAccess();
     Sequence< sal_Int8 > aPasswdHash( pIDRA->GetRedlinePassword() );
     if (pArgs && SfxItemState::SET == pArgs->GetItemState( FN_REDLINE_PROTECT, false, &pItem )
-        && ((SfxBoolItem*)pItem)->GetValue() == (aPasswdHash.getLength() != 0))
+        && static_cast<const SfxBoolItem*>(pItem)->GetValue() == (aPasswdHash.getLength() != 0))
         return false;
     rPasswordHash = aPasswdHash;
     bRes = true;
diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx
index a554ebd..bab7224 100644
--- a/sw/source/uibase/app/docsh2.cxx
+++ b/sw/source/uibase/app/docsh2.cxx
@@ -184,7 +184,7 @@ void SwDocShell::ToggleBrowserMode(bool bSet, SwView* _pView )
         {
             const SvxZoomType eType = (SvxZoomType)rViewOptions.GetZoomType();
             if ( SVX_ZOOM_PERCENT != eType)
-                ((SwView*)GetView())->SetZoom( eType );
+                static_cast<SwView*>(GetView())->SetZoom( eType );
         }
         pTempView->InvalidateBorder();
         pTempView->SetNewWindowAllowed(!bSet);
@@ -220,7 +220,7 @@ static void lcl_processCompatibleSfxHint( const uno::Reference< script::vba::XVB
     if ( dynamic_cast<const SfxEventHint*>(&rHint) )
     {
         uno::Sequence< uno::Any > aArgs;
-        sal_uLong nEventId = ((SfxEventHint&)rHint).GetEventId();
+        sal_uLong nEventId = static_cast<const SfxEventHint&>(rHint).GetEventId();
         switch( nEventId )
         {
             case SFX_EVENT_CREATEDOC:
@@ -249,7 +249,7 @@ void SwDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
     if( dynamic_cast<const SfxSimpleHint*>(&rHint) )
     {
         // switch for more actions
-        switch( ((SfxSimpleHint&) rHint).GetId() )
+        switch( static_cast<const SfxSimpleHint&>( rHint).GetId() )
         {
             case SFX_HINT_TITLECHANGED:
                 if( GetMedium() )
@@ -258,7 +258,7 @@ void SwDocShell::Notify( SfxBroadcaster&, const SfxHint& rHint )
         }
     }
     else if( dynamic_cast<const SfxEventHint*>(&rHint) &&
-        ((SfxEventHint&) rHint).GetEventId() == SFX_EVENT_LOADFINISHED )
+        static_cast<const SfxEventHint&>( rHint).GetEventId() == SFX_EVENT_LOADFINISHED )
     {
         // #i38126# - own action id
         nAction = 3;
@@ -429,7 +429,7 @@ void SwDocShell::Execute(SfxRequest& rReq)
 
                 if( pArgs && SfxItemState::SET ==
                     pArgs->GetItemState( SID_PRINTPREVIEW, false, &pItem ))
-                    bSet = ((SfxBoolItem*)pItem)->GetValue();
+                    bSet = static_cast<const SfxBoolItem*>(pItem)->GetValue();
                 else
                     bSet = !bCurrent;
 
@@ -1100,7 +1100,7 @@ void SwDocShell::Execute(SfxRequest& rReq)
             if ( pArgs && SfxItemState::SET == pArgs->GetItemState( nWhich , false, &pItem ))
             {
                 OSL_ENSURE(pItem->ISA(SfxUInt16Item), "wrong Item");

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list