[Libreoffice-commits] core.git: 16 commits - compilerplugins/clang sd/source sw/inc sw/Library_sw.mk sw/source

Stephan Bergmann sbergman at redhat.com
Sun Dec 7 06:18:53 PST 2014


 compilerplugins/clang/cstylecast.cxx             |   33 +++++++++++---
 sd/source/ui/inc/slideshow.hxx                   |    1 
 sd/source/ui/slideshow/slideshowimpl.hxx         |    1 
 sw/Library_sw.mk                                 |    1 
 sw/inc/docsh.hxx                                 |    4 +
 sw/inc/ndarr.hxx                                 |    3 -
 sw/inc/node.hxx                                  |    5 ++
 sw/source/core/crsr/findtxt.cxx                  |    5 --
 sw/source/core/crsr/viscrs.cxx                   |    3 -
 sw/source/core/doc/DocumentStatisticsManager.cxx |    3 -
 sw/source/core/inc/frame.hxx                     |   54 ++---------------------
 sw/source/core/inc/frmtool.hxx                   |    2 
 sw/source/core/layout/findfrm.cxx                |   32 +++++++++++++
 sw/source/core/layout/flowfrm.cxx                |    5 +-
 sw/source/core/layout/frmtool.cxx                |    5 ++
 sw/source/core/layout/trvlfrm.cxx                |    9 +++
 sw/source/core/sw3io/swacorr.cxx                 |    2 
 sw/source/core/text/frmform.cxx                  |    7 ++
 sw/source/core/text/itrform2.cxx                 |    3 -
 sw/source/core/text/porfly.cxx                   |    3 -
 sw/source/ui/chrdlg/drpcps.cxx                   |    3 -
 sw/source/ui/frmdlg/wrap.cxx                     |    3 -
 sw/source/uibase/app/docsh2.cxx                  |    5 +-
 sw/source/uibase/inc/view.hxx                    |    5 +-
 sw/source/uibase/uiview/viewsrch.cxx             |    9 ++-
 sw/source/uibase/wrtsh/docsh.cxx                 |   19 ++++++++
 26 files changed, 146 insertions(+), 79 deletions(-)

New commits:
commit afcac82eea2a550c09d0557253167b16a9dac9b1
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Sun Dec 7 15:17:32 2014 +0100

    loplugin:cstylecast: warn about casts involving incomplete types
    
    ...the worst kind of all
    
    Change-Id: I6b98a324735a79ed9060003b491acce733f74f06

diff --git a/compilerplugins/clang/cstylecast.cxx b/compilerplugins/clang/cstylecast.cxx
index 132686f..bce3e0f 100644
--- a/compilerplugins/clang/cstylecast.cxx
+++ b/compilerplugins/clang/cstylecast.cxx
@@ -17,6 +17,13 @@
 
 namespace {
 
+QualType resolvePointers(QualType type) {
+    while (type->isPointerType()) {
+        type = type->getAs<PointerType>()->getPointeeType();
+    }
+    return type;
+}
+
 class CStyleCast:
     public RecursiveASTVisitor<CStyleCast>, public loplugin::Plugin
 {
@@ -58,9 +65,25 @@ bool CStyleCast::VisitCStyleCastExpr(const CStyleCastExpr * expr) {
     if( expr->getCastKind() == CK_NoOp ) {
         return true;
     }
-    // ignore pointer-type conversions for now
+    std::string incompFrom;
+    std::string incompTo;
     if( expr->getCastKind() == CK_BitCast ) {
-        return true;
+        QualType t1 = resolvePointers(expr->getSubExprAsWritten()->getType());
+        QualType t2 = resolvePointers(expr->getType());
+        // Ignore "safe" casts for now that do not involve incomplete types (and
+        // can thus not be interpreted as either a static_cast or a
+        // reinterpret_cast, with potentially different results):
+        if (t1->isVoidType() || t2->isVoidType()
+            || !(t1->isIncompleteType() || t2->isIncompleteType()))
+        {
+            return true;
+        }
+        if (t1->isIncompleteType()) {
+            incompFrom = "incomplete ";
+        }
+        if (t2->isIncompleteType()) {
+            incompTo = "incomplete ";
+        }
     }
     // ignore stuff from inside templates for now
     if( expr->getCastKind() == CK_Dependent ) {
@@ -86,11 +109,11 @@ bool CStyleCast::VisitCStyleCastExpr(const CStyleCastExpr * expr) {
     }
     report(
         DiagnosticsEngine::Warning,
-        "c-style cast, type=%0, from=%1, to=%2, recommendedFix=%3",
+        "c-style cast, type=%0, from=%1%2, to=%3%4, recommendedFix=%5",
         expr->getSourceRange().getBegin())
       << expr->getCastKind()
-      << expr->getSubExprAsWritten()->getType()
-      << expr->getType()
+      << incompFrom << expr->getSubExprAsWritten()->getType()
+      << incompTo << expr->getType()
       << recommendedFix(expr->getCastKind())
       << expr->getSourceRange();
     return true;
commit 7e174e7e76ec942870b9b8366306edb6dcdb8b2b
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Sun Dec 7 13:32:39 2014 +0100

    loplugin:cstylecast, involving pointer to incomplete type
    
    Change-Id: Ida681fd1c36219c1ccbdb4bb54196cf737c88b4b

diff --git a/sw/source/ui/frmdlg/wrap.cxx b/sw/source/ui/frmdlg/wrap.cxx
index cee2b50..d5d84c6 100644
--- a/sw/source/ui/frmdlg/wrap.cxx
+++ b/sw/source/ui/frmdlg/wrap.cxx
@@ -31,6 +31,7 @@
 #include <svx/swframevalidation.hxx>
 
 #include "cmdid.h"
+#include <docsh.hxx>
 #include "uitool.hxx"
 #include "wrtsh.hxx"
 #include "swmodule.hxx"
@@ -169,7 +170,7 @@ void SwWrapTabPage::Reset(const SfxItemSet *rSet)
         }
     }
 
-    nHtmlMode = ::GetHtmlMode((const SwDocShell*)SfxObjectShell::Current());
+    nHtmlMode = ::GetHtmlMode(static_cast<const SwDocShell*>(SfxObjectShell::Current()));
     bHtmlMode = (nHtmlMode & HTMLMODE_ON) != 0;
 
     FieldUnit aMetric = ::GetDfltMetric(bHtmlMode);
commit b06095804fe48f858d956400dcfaa08ffc2ae6ec
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Sun Dec 7 12:16:56 2014 +0100

    loplugin:cstylecast, involving pointer to incomplete type
    
    Change-Id: Ie681e2a6408286e0b2f49d68f6cf8fa37c145318

diff --git a/sw/source/ui/chrdlg/drpcps.cxx b/sw/source/ui/chrdlg/drpcps.cxx
index a27d739..fd9c893 100644
--- a/sw/source/ui/chrdlg/drpcps.cxx
+++ b/sw/source/ui/chrdlg/drpcps.cxx
@@ -20,6 +20,7 @@
 #include <hintids.hxx>
 
 #include "cmdid.h"
+#include <docsh.hxx>
 #include "swmodule.hxx"
 #include "view.hxx"
 #include "wrtsh.hxx"
@@ -538,7 +539,7 @@ SwDropCapsPage::SwDropCapsPage(vcl::Window *pParent, const SfxItemSet &rSet)
 
     SetExchangeSupport();
 
-    const sal_uInt16 nHtmlMode = ::GetHtmlMode((const SwDocShell*)SfxObjectShell::Current());
+    const sal_uInt16 nHtmlMode = ::GetHtmlMode(static_cast<const SwDocShell*>(SfxObjectShell::Current()));
     bHtmlMode = (nHtmlMode & HTMLMODE_ON) != 0;
 
     // In the template dialog the text is not influenceable
commit 46593a05b28f93831da925aa7092b72be2209685
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Sun Dec 7 12:13:45 2014 +0100

    loplugin:cstylecast, involving pointer to incomplete type
    
    Change-Id: I406d56236d9e87103009703b677bee40398ed1a2

diff --git a/sw/inc/ndarr.hxx b/sw/inc/ndarr.hxx
index 5ed0970..e60b9ee 100644
--- a/sw/inc/ndarr.hxx
+++ b/sw/inc/ndarr.hxx
@@ -140,8 +140,7 @@ public:
     typedef ::std::vector<SwNodeRange> NodeRanges_t;
     typedef ::std::vector<NodeRanges_t> TableRanges_t;
 
-    SwNodePtr operator[]( sal_uLong n ) const
-        { return (SwNodePtr)BigPtrArray::operator[] ( n ); }
+    SwNodePtr operator[]( sal_uLong n ) const; // defined in node.hxx
 
     sal_uLong Count() const { return BigPtrArray::Count(); }
     void ForEach( FnForEach_SwNodes fnForEach, void* pArgs = 0 )
diff --git a/sw/inc/node.hxx b/sw/inc/node.hxx
index a8c7f29..2b22819 100644
--- a/sw/inc/node.hxx
+++ b/sw/inc/node.hxx
@@ -743,6 +743,11 @@ inline SwDummySectionNode::SwDummySectionNode( const SwNodeIndex &rWhere )
 {
 }
 
+inline SwNodePtr SwNodes::operator[]( sal_uLong n ) const
+{
+    return static_cast<SwNodePtr>(BigPtrArray::operator[] ( n ));
+}
+
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit fab3b88699363f9be163e77298a4c8217a9b93b2
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Sat Dec 6 11:47:19 2014 +0100

    Unused forward decl
    
    Change-Id: I7b1ef761695579cd157168b3b9d338606abf018d

diff --git a/sd/source/ui/inc/slideshow.hxx b/sd/source/ui/inc/slideshow.hxx
index 2a35f13..418da14 100644
--- a/sd/source/ui/inc/slideshow.hxx
+++ b/sd/source/ui/inc/slideshow.hxx
@@ -63,7 +63,6 @@ namespace sd
 {
 
 class SlideshowImpl;
-class ShowWindow;
 class Window;
 class View;
 class ViewShell;
diff --git a/sd/source/ui/slideshow/slideshowimpl.hxx b/sd/source/ui/slideshow/slideshowimpl.hxx
index cab6d84..317e075 100644
--- a/sd/source/ui/slideshow/slideshowimpl.hxx
+++ b/sd/source/ui/slideshow/slideshowimpl.hxx
@@ -80,6 +80,7 @@
 
 class SfxViewFrame;
 class SfxRequest;
+class ShowWindow;
 
 namespace sd
 {
commit 2aa9db44759ca5317d455d2f50e1cb1f53e01624
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Sat Dec 6 00:38:05 2014 +0100

    loplugin:cstylecast, involving pointer to incomplete type
    
    Change-Id: Idab944f3b9a93258b7f58a33e8a2a2c69448c7d8

diff --git a/sw/Library_sw.mk b/sw/Library_sw.mk
index c475315..1b16def 100644
--- a/sw/Library_sw.mk
+++ b/sw/Library_sw.mk
@@ -747,6 +747,7 @@ $(eval $(call gb_Library_add_exception_objects,sw,\
     sw/source/uibase/web/wtextsh \
     sw/source/uibase/web/wview \
     sw/source/uibase/wrtsh/delete \
+    sw/source/uibase/wrtsh/docsh \
     sw/source/uibase/wrtsh/move \
     sw/source/uibase/wrtsh/navmgr \
     sw/source/uibase/wrtsh/select \
diff --git a/sw/inc/docsh.hxx b/sw/inc/docsh.hxx
index 53a801c2..3b3e0be 100644
--- a/sw/inc/docsh.hxx
+++ b/sw/inc/docsh.hxx
@@ -36,6 +36,7 @@ class SfxDocumentInfoDialog;
 class SfxStyleSheetBasePool;
 class SfxInPlaceClient;
 class FontList;
+class SwEditShell;
 class SwView;
 class SwWrtShell;
 class SwFEShell;
@@ -218,6 +219,9 @@ public:
     /// Accress to the SwWrtShell belonging to SwView.
           SwWrtShell *GetWrtShell()       { return mpWrtShell; }
     const SwWrtShell *GetWrtShell() const { return mpWrtShell; }
+    // Same as GetWrtShell, but return pointer to SwEditShell base of
+    // (potentially incomplete) SwWrtShell:
+    SwEditShell * GetEditShell();
 
     /// For Core - it knows the DocShell but not the WrtShell!
           SwFEShell *GetFEShell();
diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx
index ea5c6ad..364ee6d 100644
--- a/sw/source/core/crsr/findtxt.cxx
+++ b/sw/source/core/crsr/findtxt.cxx
@@ -23,6 +23,7 @@
 #include <vcl/svapp.hxx>
 #include <vcl/window.hxx>
 
+#include <editsh.hxx>
 #include <txatritr.hxx>
 #include <fldbas.hxx>
 #include <fmtfld.hxx>
@@ -44,8 +45,6 @@
 using namespace ::com::sun::star;
 using namespace util;
 
-OUString *ReplaceBackReferences( const SearchOptions& rSearchOpt, SwPaM* pPam );
-
 static OUString
 lcl_CleanStr(const SwTxtNode& rNd, sal_Int32 const nStart, sal_Int32& rEnd,
              std::vector<sal_Int32> &rArr, bool const bRemoveSoftHyphen)
@@ -289,7 +288,7 @@ bool SwPaM::Find( const SearchOptions& rSearchOpt, bool bSearchInNotes , utl::Te
             }
 
             SwDocShell *const pDocShell = pNode->GetDoc()->GetDocShell();
-            SwViewShell *const pWrtShell = (pDocShell) ? (SwViewShell*)(pDocShell->GetWrtShell()) : 0;
+            SwViewShell *const pWrtShell = (pDocShell) ? pDocShell->GetEditShell() : 0;
             SwPostItMgr *const pPostItMgr = (pWrtShell) ? pWrtShell->GetPostItMgr() : 0;
 
             sal_Int32 aStart = 0;
diff --git a/sw/source/core/doc/DocumentStatisticsManager.cxx b/sw/source/core/doc/DocumentStatisticsManager.cxx
index 5017630..3f6ccb4 100644
--- a/sw/source/core/doc/DocumentStatisticsManager.cxx
+++ b/sw/source/core/doc/DocumentStatisticsManager.cxx
@@ -18,6 +18,7 @@
  */
 #include <DocumentStatisticsManager.hxx>
 #include <doc.hxx>
+#include <editsh.hxx>
 #include <fldbas.hxx>
 #include <docsh.hxx>
 #include <IDocumentFieldsAccess.hxx>
@@ -208,7 +209,7 @@ bool DocumentStatisticsManager::IncrementalDocStatCalculate(long nChars, bool bF
         const ModifyBlocker_Impl b(pObjShell);
         // rhbz#1081176: don't jump to cursor pos because of (temporary)
         // activation of modified flag triggering move to input position
-        LockAllViews aViewGuard((SwViewShell*)pObjShell->GetWrtShell());
+        LockAllViews aViewGuard(pObjShell->GetEditShell());
         xDocProps->setDocumentStatistics(aStat);
         if (!bDocWasModified)
         {
diff --git a/sw/source/core/sw3io/swacorr.cxx b/sw/source/core/sw3io/swacorr.cxx
index b08866f..37315e3 100644
--- a/sw/source/core/sw3io/swacorr.cxx
+++ b/sw/source/core/sw3io/swacorr.cxx
@@ -83,7 +83,7 @@ bool SwAutoCorrect::PutText( const uno::Reference < embed::XStorage >&  rStg,
     nRet = aBlk.BeginPutDoc( rShort, rShort );
     if( !IsError( nRet ) )
     {
-        ((SwEditShell*)rDShell.GetWrtShell())->_CopySelToDoc( pDoc );
+        rDShell.GetEditShell()->_CopySelToDoc( pDoc );
         nRet = aBlk.PutDoc();
         aBlk.AddName ( rShort, rShort, false );
         if( !IsError( nRet ) )
diff --git a/sw/source/uibase/wrtsh/docsh.cxx b/sw/source/uibase/wrtsh/docsh.cxx
new file mode 100644
index 0000000..904efeb
--- /dev/null
+++ b/sw/source/uibase/wrtsh/docsh.cxx
@@ -0,0 +1,19 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <sal/config.h>
+
+#include <docsh.hxx>
+#include <wrtsh.hxx>
+
+SwEditShell * SwDocShell::GetEditShell() {
+    return mpWrtShell;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 823c76994204e43736252ee4f05f9c7c590ff347
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Sat Dec 6 00:04:24 2014 +0100

    loplugin:cstylecast, involving pointer to incomplete type
    
    Change-Id: Ifd28fffddd6abf14ea884f28679ba01b0aa8c8eb

diff --git a/sw/source/uibase/uiview/viewsrch.cxx b/sw/source/uibase/uiview/viewsrch.cxx
index effb2be..c3291935 100644
--- a/sw/source/uibase/uiview/viewsrch.cxx
+++ b/sw/source/uibase/uiview/viewsrch.cxx
@@ -45,6 +45,7 @@
 #include <vcl/msgbox.hxx>
 #include <vcl/wrkwin.hxx>
 #include <editeng/unolingu.hxx>
+#include <edtwin.hxx>
 #include <swmodule.hxx>
 #include <swwait.hxx>
 #include <workctrl.hxx>
@@ -198,7 +199,7 @@ void SwView::ExecSearch(SfxRequest& rReq, bool bNoMessage)
                     if ( pDlgWrp )
                     {
                         m_pSrchDlg = static_cast<SvxSearchDialog*>(pDlgWrp->GetWindow());
-                        m_pSrchDlg->SetDocWin( (vcl::Window*)m_pEditWin);
+                        m_pSrchDlg->SetDocWin(m_pEditWin);
                         m_pSrchDlg->SetSrchFlag();
                     }
                 }
@@ -225,7 +226,7 @@ void SwView::ExecSearch(SfxRequest& rReq, bool bNoMessage)
                     if ( pDlgWrp )
                     {
                         m_pSrchDlg = static_cast<SvxSearchDialog*>(pDlgWrp->GetWindow());
-                        m_pSrchDlg->SetDocWin( (vcl::Window*)m_pEditWin);
+                        m_pSrchDlg->SetDocWin(m_pEditWin);
                         m_pSrchDlg->SetSrchFlag();
                     }
                 }
@@ -286,7 +287,7 @@ void SwView::ExecSearch(SfxRequest& rReq, bool bNoMessage)
                     if ( pDlgWrp )
                     {
                         m_pSrchDlg = static_cast<SvxSearchDialog*>(pDlgWrp->GetWindow());
-                        m_pSrchDlg->SetDocWin( (vcl::Window*)m_pEditWin);
+                        m_pSrchDlg->SetDocWin(m_pEditWin);
                         m_pSrchDlg->SetSrchFlag();
                     }
                 }
@@ -355,7 +356,7 @@ void SwView::ExecSearch(SfxRequest& rReq, bool bNoMessage)
                 if ( pDlgWrp )
                 {
                     m_pSrchDlg = static_cast<SvxSearchDialog*>(pDlgWrp->GetWindow());
-                    m_pSrchDlg->SetDocWin( (vcl::Window*)m_pEditWin);
+                    m_pSrchDlg->SetDocWin(m_pEditWin);
                     m_pSrchDlg->SetSrchFlag();
                 }
 #endif
commit c10f93bdb8ebd21ecd1b5e06785a5b606575e927
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Sat Dec 6 00:00:02 2014 +0100

    loplugin:cstylecast, involving pointer to incomplete type
    
    Change-Id: Iffba3808e2a46270ae13d0a3dce6d0453e096f07

diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx
index 6246434..9bb10f1 100644
--- a/sw/source/uibase/app/docsh2.cxx
+++ b/sw/source/uibase/app/docsh2.cxx
@@ -25,6 +25,7 @@
 
 #include <comphelper/processfactory.hxx>
 
+#include <edtwin.hxx>
 #include <hintids.hxx>
 #include <tools/urlobj.hxx>
 #include <unotools/tempfile.hxx>
@@ -814,7 +815,7 @@ void SwDocShell::Execute(SfxRequest& rReq)
                         pClipCntnr->CopyAnyData( FORMAT_RTF, (sal_Char*)
                                     pStrm->GetData(), pStrm->GetEndOfData() );
                         pClipCntnr->CopyToClipboard(
-                            GetView()? (vcl::Window*)&GetView()->GetEditWin() : 0 );
+                            GetView()? &GetView()->GetEditWin() : 0 );
                         delete pStrm;
                     }
                 }
@@ -1482,7 +1483,7 @@ SfxInPlaceClient* SwDocShell::GetIPClient( const ::svt::EmbeddedObjectRef& xObjR
     SwWrtShell* pShell = GetWrtShell();
     if ( pShell )
     {
-        pResult = pShell->GetView().FindIPClient( xObjRef.GetObject(), (vcl::Window*)&pShell->GetView().GetEditWin() );
+        pResult = pShell->GetView().FindIPClient( xObjRef.GetObject(), &pShell->GetView().GetEditWin() );
         if ( !pResult )
             pResult = new SwOleClient( &pShell->GetView(), &pShell->GetView().GetEditWin(), xObjRef );
     }
commit 6a2affb8659c0b96a35b99d51dc7415e2ed63511
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Dec 5 23:54:46 2014 +0100

    loplugin:cstylecast, involving pointer to incomplete type
    
    Change-Id: I2d4349644bf335b27a1945705f0379aefc5bb869

diff --git a/sw/source/core/text/porfly.cxx b/sw/source/core/text/porfly.cxx
index 634baa83..2fbb5069b 100644
--- a/sw/source/core/text/porfly.cxx
+++ b/sw/source/core/text/porfly.cxx
@@ -20,6 +20,7 @@
 #include "dcontact.hxx"
 #include "dflyobj.hxx"
 #include "pam.hxx"
+#include <portab.hxx>
 #include "flyfrm.hxx"
 #include "rootfrm.hxx"
 #include "frmfmt.hxx"
@@ -52,7 +53,7 @@ bool SwFlyPortion::Format( SwTxtFormatInfo &rInf )
     OSL_ENSURE( Fix() >= rInf.X(), "SwFlyPortion::Format" );
     // tabs must be expanded (Bug 8537)
     if( rInf.GetLastTab() )
-        ((SwLinePortion*)rInf.GetLastTab())->FormatEOL( rInf );
+        rInf.GetLastTab()->FormatEOL( rInf );
 
     rInf.GetLast()->FormatEOL( rInf );
     PrtWidth( static_cast<sal_uInt16>(Fix() - rInf.X() + PrtWidth()) );
commit 3278a635f8555ea1530eaca47e0cd5c864e1afcb
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Dec 5 23:52:35 2014 +0100

    loplugin:cstylecast, involving pointer to incomplete type
    
    Change-Id: I5372bd5f06f19db76a47e68c675c8fcb407eb8c9

diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx
index fca53ab..3b5d6bc 100644
--- a/sw/source/core/text/itrform2.cxx
+++ b/sw/source/core/text/itrform2.cxx
@@ -22,6 +22,7 @@
 #include <boost/scoped_ptr.hpp>
 #include <com/sun/star/i18n/ScriptType.hpp>
 #include <editeng/lspcitem.hxx>
+#include <dcontact.hxx>
 #include <txtflcnt.hxx>
 #include <txtftn.hxx>
 #include <flyfrms.hxx>
@@ -2567,7 +2568,7 @@ SwFlyCntPortion *SwTxtFormatter::NewFlyCntPortion( SwTxtFormatInfo &rInf,
     }
     else
     {
-        pRet = new SwFlyCntPortion( *rInf.GetTxtFrm(), (SwDrawContact*)pFrmFmt->FindContactObj(),
+        pRet = new SwFlyCntPortion( *rInf.GetTxtFrm(), static_cast<SwDrawContact*>(pFrmFmt->FindContactObj()),
            aTmpBase, nTmpAscent, nTmpDescent, nFlyAsc, nFlyDesc, nMode );
     }
     return pRet;
commit 918f7407569e4a4c5d1d08198951f70e2b6df642
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Dec 5 23:49:47 2014 +0100

    loplugin:cstylecast, involving pointer to incomplete type
    
    Change-Id: I557a5d25e65244f06a855cd670c85094fd5ed3c0

diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx
index 2edea7c..da6d622 100644
--- a/sw/source/core/text/frmform.cxx
+++ b/sw/source/core/text/frmform.cxx
@@ -17,6 +17,9 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <sal/config.h>
+
+#include <bodyfrm.hxx>
 #include <hintids.hxx>
 #include <editeng/keepitem.hxx>
 #include <editeng/hyphenzoneitem.hxx>
@@ -176,7 +179,7 @@ const SwBodyFrm *SwTxtFrm::FindBodyFrm() const
         const SwFrm *pFrm = GetUpper();
         while( pFrm && !pFrm->IsBodyFrm() )
             pFrm = pFrm->GetUpper();
-        return (const SwBodyFrm*)pFrm;
+        return static_cast<const SwBodyFrm*>(pFrm);
     }
     return 0;
 }
@@ -997,7 +1000,7 @@ void SwTxtFrm::FormatAdjust( SwTxtFormatter &rLine,
         SplitFrm( nEnd );
     }
 
-    const SwFrm *pBodyFrm = (const SwFrm*)(FindBodyFrm());
+    const SwFrm *pBodyFrm = FindBodyFrm();
 
     const long nBodyHeight = pBodyFrm ? ( IsVertical() ?
                                           pBodyFrm->Frm().Width() :
commit 6fe664f24bf086520248b8fd606b6696c63ed3f4
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Dec 5 23:34:28 2014 +0100

    loplugin:cstylecast, involving pointer to incomplete type
    
    Change-Id: Ic42daa13650bf880ce69c7e8a95c12d6cfa476da

diff --git a/sw/source/core/layout/flowfrm.cxx b/sw/source/core/layout/flowfrm.cxx
index 2b538cd..893875f 100644
--- a/sw/source/core/layout/flowfrm.cxx
+++ b/sw/source/core/layout/flowfrm.cxx
@@ -17,6 +17,9 @@
  *   the License at http://www.apache.org/licenses/LICENSE-2.0 .
  */
 
+#include <sal/config.h>
+
+#include <bodyfrm.hxx>
 #include "swtable.hxx"
 #include "rootfrm.hxx"
 #include "pagefrm.hxx"
@@ -1881,7 +1884,7 @@ bool SwFlowFrm::MoveFwd( bool bMakePage, bool bPageBreak, bool bMoveAlways )
             OSL_ENSURE( pStart || ( m_rThis.IsTabFrm() && !static_cast<SwTabFrm&>(m_rThis).Lower() ),
                     "MoveFwd: Missing Content" );
             SwLayoutFrm* pBody = pStart ? ( pStart->IsTxtFrm() ?
-                (SwLayoutFrm*)static_cast<SwTxtFrm*>(pStart)->FindBodyFrm() : 0 ) : 0;
+                const_cast<SwBodyFrm *>(static_cast<SwTxtFrm*>(pStart)->FindBodyFrm()) : 0 ) : 0;
             if( pBody )
                 bFtnMoved = pBody->MoveLowerFtns( pStart, pOldBoss, pNewBoss,
                                                   false);
commit c60dd5d6870c30b239b4ba5ff3100b07a38d0502
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Dec 5 23:01:06 2014 +0100

    loplugin:cstylecast, involving pointer to incomplete type
    
    Change-Id: I74769c0d8db208d2a8ee5bdca62f31c08d79d6dd

diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx
index 3bc4b7c..bf8da34 100644
--- a/sw/source/core/crsr/viscrs.cxx
+++ b/sw/source/core/crsr/viscrs.cxx
@@ -45,6 +45,7 @@
 
 #include <svx/sdr/overlay/overlaymanager.hxx>
 #include <svx/sdrpaintwindow.hxx>
+#include <svx/srchdlg.hxx>
 #include <vcl/svapp.hxx>
 #include <svx/sdr/overlay/overlayselection.hxx>
 #include <overlayrangesoutline.hxx>
@@ -574,7 +575,7 @@ SwCursor* SwShellCrsr::Create( SwPaM* pRing ) const
 short SwShellCrsr::MaxReplaceArived()
 {
     short nRet = RET_YES;
-    vcl::Window* pDlg = (vcl::Window*) SwView::GetSearchDialog();
+    vcl::Window* pDlg = SwView::GetSearchDialog();
     if( pDlg )
     {
         // Terminate old actions. The table-frames get constructed and
commit 312653feaccbedb84c4e7d36a30aabc3d8eaaa28
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Dec 5 22:54:13 2014 +0100

    loplugin:cstylecast, involving pointer to incomplete type
    
    Change-Id: I125a820a8b94d6e3233b594c7db7aabe7bfd04da

diff --git a/sw/source/uibase/inc/view.hxx b/sw/source/uibase/inc/view.hxx
index cc29486..64b8dc9 100644
--- a/sw/source/uibase/inc/view.hxx
+++ b/sw/source/uibase/inc/view.hxx
@@ -28,6 +28,7 @@
 #include <sfx2/objsh.hxx>
 #include <editeng/svxenum.hxx>
 #include <sfx2/zoomitem.hxx>
+#include <svx/ruler.hxx>
 #include <svx/svxids.hrc>
 #include <svx/fmshell.hxx>
 #include <editeng/editstat.hxx>
@@ -510,11 +511,11 @@ public:
     int             CreateTab();
     int             KillTab();
 
-    bool            StatVRuler() const { return ((vcl::Window*)m_pVRuler)->IsVisible(); }
+    bool            StatVRuler() const { return m_pVRuler->IsVisible(); }
     void            ChangeVRulerMetric(FieldUnit eUnit);
     void            GetVRulerMetric(FieldUnit& rToFill) const;
 
-    bool            StatTab() const { return ((vcl::Window*)m_pHRuler)->IsVisible(); }
+    bool            StatTab() const { return m_pHRuler->IsVisible(); }
     SvxRuler&       GetHRuler()    { return *m_pHRuler; }
     SvxRuler&       GetVRuler()    { return *m_pVRuler; }
     void            InvalidateRulerPos();
commit 5c3f46cc298d0e8dd24fa9d482110f898cc19201
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Dec 5 22:27:17 2014 +0100

    loplugin:cstylecast, involving pointer to incomplete type
    
    Change-Id: I2c97ddaac8e2f9a69816b6b0caf6b48a79cdd07e

diff --git a/sw/source/core/inc/frame.hxx b/sw/source/core/inc/frame.hxx
index 472568b..95f99c4 100644
--- a/sw/source/core/inc/frame.hxx
+++ b/sw/source/core/inc/frame.hxx
@@ -629,7 +629,7 @@ public:
     inline SwSectionFrm *FindSctFrm();
     inline SwFrm        *FindNext();
     // #i27138# - add parameter <_bInSameFtn>
-    inline SwCntntFrm* FindNextCnt( const bool _bInSameFtn = false );
+    SwCntntFrm* FindNextCnt( const bool _bInSameFtn = false );
     inline SwFrm        *FindPrev();
     inline const SwPageFrm *FindPageFrm() const;
     inline const SwFtnBossFrm *FindFtnBossFrm( bool bFtn = false ) const;
@@ -641,31 +641,13 @@ public:
     inline const SwSectionFrm *FindSctFrm() const;
     inline const SwFrm     *FindNext() const;
     // #i27138# - add parameter <_bInSameFtn>
-    inline const SwCntntFrm* FindNextCnt( const bool _bInSameFtn = false ) const;
+    const SwCntntFrm* FindNextCnt( const bool _bInSameFtn = false ) const;
     inline const SwFrm     *FindPrev() const;
            const SwFrm     *GetLower()  const;
 
-    /** inline wrapper method for <_FindPrevCnt(..)>
-        #i27138#
-    */
-    inline SwCntntFrm* FindPrevCnt( const bool _bInSameFtn = false )
-    {
-        if ( GetPrev() && GetPrev()->IsCntntFrm() )
-            return (SwCntntFrm*)(GetPrev());
-        else
-            return _FindPrevCnt( _bInSameFtn );
-    }
+    SwCntntFrm* FindPrevCnt( const bool _bInSameFtn = false );
 
-    /** inline const wrapper method for <_FindPrevCnt(..)>
-        #i27138#
-    */
-    inline const SwCntntFrm* FindPrevCnt( const bool _bInSameFtn = false ) const
-    {
-        if ( GetPrev() && GetPrev()->IsCntntFrm() )
-            return (const SwCntntFrm*)(GetPrev());
-        else
-            return const_cast<SwFrm*>(this)->_FindPrevCnt( _bInSameFtn );
-    }
+    const SwCntntFrm* FindPrevCnt( const bool _bInSameFtn = false ) const;
 
     // #i79774#
     SwFrm* _GetIndPrev() const;
@@ -691,7 +673,7 @@ public:
     inline void OptCalc() const;    // here we assume (for optimization) that
                                     // the predecessors are already formatted
 
-    inline Point   GetRelPos() const;
+    Point   GetRelPos() const;
     const  SwRect &Frm() const { return maFrm; }
     const  SwRect &Prt() const { return maPrt; }
 
@@ -1038,16 +1020,6 @@ inline void SwFrm::OptCalc() const
     if ( !mbValidPos || !mbValidPrtArea || !mbValidSize )
         const_cast<SwFrm*>(this)->OptPrepareMake();
 }
-
-inline Point SwFrm::GetRelPos() const
-{
-    Point aRet( maFrm.Pos() );
-    // here we cast since SwLayoutFrm is declared only as forwarded
-    aRet -= ((SwFrm*)GetUpper())->Prt().Pos();
-    aRet -= ((SwFrm*)GetUpper())->Frm().Pos();
-    return aRet;
-}
-
 inline const SwPageFrm *SwFrm::FindPageFrm() const
 {
     return const_cast<SwFrm*>(this)->FindPageFrm();
@@ -1111,22 +1083,6 @@ inline const SwFrm *SwFrm::FindNext() const
     else
         return const_cast<SwFrm*>(this)->_FindNext();
 }
-// #i27138# - add parameter <_bInSameFtn>
-inline SwCntntFrm *SwFrm::FindNextCnt( const bool _bInSameFtn )
-{
-    if ( mpNext && mpNext->IsCntntFrm() )
-        return (SwCntntFrm*)mpNext;
-    else
-        return _FindNextCnt( _bInSameFtn );
-}
-// #i27138# - add parameter <_bInSameFtn>
-inline const SwCntntFrm *SwFrm::FindNextCnt( const bool _bInSameFtn ) const
-{
-    if ( mpNext && mpNext->IsCntntFrm() )
-        return (SwCntntFrm*)mpNext;
-    else
-        return const_cast<SwFrm*>(this)->_FindNextCnt( _bInSameFtn );
-}
 inline SwFrm *SwFrm::FindPrev()
 {
     if ( mpPrev && !mpPrev->IsSctFrm() )
diff --git a/sw/source/core/layout/findfrm.cxx b/sw/source/core/layout/findfrm.cxx
index 7e4b823..cdc8baf 100644
--- a/sw/source/core/layout/findfrm.cxx
+++ b/sw/source/core/layout/findfrm.cxx
@@ -166,6 +166,38 @@ SwFrm* SwFrm::GetLower()
     return IsLayoutFrm() ? static_cast<SwLayoutFrm*>(this)->Lower() : 0;
 }
 
+SwCntntFrm* SwFrm::FindPrevCnt( const bool _bInSameFtn )
+{
+    if ( GetPrev() && GetPrev()->IsCntntFrm() )
+        return static_cast<SwCntntFrm*>(GetPrev());
+    else
+        return _FindPrevCnt( _bInSameFtn );
+}
+
+const SwCntntFrm* SwFrm::FindPrevCnt( const bool _bInSameFtn ) const
+{
+    if ( GetPrev() && GetPrev()->IsCntntFrm() )
+        return static_cast<const SwCntntFrm*>(GetPrev());
+    else
+        return const_cast<SwFrm*>(this)->_FindPrevCnt( _bInSameFtn );
+}
+
+SwCntntFrm *SwFrm::FindNextCnt( const bool _bInSameFtn )
+{
+    if ( mpNext && mpNext->IsCntntFrm() )
+        return static_cast<SwCntntFrm*>(mpNext);
+    else
+        return _FindNextCnt( _bInSameFtn );
+}
+
+const SwCntntFrm *SwFrm::FindNextCnt( const bool _bInSameFtn ) const
+{
+    if ( mpNext && mpNext->IsCntntFrm() )
+        return static_cast<SwCntntFrm*>(mpNext);
+    else
+        return const_cast<SwFrm*>(this)->_FindNextCnt( _bInSameFtn );
+}
+
 bool SwLayoutFrm::IsAnLower( const SwFrm *pAssumed ) const
 {
     const SwFrm *pUp = pAssumed;
diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx
index 7633b2d..b589558 100644
--- a/sw/source/core/layout/trvlfrm.cxx
+++ b/sw/source/core/layout/trvlfrm.cxx
@@ -1786,6 +1786,15 @@ bool SwFrm::OnFirstPage() const
     return bRet;
 }
 
+Point SwFrm::GetRelPos() const
+{
+    Point aRet( maFrm.Pos() );
+    // here we cast since SwLayoutFrm is declared only as forwarded
+    aRet -= GetUpper()->Prt().Pos();
+    aRet -= GetUpper()->Frm().Pos();
+    return aRet;
+}
+
 /** @return the virtual page number with the offset. */
 sal_uInt16 SwFrm::GetVirtPageNum() const
 {
commit 674e4b0c73dbef81d966e9193ec4b84df2d843b6
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Dec 5 22:25:49 2014 +0100

    loplugin:cstylecast, involving pointer to incomplete type
    
    Change-Id: I0a6dd674a9c8358c09e86db27567acede0b95b6d

diff --git a/sw/source/core/inc/frmtool.hxx b/sw/source/core/inc/frmtool.hxx
index 4db4225..8f8771b 100644
--- a/sw/source/core/inc/frmtool.hxx
+++ b/sw/source/core/inc/frmtool.hxx
@@ -235,7 +235,7 @@ private:
     bool        mbInvalidatePrevPrtArea;
     bool        mbBordersJoinedWithPrev;
 
-    SwCntntFrm *GetCnt() { return (SwCntntFrm*)pFrm; }
+    SwCntntFrm *GetCnt();
 
 public:
     SwCntntNotify( SwCntntFrm *pCntFrm );
diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx
index 30875f2..6173a03 100644
--- a/sw/source/core/layout/frmtool.cxx
+++ b/sw/source/core/layout/frmtool.cxx
@@ -737,6 +737,11 @@ SwFlyNotify::~SwFlyNotify()
     }
 }
 
+SwCntntFrm *SwCntntNotify::GetCnt()
+{
+    return static_cast<SwCntntFrm*>(pFrm);
+}
+
 SwCntntNotify::SwCntntNotify( SwCntntFrm *pCntntFrm ) :
     SwFrmNotify( pCntntFrm ),
     // OD 08.01.2004 #i11859#


More information about the Libreoffice-commits mailing list