diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-06-10 12:14:42 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-06-11 11:48:15 +0200 |
commit | 36b33c50bd620a0879bf5c8b29de3ac2dada19d0 (patch) | |
tree | d0a41a687440d0b59b27720b1c54f9f40323154e /sw | |
parent | 02a5c22e8e4f91b6a8522126b8086520ebb78284 (diff) |
loplugin:unnecessaryreturn in sw/
Change-Id: Iaca3f5385fd2c763cd1121ae50624aaa4a1f6165
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/117029
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/IDocumentContentOperations.hxx | 2 | ||||
-rw-r--r-- | sw/inc/crsrsh.hxx | 4 | ||||
-rw-r--r-- | sw/inc/doc.hxx | 6 | ||||
-rw-r--r-- | sw/inc/editsh.hxx | 5 | ||||
-rw-r--r-- | sw/inc/fesh.hxx | 2 | ||||
-rw-r--r-- | sw/inc/ndtxt.hxx | 2 | ||||
-rw-r--r-- | sw/inc/swcrsr.hxx | 2 | ||||
-rw-r--r-- | sw/inc/swddetbl.hxx | 2 | ||||
-rw-r--r-- | sw/source/core/crsr/crsrsh.cxx | 9 | ||||
-rw-r--r-- | sw/source/core/crsr/crstrvl.cxx | 5 | ||||
-rw-r--r-- | sw/source/core/crsr/swcrsr.cxx | 9 | ||||
-rw-r--r-- | sw/source/core/doc/DocumentContentOperationsManager.cxx | 3 | ||||
-rw-r--r-- | sw/source/core/doc/docnum.cxx | 7 | ||||
-rw-r--r-- | sw/source/core/docnode/ndtbl.cxx | 11 | ||||
-rw-r--r-- | sw/source/core/edit/edattr.cxx | 6 | ||||
-rw-r--r-- | sw/source/core/fields/ddetbl.cxx | 8 | ||||
-rw-r--r-- | sw/source/core/frmedt/fetab.cxx | 8 | ||||
-rw-r--r-- | sw/source/core/inc/DocumentContentOperationsManager.hxx | 2 | ||||
-rw-r--r-- | sw/source/core/txtnode/ndtxt.cxx | 6 |
19 files changed, 37 insertions, 62 deletions
diff --git a/sw/inc/IDocumentContentOperations.hxx b/sw/inc/IDocumentContentOperations.hxx index 14724eae3731..7b6960e1c074 100644 --- a/sw/inc/IDocumentContentOperations.hxx +++ b/sw/inc/IDocumentContentOperations.hxx @@ -152,7 +152,7 @@ public: /** Move a range. */ - virtual bool MoveAndJoin(SwPaM&, SwPosition&) = 0; + virtual void MoveAndJoin(SwPaM&, SwPosition&) = 0; /** Overwrite string in an existing text node. */ diff --git a/sw/inc/crsrsh.hxx b/sw/inc/crsrsh.hxx index 5b7e71a23634..38b12309c4f2 100644 --- a/sw/inc/crsrsh.hxx +++ b/sw/inc/crsrsh.hxx @@ -544,7 +544,7 @@ public: bool GoPrevCursor(); - bool GoNextPrevCursorSetSearchLabel(const bool bNext); + void GoNextPrevCursorSetSearchLabel(const bool bNext); // at CurrentCursor.SPoint ::sw::mark::IMark* SetBookmark( @@ -613,7 +613,7 @@ public: SwOutlineNodes::size_type GetOutlinePos(sal_uInt8 nLevel = UCHAR_MAX, SwPaM* pPaM = nullptr); // select the given range of OutlineNodes. Optionally including the children // the sal_uInt16s are the positions in OutlineNodes-Array (EditShell) - bool MakeOutlineSel(SwOutlineNodes::size_type nSttPos, SwOutlineNodes::size_type nEndPos, + void MakeOutlineSel(SwOutlineNodes::size_type nSttPos, SwOutlineNodes::size_type nEndPos, bool bWithChildren, bool bKillPams = true ); bool GotoNextOutline(); diff --git a/sw/inc/doc.hxx b/sw/inc/doc.hxx index 19a2b6af64b1..c94e5f04c5f3 100644 --- a/sw/inc/doc.hxx +++ b/sw/inc/doc.hxx @@ -1090,7 +1090,7 @@ public: void UpdateNumRule(); // Update all invalids. void ChgNumRuleFormats( const SwNumRule& rRule ); - bool ReplaceNumRule( const SwPosition& rPos, const OUString& rOldRule, + void ReplaceNumRule( const SwPosition& rPos, const OUString& rOldRule, const OUString& rNewRule ); // Goto next/previous on same level. @@ -1254,7 +1254,7 @@ public: void AppendUndoForInsertFromDB( const SwPaM& rPam, bool bIsTable ); - bool SetColRowWidthHeight( SwTableBox& rCurrentBox, TableChgWidthHeightType eType, + void SetColRowWidthHeight( SwTableBox& rCurrentBox, TableChgWidthHeightType eType, SwTwips nAbsDiff, SwTwips nRelDiff ); SwTableBoxFormat* MakeTableBoxFormat(); SwTableLineFormat* MakeTableLineFormat(); @@ -1279,7 +1279,7 @@ public: bool* pFullTableProtection ); // Split table at baseline position, i.e. create a new table. - bool SplitTable( const SwPosition& rPos, SplitTable_HeadlineOption eMode, + void SplitTable( const SwPosition& rPos, SplitTable_HeadlineOption eMode, bool bCalcNewSize ); /** And vice versa: rPos must be in the table that remains. The flag indicates diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx index c5f5be3c34c7..f2d8c5300535 100644 --- a/sw/inc/editsh.hxx +++ b/sw/inc/editsh.hxx @@ -257,11 +257,8 @@ public: * @param rSet * output parameter - the SfxItemSet where the automatic paragraph format attribute(s) will be store. * The attributes aren't invalidated or cleared if the function reaches the getMaxLookup limit. - * - * @return true if the function inspects all the nodes point by the pPaM parameter, - * false if the function reaches the limit of getMaxLookup number of nodes inspected. */ - bool GetPaMParAttr( SwPaM* pPaM, SfxItemSet& rSet ) const; + void GetPaMParAttr( SwPaM* pPaM, SfxItemSet& rSet ) const; /// Set attribute as new default attribute in document. void SetDefault( const SfxPoolItem& ); diff --git a/sw/inc/fesh.hxx b/sw/inc/fesh.hxx index f142270ddc40..7a1e5e60f685 100644 --- a/sw/inc/fesh.hxx +++ b/sw/inc/fesh.hxx @@ -725,7 +725,7 @@ public: bool IsAdjustCellWidthAllowed( bool bBalance = false ) const; /// Set table style of the current table. - bool SetTableStyle(const OUString& rStyleName); + void SetTableStyle(const OUString& rStyleName); bool SetTableStyle(const SwTableAutoFormat& rNew); /// Update the direct formatting according to the current table style. diff --git a/sw/inc/ndtxt.hxx b/sw/inc/ndtxt.hxx index 5e189bb1199d..9b7de4e89cb7 100644 --- a/sw/inc/ndtxt.hxx +++ b/sw/inc/ndtxt.hxx @@ -606,7 +606,7 @@ public: * @param bOutlineContentVisibleAttr the value stored in RES_PARATR_GRABBAG for 'OutlineContentVisibleAttr' * @return true if 'OutlineContentVisibleAttr' is found in RES_PARATR_GRABBAG */ - bool GetAttrOutlineContentVisible(bool& bOutlineContentVisibleAttr); + void GetAttrOutlineContentVisible(bool& bOutlineContentVisibleAttr); void SetAttrOutlineContentVisible(bool bVisible); bool IsEmptyListStyleDueToSetOutlineLevelAttr() const { return mbEmptyListStyleSetDueToSetOutlineLevelAttr;} diff --git a/sw/inc/swcrsr.hxx b/sw/inc/swcrsr.hxx index 234b0196d68e..e8fa059ee5ff 100644 --- a/sw/inc/swcrsr.hxx +++ b/sw/inc/swcrsr.hxx @@ -158,7 +158,7 @@ public: END_SENT }; bool GoSentence(SentenceMoveType eMoveType, SwRootFrame const*pLayout = nullptr); - bool ExpandToSentenceBorders(SwRootFrame const* pLayout); + void ExpandToSentenceBorders(SwRootFrame const* pLayout); virtual bool LeftRight( bool bLeft, sal_uInt16 nCnt, sal_uInt16 nMode, bool bAllowVisual, bool bSkipHidden, bool bInsertCursor, diff --git a/sw/inc/swddetbl.hxx b/sw/inc/swddetbl.hxx index b21b1a5993f2..efe956662583 100644 --- a/sw/inc/swddetbl.hxx +++ b/sw/inc/swddetbl.hxx @@ -35,7 +35,7 @@ public: virtual ~SwDDETable() override; void ChangeContent(); - bool NoDDETable(); + void NoDDETable(); SwDDEFieldType* GetDDEFieldType(); inline const SwDDEFieldType* GetDDEFieldType() const; diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx index e747b1753601..1ba7d8d71477 100644 --- a/sw/source/core/crsr/crsrsh.cxx +++ b/sw/source/core/crsr/crsrsh.cxx @@ -1390,7 +1390,7 @@ bool SwCursorShell::GoPrevCursor() return true; } -bool SwCursorShell::GoNextPrevCursorSetSearchLabel(const bool bNext) +void SwCursorShell::GoNextPrevCursorSetSearchLabel(const bool bNext) { SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::Empty ); @@ -1398,10 +1398,13 @@ bool SwCursorShell::GoNextPrevCursorSetSearchLabel(const bool bNext) { if( !m_pCurrentCursor->HasMark() ) SvxSearchDialogWrapper::SetSearchLabel( SearchLabel::NavElementNotFound ); - return false; + return; } - return bNext ? GoNextCursor() : GoPrevCursor(); + if (bNext) + GoNextCursor(); + else + GoPrevCursor(); } void SwCursorShell::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle &rRect) diff --git a/sw/source/core/crsr/crstrvl.cxx b/sw/source/core/crsr/crstrvl.cxx index 3ce07a3cb577..3e8056fe8daf 100644 --- a/sw/source/core/crsr/crstrvl.cxx +++ b/sw/source/core/crsr/crstrvl.cxx @@ -1164,13 +1164,13 @@ SwOutlineNodes::size_type SwCursorShell::GetOutlinePos(sal_uInt8 nLevel, SwPaM* return SwOutlineNodes::npos; // no more left } -bool SwCursorShell::MakeOutlineSel(SwOutlineNodes::size_type nSttPos, SwOutlineNodes::size_type nEndPos, +void SwCursorShell::MakeOutlineSel(SwOutlineNodes::size_type nSttPos, SwOutlineNodes::size_type nEndPos, bool bWithChildren , bool bKillPams) { const SwNodes& rNds = GetDoc()->GetNodes(); const SwOutlineNodes& rOutlNds = rNds.GetOutLineNds(); if( rOutlNds.empty() ) - return false; + return; CurrShell aCurr( this ); SwCallLink aLk( *this ); // watch Cursor-Moves @@ -1218,7 +1218,6 @@ bool SwCursorShell::MakeOutlineSel(SwOutlineNodes::size_type nSttPos, SwOutlineN bool bRet = !m_pCurrentCursor->IsSelOvr(); if( bRet ) UpdateCursor(SwCursorShell::SCROLLWIN|SwCursorShell::CHKRANGE|SwCursorShell::READONLY); - return bRet; } /// jump to reference marker diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx index 5ae9e5c78e76..2159d3dd2224 100644 --- a/sw/source/core/crsr/swcrsr.cxx +++ b/sw/source/core/crsr/swcrsr.cxx @@ -1626,9 +1626,8 @@ bool SwCursor::GoSentence(SentenceMoveType eMoveType, SwRootFrame const*const pL return bRet; } -bool SwCursor::ExpandToSentenceBorders(SwRootFrame const*const pLayout) +void SwCursor::ExpandToSentenceBorders(SwRootFrame const*const pLayout) { - bool bRes = false; SwTextNode* pStartNd = Start()->nNode.GetNode().GetTextNode(); SwTextNode* pEndNd = End()->nNode.GetNode().GetTextNode(); if (pStartNd && pEndNd) @@ -1660,21 +1659,15 @@ bool SwCursor::ExpandToSentenceBorders(SwRootFrame const*const pLayout) // it is allowed to place the PaM just behind the last // character in the text thus <= ...Len - bool bChanged = false; if (nStartPos <= pStartNd->GetText().getLength() && nStartPos >= 0) { *GetMark() = SwPosition(*pStartNd, nStartPos); - bChanged = true; } if (nEndPos <= pEndNd->GetText().getLength() && nEndPos >= 0) { *GetPoint() = SwPosition(*pEndNd, nEndPos); - bChanged = true; } - if (bChanged && !IsSelOvr()) - bRes = true; } - return bRes; } bool SwTableCursor::LeftRight( bool bLeft, sal_uInt16 nCnt, sal_uInt16 /*nMode*/, diff --git a/sw/source/core/doc/DocumentContentOperationsManager.cxx b/sw/source/core/doc/DocumentContentOperationsManager.cxx index c5313a093470..44c5c9ded7f9 100644 --- a/sw/source/core/doc/DocumentContentOperationsManager.cxx +++ b/sw/source/core/doc/DocumentContentOperationsManager.cxx @@ -2552,7 +2552,7 @@ bool DocumentContentOperationsManager::MoveNodeRange( SwNodeRange& rRange, SwNod return true; } -bool DocumentContentOperationsManager::MoveAndJoin( SwPaM& rPaM, SwPosition& rPos ) +void DocumentContentOperationsManager::MoveAndJoin( SwPaM& rPaM, SwPosition& rPos ) { SwNodeIndex aIdx( rPaM.Start()->nNode ); bool bJoinText = aIdx.GetNode().IsTextNode(); @@ -2575,7 +2575,6 @@ bool DocumentContentOperationsManager::MoveAndJoin( SwPaM& rPaM, SwPosition& rPo pTextNd->JoinNext(); } } - return bRet; } // Overwrite only uses the point of the PaM, the mark is ignored; characters diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx index 586324391888..95461208e954 100644 --- a/sw/source/core/doc/docnum.cxx +++ b/sw/source/core/doc/docnum.cxx @@ -1163,10 +1163,9 @@ void SwDoc::StopNumRuleAnimations( const OutputDevice* pOut ) } } -bool SwDoc::ReplaceNumRule( const SwPosition& rPos, +void SwDoc::ReplaceNumRule( const SwPosition& rPos, const OUString& rOldRule, const OUString& rNewRule ) { - bool bRet = false; SwNumRule *pOldRule = FindNumRulePtr( rOldRule ), *pNewRule = FindNumRulePtr( rNewRule ); if( pOldRule && pNewRule && pOldRule != pNewRule ) @@ -1201,12 +1200,8 @@ bool SwDoc::ReplaceNumRule( const SwPosition& rPos, } GetIDocumentUndoRedo().EndUndo( SwUndoId::END, nullptr ); getIDocumentState().SetModified(); - - bRet = true; } } - - return bRet; } namespace diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index 1b23437c3fbd..0cc141a2b6c9 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -3097,16 +3097,16 @@ void sw_BoxSetSplitBoxFormats( SwTableBox* pBox, SwCollectTableLineBoxes* pSplPa * Boxes' Max; but only if Size is using absolute * values (USHRT_MAX) */ -bool SwDoc::SplitTable( const SwPosition& rPos, SplitTable_HeadlineOption eHdlnMode, +void SwDoc::SplitTable( const SwPosition& rPos, SplitTable_HeadlineOption eHdlnMode, bool bCalcNewSize ) { SwNode* pNd = &rPos.nNode.GetNode(); SwTableNode* pTNd = pNd->FindTableNode(); if( !pTNd || pNd->IsTableNode() ) - return false; + return; if( dynamic_cast<const SwDDETable*>( &pTNd->GetTable() ) != nullptr) - return false; + return; SwTable& rTable = pTNd->GetTable(); rTable.SetHTMLTableLayout(std::shared_ptr<SwHTMLTableLayout>()); // Delete HTML Layout @@ -3235,8 +3235,6 @@ bool SwDoc::SplitTable( const SwPosition& rPos, SplitTable_HeadlineOption eHdlnM GetDocShell()->GetFEShell()->UpdateTableStyleFormatting(pNew); getIDocumentFieldsAccess().SetFieldsDirty( true, nullptr, 0 ); - - return nullptr != pNew; } static bool lcl_ChgTableSize( SwTable& rTable ) @@ -3973,7 +3971,7 @@ SwTableFormat* SwDoc::FindTableFormatByName( std::u16string_view rName, bool bAl return const_cast<SwTableFormat*>(static_cast<const SwTableFormat*>(pRet)); } -bool SwDoc::SetColRowWidthHeight( SwTableBox& rCurrentBox, TableChgWidthHeightType eType, +void SwDoc::SetColRowWidthHeight( SwTableBox& rCurrentBox, TableChgWidthHeightType eType, SwTwips nAbsDiff, SwTwips nRelDiff ) { SwTableNode* pTableNd = const_cast<SwTableNode*>(rCurrentBox.GetSttNd()->FindTableNode()); @@ -4017,7 +4015,6 @@ bool SwDoc::SetColRowWidthHeight( SwTableBox& rCurrentBox, TableChgWidthHeightTy { getIDocumentState().SetModified(); } - return bRet; } bool SwDoc::IsNumberFormat( const OUString& rString, sal_uInt32& F_Index, double& fOutNumber ) diff --git a/sw/source/core/edit/edattr.cxx b/sw/source/core/edit/edattr.cxx index c6bb80b318cb..6ab5a3ae9ad8 100644 --- a/sw/source/core/edit/edattr.cxx +++ b/sw/source/core/edit/edattr.cxx @@ -185,7 +185,7 @@ void SwEditShell::GetCurParAttr( SfxItemSet& rSet) const GetPaMParAttr( GetCursor(), rSet ); } -bool SwEditShell::GetPaMParAttr( SwPaM* pPaM, SfxItemSet& rSet ) const +void SwEditShell::GetPaMParAttr( SwPaM* pPaM, SfxItemSet& rSet ) const { // number of nodes the function has explored so far sal_uInt16 numberOfLookup = 0; @@ -236,11 +236,9 @@ bool SwEditShell::GetPaMParAttr( SwPaM* pPaM, SfxItemSet& rSet ) const // if the maximum number of node that can be inspected has been reached if (numberOfLookup >= getMaxLookup()) - return false; + return; } } - - return true; } SwTextFormatColl* SwEditShell::GetCurTextFormatColl( ) const diff --git a/sw/source/core/fields/ddetbl.cxx b/sw/source/core/fields/ddetbl.cxx index 1be2200fae3b..f4b959014575 100644 --- a/sw/source/core/fields/ddetbl.cxx +++ b/sw/source/core/fields/ddetbl.cxx @@ -175,7 +175,7 @@ SwDDEFieldType* SwDDETable::GetDDEFieldType() return m_pDDEType; } -bool SwDDETable::NoDDETable() +void SwDDETable::NoDDETable() { // search table node OSL_ENSURE( GetFrameFormat(), "No FrameFormat" ); @@ -183,11 +183,11 @@ bool SwDDETable::NoDDETable() // Is this the correct NodesArray? (because of UNDO) if( m_aLines.empty() ) - return false; + return; OSL_ENSURE( !GetTabSortBoxes().empty(), "Table without content?" ); SwNode* pNd = const_cast<SwNode*>(static_cast<SwNode const *>(GetTabSortBoxes()[0]->GetSttNd())); if( !pNd->GetNodes().IsDocNodes() ) - return false; + return; SwTableNode* pTableNd = pNd->FindTableNode(); OSL_ENSURE( pTableNd, "Where is the table?"); @@ -206,8 +206,6 @@ bool SwDDETable::NoDDETable() m_pDDEType->DecRefCnt(); pTableNd->SetNewTable( std::move(pNewTable) ); // replace table - - return true; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx index bd82d5deee2c..cb8cec705604 100644 --- a/sw/source/core/frmedt/fetab.cxx +++ b/sw/source/core/frmedt/fetab.cxx @@ -1199,19 +1199,19 @@ bool SwFEShell::IsAdjustCellWidthAllowed( bool bBalance ) const return false; } -bool SwFEShell::SetTableStyle(const OUString& rStyleName) +void SwFEShell::SetTableStyle(const OUString& rStyleName) { // make sure SwDoc has the style SwTableAutoFormat *pTableFormat = GetDoc()->GetTableStyles().FindAutoFormat(rStyleName); if (!pTableFormat) - return false; + return; SwTableNode *pTableNode = const_cast<SwTableNode*>(IsCursorInTable()); if (!pTableNode) - return false; + return; // set the name & update - return UpdateTableStyleFormatting(pTableNode, false, &rStyleName); + UpdateTableStyleFormatting(pTableNode, false, &rStyleName); } // AutoFormat for the table/table selection diff --git a/sw/source/core/inc/DocumentContentOperationsManager.hxx b/sw/source/core/inc/DocumentContentOperationsManager.hxx index 3df39532978c..cc030690e1da 100644 --- a/sw/source/core/inc/DocumentContentOperationsManager.hxx +++ b/sw/source/core/inc/DocumentContentOperationsManager.hxx @@ -54,7 +54,7 @@ public: bool MoveNodeRange(SwNodeRange&, SwNodeIndex&, SwMoveFlags) override; - bool MoveAndJoin(SwPaM&, SwPosition&) override; + void MoveAndJoin(SwPaM&, SwPosition&) override; bool Overwrite(const SwPaM &rRg, const OUString& rStr) override; diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index 1a21120cb05c..42abd0f81130 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -4019,16 +4019,12 @@ void SwTextNode::SetAttrOutlineLevel(int nLevel) } } -bool SwTextNode::GetAttrOutlineContentVisible(bool& bOutlineContentVisibleAttr) +void SwTextNode::GetAttrOutlineContentVisible(bool& bOutlineContentVisibleAttr) { SfxGrabBagItem aGrabBagItem(dynamic_cast<const SfxGrabBagItem&>(GetAttr(RES_PARATR_GRABBAG))); auto it = aGrabBagItem.GetGrabBag().find("OutlineContentVisibleAttr"); if (it != aGrabBagItem.GetGrabBag().end()) - { it->second >>= bOutlineContentVisibleAttr; - return true; - } - return false; } void SwTextNode::SetAttrOutlineContentVisible(bool bVisible) |