From a975225678c00272fc6e2ee2c85e6fe00a2204f1 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Mon, 24 Apr 2017 09:23:15 +0200 Subject: clang-tidy readability-simplify-boolean-expr in hwpfilter..lotuswordpro Change-Id: I945d3fe6af5f88937b341dfc3696bf1d36344862 Reviewed-on: https://gerrit.libreoffice.org/36874 Tested-by: Jenkins Reviewed-by: Noel Grandin --- lotuswordpro/source/filter/lwpbookmarkmgr.cxx | 5 +---- lotuswordpro/source/filter/lwpframelayout.cxx | 4 +--- lotuswordpro/source/filter/lwpfrib.cxx | 4 +--- lotuswordpro/source/filter/lwpfribsection.cxx | 8 ++----- lotuswordpro/source/filter/lwpgrfobj.cxx | 11 ++------- lotuswordpro/source/filter/lwplayout.cxx | 30 +++++-------------------- lotuswordpro/source/filter/lwpmarker.cxx | 12 +++------- lotuswordpro/source/filter/lwppagelayout.cxx | 5 +---- lotuswordpro/source/filter/lwppara1.cxx | 4 +--- lotuswordpro/source/filter/lwprowlayout.cxx | 5 +---- lotuswordpro/source/filter/lwptable.cxx | 4 +--- lotuswordpro/source/filter/lwptools.cxx | 4 +--- lotuswordpro/source/filter/xfilter/xfshadow.cxx | 7 ++---- 13 files changed, 23 insertions(+), 80 deletions(-) (limited to 'lotuswordpro') diff --git a/lotuswordpro/source/filter/lwpbookmarkmgr.cxx b/lotuswordpro/source/filter/lwpbookmarkmgr.cxx index b3b01f916916..bfec019fbfd4 100644 --- a/lotuswordpro/source/filter/lwpbookmarkmgr.cxx +++ b/lotuswordpro/source/filter/lwpbookmarkmgr.cxx @@ -95,10 +95,7 @@ bool LwpBookmarkMgr::FindBookmark(const OUString& sName) { std::map::iterator iter; iter = m_MapStart.find(sName); - if (iter != m_MapStart.end()) - return true; - else - return false; + return iter != m_MapStart.end(); } LwpBookmarkMgr::LwpBookmarkMgr() diff --git a/lotuswordpro/source/filter/lwpframelayout.cxx b/lotuswordpro/source/filter/lwpframelayout.cxx index c26d61f75378..cb35bd911213 100644 --- a/lotuswordpro/source/filter/lwpframelayout.cxx +++ b/lotuswordpro/source/filter/lwpframelayout.cxx @@ -901,9 +901,7 @@ OUString LwpFrameLayout::GetNextLinkName() bool LwpFrameLayout::HasPreviousLinkLayout() { LwpObjectID& rObjectID = m_Link.GetPreviousLayout(); - if(rObjectID.IsNull()) - return false; - return true; + return !rObjectID.IsNull(); } /** * @descr whether current frame is for water mark. Problem maybe exists by this method, must be tracking diff --git a/lotuswordpro/source/filter/lwpfrib.cxx b/lotuswordpro/source/filter/lwpfrib.cxx index 68ddcc544da5..ae4e48e76cc1 100644 --- a/lotuswordpro/source/filter/lwpfrib.cxx +++ b/lotuswordpro/source/filter/lwpfrib.cxx @@ -385,9 +385,7 @@ void LwpFrib::ReadModifiers(LwpObjectStream* pObjStrm,ModifierInfo* pModInfo) */ bool LwpFrib::HasNextFrib() { - if (!GetNext() || GetNext()->GetType()==FRIB_TAG_EOP) - return false; - return true; + return GetNext() && GetNext()->GetType() != FRIB_TAG_EOP; } void LwpFrib::ConvertChars(XFContentContainer* pXFPara,const OUString& text) diff --git a/lotuswordpro/source/filter/lwpfribsection.cxx b/lotuswordpro/source/filter/lwpfribsection.cxx index 6e1b41729be9..d6518db53026 100644 --- a/lotuswordpro/source/filter/lwpfribsection.cxx +++ b/lotuswordpro/source/filter/lwpfribsection.cxx @@ -455,13 +455,9 @@ void LwpMasterPage::RegisterFillerPageStyle() bool LwpMasterPage::IsNextPageType() { LwpLayout::UseWhenType eUserType = m_pLayout->GetUseWhenType(); - if(eUserType == LwpLayout::StartOnNextPage + return eUserType == LwpLayout::StartOnNextPage || eUserType == LwpLayout::StartOnOddPage - || eUserType == LwpLayout::StartOnEvenPage ) - { - return true; - } - return false; + || eUserType == LwpLayout::StartOnEvenPage; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/lwpgrfobj.cxx b/lotuswordpro/source/filter/lwpgrfobj.cxx index ddb79592c566..64f855ce9ce0 100644 --- a/lotuswordpro/source/filter/lwpgrfobj.cxx +++ b/lotuswordpro/source/filter/lwpgrfobj.cxx @@ -256,20 +256,13 @@ void LwpGraphicObject::XFConvert (XFContentContainer* pCont) */ bool LwpGraphicObject::IsGrafFormatValid() { - if ((m_sServerContextFormat[1]=='b'&& m_sServerContextFormat[2]=='m' && m_sServerContextFormat[3]=='p') + return (m_sServerContextFormat[1]=='b'&& m_sServerContextFormat[2]=='m' && m_sServerContextFormat[3]=='p') || (m_sServerContextFormat[1]=='j' && m_sServerContextFormat[2]=='p' && m_sServerContextFormat[3]=='g') || (m_sServerContextFormat[1]=='w' && m_sServerContextFormat[2]=='m' && m_sServerContextFormat[3]=='f') || (m_sServerContextFormat[1]=='g' && m_sServerContextFormat[2]=='i' && m_sServerContextFormat[3]=='f') || (m_sServerContextFormat[1]=='t' && m_sServerContextFormat[2]=='g' && m_sServerContextFormat[3]=='f') || (m_sServerContextFormat[1]=='p' && m_sServerContextFormat[2]=='n' && m_sServerContextFormat[3]=='g') - || (m_sServerContextFormat[1]=='e' && m_sServerContextFormat[2]=='p' && m_sServerContextFormat[3]=='s')) - { - return true; - } - else - { - return false; - } + || (m_sServerContextFormat[1]=='e' && m_sServerContextFormat[2]=='p' && m_sServerContextFormat[3]=='s'); } /** diff --git a/lotuswordpro/source/filter/lwplayout.cxx b/lotuswordpro/source/filter/lwplayout.cxx index b5f5056ebf50..ca90224f7e69 100644 --- a/lotuswordpro/source/filter/lwplayout.cxx +++ b/lotuswordpro/source/filter/lwplayout.cxx @@ -974,12 +974,8 @@ bool LwpMiddleLayout::CanSizeRight() { sal_uInt8 RelType = GetRelativeType(); - if (RelType == LwpLayoutRelativityGuts::LAY_INLINE || RelType == LwpLayoutRelativityGuts::LAY_PARA_RELATIVE - || RelType == LwpLayoutRelativityGuts::LAY_INLINE_VERTICAL) - { - return false; - } - return true; + return !(RelType == LwpLayoutRelativityGuts::LAY_INLINE || RelType == LwpLayoutRelativityGuts::LAY_PARA_RELATIVE + || RelType == LwpLayoutRelativityGuts::LAY_INLINE_VERTICAL); } sal_Int32 LwpMiddleLayout::GetMinimumWidth() { @@ -1453,9 +1449,7 @@ bool LwpMiddleLayout::GetUsePrinterSettings() bool LwpMiddleLayout::HasContent() { rtl::Reference content = m_Content.obj(); - if(content.is()) - return true; - return false; + return content.is(); } LwpLayout::LwpLayout( LwpObjectHeader &objHdr, LwpSvStream* pStrm ) : @@ -2084,11 +2078,7 @@ bool LwpPlacableLayout::IsAnchorPage() return false; rtl::Reference xLayout = GetParentLayout(); - if (xLayout.is() && (xLayout->IsPage() || xLayout->IsHeader() || xLayout->IsFooter())) - { - return true; - } - return false; + return xLayout.is() && (xLayout->IsPage() || xLayout->IsHeader() || xLayout->IsFooter()); } /** * @descr: whether the parent layout is frame layout @@ -2100,11 +2090,7 @@ bool LwpPlacableLayout::IsAnchorFrame() return false; rtl::Reference xLayout = GetParentLayout(); - if (xLayout.is() && (xLayout->IsFrame() || xLayout->IsGroupHead())) - { - return true; - } - return false; + return xLayout.is() && (xLayout->IsFrame() || xLayout->IsGroupHead()); } /** * @descr: whether the parent layout is cell layout @@ -2116,11 +2102,7 @@ bool LwpPlacableLayout::IsAnchorCell() return false; rtl::Reference xLayout = GetParentLayout(); - if (xLayout.is() && xLayout->IsCell()) - { - return true; - } - return false; + return xLayout.is() && xLayout->IsCell(); } /** diff --git a/lotuswordpro/source/filter/lwpmarker.cxx b/lotuswordpro/source/filter/lwpmarker.cxx index bfe0b267466c..5cf0e9f59060 100644 --- a/lotuswordpro/source/filter/lwpmarker.cxx +++ b/lotuswordpro/source/filter/lwpmarker.cxx @@ -290,9 +290,7 @@ void LwpCHBlkMarker::ProcessKeylist(XFContentContainer* pXFPara,sal_uInt8 nType) bool LwpCHBlkMarker::IsHasFilled() { - if (CHB_PROMPT & m_nFlag) - return false; - return true; + return (CHB_PROMPT & m_nFlag) == 0; } bool LwpCHBlkMarker::IsBubbleHelp() @@ -341,9 +339,7 @@ void LwpBookMark::Read() bool LwpBookMark::IsRightMarker(LwpObjectID objMarker) { - if (objMarker == m_objMarker) - return true; - return false; + return objMarker == m_objMarker; } OUString LwpBookMark::GetName() @@ -419,9 +415,7 @@ void LwpFieldMark::ParseTOC(OUString& sLevel,OUString& sText) bool LwpFieldMark::IsFormulaInsert() { - if (m_nFlag & FF_FORMULAINSERTED) - return true; - return false; + return (m_nFlag & FF_FORMULAINSERTED) != 0; } bool LwpFieldMark::IsDateTimeField(sal_uInt8& type,OUString& formula) diff --git a/lotuswordpro/source/filter/lwppagelayout.cxx b/lotuswordpro/source/filter/lwppagelayout.cxx index 5ee886b8284a..a8eb63d0f880 100644 --- a/lotuswordpro/source/filter/lwppagelayout.cxx +++ b/lotuswordpro/source/filter/lwppagelayout.cxx @@ -688,10 +688,7 @@ bool LwpPageLayout::operator<(LwpPageLayout& Other) } } - if(!pThisPara) - return true; - - return false; + return pThisPara == nullptr; } /** diff --git a/lotuswordpro/source/filter/lwppara1.cxx b/lotuswordpro/source/filter/lwppara1.cxx index e029356668ee..ef1a6cdc2c7a 100644 --- a/lotuswordpro/source/filter/lwppara1.cxx +++ b/lotuswordpro/source/filter/lwppara1.cxx @@ -617,9 +617,7 @@ bool LwpPara::IsInCell() if (!pStory) return false; rtl::Reference xLayout(pStory->GetLayout(nullptr)); - if (xLayout.is() && xLayout->IsCell()) - return true; - return false; + return xLayout.is() && xLayout->IsCell(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/lotuswordpro/source/filter/lwprowlayout.cxx b/lotuswordpro/source/filter/lwprowlayout.cxx index 3ca645d88473..8ddff0a5c7b0 100644 --- a/lotuswordpro/source/filter/lwprowlayout.cxx +++ b/lotuswordpro/source/filter/lwprowlayout.cxx @@ -459,10 +459,7 @@ void LwpRowLayout::SetCellSplit(sal_uInt16 nEffectRows) */ bool LwpRowLayout::GetMergeCellFlag() { - if (m_ConnCellList.empty()) - return false; - else - return true; + return !m_ConnCellList.empty(); } LwpRowHeadingLayout::LwpRowHeadingLayout(LwpObjectHeader &objHdr, LwpSvStream* pStrm) diff --git a/lotuswordpro/source/filter/lwptable.cxx b/lotuswordpro/source/filter/lwptable.cxx index 416c3f2e6ba9..a7e0d3d63802 100644 --- a/lotuswordpro/source/filter/lwptable.cxx +++ b/lotuswordpro/source/filter/lwptable.cxx @@ -125,9 +125,7 @@ void LwpTable::Read() bool LwpTable::IsNumberDown() { - if (m_nAttributes & NUMBER_DOWN) - return true; - return false; + return (m_nAttributes & NUMBER_DOWN) != 0; } void LwpTable::Parse(IXFStream* /*pOutputStream*/) diff --git a/lotuswordpro/source/filter/lwptools.cxx b/lotuswordpro/source/filter/lwptools.cxx index 045768b5dc7f..240789ca12d3 100644 --- a/lotuswordpro/source/filter/lwptools.cxx +++ b/lotuswordpro/source/filter/lwptools.cxx @@ -197,9 +197,7 @@ bool LwpTools::IsUnicodePacked(LwpObjectStream* pObjStrm, sal_uInt16 len) bool LwpTools::isFileUrl(const OString &fileName) { - if (fileName.startsWith("file://") ) - return true; - return false; + return fileName.startsWith("file://"); } OUString LwpTools::convertToFileUrl(const OString &fileName) diff --git a/lotuswordpro/source/filter/xfilter/xfshadow.cxx b/lotuswordpro/source/filter/xfilter/xfshadow.cxx index 287e2f48b2fe..b7b278a7f354 100644 --- a/lotuswordpro/source/filter/xfilter/xfshadow.cxx +++ b/lotuswordpro/source/filter/xfilter/xfshadow.cxx @@ -103,12 +103,9 @@ void XFShadow::ToXml(IXFStream *pStrm) bool operator==(XFShadow& s1, XFShadow& s2) { - if( (s1.m_ePosition == s2.m_ePosition) && + return (s1.m_ePosition == s2.m_ePosition) && (s1.m_fOffset == s2.m_fOffset) && - (s1.m_aColor == s2.m_aColor) - ) - return true; - return false; + (s1.m_aColor == s2.m_aColor); } bool operator!=(XFShadow& s1, XFShadow& s2) -- cgit