summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-04-25 10:33:00 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-04-25 13:45:17 +0200
commitae622df5df4094481ef4212dbe2ba8449e47871f (patch)
treec140eedc702566e33e8035952d3a1aaceb827c6c /sfx2
parent825c8f1b6e2c1e8c686f4656337fa2879ade481d (diff)
clang-tidy readability-simplify-boolean-expr in sfx2
Change-Id: I388e0160daf6a7359881acb82145460ad5bbbbbf Reviewed-on: https://gerrit.libreoffice.org/36929 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/source/appl/appserv.cxx7
-rw-r--r--sfx2/source/appl/childwin.cxx16
-rw-r--r--sfx2/source/appl/workwin.cxx7
-rw-r--r--sfx2/source/bastyp/fltfnc.cxx10
-rw-r--r--sfx2/source/control/dispatch.cxx5
-rw-r--r--sfx2/source/control/templatelocalview.cxx5
-rw-r--r--sfx2/source/dialog/dockwin.cxx5
-rw-r--r--sfx2/source/dialog/mgetempl.cxx5
-rw-r--r--sfx2/source/dialog/splitwin.cxx4
-rw-r--r--sfx2/source/dialog/tabdlg.cxx5
-rw-r--r--sfx2/source/doc/SfxDocumentMetaData.cxx2
-rw-r--r--sfx2/source/doc/sfxmodelfactory.cxx4
-rw-r--r--sfx2/source/doc/templatedlg.cxx4
-rw-r--r--sfx2/source/view/classificationhelper.cxx15
14 files changed, 22 insertions, 72 deletions
diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx
index 37d0fd0b2713..b8480b0f6f4d 100644
--- a/sfx2/source/appl/appserv.cxx
+++ b/sfx2/source/appl/appserv.cxx
@@ -1162,11 +1162,8 @@ void SfxApplication::MiscState_Impl(SfxItemSet &rSet)
if ( xLayoutManager.is() )
{
bool bState = true;
- if ( xLayoutManager->getElement( "private:resource/menubar/menubar" ).is()
- && xLayoutManager->isElementVisible( "private:resource/menubar/menubar" ) )
- bState = true;
- else
- bState = false;
+ bState = xLayoutManager->getElement( "private:resource/menubar/menubar" ).is()
+ && xLayoutManager->isElementVisible( "private:resource/menubar/menubar" );
SfxBoolItem aItem( SID_MENUBAR, bState );
rSet.Put( aItem );
diff --git a/sfx2/source/appl/childwin.cxx b/sfx2/source/appl/childwin.cxx
index 69a0f414d8e9..5dc15bb75a98 100644
--- a/sfx2/source/appl/childwin.cxx
+++ b/sfx2/source/appl/childwin.cxx
@@ -121,10 +121,7 @@ bool GetPosSizeFromString( const OUString& rStr, Point& rPos, Size& rSize )
rSize.Height() = rStr.getToken(0, '/', nIdx).toInt32();
// negative sizes are invalid
- if ( rSize.Width() < 0 || rSize.Height() < 0 )
- return false;
-
- return true;
+ return !(rSize.Width() < 0 || rSize.Height() < 0);
}
bool GetSplitSizeFromString( const OUString& rStr, Size& rSize )
@@ -142,10 +139,7 @@ bool GetSplitSizeFromString( const OUString& rStr, Size& rSize )
rSize.Height() = aStr.getToken(1, ';' ).toInt32();
// negative sizes are invalid
- if ( rSize.Width() < 0 || rSize.Height() < 0 )
- return false;
-
- return true;
+ return !(rSize.Width() < 0 || rSize.Height() < 0);
}
return false;
@@ -603,11 +597,7 @@ bool SfxChildWinInfo::GetExtraData_Impl
aStr = aStr.copy(nPos+1);
Point aChildPos;
Size aChildSize;
- if ( GetPosSizeFromString( aStr, aChildPos, aChildSize ) )
- {
- return true;
- }
- return false;
+ return GetPosSizeFromString( aStr, aChildPos, aChildSize );
}
bool SfxChildWindow::IsVisible() const
diff --git a/sfx2/source/appl/workwin.cxx b/sfx2/source/appl/workwin.cxx
index 85683c94d087..56d4a66aa15d 100644
--- a/sfx2/source/appl/workwin.cxx
+++ b/sfx2/source/appl/workwin.cxx
@@ -2176,12 +2176,9 @@ tools::Rectangle SfxWorkWindow::GetTopRect_Impl()
bool SfxWorkWindow::RequestTopToolSpacePixel_Impl( SvBorder aBorder )
{
- if ( !IsDockingAllowed() ||
+ return !(!IsDockingAllowed() ||
aClientArea.GetWidth() < aBorder.Left() + aBorder.Right() ||
- aClientArea.GetHeight() < aBorder.Top() + aBorder.Bottom() )
- return false;
- else
- return true;
+ aClientArea.GetHeight() < aBorder.Top() + aBorder.Bottom());
}
void SfxWorkWindow::SaveStatus_Impl(SfxChildWindow *pChild, const SfxChildWinInfo &rInfo)
diff --git a/sfx2/source/bastyp/fltfnc.cxx b/sfx2/source/bastyp/fltfnc.cxx
index 1de0c5bead70..ca8b5623c090 100644
--- a/sfx2/source/bastyp/fltfnc.cxx
+++ b/sfx2/source/bastyp/fltfnc.cxx
@@ -819,14 +819,10 @@ std::shared_ptr<const SfxFilter> SfxFilterMatcher::GetFilter4FilterName( const O
IMPL_LINK( SfxFilterMatcher, MaybeFileHdl_Impl, OUString*, pString, bool )
{
std::shared_ptr<const SfxFilter> pFilter = GetFilter4Extension( *pString );
- if (pFilter && !pFilter->GetWildcard().Matches( OUString() ) &&
+ return pFilter &&
+ !pFilter->GetWildcard().Matches("") &&
!pFilter->GetWildcard().Matches("*.*") &&
- !pFilter->GetWildcard().Matches(OUString('*'))
- )
- {
- return true;
- }
- return false;
+ !pFilter->GetWildcard().Matches("*");
}
diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx
index bc2e8dcda13c..a4db7d7dfc9e 100644
--- a/sfx2/source/control/dispatch.cxx
+++ b/sfx2/source/control/dispatch.cxx
@@ -870,10 +870,7 @@ bool SfxDispatcher::GetShellAndSlot_Impl(sal_uInt16 nSlot, SfxShell** ppShell,
if ( nullptr == (*ppSlot)->GetExecFnc() && bRealSlot )
*ppSlot = (*ppShell)->GetInterface()->GetRealSlot(*ppSlot);
// Check only real slots as enum slots don't have an execute function!
- if ( bRealSlot && ((nullptr == *ppSlot) || (nullptr == (*ppSlot)->GetExecFnc()) ))
- return false;
-
- return true;
+ return !bRealSlot || !((nullptr == *ppSlot) || (nullptr == (*ppSlot)->GetExecFnc()) );
}
return false;
diff --git a/sfx2/source/control/templatelocalview.cxx b/sfx2/source/control/templatelocalview.cxx
index cfbe91cc9b69..db5b07420333 100644
--- a/sfx2/source/control/templatelocalview.cxx
+++ b/sfx2/source/control/templatelocalview.cxx
@@ -748,10 +748,7 @@ bool TemplateLocalView::exportTo(const sal_uInt16 nItemId, const sal_uInt16 nReg
{
if (aIter->nId == nItemId)
{
- if (!mpDocTemplates->CopyTo(pRegItem->mnRegionId,aIter->nDocId,rName))
- return false;
-
- return true;
+ return mpDocTemplates->CopyTo(pRegItem->mnRegionId,aIter->nDocId,rName);
}
}
diff --git a/sfx2/source/dialog/dockwin.cxx b/sfx2/source/dialog/dockwin.cxx
index ec7d0a085fa1..74522e290d4e 100644
--- a/sfx2/source/dialog/dockwin.cxx
+++ b/sfx2/source/dialog/dockwin.cxx
@@ -300,10 +300,7 @@ namespace
static bool lcl_checkDockingWindowID( sal_uInt16 nID )
{
- if (nID < SID_DOCKWIN_START || nID >= sal_uInt16(SID_DOCKWIN_START+NUM_OF_DOCKINGWINDOWS))
- return false;
- else
- return true;
+ return !(nID < SID_DOCKWIN_START || nID >= sal_uInt16(SID_DOCKWIN_START+NUM_OF_DOCKINGWINDOWS));
}
static SfxWorkWindow* lcl_getWorkWindowFromXFrame( const uno::Reference< frame::XFrame >& rFrame )
diff --git a/sfx2/source/dialog/mgetempl.cxx b/sfx2/source/dialog/mgetempl.cxx
index 0989f25ac140..fca6b357efae 100644
--- a/sfx2/source/dialog/mgetempl.cxx
+++ b/sfx2/source/dialog/mgetempl.cxx
@@ -398,10 +398,7 @@ bool SfxManageStyleSheetPage::Execute_Impl(
nId, SfxCallMode::SYNCHRON | SfxCallMode::RECORD | SfxCallMode::MODAL,
pItems );
- if ( !pItem )
- return false;
-
- return true;
+ return pItem != nullptr;
}
diff --git a/sfx2/source/dialog/splitwin.cxx b/sfx2/source/dialog/splitwin.cxx
index 5ae04bef74a5..3f75d5425338 100644
--- a/sfx2/source/dialog/splitwin.cxx
+++ b/sfx2/source/dialog/splitwin.cxx
@@ -1004,9 +1004,7 @@ bool SfxSplitWindow::CursorIsOverRect() const
aRect = aRect.GetUnion( aVisRect );
}
- if ( aRect.IsInside( OutputToScreenPixel( static_cast<vcl::Window*>(const_cast<SfxSplitWindow *>(this))->GetPointerPosPixel() ) ) )
- return true;
- return false;
+ return aRect.IsInside( OutputToScreenPixel( static_cast<vcl::Window*>(const_cast<SfxSplitWindow *>(this))->GetPointerPosPixel() ) );
}
diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx
index e819521eb448..04bb0d07d19d 100644
--- a/sfx2/source/dialog/tabdlg.cxx
+++ b/sfx2/source/dialog/tabdlg.cxx
@@ -1201,10 +1201,7 @@ IMPL_LINK( SfxTabDialog, DeactivatePageHdl, TabControl *, pTabCtrl, bool )
pObj->bRefresh = false;
}
}
- if ( nRet & DeactivateRC::LeavePage )
- return true;
- else
- return false;
+ return static_cast<bool>(nRet & DeactivateRC::LeavePage);
}
diff --git a/sfx2/source/doc/SfxDocumentMetaData.cxx b/sfx2/source/doc/SfxDocumentMetaData.cxx
index 51825a009c14..06fddd7f3f49 100644
--- a/sfx2/source/doc/SfxDocumentMetaData.cxx
+++ b/sfx2/source/doc/SfxDocumentMetaData.cxx
@@ -1239,7 +1239,7 @@ void SAL_CALL SfxDocumentMetaData::init(
SAL_WARN("sfx.doc", "Invalid boolean: " << text);
continue;
}
- } else if ( type == "string" || true) { // default
+ } else { // default
any <<= text;
}
try {
diff --git a/sfx2/source/doc/sfxmodelfactory.cxx b/sfx2/source/doc/sfxmodelfactory.cxx
index 9267ed18846c..b1dc8c21ab7d 100644
--- a/sfx2/source/doc/sfxmodelfactory.cxx
+++ b/sfx2/source/doc/sfxmodelfactory.cxx
@@ -134,9 +134,7 @@ namespace sfx2
if ( ( _rArgument >>= aNamedValue ) && isSpecialArgumentName( aNamedValue.Name ) )
return true;
PropertyValue aPropertyValue;
- if ( ( _rArgument >>= aPropertyValue ) && isSpecialArgumentName( aPropertyValue.Name ) )
- return true;
- return false;
+ return ( _rArgument >>= aPropertyValue ) && isSpecialArgumentName( aPropertyValue.Name );
}
};
}
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index 86fff479b192..a0f8da28cbb4 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -127,9 +127,7 @@ public:
{
if(maKeyword.isEmpty())
return false;
- if(sItemName.toAsciiLowerCase().indexOf(maKeyword) >= 0)
- return true;
- return false;
+ return sItemName.toAsciiLowerCase().indexOf(maKeyword) >= 0;
}
private:
diff --git a/sfx2/source/view/classificationhelper.cxx b/sfx2/source/view/classificationhelper.cxx
index 769a0c6b5df9..907c08d13f68 100644
--- a/sfx2/source/view/classificationhelper.cxx
+++ b/sfx2/source/view/classificationhelper.cxx
@@ -554,10 +554,7 @@ bool SfxClassificationHelper::HasImpactLevel()
return false;
it = rCategory.m_aLabels.find(PROP_PREFIX_INTELLECTUALPROPERTY() + PROP_IMPACTLEVEL());
- if (it == rCategory.m_aLabels.end())
- return false;
-
- return true;
+ return it != rCategory.m_aLabels.end();
}
bool SfxClassificationHelper::HasDocumentHeader()
@@ -568,10 +565,7 @@ bool SfxClassificationHelper::HasDocumentHeader()
SfxClassificationCategory& rCategory = itCategory->second;
auto it = rCategory.m_aLabels.find(PROP_PREFIX_INTELLECTUALPROPERTY() + PROP_DOCHEADER());
- if (it == rCategory.m_aLabels.end() || it->second.isEmpty())
- return false;
-
- return true;
+ return it != rCategory.m_aLabels.end() && !it->second.isEmpty();
}
bool SfxClassificationHelper::HasDocumentFooter()
@@ -582,10 +576,7 @@ bool SfxClassificationHelper::HasDocumentFooter()
SfxClassificationCategory& rCategory = itCategory->second;
auto it = rCategory.m_aLabels.find(PROP_PREFIX_INTELLECTUALPROPERTY() + PROP_DOCFOOTER());
- if (it == rCategory.m_aLabels.end() || it->second.isEmpty())
- return false;
-
- return true;
+ return it != rCategory.m_aLabels.end() && !it->second.isEmpty();
}
InfoBarType SfxClassificationHelper::GetImpactLevelType()