summaryrefslogtreecommitdiff
path: root/sw/source/core
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2021-06-10 12:14:42 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-06-11 11:48:15 +0200
commit36b33c50bd620a0879bf5c8b29de3ac2dada19d0 (patch)
treed0a41a687440d0b59b27720b1c54f9f40323154e /sw/source/core
parent02a5c22e8e4f91b6a8522126b8086520ebb78284 (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/source/core')
-rw-r--r--sw/source/core/crsr/crsrsh.cxx9
-rw-r--r--sw/source/core/crsr/crstrvl.cxx5
-rw-r--r--sw/source/core/crsr/swcrsr.cxx9
-rw-r--r--sw/source/core/doc/DocumentContentOperationsManager.cxx3
-rw-r--r--sw/source/core/doc/docnum.cxx7
-rw-r--r--sw/source/core/docnode/ndtbl.cxx11
-rw-r--r--sw/source/core/edit/edattr.cxx6
-rw-r--r--sw/source/core/fields/ddetbl.cxx8
-rw-r--r--sw/source/core/frmedt/fetab.cxx8
-rw-r--r--sw/source/core/inc/DocumentContentOperationsManager.hxx2
-rw-r--r--sw/source/core/txtnode/ndtxt.cxx6
11 files changed, 26 insertions, 48 deletions
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)