summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2018-05-14 17:14:18 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2018-06-11 11:38:15 +0200
commit1f08bff31238d5818c54a0b86570689644dff087 (patch)
treed4d6f4b62a3c48ddeb85ba89818247c17f2578c8 /sw
parentff130af9661a57d290dbf89b54a4c0ce8d0f71ea (diff)
new loplugin:shouldreturnbool
look for methods returning only 1 and/or 0, which (most of the time) should be returning bool. Off by default, because some of this is a matter of taste Change-Id: Ib17782e629888255196e89d4a178618a9612a0de Reviewed-on: https://gerrit.libreoffice.org/54379 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/editsh.hxx2
-rw-r--r--sw/inc/view.hxx16
-rw-r--r--sw/source/core/edit/editsh.cxx3
-rw-r--r--sw/source/uibase/dochdl/gloshdl.cxx4
-rw-r--r--sw/source/uibase/dochdl/swdtflvr.cxx6
-rw-r--r--sw/source/uibase/inc/langhelper.hxx2
-rw-r--r--sw/source/uibase/inc/swdtflvr.hxx2
-rw-r--r--sw/source/uibase/inc/wrtsh.hxx2
-rw-r--r--sw/source/uibase/shells/drwtxtex.cxx3
-rw-r--r--sw/source/uibase/shells/langhelper.cxx3
-rw-r--r--sw/source/uibase/shells/txtcrsr.cxx3
-rw-r--r--sw/source/uibase/uiview/viewmdi.cxx12
-rw-r--r--sw/source/uibase/uiview/viewport.cxx18
-rw-r--r--sw/source/uibase/wrtsh/select.cxx3
14 files changed, 36 insertions, 43 deletions
diff --git a/sw/inc/editsh.hxx b/sw/inc/editsh.hxx
index 42a542ff3502..07308fa4db3d 100644
--- a/sw/inc/editsh.hxx
+++ b/sw/inc/editsh.hxx
@@ -202,7 +202,7 @@ public:
Copy all selections to the document. */
bool CopySelToDoc( SwDoc* pInsDoc );
- long SplitNode( bool bAutoFormat = false, bool bCheckTableStart = true );
+ void SplitNode( bool bAutoFormat = false, bool bCheckTableStart = true );
bool AppendTextNode();
void AutoFormatBySplitNode();
diff --git a/sw/inc/view.hxx b/sw/inc/view.hxx
index a3eddaedf991..cb32b2180a32 100644
--- a/sw/inc/view.hxx
+++ b/sw/inc/view.hxx
@@ -279,12 +279,12 @@ class SW_DLLPUBLIC SwView: public SfxViewShell
SAL_DLLPRIVATE bool GetPageScrollDownOffset(SwTwips& rOff) const;
// scrollbar movements
- SAL_DLLPRIVATE long PageUp();
- SAL_DLLPRIVATE long PageDown();
+ SAL_DLLPRIVATE bool PageUp();
+ SAL_DLLPRIVATE bool PageDown();
SAL_DLLPRIVATE bool PageUpCursor(bool bSelect);
SAL_DLLPRIVATE bool PageDownCursor(bool bSelect);
- SAL_DLLPRIVATE long PhyPageUp();
- SAL_DLLPRIVATE long PhyPageDown();
+ SAL_DLLPRIVATE void PhyPageUp();
+ SAL_DLLPRIVATE void PhyPageDown();
SAL_DLLPRIVATE void CreateScrollbar( bool bHori );
DECL_DLLPRIVATE_LINK( ScrollHdl, ScrollBar*, void );
@@ -472,10 +472,10 @@ public:
void EnableHScrollbar(bool bEnable);
void EnableVScrollbar(bool bEnable);
- int CreateVRuler();
- int KillVRuler();
- int CreateTab();
- int KillTab();
+ void CreateVRuler();
+ void KillVRuler();
+ void CreateTab();
+ void KillTab();
bool StatVRuler() const { return m_pVRuler->IsVisible(); }
void ChangeVRulerMetric(FieldUnit eUnit);
diff --git a/sw/source/core/edit/editsh.cxx b/sw/source/core/edit/editsh.cxx
index e3f443b25eec..1971989d93eb 100644
--- a/sw/source/core/edit/editsh.cxx
+++ b/sw/source/core/edit/editsh.cxx
@@ -184,7 +184,7 @@ void SwEditShell::Overwrite(const OUString &rStr)
EndAllAction();
}
-long SwEditShell::SplitNode( bool bAutoFormat, bool bCheckTableStart )
+void SwEditShell::SplitNode( bool bAutoFormat, bool bCheckTableStart )
{
StartAllAction();
GetDoc()->GetIDocumentUndoRedo().StartUndo(SwUndoId::EMPTY, nullptr);
@@ -204,7 +204,6 @@ long SwEditShell::SplitNode( bool bAutoFormat, bool bCheckTableStart )
ClearTableBoxContent();
EndAllAction();
- return 1;
}
bool SwEditShell::AppendTextNode()
diff --git a/sw/source/uibase/dochdl/gloshdl.cxx b/sw/source/uibase/dochdl/gloshdl.cxx
index 8b93fb6545be..12720302f0e5 100644
--- a/sw/source/uibase/dochdl/gloshdl.cxx
+++ b/sw/source/uibase/dochdl/gloshdl.cxx
@@ -691,10 +691,10 @@ bool SwGlossaryHdl::CopyToClipboard(SwWrtShell& rSh, const OUString& rShortName)
rtl::Reference<SwTransferable> pTransfer = new SwTransferable( rSh );
- int nRet = pTransfer->CopyGlossary( *pGlossary, rShortName );
+ bool bRet = pTransfer->CopyGlossary( *pGlossary, rShortName );
if( !pCurGrp )
delete pGlossary;
- return 0 != nRet;
+ return bRet;
}
bool SwGlossaryHdl::ImportGlossaries( const OUString& rName )
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx
index 996632519910..10ab121d348e 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -1029,10 +1029,10 @@ void SwTransferable::CalculateAndCopy()
CopyToClipboard( &m_pWrtShell->GetView().GetEditWin() );
}
-int SwTransferable::CopyGlossary( SwTextBlocks& rGlossary, const OUString& rStr )
+bool SwTransferable::CopyGlossary( SwTextBlocks& rGlossary, const OUString& rStr )
{
if(!m_pWrtShell)
- return 0;
+ return false;
SwWait aWait( *m_pWrtShell->GetView().GetDocShell(), true );
m_pClpDocFac = new SwDocFac;
@@ -1073,7 +1073,7 @@ int SwTransferable::CopyGlossary( SwTextBlocks& rGlossary, const OUString& rStr
CopyToClipboard( &m_pWrtShell->GetView().GetEditWin() );
- return 1;
+ return true;
}
static inline uno::Reference < XTransferable > * lcl_getTransferPointer ( uno::Reference < XTransferable > &xRef )
diff --git a/sw/source/uibase/inc/langhelper.hxx b/sw/source/uibase/inc/langhelper.hxx
index 2c7a979fd670..8c93d29d3c36 100644
--- a/sw/source/uibase/inc/langhelper.hxx
+++ b/sw/source/uibase/inc/langhelper.hxx
@@ -35,7 +35,7 @@ enum class SvtScriptType;
namespace SwLangHelper
{
- extern sal_uInt16 GetLanguageStatus( OutlinerView* pOLV, SfxItemSet& rSet );
+ extern void GetLanguageStatus( OutlinerView* pOLV, SfxItemSet& rSet );
extern bool SetLanguageStatus( OutlinerView* pOLV, SfxRequest &rReq, SwView const &rView, SwWrtShell &rSh );
extern void SetLanguage( SwWrtShell &rWrtSh, const OUString &rLangText, bool bIsForSelection, SfxItemSet &rCoreSet );
diff --git a/sw/source/uibase/inc/swdtflvr.hxx b/sw/source/uibase/inc/swdtflvr.hxx
index e15e4a5664c9..58990e80f943 100644
--- a/sw/source/uibase/inc/swdtflvr.hxx
+++ b/sw/source/uibase/inc/swdtflvr.hxx
@@ -166,7 +166,7 @@ public:
int Copy( bool bIsCut = false );
int PrepareForCopy( bool bIsCut = false );
void CalculateAndCopy(); // special for Calculator
- int CopyGlossary( SwTextBlocks& rGlossary, const OUString& rStr );
+ bool CopyGlossary( SwTextBlocks& rGlossary, const OUString& rStr );
// remove the DDE-Link format promise
void RemoveDDELinkFormat( const vcl::Window& rWin );
diff --git a/sw/source/uibase/inc/wrtsh.hxx b/sw/source/uibase/inc/wrtsh.hxx
index f87d113b80ab..6fbbb38d3d7e 100644
--- a/sw/source/uibase/inc/wrtsh.hxx
+++ b/sw/source/uibase/inc/wrtsh.hxx
@@ -188,7 +188,7 @@ public:
// #i32329# Enhanced selection
void SelSentence (const Point *);
void SelPara (const Point *);
- long SelAll();
+ void SelAll();
// basecursortravelling
typedef bool (SwWrtShell:: *FNSimpleMove)();
diff --git a/sw/source/uibase/shells/drwtxtex.cxx b/sw/source/uibase/shells/drwtxtex.cxx
index c24d82199a79..ea1810fbc485 100644
--- a/sw/source/uibase/shells/drwtxtex.cxx
+++ b/sw/source/uibase/shells/drwtxtex.cxx
@@ -610,7 +610,8 @@ void SwDrawTextShell::GetState(SfxItemSet& rSet)
{
case SID_LANGUAGE_STATUS://20412:
{
- nSlotId = SwLangHelper::GetLanguageStatus(pOLV,rSet);
+ SwLangHelper::GetLanguageStatus(pOLV,rSet);
+ nSlotId = 0;
break;
}
diff --git a/sw/source/uibase/shells/langhelper.cxx b/sw/source/uibase/shells/langhelper.cxx
index 33bdcce561df..07b626ad5bb5 100644
--- a/sw/source/uibase/shells/langhelper.cxx
+++ b/sw/source/uibase/shells/langhelper.cxx
@@ -57,7 +57,7 @@ using namespace ::com::sun::star;
namespace SwLangHelper
{
- sal_uInt16 GetLanguageStatus( OutlinerView* pOLV, SfxItemSet& rSet )
+ void GetLanguageStatus( OutlinerView* pOLV, SfxItemSet& rSet )
{
ESelection aSelection = pOLV->GetSelection();
EditView& rEditView=pOLV->GetEditView();
@@ -95,7 +95,6 @@ namespace SwLangHelper
SfxStringListItem aItem( SID_LANGUAGE_STATUS );
aItem.SetStringList( aSeq );
rSet.Put( aItem );
- return 0;
}
bool SetLanguageStatus( OutlinerView* pOLV, SfxRequest &rReq, SwView const &rView, SwWrtShell &rSh )
diff --git a/sw/source/uibase/shells/txtcrsr.cxx b/sw/source/uibase/shells/txtcrsr.cxx
index f64127c45069..3ecf385bd9f3 100644
--- a/sw/source/uibase/shells/txtcrsr.cxx
+++ b/sw/source/uibase/shells/txtcrsr.cxx
@@ -155,7 +155,8 @@ void SwTextShell::ExecMove(SfxRequest &rReq)
bRet = rSh.SelNearestWrd();
break;
case SID_SELECTALL:
- bRet = 0 != rSh.SelAll();
+ rSh.SelAll();
+ bRet = true;
break;
default:
OSL_FAIL("wrong dispatcher");
diff --git a/sw/source/uibase/uiview/viewmdi.cxx b/sw/source/uibase/uiview/viewmdi.cxx
index 2944568079a1..5038bae46bf8 100644
--- a/sw/source/uibase/uiview/viewmdi.cxx
+++ b/sw/source/uibase/uiview/viewmdi.cxx
@@ -486,20 +486,18 @@ IMPL_LINK( SwView, MoveNavigationHdl, void*, p, void )
delete pbNext;
}
-int SwView::CreateTab()
+void SwView::CreateTab()
{
m_pHRuler->SetActive(GetFrame() && IsActive());
m_pHRuler->Show();
InvalidateBorder();
- return 1;
}
-int SwView::KillTab()
+void SwView::KillTab()
{
m_pHRuler->Hide();
InvalidateBorder();
- return 1;
}
void SwView::ChangeTabMetric( FieldUnit eUnit )
@@ -530,22 +528,20 @@ void SwView::GetHRulerMetric(FieldUnit& eToFill) const
eToFill = m_pHRuler->GetUnit();
}
-int SwView::CreateVRuler()
+void SwView::CreateVRuler()
{
m_pHRuler->SetBorderPos( m_pVRuler->GetSizePixel().Width()-1 );
m_pVRuler->SetActive(GetFrame() && IsActive());
m_pVRuler->Show();
InvalidateBorder();
- return 1;
}
-int SwView::KillVRuler()
+void SwView::KillVRuler()
{
m_pVRuler->Hide();
m_pHRuler->SetBorderPos();
InvalidateBorder();
- return 1;
}
IMPL_LINK( SwView, ExecRulerClick, Ruler *, pRuler, void )
diff --git a/sw/source/uibase/uiview/viewport.cxx b/sw/source/uibase/uiview/viewport.cxx
index 96ae9c630c60..2896dbd653cd 100644
--- a/sw/source/uibase/uiview/viewport.cxx
+++ b/sw/source/uibase/uiview/viewport.cxx
@@ -576,30 +576,30 @@ bool SwView::GetPageScrollDownOffset( SwTwips &rOff ) const
}
// Scroll page by page
-long SwView::PageUp()
+bool SwView::PageUp()
{
if (!m_aVisArea.GetHeight())
- return 0;
+ return false;
Point aPos(m_aVisArea.TopLeft());
aPos.AdjustY( -(m_aVisArea.GetHeight() - (GetYScroll() / 2)) );
aPos.setY( std::max(0L, aPos.Y()) );
SetVisArea( aPos );
- return 1;
+ return true;
}
-long SwView::PageDown()
+bool SwView::PageDown()
{
if ( !m_aVisArea.GetHeight() )
- return 0;
+ return false;
Point aPos( m_aVisArea.TopLeft() );
aPos.AdjustY(m_aVisArea.GetHeight() - (GetYScroll() / 2) );
aPos.setY( SetVScrollMax( aPos.Y() ) );
SetVisArea( aPos );
- return 1;
+ return true;
}
-long SwView::PhyPageUp()
+void SwView::PhyPageUp()
{
// Check for the currently visible page, do not format
sal_uInt16 nActPage = m_pWrtShell->GetNextPrevPageNum( false );
@@ -615,10 +615,9 @@ long SwView::PhyPageUp()
aAlPt.AdjustY(3 * GetEditWin().PixelToLogic( Size( 0, 1 ) ).Height() );
SetVisArea( aAlPt );
}
- return 1;
}
-long SwView::PhyPageDown()
+void SwView::PhyPageDown()
{
// Check for the currently visible page, do not format
sal_uInt16 nActPage = m_pWrtShell->GetNextPrevPageNum();
@@ -634,7 +633,6 @@ long SwView::PhyPageDown()
aAlPt.AdjustY(3 * GetEditWin().PixelToLogic( Size( 0, 1 ) ).Height() );
SetVisArea( aAlPt );
}
- return 1;
}
bool SwView::PageUpCursor( bool bSelect )
diff --git a/sw/source/uibase/wrtsh/select.cxx b/sw/source/uibase/wrtsh/select.cxx
index 105e1caf7d67..839a95572d2f 100644
--- a/sw/source/uibase/wrtsh/select.cxx
+++ b/sw/source/uibase/wrtsh/select.cxx
@@ -120,7 +120,7 @@ void SwWrtShell::SelPara(const Point *pPt )
m_bSelWrd = false; // disable SelWord, otherwise no SelLine goes on
}
-long SwWrtShell::SelAll()
+void SwWrtShell::SelAll()
{
const bool bLockedView = IsViewLocked();
LockView( true );
@@ -205,7 +205,6 @@ long SwWrtShell::SelAll()
}
EndSelect();
LockView( bLockedView );
- return 1;
}
// Description: Text search