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

Noel Grandin noel at peralex.com
Wed Nov 12 02:57:38 PST 2014


 sw/inc/doc.hxx                   |    3 +
 sw/inc/edimp.hxx                 |    2 -
 sw/inc/fmtcnct.hxx               |    6 +--
 sw/inc/fmthdft.hxx               |   12 +++---
 sw/inc/ndgrf.hxx                 |    4 +-
 sw/inc/paratr.hxx                |   56 ++++++++++++++++++-------------
 sw/inc/unochart.hxx              |    5 +-
 sw/source/core/crsr/trvlcol.cxx  |    4 +-
 sw/source/core/crsr/trvlfnfl.cxx |    2 -
 sw/source/core/crsr/trvltbl.cxx  |   14 +++----
 sw/source/core/crsr/viscrs.cxx   |    8 ++--
 sw/source/core/doc/acmplwrd.cxx  |    6 +--
 sw/source/core/doc/dbgoutsw.cxx  |    2 -
 sw/source/core/doc/doc.cxx       |   43 ++++++++++++-----------
 sw/source/core/doc/doccomp.cxx   |   70 +++++++++++++++++++--------------------
 sw/source/core/inc/sectfrm.hxx   |    6 +--
 16 files changed, 129 insertions(+), 114 deletions(-)

New commits:
commit ca0b3bb41988b679fff028a3a8e8cd7c7ec5bdd2
Author: Noel Grandin <noel at peralex.com>
Date:   Wed Nov 12 11:04:31 2014 +0200

    loplugin: cstylecast
    
    Change-Id: I8c840d6635f347dcb1b8d9d193a05d509ba6cacb

diff --git a/sw/source/core/doc/acmplwrd.cxx b/sw/source/core/doc/acmplwrd.cxx
index adff16c..747d3a6 100644
--- a/sw/source/core/doc/acmplwrd.cxx
+++ b/sw/source/core/doc/acmplwrd.cxx
@@ -145,8 +145,8 @@ void SwAutoCompleteClient::Modify( const SfxPoolItem* pOld, const SfxPoolItem *)
     {
     case RES_REMOVE_UNO_OBJECT:
     case RES_OBJECTDYING:
-        if( (void*)GetRegisteredIn() == ((SwPtrMsgPoolItem *)pOld)->pObject )
-            ((SwModify*)GetRegisteredIn())->Remove(this);
+        if( (void*)GetRegisteredIn() == static_cast<const SwPtrMsgPoolItem *>(pOld)->pObject )
+            static_cast<SwModify*>(GetRegisteredIn())->Remove(this);
         pAutoCompleteWord->DocumentDying(*pDoc);
         break;
     }
@@ -283,7 +283,7 @@ bool SwAutoCompleteWord::InsertWord( const OUString& rWord, SwDoc& rDoc )
         {
             delete pNew;
             // then move "up"
-            pNew = (SwAutoCompleteString*)(*aInsPair.first);
+            pNew = static_cast<SwAutoCompleteString*>(*aInsPair.first);
 
             // add the document to the already inserted string
             pNew->AddDocument(rDoc);
diff --git a/sw/source/core/doc/dbgoutsw.cxx b/sw/source/core/doc/dbgoutsw.cxx
index 3837e0e..67ac7f2 100644
--- a/sw/source/core/doc/dbgoutsw.cxx
+++ b/sw/source/core/doc/dbgoutsw.cxx
@@ -277,7 +277,7 @@ static const OUString lcl_dbg_out(const SfxItemSet & rSet)
         if (!bFirst)
             aStr += ", ";
 
-        if ((sal_uIntPtr)pItem != SAL_MAX_SIZE)
+        if (reinterpret_cast<sal_uIntPtr>(pItem) != SAL_MAX_SIZE)
             aStr += lcl_dbg_out(*pItem);
         else
             aStr += "invalid";
diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx
index 2281b08..74b1aa0 100644
--- a/sw/source/core/doc/doc.cxx
+++ b/sw/source/core/doc/doc.cxx
@@ -508,9 +508,9 @@ struct _PostItFld : public _SetGetExpFld
             const std::set< sal_Int32 > &rPossiblePages,
             sal_uInt16& rVirtPgNo, sal_uInt16& rLineNo );
 
-    SwPostItField* GetPostIt() const
+    const SwPostItField* GetPostIt() const
     {
-        return (SwPostItField*) GetTxtFld()->GetFmtFld().GetField();
+        return static_cast<const SwPostItField*>( GetTxtFld()->GetFmtFld().GetField() );
     }
 };
 
@@ -582,7 +582,7 @@ bool sw_GetPostIts(
 static void lcl_FormatPostIt(
     IDocumentContentOperations* pIDCO,
     SwPaM& aPam,
-    SwPostItField* pField,
+    const SwPostItField* pField,
     bool bNewPage, bool bIsFirstPostIt,
     sal_uInt16 nPageNo, sal_uInt16 nLineNo )
 {
@@ -684,7 +684,7 @@ void SwDoc::CalculatePagesForPrinting(
         }
 
         ++nPageNum;
-        pStPage = (SwPageFrm*)pStPage->GetNext();
+        pStPage = static_cast<const SwPageFrm*>(pStPage->GetNext());
     }
 
     // now that we have identified the valid pages for printing according
@@ -767,7 +767,7 @@ void SwDoc::UpdatePagesForPrintingWithPostItData(
         bool bIsFirstPostIt = true;
         for (sal_uInt16 i = 0; i < nPostItCount; ++i)
         {
-            _PostItFld& rPostIt = (_PostItFld&)*(*rData.m_pPostItFields)[ i ];
+            _PostItFld& rPostIt = static_cast<_PostItFld&>(*(*rData.m_pPostItFields)[ i ]);
             nLastPageNum = nPhyPageNum;
             nPhyPageNum = rPostIt.GetPageNo(
                     aRangeEnum, rData.GetValidPagesSet(), nVirtPg, nLineNo );
@@ -811,7 +811,7 @@ void SwDoc::UpdatePagesForPrintingWithPostItData(
             // now we just need to add the post-it pages to be printed to the
             // end of the vector of pages to print
             sal_Int32 nPageNum = 0;
-            const SwPageFrm * pPageFrm = (SwPageFrm*)rData.m_pPostItShell->GetLayout()->Lower();
+            const SwPageFrm * pPageFrm = static_cast<SwPageFrm*>(rData.m_pPostItShell->GetLayout()->Lower());
             while( pPageFrm && nPageNum < nPostItDocPageCount )
             {
                 OSL_ENSURE( pPageFrm, "Empty page frame. How are we going to print this?" );
@@ -819,7 +819,7 @@ void SwDoc::UpdatePagesForPrintingWithPostItData(
                 // negative page number indicates page is from the post-it doc
                 rData.GetPagesToPrint().push_back( -nPageNum );
                 OSL_ENSURE( pPageFrm, "pPageFrm is NULL!" );
-                pPageFrm = (SwPageFrm*)pPageFrm->GetNext();
+                pPageFrm = static_cast<const SwPageFrm*>(pPageFrm->GetNext());
             }
             OSL_ENSURE( nPageNum == nPostItDocPageCount, "unexpected number of pages" );
         }
@@ -897,7 +897,7 @@ void SwDoc::CalculatePagePairsForProspectPrinting(
     const SwPageFrm *pStPage  = dynamic_cast<const SwPageFrm*>( rLayout.Lower() );
     sal_Int32 i = 0;
     for ( i = 1; pStPage && i < nDocPageCount; ++i )
-        pStPage = (SwPageFrm*)pStPage->GetNext();
+        pStPage = static_cast<const SwPageFrm*>(pStPage->GetNext());
     if ( !pStPage )          // Then it was that
         return;
 
@@ -911,7 +911,7 @@ void SwDoc::CalculatePagePairsForProspectPrinting(
         ++nPageNum;
         rValidPagesSet.insert( nPageNum );
         validStartFrms[ nPageNum ] = pPageFrm;
-        pPageFrm = (SwPageFrm*)pPageFrm->GetNext();
+        pPageFrm = static_cast<const SwPageFrm*>(pPageFrm->GetNext());
 
         rPrinterPaperTrays[ nPageNum ] = lcl_GetPaperBin( pStPage );
     }
@@ -1021,7 +1021,7 @@ const SwFmtRefMark* SwDoc::GetRefMark( const OUString& rName ) const
         if( 0 == (pItem = GetAttrPool().GetItem2( RES_TXTATR_REFMARK, n ) ))
             continue;
 
-        const SwFmtRefMark* pFmtRef = (SwFmtRefMark*)pItem;
+        const SwFmtRefMark* pFmtRef = static_cast<const SwFmtRefMark*>(pItem);
         const SwTxtRefMark* pTxtRef = pFmtRef->GetTxtRefMark();
         if( pTxtRef && &pTxtRef->GetTxtNode().GetNodes() == &GetNodes() &&
             rName == pFmtRef->GetRefName() )
@@ -1041,12 +1041,12 @@ const SwFmtRefMark* SwDoc::GetRefMark( sal_uInt16 nIndex ) const
     sal_uInt32 nCount = 0;
     for( sal_uInt32 n = 0; n < nMaxItems; ++n )
         if( 0 != (pItem = GetAttrPool().GetItem2( RES_TXTATR_REFMARK, n )) &&
-            0 != (pTxtRef = ((SwFmtRefMark*)pItem)->GetTxtRefMark()) &&
+            0 != (pTxtRef = static_cast<const SwFmtRefMark*>(pItem)->GetTxtRefMark()) &&
             &pTxtRef->GetTxtNode().GetNodes() == &GetNodes() )
         {
             if(nCount == nIndex)
             {
-                pRet = (SwFmtRefMark*)pItem;
+                pRet = static_cast<const SwFmtRefMark*>(pItem);
                 break;
             }
             nCount++;
@@ -1066,12 +1066,12 @@ sal_uInt16 SwDoc::GetRefMarks( std::vector<OUString>* pNames ) const
     sal_uInt16 nCount = 0;
     for( sal_uInt32 n = 0; n < nMaxItems; ++n )
         if( 0 != (pItem = GetAttrPool().GetItem2( RES_TXTATR_REFMARK, n )) &&
-            0 != (pTxtRef = ((SwFmtRefMark*)pItem)->GetTxtRefMark()) &&
+            0 != (pTxtRef = static_cast<const SwFmtRefMark*>(pItem)->GetTxtRefMark()) &&
             &pTxtRef->GetTxtNode().GetNodes() == &GetNodes() )
         {
             if( pNames )
             {
-                OUString pTmp(((SwFmtRefMark*)pItem)->GetRefName());
+                OUString pTmp(static_cast<const SwFmtRefMark*>(pItem)->GetRefName());
                 pNames->insert(pNames->begin() + nCount, pTmp);
             }
             ++nCount;
@@ -1171,8 +1171,9 @@ const SwFmtINetFmt* SwDoc::FindINetAttr( const OUString& rName ) const
     const SwTxtNode* pTxtNd;
     sal_uInt32 n, nMaxItems = GetAttrPool().GetItemCount2( RES_TXTATR_INETFMT );
     for( n = 0; n < nMaxItems; ++n )
-        if( 0 != (pItem = (SwFmtINetFmt*)GetAttrPool().GetItem2(
-            RES_TXTATR_INETFMT, n ) ) &&
+    {
+        pItem = static_cast<const SwFmtINetFmt*>( GetAttrPool().GetItem2( RES_TXTATR_INETFMT, n ) );
+        if( 0 != pItem &&
             pItem->GetName() == rName &&
             0 != ( pTxtAttr = pItem->GetTxtINetFmt()) &&
             0 != ( pTxtNd = pTxtAttr->GetpTxtNode() ) &&
@@ -1180,7 +1181,7 @@ const SwFmtINetFmt* SwDoc::FindINetAttr( const OUString& rName ) const
         {
             return pItem;
         }
-
+    }
     return 0;
 }
 
@@ -1197,7 +1198,7 @@ void SwDoc::Summary( SwDoc* pExtDoc, sal_uInt8 nLevel, sal_uInt8 nPara, bool bIm
             ::SetProgressState( i, GetDocShell() );
             const sal_uLong nIndex = rOutNds[ i ]->GetIndex();
 
-            const int nLvl = ((SwTxtNode*)GetNodes()[ nIndex ])->GetAttrOutlineLevel()-1;
+            const int nLvl = static_cast<SwTxtNode*>(GetNodes()[ nIndex ])->GetAttrOutlineLevel()-1;
             if( nLvl > nLevel )
                 continue;
             sal_uInt16 nEndOfs = 1;
@@ -1208,7 +1209,7 @@ void SwDoc::Summary( SwDoc* pExtDoc, sal_uInt8 nLevel, sal_uInt8 nPara, bool bIm
             while( ( nWish || bKeep ) && nIndex + nEndOfs < nNextOutNd &&
                    GetNodes()[ nIndex + nEndOfs ]->IsTxtNode() )
             {
-                SwTxtNode* pTxtNode = (SwTxtNode*)GetNodes()[ nIndex+nEndOfs ];
+                SwTxtNode* pTxtNode = static_cast<SwTxtNode*>(GetNodes()[ nIndex+nEndOfs ]);
                 if (pTxtNode->GetTxt().getLength() && nWish)
                     --nWish;
                 bKeep = pTxtNode->GetSwAttrSet().GetKeep().GetValue();
@@ -1229,7 +1230,7 @@ void SwDoc::Summary( SwDoc* pExtDoc, sal_uInt8 nLevel, sal_uInt8 nPara, bool bIm
             bool bDelete = false;
             if( (pNode = &aIndx.GetNode())->IsTxtNode() )
             {
-                SwTxtNode *pNd = (SwTxtNode*)pNode;
+                SwTxtNode *pNd = static_cast<SwTxtNode*>(pNode);
                 if( pNd->HasSwAttrSet() )
                     pNd->ResetAttr( RES_PAGEDESC, RES_BREAK );
                 if( bImpress )
@@ -1675,7 +1676,7 @@ bool SwDoc::ContainsHiddenChars() const
     {
         SwNode* pNd = GetNodes()[ --n ];
         if ( pNd->IsTxtNode() &&
-             ((SwTxtNode*)pNd)->HasHiddenCharAttribute( false ) )
+             static_cast<SwTxtNode*>(pNd)->HasHiddenCharAttribute( false ) )
             return true;
     }
 
diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx
index 2a41833..2e477fb 100644
--- a/sw/source/core/doc/doccomp.cxx
+++ b/sw/source/core/doc/doccomp.cxx
@@ -1011,7 +1011,7 @@ sal_uLong SwCompareLine::GetHashValue() const
     switch( rNode.GetNodeType() )
     {
     case ND_TEXTNODE:
-        nRet = GetTxtNodeHashValue( (SwTxtNode&)rNode, nRet );
+        nRet = GetTxtNodeHashValue( static_cast<const SwTxtNode&>(rNode), nRet );
         break;
 
     case ND_TABLENODE:
@@ -1021,7 +1021,7 @@ sal_uLong SwCompareLine::GetHashValue() const
             while( &aIdx.GetNode() != pEndNd )
             {
                 if( aIdx.GetNode().IsTxtNode() )
-                    nRet = GetTxtNodeHashValue( (SwTxtNode&)aIdx.GetNode(), nRet );
+                    nRet = GetTxtNodeHashValue( static_cast<SwTxtNode&>(aIdx.GetNode()), nRet );
                 ++aIdx;
             }
         }
@@ -1054,7 +1054,7 @@ const SwNode& SwCompareLine::GetEndNode() const
 
     case ND_SECTIONNODE:
         {
-            const SwSectionNode& rSNd = (SwSectionNode&)rNode;
+            const SwSectionNode& rSNd = static_cast<const SwSectionNode&>(rNode);
             const SwSection& rSect = rSNd.GetSection();
             if( CONTENT_SECTION != rSect.GetType() || rSect.IsProtect() )
                 pNd = rNode.EndOfSectionNode();
@@ -1066,7 +1066,7 @@ const SwNode& SwCompareLine::GetEndNode() const
 
 bool SwCompareLine::Compare( const CompareLine& rLine ) const
 {
-    return CompareNode( rNode, ((SwCompareLine&)rLine).rNode );
+    return CompareNode( rNode, static_cast<const SwCompareLine&>(rLine).rNode );
 }
 
 namespace
@@ -1102,14 +1102,14 @@ bool SwCompareLine::CompareNode( const SwNode& rDstNd, const SwNode& rSrcNd )
     switch( rDstNd.GetNodeType() )
     {
     case ND_TEXTNODE:
-        bRet = CompareTxtNd( (SwTxtNode&)rDstNd, (SwTxtNode&)rSrcNd )
-            && ( !CmpOptions.bUseRsid || ((SwTxtNode&)rDstNd).CompareParRsid( (SwTxtNode&)rSrcNd ) );
+        bRet = CompareTxtNd( static_cast<const SwTxtNode&>(rDstNd), static_cast<const SwTxtNode&>(rSrcNd) )
+            && ( !CmpOptions.bUseRsid || static_cast<const SwTxtNode&>(rDstNd).CompareParRsid( static_cast<const SwTxtNode&>(rSrcNd) ) );
         break;
 
     case ND_TABLENODE:
         {
-            const SwTableNode& rTSrcNd = (SwTableNode&)rSrcNd;
-            const SwTableNode& rTDstNd = (SwTableNode&)rDstNd;
+            const SwTableNode& rTSrcNd = static_cast<const SwTableNode&>(rSrcNd);
+            const SwTableNode& rTDstNd = static_cast<const SwTableNode&>(rDstNd);
 
             bRet = ( rTSrcNd.EndOfSectionIndex() - rTSrcNd.GetIndex() ) ==
                    ( rTDstNd.EndOfSectionIndex() - rTDstNd.GetIndex() );
@@ -1124,8 +1124,8 @@ bool SwCompareLine::CompareNode( const SwNode& rDstNd, const SwNode& rSrcNd )
 
     case ND_SECTIONNODE:
         {
-            const SwSectionNode& rSSrcNd = (SwSectionNode&)rSrcNd,
-                               & rSDstNd = (SwSectionNode&)rDstNd;
+            const SwSectionNode& rSSrcNd = static_cast<const SwSectionNode&>(rSrcNd),
+                               & rSDstNd = static_cast<const SwSectionNode&>(rDstNd);
             const SwSection& rSrcSect = rSSrcNd.GetSection(),
                            & rDstSect = rSDstNd.GetSection();
             SectionType eSrcSectType = rSrcSect.GetType(),
@@ -1191,7 +1191,7 @@ OUString SwCompareLine::GetText() const
     switch( rNode.GetNodeType() )
     {
     case ND_TEXTNODE:
-        sRet = ((SwTxtNode&)rNode).GetExpandTxt();
+        sRet = static_cast<const SwTxtNode&>(rNode).GetExpandTxt();
         break;
 
     case ND_TABLENODE:
@@ -1204,7 +1204,7 @@ OUString SwCompareLine::GetText() const
         {
             sRet = "Section - Node:";
 
-            const SwSectionNode& rSNd = (SwSectionNode&)rNode;
+            const SwSectionNode& rSNd = static_cast<const SwSectionNode&>(rNode);
             const SwSection& rSect = rSNd.GetSection();
             switch( rSect.GetType() )
             {
@@ -1387,7 +1387,7 @@ bool SwCompareLine::ChangesInLine( const SwCompareLine& rLine,
 
                 if( rpInsRing )
                 {
-                    SwPaM* pCorr = (SwPaM*)rpInsRing->GetPrev();
+                    SwPaM* pCorr = static_cast<SwPaM*>(rpInsRing->GetPrev());
                     if( *pCorr->GetPoint() == *pTmp->GetPoint() )
                         *pCorr->GetPoint() = *pTmp->GetMark();
                 }
@@ -1446,7 +1446,7 @@ sal_uLong SwCompareData::PrevIdx( const SwNode* pNd )
 
 void SwCompareData::CheckRanges( CompareData& rData )
 {
-    const SwNodes& rSrcNds = ((SwCompareData&)rData).rDoc.GetNodes();
+    const SwNodes& rSrcNds = static_cast<SwCompareData&>(rData).rDoc.GetNodes();
     const SwNodes& rDstNds = rDoc.GetNodes();
 
     const SwNode& rSrcEndNd = rSrcNds.GetEndOfContent();
@@ -1499,8 +1499,8 @@ void SwCompareData::CheckRanges( CompareData& rData )
 
 void SwCompareData::ShowInsert( sal_uLong nStt, sal_uLong nEnd )
 {
-    SwPaM* pTmp = new SwPaM( ((SwCompareLine*)GetLine( nStt ))->GetNode(), 0,
-                            ((SwCompareLine*)GetLine( nEnd-1 ))->GetEndNode(), 0,
+    SwPaM* pTmp = new SwPaM( static_cast<const SwCompareLine*>(GetLine( nStt ))->GetNode(), 0,
+                             static_cast<const SwCompareLine*>(GetLine( nEnd-1 ))->GetEndNode(), 0,
                              pInsRing );
     if( !pInsRing )
         pInsRing = pTmp;
@@ -1515,8 +1515,8 @@ void SwCompareData::ShowDelete(
     sal_uLong nInsPos )
 {
     SwNodeRange aRg(
-        ((SwCompareLine*)rData.GetLine( nStt ))->GetNode(), 0,
-        ((SwCompareLine*)rData.GetLine( nEnd-1 ))->GetEndNode(), 1 );
+        static_cast<const SwCompareLine*>(rData.GetLine( nStt ))->GetNode(), 0,
+        static_cast<const SwCompareLine*>(rData.GetLine( nEnd-1 ))->GetEndNode(), 1 );
 
     sal_uInt16 nOffset = 0;
     const CompareLine* pLine = 0;
@@ -1535,9 +1535,9 @@ void SwCompareData::ShowDelete(
     if( pLine )
     {
         if( nOffset )
-            pLineNd = &((SwCompareLine*)pLine)->GetEndNode();
+            pLineNd = &static_cast<const SwCompareLine*>(pLine)->GetEndNode();
         else
-            pLineNd = &((SwCompareLine*)pLine)->GetNode();
+            pLineNd = &static_cast<const SwCompareLine*>(pLine)->GetNode();
     }
     else
     {
@@ -1548,7 +1548,7 @@ void SwCompareData::ShowDelete(
     SwNodeIndex aInsPos( *pLineNd, nOffset );
     SwNodeIndex aSavePos( aInsPos, -1 );
 
-    ((SwCompareData&)rData).rDoc.GetDocumentContentOperationsManager().CopyWithFlyInFly( aRg, 0, aInsPos );
+    static_cast<const SwCompareData&>(rData).rDoc.GetDocumentContentOperationsManager().CopyWithFlyInFly( aRg, 0, aInsPos );
     rDoc.getIDocumentState().SetModified();
     ++aSavePos;
 
@@ -1563,7 +1563,7 @@ void SwCompareData::ShowDelete(
 
     if( pInsRing )
     {
-        SwPaM* pCorr = (SwPaM*)pInsRing->GetPrev();
+        SwPaM* pCorr = static_cast<SwPaM*>(pInsRing->GetPrev());
         if( *pCorr->GetPoint() == *pTmp->GetPoint() )
         {
             SwNodeIndex aTmpPos( pTmp->GetMark()->nNode, -1 );
@@ -1598,8 +1598,8 @@ void SwCompareData::CheckForChangesInLine( const CompareData& rData,
 
         if( i )
         {
-            SwCompareLine* pDstLn = (SwCompareLine*)GetLine( rThisStt + nDstFrom - 1 );
-            SwCompareLine* pSrcLn = (SwCompareLine*)rData.GetLine( rStt + nSrcFrom - 1 );
+            const SwCompareLine* pDstLn = static_cast<const SwCompareLine*>(GetLine( rThisStt + nDstFrom - 1 ));
+            const SwCompareLine* pSrcLn = static_cast<const SwCompareLine*>(rData.GetLine( rStt + nSrcFrom - 1 ));
 
             // Show differences in detail for lines that
             // were matched as only slightly different
@@ -1691,7 +1691,7 @@ void SwCompareData::SetRedlinesToDoc( bool bUseDocInfo )
             }
             rDoc.getIDocumentRedlineAccess().AppendRedline( new SwRangeRedline( aRedlnData, *pTmp ), true );
 
-        } while( pDelRing != ( pTmp = (SwPaM*)pTmp->GetNext() ));
+        } while( pDelRing != ( pTmp = static_cast<SwPaM*>(pTmp->GetNext()) ));
     }
 
     pTmp = pInsRing;
@@ -1713,7 +1713,7 @@ void SwCompareData::SetRedlinesToDoc( bool bUseDocInfo )
                 pTmp->GetPoint()->nContent.Assign( pContentNode,
                         (pContentNode) ? pContentNode->Len() : 0 );
             }
-        } while( pInsRing != ( pTmp = (SwPaM*)pTmp->GetNext() ));
+        } while( pInsRing != ( pTmp = static_cast<SwPaM*>(pTmp->GetNext()) ));
         SwRedlineData aRedlnData( nsRedlineType_t::REDLINE_INSERT, nAuthor, aTimeStamp,
                                     OUString(), 0, 0 );
 
@@ -1723,7 +1723,7 @@ void SwCompareData::SetRedlinesToDoc( bool bUseDocInfo )
             const SwCntntNode* pCNd;
             do {
                 SwPosition& rSttEnd = *pTmp->End(),
-                          & rEndStt = *((SwPaM*)pTmp->GetNext())->Start();
+                          & rEndStt = *static_cast<SwPaM*>(pTmp->GetNext())->Start();
                 if( rSttEnd == rEndStt ||
                     (!rEndStt.nContent.GetIndex() &&
                     rEndStt.nNode.GetIndex() - 1 == rSttEnd.nNode.GetIndex() &&
@@ -1740,12 +1740,12 @@ void SwCompareData::SetRedlinesToDoc( bool bUseDocInfo )
                     else
                     {
                         // are consecutive, so combine
-                        rSttEnd = *((SwPaM*)pTmp->GetNext())->End();
+                        rSttEnd = *static_cast<SwPaM*>(pTmp->GetNext())->End();
                         delete pTmp->GetNext();
                     }
                 }
                 else
-                    pTmp = (SwPaM*)pTmp->GetNext();
+                    pTmp = static_cast<SwPaM*>(pTmp->GetNext());
             } while( pInsRing != pTmp );
         }
 
@@ -1756,7 +1756,7 @@ void SwCompareData::SetRedlinesToDoc( bool bUseDocInfo )
                 SwUndo *const pUndo(new SwUndoCompDoc( *pTmp, true ));
                 rDoc.GetIDocumentUndoRedo().AppendUndo(pUndo);
             }
-        } while( pInsRing != ( pTmp = (SwPaM*)pTmp->GetNext() ));
+        } while( pInsRing != ( pTmp = static_cast<SwPaM*>(pTmp->GetNext()) ));
     }
 }
 
@@ -1845,7 +1845,7 @@ _SaveMergeRedlines::_SaveMergeRedlines( const SwNode& rDstNd,
 
     const SwPosition* pStt = rSrcRedl.Start();
     if( rDstNd.IsCntntNode() )
-        aPos.nContent.Assign( ((SwCntntNode*)&rDstNd), pStt->nContent.GetIndex() );
+        aPos.nContent.Assign( const_cast<SwCntntNode*>(static_cast<const SwCntntNode*>(&rDstNd)), pStt->nContent.GetIndex() );
     pDestRedl = new SwRangeRedline( rSrcRedl.GetRedlineData(), aPos );
 
     if( nsRedlineType_t::REDLINE_DELETE == pDestRedl->GetType() )
@@ -1893,7 +1893,7 @@ sal_uInt16 _SaveMergeRedlines::InsertRedline()
 
         if( GetPrev() != this )
         {
-            SwPaM* pTmpPrev = ((_SaveMergeRedlines*)GetPrev())->pDestRedl;
+            SwPaM* pTmpPrev = static_cast<_SaveMergeRedlines*>(GetPrev())->pDestRedl;
             if( pTmpPrev && *pTmpPrev->GetPoint() == *pDestRedl->GetPoint() )
                 *pTmpPrev->GetPoint() = *pDestRedl->GetMark();
         }
@@ -2064,7 +2064,7 @@ long SwDoc::MergeDoc( const SwDoc& rDoc )
 
             do {
                 nRet += pTmp->InsertRedline();
-            } while( pRing != ( pTmp = (_SaveMergeRedlines*)pTmp->GetNext() ));
+            } while( pRing != ( pTmp = static_cast<_SaveMergeRedlines*>(pTmp->GetNext()) ));
 
             while( pRing != pRing->GetNext() )
                 delete pRing->GetNext();
@@ -2100,8 +2100,8 @@ bool LineArrayComparator::Compare( int nIdx1, int nIdx2 ) const
         return false;
     }
 
-    const SwTxtNode *pTxtNd1 = ( ( SwCompareLine* )rData1.GetLine( nFirst1 + nIdx1 ) )->GetNode().GetTxtNode();
-    const SwTxtNode *pTxtNd2 = ( ( SwCompareLine* )rData2.GetLine( nFirst2 + nIdx2 ) )->GetNode().GetTxtNode();
+    const SwTxtNode *pTxtNd1 = static_cast<const SwCompareLine*>( rData1.GetLine( nFirst1 + nIdx1 ) )->GetNode().GetTxtNode();
+    const SwTxtNode *pTxtNd2 = static_cast<const SwCompareLine*>( rData2.GetLine( nFirst2 + nIdx2 ) )->GetNode().GetTxtNode();
 
     if( !pTxtNd1 || !pTxtNd2
         || ( CmpOptions.bUseRsid && !pTxtNd1->CompareParRsid( *pTxtNd2 ) ) )
diff --git a/sw/source/core/inc/sectfrm.hxx b/sw/source/core/inc/sectfrm.hxx
index 6941010..228878e 100644
--- a/sw/source/core/inc/sectfrm.hxx
+++ b/sw/source/core/inc/sectfrm.hxx
@@ -159,15 +159,15 @@ class SwDestroyList : public std::set<SwSectionFrm*> {};
 
 inline const SwSectionFrm *SwSectionFrm::GetFollow() const
 {
-    return (const SwSectionFrm*)SwFlowFrm::GetFollow();
+    return static_cast<const SwSectionFrm*>(SwFlowFrm::GetFollow());
 }
 inline SwSectionFrm *SwSectionFrm::GetFollow()
 {
-    return (SwSectionFrm*)SwFlowFrm::GetFollow();
+    return static_cast<SwSectionFrm*>(SwFlowFrm::GetFollow());
 }
 inline const SwCntntFrm *SwSectionFrm::FindLastCntnt( sal_uInt8 nMode ) const
 {
-    return ((SwSectionFrm*)this)->FindLastCntnt( nMode );
+    return const_cast<SwSectionFrm*>(this)->FindLastCntnt( nMode );
 }
 
 #endif // INCLUDED_SW_SOURCE_CORE_INC_SECTFRM_HXX
commit a2f66db3a603a5f6802504f776727669811c2489
Author: Noel Grandin <noel at peralex.com>
Date:   Wed Nov 12 10:30:00 2014 +0200

    loplugin: cstylecast
    
    Change-Id: Ica3b54a7c331f0179294e2b52aadd884f53d53dc

diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx
index ba3f5d6..63c32b3 100644
--- a/sw/inc/doc.hxx
+++ b/sw/inc/doc.hxx
@@ -45,6 +45,7 @@
 #include <tox.hxx>
 #include <frmfmt.hxx>
 #include <charfmt.hxx>
+#include <docary.hxx>
 
 #include <boost/unordered_map.hpp>
 
@@ -828,7 +829,7 @@ public:
                           bool bBroadcast = false, bool bAuto = true);
     void       DelFrmFmt( SwFrmFmt *pFmt, bool bBroadcast = false );
     SwFrmFmt* FindFrmFmtByName( const OUString& rName ) const
-        {   return static_cast<SwFrmFmt*>(FindFmtByName( (SwFmtsBase&)*mpFrmFmtTbl, rName )); }
+        {   return static_cast<SwFrmFmt*>(FindFmtByName( static_cast<SwFmtsBase&>(*mpFrmFmtTbl), rName )); }
 
     SwCharFmt *MakeCharFmt(const OUString &rFmtName, SwCharFmt *pDerivedFrom,
                            bool bBroadcast = false,
diff --git a/sw/inc/edimp.hxx b/sw/inc/edimp.hxx
index ea7f14f..c6e2956 100644
--- a/sw/inc/edimp.hxx
+++ b/sw/inc/edimp.hxx
@@ -35,7 +35,7 @@ class SwNodeIndex;
         do {
 
 #define FOREACHPAM_END() \
-        } while( (_pStartCrsr=(SwPaM *)_pStartCrsr->GetNext()) != __pStartCrsr ); \
+        } while( (_pStartCrsr=static_cast<SwPaM *>(_pStartCrsr->GetNext())) != __pStartCrsr ); \
     }
 
 struct SwPamRange
diff --git a/sw/inc/fmtcnct.hxx b/sw/inc/fmtcnct.hxx
index d782728..14d916d 100644
--- a/sw/inc/fmtcnct.hxx
+++ b/sw/inc/fmtcnct.hxx
@@ -50,8 +50,8 @@ public:
 
     virtual bool QueryValue( com::sun::star::uno::Any& rVal, sal_uInt8 nMemberId = 0 ) const SAL_OVERRIDE;
 
-    SwFlyFrmFmt* GetPrev() const { return (SwFlyFrmFmt*)aPrev.GetRegisteredIn(); }
-    SwFlyFrmFmt* GetNext() const { return (SwFlyFrmFmt*)aNext.GetRegisteredIn(); }
+    SwFlyFrmFmt* GetPrev() const { return const_cast<SwFlyFrmFmt*>(static_cast<const SwFlyFrmFmt*>(aPrev.GetRegisteredIn())); }
+    SwFlyFrmFmt* GetNext() const { return const_cast<SwFlyFrmFmt*>(static_cast<const SwFlyFrmFmt*>(aNext.GetRegisteredIn())); }
 
     void SetPrev( SwFlyFrmFmt *pFmt );
     void SetNext( SwFlyFrmFmt *pFmt );
@@ -65,7 +65,7 @@ SwFmtChain &SwFmtChain::operator=( const SwFmtChain &rCpy )
 }
 
 inline const SwFmtChain &SwAttrSet::GetChain(bool bInP) const
-    { return (const SwFmtChain&)Get( RES_CHAIN,bInP); }
+    { return static_cast<const SwFmtChain&>(Get( RES_CHAIN,bInP)); }
 
 inline const SwFmtChain &SwFmt::GetChain(bool bInP) const
     { return aSet.GetChain(bInP); }
diff --git a/sw/inc/fmthdft.hxx b/sw/inc/fmthdft.hxx
index 3fcc988..ce2afbe 100644
--- a/sw/inc/fmthdft.hxx
+++ b/sw/inc/fmthdft.hxx
@@ -53,8 +53,8 @@ public:
                                     OUString &rText,
                                     const IntlWrapper*    pIntl = 0 ) const SAL_OVERRIDE;
 
-    const SwFrmFmt *GetHeaderFmt() const { return (SwFrmFmt*)GetRegisteredIn(); }
-          SwFrmFmt *GetHeaderFmt()       { return (SwFrmFmt*)GetRegisteredIn(); }
+    const SwFrmFmt *GetHeaderFmt() const { return static_cast<const SwFrmFmt*>(GetRegisteredIn()); }
+          SwFrmFmt *GetHeaderFmt()       { return static_cast<SwFrmFmt*>(GetRegisteredIn()); }
 
     void RegisterToFormat( SwFmt& rFmt );
     bool IsActive() const { return bActive; }
@@ -86,8 +86,8 @@ public:
                                     OUString &rText,
                                     const IntlWrapper*    pIntl = 0 ) const SAL_OVERRIDE;
 
-    const SwFrmFmt *GetFooterFmt() const { return (SwFrmFmt*)GetRegisteredIn(); }
-          SwFrmFmt *GetFooterFmt()       { return (SwFrmFmt*)GetRegisteredIn(); }
+    const SwFrmFmt *GetFooterFmt() const { return static_cast<const SwFrmFmt*>(GetRegisteredIn()); }
+          SwFrmFmt *GetFooterFmt()       { return static_cast<SwFrmFmt*>(GetRegisteredIn()); }
 
     void RegisterToFormat( SwFmt& rFmt );
     bool IsActive() const { return bActive; }
@@ -95,9 +95,9 @@ public:
 };
 
 inline const SwFmtHeader &SwAttrSet::GetHeader(bool bInP) const
-    { return (const SwFmtHeader&)Get( RES_HEADER,bInP); }
+    { return static_cast<const SwFmtHeader&>(Get( RES_HEADER,bInP)); }
 inline const SwFmtFooter &SwAttrSet::GetFooter(bool bInP) const
-    { return (const SwFmtFooter&)Get( RES_FOOTER,bInP); }
+    { return static_cast<const SwFmtFooter&>(Get( RES_FOOTER,bInP)); }
 
 inline const SwFmtHeader &SwFmt::GetHeader(bool bInP) const
     { return aSet.GetHeader(bInP); }
diff --git a/sw/inc/ndgrf.hxx b/sw/inc/ndgrf.hxx
index f8f9e46..3eaa75a 100644
--- a/sw/inc/ndgrf.hxx
+++ b/sw/inc/ndgrf.hxx
@@ -217,12 +217,12 @@ public:
 // Inline methods from Node.hxx - it is only now that we know TxtNode!!
 inline       SwGrfNode   *SwNode::GetGrfNode()
 {
-     return ND_GRFNODE == nNodeType ? (SwGrfNode*)this : 0;
+     return ND_GRFNODE == nNodeType ? static_cast<SwGrfNode*>(this) : 0;
 }
 
 inline const SwGrfNode   *SwNode::GetGrfNode() const
 {
-     return ND_GRFNODE == nNodeType ? (const SwGrfNode*)this : 0;
+     return ND_GRFNODE == nNodeType ? static_cast<const SwGrfNode*>(this) : 0;
 }
 
 inline bool SwGrfNode::IsLinkedFile() const
diff --git a/sw/inc/paratr.hxx b/sw/inc/paratr.hxx
index ef9b322..53492fa 100644
--- a/sw/inc/paratr.hxx
+++ b/sw/inc/paratr.hxx
@@ -25,8 +25,20 @@
 #include <calbck.hxx>
 #include <swatrset.hxx>
 #include <format.hxx>
+#include <charfmt.hxx>
 #include <swtypes.hxx>
 #include <editeng/adjustitem.hxx>
+#include <editeng/lspcitem.hxx>
+#include <editeng/spltitem.hxx>
+#include <editeng/widwitem.hxx>
+#include <editeng/orphitem.hxx>
+#include <editeng/tstpitem.hxx>
+#include <editeng/hyphenzoneitem.hxx>
+#include <editeng/scriptspaceitem.hxx>
+#include <editeng/hngpnctitem.hxx>
+#include <editeng/forbiddenruleitem.hxx>
+#include <editeng/paravertalignitem.hxx>
+#include <editeng/pgrditem.hxx>
 
 class SwCharFmt;
 class IntlWrapper;
@@ -86,8 +98,8 @@ public:
     inline sal_uInt16 GetDistance() const { return nDistance; }
     inline sal_uInt16 &GetDistance() { return nDistance; }
 
-   inline const SwCharFmt *GetCharFmt() const { return (SwCharFmt*)GetRegisteredIn(); }
-    inline SwCharFmt *GetCharFmt()       { return (SwCharFmt*)GetRegisteredIn(); }
+    inline const SwCharFmt *GetCharFmt() const { return static_cast<const SwCharFmt*>(GetRegisteredIn()); }
+    inline SwCharFmt *GetCharFmt()       { return static_cast<SwCharFmt*>(GetRegisteredIn()); }
     void SetCharFmt( SwCharFmt *pNew );
     /// Get information from Client.
     virtual bool GetInfo( SfxPoolItem& ) const SAL_OVERRIDE;
@@ -190,37 +202,37 @@ inline SwParaConnectBorderItem& SwParaConnectBorderItem::operator=(
 
 //  Implementation of paragraph-attributes methods of SwAttrSet
 inline const SvxLineSpacingItem &SwAttrSet::GetLineSpacing(bool bInP) const
-    {   return (const SvxLineSpacingItem&)Get( RES_PARATR_LINESPACING,bInP); }
+    {   return static_cast<const SvxLineSpacingItem&>(Get( RES_PARATR_LINESPACING,bInP)); }
 inline const SvxAdjustItem &SwAttrSet::GetAdjust(bool bInP) const
-    {   return (const SvxAdjustItem&)Get( RES_PARATR_ADJUST,bInP); }
+    {   return static_cast<const SvxAdjustItem&>(Get( RES_PARATR_ADJUST,bInP)); }
 inline const SvxFmtSplitItem &SwAttrSet::GetSplit(bool bInP) const
-    {   return (const SvxFmtSplitItem&)Get( RES_PARATR_SPLIT,bInP); }
+    {   return static_cast<const SvxFmtSplitItem&>(Get( RES_PARATR_SPLIT,bInP)); }
 inline const SwRegisterItem &SwAttrSet::GetRegister(bool bInP) const
-    {   return (const SwRegisterItem&)Get( RES_PARATR_REGISTER,bInP); }
+    {   return static_cast<const SwRegisterItem&>(Get( RES_PARATR_REGISTER,bInP)); }
 inline const SvxWidowsItem &SwAttrSet::GetWidows(bool bInP) const
-    {   return (const SvxWidowsItem&)Get( RES_PARATR_WIDOWS,bInP); }
+    {   return static_cast<const SvxWidowsItem&>(Get( RES_PARATR_WIDOWS,bInP)); }
 inline const SvxOrphansItem &SwAttrSet::GetOrphans(bool bInP) const
-    {   return (const SvxOrphansItem&)Get( RES_PARATR_ORPHANS,bInP); }
+    {   return static_cast<const SvxOrphansItem&>(Get( RES_PARATR_ORPHANS,bInP)); }
 inline const SvxTabStopItem &SwAttrSet::GetTabStops(bool bInP) const
-    {   return (const SvxTabStopItem&)Get( RES_PARATR_TABSTOP,bInP); }
+    {   return static_cast<const SvxTabStopItem&>(Get( RES_PARATR_TABSTOP,bInP)); }
 inline const SvxHyphenZoneItem &SwAttrSet::GetHyphenZone(bool bInP) const
-    {   return (const SvxHyphenZoneItem&)Get(RES_PARATR_HYPHENZONE,bInP); }
+    {   return static_cast<const SvxHyphenZoneItem&>(Get(RES_PARATR_HYPHENZONE,bInP)); }
 inline const SwFmtDrop &SwAttrSet::GetDrop(bool bInP) const
-    {   return (const SwFmtDrop&)Get(RES_PARATR_DROP,bInP); }
+    {   return static_cast<const SwFmtDrop&>(Get(RES_PARATR_DROP,bInP)); }
 inline const SwNumRuleItem &SwAttrSet::GetNumRule(bool bInP) const
-    {   return (const SwNumRuleItem&)Get(RES_PARATR_NUMRULE,bInP); }
+    {   return static_cast<const SwNumRuleItem&>(Get(RES_PARATR_NUMRULE,bInP)); }
 inline const SvxScriptSpaceItem& SwAttrSet::GetScriptSpace(bool bInP) const
-    {   return (const SvxScriptSpaceItem&)Get(RES_PARATR_SCRIPTSPACE,bInP); }
+    {   return static_cast<const SvxScriptSpaceItem&>(Get(RES_PARATR_SCRIPTSPACE,bInP)); }
 inline const SvxHangingPunctuationItem &SwAttrSet::GetHangingPunctuation(bool bInP) const
-    {   return (const SvxHangingPunctuationItem&)Get(RES_PARATR_HANGINGPUNCTUATION,bInP); }
+    {   return static_cast<const SvxHangingPunctuationItem&>(Get(RES_PARATR_HANGINGPUNCTUATION,bInP)); }
 inline const SvxForbiddenRuleItem &SwAttrSet::GetForbiddenRule(bool bInP) const
-    {   return (const SvxForbiddenRuleItem&)Get(RES_PARATR_FORBIDDEN_RULES, bInP); }
+    {   return static_cast<const SvxForbiddenRuleItem&>(Get(RES_PARATR_FORBIDDEN_RULES, bInP)); }
 inline const SvxParaVertAlignItem &SwAttrSet::GetParaVertAlign(bool bInP) const
-    {   return (const SvxParaVertAlignItem&)Get( RES_PARATR_VERTALIGN, bInP ); }
+    {   return static_cast<const SvxParaVertAlignItem&>(Get( RES_PARATR_VERTALIGN, bInP )); }
 inline const SvxParaGridItem &SwAttrSet::GetParaGrid(bool bInP) const
-    {   return (const SvxParaGridItem&)Get( RES_PARATR_SNAPTOGRID, bInP ); }
+    {   return static_cast<const SvxParaGridItem&>(Get( RES_PARATR_SNAPTOGRID, bInP )); }
 inline const SwParaConnectBorderItem &SwAttrSet::GetParaConnectBorder(bool bInP) const
-    {   return (const SwParaConnectBorderItem&)Get( RES_PARATR_CONNECT_BORDER, bInP ); }
+    {   return static_cast<const SwParaConnectBorderItem&>(Get( RES_PARATR_CONNECT_BORDER, bInP )); }
 
 // Implementation of paragraph-attributes methods of SwFmt
 inline const SvxLineSpacingItem &SwFmt::GetLineSpacing(bool bInP) const
@@ -248,13 +260,13 @@ inline const SvxScriptSpaceItem& SwFmt::GetScriptSpace(bool bInP) const
 inline const SvxHangingPunctuationItem &SwFmt::GetHangingPunctuation(bool bInP) const
     {   return aSet.GetHangingPunctuation(bInP) ; }
 inline const SvxForbiddenRuleItem &SwFmt::GetForbiddenRule(bool bInP) const
-    {   return (const SvxForbiddenRuleItem&)aSet.Get(RES_PARATR_FORBIDDEN_RULES, bInP); }
+    {   return static_cast<const SvxForbiddenRuleItem&>(aSet.Get(RES_PARATR_FORBIDDEN_RULES, bInP)); }
 inline const SvxParaVertAlignItem &SwFmt::GetParaVertAlign(bool bInP) const
-    {   return (const SvxParaVertAlignItem&)aSet.Get( RES_PARATR_VERTALIGN, bInP ); }
+    {   return static_cast<const SvxParaVertAlignItem&>(aSet.Get( RES_PARATR_VERTALIGN, bInP )); }
 inline const SvxParaGridItem &SwFmt::GetParaGrid(bool bInP) const
-    {   return (const SvxParaGridItem&)aSet.Get( RES_PARATR_SNAPTOGRID, bInP ); }
+    {   return static_cast<const SvxParaGridItem&>(aSet.Get( RES_PARATR_SNAPTOGRID, bInP )); }
 inline const SwParaConnectBorderItem &SwFmt::GetParaConnectBorder(bool bInP) const
-    {   return (const SwParaConnectBorderItem&)aSet.Get( RES_PARATR_CONNECT_BORDER, bInP ); }
+    {   return static_cast<const SwParaConnectBorderItem&>(aSet.Get( RES_PARATR_CONNECT_BORDER, bInP )); }
 
 #endif
 
diff --git a/sw/inc/unochart.hxx b/sw/inc/unochart.hxx
index a368955..30bd2ba 100644
--- a/sw/inc/unochart.hxx
+++ b/sw/inc/unochart.hxx
@@ -52,6 +52,7 @@
 #include <vcl/timer.hxx>
 
 #include <calbck.hxx>
+#include <frmfmt.hxx>
 
 class SfxItemPropertySet;
 class SwDoc;
@@ -194,7 +195,7 @@ public:
     virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     virtual ::com::sun::star::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames(  ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
 
-    SwFrmFmt*       GetFrmFmt() const { return (SwFrmFmt*)GetRegisteredIn(); }
+    SwFrmFmt*       GetFrmFmt() const { return const_cast<SwFrmFmt*>(static_cast<const SwFrmFmt*>(GetRegisteredIn())); }
 
     void        AddDataSequence( const SwTable &rTable, ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence > &rxDataSequence );
     void        RemoveDataSequence( const SwTable &rTable, ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence > &rxDataSequence );
@@ -351,7 +352,7 @@ public:
     virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& xListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
     virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener >& aListener ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE;
 
-    SwFrmFmt*   GetFrmFmt() const { return (SwFrmFmt*)GetRegisteredIn(); }
+    SwFrmFmt*   GetFrmFmt() const { return const_cast<SwFrmFmt*>(static_cast<const SwFrmFmt*>(GetRegisteredIn())); }
     bool    DeleteBox( const SwTableBox &rBox );
 
     void        FillRangeDesc( SwRangeDescriptor &rRangeDesc ) const;
diff --git a/sw/source/core/crsr/trvlcol.cxx b/sw/source/core/crsr/trvlcol.cxx
index 8706797..71ae0eb 100644
--- a/sw/source/core/crsr/trvlcol.cxx
+++ b/sw/source/core/crsr/trvlcol.cxx
@@ -35,13 +35,13 @@ SwLayoutFrm* GetCurrColumn( const SwLayoutFrm* pLayFrm )
 SwLayoutFrm* GetNextColumn( const SwLayoutFrm* pLayFrm )
 {
     SwLayoutFrm* pActCol = GetCurrColumn( pLayFrm );
-    return pActCol ? (SwLayoutFrm*)pActCol->GetNext() : 0;
+    return pActCol ? static_cast<SwLayoutFrm*>(pActCol->GetNext()) : 0;
 }
 
 SwLayoutFrm* GetPrevColumn( const SwLayoutFrm* pLayFrm )
 {
     SwLayoutFrm* pActCol = GetCurrColumn( pLayFrm );
-    return pActCol ? (SwLayoutFrm*)pActCol->GetPrev() : 0;
+    return pActCol ? static_cast<SwLayoutFrm*>(pActCol->GetPrev()) : 0;
 }
 
 SwCntntFrm* GetColumnStt( const SwLayoutFrm* pColFrm )
diff --git a/sw/source/core/crsr/trvlfnfl.cxx b/sw/source/core/crsr/trvlfnfl.cxx
index d9c7cd3..62cdca2 100644
--- a/sw/source/core/crsr/trvlfnfl.cxx
+++ b/sw/source/core/crsr/trvlfnfl.cxx
@@ -59,7 +59,7 @@ bool SwCursor::GotoFtnTxt()
     if (pFtn)
     {
         SwCrsrSaveState aSaveState( *this );
-        GetPoint()->nNode = *((SwTxtFtn*)pFtn)->GetStartNode();
+        GetPoint()->nNode = *static_cast<SwTxtFtn*>(pFtn)->GetStartNode();
 
         SwCntntNode* pCNd = GetDoc()->GetNodes().GoNextSection(
                                             &GetPoint()->nNode,
diff --git a/sw/source/core/crsr/trvltbl.cxx b/sw/source/core/crsr/trvltbl.cxx
index e72992c..0574086 100644
--- a/sw/source/core/crsr/trvltbl.cxx
+++ b/sw/source/core/crsr/trvltbl.cxx
@@ -93,10 +93,10 @@ bool SwCrsrShell::GoNextCell( bool bAppendLine )
                 SwSelBoxes aBoxes;
 
                 // the document might change; w/o Action views would not be notified
-                ((SwEditShell*)this)->StartAllAction();
+                static_cast<SwEditShell*>(this)->StartAllAction();
                 bRet = mpDoc->InsertRow( pTblNd->GetTable().
                                     SelLineFromBox( pTableBox, aBoxes, false ));
-                ((SwEditShell*)this)->EndAllAction();
+                static_cast<SwEditShell*>(this)->EndAllAction();
             }
         }
         if( bRet && ( bRet = pCrsr->GoNextCell() ) )
@@ -731,7 +731,7 @@ OUString SwCrsrShell::GetBoxNms() const
         if( !pFrm )
             return sNm;
 
-        sNm = ((SwCellFrm*)pFrm)->GetTabBox()->GetName();
+        sNm = static_cast<SwCellFrm*>(pFrm)->GetTabBox()->GetName();
         sNm += ":";
         pPos = m_pTblCrsr->End();
     }
@@ -753,7 +753,7 @@ OUString SwCrsrShell::GetBoxNms() const
         } while ( pFrm && !pFrm->IsCellFrm() );
 
         if( pFrm )
-            sNm += ((SwCellFrm*)pFrm)->GetTabBox()->GetName();
+            sNm += static_cast<SwCellFrm*>(pFrm)->GetTabBox()->GetName();
     }
     return sNm;
 }
@@ -885,10 +885,10 @@ bool SwCrsrShell::EndAllTblBoxEdit()
     SwViewShell *pSh = this;
     do {
         if( pSh->IsA( TYPE( SwCrsrShell ) ) )
-            bRet |= ((SwCrsrShell*)pSh)->CheckTblBoxCntnt(
-                        ((SwCrsrShell*)pSh)->m_pCurCrsr->GetPoint() );
+            bRet |= static_cast<SwCrsrShell*>(pSh)->CheckTblBoxCntnt(
+                        static_cast<SwCrsrShell*>(pSh)->m_pCurCrsr->GetPoint() );
 
-    } while( this != (pSh = (SwViewShell *)pSh->GetNext()) );
+    } while( this != (pSh = static_cast<SwViewShell *>(pSh->GetNext())) );
     return bRet;
 }
 
diff --git a/sw/source/core/crsr/viscrs.cxx b/sw/source/core/crsr/viscrs.cxx
index c102401..4c2854a 100644
--- a/sw/source/core/crsr/viscrs.cxx
+++ b/sw/source/core/crsr/viscrs.cxx
@@ -138,7 +138,7 @@ void SwVisCrsr::_SetPosAndShow()
             const SwFrm* pFrm = rTNd.getLayoutFrm( m_pCrsrShell->GetLayout(), 0, 0, false );
             if ( pFrm )
             {
-                const SwScriptInfo* pSI = ((SwTxtFrm*)pFrm)->GetScriptInfo();
+                const SwScriptInfo* pSI = static_cast<const SwTxtFrm*>(pFrm)->GetScriptInfo();
                  // cursor level has to be shown
                 if ( pSI && pSI->CountDirChg() > 1 )
                 {
@@ -177,7 +177,7 @@ void SwVisCrsr::_SetPosAndShow()
     if ( !m_pCrsrShell->IsCrsrReadonly()  || m_pCrsrShell->GetViewOptions()->IsSelectionInReadonly() )
     {
         if ( m_pCrsrShell->GetDrawView() )
-            ((SwDrawView*)m_pCrsrShell->GetDrawView())->SetAnimationEnabled(
+            const_cast<SwDrawView*>(static_cast<const SwDrawView*>(m_pCrsrShell->GetDrawView()))->SetAnimationEnabled(
                     !m_pCrsrShell->IsSelection() );
 
         sal_uInt16 nStyle = m_bIsDragCrsr ? CURSOR_SHADOW : 0;
@@ -598,7 +598,7 @@ short SwShellCrsr::MaxReplaceArived()
             for( nActCnt = 0; pSh->ActionPend(); ++nActCnt )
                 pSh->EndAction();
             aArr.push_back( nActCnt );
-        } while( pShell != ( pSh = (SwViewShell*)pSh->GetNext() ) );
+        } while( pShell != ( pSh = static_cast<SwViewShell*>(pSh->GetNext()) ) );
 
         {
             nRet = MessageDialog(pDlg, "AskSearchDialog",
@@ -609,7 +609,7 @@ short SwShellCrsr::MaxReplaceArived()
         {
             for( nActCnt = aArr[n]; nActCnt--; )
                 pSh->StartAction();
-            pSh = (SwViewShell*)pSh->GetNext();
+            pSh = static_cast<SwViewShell*>(pSh->GetNext());
         }
     }
     else


More information about the Libreoffice-commits mailing list