[Libreoffice-commits] core.git: basctl/source basic/source chart2/source compilerplugins/clang configmgr/source connectivity/source cppuhelper/source dbaccess/source extensions/source filter/source fpicker/source framework/source l10ntools/source sd/source sfx2/source svl/source svtools/source svx/source sw/source ucb/source vcl/qt5 vcl/source xmlhelp/source

Noel Grandin (via logerrit) logerrit at kemper.freedesktop.org
Tue Aug 27 16:45:00 UTC 2019


 basctl/source/basicide/basidesh.cxx                       |    4 -
 basic/source/runtime/methods.cxx                          |    6 -
 basic/source/runtime/methods1.cxx                         |    4 -
 chart2/source/controller/drawinglayer/DrawViewWrapper.cxx |    2 
 compilerplugins/clang/plugin.cxx                          |   50 ++++++++++++
 compilerplugins/clang/plugin.hxx                          |    6 +
 compilerplugins/clang/redundantcast.cxx                   |   54 ++++++++++++++
 compilerplugins/clang/referencecasting.cxx                |   42 ----------
 compilerplugins/clang/test/redundantcast.cxx              |   14 +++
 configmgr/source/rootaccess.cxx                           |    2 
 connectivity/source/commontools/dbexception.cxx           |    2 
 connectivity/source/drivers/jdbc/JConnection.cxx          |    2 
 cppuhelper/source/exc_thrower.cxx                         |    2 
 dbaccess/source/ui/dlg/sqlmessage.cxx                     |    4 -
 dbaccess/source/ui/misc/TableCopyHelper.cxx               |    2 
 extensions/source/propctrlr/browserline.cxx               |    2 
 filter/source/msfilter/msdffimp.cxx                       |    6 -
 fpicker/source/office/iodlg.cxx                           |    2 
 framework/source/uielement/addonstoolbarwrapper.cxx       |    2 
 framework/source/uielement/statusbarwrapper.cxx           |    2 
 framework/source/uielement/toolbarwrapper.cxx             |    2 
 l10ntools/source/helper.cxx                               |    3 
 sd/source/core/drawdoc3.cxx                               |    2 
 sd/source/ui/app/sdmod2.cxx                               |    2 
 sd/source/ui/unoidl/unocpres.cxx                          |    2 
 sd/source/ui/view/FormShellManager.cxx                    |    2 
 sd/source/ui/view/viewshe2.cxx                            |    3 
 sfx2/source/dialog/backingcomp.cxx                        |    2 
 sfx2/source/notebookbar/NotebookbarTabControl.cxx         |    2 
 svl/source/items/style.cxx                                |    2 
 svtools/source/control/valueacc.cxx                       |    2 
 svx/source/dialog/imapwnd.cxx                             |   20 +----
 svx/source/gallery2/galbrws2.cxx                          |    6 -
 svx/source/table/tablecontroller.cxx                      |    2 
 svx/source/unodraw/unomtabl.cxx                           |    4 -
 sw/source/core/attr/calbck.cxx                            |    2 
 sw/source/core/crsr/crsrsh.cxx                            |    2 
 sw/source/core/doc/CntntIdxStore.cxx                      |    2 
 sw/source/core/doc/docfmt.cxx                             |    2 
 sw/source/core/docnode/ndtbl.cxx                          |    2 
 sw/source/core/frmedt/fefly1.cxx                          |    4 -
 sw/source/core/text/frmcrsr.cxx                           |    4 -
 sw/source/core/text/itradj.cxx                            |    2 
 sw/source/core/text/itrform2.cxx                          |   14 +--
 sw/source/core/unocore/unocrsrhelper.cxx                  |    2 
 sw/source/core/unocore/unoobj2.cxx                        |    5 -
 sw/source/ui/fldui/fldedt.cxx                             |    2 
 sw/source/uibase/uiview/viewling.cxx                      |    2 
 ucb/source/cacher/cachedcontentresultset.cxx              |    3 
 ucb/source/cacher/cachedcontentresultsetstub.cxx          |    3 
 ucb/source/cacher/cacheddynamicresultset.cxx              |    3 
 ucb/source/cacher/cacheddynamicresultsetstub.cxx          |    3 
 ucb/source/core/ucb.cxx                                   |    3 
 ucb/source/ucp/cmis/cmis_provider.cxx                     |    3 
 ucb/source/ucp/ftp/ftpcontentprovider.cxx                 |    3 
 ucb/source/ucp/gio/gio_provider.cxx                       |    3 
 ucb/source/ucp/hierarchy/hierarchydatasource.cxx          |    3 
 ucb/source/ucp/hierarchy/hierarchyprovider.cxx            |    3 
 ucb/source/ucp/package/pkgprovider.cxx                    |    3 
 ucb/source/ucp/tdoc/tdoc_provider.cxx                     |    3 
 ucb/source/ucp/webdav-neon/webdavprovider.cxx             |    3 
 vcl/qt5/Qt5AccessibleEventListener.cxx                    |    3 
 vcl/source/window/debugevent.cxx                          |    2 
 xmlhelp/source/cxxhelp/provider/provider.cxx              |    3 
 64 files changed, 209 insertions(+), 149 deletions(-)

New commits:
commit 9e0b3423f21c23a8ef2fe749ea7dd7c1194c2f9a
Author:     Noel Grandin <noel.grandin at collabora.co.uk>
AuthorDate: Tue Aug 27 11:06:41 2019 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Tue Aug 27 18:42:13 2019 +0200

    loplugin:referencecasting find more redundant static_cast
    
    Change-Id: I3a51812bbd3fcdc6b11e47cb12962f0d4fa7a2ae
    Reviewed-on: https://gerrit.libreoffice.org/78191
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/basctl/source/basicide/basidesh.cxx b/basctl/source/basicide/basidesh.cxx
index 70b400443180..e86a03ef5ac9 100644
--- a/basctl/source/basicide/basidesh.cxx
+++ b/basctl/source/basicide/basidesh.cxx
@@ -688,7 +688,7 @@ void Shell::UpdateWindows()
                                 if ( !pNextActiveWindow && pLibInfoItem && pLibInfoItem->GetCurrentName() == aModName &&
                                      pLibInfoItem->GetCurrentType() == TYPE_MODULE )
                                 {
-                                    pNextActiveWindow = static_cast<BaseWindow*>(pWin);
+                                    pNextActiveWindow = pWin;
                                 }
                             }
                         }
@@ -719,7 +719,7 @@ void Shell::UpdateWindows()
                                 if ( !pNextActiveWindow && pLibInfoItem && pLibInfoItem->GetCurrentName() == aDlgName &&
                                      pLibInfoItem->GetCurrentType() == TYPE_DIALOG )
                                 {
-                                    pNextActiveWindow = static_cast<BaseWindow*>(pWin);
+                                    pNextActiveWindow = pWin;
                                 }
                             }
                         }
diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx
index fe266fdc009c..7965be69c73f 100644
--- a/basic/source/runtime/methods.cxx
+++ b/basic/source/runtime/methods.cxx
@@ -4245,7 +4245,7 @@ void SbRtl_Load(StarBASIC *, SbxArray & rPar, bool)
     }
 
 
-    SbxBase* pObj = static_cast<SbxObject*>(rPar.Get(1)->GetObject());
+    SbxBase* pObj = rPar.Get(1)->GetObject();
     if ( pObj )
     {
         if (SbUserFormModule* pModule = dynamic_cast<SbUserFormModule*>(pObj))
@@ -4273,7 +4273,7 @@ void SbRtl_Unload(StarBASIC *, SbxArray & rPar, bool)
     }
 
 
-    SbxBase* pObj = static_cast<SbxObject*>(rPar.Get(1)->GetObject());
+    SbxBase* pObj = rPar.Get(1)->GetObject();
     if ( pObj )
     {
         if (SbUserFormModule* pFormModule = dynamic_cast<SbUserFormModule*>(pObj))
@@ -4322,7 +4322,7 @@ void SbRtl_SavePicture(StarBASIC *, SbxArray & rPar, bool)
         return;
     }
 
-    SbxBase* pObj = static_cast<SbxObject*>(rPar.Get(1)->GetObject());
+    SbxBase* pObj = rPar.Get(1)->GetObject();
     if (SbStdPicture *pPicture = dynamic_cast<SbStdPicture*>(pObj))
     {
         SvFileStream aOStream( rPar.Get(2)->GetOUString(), StreamMode::WRITE | StreamMode::TRUNC );
diff --git a/basic/source/runtime/methods1.cxx b/basic/source/runtime/methods1.cxx
index 32824b6f2c61..267368ce669e 100644
--- a/basic/source/runtime/methods1.cxx
+++ b/basic/source/runtime/methods1.cxx
@@ -113,7 +113,7 @@ void SbRtl_CallByName(StarBASIC *, SbxArray & rPar, bool)
     }
 
     // 1. parameter is object
-    SbxBase* pObjVar = static_cast<SbxObject*>(rPar.Get(1)->GetObject());
+    SbxBase* pObjVar = rPar.Get(1)->GetObject();
     SbxObject* pObj = nullptr;
     if( pObjVar )
         pObj = dynamic_cast<SbxObject*>( pObjVar );
@@ -852,7 +852,7 @@ void SbRtl_FindPropertyObject(StarBASIC *, SbxArray & rPar, bool)
         return;
     }
 
-    SbxBase* pObjVar = static_cast<SbxObject*>(rPar.Get(1)->GetObject());
+    SbxBase* pObjVar = rPar.Get(1)->GetObject();
     SbxObject* pObj = nullptr;
     if( pObjVar )
     {
diff --git a/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx b/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx
index 8a4ec23bbc4d..f09f4035c70a 100644
--- a/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx
+++ b/chart2/source/controller/drawinglayer/DrawViewWrapper.cxx
@@ -261,7 +261,7 @@ SdrObject* DrawViewWrapper::getTextEditObject() const
     SdrObject* pObj = getSelectedObject();
     SdrObject* pTextObj = nullptr;
     if( pObj && pObj->HasTextEdit())
-        pTextObj = static_cast<SdrTextObj*>(pObj);
+        pTextObj = pObj;
     return pTextObj;
 }
 
diff --git a/compilerplugins/clang/plugin.cxx b/compilerplugins/clang/plugin.cxx
index 7e8dfb664b15..bf48e8822a03 100644
--- a/compilerplugins/clang/plugin.cxx
+++ b/compilerplugins/clang/plugin.cxx
@@ -697,6 +697,56 @@ bool hasCLanguageLinkageType(FunctionDecl const * decl) {
     return false;
 }
 
+static const CXXRecordDecl* stripTypeSugar(QualType qt)
+{
+    const clang::Type* t = qt.getTypePtr();
+    while (auto elaboratedType = dyn_cast<ElaboratedType>(t))
+        t = elaboratedType->desugar().getTypePtr();
+    auto recordType = dyn_cast<RecordType>(t);
+    if (!recordType)
+        return nullptr;
+    return dyn_cast_or_null<CXXRecordDecl>(recordType->getDecl());
+}
+
+int derivedFromCount(const CXXRecordDecl* subclassRecordDecl, const CXXRecordDecl* baseclassRecordDecl)
+{
+    if (!subclassRecordDecl || !baseclassRecordDecl)
+        return 0;
+    int derivedCount = 0;
+    if (subclassRecordDecl == baseclassRecordDecl)
+        derivedCount++;
+    if (!subclassRecordDecl->hasDefinition())
+        return derivedCount;
+    for (auto it = subclassRecordDecl->bases_begin(); it != subclassRecordDecl->bases_end(); ++it)
+    {
+        derivedCount += derivedFromCount(stripTypeSugar(it->getType()), baseclassRecordDecl);
+        // short-circuit, we only care about 0,1,2
+        if (derivedCount > 1)
+            return derivedCount;
+    }
+    for (auto it = subclassRecordDecl->vbases_begin(); it != subclassRecordDecl->vbases_end(); ++it)
+    {
+        derivedCount += derivedFromCount(stripTypeSugar(it->getType()), baseclassRecordDecl);
+        // short-circuit, we only care about 0,1,2
+        if (derivedCount > 1)
+            return derivedCount;
+    }
+    return derivedCount;
+}
+
+int derivedFromCount(QualType subclassQt, QualType baseclassQt)
+{
+    auto baseclassRecordDecl = stripTypeSugar(baseclassQt);
+    if (!baseclassRecordDecl)
+        return 0;
+    auto subclassRecordDecl = stripTypeSugar(subclassQt);
+    if (!subclassRecordDecl)
+        return 0;
+
+    return derivedFromCount(subclassRecordDecl, baseclassRecordDecl);
+}
+
+
 } // namespace
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/compilerplugins/clang/plugin.hxx b/compilerplugins/clang/plugin.hxx
index 12ae6f7ba7c2..0712a22afc2a 100644
--- a/compilerplugins/clang/plugin.hxx
+++ b/compilerplugins/clang/plugin.hxx
@@ -283,6 +283,12 @@ bool isSamePathname(StringRef pathname, StringRef other);
 // "Language linkage of function type":
 bool hasCLanguageLinkageType(FunctionDecl const * decl);
 
+// Count the number of times the base class is present in the subclass hierarchy
+//
+int derivedFromCount(clang::QualType subclassType, clang::QualType baseclassType);
+int derivedFromCount(const CXXRecordDecl* subtypeRecord, const CXXRecordDecl* baseRecord);
+
+
 } // namespace
 
 #endif // COMPILEPLUGIN_H
diff --git a/compilerplugins/clang/redundantcast.cxx b/compilerplugins/clang/redundantcast.cxx
index 3d9ff97b473b..d4e76846cbfa 100644
--- a/compilerplugins/clang/redundantcast.cxx
+++ b/compilerplugins/clang/redundantcast.cxx
@@ -28,6 +28,7 @@
 #include "check.hxx"
 #include "compat.hxx"
 #include "plugin.hxx"
+#include <iostream>
 
 namespace {
 
@@ -136,8 +137,12 @@ public:
     bool VisitBinNE(BinaryOperator const * expr)
     { return visitBinOp(expr); }
 
+    bool VisitBinAssign(BinaryOperator const * binaryOperator);
+    bool VisitVarDecl(VarDecl const * varDecl);
+
 private:
     bool visitBinOp(BinaryOperator const * expr);
+    void visitAssign(QualType lhs, Expr const * rhs);
     bool isOverloadedFunction(FunctionDecl const * decl);
 };
 
@@ -334,6 +339,55 @@ bool RedundantCast::VisitCStyleCastExpr(CStyleCastExpr const * expr) {
     return true;
 }
 
+bool RedundantCast::VisitBinAssign(BinaryOperator const * binaryOperator) {
+    if (ignoreLocation(binaryOperator)) {
+        return true;
+    }
+    visitAssign(binaryOperator->getLHS()->getType(), binaryOperator->getRHS());
+    return true;
+}
+
+bool RedundantCast::VisitVarDecl(VarDecl const * varDecl) {
+    if (ignoreLocation(varDecl)) {
+        return true;
+    }
+    if (!varDecl->getInit())
+        return true;
+    visitAssign(varDecl->getType(), varDecl->getInit());
+    return true;
+}
+
+void RedundantCast::visitAssign(QualType t1, Expr const * rhs)
+{
+    auto staticCastExpr = dyn_cast<CXXStaticCastExpr>(rhs->IgnoreImplicit());
+    if (!staticCastExpr)
+        return;
+
+    auto const t2 = staticCastExpr->getSubExpr()->IgnoreImplicit()->getType();
+
+    // if there is more than one copy of the LHS, this cast is resolving ambiguity
+    bool foundOne = false;
+    if (t1->isRecordType())
+    {
+        foundOne = loplugin::derivedFromCount(t2, t1) == 1;
+    }
+    else
+    {
+        auto pointee1 = t1->getPointeeCXXRecordDecl();
+        auto pointee2 = t2->getPointeeCXXRecordDecl();
+        if (pointee1 && pointee2)
+            foundOne = loplugin::derivedFromCount(pointee2, pointee1) == 1;
+    }
+
+    if (foundOne)
+    {
+        report(
+            DiagnosticsEngine::Warning, "redundant static_cast from %0 to %1",
+            staticCastExpr->getExprLoc())
+            << t2 << t1 << staticCastExpr->getSourceRange();
+    }
+}
+
 bool RedundantCast::VisitCXXStaticCastExpr(CXXStaticCastExpr const * expr) {
     if (ignoreLocation(expr)) {
         return true;
diff --git a/compilerplugins/clang/referencecasting.cxx b/compilerplugins/clang/referencecasting.cxx
index e5e64f1d133e..6b1e3a47e920 100644
--- a/compilerplugins/clang/referencecasting.cxx
+++ b/compilerplugins/clang/referencecasting.cxx
@@ -342,46 +342,6 @@ static const RecordType* extractTemplateType(const clang::Type* cceType)
     return dyn_cast<RecordType>(templateParamType);
 }
 
-static int derivedFromCount(QualType qt, const CXXRecordDecl* baseRecord);
-
-static int derivedFromCount(const CXXRecordDecl* subtypeRecord, const CXXRecordDecl* baseRecord)
-{
-    if (!subtypeRecord->hasDefinition())
-        return 0;
-    int derivedCount = 0;
-    for (auto it = subtypeRecord->bases_begin(); it != subtypeRecord->bases_end(); ++it)
-    {
-        derivedCount += derivedFromCount(it->getType(), baseRecord);
-        if (derivedCount > 1)
-            return derivedCount;
-    }
-    for (auto it = subtypeRecord->vbases_begin(); it != subtypeRecord->vbases_end(); ++it)
-    {
-        derivedCount += derivedFromCount(it->getType(), baseRecord);
-        if (derivedCount > 1)
-            return derivedCount;
-    }
-    return derivedCount;
-}
-
-static int derivedFromCount(QualType qt, const CXXRecordDecl* baseRecord)
-{
-    int derivedCount = 0;
-    auto type = qt.getTypePtr();
-    if (auto elaboratedType = dyn_cast<ElaboratedType>(type))
-        type = elaboratedType->desugar().getTypePtr();
-    if (auto recordType = dyn_cast<RecordType>(type))
-    {
-        if (auto cxxRecordDecl = dyn_cast<CXXRecordDecl>(recordType->getDecl()))
-        {
-            if (cxxRecordDecl->Equals(baseRecord))
-                derivedCount++;
-            derivedCount += derivedFromCount(cxxRecordDecl, baseRecord);
-        }
-    }
-    return derivedCount;
-}
-
 /**
   Implement my own isDerived because we can't always see all the definitions of the classes involved.
   which will cause an assert with the normal clang isDerivedFrom code.
@@ -390,7 +350,7 @@ static bool isDerivedFrom(const CXXRecordDecl* subtypeRecord, const CXXRecordDec
 {
     // if there is more than one case, then we have an ambiguous conversion, and we can't change the code
     // to use the upcasting constructor.
-    return derivedFromCount(subtypeRecord, baseRecord) == 1;
+    return loplugin::derivedFromCount(subtypeRecord, baseRecord) == 1;
 }
 
 loplugin::Plugin::Registration<ReferenceCasting> referencecasting("referencecasting");
diff --git a/compilerplugins/clang/test/redundantcast.cxx b/compilerplugins/clang/test/redundantcast.cxx
index be34a57729c6..a876fae6e4b3 100644
--- a/compilerplugins/clang/test/redundantcast.cxx
+++ b/compilerplugins/clang/test/redundantcast.cxx
@@ -392,6 +392,20 @@ void testArrayDecay() {
     (void) reinterpret_cast<char const *>(u8"");
 }
 
+void testNew() {
+    class A {};
+    class B : public A {};
+    A* p = static_cast<A*>(new B); // expected-error {{redundant static_cast from 'B *' to 'A *' [loplugin:redundantcast]}}
+    (void)p;
+    // no warning expected for resolving-ambiguity cast
+    class C : public A {};
+    class D : public B, public C {};
+    p = static_cast<B*>(new D);
+    // no warning expected for down-cast
+    auto p2 = static_cast<B*>(p);
+    (void)p2;
+}
+
 int main() {
     testConstCast();
     testStaticCast();
diff --git a/configmgr/source/rootaccess.cxx b/configmgr/source/rootaccess.cxx
index 202a8a377ee8..17c9f111a27a 100644
--- a/configmgr/source/rootaccess.cxx
+++ b/configmgr/source/rootaccess.cxx
@@ -79,7 +79,7 @@ void RootAccess::initBroadcaster(
         css::util::ChangesSet set(comphelper::containerToSequence(changes));
         for (auto const& changesListener : changesListeners_)
         {
-            cppu::OWeakObject* pSource = static_cast< cppu::OWeakObject * >(this);
+            cppu::OWeakObject* pSource = this;
             css::uno::Reference< css::uno::XInterface > xBase( pSource, css::uno::UNO_QUERY );
             broadcaster->addChangesNotification(
                 changesListener,
diff --git a/connectivity/source/commontools/dbexception.cxx b/connectivity/source/commontools/dbexception.cxx
index c5557ac43e24..9d4d9e7a83d3 100644
--- a/connectivity/source/commontools/dbexception.cxx
+++ b/connectivity/source/commontools/dbexception.cxx
@@ -247,7 +247,7 @@ SQLExceptionIteratorHelper::SQLExceptionIteratorHelper( const SQLExceptionInfo&
 {
     if ( _rChainStart.isValid() )
     {
-        m_pCurrent = static_cast<const SQLException*>(_rChainStart);
+        m_pCurrent = _rChainStart;
         m_eCurrentType = _rChainStart.getType();
     }
 }
diff --git a/connectivity/source/drivers/jdbc/JConnection.cxx b/connectivity/source/drivers/jdbc/JConnection.cxx
index 4c600cf2e767..e9109a7d7e0f 100644
--- a/connectivity/source/drivers/jdbc/JConnection.cxx
+++ b/connectivity/source/drivers/jdbc/JConnection.cxx
@@ -535,7 +535,7 @@ Any SAL_CALL java_sql_Connection::getWarnings(  )
     if( out )
     {
         java_sql_SQLWarning_BASE        warn_base(t.pEnv, out);
-        SQLException aAsException( static_cast< css::sdbc::SQLException >( java_sql_SQLWarning( warn_base, *this ) ) );
+        SQLException aAsException( java_sql_SQLWarning( warn_base, *this ) );
 
         // translate to warning
         SQLWarning aWarning;
diff --git a/cppuhelper/source/exc_thrower.cxx b/cppuhelper/source/exc_thrower.cxx
index edf7b8948728..5e029feae982 100644
--- a/cppuhelper/source/exc_thrower.cxx
+++ b/cppuhelper/source/exc_thrower.cxx
@@ -134,7 +134,7 @@ Any ExceptionThrower::queryInterface( Type const & type )
     if (type.equals( cppu::UnoType<XInterface>::get() ) ||
         type.equals( ExceptionThrower::getCppuType() ))
     {
-        XExceptionThrower * that = static_cast< XExceptionThrower * >( this );
+        XExceptionThrower * that = this;
         return Any( &that, type );
     }
     return Any();
diff --git a/dbaccess/source/ui/dlg/sqlmessage.cxx b/dbaccess/source/ui/dlg/sqlmessage.cxx
index 3bcb10c4ebcd..f585b6fd1276 100644
--- a/dbaccess/source/ui/dlg/sqlmessage.cxx
+++ b/dbaccess/source/ui/dlg/sqlmessage.cxx
@@ -212,7 +212,7 @@ namespace
             SQLExceptionInfo aCurrentElement;
             iter.next( aCurrentElement );
 
-            const SQLException* pCurrentError = static_cast<const SQLException*>(aCurrentElement);
+            const SQLException* pCurrentError = aCurrentElement;
             OSL_ENSURE( pCurrentError, "lcl_buildExceptionChain: iterator failure!" );
                 // hasMoreElements should not have returned <TRUE/> in this case
 
@@ -238,7 +238,7 @@ namespace
 
             if ( aCurrentElement.getType() == SQLExceptionInfo::TYPE::SQLContext )
             {
-                const SQLContext* pContext = static_cast<const SQLContext*>(aCurrentElement);
+                const SQLContext* pContext = aCurrentElement;
                 if ( !pContext->Details.isEmpty() )
                 {
                     ExceptionDisplayInfo aSubInfo( aCurrentElement.getType() );
diff --git a/dbaccess/source/ui/misc/TableCopyHelper.cxx b/dbaccess/source/ui/misc/TableCopyHelper.cxx
index f075b33f5853..6b7015d16344 100644
--- a/dbaccess/source/ui/misc/TableCopyHelper.cxx
+++ b/dbaccess/source/ui/misc/TableCopyHelper.cxx
@@ -242,7 +242,7 @@ bool OTableCopyHelper::copyTagTable(OTableCopyHelper::DropDescriptor const & _rD
         pImport = new ORTFImportExport(_xConnection,getNumberFormatter(_xConnection, m_pController->getORB()),m_pController->getORB());
 
     xEvt = pImport;
-    SvStream* pStream = static_cast<SvStream*>(_rDesc.aHtmlRtfStorage.get());
+    SvStream* pStream = _rDesc.aHtmlRtfStorage.get();
     if ( _bCheck )
         pImport->enableCheckOnly();
 
diff --git a/extensions/source/propctrlr/browserline.cxx b/extensions/source/propctrlr/browserline.cxx
index 4c18b30ec708..4c3a56ecfc46 100644
--- a/extensions/source/propctrlr/browserline.cxx
+++ b/extensions/source/propctrlr/browserline.cxx
@@ -121,7 +121,7 @@ namespace pcr
 
         if(m_pBrowseButton)
         {
-            pRefWindow=static_cast<vcl::Window*>(m_pBrowseButton);
+            pRefWindow = m_pBrowseButton;
         }
         else if ( m_pControlWindow )
         {
diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx
index 94abf351e1dd..c3ee81c39d32 100644
--- a/filter/source/msfilter/msdffimp.cxx
+++ b/filter/source/msfilter/msdffimp.cxx
@@ -2968,7 +2968,7 @@ void DffRecordManager::Consume( SvStream& rIn, sal_uInt32 nStOfs )
     }
     if ( nStOfs )
     {
-        pCList = static_cast<DffRecordList*>(this);
+        pCList = this;
         while ( pCList->pNext )
             pCList = pCList->pNext.get();
         while (rIn.good() && ( ( rIn.Tell() + 8 ) <=  nStOfs ))
@@ -2987,7 +2987,7 @@ void DffRecordManager::Consume( SvStream& rIn, sal_uInt32 nStOfs )
 
 void DffRecordManager::Clear()
 {
-    pCList = static_cast<DffRecordList*>(this);
+    pCList = this;
     pNext.reset();
     nCurrent = 0;
     nCount = 0;
@@ -3004,7 +3004,7 @@ DffRecordHeader* DffRecordManager::Current()
 DffRecordHeader* DffRecordManager::First()
 {
     DffRecordHeader* pRet = nullptr;
-    pCList = static_cast<DffRecordList*>(this);
+    pCList = this;
     if ( pCList->nCount )
     {
         pCList->nCurrent = 0;
diff --git a/fpicker/source/office/iodlg.cxx b/fpicker/source/office/iodlg.cxx
index a4916448db77..f307abadbcdb 100644
--- a/fpicker/source/office/iodlg.cxx
+++ b/fpicker/source/office/iodlg.cxx
@@ -2301,7 +2301,7 @@ Control* SvtFileDialog::getControl( sal_Int16 _nControlId, bool _bLabelControl )
             break;
 
         case EDIT_FILEURL_LABEL:
-            pReturn = static_cast< Control* >( pImpl->_pFtFileName );
+            pReturn = pImpl->_pFtFileName;
             break;
 
         case CHECKBOX_AUTOEXTENSION:
diff --git a/framework/source/uielement/addonstoolbarwrapper.cxx b/framework/source/uielement/addonstoolbarwrapper.cxx
index 1e9d37e6ce1c..657c39b1ce31 100644
--- a/framework/source/uielement/addonstoolbarwrapper.cxx
+++ b/framework/source/uielement/addonstoolbarwrapper.cxx
@@ -151,7 +151,7 @@ Reference< XInterface > SAL_CALL AddonsToolBarWrapper::getRealInterface()
         AddonsToolBarManager* pToolBarManager = static_cast< AddonsToolBarManager *>( m_xToolBarManager.get() );
         if ( pToolBarManager )
         {
-            vcl::Window* pWindow = static_cast<vcl::Window *>(pToolBarManager->GetToolBar());
+            vcl::Window* pWindow = pToolBarManager->GetToolBar();
             return Reference< XInterface >( VCLUnoHelper::GetInterface( pWindow ), UNO_QUERY );
         }
     }
diff --git a/framework/source/uielement/statusbarwrapper.cxx b/framework/source/uielement/statusbarwrapper.cxx
index 1273cae6f5ae..75bd83c856e6 100644
--- a/framework/source/uielement/statusbarwrapper.cxx
+++ b/framework/source/uielement/statusbarwrapper.cxx
@@ -165,7 +165,7 @@ Reference< XInterface > SAL_CALL StatusBarWrapper::getRealInterface()
         StatusBarManager* pStatusBarManager = static_cast< StatusBarManager *>( m_xStatusBarManager.get() );
         if ( pStatusBarManager )
         {
-            vcl::Window* pWindow = static_cast<vcl::Window *>(pStatusBarManager->GetStatusBar());
+            vcl::Window* pWindow = pStatusBarManager->GetStatusBar();
             if ( pWindow )
                 return Reference< XInterface >( VCLUnoHelper::GetInterface( pWindow ), UNO_QUERY );
         }
diff --git a/framework/source/uielement/toolbarwrapper.cxx b/framework/source/uielement/toolbarwrapper.cxx
index 951fb3bacec7..1870b5e93d76 100644
--- a/framework/source/uielement/toolbarwrapper.cxx
+++ b/framework/source/uielement/toolbarwrapper.cxx
@@ -261,7 +261,7 @@ Reference< XInterface > SAL_CALL ToolBarWrapper::getRealInterface(  )
         ToolBarManager* pToolBarManager = static_cast< ToolBarManager *>( m_xToolBarManager.get() );
         if ( pToolBarManager )
         {
-            vcl::Window* pWindow = static_cast<vcl::Window *>(pToolBarManager->GetToolBar());
+            vcl::Window* pWindow = pToolBarManager->GetToolBar();
             return Reference< XInterface >( VCLUnoHelper::GetInterface( pWindow ), UNO_QUERY );
         }
     }
diff --git a/l10ntools/source/helper.cxx b/l10ntools/source/helper.cxx
index c16d104b34e9..e84b029869a7 100644
--- a/l10ntools/source/helper.cxx
+++ b/l10ntools/source/helper.cxx
@@ -140,8 +140,7 @@ bool isWellFormedXML( OString const & text )
 OString xmlStrToOString( const xmlChar* pString )
 {
     xmlChar* pTemp = xmlStrdup( pString );
-    OString sResult =
-        static_cast<OString>(reinterpret_cast<sal_Char*>( pTemp ));
+    OString sResult = reinterpret_cast<sal_Char*>( pTemp );
     xmlFree( pTemp );
     return sResult;
 }
diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx
index b6721acbc0e6..9aac00728c05 100644
--- a/sd/source/core/drawdoc3.cxx
+++ b/sd/source/core/drawdoc3.cxx
@@ -1573,7 +1573,7 @@ void SdDrawDocument::SetMasterPage(sal_uInt16 nSdPageNum,
                     aReplList.push_back(aReplData);
                 }
 
-                pHisSheet = static_cast<SfxStyleSheet*>( pSourceStyleSheetPool->Next() );
+                pHisSheet = pSourceStyleSheetPool->Next();
             }
 
             // If new styles were created: re-create parent chaining of the item
diff --git a/sd/source/ui/app/sdmod2.cxx b/sd/source/ui/app/sdmod2.cxx
index 4fd801e92b5f..5379f25aabde 100644
--- a/sd/source/ui/app/sdmod2.cxx
+++ b/sd/source/ui/app/sdmod2.cxx
@@ -500,7 +500,7 @@ std::unique_ptr<SfxItemSet> SdModule::CreateItemSet( sal_uInt16 nSlot )
     sal_Int32  nY;
     if( pDocSh )
     {
-        SdrPage* pPage = static_cast<SdrPage*>(pDoc->GetSdPage(0, PageKind::Standard));
+        SdrPage* pPage = pDoc->GetSdPage(0, PageKind::Standard);
         Size aSize(pPage->GetSize());
         nW = aSize.Width();
         nH = aSize.Height();
diff --git a/sd/source/ui/unoidl/unocpres.cxx b/sd/source/ui/unoidl/unocpres.cxx
index 43cceb0dae39..2571b1388bbf 100644
--- a/sd/source/ui/unoidl/unocpres.cxx
+++ b/sd/source/ui/unoidl/unocpres.cxx
@@ -186,7 +186,7 @@ uno::Any SAL_CALL SdXCustomPresentation::getByIndex( sal_Int32 Index )
         throw lang::IndexOutOfBoundsException();
 
     uno::Any aAny;
-    SdrPage * pPage = static_cast<SdrPage*>(const_cast<SdPage *>(mpSdCustomShow->PagesVector()[Index]));
+    SdrPage * pPage = const_cast<SdPage *>(mpSdCustomShow->PagesVector()[Index]);
 
     if( pPage )
     {
diff --git a/sd/source/ui/view/FormShellManager.cxx b/sd/source/ui/view/FormShellManager.cxx
index 8116b2a3359d..fa86b58ec904 100644
--- a/sd/source/ui/view/FormShellManager.cxx
+++ b/sd/source/ui/view/FormShellManager.cxx
@@ -109,7 +109,7 @@ void FormShellManager::SetFormShell (FmFormShell* pFormShell)
         if (pMainViewShell != nullptr)
         {
             // Prevent setting the view twice at the FmFormShell.
-            FmFormView* pFormView = static_cast<FmFormView*>(pMainViewShell->GetView());
+            FmFormView* pFormView = pMainViewShell->GetView();
             if (mpFormShell->GetFormView() != pFormView)
                 mpFormShell->SetView(pFormView);
         }
diff --git a/sd/source/ui/view/viewshe2.cxx b/sd/source/ui/view/viewshe2.cxx
index f5e511d21a0e..707b8ac4c511 100644
--- a/sd/source/ui/view/viewshe2.cxx
+++ b/sd/source/ui/view/viewshe2.cxx
@@ -752,8 +752,7 @@ bool ViewShell::ActivateObject(SdrOle2Obj* pObj, long nVerb)
         }
 
         SfxInPlaceClient* pSdClient =
-            static_cast<Client*>(pViewShell->FindIPClient(
-                pObj->GetObjRef(), GetActiveWindow()));
+            pViewShell->FindIPClient(pObj->GetObjRef(), GetActiveWindow());
 
         if ( !pSdClient )
         {
diff --git a/sfx2/source/dialog/backingcomp.cxx b/sfx2/source/dialog/backingcomp.cxx
index a810f0be9fda..dea33fa1698f 100644
--- a/sfx2/source/dialog/backingcomp.cxx
+++ b/sfx2/source/dialog/backingcomp.cxx
@@ -395,7 +395,7 @@ void SAL_CALL BackingComp::attachFrame( /*IN*/ const css::uno::Reference< css::f
         pBack->setOwningFrame( m_xFrame );
 
     // set NotebookBar
-    SystemWindow* pSysWindow = static_cast<SystemWindow*>(pParent);
+    SystemWindow* pSysWindow = pParent;
     if (pSysWindow)
     {
         //sfx2::SfxNotebookBar::StateMethod(pSysWindow, m_xFrame, "sfx/ui/notebookbar.ui");
diff --git a/sfx2/source/notebookbar/NotebookbarTabControl.cxx b/sfx2/source/notebookbar/NotebookbarTabControl.cxx
index f9dd28131e11..de3eaf04ad6b 100644
--- a/sfx2/source/notebookbar/NotebookbarTabControl.cxx
+++ b/sfx2/source/notebookbar/NotebookbarTabControl.cxx
@@ -361,7 +361,7 @@ Size NotebookbarTabControl::calculateRequisition() const
 
     for (int i = 0; i < GetPageCount(); i++)
     {
-        vcl::Window* pChild = static_cast<vcl::Window*>(GetTabPage(TabControl::GetPageId(i)));
+        vcl::Window* pChild = GetTabPage(TabControl::GetPageId(i));
 
         if (pChild)
         {
diff --git a/svl/source/items/style.cxx b/svl/source/items/style.cxx
index 9e15baa034f5..d206c17ba6bd 100644
--- a/svl/source/items/style.cxx
+++ b/svl/source/items/style.cxx
@@ -790,7 +790,7 @@ struct StyleSheetDisposerFunctor final : public svl::StyleSheetDisposer
     void
     Dispose(rtl::Reference<SfxStyleSheetBase> styleSheet) override
     {
-        cppu::OWeakObject* weakObject = static_cast< ::cppu::OWeakObject* >(styleSheet.get());
+        cppu::OWeakObject* weakObject = styleSheet.get();
         css::uno::Reference< css::lang::XComponent > xComp( weakObject, css::uno::UNO_QUERY );
         if( xComp.is() ) try
         {
diff --git a/svtools/source/control/valueacc.cxx b/svtools/source/control/valueacc.cxx
index 5188746d5653..50ae750f068b 100644
--- a/svtools/source/control/valueacc.cxx
+++ b/svtools/source/control/valueacc.cxx
@@ -296,7 +296,7 @@ uno::Reference< accessibility::XAccessibleRelationSet > SAL_CALL ValueSetAcc::ge
     ThrowIfDisposed();
     SolarMutexGuard g;
     uno::Reference< accessibility::XAccessibleRelationSet > xRelSet;
-    vcl::Window* pWindow = static_cast<vcl::Window*>(mpParent);
+    vcl::Window* pWindow = mpParent;
     if ( pWindow )
     {
         utl::AccessibleRelationSetHelper* pRelationSet = new utl::AccessibleRelationSetHelper;
diff --git a/svx/source/dialog/imapwnd.cxx b/svx/source/dialog/imapwnd.cxx
index 3cc57494dc0a..3a5d0b4ea6b4 100644
--- a/svx/source/dialog/imapwnd.cxx
+++ b/svx/source/dialog/imapwnd.cxx
@@ -193,10 +193,7 @@ SdrObject* IMapWindow::CreateObj( const IMapObject* pIMapObj )
             // clipped on CanvasPane
             aDrawRect.Intersection( aClipRect );
 
-            pSdrObj = static_cast<SdrObject*>(
-                new SdrRectObj(
-                    *pModel,
-                    aDrawRect));
+            pSdrObj = new SdrRectObj(*pModel, aDrawRect);
             pCloneIMapObj.reset(static_cast<IMapObject*>(new IMapRectangleObject( *pIMapRectObj )));
         }
         break;
@@ -212,13 +209,12 @@ SdrObject* IMapWindow::CreateObj( const IMapObject* pIMapObj )
             // limited to CanvasPane
             aCircle.Intersection( aClipRect );
 
-            pSdrObj = static_cast<SdrObject*>(
-                new SdrCircObj(
+            pSdrObj = new SdrCircObj(
                     *pModel,
                     SdrCircKind::Full,
                     aCircle,
                     0,
-                    36000));
+                    36000);
             pCloneIMapObj.reset(static_cast<IMapObject*>(new IMapCircleObject( *pIMapCircleObj )));
         }
         break;
@@ -235,13 +231,12 @@ SdrObject* IMapWindow::CreateObj( const IMapObject* pIMapObj )
                 // clipped on CanvasPane
                 aDrawRect.Intersection( aClipRect );
 
-                pSdrObj = static_cast<SdrObject*>(
-                    new SdrCircObj(
+                pSdrObj = new SdrCircObj(
                         *pModel,
                         SdrCircKind::Full,
                         aDrawRect,
                         0,
-                        36000));
+                        36000);
             }
             else
             {
@@ -253,11 +248,10 @@ SdrObject* IMapWindow::CreateObj( const IMapObject* pIMapObj )
 
                 basegfx::B2DPolygon aPolygon;
                 aPolygon.append(aDrawPoly.getB2DPolygon());
-                pSdrObj = static_cast<SdrObject*>(
-                    new SdrPathObj(
+                pSdrObj = new SdrPathObj(
                         *pModel,
                         OBJ_POLY,
-                        basegfx::B2DPolyPolygon(aPolygon)));
+                        basegfx::B2DPolyPolygon(aPolygon));
             }
 
             pCloneIMapObj.reset(static_cast<IMapObject*>(new IMapPolygonObject( *pIMapPolyObj )));
diff --git a/svx/source/gallery2/galbrws2.cxx b/svx/source/gallery2/galbrws2.cxx
index 88e95b540f93..9109b81ad4c7 100644
--- a/svx/source/gallery2/galbrws2.cxx
+++ b/svx/source/gallery2/galbrws2.cxx
@@ -1139,9 +1139,9 @@ void GalleryBrowser2::Execute(const OString &rIdent)
 
             switch( GetMode() )
             {
-                case GALLERYBROWSERMODE_ICON: pWindow = static_cast<vcl::Window*>(mpIconView); break;
-                case GALLERYBROWSERMODE_LIST: pWindow = static_cast<vcl::Window*>(mpListView); break;
-                case GALLERYBROWSERMODE_PREVIEW: pWindow = static_cast<vcl::Window*>(mpPreview); break;
+                case GALLERYBROWSERMODE_ICON: pWindow = mpIconView; break;
+                case GALLERYBROWSERMODE_LIST: pWindow = mpListView; break;
+                case GALLERYBROWSERMODE_PREVIEW: pWindow = mpPreview; break;
 
                 default:
                     pWindow = nullptr;
diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx
index 2389afe1f6da..5296797e0954 100644
--- a/svx/source/table/tablecontroller.cxx
+++ b/svx/source/table/tablecontroller.cxx
@@ -2779,7 +2779,7 @@ bool SvxTableController::ApplyFormatPaintBrush( SfxItemSet& rFormatSet, bool bNo
             {
                 if (bUndo)
                     xCell->AddUndo();
-                SdrText* pText = static_cast< SdrText* >( xCell.get() );
+                SdrText* pText = xCell.get();
                 SdrObjEditView::ApplyFormatPaintBrushToText( rFormatSet, rTableObj, pText, bNoCharacterFormats, bNoParagraphFormats );
             }
         }
diff --git a/svx/source/unodraw/unomtabl.cxx b/svx/source/unodraw/unomtabl.cxx
index 227433a792ed..a6d56f20d479 100644
--- a/svx/source/unodraw/unomtabl.cxx
+++ b/svx/source/unodraw/unomtabl.cxx
@@ -188,7 +188,7 @@ void SAL_CALL SvxUnoMarkerTable::removeByName( const OUString& aApiName )
 
     auto aIter = std::find_if(maItemSetVector.begin(), maItemSetVector.end(),
         [&aName](const std::unique_ptr<SfxItemSet>& rpItem) {
-            const NameOrIndex *pItem = static_cast<const NameOrIndex *>(&(rpItem->Get( XATTR_LINEEND ) ));
+            const NameOrIndex *pItem = &(rpItem->Get( XATTR_LINEEND ) );
             return pItem->GetName() == aName;
         });
     if (aIter != maItemSetVector.end())
@@ -210,7 +210,7 @@ void SAL_CALL SvxUnoMarkerTable::replaceByName( const OUString& aApiName, const
 
     auto aIter = std::find_if(maItemSetVector.begin(), maItemSetVector.end(),
         [&aName](const std::unique_ptr<SfxItemSet>& rpItem) {
-            const NameOrIndex *pItem = static_cast<const NameOrIndex *>(&(rpItem->Get( XATTR_LINEEND ) ));
+            const NameOrIndex *pItem = &(rpItem->Get( XATTR_LINEEND ) );
             return pItem->GetName() == aName;
         });
     if (aIter != maItemSetVector.end())
diff --git a/sw/source/core/attr/calbck.cxx b/sw/source/core/attr/calbck.cxx
index b90ebafae831..cef9b02b059f 100644
--- a/sw/source/core/attr/calbck.cxx
+++ b/sw/source/core/attr/calbck.cxx
@@ -283,7 +283,7 @@ SwClient* SwModify::Remove( SwClient* pDepend )
             {
                 // if object being removed is the current or next object in an
                 // iterator, advance this iterator
-                rIter.m_pPosition = static_cast<SwClient*>(pR);
+                rIter.m_pPosition = pR;
             }
         }
     }
diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx
index d5fa25e5d592..538009793741 100644
--- a/sw/source/core/crsr/crsrsh.cxx
+++ b/sw/source/core/crsr/crsrsh.cxx
@@ -471,7 +471,7 @@ bool SwCursorShell::bColumnChange()
         if(pParent!=nullptr)
         {
             pCurrCol=static_cast<SwFrame*>(pParent)->FindColFrame();
-            pCurrFrame = static_cast<SwFrame*>(pParent);
+            pCurrFrame = pParent;
         }
         else
         {
diff --git a/sw/source/core/doc/CntntIdxStore.cxx b/sw/source/core/doc/CntntIdxStore.cxx
index b62490995652..7355257bf711 100644
--- a/sw/source/core/doc/CntntIdxStore.cxx
+++ b/sw/source/core/doc/CntntIdxStore.cxx
@@ -398,7 +398,7 @@ void ContentIdxStoreImpl::RestoreFlys(SwDoc* pDoc, updater_t const & rUpdater, b
         else if( bAuto )
         {
             SwFrameFormat *pFrameFormat = (*pSpz)[ aEntry.m_nIdx ];
-            SfxPoolItem const *pAnchor = static_cast<SfxPoolItem const *>(&pFrameFormat->GetAnchor());
+            SfxPoolItem const *pAnchor = &pFrameFormat->GetAnchor();
             pFrameFormat->NotifyClients( pAnchor, pAnchor );
         }
     }
diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx
index 0c69d1d4a9a6..be514788ec6a 100644
--- a/sw/source/core/doc/docfmt.cxx
+++ b/sw/source/core/doc/docfmt.cxx
@@ -1015,7 +1015,7 @@ void SwDoc::DelTextFormatColl( SwTextFormatColl const *pColl, bool bBroadcast )
 
 static bool lcl_SetTextFormatColl( const SwNodePtr& rpNode, void* pArgs )
 {
-    SwContentNode* pCNd = static_cast<SwContentNode*>(rpNode->GetTextNode());
+    SwContentNode* pCNd = rpNode->GetTextNode();
 
     if( pCNd == nullptr)
         return true;
diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx
index 057ebdbb5ee5..48d9eab2e1b9 100644
--- a/sw/source/core/docnode/ndtbl.cxx
+++ b/sw/source/core/docnode/ndtbl.cxx
@@ -218,7 +218,7 @@ SwTableNode* SwDoc::IsIdxInTable(const SwNodeIndex& rIdx)
     SwTableNode* pTableNd = nullptr;
     sal_uLong nIndex = rIdx.GetIndex();
     do {
-        SwNode* pNd = static_cast<SwNode*>(GetNodes()[ nIndex ]->StartOfSectionNode());
+        SwNode* pNd = GetNodes()[ nIndex ]->StartOfSectionNode();
         if( nullptr != ( pTableNd = pNd->GetTableNode() ) )
             break;
 
diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx
index 552180f46525..9e7644dd7f8e 100644
--- a/sw/source/core/frmedt/fefly1.cxx
+++ b/sw/source/core/frmedt/fefly1.cxx
@@ -1839,8 +1839,8 @@ void SwFEShell::GetConnectableFrameFormats(SwFrameFormat & rFormat,
     StartAction();
 
     SwFormatChain rChain = rFormat.GetChain();
-    SwFrameFormat * pOldChainNext = static_cast<SwFrameFormat *>(rChain.GetNext());
-    SwFrameFormat * pOldChainPrev = static_cast<SwFrameFormat *>(rChain.GetPrev());
+    SwFrameFormat * pOldChainNext = rChain.GetNext();
+    SwFrameFormat * pOldChainPrev = rChain.GetPrev();
 
     if (pOldChainNext)
         mxDoc->Unchain(rFormat);
diff --git a/sw/source/core/text/frmcrsr.cxx b/sw/source/core/text/frmcrsr.cxx
index e47dc10c3a25..7eae6a55198e 100644
--- a/sw/source/core/text/frmcrsr.cxx
+++ b/sw/source/core/text/frmcrsr.cxx
@@ -197,7 +197,7 @@ bool SwTextFrame::GetCharRect( SwRect& rOrig, const SwPosition &rPos,
                                      bNoScroll );
     pFrame->GetFormatted();
 
-    const SwFrame* pTmpFrame = static_cast<SwFrame*>(pFrame->GetUpper());
+    const SwFrame* pTmpFrame = pFrame->GetUpper();
     if (pTmpFrame->getFrameArea().Top() == FAR_AWAY && !bAllowFarAway)
         return false;
 
@@ -373,7 +373,7 @@ bool SwTextFrame::GetAutoPos( SwRect& rOrig, const SwPosition &rPos ) const
     SwTextFrame* pFrame = &(const_cast<SwTextFrame*>(this)->GetFrameAtOfst( nOffset ));
 
     pFrame->GetFormatted();
-    const SwFrame* pTmpFrame = static_cast<SwFrame*>(pFrame->GetUpper());
+    const SwFrame* pTmpFrame = pFrame->GetUpper();
 
     SwRectFnSet aRectFnSet(pTmpFrame);
     SwTwips nUpperMaxY = aRectFnSet.GetPrtBottom(*pTmpFrame);
diff --git a/sw/source/core/text/itradj.cxx b/sw/source/core/text/itradj.cxx
index 27659330e387..f32bc444712e 100644
--- a/sw/source/core/text/itradj.cxx
+++ b/sw/source/core/text/itradj.cxx
@@ -749,7 +749,7 @@ void SwTextAdjuster::CalcDropAdjust()
         if( pPor->InGlueGrp() && pPor->GetNextPortion()
               && pPor->GetNextPortion()->IsDropPortion() )
         {
-            const SwLinePortion *pDropPor = static_cast<SwDropPortion*>( pPor->GetNextPortion() );
+            const SwLinePortion *pDropPor = pPor->GetNextPortion();
             SwGluePortion *pLeft = static_cast<SwGluePortion*>( pPor );
 
             // 4) pRight: Find the GluePor coming after the DropPor
diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx
index 72d3363e800b..9c59c5353fea 100644
--- a/sw/source/core/text/itrform2.cxx
+++ b/sw/source/core/text/itrform2.cxx
@@ -139,7 +139,7 @@ sal_uInt16 SwTextFormatter::GetFrameRstHeight() const
 
     // GetFrameRstHeight() is being called with Footnote.
     // Wrong: const SwFrame *pUpper = pFrame->GetUpper();
-    const SwFrame *pPage = static_cast<const SwFrame*>(m_pFrame->FindPageFrame());
+    const SwFrame *pPage = m_pFrame->FindPageFrame();
     const SwTwips nHeight = pPage->getFrameArea().Top()
                           + pPage->getFramePrintArea().Top()
                           + pPage->getFramePrintArea().Height() - Y();
@@ -1040,7 +1040,7 @@ SwLinePortion *SwTextFormatter::WhichFirstPortion(SwTextFormatInfo &rInf)
         if( !rInf.IsErgoDone() )
         {
             if( m_pFrame->IsInFootnote() && !m_pFrame->GetIndPrev() )
-                pPor = static_cast<SwLinePortion*>(NewErgoSumPortion( rInf ));
+                pPor = NewErgoSumPortion( rInf );
             rInf.SetErgoDone( true );
         }
 
@@ -1085,7 +1085,7 @@ SwLinePortion *SwTextFormatter::WhichFirstPortion(SwTextFormatInfo &rInf)
             const bool bFootnoteNum = m_pFrame->IsFootnoteNumFrame();
             rInf.GetParaPortion()->SetFootnoteNum( bFootnoteNum );
             if( bFootnoteNum )
-                pPor = static_cast<SwLinePortion*>(NewFootnoteNumPortion( rInf ));
+                pPor = NewFootnoteNumPortion( rInf );
             rInf.SetFootnoteDone( true );
         }
 
@@ -1094,7 +1094,7 @@ SwLinePortion *SwTextFormatter::WhichFirstPortion(SwTextFormatInfo &rInf)
         if( !rInf.IsErgoDone() && !pPor && ! rInf.IsMulti() )
         {
             if( m_pFrame->IsInFootnote() && !m_pFrame->GetIndPrev() )
-                pPor = static_cast<SwLinePortion*>(NewErgoSumPortion( rInf ));
+                pPor = NewErgoSumPortion( rInf );
             rInf.SetErgoDone( true );
         }
 
@@ -1106,12 +1106,12 @@ SwLinePortion *SwTextFormatter::WhichFirstPortion(SwTextFormatInfo &rInf)
 
             // If we're in the follow, then of course not
             if (GetTextFrame()->GetTextNodeForParaProps()->GetNumRule())
-                pPor = static_cast<SwLinePortion*>(NewNumberPortion( rInf ));
+                pPor = NewNumberPortion( rInf );
             rInf.SetNumDone( true );
         }
         // 8. The DropCaps
         if( !pPor && GetDropFormat() && ! rInf.IsMulti() )
-            pPor = static_cast<SwLinePortion*>(NewDropPortion( rInf ));
+            pPor = NewDropPortion( rInf );
 
         // 9. Kerning portions at beginning of line in grid mode
         if ( !pPor && !m_pCurr->GetNextPortion() )
@@ -2464,7 +2464,7 @@ void SwTextFormatter::CalcFlyWidth( SwTextFormatInfo &rInf )
 SwFlyCntPortion *SwTextFormatter::NewFlyCntPortion( SwTextFormatInfo &rInf,
                                                    SwTextAttr *pHint ) const
 {
-    const SwFrame *pFrame = static_cast<SwFrame*>(m_pFrame);
+    const SwFrame *pFrame = m_pFrame;
 
     SwFlyInContentFrame *pFly;
     SwFrameFormat* pFrameFormat = static_cast<SwTextFlyCnt*>(pHint)->GetFlyCnt().GetFrameFormat();
diff --git a/sw/source/core/unocore/unocrsrhelper.cxx b/sw/source/core/unocore/unocrsrhelper.cxx
index ddb0d1263768..5ac8ff1a5a45 100644
--- a/sw/source/core/unocore/unocrsrhelper.cxx
+++ b/sw/source/core/unocore/unocrsrhelper.cxx
@@ -547,7 +547,7 @@ bool getCursorPropertyValue(const SfxItemPropertySimpleEntry& rEntry
                 if( pAny )
                 {
                     const SwTableNode* pTableNode = pSttNode->FindTableNode();
-                    SwFrameFormat* pTableFormat = static_cast<SwFrameFormat*>(pTableNode->GetTable().GetFrameFormat());
+                    SwFrameFormat* pTableFormat = pTableNode->GetTable().GetFrameFormat();
                     //SwTable& rTable = static_cast<SwTableNode*>(pSttNode)->GetTable();
                     if(FN_UNO_TEXT_TABLE == rEntry.nWID)
                     {
diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx
index 0ab716c8bd27..2230e40d014c 100644
--- a/sw/source/core/unocore/unoobj2.cxx
+++ b/sw/source/core/unocore/unoobj2.cxx
@@ -663,8 +663,7 @@ SwXParagraphEnumerationImpl::NextElement_Impl()
             pTableNode && (&pTableNode->GetTable() != m_pOwnTable))
         {
             // this is a foreign table
-            SwFrameFormat* pTableFormat =
-                static_cast<SwFrameFormat*>(pTableNode->GetTable().GetFrameFormat());
+            SwFrameFormat* pTableFormat = pTableNode->GetTable().GetFrameFormat();
             xRef = SwXTextTable::CreateXTextTable(pTableFormat);
         }
         else
@@ -1146,7 +1145,7 @@ CreateParentXText(SwDoc & rDoc, const SwPosition& rPos)
         {
             SwTableNode const*const pTableNode = pSttNode->FindTableNode();
             SwFrameFormat *const pTableFormat =
-                static_cast<SwFrameFormat*>(pTableNode->GetTable().GetFrameFormat());
+                pTableNode->GetTable().GetFrameFormat();
             SwTableBox *const  pBox = pSttNode->GetTableBox();
 
             xParentText = pBox
diff --git a/sw/source/ui/fldui/fldedt.cxx b/sw/source/ui/fldui/fldedt.cxx
index 2290a3b632fc..aaaf1e21d28f 100644
--- a/sw/source/ui/fldui/fldedt.cxx
+++ b/sw/source/ui/fldui/fldedt.cxx
@@ -285,7 +285,7 @@ IMPL_LINK(SwFieldEditDlg, NextPrevHdl, weld::Button&, rButton, void)
     SwFieldMgr& rMgr = pTabPage->GetFieldMgr();
     SwField *pCurField = rMgr.GetCurField();
     if (pCurField->GetTypeId() == TYP_DBFLD)
-        pOldTyp = static_cast<SwDBFieldType*>(pCurField->GetTyp());
+        pOldTyp = pCurField->GetTyp();
 
     rMgr.GoNextPrev( bNext, pOldTyp );
     pCurField = rMgr.GetCurField();
diff --git a/sw/source/uibase/uiview/viewling.cxx b/sw/source/uibase/uiview/viewling.cxx
index 28fad568e8c1..380ecebcbc27 100644
--- a/sw/source/uibase/uiview/viewling.cxx
+++ b/sw/source/uibase/uiview/viewling.cxx
@@ -647,7 +647,7 @@ bool SwView::ExecSpellPopup(const Point& rPt)
             m_pWrtShell->Push();
             SwRect aToFill;
 
-            SwCursorShell *pCursorShell = static_cast<SwCursorShell*>(m_pWrtShell.get());
+            SwCursorShell *pCursorShell = m_pWrtShell.get();
             SwPaM *pCursor = pCursorShell->GetCursor();
             SwPosition aPoint(*pCursor->GetPoint());
             const SwTextNode *pNode = aPoint.nNode.GetNode().GetTextNode();
diff --git a/ucb/source/cacher/cachedcontentresultset.cxx b/ucb/source/cacher/cachedcontentresultset.cxx
index 01cf15cd183c..830d76c0129a 100644
--- a/ucb/source/cacher/cachedcontentresultset.cxx
+++ b/ucb/source/cacher/cachedcontentresultset.cxx
@@ -2109,8 +2109,7 @@ XSERVICEINFO_COMMOM_IMPL( CachedContentResultSetFactory,
 static css::uno::Reference< css::uno::XInterface >
 CachedContentResultSetFactory_CreateInstance( const css::uno::Reference< css::lang::XMultiServiceFactory> & rSMgr )
 {
-    css::lang::XServiceInfo* pX =
-        static_cast<css::lang::XServiceInfo*>(new CachedContentResultSetFactory( ucbhelper::getComponentContext(rSMgr) ));
+    css::lang::XServiceInfo* pX = new CachedContentResultSetFactory( ucbhelper::getComponentContext(rSMgr) );
     return css::uno::Reference< css::uno::XInterface >::query( pX );
 }
 
diff --git a/ucb/source/cacher/cachedcontentresultsetstub.cxx b/ucb/source/cacher/cachedcontentresultsetstub.cxx
index 178a1bb869bf..45406c3539fe 100644
--- a/ucb/source/cacher/cachedcontentresultsetstub.cxx
+++ b/ucb/source/cacher/cachedcontentresultsetstub.cxx
@@ -546,8 +546,7 @@ XSERVICEINFO_COMMOM_IMPL( CachedContentResultSetStubFactory,
 static css::uno::Reference< css::uno::XInterface >
 CachedContentResultSetStubFactory_CreateInstance( const css::uno::Reference< css::lang::XMultiServiceFactory> & )
 {
-    css::lang::XServiceInfo* pX =
-        static_cast<css::lang::XServiceInfo*>(new CachedContentResultSetStubFactory);
+    css::lang::XServiceInfo* pX = new CachedContentResultSetStubFactory;
     return css::uno::Reference< css::uno::XInterface >::query( pX );
 }
 css::uno::Sequence< OUString >
diff --git a/ucb/source/cacher/cacheddynamicresultset.cxx b/ucb/source/cacher/cacheddynamicresultset.cxx
index 8debcc1ac234..304aaa7af4b1 100644
--- a/ucb/source/cacher/cacheddynamicresultset.cxx
+++ b/ucb/source/cacher/cacheddynamicresultset.cxx
@@ -200,8 +200,7 @@ XSERVICEINFO_COMMOM_IMPL( CachedDynamicResultSetFactory,
 static css::uno::Reference< css::uno::XInterface >
 CachedDynamicResultSetFactory_CreateInstance( const css::uno::Reference< css::lang::XMultiServiceFactory> & rSMgr )
 {
-    css::lang::XServiceInfo* pX =
-        static_cast<css::lang::XServiceInfo*>(new CachedDynamicResultSetFactory( ucbhelper::getComponentContext(rSMgr) ));
+    css::lang::XServiceInfo* pX = new CachedDynamicResultSetFactory( ucbhelper::getComponentContext(rSMgr) );
     return css::uno::Reference< css::uno::XInterface >::query( pX );
 }
 
diff --git a/ucb/source/cacher/cacheddynamicresultsetstub.cxx b/ucb/source/cacher/cacheddynamicresultsetstub.cxx
index 3e2affa2270f..01f665c46c8e 100644
--- a/ucb/source/cacher/cacheddynamicresultsetstub.cxx
+++ b/ucb/source/cacher/cacheddynamicresultsetstub.cxx
@@ -192,8 +192,7 @@ XSERVICEINFO_COMMOM_IMPL( CachedDynamicResultSetStubFactory,
 static css::uno::Reference< css::uno::XInterface >
 CachedDynamicResultSetStubFactory_CreateInstance( const css::uno::Reference< css::lang::XMultiServiceFactory> & rSMgr )
 {
-    css::lang::XServiceInfo* pX =
-        static_cast<css::lang::XServiceInfo*>(new CachedDynamicResultSetStubFactory( ucbhelper::getComponentContext(rSMgr) ));
+    css::lang::XServiceInfo* pX = new CachedDynamicResultSetStubFactory( ucbhelper::getComponentContext(rSMgr) );
     return css::uno::Reference< css::uno::XInterface >::query( pX );
 }
 
diff --git a/ucb/source/core/ucb.cxx b/ucb/source/core/ucb.cxx
index 84eb2f61fe24..2986dfe8094d 100644
--- a/ucb/source/core/ucb.cxx
+++ b/ucb/source/core/ucb.cxx
@@ -338,8 +338,7 @@ XSERVICEINFO_COMMOM_IMPL( UniversalContentBroker,
 static css::uno::Reference< css::uno::XInterface >
 UniversalContentBroker_CreateInstance( const css::uno::Reference< css::lang::XMultiServiceFactory> & rSMgr )
 {
-    css::lang::XServiceInfo* pX =
-        static_cast<css::lang::XServiceInfo*>(new UniversalContentBroker( ucbhelper::getComponentContext(rSMgr) ));
+    css::lang::XServiceInfo* pX = new UniversalContentBroker( ucbhelper::getComponentContext(rSMgr) );
     return css::uno::Reference< css::uno::XInterface >::query( pX );
 }
 
diff --git a/ucb/source/ucp/cmis/cmis_provider.cxx b/ucb/source/ucp/cmis/cmis_provider.cxx
index 3584d79d3f12..effed0a78fc9 100644
--- a/ucb/source/ucp/cmis/cmis_provider.cxx
+++ b/ucb/source/ucp/cmis/cmis_provider.cxx
@@ -126,8 +126,7 @@ XSERVICEINFO_COMMOM_IMPL( ContentProvider,
 static css::uno::Reference< css::uno::XInterface >
 ContentProvider_CreateInstance( const css::uno::Reference< css::lang::XMultiServiceFactory> & rSMgr )
 {
-    css::lang::XServiceInfo* pX =
-        static_cast<css::lang::XServiceInfo*>(new ContentProvider( ucbhelper::getComponentContext(rSMgr) ));
+    css::lang::XServiceInfo* pX = new ContentProvider( ucbhelper::getComponentContext(rSMgr) );
     return css::uno::Reference< css::uno::XInterface >::query( pX );
 }
 
diff --git a/ucb/source/ucp/ftp/ftpcontentprovider.cxx b/ucb/source/ucp/ftp/ftpcontentprovider.cxx
index c132ef33c888..76d196cfe8b2 100644
--- a/ucb/source/ucp/ftp/ftpcontentprovider.cxx
+++ b/ucb/source/ucp/ftp/ftpcontentprovider.cxx
@@ -124,8 +124,7 @@ static css::uno::Reference< css::uno::XInterface >
 FTPContentProvider_CreateInstance( const css::uno::Reference<
                                    css::lang::XMultiServiceFactory> & rSMgr )
 {
-    css::lang::XServiceInfo* pX = static_cast<css::lang::XServiceInfo*>(
-        new FTPContentProvider( ucbhelper::getComponentContext(rSMgr) ));
+    css::lang::XServiceInfo* pX = new FTPContentProvider( ucbhelper::getComponentContext(rSMgr) );
     return css::uno::Reference< css::uno::XInterface >::query( pX );
 }
 
diff --git a/ucb/source/ucp/gio/gio_provider.cxx b/ucb/source/ucp/gio/gio_provider.cxx
index a27e0e9ec79f..0587cedfdc80 100644
--- a/ucb/source/ucp/gio/gio_provider.cxx
+++ b/ucb/source/ucp/gio/gio_provider.cxx
@@ -102,8 +102,7 @@ XSERVICEINFO_COMMOM_IMPL( ContentProvider,
 static css::uno::Reference< css::uno::XInterface >
 ContentProvider_CreateInstance( const css::uno::Reference< css::lang::XMultiServiceFactory> & rSMgr )
 {
-    css::lang::XServiceInfo* pX =
-        static_cast<css::lang::XServiceInfo*>(new ContentProvider( ucbhelper::getComponentContext(rSMgr) ));
+    css::lang::XServiceInfo* pX = new ContentProvider( ucbhelper::getComponentContext(rSMgr) );
     return css::uno::Reference< css::uno::XInterface >::query( pX );
 }
 
diff --git a/ucb/source/ucp/hierarchy/hierarchydatasource.cxx b/ucb/source/ucp/hierarchy/hierarchydatasource.cxx
index 2646425394de..a30a8cf26787 100644
--- a/ucb/source/ucp/hierarchy/hierarchydatasource.cxx
+++ b/ucb/source/ucp/hierarchy/hierarchydatasource.cxx
@@ -234,8 +234,7 @@ XSERVICEINFO_COMMOM_IMPL( HierarchyDataSource,
 static css::uno::Reference< css::uno::XInterface >
 HierarchyDataSource_CreateInstance( const css::uno::Reference< css::lang::XMultiServiceFactory> & rSMgr )
 {
-    css::lang::XServiceInfo* pX =
-        static_cast<css::lang::XServiceInfo*>(new HierarchyDataSource( ucbhelper::getComponentContext(rSMgr) ));
+    css::lang::XServiceInfo* pX = new HierarchyDataSource( ucbhelper::getComponentContext(rSMgr) );
     return css::uno::Reference< css::uno::XInterface >::query( pX );
 }
 
diff --git a/ucb/source/ucp/hierarchy/hierarchyprovider.cxx b/ucb/source/ucp/hierarchy/hierarchyprovider.cxx
index 4c288a45ff83..8371072bf75e 100644
--- a/ucb/source/ucp/hierarchy/hierarchyprovider.cxx
+++ b/ucb/source/ucp/hierarchy/hierarchyprovider.cxx
@@ -104,8 +104,7 @@ XSERVICEINFO_COMMOM_IMPL( HierarchyContentProvider,
 static css::uno::Reference< css::uno::XInterface >
 HierarchyContentProvider_CreateInstance( const css::uno::Reference< css::lang::XMultiServiceFactory> & rSMgr )
 {
-    css::lang::XServiceInfo* pX =
-        static_cast<css::lang::XServiceInfo*>(new HierarchyContentProvider( ucbhelper::getComponentContext(rSMgr) ));
+    css::lang::XServiceInfo* pX = new HierarchyContentProvider( ucbhelper::getComponentContext(rSMgr) );
     return css::uno::Reference< css::uno::XInterface >::query( pX );
 }
 
diff --git a/ucb/source/ucp/package/pkgprovider.cxx b/ucb/source/ucp/package/pkgprovider.cxx
index b014c6c01915..0d969812e4bd 100644
--- a/ucb/source/ucp/package/pkgprovider.cxx
+++ b/ucb/source/ucp/package/pkgprovider.cxx
@@ -146,8 +146,7 @@ XSERVICEINFO_COMMOM_IMPL( ContentProvider,
 static css::uno::Reference< css::uno::XInterface >
 ContentProvider_CreateInstance( const css::uno::Reference< css::lang::XMultiServiceFactory> & rSMgr )
 {
-    css::lang::XServiceInfo* pX =
-        static_cast<css::lang::XServiceInfo*>(new ContentProvider( ucbhelper::getComponentContext(rSMgr) ));
+    css::lang::XServiceInfo* pX = new ContentProvider( ucbhelper::getComponentContext(rSMgr) );
     return css::uno::Reference< css::uno::XInterface >::query( pX );
 }
 
diff --git a/ucb/source/ucp/tdoc/tdoc_provider.cxx b/ucb/source/ucp/tdoc/tdoc_provider.cxx
index 006f135b7701..801dbc40daeb 100644
--- a/ucb/source/ucp/tdoc/tdoc_provider.cxx
+++ b/ucb/source/ucp/tdoc/tdoc_provider.cxx
@@ -113,8 +113,7 @@ XSERVICEINFO_COMMOM_IMPL( ContentProvider,
 static css::uno::Reference< css::uno::XInterface >
 ContentProvider_CreateInstance( const css::uno::Reference< css::lang::XMultiServiceFactory> & rSMgr )
 {
-    css::lang::XServiceInfo* pX =
-        static_cast<css::lang::XServiceInfo*>(new ContentProvider( ucbhelper::getComponentContext(rSMgr) ));
+    css::lang::XServiceInfo* pX = new ContentProvider( ucbhelper::getComponentContext(rSMgr) );
     return css::uno::Reference< css::uno::XInterface >::query( pX );
 }
 
diff --git a/ucb/source/ucp/webdav-neon/webdavprovider.cxx b/ucb/source/ucp/webdav-neon/webdavprovider.cxx
index 3b821e61aa9d..2b0bd5bfe92b 100644
--- a/ucb/source/ucp/webdav-neon/webdavprovider.cxx
+++ b/ucb/source/ucp/webdav-neon/webdavprovider.cxx
@@ -102,8 +102,7 @@ XSERVICEINFO_COMMOM_IMPL( ContentProvider,
 static css::uno::Reference< css::uno::XInterface >
 ContentProvider_CreateInstance( const css::uno::Reference< css::lang::XMultiServiceFactory> & rSMgr )
 {
-    css::lang::XServiceInfo* pX =
-        static_cast<css::lang::XServiceInfo*>(new ContentProvider( ucbhelper::getComponentContext(rSMgr) ));
+    css::lang::XServiceInfo* pX = new ContentProvider( ucbhelper::getComponentContext(rSMgr) );
     return css::uno::Reference< css::uno::XInterface >::query( pX );
 }
 
diff --git a/vcl/qt5/Qt5AccessibleEventListener.cxx b/vcl/qt5/Qt5AccessibleEventListener.cxx
index d0733e3d9546..621e541723c8 100644
--- a/vcl/qt5/Qt5AccessibleEventListener.cxx
+++ b/vcl/qt5/Qt5AccessibleEventListener.cxx
@@ -40,8 +40,7 @@ Qt5AccessibleEventListener::Qt5AccessibleEventListener(const Reference<XAccessib
 void Qt5AccessibleEventListener::notifyEvent(
     const css::accessibility::AccessibleEventObject& aEvent)
 {
-    QAccessibleInterface* pQAccessibleInterface
-        = static_cast<QAccessibleInterface*>(m_pAccessibleWidget);
+    QAccessibleInterface* pQAccessibleInterface = m_pAccessibleWidget;
 
     Reference<XAccessible> xChild;
     switch (aEvent.EventId)
diff --git a/vcl/source/window/debugevent.cxx b/vcl/source/window/debugevent.cxx
index 3aa8d062a0f2..767d1e2b8392 100644
--- a/vcl/source/window/debugevent.cxx
+++ b/vcl/source/window/debugevent.cxx
@@ -48,7 +48,7 @@ vcl::Window *DebugEventInjector::ChooseWindow()
         long nIdx = Application::GetTopWindowCount() * getRandom();
         pParent = Application::GetTopWindow( nIdx );
         if (!pParent)
-            pParent = static_cast<vcl::Window *>(Application::GetAppWindow());
+            pParent = Application::GetAppWindow();
     }
     assert (pParent != nullptr);
 
diff --git a/xmlhelp/source/cxxhelp/provider/provider.cxx b/xmlhelp/source/cxxhelp/provider/provider.cxx
index 6c52e0357814..865f4066fbe8 100644
--- a/xmlhelp/source/cxxhelp/provider/provider.cxx
+++ b/xmlhelp/source/cxxhelp/provider/provider.cxx
@@ -132,8 +132,7 @@ static uno::Reference< uno::XInterface >
 ContentProvider_CreateInstance(
          const uno::Reference< lang::XMultiServiceFactory> & rSMgr )
 {
-    lang::XServiceInfo * pX = static_cast< lang::XServiceInfo * >(
-        new ContentProvider( comphelper::getComponentContext(rSMgr) ) );
+    lang::XServiceInfo * pX = new ContentProvider( comphelper::getComponentContext(rSMgr) );
     return uno::Reference< uno::XInterface >::query( pX );
 }
 


More information about the Libreoffice-commits mailing list