diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2018-12-02 20:46:02 +0300 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2018-12-03 01:20:21 +0100 |
commit | eddee22b0eed069c3ee2929c9b36a9b4fb05f130 (patch) | |
tree | 6ace29c24dfc58407049cef21d6af314f7624e14 /svx/source | |
parent | 6ed52ecfed5781659cd27ff9aea5d0a04be77cd1 (diff) |
tdf#120703 PVS: V560 A part of conditional expression is always true/false
Change-Id: Id7af9a6eaefc8b49a790eb299620c4fa97067a11
Reviewed-on: https://gerrit.libreoffice.org/64429
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'svx/source')
-rw-r--r-- | svx/source/dialog/svxbmpnumvalueset.cxx | 4 | ||||
-rw-r--r-- | svx/source/svdraw/svdedtv.cxx | 2 | ||||
-rw-r--r-- | svx/source/svdraw/svdedxv.cxx | 8 | ||||
-rw-r--r-- | svx/source/svdraw/svdmrkv.cxx | 1 | ||||
-rw-r--r-- | svx/source/svdraw/svdograf.cxx | 2 | ||||
-rw-r--r-- | svx/source/svdraw/svdomeas.cxx | 2 | ||||
-rw-r--r-- | svx/source/table/svdotable.cxx | 20 |
7 files changed, 18 insertions, 21 deletions
diff --git a/svx/source/dialog/svxbmpnumvalueset.cxx b/svx/source/dialog/svxbmpnumvalueset.cxx index 5b6df74f9c68..017bc1dfb853 100644 --- a/svx/source/dialog/svxbmpnumvalueset.cxx +++ b/svx/source/dialog/svxbmpnumvalueset.cxx @@ -259,7 +259,7 @@ void SvxNumValueSet::UserDraw( const UserDrawEvent& rUDEvt ) sal_Int32 nLevelCount = xLevel->getCount(); if(nLevelCount > 5) nLevelCount = 5; - for( sal_Int32 i = 0; i < nLevelCount && i < 5; i++) + for( sal_Int32 i = 0; i < nLevelCount; i++) { long nTop = nStartY + nRectHeight * (aLinesArr[2 * i + 11])/100 ; Point aLeft(nStartX + nRectWidth * (aLinesArr[2 * i + 10])/ 100, nTop ); @@ -634,7 +634,7 @@ void NumValueSet::UserDraw( const UserDrawEvent& rUDEvt ) sal_Int32 nLevelCount = xLevel->getCount(); if(nLevelCount > 5) nLevelCount = 5; - for( sal_Int32 i = 0; i < nLevelCount && i < 5; i++) + for( sal_Int32 i = 0; i < nLevelCount; i++) { long nTop = nStartY + nRectHeight * (aLinesArr[2 * i + 11])/100 ; Point aLeft(nStartX + nRectWidth * (aLinesArr[2 * i + 10])/ 100, nTop ); diff --git a/svx/source/svdraw/svdedtv.cxx b/svx/source/svdraw/svdedtv.cxx index a3b20b853068..71c1aabaecfe 100644 --- a/svx/source/svdraw/svdedtv.cxx +++ b/svx/source/svdraw/svdedtv.cxx @@ -384,7 +384,7 @@ bool SdrEditView::IsMirrorAllowed(bool b45Deg, bool b90Deg) const if (m_bMoveProtect) return false; if (b90Deg) return m_bMirror90Allowed; if (b45Deg) return m_bMirror45Allowed; - return m_bMirrorFreeAllowed && !m_bMoveProtect; + return m_bMirrorFreeAllowed; } bool SdrEditView::IsTransparenceAllowed() const diff --git a/svx/source/svdraw/svdedxv.cxx b/svx/source/svdraw/svdedxv.cxx index 66a409c8cfae..0e7ca533bd5c 100644 --- a/svx/source/svdraw/svdedxv.cxx +++ b/svx/source/svdraw/svdedxv.cxx @@ -1476,7 +1476,8 @@ SdrEndTextEditKind SdrObjEditView::SdrEndTextEdit(bool bDontDeleteReally) pTEObj->EndTextEdit(*pTEOutliner); - if( (pTEObj->GetRotateAngle() != 0) || (pTEObj && dynamic_cast<const SdrTextObj*>( pTEObj) != nullptr && pTEObj->IsFontwork()) ) + if ((pTEObj->GetRotateAngle() != 0) + || (dynamic_cast<const SdrTextObj*>(pTEObj) != nullptr && pTEObj->IsFontwork())) { pTEObj->ActionChanged(); } @@ -1492,7 +1493,7 @@ SdrEndTextEditKind SdrObjEditView::SdrEndTextEdit(bool bDontDeleteReally) // check deletion of entire TextObj std::unique_ptr<SdrUndoAction> pDelUndo; bool bDelObj=false; - if (pTEObj!=nullptr && bTextEditNewObj) + if (bTextEditNewObj) { bDelObj=pTEObj->IsTextFrame() && !pTEObj->HasText() && @@ -1702,7 +1703,8 @@ bool SdrObjEditView::IsTextEditFrameHit(const Point& rHit) const if( pOLV ) { vcl::Window* pWin=pOLV->GetWindow(); - if (pText!=nullptr && pText->IsTextFrame() && pOLV!=nullptr && pWin!=nullptr) { + if (pText != nullptr && pText->IsTextFrame() && pWin != nullptr) + { sal_uInt16 nPixSiz=pOLV->GetInvalidateMore(); tools::Rectangle aEditArea(aMinTextEditArea); aEditArea.Union(pOLV->GetOutputArea()); diff --git a/svx/source/svdraw/svdmrkv.cxx b/svx/source/svdraw/svdmrkv.cxx index 8a55f973873d..46c93e985716 100644 --- a/svx/source/svdraw/svdmrkv.cxx +++ b/svx/source/svdraw/svdmrkv.cxx @@ -650,7 +650,6 @@ void SdrMarkView::SetMarkHandles(SfxViewShell* pOtherShell) if(nullptr != mpMarkedObj) { bSingleTextObjMark = - mpMarkedObj && dynamic_cast<const SdrTextObj*>( mpMarkedObj) != nullptr && static_cast<SdrTextObj*>(mpMarkedObj)->IsTextFrame(); diff --git a/svx/source/svdraw/svdograf.cxx b/svx/source/svdraw/svdograf.cxx index c0cebde414b5..bcc4f1098a51 100644 --- a/svx/source/svdraw/svdograf.cxx +++ b/svx/source/svdraw/svdograf.cxx @@ -370,7 +370,7 @@ GraphicAttr SdrGrafObj::GetGraphicAttr( SdrGrafObjTransformsAttrs nTransformFlag { const bool bMirror = bool( nTransformFlags & SdrGrafObjTransformsAttrs::MIRROR ); const bool bRotate = bool( nTransformFlags & SdrGrafObjTransformsAttrs::ROTATE ) && - ( aGeo.nRotationAngle && aGeo.nRotationAngle != 18000 ) && ( GraphicType::NONE != eType ); + (aGeo.nRotationAngle && aGeo.nRotationAngle != 18000); // Need cropping info earlier const_cast<SdrGrafObj*>(this)->ImpSetAttrToGrafInfo(); diff --git a/svx/source/svdraw/svdomeas.cxx b/svx/source/svdraw/svdomeas.cxx index cc44db30d0bd..cf14585cea5f 100644 --- a/svx/source/svdraw/svdomeas.cxx +++ b/svx/source/svdraw/svdomeas.cxx @@ -244,7 +244,7 @@ void SdrMeasureObj::TakeObjInfo(SdrObjTransformInfoRec& rInfo) const rInfo.bCanConvToPoly =true; rInfo.bCanConvToPathLineToArea=false; rInfo.bCanConvToPolyLineToArea=false; - rInfo.bCanConvToContour = (rInfo.bCanConvToPoly || LineGeometryUsageIsNecessary()); + rInfo.bCanConvToContour = LineGeometryUsageIsNecessary(); } sal_uInt16 SdrMeasureObj::GetObjIdentifier() const diff --git a/svx/source/table/svdotable.cxx b/svx/source/table/svdotable.cxx index b800c7a06181..5a69a8bf83c9 100644 --- a/svx/source/table/svdotable.cxx +++ b/svx/source/table/svdotable.cxx @@ -584,7 +584,7 @@ void SdrTableObjImpl::DragEdge( bool mbHorizontal, int nEdge, sal_Int32 nOffset const OUString sSize( "Size" ); if( mbHorizontal ) { - if( (nEdge >= 0) && (nEdge <= getRowCount()) ) + if (nEdge <= getRowCount()) { sal_Int32 nHeight = mpLayouter->getRowHeight( (!nEdge)?nEdge:(nEdge-1) ); if(nEdge==0) @@ -606,7 +606,7 @@ void SdrTableObjImpl::DragEdge( bool mbHorizontal, int nEdge, sal_Int32 nOffset In LTR table dragging of edge 0(for RTL table edge N) does nothing. */ //Todo: Implement Dragging functionality for leftmost edge of table. - if( (nEdge >= 0) && (nEdge <= getColumnCount()) ) + if (nEdge <= getColumnCount()) { const bool bRTL = mpTableObj != nullptr && (mpTableObj->GetWritingMode() == WritingMode_RL_TB); sal_Int32 nWidth; @@ -633,18 +633,14 @@ void SdrTableObjImpl::DragEdge( bool mbHorizontal, int nEdge, sal_Int32 nOffset /* To prevent the table resizing on edge dragging */ if( nEdge > 0 && nEdge < mxTable->getColumnCount() ) { - if( bRTL ) nEdge--; - if( (bRTL && (nEdge >= 0)) || (!bRTL && (nEdge < mxTable->getColumnCount())) ) - { - nWidth = mpLayouter->getColumnWidth( nEdge ); - nWidth = std::max( static_cast<sal_Int32>(nWidth - nOffset), sal_Int32(0) ); + nWidth = mpLayouter->getColumnWidth(nEdge); + nWidth = std::max(static_cast<sal_Int32>(nWidth - nOffset), sal_Int32(0)); - Reference< XPropertySet > xColSet( xCols->getByIndex( nEdge ), UNO_QUERY_THROW ); - xColSet->setPropertyValue( sSize, Any( nWidth ) ); - } + Reference<XPropertySet> xColSet(xCols->getByIndex(nEdge), UNO_QUERY_THROW); + xColSet->setPropertyValue(sSize, Any(nWidth)); } } } @@ -1999,8 +1995,8 @@ void SdrTableObj::NbcReformatText() bool SdrTableObj::IsVerticalWriting() const { - const SvxWritingModeItem* pModeItem = &GetObjectItem( SDRATTR_TEXTDIRECTION ); - return pModeItem && pModeItem->GetValue() == css::text::WritingMode_TB_RL; + const SvxWritingModeItem& rModeItem = GetObjectItem( SDRATTR_TEXTDIRECTION ); + return rModeItem.GetValue() == css::text::WritingMode_TB_RL; } |