diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-10-21 15:53:34 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-10-22 12:42:07 +0200 |
commit | 4347b5975283ca1a591b6c3d4559ed360e187022 (patch) | |
tree | d607931cc2143988fe344f32b8f311bcf4f3ef51 | |
parent | b55fda6d9eb83460382c0da74eb5cd3a3d03cd7f (diff) |
pvs-studio: V728 An excessive check can be simplified
for...
"The '(A && !B) || (!A && B)' expression is equivalent to the 'bool(A) != bool(B)' expression"
subcases, where the args are already bool
Change-Id: Ica8b5c4974c513f7f7ad8acf17ca931e85ebc8af
Reviewed-on: https://gerrit.libreoffice.org/62146
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r-- | chart2/source/model/template/StockChartTypeTemplate.cxx | 6 | ||||
-rw-r--r-- | framework/source/xml/imagesdocumenthandler.cxx | 3 | ||||
-rw-r--r-- | sc/source/core/opencl/formulagroupcl.cxx | 8 | ||||
-rw-r--r-- | sc/source/core/tool/address.cxx | 2 | ||||
-rw-r--r-- | scripting/source/basprov/basprov.cxx | 4 | ||||
-rw-r--r-- | svx/source/customshapes/EnhancedCustomShape2d.cxx | 4 | ||||
-rw-r--r-- | svx/source/customshapes/EnhancedCustomShapeEngine.cxx | 4 | ||||
-rw-r--r-- | svx/source/engine3d/float3d.cxx | 24 | ||||
-rw-r--r-- | svx/source/svdraw/svdoashp.cxx | 2 | ||||
-rw-r--r-- | svx/source/table/tablelayouter.cxx | 2 | ||||
-rw-r--r-- | sw/qa/extras/globalfilter/globalfilter.cxx | 3 | ||||
-rw-r--r-- | sw/source/core/bastyp/calc.cxx | 2 | ||||
-rw-r--r-- | sw/source/core/frmedt/feshview.cxx | 3 | ||||
-rw-r--r-- | sw/source/core/layout/trvlfrm.cxx | 3 | ||||
-rw-r--r-- | sw/source/core/text/txtfrm.cxx | 4 | ||||
-rw-r--r-- | sw/source/filter/ww8/writerwordglue.cxx | 6 | ||||
-rw-r--r-- | sw/source/uibase/app/appopt.cxx | 4 | ||||
-rw-r--r-- | vcl/source/control/button.cxx | 14 | ||||
-rw-r--r-- | vcl/source/edit/texteng.cxx | 12 | ||||
-rw-r--r-- | xmloff/source/style/chrlohdl.cxx | 2 |
20 files changed, 38 insertions, 74 deletions
diff --git a/chart2/source/model/template/StockChartTypeTemplate.cxx b/chart2/source/model/template/StockChartTypeTemplate.cxx index 33fd369aad34..3a592071169f 100644 --- a/chart2/source/model/template/StockChartTypeTemplate.cxx +++ b/chart2/source/model/template/StockChartTypeTemplate.cxx @@ -438,11 +438,7 @@ sal_Bool SAL_CALL StockChartTypeTemplate::matchesTemplate( break; } - if( xCandleStickChartType.is() && - ( ( bHasVolume && - xVolumeChartType.is() ) || - ( ! bHasVolume && - ! xVolumeChartType.is() ))) + if (xCandleStickChartType.is() && bHasVolume == xVolumeChartType.is()) { bResult = true; diff --git a/framework/source/xml/imagesdocumenthandler.cxx b/framework/source/xml/imagesdocumenthandler.cxx index f18df438ab4e..927e52627e97 100644 --- a/framework/source/xml/imagesdocumenthandler.cxx +++ b/framework/source/xml/imagesdocumenthandler.cxx @@ -147,8 +147,7 @@ void SAL_CALL OReadImagesDocumentHandler::endDocument() { SolarMutexGuard g; - if (( m_bImageContainerStartFound && !m_bImageContainerEndFound ) || - ( !m_bImageContainerStartFound && m_bImageContainerEndFound ) ) + if (m_bImageContainerStartFound != m_bImageContainerEndFound) { OUString aErrorMessage = getErrorLineString(); aErrorMessage += "No matching start or end element 'image:imagecontainer' found!"; diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index d6bfc428ccb8..0f0f5e57f134 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -1441,10 +1441,7 @@ public: { pCurDVR = static_cast<const formula::DoubleVectorRefToken*>(tmpCur); - if (! - ((!pCurDVR->IsStartFixed() && !pCurDVR->IsEndFixed()) - || (pCurDVR->IsStartFixed() && pCurDVR->IsEndFixed())) - ) + if (pCurDVR->IsStartFixed() != pCurDVR->IsEndFixed()) throw Unhandled(__FILE__, __LINE__); } } @@ -2182,8 +2179,7 @@ static DynamicKernelArgument* VectorRefFactory( const ScCalcConfig& config, cons // Window being too small to justify a parallel reduction if (pDVR->GetRefRowSize() < REDUCE_THRESHOLD) return new DynamicKernelSlidingArgument<Base>(config, s, ft, pCodeGen, index); - if ((pDVR->IsStartFixed() && pDVR->IsEndFixed()) || - (!pDVR->IsStartFixed() && !pDVR->IsEndFixed())) + if (pDVR->IsStartFixed() == pDVR->IsEndFixed()) return new ParallelReductionVectorRef<Base>(config, s, ft, pCodeGen, index); else // Other cases are not supported as well return new DynamicKernelSlidingArgument<Base>(config, s, ft, pCodeGen, index); diff --git a/sc/source/core/tool/address.cxx b/sc/source/core/tool/address.cxx index 650d3553612c..31a9c816fd5d 100644 --- a/sc/source/core/tool/address.cxx +++ b/sc/source/core/tool/address.cxx @@ -961,7 +961,7 @@ static bool isValidSingleton( ScRefFlags nFlags, ScRefFlags nFlags2 ) { bool bCols = (nFlags & ScRefFlags::COL_VALID) && ((nFlags & ScRefFlags::COL2_VALID) || (nFlags2 & ScRefFlags::COL_VALID)); bool bRows = (nFlags & ScRefFlags::ROW_VALID) && ((nFlags & ScRefFlags::ROW2_VALID) || (nFlags2 & ScRefFlags::ROW_VALID)); - return (bCols && !bRows) || (!bCols && bRows); + return bCols != bRows; } static ScRefFlags lcl_ScRange_Parse_XL_A1( ScRange& r, diff --git a/scripting/source/basprov/basprov.cxx b/scripting/source/basprov/basprov.cxx index ce71c003d75d..31fa993fcecc 100644 --- a/scripting/source/basprov/basprov.cxx +++ b/scripting/source/basprov/basprov.cxx @@ -421,8 +421,8 @@ namespace basprov bool bCreate = false; if ( m_bIsAppScriptCtx ) { - bool bShared = isLibraryShared( xLibContainer, pLibNames[i] ); - if ( ( m_bIsUserCtx && !bShared ) || ( !m_bIsUserCtx && bShared ) ) + const bool bShared = isLibraryShared( xLibContainer, pLibNames[i] ); + if (m_bIsUserCtx != bShared) bCreate = true; } else diff --git a/svx/source/customshapes/EnhancedCustomShape2d.cxx b/svx/source/customshapes/EnhancedCustomShape2d.cxx index 0cb389a9d488..307f5de5a364 100644 --- a/svx/source/customshapes/EnhancedCustomShape2d.cxx +++ b/svx/source/customshapes/EnhancedCustomShape2d.cxx @@ -1175,7 +1175,7 @@ bool EnhancedCustomShape2d::GetHandlePosition( const sal_uInt32 nIndex, Point& r if ( aGeoStat.nShearAngle ) { double nTan = aGeoStat.nTan; - if ((bFlipV&&!bFlipH )||(bFlipH&&!bFlipV)) + if (bFlipV != bFlipH) nTan = -nTan; ShearPoint( rReturnPosition, Point( aLogicRect.GetWidth() / 2, aLogicRect.GetHeight() / 2 ), nTan ); } @@ -1220,7 +1220,7 @@ bool EnhancedCustomShape2d::SetHandleControllerPosition( const sal_uInt32 nIndex if ( aGeoStat.nShearAngle ) { double nTan = -aGeoStat.nTan; - if ((bFlipV&&!bFlipH )||(bFlipH&&!bFlipV)) + if (bFlipV != bFlipH) nTan = -nTan; ShearPoint( aP, Point( aLogicRect.GetWidth() / 2, aLogicRect.GetHeight() / 2 ), nTan ); } diff --git a/svx/source/customshapes/EnhancedCustomShapeEngine.cxx b/svx/source/customshapes/EnhancedCustomShapeEngine.cxx index aebd702737a1..55b1f7f2fa27 100644 --- a/svx/source/customshapes/EnhancedCustomShapeEngine.cxx +++ b/svx/source/customshapes/EnhancedCustomShapeEngine.cxx @@ -328,7 +328,7 @@ Reference< drawing::XShape > SAL_CALL EnhancedCustomShapeEngine::render() { long nShearAngle = rGeoStat.nShearAngle; double nTan = rGeoStat.nTan; - if ((bFlipV&&!bFlipH )||(bFlipH&&!bFlipV)) + if (bFlipV != bFlipH) { nShearAngle = -nShearAngle; nTan = -nTan; @@ -429,7 +429,7 @@ drawing::PolyPolygonBezierCoords SAL_CALL EnhancedCustomShapeEngine::getLineGeom { long nShearAngle = rGeoStat.nShearAngle; double nTan = rGeoStat.nTan; - if ((bFlipV&&!bFlipH )||(bFlipH&&!bFlipV)) + if (bFlipV != bFlipH) { nShearAngle = -nShearAngle; nTan = -nTan; diff --git a/svx/source/engine3d/float3d.cxx b/svx/source/engine3d/float3d.cxx index 6df52ce4d8da..85df3f93938e 100644 --- a/svx/source/engine3d/float3d.cxx +++ b/svx/source/engine3d/float3d.cxx @@ -955,8 +955,7 @@ void Svx3DWin::Update( SfxItemSet const & rAttrs ) if( eState != SfxItemState::DONTCARE ) { bool bOn = rAttrs.Get(SDRATTR_3DSCENE_LIGHTON_1).GetValue(); - if( ( bOn && !GetUILightState(*m_pBtnLight1)) || - ( !bOn && GetUILightState(*m_pBtnLight1)) ) + if (bOn != GetUILightState(*m_pBtnLight1)) { SetUILightState(*m_pBtnLight1, bOn); bUpdate = true; @@ -1004,8 +1003,7 @@ void Svx3DWin::Update( SfxItemSet const & rAttrs ) if( eState != SfxItemState::DONTCARE ) { bool bOn = rAttrs.Get(SDRATTR_3DSCENE_LIGHTON_2).GetValue(); - if( ( bOn && !GetUILightState(*m_pBtnLight2)) || - ( !bOn && GetUILightState(*m_pBtnLight2)) ) + if (bOn != GetUILightState(*m_pBtnLight2)) { SetUILightState(*m_pBtnLight2, bOn); bUpdate = true; @@ -1053,8 +1051,7 @@ void Svx3DWin::Update( SfxItemSet const & rAttrs ) if( eState != SfxItemState::DONTCARE ) { bool bOn = rAttrs.Get(SDRATTR_3DSCENE_LIGHTON_3).GetValue(); - if( ( bOn && !GetUILightState(*m_pBtnLight3)) || - ( !bOn && GetUILightState(*m_pBtnLight3)) ) + if (bOn != GetUILightState(*m_pBtnLight3)) { SetUILightState(*m_pBtnLight3, bOn); bUpdate = true; @@ -1102,8 +1099,7 @@ void Svx3DWin::Update( SfxItemSet const & rAttrs ) if( eState != SfxItemState::DONTCARE ) { bool bOn = rAttrs.Get(SDRATTR_3DSCENE_LIGHTON_4).GetValue(); - if( ( bOn && !GetUILightState(*m_pBtnLight4)) || - ( !bOn && GetUILightState(*m_pBtnLight4)) ) + if (bOn != GetUILightState(*m_pBtnLight4)) { SetUILightState(*m_pBtnLight4, bOn); bUpdate = true; @@ -1151,8 +1147,7 @@ void Svx3DWin::Update( SfxItemSet const & rAttrs ) if( eState != SfxItemState::DONTCARE ) { bool bOn = rAttrs.Get(SDRATTR_3DSCENE_LIGHTON_5).GetValue(); - if( ( bOn && !GetUILightState(*m_pBtnLight5)) || - ( !bOn && GetUILightState(*m_pBtnLight5)) ) + if (bOn != GetUILightState(*m_pBtnLight5)) { SetUILightState(*m_pBtnLight5, bOn); bUpdate = true; @@ -1200,8 +1195,7 @@ void Svx3DWin::Update( SfxItemSet const & rAttrs ) if( eState != SfxItemState::DONTCARE ) { bool bOn = rAttrs.Get(SDRATTR_3DSCENE_LIGHTON_6).GetValue(); - if( ( bOn && !GetUILightState(*m_pBtnLight6)) || - ( !bOn && GetUILightState(*m_pBtnLight6)) ) + if (bOn != GetUILightState(*m_pBtnLight6)) { SetUILightState(*m_pBtnLight6, bOn); bUpdate = true; @@ -1249,8 +1243,7 @@ void Svx3DWin::Update( SfxItemSet const & rAttrs ) if( eState != SfxItemState::DONTCARE ) { bool bOn = rAttrs.Get(SDRATTR_3DSCENE_LIGHTON_7).GetValue(); - if( ( bOn && !GetUILightState(*m_pBtnLight7)) || - ( !bOn && GetUILightState(*m_pBtnLight7)) ) + if (bOn != GetUILightState(*m_pBtnLight7)) { SetUILightState(*m_pBtnLight7 , bOn); bUpdate = true; @@ -1298,8 +1291,7 @@ void Svx3DWin::Update( SfxItemSet const & rAttrs ) if( eState != SfxItemState::DONTCARE ) { bool bOn = rAttrs.Get(SDRATTR_3DSCENE_LIGHTON_8).GetValue(); - if( ( bOn && !GetUILightState(*m_pBtnLight8)) || - ( !bOn && GetUILightState(*m_pBtnLight8)) ) + if (bOn != GetUILightState(*m_pBtnLight8)) { SetUILightState(*m_pBtnLight8, bOn); bUpdate = true; diff --git a/svx/source/svdraw/svdoashp.cxx b/svx/source/svdraw/svdoashp.cxx index f1ac0921dac3..9bacffb665c7 100644 --- a/svx/source/svdraw/svdoashp.cxx +++ b/svx/source/svdraw/svdoashp.cxx @@ -1728,7 +1728,7 @@ void SdrObjCustomShape::ImpCheckCustomGluePointsAreAdded() sal_Int32 nXDiff = aBoundRect.Left() - maRect.Left(); sal_Int32 nYDiff = aBoundRect.Top() - maRect.Top(); - if (nShearAngle&&((bMirroredX&&!bMirroredY)||(bMirroredY&&!bMirroredX))) + if (nShearAngle && bMirroredX != bMirroredY) { nShearAngle = -nShearAngle; fTan = -fTan; diff --git a/svx/source/table/tablelayouter.cxx b/svx/source/table/tablelayouter.cxx index 8231eaf9f7c4..076a0f6ed40a 100644 --- a/svx/source/table/tablelayouter.cxx +++ b/svx/source/table/tablelayouter.cxx @@ -735,7 +735,7 @@ void TableLayouter::LayoutTableHeight( tools::Rectangle& rArea, bool bFit ) else { bool bCellHasText = xCell->hasText(); - if ( (!bRowHasText && !bCellHasText) || ( bRowHasText && bCellHasText ) ) + if (bRowHasText == bCellHasText) { nMinHeight = std::max( nMinHeight, xCell->getMinimumHeight() ); } diff --git a/sw/qa/extras/globalfilter/globalfilter.cxx b/sw/qa/extras/globalfilter/globalfilter.cxx index 5c935a97ac56..f9a6a60df823 100644 --- a/sw/qa/extras/globalfilter/globalfilter.cxx +++ b/sw/qa/extras/globalfilter/globalfilter.cxx @@ -287,8 +287,7 @@ static uno::Reference<drawing::XShape> lcl_getShape(const uno::Reference<lang::X { Graphic aGraphic(xGraphic); - if ((bEmbedded && aGraphic.getOriginURL().isEmpty()) || - (!bEmbedded && !aGraphic.getOriginURL().isEmpty())) + if (bEmbedded == aGraphic.getOriginURL().isEmpty()) { xShape.set(xShapeProperties, uno::UNO_QUERY); return xShape; diff --git a/sw/source/core/bastyp/calc.cxx b/sw/source/core/bastyp/calc.cxx index 050bf145d995..06e22ce090de 100644 --- a/sw/source/core/bastyp/calc.cxx +++ b/sw/source/core/bastyp/calc.cxx @@ -859,7 +859,7 @@ SwSbxValue SwCalc::Term() GetToken(); bool bR = Prim().GetBool(); bool bL = left.GetBool(); - left.PutBool( (bL && !bR) || (!bL && bR) ); + left.PutBool(bL != bR); } break; diff --git a/sw/source/core/frmedt/feshview.cxx b/sw/source/core/frmedt/feshview.cxx index 8d2888ee166e..1a85c3aec296 100644 --- a/sw/source/core/frmedt/feshview.cxx +++ b/sw/source/core/frmedt/feshview.cxx @@ -1393,8 +1393,7 @@ bool SwFEShell::ShouldObjectBeSelected(const Point& rPt) { const SwPosition& rPos = pContact->GetContentAnchor(); bool bInHdrFtr = GetDoc()->IsInHeaderFooter( rPos.nNode ); - if ( ( IsHeaderFooterEdit() && !bInHdrFtr ) || - ( !IsHeaderFooterEdit() && bInHdrFtr ) ) + if (IsHeaderFooterEdit() != bInHdrFtr) { bRet = false; } diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx index 8ca24da7f0ae..5a5da9abc580 100644 --- a/sw/source/core/layout/trvlfrm.cxx +++ b/sw/source/core/layout/trvlfrm.cxx @@ -67,8 +67,7 @@ namespace { const SvxOpaqueItem& rOpaque = pAnchoredObj->GetFrameFormat().GetOpaque(); bool bInBackground = ( rSurround.GetSurround() == css::text::WrapTextMode_THROUGH ) && !rOpaque.GetValue(); - bool bBackgroundMatches = ( bInBackground && bSearchBackground ) || - ( !bInBackground && !bSearchBackground ); + bool bBackgroundMatches = bInBackground == bSearchBackground; const SwFlyFrame* pFly = pObj ? pObj->GetFlyFrame() : nullptr; if ( pFly && bBackgroundMatches && diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx index fb3504d86da8..b6b51c9c713b 100644 --- a/sw/source/core/text/txtfrm.cxx +++ b/sw/source/core/text/txtfrm.cxx @@ -501,9 +501,7 @@ long SwTextFrame::SwitchVerticalToHorizontal( long nLimit ) const SwFrameSwapper::SwFrameSwapper( const SwTextFrame* pTextFrame, bool bSwapIfNotSwapped ) : pFrame( pTextFrame ), bUndo( false ) { - if ( pFrame->IsVertical() && - ( ( bSwapIfNotSwapped && ! pFrame->IsSwapped() ) || - ( ! bSwapIfNotSwapped && pFrame->IsSwapped() ) ) ) + if (pFrame->IsVertical() && bSwapIfNotSwapped != pFrame->IsSwapped()) { bUndo = true; const_cast<SwTextFrame*>(pFrame)->SwapWidthAndHeight(); diff --git a/sw/source/filter/ww8/writerwordglue.cxx b/sw/source/filter/ww8/writerwordglue.cxx index c34e9f6e3e06..b803a43a1329 100644 --- a/sw/source/filter/ww8/writerwordglue.cxx +++ b/sw/source/filter/ww8/writerwordglue.cxx @@ -433,8 +433,7 @@ namespace sw { // Check top only if both object have a header or if // both object don't have a header - if ( ( HasHeader() && rOther.HasHeader() ) || - ( !HasHeader() && !rOther.HasHeader() ) ) + if (HasHeader() == rOther.HasHeader()) { if (dyaTop != rOther.dyaTop) return false; @@ -442,8 +441,7 @@ namespace sw // Check bottom only if both object have a footer or if // both object don't have a footer - if ( ( HasFooter() && rOther.HasFooter() ) || - ( !HasFooter() && !rOther.HasFooter() ) ) + if (HasFooter() == rOther.HasFooter()) { if (dyaBottom != rOther.dyaBottom) return false; diff --git a/sw/source/uibase/app/appopt.cxx b/sw/source/uibase/app/appopt.cxx index 17bf33292a4c..2da5febfa372 100644 --- a/sw/source/uibase/app/appopt.cxx +++ b/sw/source/uibase/app/appopt.cxx @@ -86,9 +86,9 @@ std::unique_ptr<SfxItemSet> SwModule::CreateItemSet( sal_uInt16 nId ) pAppView = nullptr; if(pAppView) { - // if Text then no WebView and vice versa bool bWebView = dynamic_cast<SwWebView*>( pAppView ) != nullptr; - if( (bWebView && !bTextDialog) ||(!bWebView && bTextDialog)) + // if Text then no WebView and vice versa + if (bWebView != bTextDialog) { aViewOpt = *pAppView->GetWrtShell().GetViewOptions(); } diff --git a/vcl/source/control/button.cxx b/vcl/source/control/button.cxx index d81565a68666..52fe3b483573 100644 --- a/vcl/source/control/button.cxx +++ b/vcl/source/control/button.cxx @@ -2596,11 +2596,8 @@ bool RadioButton::PreNotify( NotifyEvent& rNEvt ) // trigger redraw if mouse over state has changed if( IsNativeControlSupported(ControlType::Radiobutton, ControlPart::Entire) ) { - if( ( maMouseRect.IsInside( GetPointerPosPixel()) && - !maMouseRect.IsInside( GetLastPointerPosPixel()) ) || - ( maMouseRect.IsInside( GetLastPointerPosPixel()) && - !maMouseRect.IsInside( GetPointerPosPixel()) ) || - pMouseEvt->IsLeaveWindow() || pMouseEvt->IsEnterWindow() ) + if (maMouseRect.IsInside(GetPointerPosPixel()) != maMouseRect.IsInside(GetLastPointerPosPixel()) || + pMouseEvt->IsLeaveWindow() || pMouseEvt->IsEnterWindow()) { Invalidate( maStateRect ); } @@ -3495,11 +3492,8 @@ bool CheckBox::PreNotify( NotifyEvent& rNEvt ) // trigger redraw if mouse over state has changed if( IsNativeControlSupported(ControlType::Checkbox, ControlPart::Entire) ) { - if( ( maMouseRect.IsInside( GetPointerPosPixel()) && - !maMouseRect.IsInside( GetLastPointerPosPixel()) ) || - ( maMouseRect.IsInside( GetLastPointerPosPixel()) && - !maMouseRect.IsInside( GetPointerPosPixel()) ) || - pMouseEvt->IsLeaveWindow() || pMouseEvt->IsEnterWindow() ) + if (maMouseRect.IsInside(GetPointerPosPixel()) != maMouseRect.IsInside(GetLastPointerPosPixel()) || + pMouseEvt->IsLeaveWindow() || pMouseEvt->IsEnterWindow()) { Invalidate( maStateRect ); } diff --git a/vcl/source/edit/texteng.cxx b/vcl/source/edit/texteng.cxx index 08e1ba46212e..fd38f2413c57 100644 --- a/vcl/source/edit/texteng.cxx +++ b/vcl/source/edit/texteng.cxx @@ -943,11 +943,8 @@ long TextEngine::ImpGetXPos( sal_uInt32 nPara, TextLine* pLine, sal_Int32 nIndex if ( ( pPortion->GetKind() == PORTIONKIND_TAB ) && ( (nTextPortion+1) < pParaPortion->GetTextPortions().size() ) ) { TETextPortion* pNextPortion = pParaPortion->GetTextPortions()[ nTextPortion+1 ]; - if ( ( pNextPortion->GetKind() != PORTIONKIND_TAB ) && ( - ( !IsRightToLeft() && pNextPortion->IsRightToLeft() ) || - ( IsRightToLeft() && !pNextPortion->IsRightToLeft() ) ) ) + if (pNextPortion->GetKind() != PORTIONKIND_TAB && IsRightToLeft() != pNextPortion->IsRightToLeft()) { -// nX += pNextPortion->GetWidth(); // End of the tab portion, use start of next for cursor pos SAL_WARN_IF( bPreferPortionStart, "vcl", "ImpGetXPos: How can we get here!" ); nX = ImpGetXPos( nPara, pLine, nIndex, true ); @@ -962,8 +959,7 @@ long TextEngine::ImpGetXPos( sal_uInt32 nPara, TextLine* pLine, sal_Int32 nIndex long nPosInPortion = CalcTextWidth( nPara, nTextPortionStart, nIndex-nTextPortionStart ); - if ( ( !IsRightToLeft() && !pPortion->IsRightToLeft() ) || - ( IsRightToLeft() && pPortion->IsRightToLeft() ) ) + if (IsRightToLeft() == pPortion->IsRightToLeft()) { nX += nPosInPortion; } @@ -975,9 +971,7 @@ long TextEngine::ImpGetXPos( sal_uInt32 nPara, TextLine* pLine, sal_Int32 nIndex } else // if ( nIndex == pLine->GetStart() ) { - if ( ( pPortion->GetKind() != PORTIONKIND_TAB ) && - ( ( !IsRightToLeft() && pPortion->IsRightToLeft() ) || - ( IsRightToLeft() && !pPortion->IsRightToLeft() ) ) ) + if (pPortion->GetKind() != PORTIONKIND_TAB && IsRightToLeft() != pPortion->IsRightToLeft()) { nX += nPortionTextWidth; } diff --git a/xmloff/source/style/chrlohdl.cxx b/xmloff/source/style/chrlohdl.cxx index 2c1ffc2e0f7b..3225b4371801 100644 --- a/xmloff/source/style/chrlohdl.cxx +++ b/xmloff/source/style/chrlohdl.cxx @@ -147,7 +147,7 @@ bool XMLCharScriptHdl::equals( const css::uno::Any& r1, const css::uno::Any& r2 bool bEmptyVariant2 = aLocale2.Variant.isEmpty(); if (bEmptyVariant1 && bEmptyVariant2) bRet = true; - else if ((bEmptyVariant1 && !bEmptyVariant2) || (!bEmptyVariant1 && bEmptyVariant2)) + else if (bEmptyVariant1 != bEmptyVariant2) ; // stays false else { |