[Libreoffice-commits] core.git: 35 commits - basic/source compilerplugins/clang connectivity/source cppuhelper/source cui/source dbaccess/source editeng/source filter/source forms/source hwpfilter/source include/connectivity include/tools include/vcl registry/source reportdesign/source sc/source sdext/source sd/qa sd/source sfx2/source solenv/gbuild sot/source stoc/source store/source svl/source svtools/source svx/source sw/source testtools/source tools/source unotools/source vcl/headless vcl/inc vcl/source xmloff/source

Stephan Bergmann sbergman at redhat.com
Mon Jun 5 19:18:40 UTC 2017


 basic/source/sbx/sbxarray.cxx                             |    2 
 compilerplugins/clang/cstylecast.cxx                      |    9 
 compilerplugins/clang/redundantcast.cxx                   |   61 ++++++
 compilerplugins/clang/test/redundantcast.cxx              |   15 +
 connectivity/source/parse/sqlnode.cxx                     |    2 
 cppuhelper/source/interfacecontainer.cxx                  |    2 
 cui/source/dialogs/cuihyperdlg.cxx                        |    2 
 cui/source/dialogs/hltpbase.cxx                           |    2 
 cui/source/dialogs/linkdlg.cxx                            |    2 
 cui/source/dialogs/pastedlg.cxx                           |    4 
 cui/source/tabpages/macroass.cxx                          |    2 
 dbaccess/source/core/dataaccess/databasedocument.cxx      |    2 
 editeng/source/editeng/editeng.cxx                        |    2 
 editeng/source/editeng/impedit2.cxx                       |    2 
 editeng/source/rtf/rtfitem.cxx                            |    2 
 editeng/source/uno/unoforou.cxx                           |    8 
 filter/source/msfilter/escherex.cxx                       |    2 
 filter/source/msfilter/msdffimp.cxx                       |    8 
 filter/source/msfilter/svdfppt.cxx                        |    8 
 forms/source/component/ComboBox.cxx                       |    4 
 forms/source/component/ListBox.cxx                        |    4 
 hwpfilter/source/hwpreader.cxx                            |    2 
 include/connectivity/sqlerror.hxx                         |    2 
 include/tools/datetime.hxx                                |    2 
 include/vcl/graphicfilter.hxx                             |    4 
 registry/source/regimpl.cxx                               |    2 
 reportdesign/source/ui/report/ViewsWindow.cxx             |    4 
 reportdesign/source/ui/report/dlgedfunc.cxx               |    4 
 sc/source/core/data/column.cxx                            |    2 
 sc/source/core/data/documen3.cxx                          |    2 
 sc/source/core/data/drwlayer.cxx                          |    2 
 sc/source/core/tool/autoform.cxx                          |    2 
 sc/source/filter/xml/xmlcelli.cxx                         |    2 
 sc/source/ui/dbgui/tpsubt.cxx                             |    2 
 sc/source/ui/docshell/docfunc.cxx                         |    2 
 sc/source/ui/docshell/docsh4.cxx                          |    2 
 sc/source/ui/drawfunc/drtxtob.cxx                         |    2 
 sc/source/ui/drawfunc/fudraw.cxx                          |    8 
 sc/source/ui/miscdlgs/autofmt.cxx                         |    2 
 sc/source/ui/view/cellsh.cxx                              |    2 
 sc/source/ui/view/printfun.cxx                            |    2 
 sd/qa/unit/import-tests.cxx                               |    2 
 sd/source/core/drawdoc2.cxx                               |    2 
 sd/source/filter/eppt/epptso.cxx                          |    6 
 sd/source/filter/eppt/pptexanimations.cxx                 |    2 
 sd/source/filter/ppt/pptin.cxx                            |   28 +--
 sd/source/ui/animations/motionpathtag.cxx                 |    8 
 sd/source/ui/docshell/docshel4.cxx                        |    2 
 sd/source/ui/func/fudraw.cxx                              |    2 
 sd/source/ui/func/fupoor.cxx                              |   10 -
 sdext/source/presenter/PresenterController.cxx            |    2 
 sdext/source/presenter/PresenterHelpView.cxx              |    2 
 sdext/source/presenter/PresenterProtocolHandler.cxx       |    2 
 sdext/source/presenter/PresenterScreen.cxx                |    2 
 sdext/source/presenter/PresenterSlideSorter.cxx           |    2 
 sfx2/source/doc/docfilt.cxx                               |    2 
 sfx2/source/doc/objcont.cxx                               |    4 
 solenv/gbuild/CppunitTest.mk                              |    4 
 solenv/gbuild/JunitTest.mk                                |    6 
 solenv/gbuild/PythonTest.mk                               |    6 
 solenv/gbuild/UITest.mk                                   |    6 
 solenv/gbuild/gbuild.help.txt                             |    2 
 sot/source/base/formats.cxx                               |    4 
 sot/source/sdstor/stg.cxx                                 |    4 
 sot/source/sdstor/ucbstorage.cxx                          |    6 
 stoc/source/inspect/introspection.cxx                     |    2 
 store/source/storbios.hxx                                 |    2 
 svl/source/items/itempool.cxx                             |    3 
 svtools/source/graphic/grfcache.cxx                       |    4 
 svtools/source/misc/transfer2.cxx                         |   12 -
 svtools/source/table/tablecontrol_impl.cxx                |    2 
 svtools/source/table/tablecontrol_impl.hxx                |    2 
 svx/source/customshapes/EnhancedCustomShape2d.cxx         |   24 +-
 svx/source/customshapes/EnhancedCustomShapeFontWork.cxx   |    4 
 svx/source/dialog/connctrl.cxx                            |    4 
 svx/source/dialog/graphctl.cxx                            |   10 -
 svx/source/dialog/imapwnd.cxx                             |    2 
 svx/source/engine3d/obj3d.cxx                             |   11 -
 svx/source/engine3d/scene3d.cxx                           |   11 -
 svx/source/form/fmsrcimp.cxx                              |    2 
 svx/source/gallery2/galtheme.cxx                          |    6 
 svx/source/sdr/contact/objectcontactofpageview.cxx        |    2 
 svx/source/sdr/contact/viewcontact.cxx                    |    2 
 svx/source/sdr/contact/viewcontactofsdrpage.cxx           |   24 +-
 svx/source/svdraw/svdmark.cxx                             |    2 
 svx/source/svdraw/svdoashp.cxx                            |   36 +--
 svx/source/svdraw/svdopath.cxx                            |    4 
 svx/source/svdraw/svdpagv.cxx                             |    2 
 svx/source/svdraw/svdview.cxx                             |   10 -
 svx/source/xml/xmlgrhlp.cxx                               |    6 
 svx/source/xoutdev/_xoutbmp.cxx                           |    2 
 sw/source/core/access/accdoc.cxx                          |    2 
 sw/source/core/crsr/trvlfnfl.cxx                          |    6 
 sw/source/core/doc/DocumentContentOperationsManager.cxx   |    6 
 sw/source/core/doc/DocumentLinksAdministrationManager.cxx |    2 
 sw/source/core/doc/doccomp.cxx                            |    6 
 sw/source/core/doc/docfly.cxx                             |    4 
 sw/source/core/doc/docfmt.cxx                             |    2 
 sw/source/core/doc/docnew.cxx                             |    4 
 sw/source/core/doc/docnum.cxx                             |    2 
 sw/source/core/doc/tblrwcl.cxx                            |    2 
 sw/source/core/docnode/ndcopy.cxx                         |    4 
 sw/source/core/docnode/ndtbl.cxx                          |   16 -
 sw/source/core/docnode/ndtbl1.cxx                         |    6 
 sw/source/core/edit/edtox.cxx                             |    2 
 sw/source/core/fields/docufld.cxx                         |    2 
 sw/source/core/frmedt/fefly1.cxx                          |    2 
 sw/source/core/frmedt/feshview.cxx                        |    6 
 sw/source/core/frmedt/tblsel.cxx                          |    2 
 sw/source/core/layout/atrfrm.cxx                          |    2 
 sw/source/core/layout/ftnfrm.cxx                          |    2 
 sw/source/core/layout/laycache.cxx                        |    2 
 sw/source/core/layout/pagechg.cxx                         |    2 
 sw/source/core/layout/sectfrm.cxx                         |    2 
 sw/source/core/layout/ssfrm.cxx                           |    2 
 sw/source/core/table/swtable.cxx                          |   12 -
 sw/source/core/text/frmcrsr.cxx                           |    6 
 sw/source/core/text/frmpaint.cxx                          |   12 -
 sw/source/core/text/itrform2.cxx                          |    8 
 sw/source/core/text/porfly.cxx                            |    6 
 sw/source/core/text/pormulti.cxx                          |    4 
 sw/source/core/text/portxt.cxx                            |   12 -
 sw/source/core/text/txtftn.cxx                            |   10 -
 sw/source/core/text/txthyph.cxx                           |    4 
 sw/source/core/text/txtpaint.cxx                          |   10 -
 sw/source/core/txtnode/atrfld.cxx                         |    2 
 sw/source/core/txtnode/atrflyin.cxx                       |    4 
 sw/source/core/txtnode/atrftn.cxx                         |    2 
 sw/source/core/txtnode/atrtox.cxx                         |    2 
 sw/source/core/txtnode/fmtatr2.cxx                        |    2 
 sw/source/core/txtnode/fntcache.cxx                       |   16 -
 sw/source/core/txtnode/ndtxt.cxx                          |    4 
 sw/source/core/undo/rolbck.cxx                            |    4 
 sw/source/core/undo/unins.cxx                             |    2 
 sw/source/core/undo/untbl.cxx                             |    4 
 sw/source/core/unocore/unoevent.cxx                       |   10 -
 sw/source/core/unocore/unofield.cxx                       |    2 
 sw/source/core/unocore/unoframe.cxx                       |  130 +++++++-------
 sw/source/core/unocore/unoftn.cxx                         |    2 
 sw/source/core/unocore/unotbl.cxx                         |   10 -
 sw/source/filter/html/htmlflywriter.cxx                   |    2 
 sw/source/filter/ww8/ww8atr.cxx                           |    2 
 sw/source/filter/ww8/ww8par6.cxx                          |    2 
 sw/source/filter/xml/xmltble.cxx                          |    2 
 sw/source/ui/frmdlg/column.cxx                            |    4 
 sw/source/ui/misc/srtdlg.cxx                              |    2 
 sw/source/uibase/app/docsh.cxx                            |    6 
 sw/source/uibase/app/docst.cxx                            |    2 
 sw/source/uibase/config/modcfg.cxx                        |    2 
 sw/source/uibase/docvw/edtwin.cxx                         |    2 
 sw/source/uibase/shells/basesh.cxx                        |    2 
 sw/source/uibase/shells/frmsh.cxx                         |    2 
 sw/source/uibase/uiview/viewtab.cxx                       |    4 
 sw/source/uibase/uno/unotxdoc.cxx                         |    2 
 sw/source/uibase/utlui/uitool.cxx                         |    4 
 testtools/source/bridgetest/bridgetest.cxx                |   14 -
 testtools/source/bridgetest/cppobj.cxx                    |    2 
 tools/source/datetime/datetime.cxx                        |    3 
 unotools/source/ucbhelper/xtempfile.cxx                   |   18 -
 vcl/headless/svpframe.cxx                                 |    2 
 vcl/inc/octree.hxx                                        |    4 
 vcl/source/filter/wmf/winmtf.cxx                          |    6 
 vcl/source/gdi/alpha.cxx                                  |    2 
 vcl/source/gdi/bitmap3.cxx                                |    2 
 vcl/source/gdi/octree.cxx                                 |    2 
 vcl/source/gdi/wall.cxx                                   |    2 
 vcl/source/window/status.cxx                              |    4 
 xmloff/source/draw/ximpstyl.cxx                           |    2 
 xmloff/source/style/HatchStyle.cxx                        |    3 
 xmloff/source/style/xmlstyle.cxx                          |    2 
 xmloff/source/text/txtexppr.cxx                           |    2 
 171 files changed, 533 insertions(+), 449 deletions(-)

New commits:
commit 09f38f4df1177768fbeefc31e6e73137b2784c49
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Sat Jun 3 21:38:24 2017 +0200

    gb_SUPPRESS_TESTS to build tests but not run them
    
    Change-Id: I390b97bbacfc123b952be2b54cf1333b4d5c24a7

diff --git a/solenv/gbuild/CppunitTest.mk b/solenv/gbuild/CppunitTest.mk
index 659572668648..4bccabf6e46e 100644
--- a/solenv/gbuild/CppunitTest.mk
+++ b/solenv/gbuild/CppunitTest.mk
@@ -106,6 +106,9 @@ $(call gb_CppunitTest_get_clean_target,%) :
 
 .PHONY : $(call gb_CppunitTest_get_target,%)
 $(call gb_CppunitTest_get_target,%) :| $(gb_CppunitTest_RUNTIMEDEPS)
+ifneq ($(gb_SUPPRESS_TESTS),)
+	@true
+else
 	$(call gb_Output_announce,$*,$(true),CUT,2)
 	$(call gb_Helper_abbreviate_dirs,\
 	        $(if $(gb_CppunitTest_vcl_hide_windows),export VCL_HIDE_WINDOWS=1 && ) \
@@ -140,6 +143,7 @@ $(call gb_CppunitTest_get_target,%) :| $(gb_CppunitTest_RUNTIMEDEPS)
 					RET=$$?; \
 					$(call gb_CppunitTest_postprocess,$(gb_CppunitTest_CPPTESTCOMMAND),$@.core,$$RET) >> $@.log 2>&1;) \
 				cat $@.log; $(gb_CppunitTest_UNITTESTFAILED) Cppunit $*)))
+endif
 
 define gb_CppunitTest_CppunitTest
 $(call gb_CppunitTest__CppunitTest_impl,$(1),$(call gb_CppunitTest_get_linktarget,$(1)))
diff --git a/solenv/gbuild/JunitTest.mk b/solenv/gbuild/JunitTest.mk
index 30e226d61467..36f29b50ef28 100644
--- a/solenv/gbuild/JunitTest.mk
+++ b/solenv/gbuild/JunitTest.mk
@@ -32,6 +32,9 @@ ifneq (,$(strip $(OOO_JUNIT_JAR)))
 
 .PHONY : $(call gb_JunitTest_get_target,%)
 $(call gb_JunitTest_get_target,%) :
+ifneq ($(gb_SUPPRESS_TESTS),)
+	@true
+else
 	$(call gb_Output_announce,$*,$(true),JUT,2)
 	$(call gb_Helper_abbreviate_dirs,\
         rm -rf $(call gb_JunitTest_get_userdir,$*) && \
@@ -53,6 +56,7 @@ $(call gb_JunitTest_get_target,%) :
 		&& echo \
 		&& false)))
 	$(CLEAN_CMD)
+endif
 
 define gb_JunitTest_JunitTest
 $(call gb_JunitTest_get_target,$(1)) : T_CP := $(call gb_JavaClassSet_get_classdir,$(call gb_JunitTest_get_classsetname,$(1)))$$(gb_CLASSPATHSEP)$(OOO_JUNIT_JAR)$(if $(HAMCREST_JAR),$$(gb_CLASSPATHSEP)$(HAMCREST_JAR))$$(gb_CLASSPATHSEP)$(INSTROOT)/$(LIBO_URE_LIB_FOLDER)
@@ -152,7 +156,9 @@ else # OOO_JUNIT_JAR
 
 .PHONY : $(call gb_JunitTest_get_target,$(1))
 $(call gb_JunitTest_get_target,%) :
+ifeq ($(gb_SUPPRESS_TESTS),)
 	$(call gb_Output_announce,$* (skipped - no Junit),$(true),JUT,2)
+endif
 	@true
 
 define gb_JunitTest_JunitTest
diff --git a/solenv/gbuild/PythonTest.mk b/solenv/gbuild/PythonTest.mk
index eeff6a013ead..8ac62c43f445 100644
--- a/solenv/gbuild/PythonTest.mk
+++ b/solenv/gbuild/PythonTest.mk
@@ -32,6 +32,9 @@ ifneq ($(DISABLE_PYTHON),TRUE)
 
 .PHONY : $(call gb_PythonTest_get_target,%)
 $(call gb_PythonTest_get_target,%) :| $(gb_PythonTest_DEPS)
+ifneq ($(gb_SUPPRESS_TESTS),)
+	@true
+else
 	$(call gb_Output_announce,$*,$(true),PYT,2)
 	$(call gb_Helper_abbreviate_dirs,\
 		rm -rf $(dir $(call gb_PythonTest_get_target,$*)) && \
@@ -61,6 +64,7 @@ $(call gb_PythonTest_get_target,%) :| $(gb_PythonTest_DEPS)
 					RET=$$?; \
 					$(call gb_CppunitTest_postprocess,$(gb_PythonTest_EXECUTABLE_GDB),$@.core,$$RET) >> $@.log 2>&1;) \
 				cat $@.log; $(gb_PythonTest_UNITTESTFAILED) Python $*))))
+endif
 
 # always use udkapi and URE services
 define gb_PythonTest_PythonTest
@@ -99,7 +103,9 @@ else # DISABLE_PYTHON
 
 .PHONY : $(call gb_PythonTest_get_target,$(1))
 $(call gb_PythonTest_get_target,%) :
+ifeq ($(gb_SUPPRESS_TESTS),)
 	$(call gb_Output_announce,$* (skipped - no PythonTest),$(true),PYT,2)
+endif
 	@true
 
 define gb_PythonTest_PythonTest
diff --git a/solenv/gbuild/UITest.mk b/solenv/gbuild/UITest.mk
index 1edb3f769081..21560c8ced18 100644
--- a/solenv/gbuild/UITest.mk
+++ b/solenv/gbuild/UITest.mk
@@ -37,6 +37,9 @@ ifneq ($(DISABLE_PYTHON),TRUE)
 
 .PHONY : $(call gb_UITest_get_target,%)
 $(call gb_UITest_get_target,%) :| $(gb_UITest_DEPS)
+ifneq ($(gb_SUPPRESS_TESTS),)
+	@true
+else
 	$(call gb_Output_announce,$*,$(true),UIT,2)
 	$(call gb_Helper_abbreviate_dirs,\
 		rm -rf $(dir $(call gb_UITest_get_target,$*)) && \
@@ -69,6 +72,7 @@ $(call gb_UITest_get_target,%) :| $(gb_UITest_DEPS)
 				    RET=$$?; \
 				    $(call gb_CppunitTest_postprocess,$(gb_UITest_EXECUTABLE_GDB),$@.core,$$RET) >> $@.log 2>&1;) \
 			    cat $@.log; $(gb_UITest_UNITTESTFAILED) UI $*))))
+endif
 
 # always use udkapi and URE services
 define gb_UITest_UITest
@@ -111,7 +115,9 @@ else # DISABLE_PYTHON
 
 .PHONY : $(call gb_UITest_get_target,$(1))
 $(call gb_UITest_get_target,%) :
+ifeq ($(gb_SUPPRESS_TESTS),)
 	$(call gb_Output_announce,$* (skipped - no UITest),$(true),PYT,2)
+endif
 	@true
 
 define gb_UITest_UITest
diff --git a/solenv/gbuild/gbuild.help.txt b/solenv/gbuild/gbuild.help.txt
index 05005becc87a..0b11b3698a2e 100644
--- a/solenv/gbuild/gbuild.help.txt
+++ b/solenv/gbuild/gbuild.help.txt
@@ -145,3 +145,5 @@ INTERACTIVE VARIABLES:
                        set the build environment.
        gb_DBGARGS      Append these arguments to GDBs "set args" command for
                        debugrun. Double quotes will be automatically escaped.
+       gb_SUPPRESS_TESTS Do not run tests (but still build them, when requested
+                       by the given targets).
commit 2725f884655f1ef5c3de661ef03bef64405212ed
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Sat Jun 3 21:15:30 2017 +0200

    Improved loplugin:cstylecast to reference types
    
    Change-Id: Ie95ab6d588cfe40cc9748ce526b80d06fe825da5

diff --git a/compilerplugins/clang/cstylecast.cxx b/compilerplugins/clang/cstylecast.cxx
index 62d25acdaf20..8504ca573dcb 100644
--- a/compilerplugins/clang/cstylecast.cxx
+++ b/compilerplugins/clang/cstylecast.cxx
@@ -142,10 +142,9 @@ bool CStyleCast::VisitCStyleCastExpr(const CStyleCastExpr * expr) {
     }
     char const * perf = nullptr;
     if( expr->getCastKind() == CK_NoOp ) {
-        QualType t1 = expr->getSubExpr()->getType();
-        QualType t2 = expr->getType();
-        if (!((t1->isPointerType() && t2->isPointerType())
-              || (t1->isLValueReferenceType() && t2->isLValueReferenceType())))
+        if (!((expr->getSubExpr()->getType()->isPointerType()
+               && expr->getType()->isPointerType())
+              || expr->getTypeAsWritten()->isReferenceType()))
         {
             return true;
         }
@@ -182,7 +181,7 @@ bool CStyleCast::VisitCStyleCastExpr(const CStyleCastExpr * expr) {
         DiagnosticsEngine::Warning, "C-style cast from %0%1 to %2%3%4 (%5)",
         expr->getSourceRange().getBegin())
       << incompFrom << expr->getSubExprAsWritten()->getType()
-      << incompTo << expr->getType() << performs
+      << incompTo << expr->getTypeAsWritten() << performs
       << expr->getCastKindName()
       << expr->getSourceRange();
     return true;
commit 3fdfbe68bad1bd99b6adaf756caa12941c15b9e5
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Sat Jun 3 21:15:19 2017 +0200

    Improved loplugin:cstylecast to reference types: basic
    
    Change-Id: Ib2159aef39d416905899fe91280d2234835e23e9

diff --git a/basic/source/sbx/sbxarray.cxx b/basic/source/sbx/sbxarray.cxx
index 5fc4775fd00a..06d4ebb8ab89 100644
--- a/basic/source/sbx/sbxarray.cxx
+++ b/basic/source/sbx/sbxarray.cxx
@@ -530,7 +530,7 @@ SbxDimArray& SbxDimArray::operator=( const SbxDimArray& rArray )
 {
     if( &rArray != this )
     {
-        SbxArray::operator=( (const SbxArray&) rArray );
+        SbxArray::operator=( static_cast<const SbxArray&>(rArray) );
         m_vDimensions = rArray.m_vDimensions;
         this->mbHasFixedSize = rArray.mbHasFixedSize;
     }
commit 33451555e4fd8479c6ce64aad91ea93f3e03e633
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Sat Jun 3 21:14:57 2017 +0200

    Improved loplugin:cstylecast to reference types: connectivity
    
    Change-Id: I63c747efa2aacf4cb23de6fe9ab02af7abc107f9

diff --git a/connectivity/source/parse/sqlnode.cxx b/connectivity/source/parse/sqlnode.cxx
index a4d89f4e4290..2bb37029b583 100644
--- a/connectivity/source/parse/sqlnode.cxx
+++ b/connectivity/source/parse/sqlnode.cxx
@@ -200,7 +200,7 @@ SQLParseNodeParameter::SQLParseNodeParameter( const Reference< XConnection >& _r
     ,xFormatter(_xFormatter)
     ,xField(_xField)
     ,sPredicateTableAlias(_sPredicateTableAlias)
-    ,m_rContext( _pContext ? (const IParseContext&)(*_pContext) : (const IParseContext&)OSQLParser::s_aDefaultContext )
+    ,m_rContext( _pContext ? *_pContext : OSQLParser::s_aDefaultContext )
     ,cDecSep(_cDecSep)
     ,bQuote(_bQuote)
     ,bInternational(_bIntl)
diff --git a/include/connectivity/sqlerror.hxx b/include/connectivity/sqlerror.hxx
index cba93313abb9..4c4d6e683c01 100644
--- a/include/connectivity/sqlerror.hxx
+++ b/include/connectivity/sqlerror.hxx
@@ -71,7 +71,7 @@ namespace connectivity
         public:
             ParamValue( ) : base_type( ) { }
             ParamValue( OUString const& val ) : base_type( val ) { }
-            ParamValue( ParamValue const& rhs ) : base_type( (base_type const&)rhs ) { }
+            ParamValue( ParamValue const& rhs ) : base_type( rhs ) { }
 
             bool    is() const { return !base_type::operator!(); }
         };
commit 7392e1326d4d2512576aa61c677068a560620bb8
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Sat Jun 3 21:14:39 2017 +0200

    Improved loplugin:cstylecast to reference types: cppuhelper
    
    Change-Id: Id442b7a76072fb346d927a7dd8659a05bb491f9b

diff --git a/cppuhelper/source/interfacecontainer.cxx b/cppuhelper/source/interfacecontainer.cxx
index 2eb7197bf9e6..75ae965bf813 100644
--- a/cppuhelper/source/interfacecontainer.cxx
+++ b/cppuhelper/source/interfacecontainer.cxx
@@ -45,7 +45,7 @@ static void sequenceRemoveElementAt( Sequence< Reference< XInterface > > & rSeq,
 
     Sequence< Reference< XInterface > > aDestSeq( rSeq.getLength() - 1 );
     // getArray on a const sequence is faster
-    const Reference< XInterface > * pSource = ((const Sequence< Reference< XInterface > > &)rSeq).getConstArray();
+    const Reference< XInterface > * pSource = rSeq.getConstArray();
     Reference< XInterface > * pDest = aDestSeq.getArray();
     sal_Int32 i = 0;
     for( ; i < index; i++ )
commit 46baf01c24a936e1c5f9a30d622c88247f28a9ea
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Sat Jun 3 21:14:19 2017 +0200

    Improved loplugin:cstylecast to reference types: cui
    
    Change-Id: I3473b5d90b91f73e3bc30a7a7c6035f7de7657d6

diff --git a/cui/source/dialogs/cuihyperdlg.cxx b/cui/source/dialogs/cuihyperdlg.cxx
index 6830ff7b320b..09810b34b8b5 100644
--- a/cui/source/dialogs/cuihyperdlg.cxx
+++ b/cui/source/dialogs/cuihyperdlg.cxx
@@ -337,7 +337,7 @@ void SvxHpLinkDlg::SetPage ( SvxHyperlinkItem* pItem )
     IconChoicePage* pPage = GetTabPage (nPageId);
     if(pPage)
     {
-        SfxItemSet& aPageSet =  (SfxItemSet&)pPage->GetItemSet ();
+        SfxItemSet& aPageSet = const_cast<SfxItemSet&>(pPage->GetItemSet ());
         aPageSet.Put ( *pItem );
 
         pCurrentPage->Reset( aPageSet );
diff --git a/cui/source/dialogs/hltpbase.cxx b/cui/source/dialogs/hltpbase.cxx
index 8dac3b062fbb..9c6d5c10f073 100644
--- a/cui/source/dialogs/hltpbase.cxx
+++ b/cui/source/dialogs/hltpbase.cxx
@@ -448,7 +448,7 @@ void SvxHyperlinkTabPageBase::Reset( const SfxItemSet& rItemSet)
         FillStandardDlgFields (pHyperlinkItem);
 
         // set all other fields
-        FillDlgFields ( (OUString&)pHyperlinkItem->GetURL() );
+        FillDlgFields ( pHyperlinkItem->GetURL() );
 
         // Store initial URL
         maStrInitURL = pHyperlinkItem->GetURL();
diff --git a/cui/source/dialogs/linkdlg.cxx b/cui/source/dialogs/linkdlg.cxx
index da9c08262ec0..bcbc7919d9dd 100644
--- a/cui/source/dialogs/linkdlg.cxx
+++ b/cui/source/dialogs/linkdlg.cxx
@@ -591,7 +591,7 @@ void SvBaseLinksDlg::SetManager( LinkManager* pNewMgr )
 
     if( pLinkMgr )
     {
-        SvBaseLinks& rLnks = (SvBaseLinks&)pLinkMgr->GetLinks();
+        SvBaseLinks& rLnks = const_cast<SvBaseLinks&>(pLinkMgr->GetLinks());
         for( size_t n = 0; n < rLnks.size(); ++n )
         {
             tools::SvRef<SvBaseLink>& rLinkRef = rLnks[ n ];
diff --git a/cui/source/dialogs/pastedlg.cxx b/cui/source/dialogs/pastedlg.cxx
index c1e3f3acb98e..0b8822247d32 100644
--- a/cui/source/dialogs/pastedlg.cxx
+++ b/cui/source/dialogs/pastedlg.cxx
@@ -111,8 +111,8 @@ SotClipboardFormatId SvPasteObjectDialog::GetFormat( const TransferableDataHelpe
 
     ObjectLB().SetUpdateMode( false );
 
-    DataFlavorExVector::iterator aIter( ((DataFlavorExVector&)*pFormats).begin() ),
-                                 aEnd( ((DataFlavorExVector&)*pFormats).end() );
+    DataFlavorExVector::iterator aIter( const_cast<DataFlavorExVector&>(*pFormats).begin() ),
+                                 aEnd( const_cast<DataFlavorExVector&>(*pFormats).end() );
     while( aIter != aEnd )
     {
         SotClipboardFormatId nFormat = (*aIter++).mnSotId;
diff --git a/cui/source/tabpages/macroass.cxx b/cui/source/tabpages/macroass.cxx
index cb454389ea62..7f92f19ecece 100644
--- a/cui/source/tabpages/macroass.cxx
+++ b/cui/source/tabpages/macroass.cxx
@@ -198,7 +198,7 @@ void SfxMacroTabPage::ScriptChanged()
 bool SfxMacroTabPage::FillItemSet( SfxItemSet* rSet )
 {
     SvxMacroItem aItem( GetWhich( aPageRg[0] ) );
-    ((SvxMacroTableDtor&)aItem.GetMacroTable()) = aTbl;
+    const_cast<SvxMacroTableDtor&>(aItem.GetMacroTable()) = aTbl;
 
     const SfxPoolItem* pItem;
     if( SfxItemState::SET != GetItemSet().GetItemState( aItem.Which(), true, &pItem )
commit f41eea85217a9179b98502d536ec0548c9e1705f
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Sat Jun 3 21:14:02 2017 +0200

    Improved loplugin:cstylecast to reference types: dbaccess
    
    Change-Id: I298c4d8b8244488964ae1e63dabb8bf400c3fb32

diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx
index 0c42e19325c2..cb2bbea06c2a 100644
--- a/dbaccess/source/core/dataaccess/databasedocument.cxx
+++ b/dbaccess/source/core/dataaccess/databasedocument.cxx
@@ -1523,7 +1523,7 @@ void SAL_CALL ODatabaseDocument::close(sal_Bool bDeliverOwnership)
 
         impl_closeControllerFrames_nolck_throw( bDeliverOwnership );
 
-        m_aCloseListener.notifyEach( &XCloseListener::notifyClosing, (const lang::EventObject&)aEvent );
+        m_aCloseListener.notifyEach( &XCloseListener::notifyClosing, const_cast<const lang::EventObject&>(aEvent) );
 
         dispose();
     }
commit 256dfb9e78175c6e6a0723818afb9404ab350640
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Sat Jun 3 21:13:46 2017 +0200

    Improved loplugin:cstylecast to reference types: editeng
    
    Change-Id: I0a9321baf91ea0b460f4d1b6a638278275b184d3

diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx
index 556cbaa8eace..438608fa9948 100644
--- a/editeng/source/editeng/editeng.cxx
+++ b/editeng/source/editeng/editeng.cxx
@@ -1280,7 +1280,7 @@ bool EditEngine::PostKeyEvent( const KeyEvent& rKeyEvent, EditView* pEditView, v
                     }
                     else
                     {
-                        aCurSel = pImpEditEngine->InsertTextUserInput( (const EditSelection&)aCurSel, nCharCode, !pEditView->IsInsertMode() );
+                        aCurSel = pImpEditEngine->InsertTextUserInput( aCurSel, nCharCode, !pEditView->IsInsertMode() );
                     }
                     // AutoComplete ???
                     if ( pImpEditEngine->GetStatus().DoAutoComplete() && ( nCharCode != ' ' ) )
diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx
index 366e4f09ed6c..1225628f7e64 100644
--- a/editeng/source/editeng/impedit2.cxx
+++ b/editeng/source/editeng/impedit2.cxx
@@ -2666,7 +2666,7 @@ EditPaM ImpEditEngine::InsertTextUserInput( const EditSelection& rCurSel,
             InsertUndo( pNewUndo, bTryMerge );
         }
 
-        aEditDoc.InsertText( (const EditPaM&)aPaM, OUString(c) );
+        aEditDoc.InsertText( aPaM, OUString(c) );
         ParaPortion* pPortion = FindParaPortion( aPaM.GetNode() );
         OSL_ENSURE( pPortion, "Blind Portion in InsertText" );
         pPortion->MarkInvalid( aPaM.GetIndex(), 1 );
diff --git a/editeng/source/rtf/rtfitem.cxx b/editeng/source/rtf/rtfitem.cxx
index fa8fed89bfdd..6565cec52ddb 100644
--- a/editeng/source/rtf/rtfitem.cxx
+++ b/editeng/source/rtf/rtfitem.cxx
@@ -1869,7 +1869,7 @@ void SvxRTFParser::SetDefault( int nToken, int nValue )
             SvxTabStopItem aNewTab( nTabCount, sal_uInt16(nValue),
                                 SvxTabAdjust::Default, aPardMap.nTabStop );
             while( nTabCount )
-                ((SvxTabStop&)aNewTab[ --nTabCount ]).GetAdjustment() = SvxTabAdjust::Default;
+                const_cast<SvxTabStop&>(aNewTab[ --nTabCount ]).GetAdjustment() = SvxTabAdjust::Default;
 
             pAttrPool->SetPoolDefaultItem( aNewTab );
         }
diff --git a/editeng/source/uno/unoforou.cxx b/editeng/source/uno/unoforou.cxx
index f1d16b76fda1..050f3c8c85b1 100644
--- a/editeng/source/uno/unoforou.cxx
+++ b/editeng/source/uno/unoforou.cxx
@@ -116,7 +116,7 @@ SfxItemSet SvxOutlinerForwarder::GetAttribs( const ESelection& rSel, EditEngineA
 
     //! Does it not exist on the Outliner?
     //! and why is the GetAttribs on the EditEngine not a const?
-    EditEngine& rEditEngine = (EditEngine&)rOutliner.GetEditEngine();
+    EditEngine& rEditEngine = const_cast<EditEngine&>(rOutliner.GetEditEngine());
 
     SfxItemSet aSet( ImplOutlinerForwarderGetAttribs( rSel, nOnlyHardAttrib, rEditEngine ) );
 
@@ -154,7 +154,7 @@ SfxItemSet SvxOutlinerForwarder::GetParaAttribs( sal_Int32 nPara ) const
     mpParaAttribsCache = new SfxItemSet( rOutliner.GetParaAttribs( nPara ) );
     mnParaAttribsCache = nPara;
 
-    EditEngine& rEditEngine = (EditEngine&)rOutliner.GetEditEngine();
+    EditEngine& rEditEngine = const_cast<EditEngine&>(rOutliner.GetEditEngine());
 
     SfxStyleSheet* pStyle = rEditEngine.GetStyleSheet( nPara );
     if( pStyle )
@@ -189,7 +189,7 @@ SfxItemPool* SvxOutlinerForwarder::GetPool() const
 
 void SvxOutlinerForwarder::GetPortions( sal_Int32 nPara, std::vector<sal_Int32>& rList ) const
 {
-    ((EditEngine&)rOutliner.GetEditEngine()).GetPortions( nPara, rList );
+    const_cast<EditEngine&>(rOutliner.GetEditEngine()).GetPortions( nPara, rList );
 }
 
 void SvxOutlinerForwarder::QuickInsertText( const OUString& rText, const ESelection& rSel )
@@ -242,7 +242,7 @@ bool SvxOutlinerForwarder::IsValid() const
 
 SfxItemState SvxOutlinerForwarder::GetItemState( const ESelection& rSel, sal_uInt16 nWhich ) const
 {
-    return GetSvxEditEngineItemState( (EditEngine&)rOutliner.GetEditEngine(), rSel, nWhich );
+    return GetSvxEditEngineItemState( const_cast<EditEngine&>(rOutliner.GetEditEngine()), rSel, nWhich );
 }
 
 SfxItemState SvxOutlinerForwarder::GetItemState( sal_Int32 nPara, sal_uInt16 nWhich ) const
commit c9e58c516e050f0134505f72b584490912d8dbb4
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Sat Jun 3 21:13:26 2017 +0200

    Improved loplugin:cstylecast to reference types: filter
    
    Change-Id: I2db987556b4b4c7542edf40c7f839c2939e78e25

diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx
index ee61ed4f538e..6aa7842e4d14 100644
--- a/filter/source/msfilter/escherex.cxx
+++ b/filter/source/msfilter/escherex.cxx
@@ -4612,7 +4612,7 @@ sal_uInt32 EscherConnectorListEntry::GetConnectorRule( bool bFirst )
                     *pType >>= sShapeType;
                 MSO_SPT eSpType = EnhancedCustomShapeTypeNames::Get( sShapeType );
 
-                uno::Any* pGluePointType = ((SdrCustomShapeGeometryItem&)rGeometryItem).GetPropertyValueByName( sPath, sGluePointType );
+                uno::Any* pGluePointType = const_cast<SdrCustomShapeGeometryItem&>(rGeometryItem).GetPropertyValueByName( sPath, sGluePointType );
 
                 sal_Int16 nGluePointType = sal_Int16();
                 if ( !( pGluePointType &&
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index 11f83205f1b3..3c865e8ebe3c 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -256,7 +256,7 @@ void DffPropertyReader::ReadPropSet( SvStream& rIn, void* pClientData ) const
 #endif
 {
     sal_uLong nFilePos = rIn.Tell();
-    ReadDffPropSet( rIn, (DffPropertyReader&)*this );
+    ReadDffPropSet( rIn, const_cast<DffPropertyReader&>(*this) );
 
     if ( IsProperty( DFF_Prop_hspMaster ) )
     {
@@ -266,7 +266,7 @@ void DffPropertyReader::ReadPropSet( SvStream& rIn, void* pClientData ) const
             bool bOk = ReadDffRecordHeader(rIn, aRecHd);
             if (bOk && SvxMSDffManager::SeekToRec(rIn, DFF_msofbtOPT, aRecHd.GetRecEndFilePos()))
             {
-                rIn |= (DffPropertyReader&)*this;
+                rIn |= const_cast<DffPropertyReader&>(*this);
             }
         }
     }
@@ -4479,7 +4479,7 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
                         css::uno::Sequence< css::drawing::EnhancedCustomShapeAdjustmentValue > seqAdjustmentValues;
 
                         // before clearing the GeometryItem we have to store the current Coordinates
-                        const uno::Any* pAny = ((SdrCustomShapeGeometryItem&)aGeometryItem).GetPropertyValueByName( sPath, sCoordinates );
+                        const uno::Any* pAny = aGeometryItem.GetPropertyValueByName( sPath, sCoordinates );
                         tools::Rectangle aPolyBoundRect;
                         Point aStartPt( 0,0 );
                         if ( pAny && ( *pAny >>= seqCoordinates ) && ( seqCoordinates.getLength() >= 4 ) )
@@ -4514,7 +4514,7 @@ SdrObject* SvxMSDffManager::ImportShape( const DffRecordHeader& rHd, SvStream& r
 
                         sal_Int32 nEndAngle = 9000;
                         sal_Int32 nStartAngle = 0;
-                        pAny = ((SdrCustomShapeGeometryItem&)aGeometryItem).GetPropertyValueByName( sAdjustmentValues );
+                        pAny = aGeometryItem.GetPropertyValueByName( sAdjustmentValues );
                         if ( pAny && ( *pAny >>= seqAdjustmentValues ) && seqAdjustmentValues.getLength() > 1 )
                         {
                             if ( seqAdjustmentValues[ 0 ].State == css::beans::PropertyState_DIRECT_VALUE )
diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index 966e5f773bc9..52af6cfab9d3 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -2318,13 +2318,13 @@ SdrObject* SdrPowerPointImport::ApplyTextObj( PPTTextObj* pTextObj, SdrTextObj*
                             aSelection.nEndPos = sal::static_int_cast< sal_uInt16 >(
                                 aSelection.nEndPos + nLen );
                     }
-                    pPortion->ApplyTo( aPortionAttribs, (SdrPowerPointImport&)*this, nDestinationInstance, pTextObj );
+                    pPortion->ApplyTo( aPortionAttribs, const_cast<SdrPowerPointImport&>(*this), nDestinationInstance, pTextObj );
                     rOutliner.QuickSetAttribs( aPortionAttribs, aSelection );
                     aSelection.nStartPos = aSelection.nEndPos;
                 }
                 boost::optional< sal_Int16 > oStartNumbering;
                 SfxItemSet aParagraphAttribs( rOutliner.GetEmptyItemSet() );
-                pPara->ApplyTo( aParagraphAttribs, oStartNumbering, (SdrPowerPointImport&)*this, nDestinationInstance );
+                pPara->ApplyTo( aParagraphAttribs, oStartNumbering, const_cast<SdrPowerPointImport&>(*this), nDestinationInstance );
 
                 sal_uInt32  nIsBullet2 = 0; //, nInstance = nDestinationInstance != 0xffffffff ? nDestinationInstance : pTextObj->GetInstance();
                 pPara->GetAttrib( PPT_ParaAttr_BulletOn, nIsBullet2, nDestinationInstance );
@@ -2606,7 +2606,7 @@ bool SdrPowerPointImport::SeekToShape( SvStream& rSt, void* pClientData, sal_uIn
                         if ( const_cast<SdrPowerPointImport*>(this)->maShapeRecords.SeekToContent( rSt, DFF_msofbtClientData, SEEK_FROM_CURRENT_AND_RESTART ) )
                         {
                             sal_uInt32 nStreamPos = rSt.Tell();
-                            PPTTextObj aTextObj( rSt, (SdrPowerPointImport&)*this, rPersistEntry, nullptr );
+                            PPTTextObj aTextObj( rSt, const_cast<SdrPowerPointImport&>(*this), rPersistEntry, nullptr );
                             if ( aTextObj.Count() || aTextObj.GetOEPlaceHolderAtom() )
                             {
                                 sal_uInt32 nShapePos = 0;
@@ -3037,7 +3037,7 @@ SdrObject* SdrPowerPointImport::ImportPageBackgroundObject( const SdrPage& rPage
                     //DffRecordHeader aEscherPropertiesHd;
                     if ( SeekToRec( rStCtrl, DFF_msofbtOPT,nEscherF002End ) )
                     {
-                        ReadDffPropSet( rStCtrl, (DffPropertyReader&)*this );
+                        ReadDffPropSet( rStCtrl, static_cast<DffPropertyReader&>(*this) );
                         mnFix16Angle = Fix16ToAngle( GetPropertyValue( DFF_Prop_Rotation, 0 ) );
                         sal_uInt32 nColor = GetPropertyValue( DFF_Prop_fillColor, 0xffffff );
                         pSet.reset(new SfxItemSet( pSdrModel->GetItemPool() ));
commit 420a8de648e77f7b065bac0bd8ef0d654fb0075e
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Sat Jun 3 21:13:03 2017 +0200

    Improved loplugin:cstylecast to reference types: forms
    
    Change-Id: Ide68579e892594875a5c38b3f62872d4eeae06cf

diff --git a/forms/source/component/ComboBox.cxx b/forms/source/component/ComboBox.cxx
index cc64d8bba73a..f461a25c7bd7 100644
--- a/forms/source/component/ComboBox.cxx
+++ b/forms/source/component/ComboBox.cxx
@@ -121,7 +121,7 @@ Any SAL_CALL OComboBoxModel::queryAggregation(const Type& _rType)
 OComboBoxModel::OComboBoxModel(const Reference<XComponentContext>& _rxFactory)
     :OBoundControlModel( _rxFactory, VCL_CONTROLMODEL_COMBOBOX, FRM_SUN_CONTROL_COMBOBOX, true, true, true )
      // use the old control name for compatibility reasons
-    ,OEntryListHelper( (OControlModel&)*this )
+    ,OEntryListHelper( static_cast<OControlModel&>(*this) )
     ,OErrorBroadcaster( OComponentHelper::rBHelper )
     ,m_aListRowSet()
     ,m_eListSourceType(ListSourceType_TABLE)
@@ -134,7 +134,7 @@ OComboBoxModel::OComboBoxModel(const Reference<XComponentContext>& _rxFactory)
 
 OComboBoxModel::OComboBoxModel( const OComboBoxModel* _pOriginal, const Reference<XComponentContext>& _rxFactory )
     :OBoundControlModel( _pOriginal, _rxFactory )
-    ,OEntryListHelper( *_pOriginal, (OControlModel&)*this )
+    ,OEntryListHelper( *_pOriginal, static_cast<OControlModel&>(*this) )
     ,OErrorBroadcaster( OComponentHelper::rBHelper )
     ,m_aListRowSet()
     ,m_aListSource( _pOriginal->m_aListSource )
diff --git a/forms/source/component/ListBox.cxx b/forms/source/component/ListBox.cxx
index a57322ed5ced..ee8a4beb90d5 100644
--- a/forms/source/component/ListBox.cxx
+++ b/forms/source/component/ListBox.cxx
@@ -154,7 +154,7 @@ namespace frm
     OListBoxModel::OListBoxModel(const Reference<XComponentContext>& _rxFactory)
         :OBoundControlModel( _rxFactory, VCL_CONTROLMODEL_LISTBOX, FRM_SUN_CONTROL_LISTBOX, true, true, true )
         // use the old control name for compatibility reasons
-        ,OEntryListHelper( (OControlModel&)*this )
+        ,OEntryListHelper( static_cast<OControlModel&>(*this) )
         ,OErrorBroadcaster( OComponentHelper::rBHelper )
         ,m_aListRowSet()
         ,m_nConvertedBoundValuesType(0)
@@ -173,7 +173,7 @@ namespace frm
 
     OListBoxModel::OListBoxModel( const OListBoxModel* _pOriginal, const Reference<XComponentContext>& _rxFactory )
         :OBoundControlModel( _pOriginal, _rxFactory )
-        ,OEntryListHelper( *_pOriginal, (OControlModel&)*this )
+        ,OEntryListHelper( *_pOriginal, static_cast<OControlModel&>(*this) )
         ,OErrorBroadcaster( OComponentHelper::rBHelper )
         ,m_aListRowSet()
         ,m_eListSourceType( _pOriginal->m_eListSourceType )
commit aed9c37e5a7d6be2fe698053b94ffccef8e6b8a5
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Sat Jun 3 21:12:43 2017 +0200

    Improved loplugin:cstylecast to reference types: hwpfilter
    
    Change-Id: Iab9d3845556b66341ca3298d6929502f50863f60

diff --git a/hwpfilter/source/hwpreader.cxx b/hwpfilter/source/hwpreader.cxx
index a07afb5a058a..8a6b6d7e794a 100644
--- a/hwpfilter/source/hwpreader.cxx
+++ b/hwpfilter/source/hwpreader.cxx
@@ -53,7 +53,7 @@
 // xmloff/xmlkyd.hxx
 #define sXML_CDATA "CDATA"
 
-#define STARTP  padd( "text:style-name", "CDATA", ascii(getPStyleName(((ParaShape &)para->GetParaShape()).index,buf))); \
+#define STARTP  padd( "text:style-name", "CDATA", ascii(getPStyleName((para->GetParaShape()).index,buf))); \
     rstartEl( "text:p",mxList.get() ); \
     mxList->clear(); \
     pstart = true
commit 606dd77518319b3a0b6b547c8c6b10cd994e1ab2
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Sat Jun 3 21:12:22 2017 +0200

    Improved loplugin:cstylecast to reference types: registry
    
    Change-Id: I94070f7712604bcd4d118b94cb0f85e0146a9db1

diff --git a/registry/source/regimpl.cxx b/registry/source/regimpl.cxx
index 21a15d4c9f69..ab517844801b 100644
--- a/registry/source/regimpl.cxx
+++ b/registry/source/regimpl.cxx
@@ -839,7 +839,7 @@ RegError ORegistry::deleteSubkeysAndValues(ORegKey* pKey)
             if (sFullPath.getLength() > 1)
                 sFullPath += ROOT;
 
-            if (((OStoreFile&)pKey->getStoreFile()).remove(sFullPath, keyName))
+            if (const_cast<OStoreFile&>(pKey->getStoreFile()).remove(sFullPath, keyName))
             {
                 return RegError::DELETE_VALUE_FAILED;
             }
commit ae75b0512fd7042d2f12ca66b136564bdf84b37a
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Sat Jun 3 21:12:10 2017 +0200

    Improved loplugin:cstylecast to reference types: reportdesign
    
    Change-Id: I63c951b4021db46d9cf6432dd56904a1b01a6c47

diff --git a/reportdesign/source/ui/report/ViewsWindow.cxx b/reportdesign/source/ui/report/ViewsWindow.cxx
index 67be39d52790..4547ce83814e 100644
--- a/reportdesign/source/ui/report/ViewsWindow.cxx
+++ b/reportdesign/source/ui/report/ViewsWindow.cxx
@@ -1604,7 +1604,7 @@ void OViewsWindow::handleKey(const vcl::KeyCode& _rCode)
 
                         // switch snapping off
                         if ( !bWasNoSnap )
-                            ((SdrDragStat&)rDragStat).SetNoSnap();
+                            const_cast<SdrDragStat&>(rDragStat).SetNoSnap();
                         if ( bWasSnapEnabled )
                             rView.SetSnapEnabled( false );
 
@@ -1644,7 +1644,7 @@ void OViewsWindow::handleKey(const vcl::KeyCode& _rCode)
 
                         // restore snap
                         if ( !bWasNoSnap )
-                            ((SdrDragStat&)rDragStat).SetNoSnap( bWasNoSnap );
+                            const_cast<SdrDragStat&>(rDragStat).SetNoSnap( bWasNoSnap );
                         if ( bWasSnapEnabled )
                             rView.SetSnapEnabled( bWasSnapEnabled );
                     }
diff --git a/reportdesign/source/ui/report/dlgedfunc.cxx b/reportdesign/source/ui/report/dlgedfunc.cxx
index 8feaed9150c0..a3bc7e3c3a3a 100644
--- a/reportdesign/source/ui/report/dlgedfunc.cxx
+++ b/reportdesign/source/ui/report/dlgedfunc.cxx
@@ -284,7 +284,7 @@ bool DlgEdFunc::handleKeyEvent(const KeyEvent& _rEvent)
                     const SdrHdlList& rHdlList = m_rView.GetHdlList();
                     SdrHdl* pHdl = rHdlList.GetFocusHdl();
                     if ( pHdl )
-                        ((SdrHdlList&)rHdlList).ResetFocusHdl();
+                        const_cast<SdrHdlList&>(rHdlList).ResetFocusHdl();
                     else
                         m_pParent->getSectionWindow()->getViewsWindow()->unmarkAllObjects(nullptr);
 
@@ -318,7 +318,7 @@ bool DlgEdFunc::handleKeyEvent(const KeyEvent& _rEvent)
                 {
                     // selected handle
                     const SdrHdlList& rHdlList = m_rView.GetHdlList();
-                    ((SdrHdlList&)rHdlList).TravelFocusHdl( !rCode.IsShift() );
+                    const_cast<SdrHdlList&>(rHdlList).TravelFocusHdl( !rCode.IsShift() );
 
                     // guarantee visibility of focused handle
                     SdrHdl* pHdl = rHdlList.GetFocusHdl();
commit c03009c69deffbc9d19e0f67f9a0e114298e55c4
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Sat Jun 3 21:11:52 2017 +0200

    Improved loplugin:cstylecast to reference types: sc
    
    Change-Id: I75bbb06a5dd7a458a8ddb605cd8d722b01da8f54

diff --git a/sc/source/core/data/column.cxx b/sc/source/core/data/column.cxx
index 565ce5be9afe..f0735c5a7948 100644
--- a/sc/source/core/data/column.cxx
+++ b/sc/source/core/data/column.cxx
@@ -1773,7 +1773,7 @@ void ScColumn::CopyScenarioFrom( const ScColumn& rSrcCol )
         {
             DeleteArea( nStart, nEnd, InsertDeleteFlags::CONTENTS );
             sc::CopyToDocContext aCxt(*pDocument);
-            ((ScColumn&)rSrcCol).
+            rSrcCol.
                 CopyToColumn(aCxt, nStart, nEnd, InsertDeleteFlags::CONTENTS, false, *this);
 
             //  UpdateUsed not needed, already done in TestCopyScenario (obsolete comment ?)
diff --git a/sc/source/core/data/documen3.cxx b/sc/source/core/data/documen3.cxx
index 14dc9c1ab0fa..4c4d25752207 100644
--- a/sc/source/core/data/documen3.cxx
+++ b/sc/source/core/data/documen3.cxx
@@ -1409,7 +1409,7 @@ void ScDocument::Reorder( const sc::ReorderParam& rParam )
 SCSIZE ScDocument::Query(SCTAB nTab, const ScQueryParam& rQueryParam, bool bKeepSub)
 {
     if ( ValidTab(nTab) && nTab < static_cast<SCTAB>(maTabs.size()) && maTabs[nTab] )
-        return maTabs[nTab]->Query((ScQueryParam&)rQueryParam, bKeepSub);
+        return maTabs[nTab]->Query(const_cast<ScQueryParam&>(rQueryParam), bKeepSub);
 
     OSL_FAIL("missing tab");
     return 0;
diff --git a/sc/source/core/data/drwlayer.cxx b/sc/source/core/data/drwlayer.cxx
index 97604b507141..f7364af902b8 100644
--- a/sc/source/core/data/drwlayer.cxx
+++ b/sc/source/core/data/drwlayer.cxx
@@ -2053,7 +2053,7 @@ IMapObject* ScDrawLayer::GetHitIMapObject( SdrObject* pObj,
     if ( pIMapInfo )
     {
         Size        aGraphSize;
-        ImageMap&   rImageMap = (ImageMap&) pIMapInfo->GetImageMap();
+        ImageMap&   rImageMap = const_cast<ImageMap&>(pIMapInfo->GetImageMap());
         Graphic     aGraphic;
         bool        bObjSupported = false;
 
diff --git a/sc/source/core/tool/autoform.cxx b/sc/source/core/tool/autoform.cxx
index 6b7cd8b84452..3940631fd176 100644
--- a/sc/source/core/tool/autoform.cxx
+++ b/sc/source/core/tool/autoform.cxx
@@ -633,7 +633,7 @@ void ScAutoFormatData::FillToItemSet( sal_uInt16 nIndex, SfxItemSet& rItemSet, S
 
     if( bIncludeValueFormat )
     {
-        ScNumFormatAbbrev& rNumFormat = (ScNumFormatAbbrev&)rField.GetNumFormat();
+        ScNumFormatAbbrev& rNumFormat = const_cast<ScNumFormatAbbrev&>(rField.GetNumFormat());
         SfxUInt32Item aValueFormat( ATTR_VALUE_FORMAT, 0 );
         aValueFormat.SetValue( rNumFormat.GetFormatIndex( *rDoc.GetFormatTable() ) );
         rItemSet.Put( aValueFormat );
diff --git a/sc/source/filter/xml/xmlcelli.cxx b/sc/source/filter/xml/xmlcelli.cxx
index 43e51e653886..56cbe3ba9462 100644
--- a/sc/source/filter/xml/xmlcelli.cxx
+++ b/sc/source/filter/xml/xmlcelli.cxx
@@ -133,7 +133,7 @@ ScXMLTableRowCellContext::ScXMLTableRowCellContext( ScXMLImport& rImport,
     nMergedCols(1),
     nMatrixCols(0),
     nColsRepeated(1),
-    rXMLImport((ScXMLImport&)rImport),
+    rXMLImport(rImport),
     eGrammar( formula::FormulaGrammar::GRAM_STORAGE_DEFAULT),
     nCellType(util::NumberFormat::TEXT),
     bIsMerged(false),
diff --git a/sc/source/ui/dbgui/tpsubt.cxx b/sc/source/ui/dbgui/tpsubt.cxx
index 0d3b1e1747b9..43f574740e78 100644
--- a/sc/source/ui/dbgui/tpsubt.cxx
+++ b/sc/source/ui/dbgui/tpsubt.cxx
@@ -275,7 +275,7 @@ void ScTpSubTotalGroup::FillListBoxes()
             i++;
         }
         // subsequent initialization of the constant:
-        (sal_uInt16&)nFieldCount = i;
+        const_cast<sal_uInt16&>(nFieldCount) = i;
     }
 }
 
diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx
index 26d2bfd7e3f5..63adda37a3f8 100644
--- a/sc/source/ui/docshell/docfunc.cxx
+++ b/sc/source/ui/docshell/docfunc.cxx
@@ -1437,7 +1437,7 @@ bool ScDocFunc::ApplyStyle( const ScMarkData& rMark, const OUString& rStyleName,
 
     }
 
-    rDoc.ApplySelectionStyle( (ScStyleSheet&)*pStyleSheet, rMark );
+    rDoc.ApplySelectionStyle( *pStyleSheet, rMark );
 
     if (!AdjustRowHeight( aMultiRange ))
         rDocShell.PostPaint( aMultiRange, PaintPartFlags::Grid );
diff --git a/sc/source/ui/docshell/docsh4.cxx b/sc/source/ui/docshell/docsh4.cxx
index ed773c3ebf38..5f14c552c5ba 100644
--- a/sc/source/ui/docshell/docsh4.cxx
+++ b/sc/source/ui/docshell/docsh4.cxx
@@ -1971,7 +1971,7 @@ tools::Rectangle ScDocShell::GetVisArea( sal_uInt16 nAspect ) const
             nStartCol = nEndCol;
         if (nStartRow>nEndRow)
             nStartRow = nEndRow;
-        tools::Rectangle aNewArea = ((ScDocument&)aDocument)
+        tools::Rectangle aNewArea = aDocument
                                 .GetMMRect( nStartCol,nStartRow, nEndCol,nEndRow, nVisTab );
         //TODO/LATER: different methods for setting VisArea?!
         const_cast<ScDocShell*>(this)->SfxObjectShell::SetVisArea( aNewArea );
diff --git a/sc/source/ui/drawfunc/drtxtob.cxx b/sc/source/ui/drawfunc/drtxtob.cxx
index 8dcf933461f6..a4b096213b49 100644
--- a/sc/source/ui/drawfunc/drtxtob.cxx
+++ b/sc/source/ui/drawfunc/drtxtob.cxx
@@ -596,7 +596,7 @@ static void lcl_RemoveFields( OutlinerView& rOutView )
     bool bChanged = false;
 
     //! GetPortions and GetAttribs should be const!
-    EditEngine& rEditEng = (EditEngine&)pOutliner->GetEditEngine();
+    EditEngine& rEditEng = const_cast<EditEngine&>(pOutliner->GetEditEngine());
 
     sal_Int32 nParCount = pOutliner->GetParagraphCount();
     for (sal_Int32 nPar=0; nPar<nParCount; nPar++)
diff --git a/sc/source/ui/drawfunc/fudraw.cxx b/sc/source/ui/drawfunc/fudraw.cxx
index ce68e1f9cb67..7da26ee75f5f 100644
--- a/sc/source/ui/drawfunc/fudraw.cxx
+++ b/sc/source/ui/drawfunc/fudraw.cxx
@@ -294,7 +294,7 @@ bool FuDraw::KeyInput(const KeyEvent& rKEvt)
                     const SdrHdlList& rHdlList = pView->GetHdlList();
                     bool bForward(!rKEvt.GetKeyCode().IsShift());
 
-                    ((SdrHdlList&)rHdlList).TravelFocusHdl(bForward);
+                    const_cast<SdrHdlList&>(rHdlList).TravelFocusHdl(bForward);
 
                     // guarantee visibility of focused handle
                     SdrHdl* pHdl = rHdlList.GetFocusHdl();
@@ -506,7 +506,7 @@ bool FuDraw::KeyInput(const KeyEvent& rKEvt)
 
                                     // switch snapping off
                                     if(!bWasNoSnap)
-                                        ((SdrDragStat&)rDragStat).SetNoSnap();
+                                        const_cast<SdrDragStat&>(rDragStat).SetNoSnap();
                                     if(bWasSnapEnabled)
                                         pView->SetSnapEnabled(false);
 
@@ -515,7 +515,7 @@ bool FuDraw::KeyInput(const KeyEvent& rKEvt)
 
                                     // restore snap
                                     if(!bWasNoSnap)
-                                        ((SdrDragStat&)rDragStat).SetNoSnap(bWasNoSnap);
+                                        const_cast<SdrDragStat&>(rDragStat).SetNoSnap(bWasNoSnap);
                                     if(bWasSnapEnabled)
                                         pView->SetSnapEnabled(bWasSnapEnabled);
                                 }
@@ -586,7 +586,7 @@ bool FuDraw::KeyInput(const KeyEvent& rKEvt)
 
                             if(pNewOne)
                             {
-                                ((SdrHdlList&)rHdlList).SetFocusHdl(pNewOne);
+                                const_cast<SdrHdlList&>(rHdlList).SetFocusHdl(pNewOne);
                             }
                         }
 
diff --git a/sc/source/ui/miscdlgs/autofmt.cxx b/sc/source/ui/miscdlgs/autofmt.cxx
index ee19ebcf9d3c..c228e2f8f4d5 100644
--- a/sc/source/ui/miscdlgs/autofmt.cxx
+++ b/sc/source/ui/miscdlgs/autofmt.cxx
@@ -235,7 +235,7 @@ void ScAutoFmtPreview::DrawString(vcl::RenderContext& rRenderContext, size_t nCo
         mknum:
             if (bNumFormat)
             {
-                ScNumFormatAbbrev& rNumFormat = (ScNumFormatAbbrev&) pCurData->GetNumFormat(sal_uInt16(nNum));
+                ScNumFormatAbbrev& rNumFormat = const_cast<ScNumFormatAbbrev&>(pCurData->GetNumFormat(sal_uInt16(nNum)));
                 nNum = rNumFormat.GetFormatIndex(*pNumFmt);
             }
             else
diff --git a/sc/source/ui/view/cellsh.cxx b/sc/source/ui/view/cellsh.cxx
index 2bc601a1ae72..202598956891 100644
--- a/sc/source/ui/view/cellsh.cxx
+++ b/sc/source/ui/view/cellsh.cxx
@@ -424,7 +424,7 @@ static bool lcl_TestFormat( SvxClipboardFormatItem& rFormats, const Transferable
         if ( nFormatId == SotClipboardFormatId::EMBED_SOURCE )
         {
             TransferableObjectDescriptor aDesc;
-            if ( ((TransferableDataHelper&)rDataHelper).GetTransferableObjectDescriptor(
+            if ( const_cast<TransferableDataHelper&>(rDataHelper).GetTransferableObjectDescriptor(
                                         SotClipboardFormatId::OBJECTDESCRIPTOR, aDesc ) )
                 aStrVal = aDesc.maTypeName;
         }
diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx
index a4edfae9770d..42c97db3185f 100644
--- a/sc/source/ui/view/printfun.cxx
+++ b/sc/source/ui/view/printfun.cxx
@@ -1093,7 +1093,7 @@ static void lcl_DrawGraphic( const Graphic &rGraphic, vcl::RenderContext *pOut,
         pOut->IntersectClipRegion( rOut );
     }
 
-    ((Graphic&)rGraphic).Draw( pOut, rGrf.TopLeft(), rGrf.GetSize() );
+    rGraphic.Draw( pOut, rGrf.TopLeft(), rGrf.GetSize() );
 
     if ( bNotInside )
         pOut->Pop();
commit 760cd5b67be4225b6ff47b80a9afa97f2ddb466a
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Sat Jun 3 21:11:22 2017 +0200

    Improved loplugin:cstylecast to reference types: sd
    
    Change-Id: Icce4141f8aef688d85d219021606530839fb276f

diff --git a/sd/qa/unit/import-tests.cxx b/sd/qa/unit/import-tests.cxx
index d379b1fd86c4..a5be80b54a95 100644
--- a/sd/qa/unit/import-tests.cxx
+++ b/sd/qa/unit/import-tests.cxx
@@ -594,7 +594,7 @@ void SdImportTest::testFdo72998()
         SdrObjCustomShape *pObj = dynamic_cast<SdrObjCustomShape *>(pPage->GetObj(2));
         CPPUNIT_ASSERT( pObj );
         const SdrCustomShapeGeometryItem& rGeometryItem = static_cast<const SdrCustomShapeGeometryItem&>(pObj->GetMergedItem( SDRATTR_CUSTOMSHAPE_GEOMETRY ));
-        const css::uno::Any* pViewBox = ((SdrCustomShapeGeometryItem&)rGeometryItem).GetPropertyValueByName( OUString( "ViewBox" ) );
+        const css::uno::Any* pViewBox = const_cast<SdrCustomShapeGeometryItem&>(rGeometryItem).GetPropertyValueByName( OUString( "ViewBox" ) );
         CPPUNIT_ASSERT_MESSAGE( "Missing ViewBox", pViewBox );
         css::awt::Rectangle aViewBox;
         CPPUNIT_ASSERT( (*pViewBox >>= aViewBox ) );
diff --git a/sd/source/core/drawdoc2.cxx b/sd/source/core/drawdoc2.cxx
index 917c486c7408..73bd440f9c54 100644
--- a/sd/source/core/drawdoc2.cxx
+++ b/sd/source/core/drawdoc2.cxx
@@ -1043,7 +1043,7 @@ IMapObject* SdDrawDocument::GetHitIMapObject( SdrObject* pObj,
         const MapMode       aMap100( MapUnit::Map100thMM );
         Size                aGraphSize;
         Point               aRelPoint( rWinPoint );
-        ImageMap&           rImageMap = (ImageMap&) pIMapInfo->GetImageMap();
+        ImageMap&           rImageMap = const_cast<ImageMap&>(pIMapInfo->GetImageMap());
         const ::tools::Rectangle&    rRect = pObj->GetLogicRect();
         bool                bObjSupported = false;
 
diff --git a/sd/source/filter/eppt/epptso.cxx b/sd/source/filter/eppt/epptso.cxx
index 4a465c5328fe..f73a882ff0f3 100644
--- a/sd/source/filter/eppt/epptso.cxx
+++ b/sd/source/filter/eppt/epptso.cxx
@@ -1068,7 +1068,7 @@ void PPTWriter::ImplWriteTextStyleAtom( SvStream& rOut, int nTextInstance, sal_u
     if ( !mbEmptyPresObj )
     {
         ParagraphObj* pPara;
-        TextObjBinary aTextObj( mXText, nTextInstance, maFontCollection, (PPTExBulletProvider&)*this );
+        TextObjBinary aTextObj( mXText, nTextInstance, maFontCollection, static_cast<PPTExBulletProvider&>(*this) );
 
         // leaving out EPP_TextCharsAtom w/o text - still write out
         // attribute info though
@@ -2249,7 +2249,7 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a
                         bIsTitlePossible = false;
 
                         ImplGetText();
-                        TextObjBinary aTextObj( mXText, EPP_TEXTTYPE_Title, maFontCollection, (PPTExBulletProvider&)*this );
+                        TextObjBinary aTextObj( mXText, EPP_TEXTTYPE_Title, maFontCollection, static_cast<PPTExBulletProvider&>(*this) );
                         if ( ePageType == MASTER )
                         {
                             if ( mnTextSize )
@@ -2343,7 +2343,7 @@ void PPTWriter::ImplWritePage( const PHLayout& rLayout, EscherSolverContainer& a
                        )
                     {
                         ImplGetText();
-                        TextObjBinary aTextObj( mXText, EPP_TEXTTYPE_Body, maFontCollection, (PPTExBulletProvider&)*this );
+                        TextObjBinary aTextObj( mXText, EPP_TEXTTYPE_Body, maFontCollection, static_cast<PPTExBulletProvider&>(*this) );
                         if ( ePageType == MASTER )
                         {
                             nPrevTextStyle = EPP_TEXTSTYLE_TITLE;
diff --git a/sd/source/filter/eppt/pptexanimations.cxx b/sd/source/filter/eppt/pptexanimations.cxx
index 5ffc215ded64..35157a49cedb 100644
--- a/sd/source/filter/eppt/pptexanimations.cxx
+++ b/sd/source/filter/eppt/pptexanimations.cxx
@@ -1776,7 +1776,7 @@ void AnimationExporter::exportAnimateTargetElement( SvStream& rStrm, const Any&
             EscherExAtom aAnimReference( rStrm, DFF_msofbtAnimReference );
 
             sal_uInt32 nRefType = 1;    // TODO: nRefType == 2 -> Sound;
-            sal_uInt32 nRefId = ((EscherSolverContainer&)mrSolverContainer).GetShapeId( xShape );
+            sal_uInt32 nRefId = mrSolverContainer.GetShapeId( xShape );
 
             rStrm.WriteUInt32( nRefMode )
                  .WriteUInt32( nRefType )
diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx
index 9c4574d8729b..c2613ebc41a4 100644
--- a/sd/source/filter/ppt/pptin.cxx
+++ b/sd/source/filter/ppt/pptin.cxx
@@ -245,7 +245,7 @@ bool ImplSdPPTImport::Import()
     EEControlBits nControlWord = rOutl.GetEditEngine().GetControlWord();
     nControlWord |=  EEControlBits::ULSPACESUMMATION;
     nControlWord &= ~EEControlBits::ULSPACEFIRSTPARA;
-    ((EditEngine&)rOutl.GetEditEngine()).SetControlWord( nControlWord );
+    const_cast<EditEngine&>(rOutl.GetEditEngine()).SetControlWord( nControlWord );
 
     SdrLayerAdmin& rAdmin = mpDoc->GetLayerAdmin();
     mnBackgroundLayerID = rAdmin.GetLayerID( SdResId( STR_LAYER_BCKGRND ) );
@@ -607,8 +607,8 @@ bool ImplSdPPTImport::Import()
                             PPTParagraphObj aParagraph( *pPPTStyleSheet, TSS_Type::TextInShape, 0 );
                             PPTPortionObj aPortion( *pPPTStyleSheet, TSS_Type::TextInShape, 0 );
                             aParagraph.AppendPortion( aPortion );
-                            aParagraph.ApplyTo( rItemSet, oStartNumbering, (SdrPowerPointImport&)*this, TSS_Type::Unknown );
-                            aPortion.ApplyTo( rItemSet, (SdrPowerPointImport&)*this, TSS_Type::Unknown );
+                            aParagraph.ApplyTo( rItemSet, oStartNumbering, static_cast<SdrPowerPointImport&>(*this), TSS_Type::Unknown );
+                            aPortion.ApplyTo( rItemSet, static_cast<SdrPowerPointImport&>(*this), TSS_Type::Unknown );
                         }
                     }
 
@@ -620,8 +620,8 @@ bool ImplSdPPTImport::Import()
                         PPTParagraphObj aParagraph( *pPPTStyleSheet, TSS_Type::TextInShape, 0 );
                         PPTPortionObj aPortion( *pPPTStyleSheet, TSS_Type::TextInShape, 0 );
                         aParagraph.AppendPortion( aPortion );
-                        aParagraph.ApplyTo( rItemSet, oStartNumbering, (SdrPowerPointImport&)*this, TSS_Type::Unknown );
-                        aPortion.ApplyTo( rItemSet, (SdrPowerPointImport&)*this, TSS_Type::Unknown );
+                        aParagraph.ApplyTo( rItemSet, oStartNumbering, static_cast<SdrPowerPointImport&>(*this), TSS_Type::Unknown );
+                        aPortion.ApplyTo( rItemSet, static_cast<SdrPowerPointImport&>(*this), TSS_Type::Unknown );
                     }
 
                     // create layoutstylesheets, set layoutname and stylesheet
@@ -665,8 +665,8 @@ bool ImplSdPPTImport::Import()
                             PPTParagraphObj aParagraph( *pPPTStyleSheet, nTitleInstance, 0 );
                             PPTPortionObj aPortion( *pPPTStyleSheet, nTitleInstance, 0 );
                             aParagraph.AppendPortion( aPortion );
-                            aParagraph.ApplyTo( rItemSet, oStartNumbering, (SdrPowerPointImport&)*this, TSS_Type::Unknown );
-                            aPortion.ApplyTo( rItemSet, (SdrPowerPointImport&)*this, TSS_Type::Unknown );
+                            aParagraph.ApplyTo( rItemSet, oStartNumbering, static_cast<SdrPowerPointImport&>(*this), TSS_Type::Unknown );
+                            aPortion.ApplyTo( rItemSet, static_cast<SdrPowerPointImport&>(*this), TSS_Type::Unknown );
                         }
 
                         // outlinerstylesheet
@@ -686,8 +686,8 @@ bool ImplSdPPTImport::Import()
                                 SfxItemSet& rItemSet = pOutlineSheet->GetItemSet();
                                 PPTPortionObj aPortion( *pPPTStyleSheet, nOutlinerInstance, nLevel );
                                 pParagraphs[ nLevel ]->AppendPortion( aPortion );
-                                pParagraphs[ nLevel ]->ApplyTo( rItemSet, oStartNumbering, (SdrPowerPointImport&)*this, TSS_Type::Unknown );
-                                aPortion.ApplyTo( rItemSet, (SdrPowerPointImport&)*this, TSS_Type::Unknown );
+                                pParagraphs[ nLevel ]->ApplyTo( rItemSet, oStartNumbering, static_cast<SdrPowerPointImport&>(*this), TSS_Type::Unknown );
+                                aPortion.ApplyTo( rItemSet, static_cast<SdrPowerPointImport&>(*this), TSS_Type::Unknown );
                             }
                             else
                                 pParagraphs[ nLevel ] = nullptr;
@@ -702,8 +702,8 @@ bool ImplSdPPTImport::Import()
                             PPTParagraphObj aParagraph( *pPPTStyleSheet, TSS_Type::Subtitle, 0 );
                             PPTPortionObj aPortion( *pPPTStyleSheet, TSS_Type::Subtitle, 0 );
                             aParagraph.AppendPortion( aPortion );
-                            aParagraph.ApplyTo( rItemSet, oStartNumbering, (SdrPowerPointImport&)*this, TSS_Type::Unknown );
-                            aPortion.ApplyTo( rItemSet, (SdrPowerPointImport&)*this, TSS_Type::Unknown );
+                            aParagraph.ApplyTo( rItemSet, oStartNumbering, static_cast<SdrPowerPointImport&>(*this), TSS_Type::Unknown );
+                            aPortion.ApplyTo( rItemSet, static_cast<SdrPowerPointImport&>(*this), TSS_Type::Unknown );
                         }
                     }
                     else if ( ePgKind == PageKind::Notes )
@@ -715,8 +715,8 @@ bool ImplSdPPTImport::Import()
                             PPTParagraphObj aParagraph( *pPPTStyleSheet, TSS_Type::Notes, 0 );
                             PPTPortionObj aPortion( *pPPTStyleSheet, TSS_Type::Notes, 0 );
                             aParagraph.AppendPortion( aPortion );
-                            aParagraph.ApplyTo( rItemSet, oStartNumbering, (SdrPowerPointImport&)*this, TSS_Type::Unknown );
-                            aPortion.ApplyTo( rItemSet, (SdrPowerPointImport&)*this, TSS_Type::Unknown );
+                            aParagraph.ApplyTo( rItemSet, oStartNumbering, static_cast<SdrPowerPointImport&>(*this), TSS_Type::Unknown );
+                            aPortion.ApplyTo( rItemSet, static_cast<SdrPowerPointImport&>(*this), TSS_Type::Unknown );
                         }
                     }
                 }
@@ -2439,7 +2439,7 @@ SdrObject* ImplSdPPTImport::ApplyTextObj( PPTTextObj* pTextObj, SdrTextObj* pObj
                                 {
                                     if ( PPTPortionObj * pPor = pPara->First() )
                                     {
-                                        pPor->ApplyTo(aSet, (SdrPowerPointImport&)*this, pTextObj->GetDestinationInstance());
+                                        pPor->ApplyTo(aSet, const_cast<SdrPowerPointImport&>(static_cast<SdrPowerPointImport const &>(*this)), pTextObj->GetDestinationInstance());
                                     }
                                 }
                             }
diff --git a/sd/source/ui/animations/motionpathtag.cxx b/sd/source/ui/animations/motionpathtag.cxx
index 9de47d3750b4..a871239e64a7 100644
--- a/sd/source/ui/animations/motionpathtag.cxx
+++ b/sd/source/ui/animations/motionpathtag.cxx
@@ -596,7 +596,7 @@ bool MotionPathTag::OnTabHandles( const KeyEvent& rKEvt )
         const SdrHdlList& rHdlList = mrView.GetHdlList();
         bool bForward(!rKEvt.GetKeyCode().IsShift());
 
-        ((SdrHdlList&)rHdlList).TravelFocusHdl(bForward);
+        const_cast<SdrHdlList&>(rHdlList).TravelFocusHdl(bForward);
 
         // guarantee visibility of focused handle
         SdrHdl* pHdl = rHdlList.GetFocusHdl();
@@ -659,7 +659,7 @@ bool MotionPathTag::OnMarkHandle( const KeyEvent& rKEvt )
             }
 
             if(pNewOne)
-                ((SdrHdlList&)rHdlList).SetFocusHdl(pNewOne);
+                const_cast<SdrHdlList&>(rHdlList).SetFocusHdl(pNewOne);
         }
     }
 
@@ -730,7 +730,7 @@ bool MotionPathTag::OnMove( const KeyEvent& rKEvt )
 
                 // switch snapping off
                 if(!bWasNoSnap)
-                    ((SdrDragStat&)mrView.GetDragStat()).SetNoSnap();
+                    const_cast<SdrDragStat&>(mrView.GetDragStat()).SetNoSnap();
                 if(bWasSnapEnabled)
                     mrView.SetSnapEnabled(false);
 
@@ -739,7 +739,7 @@ bool MotionPathTag::OnMove( const KeyEvent& rKEvt )
 
                 // restore snap
                 if(!bWasNoSnap)
-                    ((SdrDragStat&)mrView.GetDragStat()).SetNoSnap(bWasNoSnap);
+                    const_cast<SdrDragStat&>(mrView.GetDragStat()).SetNoSnap(bWasNoSnap);
                 if(bWasSnapEnabled)
                     mrView.SetSnapEnabled(bWasSnapEnabled);
             }
diff --git a/sd/source/ui/docshell/docshel4.cxx b/sd/source/ui/docshell/docshel4.cxx
index 773bfd506a7e..1e4c7c885d94 100644
--- a/sd/source/ui/docshell/docshel4.cxx
+++ b/sd/source/ui/docshell/docshel4.cxx
@@ -405,7 +405,7 @@ bool DrawDocShell::ImportFrom(SfxMedium &rMedium,
         EEControlBits nControlWord = rOutl.GetEditEngine().GetControlWord();
         nControlWord |=  EEControlBits::ULSPACESUMMATION;
         nControlWord &=~ EEControlBits::ULSPACEFIRSTPARA;
-        ((EditEngine&)rOutl.GetEditEngine()).SetControlWord( nControlWord );
+        const_cast<EditEngine&>(rOutl.GetEditEngine()).SetControlWord( nControlWord );
 
         mpDoc->SetSummationOfParagraphs();
     }
diff --git a/sd/source/ui/func/fudraw.cxx b/sd/source/ui/func/fudraw.cxx
index 2501ecb59fda..4494d8476e3e 100644
--- a/sd/source/ui/func/fudraw.cxx
+++ b/sd/source/ui/func/fudraw.cxx
@@ -961,7 +961,7 @@ bool FuDraw::cancel()
 
         if(pHdl)
         {
-            ((SdrHdlList&)rHdlList).ResetFocusHdl();
+            const_cast<SdrHdlList&>(rHdlList).ResetFocusHdl();
         }
         else
         {
diff --git a/sd/source/ui/func/fupoor.cxx b/sd/source/ui/func/fupoor.cxx
index 8fa2896794ef..5589ca9f0345 100644
--- a/sd/source/ui/func/fupoor.cxx
+++ b/sd/source/ui/func/fupoor.cxx
@@ -288,7 +288,7 @@ bool FuPoor::KeyInput(const KeyEvent& rKEvt)
                 const SdrHdlList& rHdlList = mpView->GetHdlList();
                 bool bForward(!rKEvt.GetKeyCode().IsShift());
 
-                ((SdrHdlList&)rHdlList).TravelFocusHdl(bForward);
+                const_cast<SdrHdlList&>(rHdlList).TravelFocusHdl(bForward);
 
                 // guarantee visibility of focused handle
                 SdrHdl* pHdl = rHdlList.GetFocusHdl();
@@ -569,7 +569,7 @@ bool FuPoor::KeyInput(const KeyEvent& rKEvt)
 
                         if(pNewOne)
                         {
-                            ((SdrHdlList&)rHdlList).SetFocusHdl(pNewOne);
+                            const_cast<SdrHdlList&>(rHdlList).SetFocusHdl(pNewOne);
                         }
                     }
 
@@ -752,7 +752,7 @@ bool FuPoor::KeyInput(const KeyEvent& rKEvt)
 
                                 // switch snapping off
                                 if(!bWasNoSnap)
-                                    ((SdrDragStat&)rDragStat).SetNoSnap();
+                                    const_cast<SdrDragStat&>(rDragStat).SetNoSnap();
                                 if(bWasSnapEnabled)
                                     mpView->SetSnapEnabled(false);
 
@@ -761,7 +761,7 @@ bool FuPoor::KeyInput(const KeyEvent& rKEvt)
 
                                 // restore snap
                                 if(!bWasNoSnap)
-                                    ((SdrDragStat&)rDragStat).SetNoSnap(bWasNoSnap);
+                                    const_cast<SdrDragStat&>(rDragStat).SetNoSnap(bWasNoSnap);
                                 if(bWasSnapEnabled)
                                     mpView->SetSnapEnabled(bWasSnapEnabled);
                             }
@@ -891,7 +891,7 @@ bool FuPoor::MouseMove(const MouseEvent& )
 void FuPoor::SelectionHasChanged()
 {
     const SdrHdlList& rHdlList = mpView->GetHdlList();
-    ((SdrHdlList&)rHdlList).ResetFocusHdl();
+    const_cast<SdrHdlList&>(rHdlList).ResetFocusHdl();
 }
 
 /**
commit 03f2dbfabf2d1e8906ac7c3ec5d230facb0ec57c
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Sat Jun 3 21:11:10 2017 +0200

    Improved loplugin:cstylecast to reference types: sfx2
    
    Change-Id: I0e5be42d78130c34e6ec39c32d463ed15d59b377

diff --git a/sfx2/source/doc/docfilt.cxx b/sfx2/source/doc/docfilt.cxx
index c7d1d219b609..8d8876bc9191 100644
--- a/sfx2/source/doc/docfilt.cxx
+++ b/sfx2/source/doc/docfilt.cxx
@@ -166,7 +166,7 @@ OUString SfxFilter::GetTypeFromStorage( const SotStorage& rStg )
     }
     else
     {
-        SotClipboardFormatId nClipId = ((SotStorage&)rStg).GetFormat();
+        SotClipboardFormatId nClipId = const_cast<SotStorage&>(rStg).GetFormat();
         if ( nClipId != SotClipboardFormatId::NONE )
         {
             std::shared_ptr<const SfxFilter> pFilter = SfxFilterMatcher().GetFilter4ClipBoardId( nClipId );
diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx
index ca419ab37d64..36ac1f9faad1 100644
--- a/sfx2/source/doc/objcont.cxx
+++ b/sfx2/source/doc/objcont.cxx
@@ -250,7 +250,7 @@ void SfxObjectShell::UpdateTime_Impl(
         if (nDays==0)
         {
             // If no day between now and last editing - calculate time directly.
-            nAddTime    =   (const tools::Time&)aNow - (const tools::Time&)pImpl->nTime ;
+            nAddTime    =   static_cast<const tools::Time&>(aNow) - static_cast<const tools::Time&>(pImpl->nTime);
         }
         else if (nDays<=31)
         {
@@ -261,7 +261,7 @@ void SfxObjectShell::UpdateTime_Impl(
             // nAddTime = (24h - nTime) + (nDays * 24h) + aNow
             --nDays;
              nAddTime    =  nDays*n24Time.GetTime() ;
-            nAddTime    +=  n24Time-(const tools::Time&)pImpl->nTime        ;
+            nAddTime    +=  n24Time-static_cast<const tools::Time&>(pImpl->nTime);
             nAddTime    +=  aNow                    ;
         }
 
commit eaa689639fb3e02c204ab3fa132f79aed5b598c7
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Sat Jun 3 21:10:50 2017 +0200

    Improved loplugin:cstylecast to reference types: sot
    
    Change-Id: I14135642998ef08dfb4aa4c7e10b327cf8d33de7

diff --git a/sot/source/base/formats.cxx b/sot/source/base/formats.cxx
index ad0a0c0a5525..b2fde5323c06 100644
--- a/sot/source/base/formats.cxx
+++ b/sot/source/base/formats.cxx
@@ -1321,8 +1321,8 @@ SotDestinationEntry_Impl const aDestinationArray[] =
 
 bool IsFormatSupported( const DataFlavorExVector& rDataFlavorExVector, SotClipboardFormatId nId )
 {
-    DataFlavorExVector::iterator    aIter( ( (DataFlavorExVector&) rDataFlavorExVector ).begin() );
-    DataFlavorExVector::iterator    aEnd( ( (DataFlavorExVector&) rDataFlavorExVector ).end() );
+    auto aIter( rDataFlavorExVector.begin() );
+    auto aEnd( rDataFlavorExVector.end() );
     bool bRet = false;
 
     while( aIter != aEnd )
diff --git a/sot/source/sdstor/stg.cxx b/sot/source/sdstor/stg.cxx
index f2a01cf4eb75..04e1ea3f18ca 100644
--- a/sot/source/sdstor/stg.cxx
+++ b/sot/source/sdstor/stg.cxx
@@ -831,11 +831,11 @@ void Storage::SetClass( const SvGlobalName & rClass,
     if( Validate( true ) )
     {
         // set the class name in the root entry
-        pEntry->m_aEntry.SetClassId( (const ClsId&) rClass.GetCLSID() );
+        pEntry->m_aEntry.SetClassId( rClass.GetCLSID() );
         pEntry->SetDirty();
         // then create the streams
         StgCompObjStream aCompObj( *this, true );
-        aCompObj.GetClsId() = (const ClsId&) rClass.GetCLSID();
+        aCompObj.GetClsId() = rClass.GetCLSID();
         aCompObj.GetCbFormat() = nOriginalClipFormat;
         aCompObj.GetUserName() = rUserTypeName;
         if( !aCompObj.Store() )
diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx
index abd2a244f1a2..bfe31956e8f6 100644
--- a/sot/source/sdstor/ucbstorage.cxx
+++ b/sot/source/sdstor/ucbstorage.cxx
@@ -2392,7 +2392,7 @@ void UCBStorage::SetClassId( const ClsId& rClsId )
 
 const ClsId& UCBStorage::GetClassId() const
 {
-    return ( const ClsId& ) pImp->m_aClassId.GetCLSID();
+    return pImp->m_aClassId.GetCLSID();
 }
 
 SvGlobalName UCBStorage::GetClassName()
commit 943a73ac8450fc0afc9792945a8f4428e903d9da
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Sat Jun 3 21:10:32 2017 +0200

    Improved loplugin:cstylecast to reference types: stoc
    
    Change-Id: I73909ff3bd5258d87d2a5f7d06d96ae447b13089

diff --git a/stoc/source/inspect/introspection.cxx b/stoc/source/inspect/introspection.cxx
index 986e57fb4642..1089e1477f8e 100644
--- a/stoc/source/inspect/introspection.cxx
+++ b/stoc/source/inspect/introspection.cxx
@@ -476,7 +476,7 @@ void IntrospectionAccessStatic_Impl::setPropertyValueByIndex(const Any& obj, sal
             Reference<XIdlField2> xField2(xField, UNO_QUERY);
             if( xField2.is() )
             {
-                xField2->set( (Any&)obj, aValue );
+                xField2->set( const_cast<Any&>(obj), aValue );
                 // IllegalArgumentException
                 // NullPointerException
             } else
commit 3631ef8ceaa72525f84226cb5017dadea2c2c414
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Sat Jun 3 21:10:18 2017 +0200

    Improved loplugin:cstylecast to reference types: store
    
    Change-Id: I78213cb2b8812ebdd1354c045318d081e4197934

diff --git a/store/source/storbios.hxx b/store/source/storbios.hxx
index 336a37ff0515..a563f5b55a12 100644
--- a/store/source/storbios.hxx
+++ b/store/source/storbios.hxx
@@ -178,7 +178,7 @@ private:
 
 inline OStorePageBIOS::operator osl::Mutex& (void) const
 {
-    return (osl::Mutex&)m_aMutex;
+    return const_cast<osl::Mutex&>(m_aMutex);
 }
 inline bool OStorePageBIOS::isWriteable() const
 {
commit 31c3ca9fef4af2773668d4c7703bd851e012c55a
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Sat Jun 3 21:10:04 2017 +0200

    Improved loplugin:cstylecast to reference types: svl
    
    Change-Id: I37cc0ba5d05c198795c6ae3d0f1037aa1221cfb6

diff --git a/svl/source/items/itempool.cxx b/svl/source/items/itempool.cxx
index 36b2eb006f77..fcd84bf6b510 100644
--- a/svl/source/items/itempool.cxx
+++ b/svl/source/items/itempool.cxx
@@ -761,8 +761,7 @@ void SfxItemPool::Remove( const SfxPoolItem& rItem )
         assert(!IsDefaultItem(&rItem) && "a non Pool Item is Default?!");
         if ( 0 == ReleaseRef(rItem) )
         {
-            SfxPoolItem *pItem = &(SfxPoolItem &)rItem;
-            delete pItem;
+            delete &rItem;
         }
         return;
     }
commit 6616e886ae33e54d6048e2f8b635b5a358dccc01
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Sat Jun 3 21:09:20 2017 +0200

    Improved loplugin:cstylecast to reference types: svtools
    
    Change-Id: I7ac860cdf68e920834a65573a6f3344855840332

diff --git a/svtools/source/graphic/grfcache.cxx b/svtools/source/graphic/grfcache.cxx
index fe31de3fb51e..4c8adaf767e2 100644
--- a/svtools/source/graphic/grfcache.cxx
+++ b/svtools/source/graphic/grfcache.cxx
@@ -258,7 +258,7 @@ bool GraphicCacheEntry::ImplInit( const GraphicObject& rObj )
         }
 
         if( rGraphic.IsLink() )
-            maGfxLink = ( (Graphic&) rGraphic ).GetLink();
+            maGfxLink = rGraphic.GetLink();
         else
             maGfxLink = GfxLink();
 
@@ -1001,7 +1001,7 @@ void GraphicCache::GraphicObjectWasSwappedIn( const GraphicObject& rObj )
         if( pEntry->GetID().IsEmpty() )
         {
             ReleaseGraphicObject( rObj );
-            AddGraphicObject( rObj, (Graphic&) rObj.GetGraphic(), nullptr, nullptr );
+            AddGraphicObject( rObj, const_cast<Graphic&>(rObj.GetGraphic()), nullptr, nullptr );
         }
         else
             pEntry->GraphicObjectWasSwappedIn( rObj );
diff --git a/svtools/source/misc/transfer2.cxx b/svtools/source/misc/transfer2.cxx
index 5e9b8374895f..863d8c1133c9 100644
--- a/svtools/source/misc/transfer2.cxx
+++ b/svtools/source/misc/transfer2.cxx
@@ -133,11 +133,11 @@ void SAL_CALL DropTargetHelper::DropTargetListener::drop( const DropTargetDropEv
         // accepted action as the execute action in the call to ::ExecuteDrop
         aAcceptEvent.mnAction = aExecuteEvt.mnAction;
         aAcceptEvent.maPosPixel = aExecuteEvt.maPosPixel;
-        (DropTargetEvent&)( aAcceptEvent.maDragEvent ) = (DropTargetEvent&) rDTDE;
-        ( (DropTargetDragEvent&)( aAcceptEvent.maDragEvent ) ).DropAction = rDTDE.DropAction;
-        ( (DropTargetDragEvent&)( aAcceptEvent.maDragEvent ) ).LocationX = rDTDE.LocationX;
-        ( (DropTargetDragEvent&)( aAcceptEvent.maDragEvent ) ).LocationY = rDTDE.LocationY;
-        ( (DropTargetDragEvent&)( aAcceptEvent.maDragEvent ) ).SourceActions = rDTDE.SourceActions;
+        static_cast<DropTargetEvent&>(const_cast<DropTargetDragEvent&>( aAcceptEvent.maDragEvent )) = rDTDE;
+        const_cast<DropTargetDragEvent&>( aAcceptEvent.maDragEvent ).DropAction = rDTDE.DropAction;
+        const_cast<DropTargetDragEvent&>( aAcceptEvent.maDragEvent ).LocationX = rDTDE.LocationX;
+        const_cast<DropTargetDragEvent&>( aAcceptEvent.maDragEvent ).LocationY = rDTDE.LocationY;
+        const_cast<DropTargetDragEvent&>( aAcceptEvent.maDragEvent ).SourceActions = rDTDE.SourceActions;
         aAcceptEvent.mbLeaving = false;
         aAcceptEvent.mbDefault = aExecuteEvt.mbDefault;
 
@@ -373,7 +373,7 @@ bool TransferDataContainer::GetData(
     // test first the list
     for( ; aIter != aEnd; ++aIter )
     {
-        TDataCntnrEntry_Impl& rEntry = (TDataCntnrEntry_Impl&)*aIter;
+        TDataCntnrEntry_Impl& rEntry = *aIter;
         if( nFmtId == rEntry.nId )
         {
             bFnd = SetAny( rEntry.aAny );
diff --git a/svtools/source/table/tablecontrol_impl.cxx b/svtools/source/table/tablecontrol_impl.cxx
index fa5d0ca21bd0..fdbe172bbe26 100644
--- a/svtools/source/table/tablecontrol_impl.cxx
+++ b/svtools/source/table/tablecontrol_impl.cxx
@@ -1737,7 +1737,7 @@ namespace svt { namespace table
     {
         ENSURE_OR_RETURN( ( i_column >= 0 ) && ( i_column < m_pModel->getColumnCount() ),
             "TableControl_Impl::getColumnMetrics: illegal column index!", ColumnMetrics() );
-        return (ColumnMetrics const &)m_aColumnWidths[ i_column ];
+        return m_aColumnWidths[ i_column ];
     }
 
 
diff --git a/svtools/source/table/tablecontrol_impl.hxx b/svtools/source/table/tablecontrol_impl.hxx
index b2773971c6c4..8d9b5a2ae9e6 100644
--- a/svtools/source/table/tablecontrol_impl.hxx
+++ b/svtools/source/table/tablecontrol_impl.hxx
@@ -34,7 +34,7 @@ class ScrollBarBox;
 
 namespace svt { namespace table
 {
-    struct MutableColumnMetrics : protected ColumnMetrics
+    struct MutableColumnMetrics : public ColumnMetrics
     {
         MutableColumnMetrics()
             :ColumnMetrics()
commit acb923263e3a15f9cd8fda46d28a749c7496d113
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Sat Jun 3 21:08:57 2017 +0200

    Improved loplugin:cstylecast to reference types: svx
    
    Change-Id: Idb58ca86ea6c0593283c455880ca7c0e99983c60

diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx
index c4de12bbcfc3..26fbc948bf94 100644
--- a/svx/source/customshapes/EnhancedCustomShape2d.cxx
+++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx
@@ -537,13 +537,13 @@ bool EnhancedCustomShape2d::ConvertSequenceToEnhancedCustomShape2dHandle(
 void EnhancedCustomShape2d::ApplyShapeAttributes( const SdrCustomShapeGeometryItem& rGeometryItem )
 {
     // AdjustmentValues
-    const Any* pAny = ((SdrCustomShapeGeometryItem&)rGeometryItem).GetPropertyValueByName( "AdjustmentValues" );
+    const Any* pAny = const_cast<SdrCustomShapeGeometryItem&>(rGeometryItem).GetPropertyValueByName( "AdjustmentValues" );
     if ( pAny )
         *pAny >>= seqAdjustmentValues;
 
 
     // Coordsize
-    const Any* pViewBox = ((SdrCustomShapeGeometryItem&)rGeometryItem).GetPropertyValueByName( "ViewBox" );
+    const Any* pViewBox = const_cast<SdrCustomShapeGeometryItem&>(rGeometryItem).GetPropertyValueByName( "ViewBox" );
     css::awt::Rectangle aViewBox;
     if ( pViewBox && (*pViewBox >>= aViewBox ) )
     {
@@ -556,31 +556,31 @@ void EnhancedCustomShape2d::ApplyShapeAttributes( const SdrCustomShapeGeometryIt
 
 
     // Path/Coordinates
-    pAny = ((SdrCustomShapeGeometryItem&)rGeometryItem).GetPropertyValueByName( sPath, "Coordinates" );
+    pAny = const_cast<SdrCustomShapeGeometryItem&>(rGeometryItem).GetPropertyValueByName( sPath, "Coordinates" );
     if ( pAny )
         *pAny >>= seqCoordinates;
 
 
     // Path/GluePoints
-    pAny = ((SdrCustomShapeGeometryItem&)rGeometryItem).GetPropertyValueByName( sPath, "GluePoints" );
+    pAny = const_cast<SdrCustomShapeGeometryItem&>(rGeometryItem).GetPropertyValueByName( sPath, "GluePoints" );
     if ( pAny )
         *pAny >>= seqGluePoints;
 
 
     // Path/Segments
-    pAny = ((SdrCustomShapeGeometryItem&)rGeometryItem).GetPropertyValueByName( sPath, "Segments" );
+    pAny = const_cast<SdrCustomShapeGeometryItem&>(rGeometryItem).GetPropertyValueByName( sPath, "Segments" );
     if ( pAny )
         *pAny >>= seqSegments;
 
 
     // Path/SubViewSize
-    pAny = ((SdrCustomShapeGeometryItem&)rGeometryItem).GetPropertyValueByName( sPath, "SubViewSize" );
+    pAny = const_cast<SdrCustomShapeGeometryItem&>(rGeometryItem).GetPropertyValueByName( sPath, "SubViewSize" );
     if ( pAny )
         *pAny >>= seqSubViewSize;
 
 
     // Path/StretchX
-    pAny = ((SdrCustomShapeGeometryItem&)rGeometryItem).GetPropertyValueByName( sPath, "StretchX" );
+    pAny = const_cast<SdrCustomShapeGeometryItem&>(rGeometryItem).GetPropertyValueByName( sPath, "StretchX" );
     if ( pAny )
     {
         sal_Int32 nStretchX = 0;
@@ -590,7 +590,7 @@ void EnhancedCustomShape2d::ApplyShapeAttributes( const SdrCustomShapeGeometryIt
 
 
     // Path/StretchY
-    pAny = ((SdrCustomShapeGeometryItem&)rGeometryItem).GetPropertyValueByName( sPath, "StretchY" );
+    pAny = const_cast<SdrCustomShapeGeometryItem&>(rGeometryItem).GetPropertyValueByName( sPath, "StretchY" );
     if ( pAny )
     {
         sal_Int32 nStretchY = 0;
@@ -600,19 +600,19 @@ void EnhancedCustomShape2d::ApplyShapeAttributes( const SdrCustomShapeGeometryIt
 
 
     // Path/TextFrames
-    pAny = ((SdrCustomShapeGeometryItem&)rGeometryItem).GetPropertyValueByName( sPath, "TextFrames" );
+    pAny = const_cast<SdrCustomShapeGeometryItem&>(rGeometryItem).GetPropertyValueByName( sPath, "TextFrames" );
     if ( pAny )
         *pAny >>= seqTextFrames;
 
 
     // Equations
-    pAny = ((SdrCustomShapeGeometryItem&)rGeometryItem).GetPropertyValueByName( "Equations" );
+    pAny = const_cast<SdrCustomShapeGeometryItem&>(rGeometryItem).GetPropertyValueByName( "Equations" );
     if ( pAny )
         *pAny >>= seqEquations;
 
 
     // Handles
-    pAny = ((SdrCustomShapeGeometryItem&)rGeometryItem).GetPropertyValueByName( "Handles" );
+    pAny = const_cast<SdrCustomShapeGeometryItem&>(rGeometryItem).GetPropertyValueByName( "Handles" );
     if ( pAny )
         *pAny >>= seqHandles;
 }
@@ -1632,7 +1632,7 @@ void EnhancedCustomShape2d::CreateSubPath( sal_Int32& rSrcPt, sal_Int32& rSegmen
                             _aCenter.Y() = nCoordHeight/2 * fYScale;
                             fWidth = nCoordWidth/2;
                             fHeight = nCoordHeight/2;
-                            const Any* pViewBox = ((SdrCustomShapeGeometryItem&)rGeometryItem).GetPropertyValueByName( "ViewBox" );
+                            const Any* pViewBox = rGeometryItem.GetPropertyValueByName( "ViewBox" );
                             css::awt::Rectangle aViewBox;
                             if ( pViewBox && (*pViewBox >>= aViewBox ) )
                             {
diff --git a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx
index a264b93939df..cefeb456d3e3 100644
--- a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx
+++ b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx
@@ -139,7 +139,7 @@ double GetLength( const tools::Polygon& rPolygon )
     {
         sal_uInt16 nCount = rPolygon.GetSize();
         while( --nCount )
-            fLength += ((tools::Polygon&)rPolygon).CalcDistance( nCount, nCount - 1 );
+            fLength += const_cast<tools::Polygon&>(rPolygon).CalcDistance( nCount, nCount - 1 );
     }
     return fLength;
 }
@@ -536,7 +536,7 @@ void CalcDistances( const tools::Polygon& rPoly, std::vector< double >& rDistanc
     {
         for ( i = 0; i < nCount; i++ )
         {
-            double fDistance = i ? ((tools::Polygon&)rPoly).CalcDistance( i, i - 1 ) : 0.0;
+            double fDistance = i ? const_cast<tools::Polygon&>(rPoly).CalcDistance( i, i - 1 ) : 0.0;
             rDistances.push_back( fDistance );
         }
         std::partial_sum( rDistances.begin(), rDistances.end(), rDistances.begin() );
diff --git a/svx/source/dialog/connctrl.cxx b/svx/source/dialog/connctrl.cxx
index 13d5004424fb..d622a7d52e6d 100644
--- a/svx/source/dialog/connctrl.cxx
+++ b/svx/source/dialog/connctrl.cxx
@@ -161,8 +161,8 @@ void SvxXConnectionPreview::Construct()
                 const SdrEdgeObj* pTmpEdgeObj = static_cast<const SdrEdgeObj*>(pObj);
                 pEdgeObj = pTmpEdgeObj->Clone();
 
-                SdrObjConnection& rConn1 = (SdrObjConnection&)pEdgeObj->GetConnection( true );
-                SdrObjConnection& rConn2 = (SdrObjConnection&)pEdgeObj->GetConnection( false );
+                SdrObjConnection& rConn1 = pEdgeObj->GetConnection( true );
+                SdrObjConnection& rConn2 = pEdgeObj->GetConnection( false );
 
                 rConn1 = pTmpEdgeObj->GetConnection( true );
                 rConn2 = pTmpEdgeObj->GetConnection( false );
diff --git a/svx/source/dialog/graphctl.cxx b/svx/source/dialog/graphctl.cxx
index cdf0e5d05003..b65d75b0992a 100644
--- a/svx/source/dialog/graphctl.cxx
+++ b/svx/source/dialog/graphctl.cxx
@@ -332,7 +332,7 @@ void GraphCtrl::KeyInput( const KeyEvent& rKEvt )
 
                     if(pHdl)
                     {
-                        ((SdrHdlList&)rHdlList).ResetFocusHdl();
+                        const_cast<SdrHdlList&>(rHdlList).ResetFocusHdl();
                         bGrabFocusToFirstControl = false;
                     }
                 }
@@ -367,7 +367,7 @@ void GraphCtrl::KeyInput( const KeyEvent& rKEvt )
                     const SdrHdlList& rHdlList = pView->GetHdlList();
                     bool bForward(!aCode.IsShift());
 
-                    ((SdrHdlList&)rHdlList).TravelFocusHdl(bForward);
+                    const_cast<SdrHdlList&>(rHdlList).TravelFocusHdl(bForward);
 
                     bProc = true;
                 }
@@ -514,7 +514,7 @@ void GraphCtrl::KeyInput( const KeyEvent& rKEvt )
 
                             // switch snapping off
                             if(!bWasNoSnap)
-                                ((SdrDragStat&)rDragStat).SetNoSnap();
+                                const_cast<SdrDragStat&>(rDragStat).SetNoSnap();
                             if(bWasSnapEnabled)
                                 pView->SetSnapEnabled(false);
 
@@ -523,7 +523,7 @@ void GraphCtrl::KeyInput( const KeyEvent& rKEvt )
 
                             // restore snap
                             if(!bWasNoSnap)
-                                ((SdrDragStat&)rDragStat).SetNoSnap(bWasNoSnap);
+                                const_cast<SdrDragStat&>(rDragStat).SetNoSnap(bWasNoSnap);
                             if(bWasSnapEnabled)
                                 pView->SetSnapEnabled(bWasSnapEnabled);
                         }
@@ -585,7 +585,7 @@ void GraphCtrl::KeyInput( const KeyEvent& rKEvt )
 
                         if(pNewOne)
                         {
-                            ((SdrHdlList&)rHdlList).SetFocusHdl(pNewOne);
+                            const_cast<SdrHdlList&>(rHdlList).SetFocusHdl(pNewOne);
                         }
                     }
 
diff --git a/svx/source/dialog/imapwnd.cxx b/svx/source/dialog/imapwnd.cxx
index a73ff87da1ed..44534a92627d 100644
--- a/svx/source/dialog/imapwnd.cxx
+++ b/svx/source/dialog/imapwnd.cxx
@@ -808,7 +808,7 @@ void IMapWindow::StartPolyEdit()
 
     if(!pHdl)
     {
-        ((SdrHdlList&)rHdlList).TravelFocusHdl(true);
+        const_cast<SdrHdlList&>(rHdlList).TravelFocusHdl(true);
     }
 }
 
diff --git a/svx/source/engine3d/obj3d.cxx b/svx/source/engine3d/obj3d.cxx
index 8267a14d9ad0..52b553d50d30 100644
--- a/svx/source/engine3d/obj3d.cxx
+++ b/svx/source/engine3d/obj3d.cxx
@@ -696,22 +696,21 @@ E3dObject& E3dObject::operator=(const E3dObject& rObj)
         return *this;
     SdrObject::operator=(rObj);
 
-    const E3dObject& r3DObj = (const E3dObject&) rObj;
-    if (r3DObj.GetSubList())
+    if (rObj.GetSubList())
     {
-        maSubList.CopyObjects(*r3DObj.GetSubList());
+        maSubList.CopyObjects(*rObj.GetSubList());
     }
 
     // BoundVol can be copied since also the children are copied
-    maLocalBoundVol  = r3DObj.maLocalBoundVol;
-    maTransformation = r3DObj.maTransformation;
+    maLocalBoundVol  = rObj.maLocalBoundVol;
+    maTransformation = rObj.maTransformation;
 
     // Because the parent may have changed, definitely redefine the total
     // transformation next time
     SetTransformChanged();
 
     // Copy selection status
-    mbIsSelected = r3DObj.mbIsSelected;
+    mbIsSelected = rObj.mbIsSelected;
     return *this;
 }
 
diff --git a/svx/source/engine3d/scene3d.cxx b/svx/source/engine3d/scene3d.cxx
index e8d707392db1..7e80afac9779 100644
--- a/svx/source/engine3d/scene3d.cxx
+++ b/svx/source/engine3d/scene3d.cxx
@@ -243,7 +243,7 @@ sal_uInt32 E3dScene::RemapOrdNum(sal_uInt32 nNewOrdNum) const
 
         if(nObjCount > 1)
         {
-            const_cast<E3dScene*>(this)->mp3DDepthRemapper = new Imp3DDepthRemapper((E3dScene&)(*this));
+            const_cast<E3dScene*>(this)->mp3DDepthRemapper = new Imp3DDepthRemapper(const_cast<E3dScene&>(*this));
         }
     }
 
@@ -281,7 +281,7 @@ void E3dScene::NbcSetSnapRect(const tools::Rectangle& rRect)
     SetRectsDirty();
     E3dObject::NbcSetSnapRect(rRect);
     aCamera.SetDeviceWindow(rRect);
-    aCameraSet.SetViewportRectangle((tools::Rectangle&)rRect);
+    aCameraSet.SetViewportRectangle(rRect);
 
     ImpCleanup3DDepthMapper();
 }
@@ -325,7 +325,7 @@ void E3dScene::SetCamera(const Camera3D& rNewCamera)
 
     // Set perspective
     GetCameraSet().SetPerspective(aCamera.GetProjection() == ProjectionType::Perspective);
-    GetCameraSet().SetViewportRectangle((tools::Rectangle&)aCamera.GetDeviceWindow());
+    GetCameraSet().SetViewportRectangle(aCamera.GetDeviceWindow());
 
     ImpCleanup3DDepthMapper();
 }
@@ -419,10 +419,9 @@ E3dScene& E3dScene::operator=(const E3dScene& rObj)
         return *this;
     E3dObject::operator=(rObj);
 
-    const E3dScene& r3DObj = (const E3dScene&) rObj;
-    aCamera          = r3DObj.aCamera;
+    aCamera          = rObj.aCamera;
 
-    aCameraSet = r3DObj.aCameraSet;
+    aCameraSet = rObj.aCameraSet;
     static_cast<sdr::properties::E3dSceneProperties&>(GetProperties()).SetSceneItemsFromCamera();
 
     InvalidateBoundVolume();
diff --git a/svx/source/form/fmsrcimp.cxx b/svx/source/form/fmsrcimp.cxx
index 8ad18af31eee..87d3dafc64cd 100644
--- a/svx/source/form/fmsrcimp.cxx
+++ b/svx/source/form/fmsrcimp.cxx
@@ -53,7 +53,7 @@
 
 #define EQUAL_BOOKMARKS(a, b) a == b
 
-#define IFACECAST(c)          ((const Reference< XInterface >&)c)
+#define IFACECAST(c)          static_cast<const Reference< XInterface >&>(c)
 
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::util;
diff --git a/svx/source/gallery2/galtheme.cxx b/svx/source/gallery2/galtheme.cxx
index 83fdc6285cb6..3a7377d65ff5 100644
--- a/svx/source/gallery2/galtheme.cxx
+++ b/svx/source/gallery2/galtheme.cxx
@@ -389,11 +389,11 @@ bool GalleryTheme::InsertObject( const SgaObject& rObj, sal_uIntPtr nInsertPos )
 
             if (pOldObj)
             {
-                ((SgaObject&) rObj).SetTitle( pOldObj->GetTitle() );
+                const_cast<SgaObject&>(rObj).SetTitle( pOldObj->GetTitle() );
             }
         }
         else if (rObj.GetTitle() == "__<empty>__")
-            ((SgaObject&) rObj).SetTitle("");
+            const_cast<SgaObject&>(rObj).SetTitle("");
 
         ImplWriteSgaObject(rObj, nInsertPos, &aNewEntry);
         pFoundEntry->nOffset = aNewEntry.nOffset;
@@ -846,7 +846,7 @@ bool GalleryTheme::InsertGraphic( const Graphic& rGraphic, sal_uIntPtr nInsertPo
     if( rGraphic.GetType() != GraphicType::NONE )
     {
         ConvertDataFormat nExportFormat = ConvertDataFormat::Unknown;
-        const GfxLink     aGfxLink( ( (Graphic&) rGraphic ).GetLink() );
+        const GfxLink     aGfxLink( rGraphic.GetLink() );
 
         if( aGfxLink.GetDataSize() )
         {
diff --git a/svx/source/sdr/contact/objectcontactofpageview.cxx b/svx/source/sdr/contact/objectcontactofpageview.cxx
index 552ac31866bf..77be097549a4 100644
--- a/svx/source/sdr/contact/objectcontactofpageview.cxx
+++ b/svx/source/sdr/contact/objectcontactofpageview.cxx
@@ -58,7 +58,7 @@ namespace sdr
             mrPageWindow(rPageWindow)
         {
             // init PreviewRenderer flag
-            setPreviewRenderer(((SdrPaintView&)rPageWindow.GetPageView().GetView()).IsPreviewRenderer());
+            setPreviewRenderer(static_cast<SdrPaintView&>(rPageWindow.GetPageView().GetView()).IsPreviewRenderer());
 
             // init timer
             SetPriority(TaskPriority::HIGH);
diff --git a/svx/source/sdr/contact/viewcontact.cxx b/svx/source/sdr/contact/viewcontact.cxx
index fd57b8acd34d..aab8310c0388 100644
--- a/svx/source/sdr/contact/viewcontact.cxx
+++ b/svx/source/sdr/contact/viewcontact.cxx
@@ -166,7 +166,7 @@ ViewContact& ViewContact::GetViewContact(sal_uInt32 /*nIndex*/) const
 {
     // This is the default implementation; call would be an error
     OSL_FAIL("ViewContact::GetViewContact: This call needs to be overridden when GetObjectCount() can return results != 0 (!)");
-    return (ViewContact&)(*this);
+    return const_cast<ViewContact&>(*this);
 }
 
 ViewContact* ViewContact::GetParentContact() const
diff --git a/svx/source/sdr/contact/viewcontactofsdrpage.cxx b/svx/source/sdr/contact/viewcontactofsdrpage.cxx
index d85f54f80c18..cbbc44efb654 100644
--- a/svx/source/sdr/contact/viewcontactofsdrpage.cxx
+++ b/svx/source/sdr/contact/viewcontactofsdrpage.cxx
@@ -522,9 +522,9 @@ ViewContact& ViewContactOfSdrPage::GetViewContact(sal_uInt32 nIndex) const
 {
     switch(nIndex)
     {
-        case 0: return (ViewContact&)maViewContactOfPageBackground;
-        case 1: return (ViewContact&)maViewContactOfPageShadow;
-        case 2: return (ViewContact&)maViewContactOfPageFill;
+        case 0: return const_cast<ViewContactOfPageBackground&>(maViewContactOfPageBackground);
+        case 1: return const_cast<ViewContactOfPageShadow&>(maViewContactOfPageShadow);
+        case 2: return const_cast<ViewContactOfPageFill&>(maViewContactOfPageFill);
         case 3:
         {
             const SdrPage& rPage = GetSdrPage();
@@ -535,17 +535,17 @@ ViewContact& ViewContactOfSdrPage::GetViewContact(sal_uInt32 nIndex) const
             }
             else
             {
-                return (ViewContact&)maViewContactOfMasterPage;
+                return const_cast<ViewContactOfMasterPage&>(maViewContactOfMasterPage);
             }
         }
-        case 4: return (ViewContact&)maViewContactOfOuterPageBorder;
-        case 5: return (ViewContact&)maViewContactOfInnerPageBorder;
-        case 6: return (ViewContact&)maViewContactOfGridBack;
-        case 7: return (ViewContact&)maViewContactOfHelplinesBack;
-        case 8: return (ViewContact&)maViewContactOfPageHierarchy;
-        case 9: return (ViewContact&)maViewContactOfGridFront;
-        case 10: case 11: return (ViewContact&)maViewContactOfHelplinesFront;
-        default: assert(false);return (ViewContact&)maViewContactOfHelplinesFront;
+        case 4: return const_cast<ViewContactOfOuterPageBorder&>(maViewContactOfOuterPageBorder);
+        case 5: return const_cast<ViewContactOfInnerPageBorder&>(maViewContactOfInnerPageBorder);
+        case 6: return const_cast<ViewContactOfGrid&>(maViewContactOfGridBack);
+        case 7: return const_cast<ViewContactOfHelplines&>(maViewContactOfHelplinesBack);
+        case 8: return const_cast<ViewContactOfPageHierarchy&>(maViewContactOfPageHierarchy);
+        case 9: return const_cast<ViewContactOfGrid&>(maViewContactOfGridFront);
+        case 10: case 11: return const_cast<ViewContactOfHelplines&>(maViewContactOfHelplinesFront);
+        default: assert(false);return const_cast<ViewContactOfHelplines&>(maViewContactOfHelplinesFront);
     }
 }
 
diff --git a/svx/source/svdraw/svdmark.cxx b/svx/source/svdraw/svdmark.cxx
index 7c4747ab0684..30396fcd2e5a 100644
--- a/svx/source/svdraw/svdmark.cxx
+++ b/svx/source/svdraw/svdmark.cxx
@@ -495,7 +495,7 @@ const OUString& SdrMarkList::GetMarkDescription() const
 
 const OUString& SdrMarkList::GetPointMarkDescription(bool bGlue) const
 {
-    bool& rNameOk = (bool&)(bGlue ? mbGluePointNameOk : mbPointNameOk);
+    bool& rNameOk = const_cast<bool&>(bGlue ? mbGluePointNameOk : mbPointNameOk);
     OUString& rName = const_cast<OUString&>(bGlue ? maGluePointName : maPointName);
     const size_t nMarkCount(GetMarkCount());
     size_t nMarkPtAnz(0);
diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx
index 30a4177d0bf4..1b8b0dbe0311 100644
--- a/svx/source/svdraw/svdoashp.cxx
+++ b/svx/source/svdraw/svdoashp.cxx
@@ -884,7 +884,7 @@ void SdrObjCustomShape::MergeDefaultAttributes( const OUString* pType )
     // AdjustmentValues
 
     const OUString sAdjustmentValues( "AdjustmentValues" );
-    const Any* pAny = ((SdrCustomShapeGeometryItem&)aGeometryItem).GetPropertyValueByName( sAdjustmentValues );
+    const Any* pAny = aGeometryItem.GetPropertyValueByName( sAdjustmentValues );
     if ( pAny )
         *pAny >>= seqAdjustmentValues;
     if ( pDefCustomShape && pDefData )  // now check if we have to default some adjustment values
@@ -920,7 +920,7 @@ void SdrObjCustomShape::MergeDefaultAttributes( const OUString* pType )
     // Coordsize
 
     const OUString sViewBox( "ViewBox" );
-    const Any* pViewBox = ((SdrCustomShapeGeometryItem&)aGeometryItem).GetPropertyValueByName( sViewBox );
+    const Any* pViewBox = aGeometryItem.GetPropertyValueByName( sViewBox );
     css::awt::Rectangle aViewBox;
     if ( !pViewBox || !(*pViewBox >>= aViewBox ) )
     {
@@ -942,7 +942,7 @@ void SdrObjCustomShape::MergeDefaultAttributes( const OUString* pType )
     // Path/Coordinates
 
     const OUString sCoordinates( "Coordinates" );
-    pAny = ((SdrCustomShapeGeometryItem&)aGeometryItem).GetPropertyValueByName( sPath, sCoordinates );
+    pAny = aGeometryItem.GetPropertyValueByName( sPath, sCoordinates );
     if ( !pAny && pDefCustomShape && pDefCustomShape->nVertices && pDefCustomShape->pVertices )
     {
         css::uno::Sequence< css::drawing::EnhancedCustomShapeParameterPair> seqCoordinates;
@@ -961,7 +961,7 @@ void SdrObjCustomShape::MergeDefaultAttributes( const OUString* pType )
 
     // Path/GluePoints
     const OUString sGluePoints( "GluePoints" );
-    pAny = ((SdrCustomShapeGeometryItem&)aGeometryItem).GetPropertyValueByName( sPath, sGluePoints );
+    pAny = aGeometryItem.GetPropertyValueByName( sPath, sGluePoints );
     if ( !pAny && pDefCustomShape && pDefCustomShape->nGluePoints && pDefCustomShape->pGluePoints )
     {
         css::uno::Sequence< css::drawing::EnhancedCustomShapeParameterPair> seqGluePoints;
@@ -979,7 +979,7 @@ void SdrObjCustomShape::MergeDefaultAttributes( const OUString* pType )
 
     // Path/Segments
     const OUString sSegments( "Segments" );
-    pAny = ((SdrCustomShapeGeometryItem&)aGeometryItem).GetPropertyValueByName( sPath, sSegments );
+    pAny = aGeometryItem.GetPropertyValueByName( sPath, sSegments );
     if ( !pAny && pDefCustomShape && pDefCustomShape->nElements && pDefCustomShape->pElements )
     {
         css::uno::Sequence< css::drawing::EnhancedCustomShapeSegment > seqSegments;
@@ -999,7 +999,7 @@ void SdrObjCustomShape::MergeDefaultAttributes( const OUString* pType )
 
     // Path/StretchX
     const OUString sStretchX( "StretchX" );
-    pAny = ((SdrCustomShapeGeometryItem&)aGeometryItem).GetPropertyValueByName( sPath, sStretchX );
+    pAny = aGeometryItem.GetPropertyValueByName( sPath, sStretchX );
     if ( !pAny && pDefCustomShape )
     {
         sal_Int32 nXRef = pDefCustomShape->nXRef;
@@ -1013,7 +1013,7 @@ void SdrObjCustomShape::MergeDefaultAttributes( const OUString* pType )
 
     // Path/StretchY
     const OUString sStretchY( "StretchY" );
-    pAny = ((SdrCustomShapeGeometryItem&)aGeometryItem).GetPropertyValueByName( sPath, sStretchY );
+    pAny = aGeometryItem.GetPropertyValueByName( sPath, sStretchY );
     if ( !pAny && pDefCustomShape )
     {
         sal_Int32 nYRef = pDefCustomShape->nYRef;
@@ -1027,7 +1027,7 @@ void SdrObjCustomShape::MergeDefaultAttributes( const OUString* pType )
 
     // Path/TextFrames
     const OUString sTextFrames( "TextFrames" );
-    pAny = ((SdrCustomShapeGeometryItem&)aGeometryItem).GetPropertyValueByName( sPath, sTextFrames );
+    pAny = aGeometryItem.GetPropertyValueByName( sPath, sTextFrames );
     if ( !pAny && pDefCustomShape && pDefCustomShape->nTextRect && pDefCustomShape->pTextRect )
     {
         css::uno::Sequence< css::drawing::EnhancedCustomShapeTextFrame > seqTextFrames;
@@ -1049,7 +1049,7 @@ void SdrObjCustomShape::MergeDefaultAttributes( const OUString* pType )
 
     // Equations
     const OUString sEquations(  "Equations"  );
-    pAny = ((SdrCustomShapeGeometryItem&)aGeometryItem).GetPropertyValueByName( sEquations );
+    pAny = aGeometryItem.GetPropertyValueByName( sEquations );
     if ( !pAny && pDefCustomShape && pDefCustomShape->nCalculation && pDefCustomShape->pCalculation )
     {
         css::uno::Sequence< OUString > seqEquations;
@@ -1066,7 +1066,7 @@ void SdrObjCustomShape::MergeDefaultAttributes( const OUString* pType )
 
     // Handles
     const OUString sHandles(  "Handles"  );
-    pAny = ((SdrCustomShapeGeometryItem&)aGeometryItem).GetPropertyValueByName( sHandles );
+    pAny = aGeometryItem.GetPropertyValueByName( sHandles );
     if ( !pAny && pDefCustomShape && pDefCustomShape->nHandles && pDefCustomShape->pHandles )
     {
         css::uno::Sequence< css::beans::PropertyValues > seqHandles;
@@ -1111,7 +1111,7 @@ bool SdrObjCustomShape::IsDefaultGeometry( const DefaultType eDefaultType ) cons
         case DefaultType::Viewbox :
         {
             const OUString sViewBox( "ViewBox" );
-            const Any* pViewBox = ((SdrCustomShapeGeometryItem&)aGeometryItem).GetPropertyValueByName( sViewBox );
+            const Any* pViewBox = const_cast<SdrCustomShapeGeometryItem&>(aGeometryItem).GetPropertyValueByName( sViewBox );
             css::awt::Rectangle aViewBox;
             if ( pViewBox && ( *pViewBox >>= aViewBox ) )
             {
@@ -1125,7 +1125,7 @@ bool SdrObjCustomShape::IsDefaultGeometry( const DefaultType eDefaultType ) cons
         case DefaultType::Path :
         {
             const OUString sCoordinates( "Coordinates" );
-            pAny = ((SdrCustomShapeGeometryItem&)aGeometryItem).GetPropertyValueByName( sPath, sCoordinates );
+            pAny = const_cast<SdrCustomShapeGeometryItem&>(aGeometryItem).GetPropertyValueByName( sPath, sCoordinates );
             if ( pAny && pDefCustomShape && pDefCustomShape->nVertices && pDefCustomShape->pVertices )
             {
                 css::uno::Sequence< css::drawing::EnhancedCustomShapeParameterPair> seqCoordinates1, seqCoordinates2;
@@ -1150,7 +1150,7 @@ bool SdrObjCustomShape::IsDefaultGeometry( const DefaultType eDefaultType ) cons
         case DefaultType::Gluepoints :
         {
             const OUString sGluePoints( "GluePoints" );
-            pAny = ((SdrCustomShapeGeometryItem&)aGeometryItem).GetPropertyValueByName( sPath, sGluePoints );
+            pAny = const_cast<SdrCustomShapeGeometryItem&>(aGeometryItem).GetPropertyValueByName( sPath, sGluePoints );
             if ( pAny && pDefCustomShape && pDefCustomShape->nGluePoints && pDefCustomShape->pGluePoints )
             {
                 css::uno::Sequence< css::drawing::EnhancedCustomShapeParameterPair> seqGluePoints1, seqGluePoints2;
@@ -1176,7 +1176,7 @@ bool SdrObjCustomShape::IsDefaultGeometry( const DefaultType eDefaultType ) cons
         {
             // Path/Segments
             const OUString sSegments( "Segments" );
-            pAny = ((SdrCustomShapeGeometryItem&)aGeometryItem).GetPropertyValueByName( sPath, sSegments );
+            pAny = const_cast<SdrCustomShapeGeometryItem&>(aGeometryItem).GetPropertyValueByName( sPath, sSegments );
             if ( pAny )
             {
                 css::uno::Sequence< css::drawing::EnhancedCustomShapeSegment > seqSegments1, seqSegments2;
@@ -1220,7 +1220,7 @@ bool SdrObjCustomShape::IsDefaultGeometry( const DefaultType eDefaultType ) cons
         case DefaultType::StretchX :
         {
             const OUString sStretchX( "StretchX" );
-            pAny = ((SdrCustomShapeGeometryItem&)aGeometryItem).GetPropertyValueByName( sPath, sStretchX );
+            pAny = const_cast<SdrCustomShapeGeometryItem&>(aGeometryItem).GetPropertyValueByName( sPath, sStretchX );
             if ( pAny && pDefCustomShape )
             {
                 sal_Int32 nStretchX = 0;
@@ -1238,7 +1238,7 @@ bool SdrObjCustomShape::IsDefaultGeometry( const DefaultType eDefaultType ) cons
         case DefaultType::StretchY :
         {
             const OUString sStretchY( "StretchY" );
-            pAny = ((SdrCustomShapeGeometryItem&)aGeometryItem).GetPropertyValueByName( sPath, sStretchY );
+            pAny = const_cast<SdrCustomShapeGeometryItem&>(aGeometryItem).GetPropertyValueByName( sPath, sStretchY );
             if ( pAny && pDefCustomShape )
             {
                 sal_Int32 nStretchY = 0;
@@ -1256,7 +1256,7 @@ bool SdrObjCustomShape::IsDefaultGeometry( const DefaultType eDefaultType ) cons
         case DefaultType::Equations :
         {
             const OUString sEquations(  "Equations"  );
-            pAny = ((SdrCustomShapeGeometryItem&)aGeometryItem).GetPropertyValueByName( sEquations );
+            pAny = const_cast<SdrCustomShapeGeometryItem&>(aGeometryItem).GetPropertyValueByName( sEquations );
             if ( pAny && pDefCustomShape && pDefCustomShape->nCalculation && pDefCustomShape->pCalculation )
             {
                 css::uno::Sequence< OUString > seqEquations1, seqEquations2;
@@ -1281,7 +1281,7 @@ bool SdrObjCustomShape::IsDefaultGeometry( const DefaultType eDefaultType ) cons
         case DefaultType::TextFrames :
         {
             const OUString sTextFrames(  "TextFrames"  );
-            pAny = ((SdrCustomShapeGeometryItem&)aGeometryItem).GetPropertyValueByName( sPath, sTextFrames );
+            pAny = const_cast<SdrCustomShapeGeometryItem&>(aGeometryItem).GetPropertyValueByName( sPath, sTextFrames );
             if ( pAny && pDefCustomShape && pDefCustomShape->nTextRect && pDefCustomShape->pTextRect )
             {
                 css::uno::Sequence< css::drawing::EnhancedCustomShapeTextFrame > seqTextFrames1, seqTextFrames2;
diff --git a/svx/source/svdraw/svdopath.cxx b/svx/source/svdraw/svdopath.cxx
index 894d6cbff6c0..0c3dad0cd56f 100644
--- a/svx/source/svdraw/svdopath.cxx
+++ b/svx/source/svdraw/svdopath.cxx
@@ -2205,7 +2205,7 @@ OUString SdrPathObj::getSpecialDragComment(const SdrDragStat& rDrag) const
     else
     {
         ImpPathForDragAndCreate aDragAndCreate(*const_cast<SdrPathObj*>(this));
-        bool bDidWork(aDragAndCreate.beginPathDrag((SdrDragStat&)rDrag));
+        bool bDidWork(aDragAndCreate.beginPathDrag(const_cast<SdrDragStat&>(rDrag)));
 
         if(bDidWork)
         {
@@ -2220,7 +2220,7 @@ basegfx::B2DPolyPolygon SdrPathObj::getSpecialDragPoly(const SdrDragStat& rDrag)
 {
     basegfx::B2DPolyPolygon aRetval;
     ImpPathForDragAndCreate aDragAndCreate(*const_cast<SdrPathObj*>(this));
-    bool bDidWork(aDragAndCreate.beginPathDrag((SdrDragStat&)rDrag));
+    bool bDidWork(aDragAndCreate.beginPathDrag(const_cast<SdrDragStat&>(rDrag)));
 
     if(bDidWork)
     {
diff --git a/svx/source/svdraw/svdpagv.cxx b/svx/source/svdraw/svdpagv.cxx
index fd94f4388877..a4d4c34d949a 100644
--- a/svx/source/svdraw/svdpagv.cxx
+++ b/svx/source/svdraw/svdpagv.cxx
@@ -709,7 +709,7 @@ void SdrPageView::ImpInvalidateHelpLineArea(sal_uInt16 nNum) const
                 aR.Right() += aSiz.Width();
                 aR.Top() -= aSiz.Height();
                 aR.Bottom() += aSiz.Height();
-                ((SdrView&)GetView()).InvalidateOneWin(static_cast<vcl::Window&>(rOutDev), aR);
+                const_cast<SdrView&>(GetView()).InvalidateOneWin(static_cast<vcl::Window&>(rOutDev), aR);
             }
         }
     }
diff --git a/svx/source/xml/xmlgrhlp.cxx b/svx/source/xml/xmlgrhlp.cxx

... etc. - the rest is truncated


More information about the Libreoffice-commits mailing list