diff options
62 files changed, 198 insertions, 198 deletions
diff --git a/sw/source/core/crsr/trvlfnfl.cxx b/sw/source/core/crsr/trvlfnfl.cxx index 28a703679a76..4df1c3e6aa71 100644 --- a/sw/source/core/crsr/trvlfnfl.cxx +++ b/sw/source/core/crsr/trvlfnfl.cxx @@ -136,7 +136,7 @@ bool SwCursor::GotoFootnoteAnchor() { SwCursorSaveState aSaveState( *this ); - SwTextNode& rTNd = (SwTextNode&)pTextFootnote->GetTextNode(); + SwTextNode& rTNd = const_cast<SwTextNode&>(pTextFootnote->GetTextNode()); GetPoint()->nNode = rTNd; GetPoint()->nContent.Assign( &rTNd, pTextFootnote->GetStart() ); @@ -225,7 +225,7 @@ bool SwCursor::GotoNextFootnoteAnchor() { SwCursorSaveState aSaveState( *this ); - SwTextNode& rTNd = (SwTextNode&)pTextFootnote->GetTextNode(); + SwTextNode& rTNd = const_cast<SwTextNode&>(pTextFootnote->GetTextNode()); GetPoint()->nNode = rTNd; GetPoint()->nContent.Assign( &rTNd, pTextFootnote->GetStart() ); bRet = !IsSelOvr(); @@ -282,7 +282,7 @@ bool SwCursor::GotoPrevFootnoteAnchor() { SwCursorSaveState aSaveState( *this ); - SwTextNode& rTNd = (SwTextNode&)pTextFootnote->GetTextNode(); + SwTextNode& rTNd = const_cast<SwTextNode&>(pTextFootnote->GetTextNode()); GetPoint()->nNode = rTNd; GetPoint()->nContent.Assign( &rTNd, pTextFootnote->GetStart() ); bRet = !IsSelOvr(); diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx index 4694f5593d10..49d8b4fedfab 100644 --- a/sw/source/core/doc/DocumentContentOperationsManager.cxx +++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx @@ -748,7 +748,7 @@ namespace RedlineFlags eOld = pDoc->getIDocumentRedlineAccess().GetRedlineFlags(); pDoc->getIDocumentRedlineAccess().SetRedlineFlags_intern( ( eOld & ~RedlineFlags::Ignore) | RedlineFlags::On ); - SwRedlineTable& rRedlTable = (SwRedlineTable&)pDoc->getIDocumentRedlineAccess().GetRedlineTable(); + SwRedlineTable& rRedlTable = pDoc->getIDocumentRedlineAccess().GetRedlineTable(); do { SwRangeRedline* pTmp = rRedlTable[ nRedlPos ]; @@ -871,7 +871,7 @@ namespace // delete it if( bDelFootnote ) { - SwTextNode& rTextNd = (SwTextNode&)pSrch->GetTextNode(); + SwTextNode& rTextNd = const_cast<SwTextNode&>(pSrch->GetTextNode()); SwIndex aIdx( &rTextNd, nFootnoteSttIdx ); rTextNd.EraseText( aIdx, 1 ); } @@ -899,7 +899,7 @@ namespace if( bDelFootnote ) { // delete it - SwTextNode& rTextNd = (SwTextNode&)pSrch->GetTextNode(); + SwTextNode& rTextNd = const_cast<SwTextNode&>(pSrch->GetTextNode()); SwIndex aIdx( &rTextNd, nFootnoteSttIdx ); rTextNd.EraseText( aIdx, 1 ); } diff --git a/sw/source/core/doc/DocumentLinksAdministrationManager.cxx b/sw/source/core/doc/DocumentLinksAdministrationManager.cxx index e1d1a19b6a3a..02a5dac0a256 100644 --- a/sw/source/core/doc/DocumentLinksAdministrationManager.cxx +++ b/sw/source/core/doc/DocumentLinksAdministrationManager.cxx @@ -500,7 +500,7 @@ bool DocumentLinksAdministrationManager::SelectServerObj( const OUString& rStr, } else if( sCmp == "outline" ) { - SwPosition aPos( SwNodeIndex( (SwNodes&)m_rDoc.GetNodes() )); + SwPosition aPos( SwNodeIndex( m_rDoc.GetNodes() )); if( m_rDoc.GotoOutline( aPos, sName )) { SwNode* pNd = &aPos.nNode.GetNode(); diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx index d5e5cb40cf4e..de6c6324d067 100644 --- a/sw/source/core/doc/doccomp.cxx +++ b/sw/source/core/doc/doccomp.cxx @@ -1579,7 +1579,7 @@ void CompareData::CheckForChangesInLine( const CompareData& rData, sal_uLong& rStt, sal_uLong& rEnd, sal_uLong& rThisStt, sal_uLong& rThisEnd ) { - LineArrayComparator aCmp( (CompareData&)*this, rData, rThisStt, rThisEnd, + LineArrayComparator aCmp( *this, rData, rThisStt, rThisEnd, rStt, rEnd ); int nMinLen = std::min( aCmp.GetLen1(), aCmp.GetLen2() ); @@ -1857,7 +1857,7 @@ long SwDoc::CompareDoc( const SwDoc& rDoc ) GetIDocumentUndoRedo().StartUndo(SwUndoId::EMPTY, nullptr); bool bDocWasModified = getIDocumentState().IsModified(); - SwDoc& rSrcDoc = (SwDoc&)rDoc; + SwDoc& rSrcDoc = const_cast<SwDoc&>(rDoc); bool bSrcModified = rSrcDoc.getIDocumentState().IsModified(); RedlineFlags eSrcRedlMode = rSrcDoc.getIDocumentRedlineAccess().GetRedlineFlags(); @@ -2080,7 +2080,7 @@ long SwDoc::MergeDoc( const SwDoc& rDoc ) GetIDocumentUndoRedo().StartUndo(SwUndoId::EMPTY, nullptr); - SwDoc& rSrcDoc = (SwDoc&)rDoc; + SwDoc& rSrcDoc = const_cast<SwDoc&>(rDoc); bool bSrcModified = rSrcDoc.getIDocumentState().IsModified(); RedlineFlags eSrcRedlMode = rSrcDoc.getIDocumentRedlineAccess().GetRedlineFlags(); diff --git a/sw/source/core/doc/docfly.cxx b/sw/source/core/doc/docfly.cxx index a39db5f8b0f1..cfe3ca7ba717 100644 --- a/sw/source/core/doc/docfly.cxx +++ b/sw/source/core/doc/docfly.cxx @@ -882,8 +882,8 @@ bool SwDoc::ChgAnchor( const SdrMarkList& _rMrkList, } else { - SwContentNode &rCNd = (SwContentNode&) - *static_cast<const SwContentFrame*>(pNewAnchorFrame)->GetNode(); + SwContentNode &rCNd = const_cast<SwContentNode&>( + *static_cast<const SwContentFrame*>(pNewAnchorFrame)->GetNode()); if ( pNewAnchorFrame->Frame().Bottom() < aPt.Y() ) rCNd.MakeStartIndex( &aPos.nContent ); else diff --git a/sw/source/core/doc/docfmt.cxx b/sw/source/core/doc/docfmt.cxx index 59dec3745cd9..ef366c600c1d 100644 --- a/sw/source/core/doc/docfmt.cxx +++ b/sw/source/core/doc/docfmt.cxx @@ -1232,7 +1232,7 @@ SwTextFormatColl* SwDoc::CopyTextColl( const SwTextFormatColl& rColl ) /// copy the graphic nodes SwGrfFormatColl* SwDoc::CopyGrfColl( const SwGrfFormatColl& rColl ) { - SwGrfFormatColl* pNewColl = static_cast<SwGrfFormatColl*>(FindFormatByName( (SwFormatsBase&)*mpGrfFormatCollTable, rColl.GetName() )); + SwGrfFormatColl* pNewColl = static_cast<SwGrfFormatColl*>(FindFormatByName( static_cast<SwFormatsBase const &>(*mpGrfFormatCollTable), rColl.GetName() )); if( pNewColl ) return pNewColl; diff --git a/sw/source/core/doc/docnew.cxx b/sw/source/core/doc/docnew.cxx index 3d7b813fe964..f4a6095dfe62 100644 --- a/sw/source/core/doc/docnew.cxx +++ b/sw/source/core/doc/docnew.cxx @@ -178,10 +178,10 @@ void StartGrammarChecking( SwDoc &rDoc ) */ static void lcl_DelFormatIndices( SwFormat* pFormat ) { - SwFormatContent &rFormatContent = (SwFormatContent&)pFormat->GetContent(); + SwFormatContent &rFormatContent = const_cast<SwFormatContent&>(pFormat->GetContent()); if ( rFormatContent.GetContentIdx() ) rFormatContent.SetNewContentIdx( nullptr ); - SwFormatAnchor &rFormatAnchor = (SwFormatAnchor&)pFormat->GetAnchor(); + SwFormatAnchor &rFormatAnchor = const_cast<SwFormatAnchor&>(pFormat->GetAnchor()); if ( rFormatAnchor.GetContentAnchor() ) rFormatAnchor.SetAnchor( nullptr ); } diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx index afaf60bfa94d..dd833bb1af85 100644 --- a/sw/source/core/doc/docnum.cxx +++ b/sw/source/core/doc/docnum.cxx @@ -1897,7 +1897,7 @@ bool SwDoc::MoveParagraph( const SwPaM& rPam, long nOffset, bool bIsOutlMv ) SwPaM aPam( pStt->nNode, aMvRg.aEnd ); - SwPaM& rOrigPam = (SwPaM&)rPam; + SwPaM& rOrigPam = const_cast<SwPaM&>(rPam); rOrigPam.DeleteMark(); rOrigPam.GetPoint()->nNode = aIdx.GetIndex() - 1; diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx index e343f15a5116..625d668f216c 100644 --- a/sw/source/core/doc/tblrwcl.cxx +++ b/sw/source/core/doc/tblrwcl.cxx @@ -2058,7 +2058,7 @@ bool SwTable::MakeCopy( SwDoc* pInsDoc, const SwPosition& rPos, FndBox_ aFndBox( nullptr, nullptr ); { FndPara aPara( rSelBoxes, &aFndBox ); - ForEach_FndLineCopyCol( (SwTableLines&)GetTabLines(), &aPara ); + ForEach_FndLineCopyCol( const_cast<SwTableLines&>(GetTabLines()), &aPara ); } if( aFndBox.GetLines().empty() ) return false; diff --git a/sw/source/core/docnode/ndcopy.cxx b/sw/source/core/docnode/ndcopy.cxx index 86837982e842..737c8cd9abaa 100644 --- a/sw/source/core/docnode/ndcopy.cxx +++ b/sw/source/core/docnode/ndcopy.cxx @@ -235,7 +235,7 @@ static void lcl_CopyTableLine( const SwTableLine* pLine, CopyTable* pCT ) SwTableNode* SwTableNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const { // In which array are we? Nodes? UndoNodes? - SwNodes& rNds = (SwNodes&)GetNodes(); + SwNodes& rNds = const_cast<SwNodes&>(GetNodes()); { if( rIdx < pDoc->GetNodes().GetEndOfInserts().GetIndex() && @@ -262,7 +262,7 @@ SwTableNode* SwTableNode::MakeCopy( SwDoc* pDoc, const SwNodeIndex& rIdx ) const SwEndNode* pEndNd = new SwEndNode( rIdx, *pTableNd ); SwNodeIndex aInsPos( *pEndNd ); - SwTable& rTable = (SwTable&)pTableNd->GetTable(); + SwTable& rTable = pTableNd->GetTable(); rTable.RegisterToFormat( *pTableFormat ); rTable.SetRowsToRepeat( GetTable().GetRowsToRepeat() ); diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index 90b952ab52e7..9d427e613372 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -167,7 +167,7 @@ lcl_SetDfltBoxAttr(SwTableBox& rBox, DfltBoxAttrList_t & rBoxFormatArr, pNewTableBoxFormat->SetFormatAttr( pBoxFrameFormat->GetAttrSet().Get( RES_FRM_SIZE ) ); if( pAutoFormat ) - pAutoFormat->UpdateToSet( nId, (SfxItemSet&)pNewTableBoxFormat->GetAttrSet(), + pAutoFormat->UpdateToSet( nId, const_cast<SfxItemSet&>(static_cast<SfxItemSet const &>(pNewTableBoxFormat->GetAttrSet())), SwTableAutoFormat::UPDATE_BOX, pDoc->GetNumberFormatter() ); else @@ -200,7 +200,7 @@ static SwTableBoxFormat *lcl_CreateAFormatBoxFormat( SwDoc &rDoc, std::vector<Sw if( !rBoxFormatArr[nId] ) { SwTableBoxFormat* pBoxFormat = rDoc.MakeTableBoxFormat(); - rAutoFormat.UpdateToSet( nId, (SfxItemSet&)pBoxFormat->GetAttrSet(), + rAutoFormat.UpdateToSet( nId, const_cast<SfxItemSet&>(static_cast<SfxItemSet const &>(pBoxFormat->GetAttrSet())), SwTableAutoFormat::UPDATE_BOX, rDoc.GetNumberFormatter( ) ); if( USHRT_MAX != nCols ) @@ -671,8 +671,8 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTableOpts, || pEnd->nNode.GetIndex() >= GetNodes().GetEndOfContent().GetIndex()-1 ) { getIDocumentContentOperations().SplitNode( *pEnd, false ); - --((SwNodeIndex&)pEnd->nNode); - ((SwIndex&)pEnd->nContent).Assign( + --const_cast<SwNodeIndex&>(pEnd->nNode); + const_cast<SwIndex&>(pEnd->nContent).Assign( pEnd->nNode.GetNode().GetContentNode(), 0 ); // A Node and at the End? if( pStt->nNode.GetIndex() >= pEnd->nNode.GetIndex() ) @@ -868,7 +868,7 @@ const SwTable* SwDoc::TextToTable( const SwInsertTableOptions& rInsTableOpts, aNode2Layout.RestoreUpperFrames( GetNodes(), nIdx, nIdx + 1 ); { - SwPaM& rTmp = (SwPaM&)rRange; // Point always at the Start + SwPaM& rTmp = const_cast<SwPaM&>(rRange); // Point always at the Start rTmp.DeleteMark(); rTmp.GetPoint()->nNode = *pTableNd; SwContentNode* pCNd = GetNodes().GoNext( &rTmp.GetPoint()->nNode ); @@ -1168,8 +1168,8 @@ const SwTable* SwDoc::TextToTable( const std::vector< std::vector<SwNodeRange> > || pEnd->nNode.GetIndex() >= GetNodes().GetEndOfContent().GetIndex()-1 ) { getIDocumentContentOperations().SplitNode( *pEnd, false ); - --((SwNodeIndex&)pEnd->nNode); - ((SwIndex&)pEnd->nContent).Assign( + --const_cast<SwNodeIndex&>(pEnd->nNode); + const_cast<SwIndex&>(pEnd->nContent).Assign( pEnd->nNode.GetNode().GetContentNode(), 0 ); // A Node and at the End? if( pStt->nNode.GetIndex() >= pEnd->nNode.GetIndex() ) @@ -3662,7 +3662,7 @@ struct SetAFormatTabPara sal_uInt8 nAFormatLine, nAFormatBox; explicit SetAFormatTabPara( const SwTableAutoFormat& rNew ) - : rTableFormat( (SwTableAutoFormat&)rNew ), pUndo( nullptr ), + : rTableFormat( const_cast<SwTableAutoFormat&>(rNew) ), pUndo( nullptr ), nEndBox( 0 ), nCurBox( 0 ), nAFormatLine( 0 ), nAFormatBox( 0 ) {} }; diff --git a/sw/source/core/docnode/ndtbl1.cxx b/sw/source/core/docnode/ndtbl1.cxx index 44b9d0844a86..ce875b467711 100644 --- a/sw/source/core/docnode/ndtbl1.cxx +++ b/sw/source/core/docnode/ndtbl1.cxx @@ -227,7 +227,7 @@ static void lcl_CollectLines( std::vector<SwTableLine*> &rArr, const SwCursor& r FndBox_ aFndBox( nullptr, nullptr ); { FndPara aTmpPara( aBoxes, &aFndBox ); - ForEach_FndLineCopyCol( (SwTableLines&)rTable.GetTabLines(), &aTmpPara ); + ForEach_FndLineCopyCol( const_cast<SwTableLines&>(rTable.GetTabLines()), &aTmpPara ); } // Collect the Lines which only contain selected Boxes @@ -329,7 +329,7 @@ void SwDoc::GetRowSplit( const SwCursor& rCursor, SwFormatRowSplit *& rpSz ) if( !aRowArr.empty() ) { - rpSz = &(SwFormatRowSplit&)aRowArr[0]->GetFrameFormat()->GetRowSplit(); + rpSz = &const_cast<SwFormatRowSplit&>(aRowArr[0]->GetFrameFormat()->GetRowSplit()); if (rpSz) { @@ -401,7 +401,7 @@ void SwDoc::GetRowHeight( const SwCursor& rCursor, SwFormatFrameSize *& rpSz ) if( !aRowArr.empty() ) { - rpSz = &(SwFormatFrameSize&)aRowArr[0]->GetFrameFormat()->GetFrameSize(); + rpSz = &const_cast<SwFormatFrameSize&>(aRowArr[0]->GetFrameFormat()->GetFrameSize()); if (rpSz) { diff --git a/sw/source/core/edit/edtox.cxx b/sw/source/core/edit/edtox.cxx index e37d8884859c..bd3c90a24499 100644 --- a/sw/source/core/edit/edtox.cxx +++ b/sw/source/core/edit/edtox.cxx @@ -205,7 +205,7 @@ const SwTOXBase* SwEditShell::GetCurTOX() const bool SwEditShell::DeleteTOX( const SwTOXBase& rTOXBase, bool bDelNodes ) { - return GetDoc()->DeleteTOX( (SwTOXBase&)rTOXBase, bDelNodes ); + return GetDoc()->DeleteTOX( rTOXBase, bDelNodes ); } // manage types of listings diff --git a/sw/source/core/fields/docufld.cxx b/sw/source/core/fields/docufld.cxx index a9d41cbece2e..274984d874f8 100644 --- a/sw/source/core/fields/docufld.cxx +++ b/sw/source/core/fields/docufld.cxx @@ -734,7 +734,7 @@ OUString SwDocStatFieldType::Expand(sal_uInt16 nSubType, SvxNumType nFormat) con case DS_CHAR: nVal = rDStat.nChar; break; case DS_PAGE: if( pDoc->getIDocumentLayoutAccess().GetCurrentLayout() ) - ((SwDocStat &)rDStat).nPage = pDoc->getIDocumentLayoutAccess().GetCurrentLayout()->GetPageNum(); + const_cast<SwDocStat &>(rDStat).nPage = pDoc->getIDocumentLayoutAccess().GetCurrentLayout()->GetPageNum(); nVal = rDStat.nPage; if( SVX_NUM_PAGEDESC == nFormat ) nFormat = nNumberingType; diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx index 024c895d618b..b0d3a3a8e0f3 100644 --- a/sw/source/core/frmedt/fefly1.cxx +++ b/sw/source/core/frmedt/fefly1.cxx @@ -736,7 +736,7 @@ const SwFrameFormat *SwFEShell::NewFlyFrame( const SfxItemSet& rSet, bool bAnchV if( bVOriChgd ) const_cast<SfxItemSet&>(rSet).Put( aOldV ); - GetDoc()->SetFlyFrameAttr( *pRet, (SfxItemSet&)rSet ); + GetDoc()->SetFlyFrameAttr( *pRet, const_cast<SfxItemSet&>(rSet) ); GetDoc()->GetIDocumentUndoRedo().DoUndo(bDoesUndo); } delete pOldAnchor; diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx index aa9ee085049b..813dcc658a8d 100644 --- a/sw/source/core/frmedt/feshview.cxx +++ b/sw/source/core/frmedt/feshview.cxx @@ -799,7 +799,7 @@ const SwFrameFormat* SwFEShell::SelFlyGrabCursor() pCursor->GetPoint()->nNode = *pCNode; pCursor->GetPoint()->nContent.Assign( pCNode, 0 ); - SwRect& rChrRect = (SwRect&)GetCharRect(); + SwRect& rChrRect = const_cast<SwRect&>(GetCharRect()); rChrRect = pFly->Prt(); rChrRect.Pos() += pFly->Frame().Pos(); GetCursorDocPos() = rChrRect.Pos(); @@ -2126,7 +2126,7 @@ bool SwFEShell::EndMark() SwDrawView* pDView = Imp()->GetDrawView(); // frames are not selected this way, except when // it is only one frame - SdrMarkList &rMrkList = (SdrMarkList&)pDView->GetMarkedObjectList(); + SdrMarkList &rMrkList = const_cast<SdrMarkList&>(pDView->GetMarkedObjectList()); SwFlyFrame* pOldSelFly = ::GetFlyFromMarked( &rMrkList, this ); if ( rMrkList.GetMarkCount() > 1 ) @@ -2487,7 +2487,7 @@ bool SwFEShell::GotoFly( const OUString& rName, FlyCntType eType, bool bSelFrame pCursor->GetPoint()->nNode = *pCNode; pCursor->GetPoint()->nContent.Assign( pCNode, 0 ); - SwRect& rChrRect = (SwRect&)GetCharRect(); + SwRect& rChrRect = const_cast<SwRect&>(GetCharRect()); rChrRect = pFrame->Prt(); rChrRect.Pos() += pFrame->Frame().Pos(); GetCursorDocPos() = rChrRect.Pos(); diff --git a/sw/source/core/frmedt/tblsel.cxx b/sw/source/core/frmedt/tblsel.cxx index 5055c0740328..5bdbcae41257 100644 --- a/sw/source/core/frmedt/tblsel.cxx +++ b/sw/source/core/frmedt/tblsel.cxx @@ -1445,7 +1445,7 @@ TableMergeErr CheckMergeSel( const SwSelBoxes& rBoxes ) FndBox_ aFndBox( nullptr, nullptr ); FndPara aPara( rBoxes, &aFndBox ); const SwTableNode* pTableNd = aPara.rBoxes[0]->GetSttNd()->FindTableNode(); - ForEach_FndLineCopyCol( (SwTableLines&)pTableNd->GetTable().GetTabLines(), &aPara ); + ForEach_FndLineCopyCol( const_cast<SwTableLines&>(pTableNd->GetTable().GetTabLines()), &aPara ); if( !aFndBox.GetLines().empty() ) { bool bMergeSelOk = true; diff --git a/sw/source/core/layout/atrfrm.cxx b/sw/source/core/layout/atrfrm.cxx index 2f6516d4f22a..1a459f5d14cb 100644 --- a/sw/source/core/layout/atrfrm.cxx +++ b/sw/source/core/layout/atrfrm.cxx @@ -127,7 +127,7 @@ static void lcl_DelHFFormat( SwClient *pToRemove, SwFrameFormat *pFormat ) { // If there is a Cursor registered in one of the nodes, we need to call the // ParkCursor in an (arbitrary) shell. - SwFormatContent& rCnt = (SwFormatContent&)pFormat->GetContent(); + SwFormatContent& rCnt = const_cast<SwFormatContent&>(pFormat->GetContent()); if ( rCnt.GetContentIdx() ) { SwNode *pNode = nullptr; diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx index 14790e03eed2..78566f1a1535 100644 --- a/sw/source/core/layout/ftnfrm.cxx +++ b/sw/source/core/layout/ftnfrm.cxx @@ -2812,7 +2812,7 @@ const SwContentFrame* SwFootnoteFrame::GetRefFromAttr() const SwContentFrame* SwFootnoteFrame::GetRefFromAttr() { assert(pAttr && "invalid Attribute"); - SwTextNode& rTNd = (SwTextNode&)pAttr->GetTextNode(); + SwTextNode& rTNd = const_cast<SwTextNode&>(pAttr->GetTextNode()); SwPosition aPos( rTNd, SwIndex( &rTNd, pAttr->GetStart() )); SwContentFrame* pCFrame = rTNd.getLayoutFrame( getRootFrame(), nullptr, &aPos, false ); return pCFrame; diff --git a/sw/source/core/layout/laycache.cxx b/sw/source/core/layout/laycache.cxx index ab8f0e361841..74653f8db268 100644 --- a/sw/source/core/layout/laycache.cxx +++ b/sw/source/core/layout/laycache.cxx @@ -667,7 +667,7 @@ bool SwLayHelper::CheckInsertPage() } // If the page style is changing, we'll have a first page. bool bNextPageFirst = pDesc != mrpPage->GetPageDesc(); - ::InsertNewPage( (SwPageDesc&)*pDesc, mrpPage->GetUpper(), + ::InsertNewPage( const_cast<SwPageDesc&>(*pDesc), mrpPage->GetUpper(), bNextPageOdd, bNextPageFirst, bInsertEmpty, false, mrpPage->GetNext() ); if ( bEnd ) { diff --git a/sw/source/core/layout/pagechg.cxx b/sw/source/core/layout/pagechg.cxx index 906566892ecc..343c157dceae 100644 --- a/sw/source/core/layout/pagechg.cxx +++ b/sw/source/core/layout/pagechg.cxx @@ -1234,7 +1234,7 @@ SwPageFrame *SwFrame::InsertPage( SwPageFrame *pPrevPage, bool bFootnote ) // For ContentFrame take the one from format if provided, // otherwise from the Follow of the PrevPage if ( IsFlowFrame() && !SwFlowFrame::CastFlowFrame( this )->IsFollow() ) - { SwFormatPageDesc &rDesc = (SwFormatPageDesc&)GetAttrSet()->GetPageDesc(); + { SwFormatPageDesc &rDesc = const_cast<SwFormatPageDesc&>(GetAttrSet()->GetPageDesc()); pDesc = rDesc.GetPageDesc(); if ( rDesc.GetNumOffset() ) { diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx index 7dd2e43a976c..b94ba4582d85 100644 --- a/sw/source/core/layout/sectfrm.cxx +++ b/sw/source/core/layout/sectfrm.cxx @@ -58,7 +58,7 @@ SwSectionFrame::SwSectionFrame( SwSection &rSect, SwFrame* pSib ) SwSectionFrame::SwSectionFrame( SwSectionFrame &rSect, bool bMaster ) : SwLayoutFrame( rSect.GetFormat(), rSect.getRootFrame() ), - SwFlowFrame( (SwFrame&)*this ), + SwFlowFrame( static_cast<SwFrame&>(*this) ), m_pSection( rSect.GetSection() ), m_bFootnoteAtEnd( rSect.IsFootnoteAtEnd() ), m_bEndnAtEnd( rSect.IsEndnAtEnd() ), diff --git a/sw/source/core/layout/ssfrm.cxx b/sw/source/core/layout/ssfrm.cxx index 2a4fd7421347..b8b3c1ecf8cf 100644 --- a/sw/source/core/layout/ssfrm.cxx +++ b/sw/source/core/layout/ssfrm.cxx @@ -415,7 +415,7 @@ void SwLayoutFrame::SetFrameFormat( SwFrameFormat *pNew ) SwContentFrame::SwContentFrame( SwContentNode * const pContent, SwFrame* pSib ) : SwFrame( pContent, pSib ), - SwFlowFrame( (SwFrame&)*this ) + SwFlowFrame( static_cast<SwFrame&>(*this) ) { } diff --git a/sw/source/core/table/swtable.cxx b/sw/source/core/table/swtable.cxx index d122f66fc4e9..ca0efb0f9353 100644 --- a/sw/source/core/table/swtable.cxx +++ b/sw/source/core/table/swtable.cxx @@ -1632,8 +1632,8 @@ SwTableBox::SwTableBox( SwTableBoxFormat* pFormat, const SwNodeIndex &rIdx, // insert into the table const SwTableNode* pTableNd = m_pStartNode->FindTableNode(); OSL_ENSURE( pTableNd, "In which table is that box?" ); - SwTableSortBoxes& rSrtArr = (SwTableSortBoxes&)pTableNd->GetTable(). - GetTabSortBoxes(); + SwTableSortBoxes& rSrtArr = const_cast<SwTableSortBoxes&>(pTableNd->GetTable(). + GetTabSortBoxes()); SwTableBox* p = this; // error: &this rSrtArr.insert( p ); // insert } @@ -1652,8 +1652,8 @@ SwTableBox::SwTableBox( SwTableBoxFormat* pFormat, const SwStartNode& rSttNd, Sw // insert into the table const SwTableNode* pTableNd = m_pStartNode->FindTableNode(); OSL_ENSURE( pTableNd, "In which table is the box?" ); - SwTableSortBoxes& rSrtArr = (SwTableSortBoxes&)pTableNd->GetTable(). - GetTabSortBoxes(); + SwTableSortBoxes& rSrtArr = const_cast<SwTableSortBoxes&>(pTableNd->GetTable(). + GetTabSortBoxes()); SwTableBox* p = this; // error: &this rSrtArr.insert( p ); // insert } @@ -1665,8 +1665,8 @@ void SwTableBox::RemoveFromTable() // remove from table const SwTableNode* pTableNd = m_pStartNode->FindTableNode(); assert(pTableNd && "In which table is that box?"); - SwTableSortBoxes& rSrtArr = (SwTableSortBoxes&)pTableNd->GetTable(). - GetTabSortBoxes(); + SwTableSortBoxes& rSrtArr = const_cast<SwTableSortBoxes&>(pTableNd->GetTable(). + GetTabSortBoxes()); SwTableBox *p = this; // error: &this rSrtArr.erase( p ); // remove m_pStartNode = nullptr; // clear it so this is only run once diff --git a/sw/source/core/text/frmcrsr.cxx b/sw/source/core/text/frmcrsr.cxx index 2b51799c566c..4481a5cb129b 100644 --- a/sw/source/core/text/frmcrsr.cxx +++ b/sw/source/core/text/frmcrsr.cxx @@ -556,12 +556,12 @@ bool SwTextFrame::GetCursorOfst_(SwPosition* pPos, const Point& rPoint, if ( IsVertical() ) { - SwitchVerticalToHorizontal( (Point&)rPoint ); + SwitchVerticalToHorizontal( const_cast<Point&>(rPoint) ); const_cast<SwTextFrame*>(this)->SwapWidthAndHeight(); } if ( IsRightToLeft() ) - SwitchRTLtoLTR( (Point&)rPoint ); + SwitchRTLtoLTR( const_cast<Point&>(rPoint) ); SwFillData *pFillData = ( pCMS && pCMS->m_pFill ) ? new SwFillData( pCMS, pPos, Frame(), rPoint ) : nullptr; @@ -651,7 +651,7 @@ bool SwTextFrame::GetCursorOfst_(SwPosition* pPos, const Point& rPoint, pFillData->SetOrient( text::HoriOrientation::LEFT ); } - (Point&)rPoint = aOldPoint; + const_cast<Point&>(rPoint) = aOldPoint; delete pFillData; return true; diff --git a/sw/source/core/text/frmpaint.cxx b/sw/source/core/text/frmpaint.cxx index e3f1b146851d..0e9e3d0f86a9 100644 --- a/sw/source/core/text/frmpaint.cxx +++ b/sw/source/core/text/frmpaint.cxx @@ -308,7 +308,7 @@ void SwTextFrame::PaintExtraData( const SwRect &rRect ) const SwRect rOldRect( rRect ); if ( IsVertical() ) - SwitchVerticalToHorizontal( (SwRect&)rRect ); + SwitchVerticalToHorizontal( const_cast<SwRect&>(rRect) ); SwLayoutModeModifier aLayoutModeModifier( *pSh->GetOut() ); aLayoutModeModifier.Modify( false ); @@ -340,7 +340,7 @@ void SwTextFrame::PaintExtraData( const SwRect &rRect ) const aExtra.IncLineNr(); if( !aLine.Next() ) { - (SwRect&)rRect = rOldRect; + const_cast<SwRect&>(rRect) = rOldRect; return; } } @@ -401,7 +401,7 @@ void SwTextFrame::PaintExtraData( const SwRect &rRect ) const aExtra.PaintRedline( Frame().Top()+Prt().Top(), Prt().Height() ); } - (SwRect&)rRect = rOldRect; + const_cast<SwRect&>(rRect) = rOldRect; } } @@ -654,10 +654,10 @@ void SwTextFrame::Paint(vcl::RenderContext& rRenderContext, SwRect const& rRect, SwSwapIfNotSwapped swap(const_cast<SwTextFrame *>(this)); if ( IsVertical() ) - SwitchVerticalToHorizontal( (SwRect&)rRect ); + SwitchVerticalToHorizontal( const_cast<SwRect&>(rRect) ); if ( IsRightToLeft() ) - SwitchRTLtoLTR( (SwRect&)rRect ); + SwitchRTLtoLTR( const_cast<SwRect&>(rRect) ); SwTextPaintInfo aInf( const_cast<SwTextFrame*>(this), rRect ); aInf.SetWrongList( const_cast<SwTextNode*>(GetTextNode())->GetWrong() ); @@ -705,7 +705,7 @@ void SwTextFrame::Paint(vcl::RenderContext& rRenderContext, SwRect const& rRect, rRepaint.Clear(); } - (SwRect&)rRect = aOldRect; + const_cast<SwRect&>(rRect) = aOldRect; OSL_ENSURE( ! IsSwapped(), "A frame is swapped after Paint" ); } diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx index 42245d3a5e7a..4259c4bf8055 100644 --- a/sw/source/core/text/itrform2.cxx +++ b/sw/source/core/text/itrform2.cxx @@ -1401,14 +1401,14 @@ SwLinePortion *SwTextFormatter::NewPortion( SwTextFormatInfo &rInf ) if ( pTextFootnote ) { - SwFormatFootnote& rFootnote = (SwFormatFootnote&)pTextFootnote->GetFootnote(); + SwFormatFootnote& rFootnote = const_cast<SwFormatFootnote&>(pTextFootnote->GetFootnote()); const SwDoc *pDoc = rInf.GetTextFrame()->GetNode()->GetDoc(); const SwEndNoteInfo* pInfo; if( rFootnote.IsEndNote() ) pInfo = &pDoc->GetEndNoteInfo(); else pInfo = &pDoc->GetFootnoteInfo(); - const SwAttrSet& rSet = pInfo->GetAnchorCharFormat((SwDoc&)*pDoc)->GetAttrSet(); + const SwAttrSet& rSet = pInfo->GetAnchorCharFormat(const_cast<SwDoc&>(*pDoc))->GetAttrSet(); const SfxPoolItem* pItem; sal_uInt16 nDir = 0; @@ -1925,9 +1925,9 @@ SwTwips SwTextFormatter::CalcBottomLine() const nRet = nMin - nDist; if( bRepaint ) { - ((SwRepaint&)GetInfo().GetParaPortion() + const_cast<SwRepaint&>(GetInfo().GetParaPortion() ->GetRepaint()).Bottom( nRet-1 ); - ((SwTextFormatInfo&)GetInfo()).SetPaintOfst( 0 ); + const_cast<SwTextFormatInfo&>(GetInfo()).SetPaintOfst( 0 ); } } } diff --git a/sw/source/core/text/porfly.cxx b/sw/source/core/text/porfly.cxx index bc88313a1033..a853b67912ee 100644 --- a/sw/source/core/text/porfly.cxx +++ b/sw/source/core/text/porfly.cxx @@ -228,16 +228,16 @@ void sw::FlyContentPortion::Paint(const SwTextPaintInfo& rInf) const SwLayoutModeModifier aLayoutModeModifier(*rInf.GetOut()); m_pFly->Paint(const_cast<vcl::RenderContext&>(*rInf.GetOut()), aRect); } - ((SwTextPaintInfo&)rInf).GetRefDev()->SetLayoutMode(rInf.GetOut()->GetLayoutMode()); + const_cast<SwTextPaintInfo&>(rInf).GetRefDev()->SetLayoutMode(rInf.GetOut()->GetLayoutMode()); // As the OutputDevice might be anything, the font must be re-selected. // Being in const method should not be a problem. - ((SwTextPaintInfo&)rInf).SelectFont(); + const_cast<SwTextPaintInfo&>(rInf).SelectFont(); assert(rInf.GetVsh()); SAL_WARN_IF(rInf.GetVsh()->GetOut() != rInf.GetOut(), "sw.core", "SwFlyCntPortion::Paint: Outdev has changed"); if(rInf.GetVsh()) - ((SwTextPaintInfo&)rInf).SetOut(rInf.GetVsh()->GetOut()); + const_cast<SwTextPaintInfo&>(rInf).SetOut(rInf.GetVsh()->GetOut()); } } diff --git a/sw/source/core/text/pormulti.cxx b/sw/source/core/text/pormulti.cxx index 542392f19181..39cfecd1217c 100644 --- a/sw/source/core/text/pormulti.cxx +++ b/sw/source/core/text/pormulti.cxx @@ -219,9 +219,9 @@ sal_Int32 SwBidiPortion::GetSpaceCnt( const SwTextSizeInfo &rInf ) const static_cast<SwMultiPortion*>(pPor)->IsBidi() ) nBlanks = nBlanks + static_cast<SwBidiPortion*>(pPor)->GetSpaceCnt( rInf ); - ((SwTextSizeInfo &)rInf).SetIdx( rInf.GetIdx() + pPor->GetLen() ); + const_cast<SwTextSizeInfo &>(rInf).SetIdx( rInf.GetIdx() + pPor->GetLen() ); } - ((SwTextSizeInfo &)rInf).SetIdx( nTmpStart ); + const_cast<SwTextSizeInfo &>(rInf).SetIdx( nTmpStart ); return nBlanks; } diff --git a/sw/source/core/text/portxt.cxx b/sw/source/core/text/portxt.cxx index bcdd4772cd31..d953c7276c6e 100644 --- a/sw/source/core/text/portxt.cxx +++ b/sw/source/core/text/portxt.cxx @@ -184,11 +184,11 @@ static sal_Int32 lcl_AddSpace( const SwTextSizeInfo &rInf, const OUString* pStr, if ( CH_TXTATR_BREAKWORD == rInf.GetChar( nPos ) && pPor->InExpGrp() ) { bool bOldOnWin = rInf.OnWin(); - ((SwTextSizeInfo &)rInf).SetOnWin( false ); + const_cast<SwTextSizeInfo &>(rInf).SetOnWin( false ); OUString aStr; pPor->GetExpText( rInf, aStr ); - ((SwTextSizeInfo &)rInf).SetOnWin( bOldOnWin ); + const_cast<SwTextSizeInfo &>(rInf).SetOnWin( bOldOnWin ); nNextScript = (sal_uInt8)g_pBreakIt->GetBreakIter()->getScriptType( aStr, 0 ); } @@ -580,11 +580,11 @@ sal_Int32 SwTextPortion::GetSpaceCnt( const SwTextSizeInfo &rInf, // OnWin() likes to return a blank instead of an empty string from // time to time. We cannot use that here at all, however. bool bOldOnWin = rInf.OnWin(); - ((SwTextSizeInfo &)rInf).SetOnWin( false ); + const_cast<SwTextSizeInfo &>(rInf).SetOnWin( false ); OUString aStr; GetExpText( rInf, aStr ); - ((SwTextSizeInfo &)rInf).SetOnWin( bOldOnWin ); + const_cast<SwTextSizeInfo &>(rInf).SetOnWin( bOldOnWin ); nCnt = nCnt + lcl_AddSpace( rInf, &aStr, *this ); nPos = aStr.getLength(); @@ -617,11 +617,11 @@ long SwTextPortion::CalcSpacing( long nSpaceAdd, const SwTextSizeInfo &rInf ) co // OnWin() likes to return a blank instead of an empty string from // time to time. We cannot use that here at all, however. bool bOldOnWin = rInf.OnWin(); - ((SwTextSizeInfo &)rInf).SetOnWin( false ); + const_cast<SwTextSizeInfo &>(rInf).SetOnWin( false ); OUString aStr; GetExpText( rInf, aStr ); - ((SwTextSizeInfo &)rInf).SetOnWin( bOldOnWin ); + const_cast<SwTextSizeInfo &>(rInf).SetOnWin( bOldOnWin ); if( nSpaceAdd > 0 ) nCnt = nCnt + lcl_AddSpace( rInf, &aStr, *this ); else diff --git a/sw/source/core/text/txtftn.cxx b/sw/source/core/text/txtftn.cxx index d329543cb453..9c91e98b97f8 100644 --- a/sw/source/core/text/txtftn.cxx +++ b/sw/source/core/text/txtftn.cxx @@ -938,7 +938,7 @@ SwNumberPortion *SwTextFormatter::NewFootnoteNumPortion( SwTextFormatInfo &rInf const SwTextFootnote* pFootnote = pFootnoteFrame->GetAttr(); // Aha! So we're in the Footnote Area! - SwFormatFootnote& rFootnote = (SwFormatFootnote&)pFootnote->GetFootnote(); + SwFormatFootnote& rFootnote = const_cast<SwFormatFootnote&>(pFootnote->GetFootnote()); SwDoc *pDoc = m_pFrame->GetNode()->GetDoc(); OUString aFootnoteText( rFootnote.GetViewNumStr( *pDoc, true )); @@ -1248,17 +1248,17 @@ SwFootnoteSave::SwFootnoteSave( const SwTextSizeInfo &rInf, const SwTextFootnote* pTextFootnote, const bool bApplyGivenScriptType, const SwFontScript nGivenScriptType ) - : pInf( &((SwTextSizeInfo&)rInf) ) + : pInf( &const_cast<SwTextSizeInfo&>(rInf) ) , pFnt( nullptr ) , pOld( nullptr ) { if( pTextFootnote && rInf.GetTextFrame() ) { - pFnt = ((SwTextSizeInfo&)rInf).GetFont(); + pFnt = const_cast<SwTextSizeInfo&>(rInf).GetFont(); pOld = new SwFont( *pFnt ); pOld->GetTox() = pFnt->GetTox(); pFnt->GetTox() = 0; - SwFormatFootnote& rFootnote = (SwFormatFootnote&)pTextFootnote->GetFootnote(); + SwFormatFootnote& rFootnote = const_cast<SwFormatFootnote&>(pTextFootnote->GetFootnote()); const SwDoc *pDoc = rInf.GetTextFrame()->GetNode()->GetDoc(); // #i98418# @@ -1278,7 +1278,7 @@ SwFootnoteSave::SwFootnoteSave( const SwTextSizeInfo &rInf, pInfo = &pDoc->GetEndNoteInfo(); else pInfo = &pDoc->GetFootnoteInfo(); - const SwAttrSet& rSet = pInfo->GetAnchorCharFormat((SwDoc&)*pDoc)->GetAttrSet(); + const SwAttrSet& rSet = pInfo->GetAnchorCharFormat(const_cast<SwDoc&>(*pDoc))->GetAttrSet(); pFnt->SetDiffFnt( &rSet, rInf.GetTextFrame()->GetNode()->getIDocumentSettingAccess() ); // we reduce footnote size, if we are inside a double line portion diff --git a/sw/source/core/text/txthyph.cxx b/sw/source/core/text/txthyph.cxx index b8e62040b3a7..a3ea58fc044f 100644 --- a/sw/source/core/text/txthyph.cxx +++ b/sw/source/core/text/txthyph.cxx @@ -293,7 +293,7 @@ bool SwTextPortion::CreateHyphen( SwTextFormatInfo &rInf, SwTextGuess &rGuess ) // length of pHyphPor is adjusted pHyphPor->SetLen( aAltText.getLength() + 1 ); - (SwPosSize&)(*pHyphPor) = pHyphPor->GetTextSize( rInf ); + static_cast<SwPosSize&>(*pHyphPor) = pHyphPor->GetTextSize( rInf ); pHyphPor->SetLen( aAltSpell.nChangedLength + nTmpLen ); } else @@ -309,7 +309,7 @@ bool SwTextPortion::CreateHyphen( SwTextFormatInfo &rInf, SwTextGuess &rGuess ) rInf.GetFont()->GetMagic( pTmpMagic, nFntIdx, rInf.GetFont()->GetActual() ); if( !pLastMagicNo || pLastMagicNo != pTmpMagic ) { pLastMagicNo = pTmpMagic; - (SwPosSize&)(*pHyphPor) = pHyphPor->GetTextSize( rInf ); + static_cast<SwPosSize&>(*pHyphPor) = pHyphPor->GetTextSize( rInf ); aMiniCacheH = pHyphPor->Height(); aMiniCacheW = pHyphPor->Width(); } else { diff --git a/sw/source/core/text/txtpaint.cxx b/sw/source/core/text/txtpaint.cxx index f503b4121699..1bafd80929db 100644 --- a/sw/source/core/text/txtpaint.cxx +++ b/sw/source/core/text/txtpaint.cxx @@ -46,14 +46,14 @@ void SwSaveClip::ChgClip_( const SwRect &rRect, const SwTextFrame* pFrame, const bool bVertical = pFrame && pFrame->IsVertical(); if ( pFrame && pFrame->IsRightToLeft() ) - pFrame->SwitchLTRtoRTL( (SwRect&)rRect ); + pFrame->SwitchLTRtoRTL( const_cast<SwRect&>(rRect) ); if ( bVertical ) - pFrame->SwitchHorizontalToVertical( (SwRect&)rRect ); + pFrame->SwitchHorizontalToVertical( const_cast<SwRect&>(rRect) ); if ( !pOut || (!rRect.HasArea() && !pOut->IsClipRegion()) ) { - (SwRect&)rRect = aOldRect; + const_cast<SwRect&>(rRect) = aOldRect; return; } @@ -82,7 +82,7 @@ void SwSaveClip::ChgClip_( const SwRect &rRect, const SwTextFrame* pFrame, { if ( aRect == pOut->GetClipRegion().GetBoundRect() ) { - (SwRect&)rRect = aOldRect; + const_cast<SwRect&>(rRect) = aOldRect; return; } } @@ -105,7 +105,7 @@ void SwSaveClip::ChgClip_( const SwRect &rRect, const SwTextFrame* pFrame, } bChg = true; - (SwRect&)rRect = aOldRect; + const_cast<SwRect&>(rRect) = aOldRect; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/txtnode/atrfld.cxx b/sw/source/core/txtnode/atrfld.cxx index c522486a839d..1719074eb0a2 100644 --- a/sw/source/core/txtnode/atrfld.cxx +++ b/sw/source/core/txtnode/atrfld.cxx @@ -414,7 +414,7 @@ void SwTextField::CopyTextField( SwTextField *pDest ) const IDocumentFieldsAccess* pIDFA = &m_pTextNode->getIDocumentFieldsAccess(); IDocumentFieldsAccess* pDestIDFA = &pDest->m_pTextNode->getIDocumentFieldsAccess(); - SwFormatField& rDestFormatField = (SwFormatField&)pDest->GetFormatField(); + SwFormatField& rDestFormatField = const_cast<SwFormatField&>(pDest->GetFormatField()); const SwFieldIds nFieldWhich = rDestFormatField.GetField()->GetTyp()->Which(); if( pIDFA != pDestIDFA ) diff --git a/sw/source/core/txtnode/atrflyin.cxx b/sw/source/core/txtnode/atrflyin.cxx index eca7534bcbba..b4ca1e96e704 100644 --- a/sw/source/core/txtnode/atrflyin.cxx +++ b/sw/source/core/txtnode/atrflyin.cxx @@ -124,7 +124,7 @@ void SwTextFlyCnt::CopyFlyFormat( SwDoc* pDoc ) } SwFrameFormat* pNew = pDoc->getIDocumentLayoutAccess().CopyLayoutFormat( *pFormat, aAnchor, false, false ); - ((SwFormatFlyCnt&)GetFlyCnt()).SetFlyFormat( pNew ); + const_cast<SwFormatFlyCnt&>(GetFlyCnt()).SetFlyFormat( pNew ); } /** SetAnchor() is called by SwTextNode::InsertHint() and sets the anchor @@ -176,7 +176,7 @@ void SwTextFlyCnt::SetAnchor( const SwTextNode *pNode ) ::sw::UndoGuard const undoGuardFormat( pFormat->GetDoc()->GetIDocumentUndoRedo()); pFormat->GetDoc()->getIDocumentLayoutAccess().DelLayoutFormat( pFormat ); - ((SwFormatFlyCnt&)GetFlyCnt()).SetFlyFormat( pNew ); + const_cast<SwFormatFlyCnt&>(GetFlyCnt()).SetFlyFormat( pNew ); } else if( pNode->GetpSwpHints() && pNode->GetpSwpHints()->IsInSplitNode() && diff --git a/sw/source/core/txtnode/atrftn.cxx b/sw/source/core/txtnode/atrftn.cxx index 5c8aa1ecbaf9..0c1c034a6e91 100644 --- a/sw/source/core/txtnode/atrftn.cxx +++ b/sw/source/core/txtnode/atrftn.cxx @@ -328,7 +328,7 @@ void SwTextFootnote::SetStartNode( const SwNodeIndex *pNewNode, bool bDelNode ) void SwTextFootnote::SetNumber( const sal_uInt16 nNewNum, const OUString &sNumStr ) { - SwFormatFootnote& rFootnote = (SwFormatFootnote&)GetFootnote(); + SwFormatFootnote& rFootnote = const_cast<SwFormatFootnote&>(GetFootnote()); rFootnote.m_aNumber = sNumStr; if ( sNumStr.isEmpty() ) diff --git a/sw/source/core/txtnode/atrtox.cxx b/sw/source/core/txtnode/atrtox.cxx index 819a8ac819ad..f7e0fee43569 100644 --- a/sw/source/core/txtnode/atrtox.cxx +++ b/sw/source/core/txtnode/atrtox.cxx @@ -55,7 +55,7 @@ sal_Int32* SwTextTOXMark::GetEnd() void SwTextTOXMark::CopyTOXMark( SwDoc* pDoc ) { - SwTOXMark& rTOX = (SwTOXMark&)GetTOXMark(); + SwTOXMark& rTOX = const_cast<SwTOXMark&>(GetTOXMark()); TOXTypes eType = rTOX.GetTOXType()->GetType(); const sal_uInt16 nCount = pDoc->GetTOXTypeCount( eType ); const SwTOXType* pType = nullptr; diff --git a/sw/source/core/txtnode/fmtatr2.cxx b/sw/source/core/txtnode/fmtatr2.cxx index d6a3bdc40681..f8ef2b31698b 100644 --- a/sw/source/core/txtnode/fmtatr2.cxx +++ b/sw/source/core/txtnode/fmtatr2.cxx @@ -209,7 +209,7 @@ SwFormatINetFormat::~SwFormatINetFormat() bool SwFormatINetFormat::operator==( const SfxPoolItem& rAttr ) const { assert(SfxPoolItem::operator==(rAttr)); - bool bRet = SfxPoolItem::operator==( (SfxPoolItem&) rAttr ) + bool bRet = SfxPoolItem::operator==( rAttr ) && msURL == static_cast<const SwFormatINetFormat&>(rAttr).msURL && msHyperlinkName == static_cast<const SwFormatINetFormat&>(rAttr).msHyperlinkName && msTargetFrame == static_cast<const SwFormatINetFormat&>(rAttr).msTargetFrame diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx index 8f02ce2fe8b8..bd205152e0d4 100644 --- a/sw/source/core/txtnode/fntcache.cxx +++ b/sw/source/core/txtnode/fntcache.cxx @@ -150,9 +150,9 @@ void SwFntObj::CreatePrtFont( const OutputDevice& rPrt ) delete m_pPrtFont; const vcl::Font aOldFnt( rPrt.GetFont() ); - ((OutputDevice&)rPrt).SetFont( m_aFont ); + const_cast<OutputDevice&>(rPrt).SetFont( m_aFont ); const FontMetric aWinMet( rPrt.GetFontMetric() ); - ((OutputDevice&)rPrt).SetFont( aOldFnt ); + const_cast<OutputDevice&>(rPrt).SetFont( aOldFnt ); long nWidth = ( aWinMet.GetFontSize().Width() * m_nPropWidth ) / 100; if( !nWidth ) @@ -289,10 +289,10 @@ sal_uInt16 SwFntObj::GetFontAscent( const SwViewShell *pSh, const OutputDevice& { CreatePrtFont( rOut ); const vcl::Font aOldFnt( rRefDev.GetFont() ); - ((OutputDevice&)rRefDev).SetFont( *m_pPrtFont ); + const_cast<OutputDevice&>(rRefDev).SetFont( *m_pPrtFont ); const FontMetric aOutMet( rRefDev.GetFontMetric() ); m_nPrtAscent = (sal_uInt16) aOutMet.GetAscent(); - ( (OutputDevice&)rRefDev).SetFont( aOldFnt ); + const_cast<OutputDevice&>(rRefDev).SetFont( aOldFnt ); } nRet = m_nPrtAscent; @@ -326,7 +326,7 @@ sal_uInt16 SwFntObj::GetFontHeight( const SwViewShell* pSh, const OutputDevice& { CreatePrtFont( rOut ); const vcl::Font aOldFnt( rRefDev.GetFont() ); - ((OutputDevice&)rRefDev).SetFont( *m_pPrtFont ); + const_cast<OutputDevice&>(rRefDev).SetFont( *m_pPrtFont ); m_nPrtHeight = static_cast<sal_uInt16>(rRefDev.GetTextHeight()); #if OSL_DEBUG_LEVEL > 0 @@ -339,7 +339,7 @@ sal_uInt16 SwFntObj::GetFontHeight( const SwViewShell* pSh, const OutputDevice& "GetTextHeight != Ascent + Descent" ); #endif - ((OutputDevice&)rRefDev).SetFont( aOldFnt ); + const_cast<OutputDevice&>(rRefDev).SetFont( aOldFnt ); } nRet = m_nPrtHeight + GetFontLeading( pSh, rRefDev ); @@ -360,9 +360,9 @@ sal_uInt16 SwFntObj::GetFontLeading( const SwViewShell *pSh, const OutputDevice& SolarMutexGuard aGuard; const vcl::Font aOldFnt( rOut.GetFont() ); - ((OutputDevice&)rOut).SetFont( *m_pPrtFont ); + const_cast<OutputDevice&>(rOut).SetFont( *m_pPrtFont ); const FontMetric aMet( rOut.GetFontMetric() ); - ((OutputDevice&)rOut).SetFont( aOldFnt ); + const_cast<OutputDevice&>(rOut).SetFont( aOldFnt ); m_bSymbol = RTL_TEXTENCODING_SYMBOL == aMet.GetCharSet(); GuessLeading( *pSh, aMet ); m_nExtLeading = static_cast<sal_uInt16>(aMet.GetExternalLeading()); diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index f25c70d3250a..c687809cbb92 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -2480,7 +2480,7 @@ void SwTextNode::NumRuleChgd() // in the list tree reflected in the layout. // Important note: { - SvxLRSpaceItem& rLR = (SvxLRSpaceItem&)GetSwAttrSet().GetLRSpace(); + SvxLRSpaceItem& rLR = const_cast<SvxLRSpaceItem&>(GetSwAttrSet().GetLRSpace()); NotifyClients( &rLR, &rLR ); } @@ -4880,7 +4880,7 @@ void SwTextNode::dumpAsXml(xmlTextWriterPtr pWriter) const sal_uInt32 SwTextNode::GetRsid( sal_Int32 nStt, sal_Int32 nEnd ) const { - SfxItemSet aSet( (SfxItemPool&) (GetDoc()->GetAttrPool()), RES_CHRATR_RSID, RES_CHRATR_RSID ); + SfxItemSet aSet( const_cast<SfxItemPool&>(static_cast<SfxItemPool const &>(GetDoc()->GetAttrPool())), RES_CHRATR_RSID, RES_CHRATR_RSID ); if ( GetAttr(aSet, nStt, nEnd) ) { const SvxRsidItem* pRsid = aSet.GetItem<SvxRsidItem>(RES_CHRATR_RSID); diff --git a/sw/source/core/undo/unins.cxx b/sw/source/core/undo/unins.cxx index b407bbd69491..500185107abf 100644 --- a/sw/source/core/undo/unins.cxx +++ b/sw/source/core/undo/unins.cxx @@ -429,7 +429,7 @@ void SwUndoInsert::RepeatImpl(::sw::RepeatContext & rContext) { // StarView does not yet provide an option to copy a StarOBJ tools::SvRef<SotStorage> aRef = new SotStorage( OUString() ); - SwOLEObj& rSwOLE = (SwOLEObj&)static_cast<SwOLENode*>(pCNd)->GetOLEObj(); + SwOLEObj& rSwOLE = static_cast<SwOLENode*>(pCNd)->GetOLEObj(); // temporary storage until object is inserted // TODO/MBA: seems that here a physical copy is done - not as in drawing layer! Testing! diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx index f2c01ae7bd55..25552f46b326 100644 --- a/sw/source/core/undo/untbl.cxx +++ b/sw/source/core/undo/untbl.cxx @@ -925,7 +925,7 @@ void SaveTable::RestoreAttr( SwTable& rTable, bool bMdfyBox ) // first, get back attributes of TableFrameFormat SwFrameFormat* pFormat = rTable.GetFrameFormat(); - SfxItemSet& rFormatSet = (SfxItemSet&)pFormat->GetAttrSet(); + SfxItemSet& rFormatSet = const_cast<SfxItemSet&>(static_cast<SfxItemSet const &>(pFormat->GetAttrSet())); rFormatSet.ClearItem(); rFormatSet.Put(m_aTableSet); @@ -982,7 +982,7 @@ void SaveTable::CreateNew( SwTable& rTable, bool bCreateFrames, // first, get back attributes of TableFrameFormat SwFrameFormat* pFormat = rTable.GetFrameFormat(); - SfxItemSet& rFormatSet = (SfxItemSet&)pFormat->GetAttrSet(); + SfxItemSet& rFormatSet = const_cast<SfxItemSet&>(static_cast<SfxItemSet const &>(pFormat->GetAttrSet())); rFormatSet.ClearItem(); rFormatSet.Put(m_aTableSet); diff --git a/sw/source/core/unocore/unoevent.cxx b/sw/source/core/unocore/unoevent.cxx index daf90d4b428c..8f0b69d68f8b 100644 --- a/sw/source/core/unocore/unoevent.cxx +++ b/sw/source/core/unocore/unoevent.cxx @@ -157,7 +157,7 @@ void SwHyperlinkEventDescriptor::copyMacrosFromNameReplace( // use double cast in superclass constructor to avoid ambiguous cast SwFrameEventDescriptor::SwFrameEventDescriptor( SwXTextFrame& rFrameRef ) : - SvEventDescriptor((text::XTextFrame&)rFrameRef, aFrameEvents), + SvEventDescriptor(static_cast<text::XTextFrame&>(rFrameRef), aFrameEvents), sSwFrameEventDescriptor("SwFrameEventDescriptor"), rFrame(rFrameRef) { @@ -165,15 +165,15 @@ SwFrameEventDescriptor::SwFrameEventDescriptor( SwFrameEventDescriptor::SwFrameEventDescriptor( SwXTextGraphicObject& rGraphicRef ) : - SvEventDescriptor((text::XTextContent&)rGraphicRef, aGraphicEvents), - rFrame((SwXFrame&)rGraphicRef) + SvEventDescriptor(static_cast<text::XTextContent&>(rGraphicRef), aGraphicEvents), + rFrame(static_cast<SwXFrame&>(rGraphicRef)) { } SwFrameEventDescriptor::SwFrameEventDescriptor( SwXTextEmbeddedObject& rObjectRef ) : - SvEventDescriptor((text::XTextContent&)rObjectRef, aOLEEvents), - rFrame((SwXFrame&)rObjectRef) + SvEventDescriptor(static_cast<text::XTextContent&>(rObjectRef), aOLEEvents), + rFrame(static_cast<SwXFrame&>(rObjectRef)) { } diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx index dff3a9a53971..f74834998b65 100644 --- a/sw/source/core/unocore/unofield.cxx +++ b/sw/source/core/unocore/unofield.cxx @@ -1995,7 +1995,7 @@ void SAL_CALL SwXTextField::attach( // delete former annotation { const SwTextField* pTextField = m_pImpl->m_pFormatField->GetTextField(); - SwTextNode& rTextNode = (SwTextNode&)*pTextField->GetpTextNode(); + SwTextNode& rTextNode = *pTextField->GetpTextNode(); SwPaM aPam( rTextNode, pTextField->GetStart() ); aPam.SetMark(); aPam.Move(); diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx index 93a2ea25526c..a005091d1bbb 100644 --- a/sw/source/core/unocore/unoframe.cxx +++ b/sw/source/core/unocore/unoframe.cxx @@ -194,10 +194,10 @@ bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const SfxI { const ::uno::Any* pAnchorPgNo; if(GetProperty(RES_ANCHOR, MID_ANCHOR_PAGENUM, pAnchorPgNo)) - bRet &= ((SfxPoolItem&)aAnchor).PutValue(*pAnchorPgNo, MID_ANCHOR_PAGENUM); + bRet &= static_cast<SfxPoolItem&>(aAnchor).PutValue(*pAnchorPgNo, MID_ANCHOR_PAGENUM); const ::uno::Any* pAnchorType; if(GetProperty(RES_ANCHOR, MID_ANCHOR_ANCHORTYPE, pAnchorType)) - bRet &= ((SfxPoolItem&)aAnchor).PutValue(*pAnchorType, MID_ANCHOR_ANCHORTYPE); + bRet &= static_cast<SfxPoolItem&>(aAnchor).PutValue(*pAnchorType, MID_ANCHOR_ANCHORTYPE); } rToSet.Put(aAnchor); @@ -301,44 +301,44 @@ bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const SfxI if(pCol) { - bRet &= ((SfxPoolItem&)aBrush).PutValue(*pCol,MID_BACK_COLOR ); + bRet &= static_cast<SfxPoolItem&>(aBrush).PutValue(*pCol,MID_BACK_COLOR ); } if(pColTrans) { - bRet &= ((SfxPoolItem&)aBrush).PutValue(*pColTrans, MID_BACK_COLOR_TRANSPARENCY); + bRet &= static_cast<SfxPoolItem&>(aBrush).PutValue(*pColTrans, MID_BACK_COLOR_TRANSPARENCY); } if(pRGBCol) { - bRet &= ((SfxPoolItem&)aBrush).PutValue(*pRGBCol, MID_BACK_COLOR_R_G_B); + bRet &= static_cast<SfxPoolItem&>(aBrush).PutValue(*pRGBCol, MID_BACK_COLOR_R_G_B); } if(pTrans) { // don't overwrite transparency with a non-transparence flag if(!pColTrans || Any2Bool( *pTrans )) - bRet &= ((SfxPoolItem&)aBrush).PutValue(*pTrans, MID_GRAPHIC_TRANSPARENT); + bRet &= static_cast<SfxPoolItem&>(aBrush).PutValue(*pTrans, MID_GRAPHIC_TRANSPARENT); } if(pGrURL) { - bRet &= ((SfxPoolItem&)aBrush).PutValue(*pGrURL, MID_GRAPHIC_URL); + bRet &= static_cast<SfxPoolItem&>(aBrush).PutValue(*pGrURL, MID_GRAPHIC_URL); } if(pGrFilter) { - bRet &= ((SfxPoolItem&)aBrush).PutValue(*pGrFilter, MID_GRAPHIC_FILTER); + bRet &= static_cast<SfxPoolItem&>(aBrush).PutValue(*pGrFilter, MID_GRAPHIC_FILTER); } if(pGrLoc) { - bRet &= ((SfxPoolItem&)aBrush).PutValue(*pGrLoc, MID_GRAPHIC_POSITION); + bRet &= static_cast<SfxPoolItem&>(aBrush).PutValue(*pGrLoc, MID_GRAPHIC_POSITION); } if(pGrTranparency) { - bRet &= ((SfxPoolItem&)aBrush).PutValue(*pGrTranparency, MID_GRAPHIC_TRANSPARENCY); + bRet &= static_cast<SfxPoolItem&>(aBrush).PutValue(*pGrTranparency, MID_GRAPHIC_TRANSPARENCY); } setSvxBrushItemAsFillAttributesToTargetSet(aBrush, rToSet); @@ -640,11 +640,11 @@ bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const SfxI { SvxProtectItem aProt ( static_cast < const ::SvxProtectItem & > ( rFromSet.Get ( RES_PROTECT ) ) ); if(pCont) - bRet &= ((SfxPoolItem&)aProt).PutValue(*pCont, MID_PROTECT_CONTENT); + bRet &= static_cast<SfxPoolItem&>(aProt).PutValue(*pCont, MID_PROTECT_CONTENT); if(pPos ) - bRet &= ((SfxPoolItem&)aProt).PutValue(*pPos, MID_PROTECT_POSITION); + bRet &= static_cast<SfxPoolItem&>(aProt).PutValue(*pPos, MID_PROTECT_POSITION); if(pName) - bRet &= ((SfxPoolItem&)aProt).PutValue(*pName, MID_PROTECT_SIZE); + bRet &= static_cast<SfxPoolItem&>(aProt).PutValue(*pName, MID_PROTECT_SIZE); rToSet.Put(aProt); } } @@ -661,13 +661,13 @@ bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const SfxI { SwFormatHoriOrient aOrient ( static_cast < const ::SwFormatHoriOrient & > ( rFromSet.Get ( RES_HORI_ORIENT ) ) ); if(pHori ) - bRet &= ((SfxPoolItem&)aOrient).PutValue(*pHori, MID_HORIORIENT_ORIENT); + bRet &= static_cast<SfxPoolItem&>(aOrient).PutValue(*pHori, MID_HORIORIENT_ORIENT); if(pHoriP) - bRet &= ((SfxPoolItem&)aOrient).PutValue(*pHoriP, MID_HORIORIENT_POSITION|CONVERT_TWIPS); + bRet &= static_cast<SfxPoolItem&>(aOrient).PutValue(*pHoriP, MID_HORIORIENT_POSITION|CONVERT_TWIPS); if(pHoriR) - bRet &= ((SfxPoolItem&)aOrient).PutValue(*pHoriR, MID_HORIORIENT_RELATION); + bRet &= static_cast<SfxPoolItem&>(aOrient).PutValue(*pHoriR, MID_HORIORIENT_RELATION); if(pPageT) - bRet &= ((SfxPoolItem&)aOrient).PutValue(*pPageT, MID_HORIORIENT_PAGETOGGLE); + bRet &= static_cast<SfxPoolItem&>(aOrient).PutValue(*pPageT, MID_HORIORIENT_PAGETOGGLE); rToSet.Put(aOrient); } } @@ -683,11 +683,11 @@ bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const SfxI { SwFormatVertOrient aOrient ( static_cast < const ::SwFormatVertOrient & > ( rFromSet.Get ( RES_VERT_ORIENT ) ) ); if(pVert ) - bRet &= ((SfxPoolItem&)aOrient).PutValue(*pVert, MID_VERTORIENT_ORIENT); + bRet &= static_cast<SfxPoolItem&>(aOrient).PutValue(*pVert, MID_VERTORIENT_ORIENT); if(pVertP) - bRet &= ((SfxPoolItem&)aOrient).PutValue(*pVertP, MID_VERTORIENT_POSITION|CONVERT_TWIPS); + bRet &= static_cast<SfxPoolItem&>(aOrient).PutValue(*pVertP, MID_VERTORIENT_POSITION|CONVERT_TWIPS); if(pVertR) - bRet &= ((SfxPoolItem&)aOrient).PutValue(*pVertR, MID_VERTORIENT_RELATION); + bRet &= static_cast<SfxPoolItem&>(aOrient).PutValue(*pVertR, MID_VERTORIENT_RELATION); rToSet.Put(aOrient); } } @@ -704,13 +704,13 @@ bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const SfxI { SwFormatURL aURL ( static_cast < const ::SwFormatURL & > ( rFromSet.Get ( RES_URL ) ) ); if(pURL) - bRet &= ((SfxPoolItem&)aURL).PutValue(*pURL, MID_URL_URL); + bRet &= static_cast<SfxPoolItem&>(aURL).PutValue(*pURL, MID_URL_URL); if(pTarget) - bRet &= ((SfxPoolItem&)aURL).PutValue(*pTarget, MID_URL_TARGET); + bRet &= static_cast<SfxPoolItem&>(aURL).PutValue(*pTarget, MID_URL_TARGET); if(pHyLNm) - bRet &= ((SfxPoolItem&)aURL).PutValue(*pHyLNm, MID_URL_HYPERLINKNAME ); + bRet &= static_cast<SfxPoolItem&>(aURL).PutValue(*pHyLNm, MID_URL_HYPERLINKNAME ); if(pHySMp) - bRet &= ((SfxPoolItem&)aURL).PutValue(*pHySMp, MID_URL_SERVERMAP); + bRet &= static_cast<SfxPoolItem&>(aURL).PutValue(*pHySMp, MID_URL_SERVERMAP); rToSet.Put(aURL); } } @@ -722,9 +722,9 @@ bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const SfxI { SvxLRSpaceItem aLR ( static_cast < const ::SvxLRSpaceItem & > ( rFromSet.Get ( RES_LR_SPACE ) ) ); if(pL) - bRet &= ((SfxPoolItem&)aLR).PutValue(*pL, MID_L_MARGIN|CONVERT_TWIPS); + bRet &= static_cast<SfxPoolItem&>(aLR).PutValue(*pL, MID_L_MARGIN|CONVERT_TWIPS); if(pR) - bRet &= ((SfxPoolItem&)aLR).PutValue(*pR, MID_R_MARGIN|CONVERT_TWIPS); + bRet &= static_cast<SfxPoolItem&>(aLR).PutValue(*pR, MID_R_MARGIN|CONVERT_TWIPS); rToSet.Put(aLR); } const ::uno::Any* pT = nullptr; @@ -735,30 +735,30 @@ bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const SfxI { SvxULSpaceItem aTB ( static_cast < const ::SvxULSpaceItem &> ( rFromSet.Get ( RES_UL_SPACE ) ) ); if(pT) - bRet &= ((SfxPoolItem&)aTB).PutValue(*pT, MID_UP_MARGIN|CONVERT_TWIPS); + bRet &= static_cast<SfxPoolItem&>(aTB).PutValue(*pT, MID_UP_MARGIN|CONVERT_TWIPS); if(pB) - bRet &= ((SfxPoolItem&)aTB).PutValue(*pB, MID_LO_MARGIN|CONVERT_TWIPS); + bRet &= static_cast<SfxPoolItem&>(aTB).PutValue(*pB, MID_LO_MARGIN|CONVERT_TWIPS); rToSet.Put(aTB); } const ::uno::Any* pOp; if(GetProperty(RES_OPAQUE, 0, pOp)) { SvxOpaqueItem aOp ( static_cast < const ::SvxOpaqueItem& > ( rFromSet.Get ( RES_OPAQUE ) ) ); - bRet &= ((SfxPoolItem&)aOp).PutValue(*pOp, 0); + bRet &= static_cast<SfxPoolItem&>(aOp).PutValue(*pOp, 0); rToSet.Put(aOp); } const ::uno::Any* pPrt; if(GetProperty(RES_PRINT, 0, pPrt)) { SvxPrintItem aPrt ( static_cast < const ::SvxPrintItem & > ( rFromSet.Get ( RES_PRINT ) ) ); - bRet &= ((SfxPoolItem&)aPrt).PutValue(*pPrt, 0); + bRet &= static_cast<SfxPoolItem&>(aPrt).PutValue(*pPrt, 0); rToSet.Put(aPrt); } const ::uno::Any* pSh; if(GetProperty(RES_SHADOW, CONVERT_TWIPS, pSh)) { SvxShadowItem aSh ( static_cast < const ::SvxShadowItem& > ( rFromSet.Get ( RES_SHADOW ) ) ); - bRet &= ((SfxPoolItem&)aSh).PutValue(*pSh, CONVERT_TWIPS); + bRet &= static_cast<SfxPoolItem&>(aSh).PutValue(*pSh, CONVERT_TWIPS); rToSet.Put(aSh); } const ::uno::Any* pShTr; @@ -776,9 +776,9 @@ bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const SfxI { SwFormatSurround aSrnd ( static_cast < const ::SwFormatSurround & > ( rFromSet.Get ( RES_SURROUND ) ) ); if(pSur) - bRet &= ((SfxPoolItem&)aSrnd).PutValue(*pSur, MID_SURROUND_SURROUNDTYPE ); + bRet &= static_cast<SfxPoolItem&>(aSrnd).PutValue(*pSur, MID_SURROUND_SURROUNDTYPE ); if(pSurAnch) - bRet &= ((SfxPoolItem&)aSrnd).PutValue(*pSurAnch, MID_SURROUND_ANCHORONLY); + bRet &= static_cast<SfxPoolItem&>(aSrnd).PutValue(*pSurAnch, MID_SURROUND_ANCHORONLY); rToSet.Put(aSrnd); } const ::uno::Any* pLeft = nullptr; @@ -809,27 +809,27 @@ bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const SfxI { SvxBoxItem aBox ( static_cast < const ::SvxBoxItem & > ( rFromSet.Get ( RES_BOX ) ) ); if( pLeft ) - bRet &= ((SfxPoolItem&)aBox).PutValue(*pLeft, CONVERT_TWIPS|LEFT_BORDER ); + bRet &= static_cast<SfxPoolItem&>(aBox).PutValue(*pLeft, CONVERT_TWIPS|LEFT_BORDER ); if( pRight ) - bRet &= ((SfxPoolItem&)aBox).PutValue(*pRight, CONVERT_TWIPS|RIGHT_BORDER ); + bRet &= static_cast<SfxPoolItem&>(aBox).PutValue(*pRight, CONVERT_TWIPS|RIGHT_BORDER ); if( pTop ) - bRet &= ((SfxPoolItem&)aBox).PutValue(*pTop, CONVERT_TWIPS|TOP_BORDER); + bRet &= static_cast<SfxPoolItem&>(aBox).PutValue(*pTop, CONVERT_TWIPS|TOP_BORDER); if( pBottom ) - bRet &= ((SfxPoolItem&)aBox).PutValue(*pBottom, CONVERT_TWIPS|BOTTOM_BORDER); + bRet &= static_cast<SfxPoolItem&>(aBox).PutValue(*pBottom, CONVERT_TWIPS|BOTTOM_BORDER); if( pDistance ) - bRet &= ((SfxPoolItem&)aBox).PutValue(*pDistance, CONVERT_TWIPS|BORDER_DISTANCE); + bRet &= static_cast<SfxPoolItem&>(aBox).PutValue(*pDistance, CONVERT_TWIPS|BORDER_DISTANCE); if( pLeftDistance ) - bRet &= ((SfxPoolItem&)aBox).PutValue(*pLeftDistance, CONVERT_TWIPS|LEFT_BORDER_DISTANCE); + bRet &= static_cast<SfxPoolItem&>(aBox).PutValue(*pLeftDistance, CONVERT_TWIPS|LEFT_BORDER_DISTANCE); if( pRightDistance ) - bRet &= ((SfxPoolItem&)aBox).PutValue(*pRightDistance, CONVERT_TWIPS|RIGHT_BORDER_DISTANCE); + bRet &= static_cast<SfxPoolItem&>(aBox).PutValue(*pRightDistance, CONVERT_TWIPS|RIGHT_BORDER_DISTANCE); if( pTopDistance ) - bRet &= ((SfxPoolItem&)aBox).PutValue(*pTopDistance, CONVERT_TWIPS|TOP_BORDER_DISTANCE); + bRet &= static_cast<SfxPoolItem&>(aBox).PutValue(*pTopDistance, CONVERT_TWIPS|TOP_BORDER_DISTANCE); if( pBottomDistance ) - bRet &= ((SfxPoolItem&)aBox).PutValue(*pBottomDistance, CONVERT_TWIPS|BOTTOM_BORDER_DISTANCE); + bRet &= static_cast<SfxPoolItem&>(aBox).PutValue(*pBottomDistance, CONVERT_TWIPS|BOTTOM_BORDER_DISTANCE); if( pLineStyle ) - bRet &= ((SfxPoolItem&)aBox).PutValue(*pLineStyle, LINE_STYLE); + bRet &= static_cast<SfxPoolItem&>(aBox).PutValue(*pLineStyle, LINE_STYLE); if( pLineWidth ) - bRet &= ((SfxPoolItem&)aBox).PutValue(*pLineWidth, LINE_WIDTH|CONVERT_TWIPS); + bRet &= static_cast<SfxPoolItem&>(aBox).PutValue(*pLineWidth, LINE_WIDTH|CONVERT_TWIPS); rToSet.Put(aBox); } { @@ -861,27 +861,27 @@ bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const SfxI rSizeFound = true; SwFormatFrameSize aFrameSz ( static_cast < const ::SwFormatFrameSize& > ( rFromSet.Get ( RES_FRM_SIZE ) ) ); if(pWidth) - bRet &= ((SfxPoolItem&)aFrameSz).PutValue(*pWidth, MID_FRMSIZE_WIDTH|CONVERT_TWIPS); + bRet &= static_cast<SfxPoolItem&>(aFrameSz).PutValue(*pWidth, MID_FRMSIZE_WIDTH|CONVERT_TWIPS); if(pHeight) - bRet &= ((SfxPoolItem&)aFrameSz).PutValue(*pHeight, MID_FRMSIZE_HEIGHT|CONVERT_TWIPS); + bRet &= static_cast<SfxPoolItem&>(aFrameSz).PutValue(*pHeight, MID_FRMSIZE_HEIGHT|CONVERT_TWIPS); if(pRelH ) - bRet &= ((SfxPoolItem&)aFrameSz).PutValue(*pRelH, MID_FRMSIZE_REL_HEIGHT); + bRet &= static_cast<SfxPoolItem&>(aFrameSz).PutValue(*pRelH, MID_FRMSIZE_REL_HEIGHT); if (pRelHRelation) bRet &= aFrameSz.PutValue(*pRelHRelation, MID_FRMSIZE_REL_HEIGHT_RELATION); if(pRelW ) - bRet &= ((SfxPoolItem&)aFrameSz).PutValue(*pRelW, MID_FRMSIZE_REL_WIDTH); + bRet &= static_cast<SfxPoolItem&>(aFrameSz).PutValue(*pRelW, MID_FRMSIZE_REL_WIDTH); if (pRelWRelation) bRet &= aFrameSz.PutValue(*pRelWRelation, MID_FRMSIZE_REL_WIDTH_RELATION); if(pSyncWidth) - bRet &= ((SfxPoolItem&)aFrameSz).PutValue(*pSyncWidth, MID_FRMSIZE_IS_SYNC_WIDTH_TO_HEIGHT); + bRet &= static_cast<SfxPoolItem&>(aFrameSz).PutValue(*pSyncWidth, MID_FRMSIZE_IS_SYNC_WIDTH_TO_HEIGHT); if(pSyncHeight) - bRet &= ((SfxPoolItem&)aFrameSz).PutValue(*pSyncHeight, MID_FRMSIZE_IS_SYNC_HEIGHT_TO_WIDTH); + bRet &= static_cast<SfxPoolItem&>(aFrameSz).PutValue(*pSyncHeight, MID_FRMSIZE_IS_SYNC_HEIGHT_TO_WIDTH); if(pSize) - bRet &= ((SfxPoolItem&)aFrameSz).PutValue(*pSize, MID_FRMSIZE_SIZE|CONVERT_TWIPS); + bRet &= static_cast<SfxPoolItem&>(aFrameSz).PutValue(*pSize, MID_FRMSIZE_SIZE|CONVERT_TWIPS); if(pSizeType) - bRet &= ((SfxPoolItem&)aFrameSz).PutValue(*pSizeType, MID_FRMSIZE_SIZE_TYPE); + bRet &= static_cast<SfxPoolItem&>(aFrameSz).PutValue(*pSizeType, MID_FRMSIZE_SIZE_TYPE); if(pWidthType) - bRet &= ((SfxPoolItem&)aFrameSz).PutValue(*pWidthType, MID_FRMSIZE_WIDTH_TYPE); + bRet &= static_cast<SfxPoolItem&>(aFrameSz).PutValue(*pWidthType, MID_FRMSIZE_WIDTH_TYPE); if(!aFrameSz.GetWidth()) aFrameSz.SetWidth(MINFLY); if(!aFrameSz.GetHeight()) @@ -897,7 +897,7 @@ bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const SfxI aSize.Height = 2 * MM50; ::uno::Any aSizeVal; aSizeVal <<= aSize; - ((SfxPoolItem&)aFrameSz).PutValue(aSizeVal, MID_FRMSIZE_SIZE|CONVERT_TWIPS); + static_cast<SfxPoolItem&>(aFrameSz).PutValue(aSizeVal, MID_FRMSIZE_SIZE|CONVERT_TWIPS); rToSet.Put(aFrameSz); } } @@ -944,7 +944,7 @@ bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const SfxI if ( pTextVertAdjust ) { SdrTextVertAdjustItem aTextVertAdjust(static_cast <const ::SdrTextVertAdjustItem & > ( rFromSet.Get ( RES_TEXT_VERT_ADJUST ) )); - bRet &= ((SfxPoolItem&)aTextVertAdjust).PutValue(*pTextVertAdjust, 0); + bRet &= static_cast<SfxPoolItem&>(aTextVertAdjust).PutValue(*pTextVertAdjust, 0); rToSet.Put(aTextVertAdjust); } } @@ -970,7 +970,7 @@ static inline void lcl_FillCol ( SfxItemSet &rToSet, const ::SfxItemSet &rFromSe if ( pAny ) { SwFormatCol aCol ( static_cast < const ::SwFormatCol & > ( rFromSet.Get ( RES_COL ) ) ); - ((SfxPoolItem&)aCol).PutValue( *pAny, MID_COLUMNS); + static_cast<SfxPoolItem&>(aCol).PutValue( *pAny, MID_COLUMNS); rToSet.Put(aCol); } } @@ -1035,11 +1035,11 @@ static inline void lcl_FillMirror ( SfxItemSet &rToSet, const ::SfxItemSet &rFro { SwMirrorGrf aMirror ( static_cast < const ::SwMirrorGrf& > ( rFromSet.Get ( RES_GRFATR_MIRRORGRF ) ) ); if(pHEvenMirror) - rRet &= ((SfxPoolItem&)aMirror).PutValue(*pHEvenMirror, MID_MIRROR_HORZ_EVEN_PAGES); + rRet &= static_cast<SfxPoolItem&>(aMirror).PutValue(*pHEvenMirror, MID_MIRROR_HORZ_EVEN_PAGES); if(pHOddMirror) - rRet &= ((SfxPoolItem&)aMirror).PutValue(*pHOddMirror, MID_MIRROR_HORZ_ODD_PAGES); + rRet &= static_cast<SfxPoolItem&>(aMirror).PutValue(*pHOddMirror, MID_MIRROR_HORZ_ODD_PAGES); if(pVMirror) - rRet &= ((SfxPoolItem&)aMirror).PutValue(*pVMirror, MID_MIRROR_VERT); + rRet &= static_cast<SfxPoolItem&>(aMirror).PutValue(*pVMirror, MID_MIRROR_VERT); rToSet.Put(aMirror); } } @@ -2799,7 +2799,7 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan { pFormat->Add(this); if(!m_sName.isEmpty()) - pDoc->SetFlyName((SwFlyFrameFormat&)*pFormat, m_sName); + pDoc->SetFlyName(*pFormat, m_sName); } // wake up the SwXTextFrame static_cast<SwXTextFrame*>(this)->SetDoc( bIsDescriptor ? m_pDoc : GetFrameFormat()->GetDoc() ); @@ -2859,7 +2859,7 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan pGrfNd->SetChgTwipSize( !bSizeFound ); pFormat->Add(this); if(!m_sName.isEmpty()) - pDoc->SetFlyName((SwFlyFrameFormat&)*pFormat, m_sName); + pDoc->SetFlyName(*pFormat, m_sName); } const ::uno::Any* pSurroundContour; @@ -2963,7 +2963,7 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan pDoc->GetIDocumentUndoRedo().EndUndo(SwUndoId::INSERT, nullptr); pFormat2->Add(this); if(!m_sName.isEmpty()) - pDoc->SetFlyName((SwFlyFrameFormat&)*pFormat2, m_sName); + pDoc->SetFlyName(*pFormat2, m_sName); } } else if( pStreamName ) @@ -2977,7 +2977,7 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan pDoc->GetIDocumentUndoRedo().EndUndo(SwUndoId::INSERT, nullptr); pFrameFormat->Add(this); if(!m_sName.isEmpty()) - pDoc->SetFlyName((SwFlyFrameFormat&)*pFrameFormat, m_sName); + pDoc->SetFlyName(*pFrameFormat, m_sName); } else if (pEmbeddedObject) { @@ -3004,7 +3004,7 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan pDoc->GetIDocumentUndoRedo().EndUndo(SwUndoId::INSERT, nullptr); pFrameFormat->Add(this); if(!m_sName.isEmpty()) - pDoc->SetFlyName((SwFlyFrameFormat&)*pFrameFormat, m_sName); + pDoc->SetFlyName(*pFrameFormat, m_sName); } } if( pFormat && pDoc->getIDocumentDrawModelAccess().GetDrawModel() ) diff --git a/sw/source/core/unocore/unoftn.cxx b/sw/source/core/unocore/unoftn.cxx index ce5c213d5aab..0bd15d1e0301 100644 --- a/sw/source/core/unocore/unoftn.cxx +++ b/sw/source/core/unocore/unoftn.cxx @@ -269,7 +269,7 @@ SwXFootnote::setLabel(const OUString& aLabel) { const SwTextFootnote* pTextFootnote = pFormat->GetTextFootnote(); OSL_ENSURE(pTextFootnote, "No TextNode?"); - SwTextNode& rTextNode = (SwTextNode&)pTextFootnote->GetTextNode(); + SwTextNode& rTextNode = const_cast<SwTextNode&>(pTextFootnote->GetTextNode()); SwPaM aPam(rTextNode, pTextFootnote->GetStart()); GetDoc()->SetCurFootnote(aPam, newLabel, pFormat->GetNumber(), pFormat->IsEndNote()); diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx index cbb32805a3c7..4754febbc808 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -3410,7 +3410,7 @@ SwXCellRange::setPropertyValue(const OUString& rPropertyName, const uno::Any& aV { SvxBrushItem aBrush( RES_BACKGROUND ); SwDoc::GetBoxAttr(*m_pImpl->m_pTableCursor, aBrush); - ((SfxPoolItem&)aBrush).PutValue(aValue, pEntry->nMemberId); + static_cast<SfxPoolItem&>(aBrush).PutValue(aValue, pEntry->nMemberId); pDoc->SetBoxAttr(*m_pImpl->m_pTableCursor, aBrush); } @@ -3444,7 +3444,7 @@ SwXCellRange::setPropertyValue(const OUString& rPropertyName, const uno::Any& aV aSet.Put(aBoxInfo); SvxBoxItem aBoxItem(static_cast<const SvxBoxItem&>(aSet.Get(RES_BOX))); - ((SfxPoolItem&)aBoxItem).PutValue(aValue, pEntry->nMemberId); + static_cast<SfxPoolItem&>(aBoxItem).PutValue(aValue, pEntry->nMemberId); aSet.Put(aBoxItem); pDoc->SetTabBorders(*m_pImpl->m_pTableCursor, aSet); } @@ -3452,7 +3452,7 @@ SwXCellRange::setPropertyValue(const OUString& rPropertyName, const uno::Any& aV case RES_BOXATR_FORMAT: { SfxUInt32Item aNumberFormat(RES_BOXATR_FORMAT); - ((SfxPoolItem&)aNumberFormat).PutValue(aValue, 0); + static_cast<SfxPoolItem&>(aNumberFormat).PutValue(aValue, 0); pDoc->SetBoxAttr(rCursor, aNumberFormat); } break; diff --git a/sw/source/filter/html/htmlflywriter.cxx b/sw/source/filter/html/htmlflywriter.cxx index 3cd38830f0aa..69320ce63047 100644 --- a/sw/source/filter/html/htmlflywriter.cxx +++ b/sw/source/filter/html/htmlflywriter.cxx @@ -1717,7 +1717,7 @@ static Writer & OutHTML_FrameFormatAsImage( Writer& rWrt, const SwFrameFormat& r return rWrt; ImageMap aIMap; - Graphic aGraphic( ((SwFrameFormat &)rFrameFormat).MakeGraphic( &aIMap ) ); + Graphic aGraphic( const_cast<SwFrameFormat &>(rFrameFormat).MakeGraphic( &aIMap ) ); Size aSz( 0, 0 ); OUString GraphicURL; if(!rHTMLWrt.mbEmbedImages) diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index 2860a4a250e6..0caf73a064a1 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -627,7 +627,7 @@ void MSWordExportBase::CorrectTabStopInSet( SfxItemSet& rSet, sal_uInt16 nAbsLef SvxTabStopItem aTStop(*pItem); for ( sal_uInt16 nCnt = 0; nCnt < aTStop.Count(); ++nCnt ) { - SvxTabStop& rTab = (SvxTabStop&)aTStop[ nCnt ]; + SvxTabStop& rTab = const_cast<SvxTabStop&>(aTStop[ nCnt ]); if ( SvxTabAdjust::Default != rTab.GetAdjustment() && rTab.GetTabPos() >= nAbsLeft ) { diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index f23c8da661e4..3c05190a8c17 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -4146,7 +4146,7 @@ void SwWW8ImplReader::Read_LR( sal_uInt16 nId, const sal_uInt8* pData, short nLe // If have not explicit left, set number format list tab position is doc default tab const SvxTabStopItem *pDefaultStopItem = static_cast<const SvxTabStopItem *>(m_rDoc.GetAttrPool().GetPoolDefaultItem(RES_PARATR_TABSTOP)); if ( pDefaultStopItem && pDefaultStopItem->Count() > 0 ) - const_cast<SwNumFormat*>(pNumFormat)->SetListtabPos( ((SvxTabStop&)(*pDefaultStopItem)[0]).GetTabPos() ); + const_cast<SwNumFormat*>(pNumFormat)->SetListtabPos( const_cast<SvxTabStop&>((*pDefaultStopItem)[0]).GetTabPos() ); } } } diff --git a/sw/source/filter/xml/xmltble.cxx b/sw/source/filter/xml/xmltble.cxx index ace240830758..448f8a2deaed 100644 --- a/sw/source/filter/xml/xmltble.cxx +++ b/sw/source/filter/xml/xmltble.cxx @@ -1139,7 +1139,7 @@ void SwXMLExport::ExportTable( const SwTableNode& rTableNd ) SwXMLTableInfo_Impl aTableInfo( &rTable, nPrefix ); ExportTableLines( rTable.GetTabLines(), aTableInfo, rTable.GetRowsToRepeat() ); - for( SwTableLine *pLine : ((SwTable &)rTable).GetTabLines() ) + for( SwTableLine *pLine : const_cast<SwTable &>(rTable).GetTabLines() ) lcl_xmltble_ClearName_Line( pLine ); } } diff --git a/sw/source/ui/frmdlg/column.cxx b/sw/source/ui/frmdlg/column.cxx index 473cea4543b6..1c6e913cca02 100644 --- a/sw/source/ui/frmdlg/column.cxx +++ b/sw/source/ui/frmdlg/column.cxx @@ -153,8 +153,8 @@ SwColumnDlg::SwColumnDlg(vcl::Window* pParent, SwWrtShell& rSh) const SwFrameFormat &rFormat = pPageDesc->GetMaster(); nPageWidth = rFormat.GetFrameSize().GetSize().Width(); - const SvxLRSpaceItem& rLRSpace = (const SvxLRSpaceItem&)rFormat.GetLRSpace(); - const SvxBoxItem& rBox = (const SvxBoxItem&) rFormat.GetBox(); + const SvxLRSpaceItem& rLRSpace = rFormat.GetLRSpace(); + const SvxBoxItem& rBox = rFormat.GetBox(); nPageWidth -= rLRSpace.GetLeft() + rLRSpace.GetRight() + rBox.GetSmallestDistance(); pPageSet->Put(rFormat.GetCol()); diff --git a/sw/source/ui/misc/srtdlg.cxx b/sw/source/ui/misc/srtdlg.cxx index a6a2b11b3a50..b33fedc9f169 100644 --- a/sw/source/ui/misc/srtdlg.cxx +++ b/sw/source/ui/misc/srtdlg.cxx @@ -95,7 +95,7 @@ static bool lcl_GetSelTable( SwWrtShell &rSh, sal_uInt16& rX, sal_uInt16& rY ) ::GetTableSel( rSh, aSelBoxes ); FndPara aPara( aSelBoxes, &aFndBox ); const SwTable& rTable = pTableNd->GetTable(); - ForEach_FndLineCopyCol( (SwTableLines&)rTable.GetTabLines(), &aPara ); + ForEach_FndLineCopyCol( const_cast<SwTableLines&>(rTable.GetTabLines()), &aPara ); } rX = aFndBox.GetLines().size(); if( !rX ) diff --git a/sw/source/uibase/app/docsh.cxx b/sw/source/uibase/app/docsh.cxx index 029bccef8456..ff2fd5c76088 100644 --- a/sw/source/uibase/app/docsh.cxx +++ b/sw/source/uibase/app/docsh.cxx @@ -338,7 +338,7 @@ bool SwDocShell::Save() if (m_pDoc->ContainsMSVBasic()) { if( SvtFilterOptions::Get().IsLoadWordBasicStorage() ) - nVBWarning = GetSaveWarningOfMSVBAStorage( (SfxObjectShell&) (*this) ); + nVBWarning = GetSaveWarningOfMSVBAStorage( static_cast<SfxObjectShell&>(*this) ); m_pDoc->SetContainsMSVBasic( false ); } @@ -463,7 +463,7 @@ bool SwDocShell::SaveAs( SfxMedium& rMedium ) if (m_pDoc->ContainsMSVBasic()) { if( SvtFilterOptions::Get().IsLoadWordBasicStorage() ) - nVBWarning = GetSaveWarningOfMSVBAStorage( (SfxObjectShell&) *this ); + nVBWarning = GetSaveWarningOfMSVBAStorage( static_cast<SfxObjectShell&>(*this) ); m_pDoc->SetContainsMSVBasic( false ); } @@ -565,7 +565,7 @@ bool SwDocShell::ConvertTo( SfxMedium& rMedium ) OSL_ENSURE( !xStg->GetError(), "No storage available for storing VBA macros!" ); if ( !xStg->GetError() ) { - nVBWarning = SaveOrDelMSVBAStorage( (SfxObjectShell&) *this, *xStg, bSave, "Macros" ); + nVBWarning = SaveOrDelMSVBAStorage( static_cast<SfxObjectShell&>(*this), *xStg, bSave, "Macros" ); xStg->Commit(); m_pDoc->SetContainsMSVBasic( true ); } diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx index 147212a01181..f78d7126faeb 100644 --- a/sw/source/uibase/app/docst.cxx +++ b/sw/source/uibase/app/docst.cxx @@ -1256,7 +1256,7 @@ SfxStyleFamily SwDocShell::MakeByExample( const OUString &rName, SfxStyleFamily { pCurrWrtShell->StartAllAction(); size_t nPgDsc = pCurrWrtShell->GetCurPageDesc(); - SwPageDesc& rSrc = (SwPageDesc&)pCurrWrtShell->GetPageDesc( nPgDsc ); + SwPageDesc& rSrc = const_cast<SwPageDesc&>(pCurrWrtShell->GetPageDesc( nPgDsc )); SwPageDesc& rDest = *const_cast<SwPageDesc*>(pStyle->GetPageDesc()); sal_uInt16 nPoolId = rDest.GetPoolFormatId(); diff --git a/sw/source/uibase/config/modcfg.cxx b/sw/source/uibase/config/modcfg.cxx index 793d5cc8b019..af7f1d01d024 100644 --- a/sw/source/uibase/config/modcfg.cxx +++ b/sw/source/uibase/config/modcfg.cxx @@ -625,7 +625,7 @@ static void lcl_WriteOpt(const InsCaptionOpt& rOpt, Any* pValues, sal_Int32 nPro case 5: pValues[nProp] <<= rOpt.GetSeparator();break;//Delimiter", case 6: pValues[nProp] <<= (sal_Int32)rOpt.GetLevel(); break;//Level", case 7: pValues[nProp] <<= (sal_Int32)rOpt.GetPos(); break;//Position", - case 8: pValues[nProp] <<= (OUString&)rOpt.GetCharacterStyle(); break; //CharacterStyle + case 8: pValues[nProp] <<= rOpt.GetCharacterStyle(); break; //CharacterStyle case 9: pValues[nProp] <<= rOpt.CopyAttributes(); break; //ApplyAttributes } } diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index f69e8c64184d..d1779e0b11b0 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -1524,7 +1524,7 @@ void SwEditWin::KeyInput(const KeyEvent &rKEvt) ((nLclSelectionType & (SelectionType::DrawObject|SelectionType::DbForm)) && rSh.GetDrawView()->GetMarkedObjectList().GetMarkCount() == 1)))) { - SdrHdlList& rHdlList = (SdrHdlList&)rSh.GetDrawView()->GetHdlList(); + SdrHdlList& rHdlList = const_cast<SdrHdlList&>(rSh.GetDrawView()->GetHdlList()); SdrHdl* pAnchor = rHdlList.GetHdl(SdrHdlKind::Anchor); if ( ! pAnchor ) pAnchor = rHdlList.GetHdl(SdrHdlKind::Anchor_TR); diff --git a/sw/source/uibase/shells/basesh.cxx b/sw/source/uibase/shells/basesh.cxx index 48c4a0d0d7ca..53c80f3560f5 100644 --- a/sw/source/uibase/shells/basesh.cxx +++ b/sw/source/uibase/shells/basesh.cxx @@ -2534,7 +2534,7 @@ void SwBaseShell::ExecDlg(SfxRequest &rReq) OSL_ENSURE(pDlg, "Dialog creation failed!"); if ( pDlg->Execute() == RET_OK ) { - rSh.SetFlyFrameAttr((SfxItemSet &) *pDlg->GetOutputItemSet() ); + rSh.SetFlyFrameAttr(const_cast<SfxItemSet &>(*pDlg->GetOutputItemSet()) ); pOutSet = pDlg->GetOutputItemSet(); } } diff --git a/sw/source/uibase/shells/frmsh.cxx b/sw/source/uibase/shells/frmsh.cxx index db817ffaa3e2..11cb198d88e2 100644 --- a/sw/source/uibase/shells/frmsh.cxx +++ b/sw/source/uibase/shells/frmsh.cxx @@ -233,7 +233,7 @@ void SwFrameShell::Execute(SfxRequest &rReq) break; case FN_FRAME_UNCHAIN: - rSh.Unchain( (SwFrameFormat&)*rSh.GetFlyFrameFormat() ); + rSh.Unchain( *rSh.GetFlyFrameFormat() ); GetView().GetViewFrame()->GetBindings().Invalidate(FN_FRAME_CHAIN); break; case FN_FORMAT_FOOTNOTE_DLG: diff --git a/sw/source/uibase/uiview/viewtab.cxx b/sw/source/uibase/uiview/viewtab.cxx index 7eff56c3f7e0..698b994b5f46 100644 --- a/sw/source/uibase/uiview/viewtab.cxx +++ b/sw/source/uibase/uiview/viewtab.cxx @@ -1599,14 +1599,14 @@ void SwView::StateTabWin(SfxItemSet& rSet) const SwFormatHeader& rHeaderFormat = rMaster.GetHeader(); SwFrameFormat *pHeaderFormat = const_cast<SwFrameFormat*>(rHeaderFormat.GetHeaderFormat()); if( pHeaderFormat )// #i80890# if rDesc is not the one belonging to the current page is might crash - pBox = & (const SvxBoxItem&)pHeaderFormat->GetBox(); + pBox = & pHeaderFormat->GetBox(); } else if(nFrameType & FrameTypeFlags::FOOTER ) { const SwFormatFooter& rFooterFormat = rMaster.GetFooter(); SwFrameFormat *pFooterFormat = const_cast<SwFrameFormat*>(rFooterFormat.GetFooterFormat()); if( pFooterFormat )// #i80890# if rDesc is not the one belonging to the current page is might crash - pBox = & (const SvxBoxItem&)pFooterFormat->GetBox(); + pBox = & pFooterFormat->GetBox(); } if(pBox) { diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index 45606c4193f9..755d2497cf1d 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -3700,7 +3700,7 @@ uno::Sequence< lang::Locale > SAL_CALL SwXTextDocument::getDocumentLanguages( SdrOutliner* pOutliner = pSdrView->GetTextEditOutliner(); if(pOutliner) { - EditEngine& rEditEng = (EditEngine&)pOutliner->GetEditEngine(); + EditEngine& rEditEng = const_cast<EditEngine&>(pOutliner->GetEditEngine()); sal_Int32 nParCount = pOutliner->GetParagraphCount(); for (sal_Int32 nPar=0; nPar<nParCount; nPar++) { diff --git a/sw/source/uibase/utlui/uitool.cxx b/sw/source/uibase/utlui/uitool.cxx index 887b75e76271..45afe60c1520 100644 --- a/sw/source/uibase/utlui/uitool.cxx +++ b/sw/source/uibase/utlui/uitool.cxx @@ -559,7 +559,7 @@ void PageDescToItemSet( const SwPageDesc& rPageDesc, SfxItemSet& rSet) } // Integrate footnotes - SwPageFootnoteInfo& rInfo = (SwPageFootnoteInfo&)rPageDesc.GetFootnoteInfo(); + SwPageFootnoteInfo& rInfo = const_cast<SwPageFootnoteInfo&>(rPageDesc.GetFootnoteInfo()); SwPageFootnoteInfoItem aFootnoteItem(rInfo); rSet.Put(aFootnoteItem); @@ -627,7 +627,7 @@ void SfxToSwPageDescAttr( const SwWrtShell& rShell, SfxItemSet& rSet ) { // Delete only, if PageDesc will be enabled! rSet.ClearItem( RES_BREAK ); - SwPageDesc* pDesc = ((SwWrtShell&)rShell).FindPageDescByName( + SwPageDesc* pDesc = const_cast<SwWrtShell&>(rShell).FindPageDescByName( rDescName, true ); if( pDesc ) aPgDesc.RegisterToPageDesc( *pDesc ); |