diff options
Diffstat (limited to 'sw/source')
-rw-r--r-- | sw/source/core/doc/DocumentLinksAdministrationManager.cxx | 14 | ||||
-rw-r--r-- | sw/source/core/draw/dview.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/edit/edfcol.cxx | 22 | ||||
-rw-r--r-- | sw/source/core/edit/edtox.cxx | 17 | ||||
-rw-r--r-- | sw/source/core/frmedt/fefly1.cxx | 13 | ||||
-rw-r--r-- | sw/source/core/frmedt/feshview.cxx | 12 | ||||
-rw-r--r-- | sw/source/core/layout/findfrm.cxx | 4 | ||||
-rw-r--r-- | sw/source/core/layout/flylay.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/layout/ftnfrm.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/txtnode/fntcache.cxx | 5 | ||||
-rw-r--r-- | sw/source/core/undo/docundo.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/docxattributeoutput.cxx | 8 | ||||
-rw-r--r-- | sw/source/uibase/docvw/edtwin.cxx | 5 | ||||
-rw-r--r-- | sw/source/uibase/fldui/fldmgr.cxx | 2 |
14 files changed, 51 insertions, 59 deletions
diff --git a/sw/source/core/doc/DocumentLinksAdministrationManager.cxx b/sw/source/core/doc/DocumentLinksAdministrationManager.cxx index 577db70611ff..659acaf4e97a 100644 --- a/sw/source/core/doc/DocumentLinksAdministrationManager.cxx +++ b/sw/source/core/doc/DocumentLinksAdministrationManager.cxx @@ -65,15 +65,13 @@ namespace ::sfx2::SvBaseLink* lcl_FindNextRemovableLink( const ::sfx2::SvBaseLinks& rLinks ) { - for(const auto & rLink : rLinks) + for (const auto& rLinkIter : rLinks) { - ::sfx2::SvBaseLink* pLnk = &(*rLink); - if( pLnk && - ( OBJECT_CLIENT_GRF == pLnk->GetObjType() || - OBJECT_CLIENT_FILE == pLnk->GetObjType() ) && - dynamic_cast<const SwBaseLink*>( pLnk) != nullptr ) + ::sfx2::SvBaseLink& rLnk = *rLinkIter; + if ((OBJECT_CLIENT_GRF == rLnk.GetObjType() || OBJECT_CLIENT_FILE == rLnk.GetObjType()) + && dynamic_cast<const SwBaseLink*>(&rLnk) != nullptr) { - tools::SvRef<sfx2::SvBaseLink> xLink = pLnk; + tools::SvRef<sfx2::SvBaseLink> xLink(&rLnk); OUString sFName; sfx2::LinkManager::GetDisplayNames( xLink.get(), nullptr, &sFName ); @@ -81,7 +79,7 @@ namespace INetURLObject aURL( sFName ); if( INetProtocol::File == aURL.GetProtocol() || INetProtocol::Cid == aURL.GetProtocol() ) - return pLnk; + return &rLnk; } } return nullptr; diff --git a/sw/source/core/draw/dview.cxx b/sw/source/core/draw/dview.cxx index 0fa554afb4be..70436dd66f2e 100644 --- a/sw/source/core/draw/dview.cxx +++ b/sw/source/core/draw/dview.cxx @@ -633,7 +633,7 @@ void SwDrawView::ObjOrderChanged( SdrObject* pObj, size_t nOldPos, // adjust loop counter if ( bMovedForward ) ++i; - else if ( !bMovedForward && i > 0 ) + else if (i > 0) --i; } diff --git a/sw/source/core/edit/edfcol.cxx b/sw/source/core/edit/edfcol.cxx index 5da40eb2555b..f87679332f42 100644 --- a/sw/source/core/edit/edfcol.cxx +++ b/sw/source/core/edit/edfcol.cxx @@ -2213,22 +2213,22 @@ void SwEditShell::FillByEx(SwTextFormatColl* pColl) // Do NOT copy AutoNumRules into the template const SfxPoolItem* pItem; const SwNumRule* pRule = nullptr; - if( SfxItemState::SET == pSet->GetItemState( RES_BREAK, false ) || - SfxItemState::SET == pSet->GetItemState( RES_PAGEDESC,false ) || - ( SfxItemState::SET == pSet->GetItemState( RES_PARATR_NUMRULE, - false, &pItem ) && nullptr != (pRule = GetDoc()->FindNumRulePtr( - static_cast<const SwNumRuleItem*>(pItem)->GetValue() )) && - pRule && pRule->IsAutoRule() ) - ) + if (SfxItemState::SET == pSet->GetItemState(RES_BREAK, false) + || SfxItemState::SET == pSet->GetItemState(RES_PAGEDESC, false) + || (SfxItemState::SET == pSet->GetItemState(RES_PARATR_NUMRULE, false, &pItem) + && nullptr != (pRule = GetDoc()->FindNumRulePtr( + static_cast<const SwNumRuleItem*>(pItem)->GetValue())) + && pRule->IsAutoRule())) { SfxItemSet aSet( *pSet ); aSet.ClearItem( RES_BREAK ); aSet.ClearItem( RES_PAGEDESC ); - if( pRule || (SfxItemState::SET == pSet->GetItemState( RES_PARATR_NUMRULE, - false, &pItem ) && nullptr != (pRule = GetDoc()->FindNumRulePtr( - static_cast<const SwNumRuleItem*>(pItem)->GetValue() )) && - pRule && pRule->IsAutoRule() )) + if (pRule + || (SfxItemState::SET == pSet->GetItemState(RES_PARATR_NUMRULE, false, &pItem) + && nullptr != (pRule = GetDoc()->FindNumRulePtr( + static_cast<const SwNumRuleItem*>(pItem)->GetValue())) + && pRule->IsAutoRule())) aSet.ClearItem( RES_PARATR_NUMRULE ); if( aSet.Count() ) diff --git a/sw/source/core/edit/edtox.cxx b/sw/source/core/edit/edtox.cxx index 80526cc81b5f..2495fc8de524 100644 --- a/sw/source/core/edit/edtox.cxx +++ b/sw/source/core/edit/edtox.cxx @@ -154,17 +154,16 @@ void SwEditShell::InsertTableOf( const SwTOXBase& rTOX, const SfxItemSet* pSet ) } /// update tables of content -void SwEditShell::UpdateTableOf( const SwTOXBase& rTOX, const SfxItemSet* pSet ) +void SwEditShell::UpdateTableOf(const SwTOXBase& rTOX, const SfxItemSet* pSet) { - OSL_ENSURE( dynamic_cast<const SwTOXBaseSection*>( &rTOX) != nullptr, "no TOXBaseSection!" ); - SwTOXBaseSection* pTOX = const_cast<SwTOXBaseSection*>(static_cast<const SwTOXBaseSection*>(&rTOX)); - OSL_ENSURE(pTOX, "no current listing"); - if( pTOX && nullptr != pTOX->GetFormat()->GetSectionNode() ) + assert(dynamic_cast<const SwTOXBaseSection*>(&rTOX) && "no TOXBaseSection!"); + SwTOXBaseSection& rTOXSect = static_cast<SwTOXBaseSection&>(const_cast<SwTOXBase&>(rTOX)); + if (rTOXSect.GetFormat()->GetSectionNode()) { SwDoc* pMyDoc = GetDoc(); SwDocShell* pDocSh = pMyDoc->GetDocShell(); - bool bInIndex = pTOX == GetCurTOX(); + bool bInIndex = &rTOX == GetCurTOX(); SET_CURR_SHELL( this ); StartAllAction(); @@ -174,17 +173,17 @@ void SwEditShell::UpdateTableOf( const SwTOXBase& rTOX, const SfxItemSet* pSet ) pMyDoc->GetIDocumentUndoRedo().StartUndo(SwUndoId::TOXCHANGE, nullptr); // create listing stub - pTOX->Update(pSet); + rTOXSect.Update(pSet); // correct Cursor if( bInIndex ) - pTOX->SetPosAtStartEnd( *GetCursor()->GetPoint() ); + rTOXSect.SetPosAtStartEnd(*GetCursor()->GetPoint()); // start formatting CalcLayout(); // insert page numbering - pTOX->UpdatePageNum(); + rTOXSect.UpdatePageNum(); pMyDoc->GetIDocumentUndoRedo().EndUndo(SwUndoId::TOXCHANGE, nullptr); diff --git a/sw/source/core/frmedt/fefly1.cxx b/sw/source/core/frmedt/fefly1.cxx index d94ee5c8e6ad..107bb3feac55 100644 --- a/sw/source/core/frmedt/fefly1.cxx +++ b/sw/source/core/frmedt/fefly1.cxx @@ -978,7 +978,6 @@ void SwFEShell::SetPageObjsNewPage( std::vector<SwFrameFormat*>& rFillArr ) StartAllAction(); StartUndo(); - long nNewPage; SwRootFrame* pTmpRootFrame = GetLayout(); sal_uInt16 nMaxPage = pTmpRootFrame->GetPageNum(); bool bTmpAssert = false; @@ -989,13 +988,11 @@ void SwFEShell::SetPageObjsNewPage( std::vector<SwFrameFormat*>& rFillArr ) // FlyFormat is still valid, therefore process SwFormatAnchor aNewAnchor( pFormat->GetAnchor() ); - if ((RndStdIds::FLY_AT_PAGE != aNewAnchor.GetAnchorId()) || - 0 >= ( nNewPage = aNewAnchor.GetPageNum() + 1 ) ) - // Anchor has been changed or invalid page number, - // therefore: do not change! + if (RndStdIds::FLY_AT_PAGE != aNewAnchor.GetAnchorId()) + // Anchor has been changed, therefore: do not change! continue; - - if( sal_uInt16(nNewPage) > nMaxPage ) + sal_uInt16 nNewPage = aNewAnchor.GetPageNum() + 1; + if (nNewPage > nMaxPage) { if ( RES_DRAWFRMFMT == pFormat->Which() ) pFormat->CallSwClientNotify(sw::DrawFrameFormatHint(sw::DrawFrameFormatHintId::PAGE_OUT_OF_BOUNDS)); @@ -1003,7 +1000,7 @@ void SwFEShell::SetPageObjsNewPage( std::vector<SwFrameFormat*>& rFillArr ) pFormat->DelFrames(); bTmpAssert = true; } - aNewAnchor.SetPageNum( sal_uInt16(nNewPage) ); + aNewAnchor.SetPageNum(nNewPage); mxDoc->SetAttr( aNewAnchor, *pFormat ); } } diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx index ae1259ce55ca..4abc8f16aea1 100644 --- a/sw/source/core/frmedt/feshview.cxx +++ b/sw/source/core/frmedt/feshview.cxx @@ -348,14 +348,14 @@ static bool LessY( Point const & aPt1, Point const & aPt2, bool bOld ) bool SwFEShell::MoveAnchor( SwMove nDir ) { - const SdrMarkList* pMrkList; - if( !Imp()->GetDrawView() || - nullptr == (pMrkList = &Imp()->GetDrawView()->GetMarkedObjectList()) || - 1 != pMrkList->GetMarkCount()) + if (!Imp()->GetDrawView()) + return false; + const SdrMarkList& pMrkList = Imp()->GetDrawView()->GetMarkedObjectList(); + if (1 != pMrkList.GetMarkCount()) return false; SwFrame* pOld; SwFlyFrame* pFly = nullptr; - SdrObject *pObj = pMrkList->GetMark( 0 )->GetMarkedSdrObj(); + SdrObject *pObj = pMrkList.GetMark( 0 )->GetMarkedSdrObj(); if (SwVirtFlyDrawObj* pVirtO = dynamic_cast<SwVirtFlyDrawObj*>(pObj)) { pFly = pVirtO->GetFlyFrame(); @@ -1546,7 +1546,7 @@ const SdrObject* SwFEShell::GetBestObject( bool bNext, GotoObjFlags eType, bool (pVirtO && pVirtO->IsTextBox()) || ( eType == GotoObjFlags::DrawSimple && lcl_IsControlGroup( pObj ) ) || ( eType == GotoObjFlags::DrawControl && !lcl_IsControlGroup( pObj ) ) || - ( pFilter && !pFilter->includeObject( *pObj ) ) ) + !pFilter->includeObject( *pObj ) ) continue; if (pVirtO) { diff --git a/sw/source/core/layout/findfrm.cxx b/sw/source/core/layout/findfrm.cxx index a38f9f989529..a0c0eceebfac 100644 --- a/sw/source/core/layout/findfrm.cxx +++ b/sw/source/core/layout/findfrm.cxx @@ -395,8 +395,8 @@ const SwContentFrame* SwContentFrame::ImplGetNextContentFrame( bool bFwd ) const } bGoingUp = !(bGoingFwdOrBwd || bGoingDown); - - if ( !bFwd && bGoingDown && p ) + assert(p); + if (!bFwd && bGoingDown) { while ( p->GetNext() ) p = p->GetNext(); diff --git a/sw/source/core/layout/flylay.cxx b/sw/source/core/layout/flylay.cxx index 6dde1f694242..680632625da7 100644 --- a/sw/source/core/layout/flylay.cxx +++ b/sw/source/core/layout/flylay.cxx @@ -123,7 +123,7 @@ void SwFlyFreeFrame::MakeAll(vcl::RenderContext* /*pRenderContext*/) } // #i28701# - use new method <GetPageFrame()> - if( !GetPageFrame() && GetAnchorFrame() && GetAnchorFrame()->IsInFly() ) + if( !GetPageFrame() && GetAnchorFrame()->IsInFly() ) { SwFlyFrame* pFly = AnchorFrame()->FindFlyFrame(); SwPageFrame *pPageFrame = pFly ? pFly->FindPageFrame() : nullptr; diff --git a/sw/source/core/layout/ftnfrm.cxx b/sw/source/core/layout/ftnfrm.cxx index ef0d950e62b3..7cc0b077e6eb 100644 --- a/sw/source/core/layout/ftnfrm.cxx +++ b/sw/source/core/layout/ftnfrm.cxx @@ -1346,7 +1346,7 @@ void SwFootnoteBossFrame::InsertFootnote( SwFootnoteFrame* pNew ) } if ( !bEnd && pSibling ) nCmpPos = ::lcl_FindFootnotePos( pDoc, pSibling->GetAttr() ); - if ( pSibling && pLastSib && (pSibling != pLastSib) ) + if (pSibling && (pSibling != pLastSib)) { // too far? if ( (nLastPos < nCmpPos) && (nCmpPos > nStPos) ) diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx index 24d91cba54f0..7d5bcf66a9fa 100644 --- a/sw/source/core/txtnode/fntcache.cxx +++ b/sw/source/core/txtnode/fntcache.cxx @@ -2561,12 +2561,11 @@ TextFrameIndex SwFont::GetTextBreak(SwDrawTextInfo const & rInf, long nTextWidth bool SwDrawTextInfo::ApplyAutoColor( vcl::Font* pFont ) { const vcl::Font& rFnt = pFont ? *pFont : GetOut().GetFont(); - bool bPrt = GetShell() && ! GetShell()->GetWin(); Color nNewColor = COL_BLACK; bool bChgFntColor = false; bool bChgLineColor = false; - if( bPrt && GetShell() && GetShell()->GetViewOptions()->IsBlackFont() ) + if (GetShell() && !GetShell()->GetWin() && GetShell()->GetViewOptions()->IsBlackFont()) { if ( COL_BLACK != rFnt.GetColor() ) bChgFntColor = true; @@ -2582,7 +2581,7 @@ bool SwDrawTextInfo::ApplyAutoColor( vcl::Font* pFont ) // LineColor has to be changed if: // 1. IsAlwaysAutoColor is set - bChgLineColor = ! bPrt && GetShell() && + bChgLineColor = GetShell() && GetShell()->GetWin() && GetShell()->GetAccessibilityOptions()->IsAlwaysAutoColor(); bChgFntColor = COL_AUTO == rFnt.GetColor() || bChgLineColor; diff --git a/sw/source/core/undo/docundo.cxx b/sw/source/core/undo/docundo.cxx index f5720c7aad77..73105e2f5a02 100644 --- a/sw/source/core/undo/docundo.cxx +++ b/sw/source/core/undo/docundo.cxx @@ -133,7 +133,7 @@ size_t UndoManager::GetRedoActionCount(const bool bCurrentLevel) const if (!pAction) return nRet; - if (m_pView && !m_bRepair) + if (!m_bRepair) { // If another view created the first redo action, prevent redoing it from this view. ViewShellId nViewShellId = m_pView->GetViewShellId(); diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index 016851c4d892..a7851e49e49f 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -3188,10 +3188,10 @@ static void impl_borders( FSHelperPtr const & pSerializer, // If there is a shadow, and it's not the regular 'Bottom-Right', // then write only the 'shadowed' sides of the border if ( - ( ( rOptions.aShadowLocation == SvxShadowLocation::TopLeft || rOptions.aShadowLocation == SvxShadowLocation::TopRight ) && *pBrd == SvxBoxItemLine::TOP ) || - ( ( rOptions.aShadowLocation == SvxShadowLocation::TopLeft || rOptions.aShadowLocation == SvxShadowLocation::BottomLeft ) && *pBrd == SvxBoxItemLine::LEFT ) || - ( ( rOptions.aShadowLocation == SvxShadowLocation::BottomLeft || rOptions.aShadowLocation == SvxShadowLocation::BottomRight ) && *pBrd == SvxBoxItemLine::BOTTOM) || - ( ( rOptions.aShadowLocation == SvxShadowLocation::TopRight || rOptions.aShadowLocation == SvxShadowLocation::BottomRight ) && *pBrd == SvxBoxItemLine::RIGHT ) + ((rOptions.aShadowLocation == SvxShadowLocation::TopLeft || rOptions.aShadowLocation == SvxShadowLocation::TopRight ) && *pBrd == SvxBoxItemLine::TOP ) || + ((rOptions.aShadowLocation == SvxShadowLocation::TopLeft || rOptions.aShadowLocation == SvxShadowLocation::BottomLeft) && *pBrd == SvxBoxItemLine::LEFT ) || + ((rOptions.aShadowLocation == SvxShadowLocation::BottomLeft ) && *pBrd == SvxBoxItemLine::BOTTOM) || + ((rOptions.aShadowLocation == SvxShadowLocation::TopRight ) && *pBrd == SvxBoxItemLine::RIGHT ) ) { bWriteShadow = true; diff --git a/sw/source/uibase/docvw/edtwin.cxx b/sw/source/uibase/docvw/edtwin.cxx index 23ceeca5a22b..1dcf34f2d88e 100644 --- a/sw/source/uibase/docvw/edtwin.cxx +++ b/sw/source/uibase/docvw/edtwin.cxx @@ -1284,7 +1284,7 @@ void SwEditWin::ChangeDrawing( sal_uInt8 nDir ) else { // move handle with index nHandleIndex - if(pHdl && (nX || nY)) + if (nX || nY) { if( SdrHdlKind::Anchor == pHdl->GetKind() || SdrHdlKind::Anchor_TR == pHdl->GetKind() ) @@ -3114,8 +3114,7 @@ void SwEditWin::MouseButtonDown(const MouseEvent& _rMEvt) // only try to select frame, if pointer already was // switched accordingly if ( m_aActHitType != SdrHitKind::NONE && !rSh.IsSelFrameMode() && - !GetView().GetViewFrame()->GetDispatcher()->IsLocked() && - !bExecDrawTextLink) + !GetView().GetViewFrame()->GetDispatcher()->IsLocked()) { // Test if there is a draw object at that position and if it should be selected. bool bShould = rSh.ShouldObjectBeSelected(aDocPos); diff --git a/sw/source/uibase/fldui/fldmgr.cxx b/sw/source/uibase/fldui/fldmgr.cxx index 52c8a12bd17e..5ada2a617ae4 100644 --- a/sw/source/uibase/fldui/fldmgr.cxx +++ b/sw/source/uibase/fldui/fldmgr.cxx @@ -883,7 +883,7 @@ bool SwFieldMgr::GoNextPrev( bool bNext, SwFieldType* pTyp ) return pSh->MoveFieldType( nullptr, bNext, SwFieldIds::Database ); } - return pTyp && pSh && pSh->MoveFieldType( pTyp, bNext ); + return pTyp && pSh->MoveFieldType(pTyp, bNext); } // insert field types |